UNPKG

@opensig/opendesign

Version:

176 lines (175 loc) 4.28 kB
import "../table/index.mjs"; import { tableProps } from "../table/types.mjs"; const DataTableSizes = ["medium", "small"]; const DataTableHeaderStyles = ["fill", "split-line"]; const DataTableSortModes = ["single", "multiple"]; const DataTableFixedTypes = [true, "left", "right"]; const TABLE_EMPTY_OPTION_VALUE = "__null__"; const TABLE_ALL_OPTION_VALUE = "__all__"; const { emptyLabel, loading, loadingLabel, border, stripe, highlightCurrentRow } = tableProps; const dataTableProps = { /** * @zh-CN 表格数据 * @en-US Table data */ data: { type: Array, required: true }, /** * @zh-CN 列配置, IOS端不支持多列固定 * @en-US Table column schema, not support multi-column fixed in IOS */ columns: { type: Array, required: true }, /** * @zh-CN 表格尺寸 * @en-US table size */ size: { type: String, default: "medium" }, /** * @zh-CN 表格高度,超出时固定表头滚动 * @en-US Table Height: Fixed Header with Scrollable Body When Exceeding Height */ height: { type: [Number, String] }, /** * @zh-CN 表格最大高度,超出时固定表头滚动 * @en-US Table Max Height: Fixed Header with Scrollable Body When Exceeding Height */ maxHeight: { type: [Number, String], default: "fit-content" }, /** * @zh-CN 内部table元素最小宽度,超出时出现横向滚动条 * @en-US min-width of the inner table element; a horizontal scrollbar will appear when it exceeds the available width. */ minTableWidth: { type: [Number, String] }, /** * @zh-CN 表格数据行唯一标识字段名 * @en-US Unique Identifier Field Name for Table Data Rows */ rowKey: { type: [String, Function], default: "id" }, /** * @zh-CN 合并单元格的计算方法,已被合并的单元格不会再次被合并 * @en-US Calculation Methods for Merged Cells. Cells that have already been merged cannot be merged again */ spanMethod: { type: Function, default: () => () => void 0 }, /** * @zh-CN 是否展示header * @en-US Whether to show the header. * @since 1.2.2 */ showHeader: { type: Boolean, default: true }, /** * @zh-CN 表头风格 * @en-US table header style * @since 1.2.2 */ headerStyle: { type: String, default: "fill" }, /** * @zh-CN 排序模式,single 为单条件排序,multiple 为多条件排序 * @en-US Sort mode, 'single' for single-condition sort, 'multiple' for multi-condition sort * @since 1.2.5 */ sortMode: { type: String, default: "single" }, /** * @zh-CN 行展开的计算方法,返回 `false` 则不可被展开 * @en-US Calculation Methods for Row expansion. Returns `false` if the row cannot be expanded. * @since 1.2.2 */ expandMethod: { type: Function }, /** * @zh-CN 表格是否可以调整列宽 * @en-US Resize column width */ columnResizable: { type: Boolean, default: false }, /** * @zh-CN 表格是否可以行选择 * @en-US Whether row selection is available for the table. * @since 1.2.2 */ selection: { type: Boolean, default: false }, /** * @zh-CN 选择时指示行是否可被选择的键名 * @en-US Key name for indicating row selectability during selection * @since 1.2.2 */ disabledProp: { type: String, default: "disabled" }, /** * @zh-CN 树形表格选择时是否遵循父子不关联 * @en-US Whether to disable parent-child association in tree table selection * @since 1.2.2 */ checkStrictly: { type: Boolean, default: true }, stripe, border, /** * @zh-CN 单元格为空时的展示文案,默认为 '--' * @en-US Render text when cell value is empty */ defaultEmptyCellText: { type: String, default: "--" }, emptyLabel, loading, loadingLabel, highlightCurrentRow }; const DataTableSortMethod = { /** 升序排序 */ ASC: 1, /** 降序排序 */ DESC: -1, /** 不排序 */ NA: void 0 }; export { DataTableFixedTypes, DataTableHeaderStyles, DataTableSizes, DataTableSortMethod, DataTableSortModes, TABLE_ALL_OPTION_VALUE, TABLE_EMPTY_OPTION_VALUE, dataTableProps };