@element-plus/nightly 0.0.20220104 → 0.0.20220105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.full.js +392 -408
- package/dist/index.full.min.js +8 -8
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +8 -8
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +392 -408
- package/es/components/index.mjs +1 -1
- package/es/components/skeleton/index.mjs +2 -2
- package/es/components/skeleton/src/skeleton.mjs +5 -24
- package/es/components/skeleton/src/skeleton.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.vue_vue_type_script_lang.mjs +1 -1
- package/es/components/skeleton/src/skeleton2.mjs +24 -5
- package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
- package/es/components/table/index.d.ts +9 -0
- package/es/components/table/src/table/style-helper.d.ts +7 -0
- package/es/components/table/src/table/style-helper.mjs +20 -17
- package/es/components/table/src/table/style-helper.mjs.map +1 -1
- package/es/components/table/src/table-body/index.mjs +5 -3
- package/es/components/table/src/table-body/index.mjs.map +1 -1
- package/es/components/table/src/table-body/styles-helper.d.ts +0 -1
- package/es/components/table/src/table-body/styles-helper.mjs +10 -17
- package/es/components/table/src/table-body/styles-helper.mjs.map +1 -1
- package/es/components/table/src/table-column/defaults.d.ts +1 -0
- package/es/components/table/src/table-column/defaults.mjs.map +1 -1
- package/es/components/table/src/table-column/index.mjs +1 -0
- package/es/components/table/src/table-column/index.mjs.map +1 -1
- package/es/components/table/src/table-footer/index.d.ts +4 -2
- package/es/components/table/src/table-footer/index.mjs +33 -18
- package/es/components/table/src/table-footer/index.mjs.map +1 -1
- package/es/components/table/src/table-footer/style-helper.d.ts +4 -2
- package/es/components/table/src/table-footer/style-helper.mjs +28 -31
- package/es/components/table/src/table-footer/style-helper.mjs.map +1 -1
- package/es/components/table/src/table-header/index.d.ts +3 -2
- package/es/components/table/src/table-header/index.mjs +89 -51
- package/es/components/table/src/table-header/index.mjs.map +1 -1
- package/es/components/table/src/table-header/style.helper.d.ts +1 -1
- package/es/components/table/src/table-header/style.helper.mjs +14 -24
- package/es/components/table/src/table-header/style.helper.mjs.map +1 -1
- package/es/components/table/src/table-header/utils-helper.mjs +1 -0
- package/es/components/table/src/table-header/utils-helper.mjs.map +1 -1
- package/es/components/table/src/table-layout.d.ts +1 -0
- package/es/components/table/src/table-layout.mjs +7 -1
- package/es/components/table/src/table-layout.mjs.map +1 -1
- package/es/components/table/src/table.vue.d.ts +9 -0
- package/es/components/table/src/table.vue_vue_type_script_lang.mjs +12 -2
- package/es/components/table/src/table.vue_vue_type_script_lang.mjs.map +1 -1
- package/es/components/table/src/table.vue_vue_type_template_id_4a1660ad_lang.mjs +62 -213
- package/es/components/table/src/table.vue_vue_type_template_id_4a1660ad_lang.mjs.map +1 -1
- package/es/components/table/src/util.d.ts +14 -0
- package/es/components/table/src/util.mjs +90 -1
- package/es/components/table/src/util.mjs.map +1 -1
- package/es/index.mjs +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/skeleton/index.js +2 -2
- package/lib/components/skeleton/src/skeleton.js +5 -23
- package/lib/components/skeleton/src/skeleton.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.vue_vue_type_script_lang.js +1 -1
- package/lib/components/skeleton/src/skeleton2.js +23 -5
- package/lib/components/skeleton/src/skeleton2.js.map +1 -1
- package/lib/components/table/index.d.ts +9 -0
- package/lib/components/table/src/table/style-helper.d.ts +7 -0
- package/lib/components/table/src/table/style-helper.js +20 -21
- package/lib/components/table/src/table/style-helper.js.map +1 -1
- package/lib/components/table/src/table-body/index.js +5 -3
- package/lib/components/table/src/table-body/index.js.map +1 -1
- package/lib/components/table/src/table-body/styles-helper.d.ts +0 -1
- package/lib/components/table/src/table-body/styles-helper.js +10 -17
- package/lib/components/table/src/table-body/styles-helper.js.map +1 -1
- package/lib/components/table/src/table-column/defaults.d.ts +1 -0
- package/lib/components/table/src/table-column/defaults.js.map +1 -1
- package/lib/components/table/src/table-column/index.js +1 -0
- package/lib/components/table/src/table-column/index.js.map +1 -1
- package/lib/components/table/src/table-footer/index.d.ts +4 -2
- package/lib/components/table/src/table-footer/index.js +32 -17
- package/lib/components/table/src/table-footer/index.js.map +1 -1
- package/lib/components/table/src/table-footer/style-helper.d.ts +4 -2
- package/lib/components/table/src/table-footer/style-helper.js +28 -31
- package/lib/components/table/src/table-footer/style-helper.js.map +1 -1
- package/lib/components/table/src/table-header/index.d.ts +3 -2
- package/lib/components/table/src/table-header/index.js +89 -51
- package/lib/components/table/src/table-header/index.js.map +1 -1
- package/lib/components/table/src/table-header/style.helper.d.ts +1 -1
- package/lib/components/table/src/table-header/style.helper.js +14 -24
- package/lib/components/table/src/table-header/style.helper.js.map +1 -1
- package/lib/components/table/src/table-header/utils-helper.js +1 -0
- package/lib/components/table/src/table-header/utils-helper.js.map +1 -1
- package/lib/components/table/src/table-layout.d.ts +1 -0
- package/lib/components/table/src/table-layout.js +7 -1
- package/lib/components/table/src/table-layout.js.map +1 -1
- package/lib/components/table/src/table.vue.d.ts +9 -0
- package/lib/components/table/src/table.vue_vue_type_script_lang.js +12 -2
- package/lib/components/table/src/table.vue_vue_type_script_lang.js.map +1 -1
- package/lib/components/table/src/table.vue_vue_type_template_id_4a1660ad_lang.js +62 -213
- package/lib/components/table/src/table.vue_vue_type_template_id_4a1660ad_lang.js.map +1 -1
- package/lib/components/table/src/util.d.ts +14 -0
- package/lib/components/table/src/util.js +95 -0
- package/lib/components/table/src/util.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/theme-chalk/el-table.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/table.scss +176 -124
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.helper.mjs","sources":["../../../../../../../packages/components/table/src/table-header/style.helper.ts"],"sourcesContent":["import { getCurrentInstance } from 'vue'\n\nimport type { TableColumnCtx } from '../table-column/defaults'\nimport type { Table } from '../table/defaults'\nimport type { TableHeaderProps } from '.'\n\nfunction useStyle<T>(props: TableHeaderProps<T>) {\n const instance = getCurrentInstance()\n const parent = instance.parent as Table<T>\n
|
|
1
|
+
{"version":3,"file":"style.helper.mjs","sources":["../../../../../../../packages/components/table/src/table-header/style.helper.ts"],"sourcesContent":["import { getCurrentInstance } from 'vue'\nimport {\n getFixedColumnsClass,\n getFixedColumnOffset,\n ensurePosition,\n ensureRightFixedStyle,\n} from '../util'\nimport type { TableColumnCtx } from '../table-column/defaults'\nimport type { Table } from '../table/defaults'\nimport type { TableHeaderProps } from '.'\n\nfunction useStyle<T>(props: TableHeaderProps<T>) {\n const instance = getCurrentInstance()\n const parent = instance.parent as Table<T>\n\n const getHeaderRowStyle = (rowIndex: number) => {\n const headerRowStyle = parent.props.headerRowStyle\n if (typeof headerRowStyle === 'function') {\n return headerRowStyle.call(null, { rowIndex })\n }\n return headerRowStyle\n }\n\n const getHeaderRowClass = (rowIndex: number): string => {\n const classes = []\n const headerRowClassName = parent.props.headerRowClassName\n if (typeof headerRowClassName === 'string') {\n classes.push(headerRowClassName)\n } else if (typeof headerRowClassName === 'function') {\n classes.push(headerRowClassName.call(null, { rowIndex }))\n }\n\n return classes.join(' ')\n }\n\n const getHeaderCellStyle = (\n rowIndex: number,\n columnIndex: number,\n row: T,\n column: TableColumnCtx<T>,\n hasGutter: boolean\n ) => {\n let headerCellStyles = parent.props.headerCellStyle ?? {}\n if (typeof headerCellStyles === 'function') {\n headerCellStyles = headerCellStyles.call(null, {\n rowIndex,\n columnIndex,\n row,\n column,\n })\n }\n const fixedStyle = getFixedColumnOffset<T>(\n columnIndex,\n column.fixed,\n props.store,\n row as unknown as TableColumnCtx<T>[]\n )\n ensureRightFixedStyle(fixedStyle, hasGutter)\n ensurePosition(fixedStyle, 'left')\n ensurePosition(fixedStyle, 'right')\n return Object.assign({}, headerCellStyles, fixedStyle)\n }\n\n const getHeaderCellClass = (\n rowIndex: number,\n columnIndex: number,\n row: T,\n column: TableColumnCtx<T>\n ) => {\n const fixedClasses = column.isSubColumn\n ? []\n : getFixedColumnsClass<T>(\n columnIndex,\n column.fixed,\n props.store,\n row as unknown as TableColumnCtx<T>[]\n )\n const classes = [\n column.id,\n column.order,\n column.headerAlign,\n column.className,\n column.labelClassName,\n ...fixedClasses,\n ]\n\n if (!column.children) {\n classes.push('is-leaf')\n }\n\n if (column.sortable) {\n classes.push('is-sortable')\n }\n\n const headerCellClassName = parent.props.headerCellClassName\n if (typeof headerCellClassName === 'string') {\n classes.push(headerCellClassName)\n } else if (typeof headerCellClassName === 'function') {\n classes.push(\n headerCellClassName.call(null, {\n rowIndex,\n columnIndex,\n row,\n column,\n })\n )\n }\n\n classes.push('el-table__cell')\n\n return classes.join(' ')\n }\n\n return {\n getHeaderRowStyle,\n getHeaderRowClass,\n getHeaderCellStyle,\n getHeaderCellClass,\n }\n}\n\nexport default useStyle\n"],"names":[],"mappings":";;;AAOA,SAAS,QAAQ,CAAC,KAAK,EAAE;AACzB,EAAE,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;AACxC,EAAE,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;AACjC,EAAE,MAAM,iBAAiB,GAAG,CAAC,QAAQ,KAAK;AAC1C,IAAI,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;AACvD,IAAI,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE;AAC9C,MAAM,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;AACrD,KAAK;AACL,IAAI,OAAO,cAAc,CAAC;AAC1B,GAAG,CAAC;AACJ,EAAE,MAAM,iBAAiB,GAAG,CAAC,QAAQ,KAAK;AA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,KAAK;AACL,IAAI,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACnC,IAAI,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7B,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,iBAAiB;AACrB,IAAI,iBAAiB;AACrB,IAAI,kBAAkB;AACtB,IAAI,kBAAkB;AACtB,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-helper.mjs","sources":["../../../../../../../packages/components/table/src/table-header/utils-helper.ts"],"sourcesContent":["import { getCurrentInstance, computed } from 'vue'\n\nimport type { TableColumnCtx } from '../table-column/defaults'\nimport type { Table } from '../table/defaults'\nimport type { TableHeaderProps } from '.'\n\nconst getAllColumns = <T>(\n columns: TableColumnCtx<T>[]\n): TableColumnCtx<T>[] => {\n const result = []\n columns.forEach((column) => {\n if (column.children) {\n result.push(column)\n // eslint-disable-next-line prefer-spread\n result.push.apply(result, getAllColumns(column.children))\n } else {\n result.push(column)\n }\n })\n return result\n}\n\nconst convertToRows = <T>(\n originColumns: TableColumnCtx<T>[]\n): TableColumnCtx<T>[] => {\n let maxLevel = 1\n const traverse = (column: TableColumnCtx<T>, parent: TableColumnCtx<T>) => {\n if (parent) {\n column.level = parent.level + 1\n if (maxLevel < column.level) {\n maxLevel = column.level\n }\n }\n if (column.children) {\n let colSpan = 0\n column.children.forEach((subColumn) => {\n traverse(subColumn, column)\n colSpan += subColumn.colSpan\n })\n column.colSpan = colSpan\n } else {\n column.colSpan = 1\n }\n }\n\n originColumns.forEach((column) => {\n column.level = 1\n traverse(column, undefined)\n })\n\n const rows = []\n for (let i = 0; i < maxLevel; i++) {\n rows.push([])\n }\n\n const allColumns = getAllColumns(originColumns)\n\n allColumns.forEach((column) => {\n if (!column.children) {\n column.rowSpan = maxLevel - column.level + 1\n } else {\n column.rowSpan = 1\n }\n rows[column.level - 1].push(column)\n })\n\n return rows\n}\n\nfunction useUtils<T>(props: TableHeaderProps<T>) {\n const instance = getCurrentInstance()\n const parent = instance.parent as Table<T>\n const columnRows = computed(() => {\n return convertToRows(props.store.states.originColumns.value)\n })\n const isGroup = computed(() => {\n const result = columnRows.value.length > 1\n if (result) parent.state.isGroup.value = true\n return result\n })\n const toggleAllSelection = (event: Event) => {\n event.stopPropagation()\n parent.store.commit('toggleAllSelection')\n }\n return {\n isGroup,\n toggleAllSelection,\n columnRows,\n }\n}\n\nexport default useUtils\n"],"names":[],"mappings":";;AACA,MAAM,aAAa,GAAG,CAAC,OAAO,KAAK;AACnC,EAAE,MAAM,MAAM,GAAG,EAAE,CAAC;AACpB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK;AAC9B,IAAI,IAAI,MAAM,CAAC,QAAQ,EAAE;AACzB,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAChE,KAAK,MAAM;AACX,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AACF,MAAM,aAAa,GAAG,CAAC,aAAa,KAAK;AACzC,EAAE,IAAI,QAAQ,GAAG,CAAC,CAAC;AACnB,EAAE,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK;AACvC,IAAI,IAAI,MAAM,EAAE;AAChB,MAAM,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;AACtC,MAAM,IAAI,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE;AACnC,QAAQ,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;AAChC,OAAO;AACP,KAAK;AACL,IAAI,IAAI,MAAM,CAAC,QAA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AE,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AACF,SAAS,QAAQ,CAAC,KAAK,EAAE;AACzB,EAAE,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;AACxC,EAAE,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;AACjC,EAAE,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM;AACpC,IAAI,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACjE,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM;AACjC,IAAI,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAC/C,IAAI,IAAI,MAAM;AACd,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;AACxC,IAAI,OAAO,MAAM,CAAC;AAClB,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,kBAAkB,GAAG,CAAC,KAAK,KAAK;AACxC,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;AAC5B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAC9C,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,OAAO;AACX,IAAI,kBAAkB;AACtB,IAAI,UAAU;AACd,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"utils-helper.mjs","sources":["../../../../../../../packages/components/table/src/table-header/utils-helper.ts"],"sourcesContent":["import { getCurrentInstance, computed } from 'vue'\n\nimport type { TableColumnCtx } from '../table-column/defaults'\nimport type { Table } from '../table/defaults'\nimport type { TableHeaderProps } from '.'\n\nconst getAllColumns = <T>(\n columns: TableColumnCtx<T>[]\n): TableColumnCtx<T>[] => {\n const result = []\n columns.forEach((column) => {\n if (column.children) {\n result.push(column)\n // eslint-disable-next-line prefer-spread\n result.push.apply(result, getAllColumns(column.children))\n } else {\n result.push(column)\n }\n })\n return result\n}\n\nconst convertToRows = <T>(\n originColumns: TableColumnCtx<T>[]\n): TableColumnCtx<T>[] => {\n let maxLevel = 1\n const traverse = (column: TableColumnCtx<T>, parent: TableColumnCtx<T>) => {\n if (parent) {\n column.level = parent.level + 1\n if (maxLevel < column.level) {\n maxLevel = column.level\n }\n }\n if (column.children) {\n let colSpan = 0\n column.children.forEach((subColumn) => {\n traverse(subColumn, column)\n colSpan += subColumn.colSpan\n })\n column.colSpan = colSpan\n } else {\n column.colSpan = 1\n }\n }\n\n originColumns.forEach((column) => {\n column.level = 1\n traverse(column, undefined)\n })\n\n const rows = []\n for (let i = 0; i < maxLevel; i++) {\n rows.push([])\n }\n\n const allColumns = getAllColumns(originColumns)\n\n allColumns.forEach((column) => {\n if (!column.children) {\n column.rowSpan = maxLevel - column.level + 1\n } else {\n column.rowSpan = 1\n column.children.forEach((col) => (col.isSubColumn = true))\n }\n rows[column.level - 1].push(column)\n })\n\n return rows\n}\n\nfunction useUtils<T>(props: TableHeaderProps<T>) {\n const instance = getCurrentInstance()\n const parent = instance.parent as Table<T>\n const columnRows = computed(() => {\n return convertToRows(props.store.states.originColumns.value)\n })\n const isGroup = computed(() => {\n const result = columnRows.value.length > 1\n if (result) parent.state.isGroup.value = true\n return result\n })\n const toggleAllSelection = (event: Event) => {\n event.stopPropagation()\n parent.store.commit('toggleAllSelection')\n }\n return {\n isGroup,\n toggleAllSelection,\n columnRows,\n }\n}\n\nexport default useUtils\n"],"names":[],"mappings":";;AACA,MAAM,aAAa,GAAG,CAAC,OAAO,KAAK;AACnC,EAAE,MAAM,MAAM,GAAG,EAAE,CAAC;AACpB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK;AAC9B,IAAI,IAAI,MAAM,CAAC,QAAQ,EAAE;AACzB,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,MAAM,MAAM,CAAC,I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AC;AAC/C,IAAI,IAAI,MAAM;AACd,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;AACxC,IAAI,OAAO,MAAM,CAAC;AAClB,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,kBAAkB,GAAG,CAAC,KAAK,KAAK;AACxC,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;AAC5B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAC9C,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,OAAO;AACX,IAAI,kBAAkB;AACtB,IAAI,UAAU;AACd,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -22,6 +22,7 @@ declare class TableLayout<T> {
|
|
|
22
22
|
footerHeight: Ref<null | number>;
|
|
23
23
|
viewportHeight: Ref<null | number>;
|
|
24
24
|
bodyHeight: Ref<null | number>;
|
|
25
|
+
bodyScrollHeight: Ref<number>;
|
|
25
26
|
fixedBodyHeight: Ref<null | number>;
|
|
26
27
|
gutterWidth: number;
|
|
27
28
|
constructor(options: Record<string, any>);
|
|
@@ -24,6 +24,7 @@ class TableLayout {
|
|
|
24
24
|
this.footerHeight = ref(44);
|
|
25
25
|
this.viewportHeight = ref(null);
|
|
26
26
|
this.bodyHeight = ref(null);
|
|
27
|
+
this.bodyScrollHeight = ref(0);
|
|
27
28
|
this.fixedBodyHeight = ref(null);
|
|
28
29
|
this.gutterWidth = scrollbarWidth();
|
|
29
30
|
for (const name in options) {
|
|
@@ -93,9 +94,10 @@ class TableLayout {
|
|
|
93
94
|
return flattenColumns;
|
|
94
95
|
}
|
|
95
96
|
updateElsHeight() {
|
|
97
|
+
var _a;
|
|
96
98
|
if (!this.table.$ready)
|
|
97
99
|
return nextTick(() => this.updateElsHeight());
|
|
98
|
-
const { headerWrapper, appendWrapper, footerWrapper } = this.table.refs;
|
|
100
|
+
const { headerWrapper, appendWrapper, footerWrapper, bodyWrapper } = this.table.refs;
|
|
99
101
|
this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0;
|
|
100
102
|
if (this.showHeader && !headerWrapper)
|
|
101
103
|
return;
|
|
@@ -108,7 +110,11 @@ class TableLayout {
|
|
|
108
110
|
const tableHeight = this.tableHeight.value = this.table.vnode.el.clientHeight;
|
|
109
111
|
const footerHeight = this.footerHeight.value = footerWrapper ? footerWrapper.offsetHeight : 0;
|
|
110
112
|
if (this.height.value !== null) {
|
|
113
|
+
if (this.bodyHeight.value === null) {
|
|
114
|
+
requestAnimationFrame(() => this.updateElsHeight());
|
|
115
|
+
}
|
|
111
116
|
this.bodyHeight.value = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
|
|
117
|
+
this.bodyScrollHeight.value = (_a = bodyWrapper.querySelector(".el-table__body")) == null ? void 0 : _a.scrollHeight;
|
|
112
118
|
}
|
|
113
119
|
this.fixedBodyHeight.value = this.scrollX.value ? this.bodyHeight.value - this.gutterWidth : this.bodyHeight.value;
|
|
114
120
|
this.viewportHeight.value = this.scrollX.value ? tableHeight - this.gutterWidth : tableHeight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-layout.mjs","sources":["../../../../../../packages/components/table/src/table-layout.ts"],"sourcesContent":["import { nextTick, ref, isRef } from 'vue'\nimport { hasOwn } from '@vue/shared'\nimport { isClient } from '@vueuse/core'\nimport scrollbarWidth from '@element-plus/utils/scrollbar-width'\nimport { parseHeight } from './util'\nimport type { Ref } from 'vue'\n\nimport type { TableColumnCtx } from './table-column/defaults'\nimport type { TableHeader } from './table-header'\nimport type { Table } from './table/defaults'\nimport type { Store } from './store'\nclass TableLayout<T> {\n observers: TableHeader[]\n table: Table<T>\n store: Store<T>\n columns: TableColumnCtx<T>[]\n fit: boolean\n showHeader: boolean\n\n height: Ref<null | number>\n scrollX: Ref<boolean>\n scrollY: Ref<boolean>\n bodyWidth: Ref<null | number>\n fixedWidth: Ref<null | number>\n rightFixedWidth: Ref<null | number>\n tableHeight: Ref<null | number>\n headerHeight: Ref<null | number> // Table Header Height\n appendHeight: Ref<null | number> // Append Slot Height\n footerHeight: Ref<null | number> // Table Footer Height\n viewportHeight: Ref<null | number> // Table Height - Scroll Bar Height\n bodyHeight: Ref<null | number> // Table Height - Table Header Height\n fixedBodyHeight: Ref<null | number> // Table Height - Table Header Height - Scroll Bar Height\n gutterWidth: number\n constructor(options: Record<string, any>) {\n this.observers = []\n this.table = null\n this.store = null\n this.columns = []\n this.fit = true\n this.showHeader = true\n this.height = ref(null)\n this.scrollX = ref(false)\n this.scrollY = ref(false)\n this.bodyWidth = ref(null)\n this.fixedWidth = ref(null)\n this.rightFixedWidth = ref(null)\n this.tableHeight = ref(null)\n this.headerHeight = ref(44)\n this.appendHeight = ref(0)\n this.footerHeight = ref(44)\n this.viewportHeight = ref(null)\n this.bodyHeight = ref(null)\n this.fixedBodyHeight = ref(null)\n this.gutterWidth = scrollbarWidth()\n for (const name in options) {\n if (hasOwn(options, name)) {\n if (isRef(this[name])) {\n this[name as string].value = options[name]\n } else {\n this[name as string] = options[name]\n }\n }\n }\n if (!this.table) {\n throw new Error('Table is required for Table Layout')\n }\n if (!this.store) {\n throw new Error('Store is required for Table Layout')\n }\n }\n\n updateScrollY() {\n const height = this.height.value\n /**\n * When the height is not initialized, it is null.\n * After the table is initialized, when the height is not configured, the height is 0.\n */\n if (height === null) return false\n const bodyWrapper = this.table.refs.bodyWrapper as HTMLElement\n if (this.table.vnode.el && bodyWrapper) {\n let scrollY = true\n const prevScrollY = this.scrollY.value\n /**\n * When bodyHeight has no value,\n * it means that the table height is not set,\n * and the scroll bar will never appear\n */\n if (this.bodyHeight.value === null) {\n scrollY = false\n } else {\n const body = bodyWrapper.querySelector('.el-table__body') as HTMLElement\n scrollY = body.offsetHeight > this.bodyHeight.value\n }\n this.scrollY.value = scrollY\n return prevScrollY !== scrollY\n }\n return false\n }\n\n setHeight(value: string | number, prop = 'height') {\n if (!isClient) return\n const el = this.table.vnode.el\n value = parseHeight(value)\n this.height.value = Number(value)\n\n if (!el && (value || value === 0))\n return nextTick(() => this.setHeight(value, prop))\n\n if (typeof value === 'number') {\n el.style[prop] = `${value}px`\n this.updateElsHeight()\n } else if (typeof value === 'string') {\n el.style[prop] = value\n this.updateElsHeight()\n }\n }\n\n setMaxHeight(value: string | number) {\n this.setHeight(value, 'max-height')\n }\n\n getFlattenColumns(): TableColumnCtx<T>[] {\n const flattenColumns = []\n const columns = this.table.store.states.columns.value\n columns.forEach((column) => {\n if (column.isColumnGroup) {\n // eslint-disable-next-line prefer-spread\n flattenColumns.push.apply(flattenColumns, column.columns)\n } else {\n flattenColumns.push(column)\n }\n })\n\n return flattenColumns\n }\n\n updateElsHeight() {\n if (!this.table.$ready) return nextTick(() => this.updateElsHeight())\n const { headerWrapper, appendWrapper, footerWrapper } = this.table.refs\n this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0\n if (this.showHeader && !headerWrapper) return\n\n const headerTrElm: HTMLElement = headerWrapper\n ? headerWrapper.querySelector('.el-table__header tr')\n : null\n const noneHeader = this.headerDisplayNone(headerTrElm)\n\n const headerHeight = (this.headerHeight.value = !this.showHeader\n ? 0\n : headerWrapper.offsetHeight)\n if (\n this.showHeader &&\n !noneHeader &&\n headerWrapper.offsetWidth > 0 &&\n (this.table.store.states.columns.value || []).length > 0 &&\n headerHeight < 2\n ) {\n return nextTick(() => this.updateElsHeight())\n }\n const tableHeight = (this.tableHeight.value =\n this.table.vnode.el.clientHeight)\n const footerHeight = (this.footerHeight.value = footerWrapper\n ? footerWrapper.offsetHeight\n : 0)\n if (this.height.value !== null) {\n this.bodyHeight.value =\n tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0)\n }\n this.fixedBodyHeight.value = this.scrollX.value\n ? this.bodyHeight.value - this.gutterWidth\n : this.bodyHeight.value\n\n this.viewportHeight.value = this.scrollX.value\n ? tableHeight - this.gutterWidth\n : tableHeight\n\n this.updateScrollY()\n this.notifyObservers('scrollable')\n }\n\n headerDisplayNone(elm: HTMLElement) {\n if (!elm) return true\n let headerChild = elm\n while (headerChild.tagName !== 'DIV') {\n if (getComputedStyle(headerChild).display === 'none') {\n return true\n }\n headerChild = headerChild.parentElement\n }\n return false\n }\n\n updateColumnsWidth() {\n if (!isClient) return\n const fit = this.fit\n const bodyWidth = this.table.vnode.el.clientWidth\n let bodyMinWidth = 0\n\n const flattenColumns = this.getFlattenColumns()\n const flexColumns = flattenColumns.filter(\n (column) => typeof column.width !== 'number'\n )\n flattenColumns.forEach((column) => {\n // Clean those columns whose width changed from flex to unflex\n if (typeof column.width === 'number' && column.realWidth)\n column.realWidth = null\n })\n if (flexColumns.length > 0 && fit) {\n flattenColumns.forEach((column) => {\n bodyMinWidth += Number(column.width || column.minWidth || 80)\n })\n\n const scrollYWidth = this.scrollY.value ? this.gutterWidth : 0\n\n if (bodyMinWidth <= bodyWidth - scrollYWidth) {\n // DON'T HAVE SCROLL BAR\n this.scrollX.value = false\n\n const totalFlexWidth = bodyWidth - scrollYWidth - bodyMinWidth\n\n if (flexColumns.length === 1) {\n flexColumns[0].realWidth =\n Number(flexColumns[0].minWidth || 80) + totalFlexWidth\n } else {\n const allColumnsWidth = flexColumns.reduce(\n (prev, column) => prev + Number(column.minWidth || 80),\n 0\n )\n const flexWidthPerPixel = totalFlexWidth / allColumnsWidth\n let noneFirstWidth = 0\n\n flexColumns.forEach((column, index) => {\n if (index === 0) return\n const flexWidth = Math.floor(\n Number(column.minWidth || 80) * flexWidthPerPixel\n )\n noneFirstWidth += flexWidth\n column.realWidth = Number(column.minWidth || 80) + flexWidth\n })\n\n flexColumns[0].realWidth =\n Number(flexColumns[0].minWidth || 80) +\n totalFlexWidth -\n noneFirstWidth\n }\n } else {\n // HAVE HORIZONTAL SCROLL BAR\n this.scrollX.value = true\n flexColumns.forEach(function (column) {\n column.realWidth = Number(column.minWidth)\n })\n }\n\n this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth)\n this.table.state.resizeState.value.width = this.bodyWidth.value\n } else {\n flattenColumns.forEach((column) => {\n if (!column.width && !column.minWidth) {\n column.realWidth = 80\n } else {\n column.realWidth = Number(column.width || column.minWidth)\n }\n bodyMinWidth += column.realWidth\n })\n this.scrollX.value = bodyMinWidth > bodyWidth\n\n this.bodyWidth.value = bodyMinWidth\n }\n\n const fixedColumns = this.store.states.fixedColumns.value\n\n if (fixedColumns.length > 0) {\n let fixedWidth = 0\n fixedColumns.forEach(function (column) {\n fixedWidth += Number(column.realWidth || column.width)\n })\n\n this.fixedWidth.value = fixedWidth\n }\n\n const rightFixedColumns = this.store.states.rightFixedColumns.value\n if (rightFixedColumns.length > 0) {\n let rightFixedWidth = 0\n rightFixedColumns.forEach(function (column) {\n rightFixedWidth += Number(column.realWidth || column.width)\n })\n\n this.rightFixedWidth.value = rightFixedWidth\n }\n this.notifyObservers('columns')\n }\n\n addObserver(observer: TableHeader) {\n this.observers.push(observer)\n }\n\n removeObserver(observer: TableHeader) {\n const index = this.observers.indexOf(observer)\n if (index !== -1) {\n this.observers.splice(index, 1)\n }\n }\n\n notifyObservers(event: string) {\n const observers = this.observers\n observers.forEach((observer) => {\n switch (event) {\n case 'columns':\n observer.state?.onColumnsChange(this)\n break\n case 'scrollable':\n observer.state?.onScrollableChange(this)\n break\n default:\n throw new Error(`Table Layout don't have event ${event}.`)\n }\n })\n }\n}\n\nexport default TableLayout\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,WAAW,CAAC;AAClB,EAAE,WAAW,CAAC,OAAO,EAAE;AACvB,IAAI,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;AACxB,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACtB,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACtB,IAAI,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;AACtB,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;AACpB,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AAC3B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AG,QAAQ,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC5E,UAAU,MAAM;AAChB,QAAQ,KAAK,YAAY;AACzB,UAAU,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC/E,UAAU,MAAM;AAChB,QAAQ;AACR,UAAU,MAAM,IAAI,KAAK,CAAC,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,OAAO;AACP,KAAK,CAAC,CAAC;AACP,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"table-layout.mjs","sources":["../../../../../../packages/components/table/src/table-layout.ts"],"sourcesContent":["import { nextTick, ref, isRef } from 'vue'\nimport { hasOwn } from '@vue/shared'\nimport { isClient } from '@vueuse/core'\nimport scrollbarWidth from '@element-plus/utils/scrollbar-width'\nimport { parseHeight } from './util'\nimport type { Ref } from 'vue'\n\nimport type { TableColumnCtx } from './table-column/defaults'\nimport type { TableHeader } from './table-header'\nimport type { Table } from './table/defaults'\nimport type { Store } from './store'\nclass TableLayout<T> {\n observers: TableHeader[]\n table: Table<T>\n store: Store<T>\n columns: TableColumnCtx<T>[]\n fit: boolean\n showHeader: boolean\n\n height: Ref<null | number>\n scrollX: Ref<boolean>\n scrollY: Ref<boolean>\n bodyWidth: Ref<null | number>\n fixedWidth: Ref<null | number>\n rightFixedWidth: Ref<null | number>\n tableHeight: Ref<null | number>\n headerHeight: Ref<null | number> // Table Header Height\n appendHeight: Ref<null | number> // Append Slot Height\n footerHeight: Ref<null | number> // Table Footer Height\n viewportHeight: Ref<null | number> // Table Height - Scroll Bar Height\n bodyHeight: Ref<null | number> // Table Height - Table Header Height\n bodyScrollHeight: Ref<number>\n fixedBodyHeight: Ref<null | number> // Table Height - Table Header Height - Scroll Bar Height\n gutterWidth: number\n constructor(options: Record<string, any>) {\n this.observers = []\n this.table = null\n this.store = null\n this.columns = []\n this.fit = true\n this.showHeader = true\n this.height = ref(null)\n this.scrollX = ref(false)\n this.scrollY = ref(false)\n this.bodyWidth = ref(null)\n this.fixedWidth = ref(null)\n this.rightFixedWidth = ref(null)\n this.tableHeight = ref(null)\n this.headerHeight = ref(44)\n this.appendHeight = ref(0)\n this.footerHeight = ref(44)\n this.viewportHeight = ref(null)\n this.bodyHeight = ref(null)\n this.bodyScrollHeight = ref(0)\n this.fixedBodyHeight = ref(null)\n this.gutterWidth = scrollbarWidth()\n for (const name in options) {\n if (hasOwn(options, name)) {\n if (isRef(this[name])) {\n this[name as string].value = options[name]\n } else {\n this[name as string] = options[name]\n }\n }\n }\n if (!this.table) {\n throw new Error('Table is required for Table Layout')\n }\n if (!this.store) {\n throw new Error('Store is required for Table Layout')\n }\n }\n\n updateScrollY() {\n const height = this.height.value\n /**\n * When the height is not initialized, it is null.\n * After the table is initialized, when the height is not configured, the height is 0.\n */\n if (height === null) return false\n const bodyWrapper = this.table.refs.bodyWrapper as HTMLElement\n if (this.table.vnode.el && bodyWrapper) {\n let scrollY = true\n const prevScrollY = this.scrollY.value\n /**\n * When bodyHeight has no value,\n * it means that the table height is not set,\n * and the scroll bar will never appear\n */\n if (this.bodyHeight.value === null) {\n scrollY = false\n } else {\n const body = bodyWrapper.querySelector('.el-table__body') as HTMLElement\n scrollY = body.offsetHeight > this.bodyHeight.value\n }\n this.scrollY.value = scrollY\n return prevScrollY !== scrollY\n }\n return false\n }\n\n setHeight(value: string | number, prop = 'height') {\n if (!isClient) return\n const el = this.table.vnode.el\n value = parseHeight(value)\n this.height.value = Number(value)\n\n if (!el && (value || value === 0))\n return nextTick(() => this.setHeight(value, prop))\n\n if (typeof value === 'number') {\n el.style[prop] = `${value}px`\n this.updateElsHeight()\n } else if (typeof value === 'string') {\n el.style[prop] = value\n this.updateElsHeight()\n }\n }\n\n setMaxHeight(value: string | number) {\n this.setHeight(value, 'max-height')\n }\n\n getFlattenColumns(): TableColumnCtx<T>[] {\n const flattenColumns = []\n const columns = this.table.store.states.columns.value\n columns.forEach((column) => {\n if (column.isColumnGroup) {\n // eslint-disable-next-line prefer-spread\n flattenColumns.push.apply(flattenColumns, column.columns)\n } else {\n flattenColumns.push(column)\n }\n })\n\n return flattenColumns\n }\n\n updateElsHeight() {\n if (!this.table.$ready) return nextTick(() => this.updateElsHeight())\n const { headerWrapper, appendWrapper, footerWrapper, bodyWrapper } =\n this.table.refs\n this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0\n if (this.showHeader && !headerWrapper) return\n\n const headerTrElm: HTMLElement = headerWrapper\n ? headerWrapper.querySelector('.el-table__header tr')\n : null\n const noneHeader = this.headerDisplayNone(headerTrElm)\n\n const headerHeight = (this.headerHeight.value = !this.showHeader\n ? 0\n : headerWrapper.offsetHeight)\n if (\n this.showHeader &&\n !noneHeader &&\n headerWrapper.offsetWidth > 0 &&\n (this.table.store.states.columns.value || []).length > 0 &&\n headerHeight < 2\n ) {\n return nextTick(() => this.updateElsHeight())\n }\n const tableHeight = (this.tableHeight.value =\n this.table.vnode.el.clientHeight)\n const footerHeight = (this.footerHeight.value = footerWrapper\n ? footerWrapper.offsetHeight\n : 0)\n if (this.height.value !== null) {\n if (this.bodyHeight.value === null) {\n requestAnimationFrame(() => this.updateElsHeight())\n }\n this.bodyHeight.value =\n tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0)\n this.bodyScrollHeight.value =\n bodyWrapper.querySelector('.el-table__body')?.scrollHeight!\n }\n this.fixedBodyHeight.value = this.scrollX.value\n ? this.bodyHeight.value - this.gutterWidth\n : this.bodyHeight.value\n\n this.viewportHeight.value = this.scrollX.value\n ? tableHeight - this.gutterWidth\n : tableHeight\n\n this.updateScrollY()\n this.notifyObservers('scrollable')\n }\n\n headerDisplayNone(elm: HTMLElement) {\n if (!elm) return true\n let headerChild = elm\n while (headerChild.tagName !== 'DIV') {\n if (getComputedStyle(headerChild).display === 'none') {\n return true\n }\n headerChild = headerChild.parentElement\n }\n return false\n }\n\n updateColumnsWidth() {\n if (!isClient) return\n const fit = this.fit\n const bodyWidth = this.table.vnode.el.clientWidth\n let bodyMinWidth = 0\n\n const flattenColumns = this.getFlattenColumns()\n const flexColumns = flattenColumns.filter(\n (column) => typeof column.width !== 'number'\n )\n flattenColumns.forEach((column) => {\n // Clean those columns whose width changed from flex to unflex\n if (typeof column.width === 'number' && column.realWidth)\n column.realWidth = null\n })\n if (flexColumns.length > 0 && fit) {\n flattenColumns.forEach((column) => {\n bodyMinWidth += Number(column.width || column.minWidth || 80)\n })\n\n const scrollYWidth = this.scrollY.value ? this.gutterWidth : 0\n\n if (bodyMinWidth <= bodyWidth - scrollYWidth) {\n // DON'T HAVE SCROLL BAR\n this.scrollX.value = false\n\n const totalFlexWidth = bodyWidth - scrollYWidth - bodyMinWidth\n\n if (flexColumns.length === 1) {\n flexColumns[0].realWidth =\n Number(flexColumns[0].minWidth || 80) + totalFlexWidth\n } else {\n const allColumnsWidth = flexColumns.reduce(\n (prev, column) => prev + Number(column.minWidth || 80),\n 0\n )\n const flexWidthPerPixel = totalFlexWidth / allColumnsWidth\n let noneFirstWidth = 0\n\n flexColumns.forEach((column, index) => {\n if (index === 0) return\n const flexWidth = Math.floor(\n Number(column.minWidth || 80) * flexWidthPerPixel\n )\n noneFirstWidth += flexWidth\n column.realWidth = Number(column.minWidth || 80) + flexWidth\n })\n\n flexColumns[0].realWidth =\n Number(flexColumns[0].minWidth || 80) +\n totalFlexWidth -\n noneFirstWidth\n }\n } else {\n // HAVE HORIZONTAL SCROLL BAR\n this.scrollX.value = true\n flexColumns.forEach(function (column) {\n column.realWidth = Number(column.minWidth)\n })\n }\n\n this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth)\n this.table.state.resizeState.value.width = this.bodyWidth.value\n } else {\n flattenColumns.forEach((column) => {\n if (!column.width && !column.minWidth) {\n column.realWidth = 80\n } else {\n column.realWidth = Number(column.width || column.minWidth)\n }\n bodyMinWidth += column.realWidth\n })\n this.scrollX.value = bodyMinWidth > bodyWidth\n\n this.bodyWidth.value = bodyMinWidth\n }\n\n const fixedColumns = this.store.states.fixedColumns.value\n\n if (fixedColumns.length > 0) {\n let fixedWidth = 0\n fixedColumns.forEach(function (column) {\n fixedWidth += Number(column.realWidth || column.width)\n })\n\n this.fixedWidth.value = fixedWidth\n }\n\n const rightFixedColumns = this.store.states.rightFixedColumns.value\n if (rightFixedColumns.length > 0) {\n let rightFixedWidth = 0\n rightFixedColumns.forEach(function (column) {\n rightFixedWidth += Number(column.realWidth || column.width)\n })\n\n this.rightFixedWidth.value = rightFixedWidth\n }\n this.notifyObservers('columns')\n }\n\n addObserver(observer: TableHeader) {\n this.observers.push(observer)\n }\n\n removeObserver(observer: TableHeader) {\n const index = this.observers.indexOf(observer)\n if (index !== -1) {\n this.observers.splice(index, 1)\n }\n }\n\n notifyObservers(event: string) {\n const observers = this.observers\n observers.forEach((observer) => {\n switch (event) {\n case 'columns':\n observer.state?.onColumnsChange(this)\n break\n case 'scrollable':\n observer.state?.onScrollableChange(this)\n break\n default:\n throw new Error(`Table Layout don't have event ${event}.`)\n }\n })\n }\n}\n\nexport default TableLayout\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,WAAW,CAAC;AAClB,EAAE,WAAW,CAAC,OAAO,EAAE;AACvB,IAAI,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;AACxB,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACtB,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACtB,IAAI,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;AACtB,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;AACpB,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AAC3B,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;AAC5B,IAAI,IAAI,C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AC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACtC,KAAK;AACL,GAAG;AACH,EAAE,eAAe,CAAC,KAAK,EAAE;AACzB,IAAI,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AACrC,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAK;AACpC,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC;AACjB,MAAM,QAAQ,KAAK;AACnB,QAAQ,KAAK,SAAS;AACtB,UAAU,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC5E,UAAU,MAAM;AAChB,QAAQ,KAAK,YAAY;AACzB,UAAU,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC/E,UAAU,MAAM;AAChB,QAAQ;AACR,UAAU,MAAM,IAAI,KAAK,CAAC,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,OAAO;AACP,KAAK,CAAC,CAAC;AACP,GAAG;AACH;;;;"}
|
|
@@ -122,10 +122,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
122
122
|
height?: undefined;
|
|
123
123
|
'max-height'?: undefined;
|
|
124
124
|
}>;
|
|
125
|
+
tableBodyStyles: import("vue").ComputedRef<{
|
|
126
|
+
width: string;
|
|
127
|
+
}>;
|
|
125
128
|
emptyBlockStyle: import("vue").ComputedRef<{
|
|
126
129
|
width: string;
|
|
127
130
|
height: string;
|
|
128
131
|
} | null>;
|
|
132
|
+
borderBottomPatchStyles: import("vue").ComputedRef<{
|
|
133
|
+
bottom: string;
|
|
134
|
+
right: string;
|
|
135
|
+
}>;
|
|
129
136
|
debouncedUpdateLayout: import("lodash").DebouncedFunc<() => void>;
|
|
130
137
|
handleFixedMousewheel: (event: any, data: any) => void;
|
|
131
138
|
fixedHeight: import("vue").ComputedRef<{
|
|
@@ -160,6 +167,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
160
167
|
t: import("element-plus/es/hooks").Translator;
|
|
161
168
|
setDragVisible: (visible: boolean) => void;
|
|
162
169
|
context: Table<any>;
|
|
170
|
+
computedSumText: import("vue").ComputedRef<string>;
|
|
171
|
+
computedEmptyText: import("vue").ComputedRef<string>;
|
|
163
172
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "select-all" | "expand-change" | "current-change" | "selection-change" | "cell-mouse-enter" | "cell-mouse-leave" | "cell-contextmenu" | "cell-click" | "cell-dblclick" | "row-click" | "row-contextmenu" | "row-dblclick" | "header-click" | "header-contextmenu" | "sort-change" | "filter-change" | "header-dragend")[], "select" | "select-all" | "expand-change" | "current-change" | "selection-change" | "cell-mouse-enter" | "cell-mouse-leave" | "cell-contextmenu" | "cell-click" | "cell-dblclick" | "row-click" | "row-contextmenu" | "row-dblclick" | "header-click" | "header-contextmenu" | "sort-change" | "filter-change" | "header-dragend", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
164
173
|
data?: unknown;
|
|
165
174
|
size?: unknown;
|
|
@@ -84,7 +84,9 @@ var script = defineComponent({
|
|
|
84
84
|
resizeProxyVisible,
|
|
85
85
|
bodyWidth,
|
|
86
86
|
resizeState,
|
|
87
|
-
doLayout
|
|
87
|
+
doLayout,
|
|
88
|
+
tableBodyStyles,
|
|
89
|
+
borderBottomPatchStyles
|
|
88
90
|
} = useStyle(props, layout, store, table);
|
|
89
91
|
const debouncedUpdateLayout = debounce(doLayout, 50);
|
|
90
92
|
const tableId = `el-table_${tableIdSeed++}`;
|
|
@@ -95,6 +97,10 @@ var script = defineComponent({
|
|
|
95
97
|
doLayout,
|
|
96
98
|
debouncedUpdateLayout
|
|
97
99
|
};
|
|
100
|
+
const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
|
|
101
|
+
const computedEmptyText = computed(() => {
|
|
102
|
+
return props.emptyText || t("el.table.emptyText");
|
|
103
|
+
});
|
|
98
104
|
return {
|
|
99
105
|
layout,
|
|
100
106
|
store,
|
|
@@ -110,7 +116,9 @@ var script = defineComponent({
|
|
|
110
116
|
isGroup,
|
|
111
117
|
bodyWidth,
|
|
112
118
|
bodyHeight,
|
|
119
|
+
tableBodyStyles,
|
|
113
120
|
emptyBlockStyle,
|
|
121
|
+
borderBottomPatchStyles,
|
|
114
122
|
debouncedUpdateLayout,
|
|
115
123
|
handleFixedMousewheel,
|
|
116
124
|
fixedHeight,
|
|
@@ -126,7 +134,9 @@ var script = defineComponent({
|
|
|
126
134
|
sort,
|
|
127
135
|
t,
|
|
128
136
|
setDragVisible,
|
|
129
|
-
context: table
|
|
137
|
+
context: table,
|
|
138
|
+
computedSumText,
|
|
139
|
+
computedEmptyText
|
|
130
140
|
};
|
|
131
141
|
}
|
|
132
142
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.vue_vue_type_script_lang.mjs","sources":["../../../../../../packages/components/table/src/table.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n {\n 'el-table--fit': fit,\n 'el-table--striped': stripe,\n 'el-table--border': border || isGroup,\n 'el-table--hidden': isHidden,\n 'el-table--group': isGroup,\n 'el-table--fluid-height': maxHeight,\n 'el-table--scrollable-x': layout.scrollX.value,\n 'el-table--scrollable-y': layout.scrollY.value,\n 'el-table--enable-row-hover': !store.states.isComplex.value,\n 'el-table--enable-row-transition':\n (store.states.data.value || []).length !== 0 &&\n (store.states.data.value || []).length < 100,\n },\n tableSize ? `el-table--${tableSize}` : '',\n className,\n 'el-table',\n ]\"\n :style=\"style\"\n @mouseleave=\"handleMouseLeave()\"\n >\n <div ref=\"hiddenColumns\" class=\"hidden-columns\">\n <slot></slot>\n </div>\n <div\n v-if=\"showHeader\"\n ref=\"headerWrapper\"\n v-mousewheel=\"handleHeaderFooterMousewheel\"\n class=\"el-table__header-wrapper\"\n >\n <table-header\n ref=\"tableHeader\"\n :border=\"border\"\n :default-sort=\"defaultSort\"\n :store=\"store\"\n :style=\"{\n width: layout.bodyWidth.value ? layout.bodyWidth.value + 'px' : '',\n }\"\n @set-drag-visible=\"setDragVisible\"\n />\n </div>\n <div ref=\"bodyWrapper\" :style=\"[bodyHeight]\" class=\"el-table__body-wrapper\">\n <table-body\n :context=\"context\"\n :highlight=\"highlightCurrentRow\"\n :row-class-name=\"rowClassName\"\n :tooltip-effect=\"tooltipEffect\"\n :row-style=\"rowStyle\"\n :store=\"store\"\n :stripe=\"stripe\"\n :style=\"{\n width: bodyWidth,\n }\"\n />\n <div\n v-if=\"isEmpty\"\n ref=\"emptyBlock\"\n :style=\"emptyBlockStyle\"\n class=\"el-table__empty-block\"\n >\n <span class=\"el-table__empty-text\">\n <slot name=\"empty\">{{ emptyText || t('el.table.emptyText') }}</slot>\n </span>\n </div>\n <div\n v-if=\"$slots.append\"\n ref=\"appendWrapper\"\n class=\"el-table__append-wrapper\"\n >\n <slot name=\"append\"></slot>\n </div>\n </div>\n <div\n v-if=\"showSummary\"\n v-show=\"!isEmpty\"\n ref=\"footerWrapper\"\n v-mousewheel=\"handleHeaderFooterMousewheel\"\n class=\"el-table__footer-wrapper\"\n >\n <table-footer\n :border=\"border\"\n :default-sort=\"defaultSort\"\n :store=\"store\"\n :style=\"{\n width: layout.bodyWidth.value ? layout.bodyWidth.value + 'px' : '',\n }\"\n :sum-text=\"sumText || t('el.table.sumText')\"\n :summary-method=\"summaryMethod\"\n />\n </div>\n <div\n v-if=\"store.states.fixedColumns.value.length > 0\"\n ref=\"fixedWrapper\"\n v-mousewheel=\"handleFixedMousewheel\"\n :style=\"[\n {\n width: layout.fixedWidth.value ? layout.fixedWidth.value + 'px' : '',\n },\n fixedHeight,\n ]\"\n class=\"el-table__fixed\"\n >\n <div\n v-if=\"showHeader\"\n ref=\"fixedHeaderWrapper\"\n class=\"el-table__fixed-header-wrapper\"\n >\n <table-header\n ref=\"fixedTableHeader\"\n :border=\"border\"\n :store=\"store\"\n :style=\"{\n width: bodyWidth,\n }\"\n fixed=\"left\"\n @set-drag-visible=\"setDragVisible\"\n />\n </div>\n <div\n ref=\"fixedBodyWrapper\"\n :style=\"[\n {\n top: layout.headerHeight.value + 'px',\n },\n fixedBodyHeight,\n ]\"\n class=\"el-table__fixed-body-wrapper\"\n >\n <table-body\n :highlight=\"highlightCurrentRow\"\n :row-class-name=\"rowClassName\"\n :tooltip-effect=\"tooltipEffect\"\n :row-style=\"rowStyle\"\n :store=\"store\"\n :stripe=\"stripe\"\n :style=\"{\n width: bodyWidth,\n }\"\n fixed=\"left\"\n />\n <div\n v-if=\"$slots.append\"\n :style=\"{ height: layout.appendHeight.value + 'px' }\"\n class=\"el-table__append-gutter\"\n ></div>\n </div>\n <div\n v-if=\"showSummary\"\n v-show=\"!isEmpty\"\n ref=\"fixedFooterWrapper\"\n class=\"el-table__fixed-footer-wrapper\"\n >\n <table-footer\n :border=\"border\"\n :store=\"store\"\n :style=\"{\n width: bodyWidth,\n }\"\n :sum-text=\"sumText || t('el.table.sumText')\"\n :summary-method=\"summaryMethod\"\n fixed=\"left\"\n />\n </div>\n </div>\n <div\n v-if=\"store.states.rightFixedColumns.value.length > 0\"\n ref=\"rightFixedWrapper\"\n v-mousewheel=\"handleFixedMousewheel\"\n :style=\"[\n {\n width: layout.rightFixedWidth.value\n ? layout.rightFixedWidth.value + 'px'\n : '',\n right: layout.scrollY.value\n ? (border ? layout.gutterWidth : layout.gutterWidth || 0) + 'px'\n : '',\n },\n fixedHeight,\n ]\"\n class=\"el-table__fixed-right\"\n >\n <div\n v-if=\"showHeader\"\n ref=\"rightFixedHeaderWrapper\"\n class=\"el-table__fixed-header-wrapper\"\n >\n <table-header\n ref=\"rightFixedTableHeader\"\n :border=\"border\"\n :store=\"store\"\n :style=\"{\n width: bodyWidth,\n }\"\n fixed=\"right\"\n @set-drag-visible=\"setDragVisible\"\n />\n </div>\n <div\n ref=\"rightFixedBodyWrapper\"\n :style=\"[{ top: layout.headerHeight.value + 'px' }, fixedBodyHeight]\"\n class=\"el-table__fixed-body-wrapper\"\n >\n <table-body\n :highlight=\"highlightCurrentRow\"\n :row-class-name=\"rowClassName\"\n :tooltip-effect=\"tooltipEffect\"\n :row-style=\"rowStyle\"\n :store=\"store\"\n :stripe=\"stripe\"\n :style=\"{\n width: bodyWidth,\n }\"\n fixed=\"right\"\n />\n <div\n v-if=\"$slots.append\"\n :style=\"{ height: layout.appendHeight.value + 'px' }\"\n class=\"el-table__append-gutter\"\n ></div>\n </div>\n <div\n v-if=\"showSummary\"\n v-show=\"!isEmpty\"\n ref=\"rightFixedFooterWrapper\"\n class=\"el-table__fixed-footer-wrapper\"\n >\n <table-footer\n :border=\"border\"\n :store=\"store\"\n :style=\"{\n width: bodyWidth,\n }\"\n :sum-text=\"sumText || t('el.table.sumText')\"\n :summary-method=\"summaryMethod\"\n fixed=\"right\"\n />\n </div>\n </div>\n <div\n v-if=\"store.states.rightFixedColumns.value.length > 0\"\n ref=\"rightFixedPatch\"\n :style=\"{\n width: layout.scrollY.value ? layout.gutterWidth + 'px' : '0',\n height: layout.headerHeight.value + 'px',\n }\"\n class=\"el-table__fixed-right-patch\"\n ></div>\n <div\n v-show=\"resizeProxyVisible\"\n ref=\"resizeProxy\"\n class=\"el-table__column-resize-proxy\"\n ></div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, getCurrentInstance, computed } from 'vue'\nimport debounce from 'lodash/debounce'\nimport { Mousewheel } from '@element-plus/directives'\nimport { useLocale } from '@element-plus/hooks'\nimport { createStore } from './store/helper'\nimport TableLayout from './table-layout'\nimport TableHeader from './table-header'\nimport TableBody from './table-body'\nimport TableFooter from './table-footer'\nimport useUtils from './table/utils-helper'\nimport useStyle from './table/style-helper'\nimport defaultProps from './table/defaults'\n\nimport type { Table } from './table/defaults'\n\nlet tableIdSeed = 1\nexport default defineComponent({\n name: 'ElTable',\n directives: {\n Mousewheel,\n },\n components: {\n TableHeader,\n TableBody,\n TableFooter,\n },\n props: defaultProps,\n emits: [\n 'select',\n 'select-all',\n 'selection-change',\n 'cell-mouse-enter',\n 'cell-mouse-leave',\n 'cell-contextmenu',\n 'cell-click',\n 'cell-dblclick',\n 'row-click',\n 'row-contextmenu',\n 'row-dblclick',\n 'header-click',\n 'header-contextmenu',\n 'sort-change',\n 'filter-change',\n 'current-change',\n 'header-dragend',\n 'expand-change',\n ],\n setup(props) {\n type Row = typeof props.data[number]\n const { t } = useLocale()\n const table = getCurrentInstance() as Table<Row>\n const store = createStore<Row>(table, props)\n table.store = store\n const layout = new TableLayout<Row>({\n store: table.store,\n table,\n fit: props.fit,\n showHeader: props.showHeader,\n })\n table.layout = layout\n\n const isEmpty = computed(() => (store.states.data.value || []).length === 0)\n\n /**\n * open functions\n */\n const {\n setCurrentRow,\n toggleRowSelection,\n clearSelection,\n clearFilter,\n toggleAllSelection,\n toggleRowExpansion,\n clearSort,\n sort,\n } = useUtils<Row>(store)\n const {\n isHidden,\n renderExpanded,\n setDragVisible,\n isGroup,\n handleMouseLeave,\n handleHeaderFooterMousewheel,\n tableSize,\n bodyHeight,\n emptyBlockStyle,\n handleFixedMousewheel,\n fixedHeight,\n fixedBodyHeight,\n resizeProxyVisible,\n bodyWidth,\n resizeState,\n doLayout,\n } = useStyle<Row>(props, layout, store, table)\n\n const debouncedUpdateLayout = debounce(doLayout, 50)\n\n const tableId = `el-table_${tableIdSeed++}`\n table.tableId = tableId\n table.state = {\n isGroup,\n resizeState,\n doLayout,\n debouncedUpdateLayout,\n }\n return {\n layout,\n store,\n handleHeaderFooterMousewheel,\n handleMouseLeave,\n tableId,\n tableSize,\n isHidden,\n isEmpty,\n renderExpanded,\n resizeProxyVisible,\n resizeState,\n isGroup,\n bodyWidth,\n bodyHeight,\n emptyBlockStyle,\n debouncedUpdateLayout,\n handleFixedMousewheel,\n fixedHeight,\n fixedBodyHeight,\n setCurrentRow,\n toggleRowSelection,\n clearSelection,\n clearFilter,\n toggleAllSelection,\n toggleRowExpansion,\n clearSort,\n doLayout,\n sort,\n t,\n setDragVisible,\n context: table,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA8QA,IAAI,WAAW,GAAG,EAAE;;AAEpB,EAAE,MAAM,SAAS;;AAEjB,IAAI,UAAU;AACd,GAAG;EACD,UAAU,EAAE;IACV;IACA,SAAS;;GAEV;OACI,EAAE;OACF,EAAE;IACL,QAAQ;;IAER;IACA;IACA;IACA;IACA,YAAY;IACZ,eAAe;IACf,WAAW;IACX,iBAAiB;IACjB;IACA,cAAc;IACd;IACA,aAAa;IACb;IACA;IACA,gBAAgB;IAChB;;OAEG,CAAC,KAAK,EAAE;IACX,MAAM,EAAE,CAAC,EAAE,GAAG;IACd,MAAM,KAAK,GAAG;;IAEd,KAAK,CAAC,KAAK;IACX,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC;MAC7B,YAAY,CAAC,KAAK;MAClB,KAAK;MACL,KAAK,KAAK,IAAI;MACd,UAAU,EAAE;KACb,CAAC,CAAC;SACE,CAAC,MAAM,GAAG;UACT;;MAEJ,aAAa;;MAEb,cAAc;;MAEd,kBAAkB;;MAElB;UACI;KACL;IACD,MAAM;MACJ,QAAQ;MACR,cAAc;MACd,cAAc;MACd,OAAO;MACP,gBAAgB;MAChB;MACA,SAAS;MACT;MACA,eAAe;MACf;MACA;MACA;MACA;MACA;MACA,WAAW;MACX,QAAQ;QACN;UACE;UACA,OAAO,GAAG,CAAC;SACZ,CAAC,OAAO,GAAG,OAAO;SAClB,CAAC,KAAK;MACT,OAAO;MACP,WAAW;MACX,QAAQ;MACR;MACA;IACF,OAAO;;MAEL,KAAK;;MAEL,gBAAgB;MAChB,OAAO;MACP;MACA;MACA,OAAO;MACP;MACA,kBAAkB;;MAElB;MACA;MACA;MACA,eAAe;MACf;MACA;MACA;MACA;MACA;MACA;MACA,cAAc;MACd,WAAW;MACX;MACA;MACA,SAAS;MACT,QAAQ;MACR,IAAI;MACJ,CAAC;MACD;MACA,OAAO,EAAE,KAAK;MACd;;;;;;"}
|
|
1
|
+
{"version":3,"file":"table.vue_vue_type_script_lang.mjs","sources":["../../../../../../packages/components/table/src/table.vue"],"sourcesContent":["<template>\n <div\n ref=\"tableWrapper\"\n :class=\"[\n {\n 'el-table--fit': fit,\n 'el-table--striped': stripe,\n 'el-table--border': border || isGroup,\n 'el-table--hidden': isHidden,\n 'el-table--group': isGroup,\n 'el-table--fluid-height': maxHeight,\n 'el-table--scrollable-x': layout.scrollX.value,\n 'el-table--scrollable-y': layout.scrollY.value,\n 'el-table--enable-row-hover': !store.states.isComplex.value,\n 'el-table--enable-row-transition':\n (store.states.data.value || []).length !== 0 &&\n (store.states.data.value || []).length < 100,\n },\n tableSize ? `el-table--${tableSize}` : '',\n className,\n 'el-table',\n ]\"\n :style=\"style\"\n @mouseleave=\"handleMouseLeave()\"\n >\n <div class=\"el-table__inner-wrapper\">\n <div ref=\"hiddenColumns\" class=\"hidden-columns\">\n <slot></slot>\n </div>\n <div\n v-if=\"showHeader\"\n ref=\"headerWrapper\"\n v-mousewheel=\"handleHeaderFooterMousewheel\"\n class=\"el-table__header-wrapper\"\n >\n <table-header\n ref=\"tableHeader\"\n :border=\"border\"\n :default-sort=\"defaultSort\"\n :store=\"store\"\n :style=\"tableBodyStyles\"\n @set-drag-visible=\"setDragVisible\"\n />\n </div>\n <div ref=\"bodyWrapper\" :style=\"bodyHeight\" class=\"el-table__body-wrapper\">\n <table-body\n :context=\"context\"\n :highlight=\"highlightCurrentRow\"\n :row-class-name=\"rowClassName\"\n :tooltip-effect=\"tooltipEffect\"\n :row-style=\"rowStyle\"\n :store=\"store\"\n :stripe=\"stripe\"\n :style=\"{\n width: bodyWidth,\n }\"\n />\n <div\n v-if=\"isEmpty\"\n ref=\"emptyBlock\"\n :style=\"emptyBlockStyle\"\n class=\"el-table__empty-block\"\n >\n <span class=\"el-table__empty-text\">\n <slot name=\"empty\">{{ computedEmptyText }}</slot>\n </span>\n </div>\n <div\n v-if=\"$slots.append\"\n ref=\"appendWrapper\"\n class=\"el-table__append-wrapper\"\n >\n <slot name=\"append\"></slot>\n </div>\n </div>\n <div v-if=\"border || isGroup\" class=\"el-table__border-left-patch\"></div>\n <div\n v-if=\"layout.scrollX.value && layout.height.value\"\n class=\"el-table__border-bottom-patch\"\n :style=\"borderBottomPatchStyles\"\n ></div>\n </div>\n <div\n v-if=\"showSummary\"\n v-show=\"!isEmpty\"\n ref=\"footerWrapper\"\n v-mousewheel=\"handleHeaderFooterMousewheel\"\n class=\"el-table__footer-wrapper\"\n >\n <table-footer\n :border=\"border\"\n :default-sort=\"defaultSort\"\n :store=\"store\"\n :style=\"tableBodyStyles\"\n :sum-text=\"computedSumText\"\n :summary-method=\"summaryMethod\"\n />\n </div>\n <div\n v-show=\"resizeProxyVisible\"\n ref=\"resizeProxy\"\n class=\"el-table__column-resize-proxy\"\n ></div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, getCurrentInstance, computed } from 'vue'\nimport debounce from 'lodash/debounce'\nimport { Mousewheel } from '@element-plus/directives'\nimport { useLocale } from '@element-plus/hooks'\nimport { createStore } from './store/helper'\nimport TableLayout from './table-layout'\nimport TableHeader from './table-header'\nimport TableBody from './table-body'\nimport TableFooter from './table-footer'\nimport useUtils from './table/utils-helper'\nimport useStyle from './table/style-helper'\nimport defaultProps from './table/defaults'\n\nimport type { Table } from './table/defaults'\n\nlet tableIdSeed = 1\nexport default defineComponent({\n name: 'ElTable',\n directives: {\n Mousewheel,\n },\n components: {\n TableHeader,\n TableBody,\n TableFooter,\n },\n props: defaultProps,\n emits: [\n 'select',\n 'select-all',\n 'selection-change',\n 'cell-mouse-enter',\n 'cell-mouse-leave',\n 'cell-contextmenu',\n 'cell-click',\n 'cell-dblclick',\n 'row-click',\n 'row-contextmenu',\n 'row-dblclick',\n 'header-click',\n 'header-contextmenu',\n 'sort-change',\n 'filter-change',\n 'current-change',\n 'header-dragend',\n 'expand-change',\n ],\n setup(props) {\n type Row = typeof props.data[number]\n const { t } = useLocale()\n const table = getCurrentInstance() as Table<Row>\n const store = createStore<Row>(table, props)\n table.store = store\n const layout = new TableLayout<Row>({\n store: table.store,\n table,\n fit: props.fit,\n showHeader: props.showHeader,\n })\n table.layout = layout\n\n const isEmpty = computed(() => (store.states.data.value || []).length === 0)\n\n /**\n * open functions\n */\n const {\n setCurrentRow,\n toggleRowSelection,\n clearSelection,\n clearFilter,\n toggleAllSelection,\n toggleRowExpansion,\n clearSort,\n sort,\n } = useUtils<Row>(store)\n const {\n isHidden,\n renderExpanded,\n setDragVisible,\n isGroup,\n handleMouseLeave,\n handleHeaderFooterMousewheel,\n tableSize,\n bodyHeight,\n emptyBlockStyle,\n handleFixedMousewheel,\n fixedHeight,\n fixedBodyHeight,\n resizeProxyVisible,\n bodyWidth,\n resizeState,\n doLayout,\n tableBodyStyles,\n borderBottomPatchStyles,\n } = useStyle<Row>(props, layout, store, table)\n\n const debouncedUpdateLayout = debounce(doLayout, 50)\n\n const tableId = `el-table_${tableIdSeed++}`\n table.tableId = tableId\n table.state = {\n isGroup,\n resizeState,\n doLayout,\n debouncedUpdateLayout,\n }\n const computedSumText = computed(\n () => props.sumText || t('el.table.sumText')\n )\n\n const computedEmptyText = computed(() => {\n return props.emptyText || t('el.table.emptyText')\n })\n\n return {\n layout,\n store,\n handleHeaderFooterMousewheel,\n handleMouseLeave,\n tableId,\n tableSize,\n isHidden,\n isEmpty,\n renderExpanded,\n resizeProxyVisible,\n resizeState,\n isGroup,\n bodyWidth,\n bodyHeight,\n tableBodyStyles,\n emptyBlockStyle,\n borderBottomPatchStyles,\n debouncedUpdateLayout,\n handleFixedMousewheel,\n fixedHeight,\n fixedBodyHeight,\n setCurrentRow,\n toggleRowSelection,\n clearSelection,\n clearFilter,\n toggleAllSelection,\n toggleRowExpansion,\n clearSort,\n doLayout,\n sort,\n t,\n setDragVisible,\n context: table,\n computedSumText,\n computedEmptyText,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsHA,IAAI,WAAW,GAAG,EAAE;;AAEpB,EAAE,MAAM,SAAS;;AAEjB,IAAI,UAAU;AACd,GAAG;EACD,UAAU,EAAE;IACV;IACA,SAAS;;GAEV;OACI,EAAE;OACF,EAAE;IACL,QAAQ;;IAER;IACA;IACA;IACA;IACA,YAAY;IACZ,eAAe;IACf,WAAW;IACX,iBAAiB;IACjB;IACA,cAAc;IACd;IACA,aAAa;IACb;IACA;IACA,gBAAgB;IAChB;;OAEG,CAAC,KAAK,EAAE;IACX,MAAM,EAAE,CAAC,EAAE,GAAG;IACd,MAAM,KAAK,GAAG;;IAEd,KAAK,CAAC,KAAK;IACX,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC;MAC7B,YAAY,CAAC,KAAK;MAClB,KAAK;MACL,KAAK,KAAK,IAAI;MACd,UAAU,EAAE;KACb,CAAC,CAAC;SACE,CAAC,MAAM,GAAG;UACT;;MAEJ,aAAa;;MAEb,cAAc;;MAEd,kBAAkB;;MAElB;UACI;KACL;IACD,MAAM;MACJ,QAAQ;MACR,cAAc;MACd,cAAc;MACd,OAAO;MACP,gBAAgB;MAChB;MACA,SAAS;MACT;MACA,eAAe;MACf;MACA;MACA;MACA;MACA;MACA,WAAW;MACX,QAAQ;MACR;MACA;QACE,QAAQ,CAAC;UACP;UACA,OAAO;SACR,CAAC,OAAO,GAAG;SACX,CAAC,KAAK,GAAG;MACZ,OAAO;MACP,WAAW;MACX,QAAQ;MACR;MACA;IACF,MAAM,eAAe,YAAY,WAAW,CAAC;;MAE3C,OAAO,KAAK,CAAC,SAAS,IAAI,EAAE,oBAAoB,CAAC;;IAEnD,OAAO;MACL,MAAM;MACN,KAAK;MACL;MACA;MACA,OAAO;MACP,SAAS;;MAET,OAAO;MACP,cAAc;;;MAGd,OAAO;MACP,SAAS;;;MAGT;MACA;MACA;MACA,qBA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