{"version":3,"file":"config.js","sources":["../../../../../../packages/components/table/src/config.ts"],"sourcesContent":["// @ts-nocheck\nimport { h } from 'vue'\nimport ElCheckbox from '@element-plus/components/checkbox'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { ArrowRight, Loading } from '@element-plus/icons-vue'\nimport { getProp } from '@element-plus/utils'\n\nimport type { VNode } from 'vue'\nimport type { TableColumnCtx } from './table-column/defaults'\nimport type { Store } from './store'\nimport type { TreeNode } from './table/defaults'\n\nconst defaultClassNames = {\n selection: 'table-column--selection',\n expand: 'table__expand-column',\n}\n\nexport const cellStarts = {\n default: {\n order: '',\n },\n selection: {\n width: 48,\n minWidth: 48,\n realWidth: 48,\n order: '',\n },\n expand: {\n width: 48,\n minWidth: 48,\n realWidth: 48,\n order: '',\n },\n index: {\n width: 48,\n minWidth: 48,\n realWidth: 48,\n order: '',\n },\n}\n\nexport const getDefaultClassName = (type) => {\n return defaultClassNames[type] || ''\n}\n\n// 这些选项不应该被覆盖\nexport const cellForced = {\n selection: {\n renderHeader({ store, column }: { store: Store }) {\n function isDisabled() {\n return store.states.data.value && store.states.data.value.length === 0\n }\n return h(ElCheckbox, {\n disabled: isDisabled(),\n size: store.states.tableSize.value,\n indeterminate:\n store.states.selection.value.length > 0 &&\n !store.states.isAllSelected.value,\n 'onUpdate:modelValue': store.toggleAllSelection,\n modelValue: store.states.isAllSelected.value,\n ariaLabel: column.label,\n })\n },\n renderCell({\n row,\n column,\n store,\n $index,\n }: {\n row: T\n column: TableColumnCtx\n store: Store\n $index: string\n }) {\n return h(ElCheckbox, {\n disabled: column.selectable\n ? !column.selectable.call(null, row, $index)\n : false,\n size: store.states.tableSize.value,\n onChange: () => {\n store.commit('rowSelectedChanged', row)\n },\n onClick: (event: Event) => event.stopPropagation(),\n modelValue: store.isSelected(row),\n ariaLabel: column.label,\n })\n },\n sortable: false,\n resizable: false,\n },\n index: {\n renderHeader({ column }: { column: TableColumnCtx }) {\n return column.label || '#'\n },\n renderCell({\n column,\n $index,\n }: {\n column: TableColumnCtx\n $index: number\n }) {\n let i = $index + 1\n const index = column.index\n\n if (typeof index === 'number') {\n i = $index + index\n } else if (typeof index === 'function') {\n i = index($index)\n }\n return h('div', {}, [i])\n },\n sortable: false,\n },\n expand: {\n renderHeader({ column }: { column: TableColumnCtx }) {\n return column.label || ''\n },\n renderCell({\n row,\n store,\n expanded,\n }: {\n row: T\n store: Store\n expanded: boolean\n }) {\n const { ns } = store\n const classes = [ns.e('expand-icon')]\n if (expanded) {\n classes.push(ns.em('expand-icon', 'expanded'))\n }\n const callback = function (e: Event) {\n e.stopPropagation()\n store.toggleRowExpansion(row)\n }\n return h(\n 'div',\n {\n class: classes,\n onClick: callback,\n },\n {\n default: () => {\n return [\n h(ElIcon, null, {\n default: () => {\n return [h(ArrowRight)]\n },\n }),\n ]\n },\n }\n )\n },\n sortable: false,\n resizable: false,\n },\n}\n\nexport function defaultRenderCell({\n row,\n column,\n $index,\n}: {\n row: T\n column: TableColumnCtx\n $index: number\n}) {\n const property = column.property\n const value = property && getProp(row, property).value\n if (column && column.formatter) {\n return column.formatter(row, column, value, $index)\n }\n return value?.toString?.() || ''\n}\n\nexport function treeCellPrefix(\n {\n row,\n treeNode,\n store,\n }: {\n row: T\n treeNode: TreeNode\n store: Store\n },\n createPlaceholder = false\n) {\n const { ns } = store\n if (!treeNode) {\n if (createPlaceholder) {\n return [\n h('span', {\n class: ns.e('placeholder'),\n }),\n ]\n }\n return null\n }\n const ele: VNode[] = []\n const callback = function (e) {\n e.stopPropagation()\n if (treeNode.loading) {\n return\n }\n store.loadOrToggle(row)\n }\n if (treeNode.indent) {\n ele.push(\n h('span', {\n class: ns.e('indent'),\n style: { 'padding-left': `${treeNode.indent}px` },\n })\n )\n }\n if (typeof treeNode.expanded === 'boolean' && !treeNode.noLazyChildren) {\n const expandClasses = [\n ns.e('expand-icon'),\n treeNode.expanded ? ns.em('expand-icon', 'expanded') : '',\n ]\n let icon = ArrowRight\n if (treeNode.loading) {\n icon = Loading\n }\n\n ele.push(\n h(\n 'div',\n {\n class: expandClasses,\n onClick: callback,\n },\n {\n default: () => {\n return [\n h(\n ElIcon,\n { class: { [ns.is('loading')]: treeNode.loading } },\n {\n default: () => [h(icon)],\n }\n ),\n ]\n },\n }\n )\n )\n } else {\n ele.push(\n h('span', {\n class: ns.e('placeholder'),\n })\n )\n }\n return ele\n}\n"],"names":["h","ElCheckbox","ElIcon","ArrowRight","getProp","Loading"],"mappings":";;;;;;;;;;;AAKA,MAAM,iBAAiB,GAAG;AAC1B,EAAE,SAAS,EAAE,yBAAyB;AACtC,EAAE,MAAM,EAAE,sBAAsB;AAChC,CAAC,CAAC;AACU,MAAC,UAAU,GAAG;AAC1B,EAAE,OAAO,EAAE;AACX,IAAI,KAAK,EAAE,EAAE;AACb,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,KAAK,EAAE,EAAE;AACb,IAAI,QAAQ,EAAE,EAAE;AAChB,IAAI,SAAS,EAAE,EAAE;AACjB,IAAI,KAAK,EAAE,EAAE;AACb,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,KAAK,EAAE,EAAE;AACb,IAAI,QAAQ,EAAE,EAAE;AAChB,IAAI,SAAS,EAAE,EAAE;AACjB,IAAI,KAAK,EAAE,EAAE;AACb,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,KAAK,EAAE,EAAE;AACb,IAAI,QAAQ,EAAE,EAAE;AAChB,IAAI,SAAS,EAAE,EAAE;AACjB,IAAI,KAAK,EAAE,EAAE;AACb,GAAG;AACH,EAAE;AACU,MAAC,mBAAmB,GAAG,CAAC,IAAI,KAAK;AAC7C,EAAE,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AACvC,EAAE;AACU,MAAC,UAAU,GAAG;AAC1B,EAAE,SAAS,EAAE;AACb,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;AACpC,MAAM,SAAS,UAAU,GAAG;AAC5B,QAA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