@sdata/web-vue 3.2.1 → 3.3.1

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.
Files changed (70) hide show
  1. package/README.md +2 -2
  2. package/dist/sd.css +91 -17
  3. package/dist/sd.min.css +1 -1
  4. package/es/_components/select-view/style/index.css +5 -6
  5. package/es/_components/virtual-list-v2/hooks/use-size.d.ts +17 -0
  6. package/es/_components/virtual-list-v2/hooks/use-size.js +95 -0
  7. package/es/_components/virtual-list-v2/index.d.ts +2 -0
  8. package/es/_components/virtual-list-v2/index.js +5 -0
  9. package/es/_components/virtual-list-v2/interface.d.ts +44 -0
  10. package/es/_components/virtual-list-v2/virtual-list-item.d.ts +22 -0
  11. package/es/_components/virtual-list-v2/virtual-list-item.js +37 -0
  12. package/es/_components/virtual-list-v2/virtual-list.js +47 -0
  13. package/es/_components/virtual-list-v2/virtual-list.vue.d.ts +749 -0
  14. package/es/_components/virtual-list-v2/virtual-list.vue_vue_type_script_lang.js +179 -0
  15. package/es/_hooks/use-config-provider-prop.d.ts +1 -1
  16. package/es/_virtual/_plugin-vue_export-helper.js +8 -0
  17. package/es/color-picker/hooks/use-control-block.js +4 -1
  18. package/es/components.d.ts +1 -0
  19. package/es/config-provider/config-provider.vue.d.ts +7 -1
  20. package/es/config-provider/config-provider.vue_vue_type_script_setup_true_lang.js +7 -1
  21. package/es/config-provider/context.d.ts +14 -0
  22. package/es/config-provider/index.d.ts +9 -0
  23. package/es/index.css +91 -17
  24. package/es/index.d.ts +2 -0
  25. package/es/index.js +2 -1
  26. package/es/index.scss +1 -0
  27. package/es/input-tag/style/index.css +5 -6
  28. package/es/input-tag/style/input-tag.scss +30 -10
  29. package/es/message/message.vue_vue_type_script_setup_true_lang.js +1 -1
  30. package/es/pagination/pagination.js +101 -19
  31. package/es/sd-vue.js +2 -0
  32. package/es/table/context.d.ts +1 -1
  33. package/es/table/hooks/use-column-resize.d.ts +3 -2
  34. package/es/table/hooks/use-column-resize.js +21 -48
  35. package/es/table/hooks/use-drag.d.ts +1 -3
  36. package/es/table/hooks/use-drag.js +2 -18
  37. package/es/table/index.d.ts +21 -36
  38. package/es/table/style/index.css +12 -5
  39. package/es/table/style/index.scss +16 -6
  40. package/es/table/table-operation-td.js +15 -12
  41. package/es/table/table-operation-th.js +2 -2
  42. package/es/table/table-tbody.js +3 -1
  43. package/es/table/table-td.js +3 -4
  44. package/es/table/table-th.js +24 -40
  45. package/es/table/table-thead.js +3 -1
  46. package/es/table/table.d.ts +13 -19
  47. package/es/table/table.js +205 -424
  48. package/es/table/utils.d.ts +2 -0
  49. package/es/table/utils.js +11 -1
  50. package/es/tag/index.d.ts +3 -3
  51. package/es/tag/tag.vue.d.ts +2 -2
  52. package/es/tag/tag.vue_vue_type_script_setup_true_lang.js +16 -5
  53. package/es/toolbar/index.d.ts +72 -0
  54. package/es/toolbar/index.js +10 -0
  55. package/es/toolbar/style/css.js +2 -0
  56. package/es/toolbar/style/index.css +85 -0
  57. package/es/toolbar/style/index.d.ts +2 -0
  58. package/es/toolbar/style/index.js +2 -0
  59. package/es/toolbar/style/index.scss +97 -0
  60. package/es/toolbar/style/token.scss +25 -0
  61. package/es/toolbar/toolbar.js +5 -0
  62. package/es/toolbar/toolbar.vue.d.ts +44 -0
  63. package/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +197 -0
  64. package/es/toolbar/types.d.ts +26 -0
  65. package/es/trigger/trigger.js +5 -1
  66. package/json/vetur-attributes.json +76 -1
  67. package/json/vetur-tags.json +24 -0
  68. package/json/web-types.json +163 -7
  69. package/package.json +1 -1
  70. package/es/table/table-col-group.vue.d.ts +0 -29
package/es/table/table.js CHANGED
@@ -2,8 +2,7 @@ import { configProviderInjectionKey } from "../config-provider/context.js";
2
2
  import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/objectSpread2.js";
3
3
  import { getPrefixCls } from "../_utils/global-config.js";
4
4
  import { isArray, isFunction, isNull, isNumber, isObject, isString, isUndefined } from "../_utils/is.js";
5
- import { _asyncToGenerator } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/asyncToGenerator.js";
6
- import virtual_list_default from "../_components/virtual-list/index.js";
5
+ import resize_observer_default from "../_components/resize-observer.js";
7
6
  import { omit } from "../_utils/omit.js";
8
7
  import { useComponentRef } from "../_hooks/use-component-ref.js";
9
8
  import { useScrollbar } from "../_hooks/use-scrollbar.js";
@@ -17,13 +16,14 @@ import IconMinus from "../icon/icon-minus/index.js";
17
16
  import IconPlus from "../icon/icon-plus/index.js";
18
17
  import { getValueByPath, setValueByPath } from "../_utils/get-value-by-path.js";
19
18
  import Pagination from "../pagination/index.js";
19
+ import virtual_list_v2_default from "../_components/virtual-list-v2/index.js";
20
20
  import { tableInjectionKey } from "./context.js";
21
21
  import { useColumnResize } from "./hooks/use-column-resize.js";
22
22
  import { useDrag } from "./hooks/use-drag.js";
23
23
  import { useExpand } from "./hooks/use-expand.js";
24
24
  import { useFilter } from "./hooks/use-filter.js";
25
25
  import { usePagination } from "./hooks/use-pagination.js";
26
- import { getGroupColumns, mapArrayWithChildren, mapRawTableData } from "./utils.js";
26
+ import { getGroupColumns, getTableGridTemplate, mapArrayWithChildren, mapRawTableData } from "./utils.js";
27
27
  import { useRowSelection } from "./hooks/use-row-selection.js";
28
28
  import { useSorter } from "./hooks/use-sorter.js";
29
29
  import { useSpan } from "./hooks/use-span.js";
@@ -34,22 +34,18 @@ import table_td_default from "./table-td.js";
34
34
  import table_th_default from "./table-th.js";
35
35
  import table_thead_default from "./table-thead.js";
36
36
  import table_tr_default from "./table-tr.js";
37
- import { Fragment, computed, createVNode, defineComponent, inject, isVNode, mergeProps, nextTick, onMounted, provide, reactive, ref, toRefs, watch, watchEffect } from "vue";
38
- import { useElementBounding, useElementSize, useResizeObserver, watchThrottled } from "@vueuse/core";
37
+ import { Fragment, computed, createVNode, defineComponent, inject, isVNode, mergeProps, onMounted, provide, reactive, ref, toRefs, watch, watchEffect } from "vue";
39
38
  //#region components/table/table.tsx
40
39
  var _excluded = [
40
+ "data",
41
41
  "itemKey",
42
- "keyField",
43
- "estimatedSize",
44
- "scrollbar",
45
- "itemSize",
46
- "minItemSize",
47
42
  "component",
48
43
  "listAttrs",
49
44
  "contentAttrs",
50
- "listStyle",
51
- "paddingPosition"
52
- ];
45
+ "paddingPosition",
46
+ "isStaticItemHeight",
47
+ "fixedSize"
48
+ ], _excluded2 = ["outerStyle"], _excluded3 = ["outerStyle"];
53
49
  function _isSlot(s) {
54
50
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
55
51
  }
@@ -117,6 +113,14 @@ var table_default = /* @__PURE__ */ defineComponent({
117
113
  }
118
114
  },
119
115
  /**
116
+ * @zh 表格的 table-layout 属性设置为 fixed,设置为 fixed 后,表格的宽度不会被内容撑开超出 100%。
117
+ * @en The table-layout property of the table is set to fixed. After it is set to fixed, the width of the table will not be stretched beyond 100% by the content.
118
+ */
119
+ tableLayoutFixed: {
120
+ type: Boolean,
121
+ default: false
122
+ },
123
+ /**
120
124
  * @zh 是否为加载中状态
121
125
  * @en Whether it is loading state
122
126
  */
@@ -322,10 +326,6 @@ var table_default = /* @__PURE__ */ defineComponent({
322
326
  type: [Object, Boolean],
323
327
  default: true
324
328
  },
325
- debug: {
326
- type: Boolean,
327
- default: false
328
- },
329
329
  /**
330
330
  * @zh 是否展示空子树
331
331
  * @en Whether to display empty subtrees
@@ -563,11 +563,6 @@ var table_default = /* @__PURE__ */ defineComponent({
563
563
  * @slot empty
564
564
  */
565
565
  /**
566
- * @zh 插入至表格最后一行之后的内容
567
- * @en Content inserted after the last table row
568
- * @slot append
569
- */
570
- /**
571
566
  * @zh 自定义 thead 元素
572
567
  * @en Custom thead element
573
568
  * @slot thead
@@ -594,12 +589,7 @@ var table_default = /* @__PURE__ */ defineComponent({
594
589
  return (_rowSelection$value$c = (_rowSelection$value = rowSelection.value) === null || _rowSelection$value === void 0 ? void 0 : _rowSelection$value.checkStrictly) !== null && _rowSelection$value$c !== void 0 ? _rowSelection$value$c : true;
595
590
  });
596
591
  const { scrollbarProps } = useScrollbar(scrollbar);
597
- const containerClientWidth = ref(0);
598
- const containerScrollWidth = ref(0);
599
- const autoScrollX = ref(false);
600
- const debugLog = (_phase, _payload) => {
601
- if (!props.debug) return;
602
- };
592
+ const displayScrollbar = computed(() => scrollbar.value !== false);
603
593
  const isScroll = computed(() => {
604
594
  var _props$scroll, _props$scroll2, _props$scroll3, _props$scroll4;
605
595
  return {
@@ -607,53 +597,20 @@ var table_default = /* @__PURE__ */ defineComponent({
607
597
  y: Boolean(((_props$scroll3 = props.scroll) === null || _props$scroll3 === void 0 ? void 0 : _props$scroll3.y) || ((_props$scroll4 = props.scroll) === null || _props$scroll4 === void 0 ? void 0 : _props$scroll4.maxHeight))
608
598
  };
609
599
  });
610
- const resolvedScroll = computed(() => ({
611
- x: isScroll.value.x || autoScrollX.value,
612
- y: isScroll.value.y
613
- }));
614
600
  const summaryRef = ref();
615
601
  const thRefs = ref({});
616
602
  const { componentRef: contentComRef, elementRef: contentRef } = useComponentRef("containerRef");
617
603
  const { componentRef: tbodyComRef, elementRef: tbodyRef } = useComponentRef("containerRef");
618
- const { componentRef: _virtualComRef, elementRef: virtualRef } = useComponentRef("viewportRef");
619
- const getVirtualListInstance = () => _virtualComRef.value;
620
- const theadRef = ref();
621
- const isVirtualList = computed(() => Boolean(props.virtualListProps));
622
- const splitTable = computed(() => {
623
- var _props$data$length, _props$data;
624
- return resolvedScroll.value.y || props.stickyHeader || isVirtualList.value || resolvedScroll.value.x && ((_props$data$length = (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.length) !== null && _props$data$length !== void 0 ? _props$data$length : 0) === 0;
625
- });
626
- const containerScrollLeft = ref(0);
627
- const alignLeft = ref(true);
628
- const alignRight = ref(true);
629
- const getScrollbarScrollElement = (component) => {
630
- var _ref, _scrollbar$elements$s, _scrollbar$elements, _scrollbar$elements2;
631
- if (component instanceof HTMLElement) return component;
632
- const scrollbar = component;
633
- return (_ref = (_scrollbar$elements$s = scrollbar === null || scrollbar === void 0 || (_scrollbar$elements = scrollbar.elements) === null || _scrollbar$elements === void 0 || (_scrollbar$elements = _scrollbar$elements.call(scrollbar)) === null || _scrollbar$elements === void 0 ? void 0 : _scrollbar$elements.scrollOffsetElement) !== null && _scrollbar$elements$s !== void 0 ? _scrollbar$elements$s : scrollbar === null || scrollbar === void 0 || (_scrollbar$elements2 = scrollbar.elements) === null || _scrollbar$elements2 === void 0 || (_scrollbar$elements2 = _scrollbar$elements2.call(scrollbar)) === null || _scrollbar$elements2 === void 0 ? void 0 : _scrollbar$elements2.viewport) !== null && _ref !== void 0 ? _ref : null;
634
- };
635
- const getScrollContainer = () => {
636
- var _ref3, _getScrollbarScrollEl2;
604
+ const { elementRef: virtualRef } = useComponentRef("viewportRef");
605
+ const { componentRef: theadComRef, elementRef: theadRef } = useComponentRef("containerRef");
606
+ const containerElement = computed(() => {
637
607
  if (splitTable.value) {
638
- var _ref2, _getScrollbarScrollEl;
639
- if (isVirtualList.value) {
640
- var _virtualRef$value;
641
- return (_virtualRef$value = virtualRef.value) !== null && _virtualRef$value !== void 0 ? _virtualRef$value : null;
642
- }
643
- return (_ref2 = (_getScrollbarScrollEl = getScrollbarScrollElement(tbodyComRef.value)) !== null && _getScrollbarScrollEl !== void 0 ? _getScrollbarScrollEl : tbodyRef.value) !== null && _ref2 !== void 0 ? _ref2 : null;
608
+ if (isVirtualList.value) return virtualRef.value;
609
+ return tbodyRef.value;
644
610
  }
645
- return (_ref3 = (_getScrollbarScrollEl2 = getScrollbarScrollElement(contentComRef.value)) !== null && _getScrollbarScrollEl2 !== void 0 ? _getScrollbarScrollEl2 : contentRef.value) !== null && _ref3 !== void 0 ? _ref3 : null;
646
- };
647
- const { width: containerElementWidth } = useElementSize(computed(() => getScrollContainer()));
648
- const getContainerMetrics = () => {
649
- var _element$scrollWidth;
650
- const element = getScrollContainer();
651
- return {
652
- element,
653
- clientWidth: containerElementWidth.value || (element === null || element === void 0 ? void 0 : element.clientWidth) || containerClientWidth.value,
654
- scrollWidth: (_element$scrollWidth = element === null || element === void 0 ? void 0 : element.scrollWidth) !== null && _element$scrollWidth !== void 0 ? _element$scrollWidth : containerScrollWidth.value
655
- };
656
- };
611
+ return contentRef.value;
612
+ });
613
+ const splitTable = computed(() => isScroll.value.y || props.stickyHeader || isVirtualList.value || isScroll.value.x && flattenData.value.length === 0);
657
614
  const slotColumnMap = reactive(/* @__PURE__ */ new Map());
658
615
  const slotColumns = ref();
659
616
  watch([components, slotColumnMap], ([components, slotColumnMap]) => {
@@ -669,17 +626,14 @@ var table_default = /* @__PURE__ */ defineComponent({
669
626
  const dataColumnMap = /* @__PURE__ */ new Map();
670
627
  const dataColumns = ref([]);
671
628
  const groupColumns = ref([]);
672
- const { resizingColumn, columnWidth, handleThMouseDown } = useColumnResize(thRefs, emit, (dataIndex) => {
673
- var _dataColumnMap$get;
674
- return (_dataColumnMap$get = dataColumnMap.get(dataIndex)) === null || _dataColumnMap$get === void 0 ? void 0 : _dataColumnMap$get.width;
675
- });
629
+ const { resizingColumn, columnWidth, handleThMouseDown } = useColumnResize(thRefs, emit);
676
630
  watch([
677
631
  columns,
678
632
  slotColumns,
679
633
  columnWidth
680
634
  ], ([columns, slotColumns]) => {
681
- var _ref4;
682
- const result = getGroupColumns((_ref4 = slotColumns !== null && slotColumns !== void 0 ? slotColumns : columns) !== null && _ref4 !== void 0 ? _ref4 : [], dataColumnMap, columnWidth);
635
+ var _ref;
636
+ const result = getGroupColumns((_ref = slotColumns !== null && slotColumns !== void 0 ? slotColumns : columns) !== null && _ref !== void 0 ? _ref : [], dataColumnMap, columnWidth);
683
637
  dataColumns.value = result.dataColumns;
684
638
  groupColumns.value = result.groupColumns;
685
639
  }, {
@@ -708,6 +662,10 @@ var table_default = /* @__PURE__ */ defineComponent({
708
662
  if (_hasRightFixedColumn !== hasRightFixedColumn.value) hasRightFixedColumn.value = _hasRightFixedColumn;
709
663
  if (_hasLeftFixedDataColumns !== hasLeftFixedDataColumns.value) hasLeftFixedDataColumns.value = _hasLeftFixedDataColumns;
710
664
  });
665
+ const hasEllipsis = computed(() => {
666
+ for (const col of dataColumns.value) if (col.ellipsis) return true;
667
+ return false;
668
+ });
711
669
  const handleChange = (type) => {
712
670
  const extra = {
713
671
  type,
@@ -746,9 +704,8 @@ var table_default = /* @__PURE__ */ defineComponent({
746
704
  disabledKeys.clear();
747
705
  const travelData = (data) => {
748
706
  if (isArray(data) && data.length > 0) for (const record of data) {
749
- const recordKey = getRecordKey(record, rowKey.value);
750
- allRowKeys.push(recordKey);
751
- if (record.disabled) disabledKeys.add(recordKey);
707
+ allRowKeys.push(getRecordKey(record, rowKey.value));
708
+ if (record.disabled) disabledKeys.add(getRecordKey(record, rowKey.value));
752
709
  if (record.children) travelData(record.children);
753
710
  }
754
711
  };
@@ -812,7 +769,7 @@ var table_default = /* @__PURE__ */ defineComponent({
812
769
  };
813
770
  const { dragType, dragState, handleDragStart, handleDragEnter, handleDragover, handleDragEnd, handleDrop } = useDrag(draggable);
814
771
  const processedData = computed(() => {
815
- var _props$data2;
772
+ var _props$data;
816
773
  const travel = (data) => {
817
774
  const result = [];
818
775
  for (const _record of data) {
@@ -835,7 +792,7 @@ var table_default = /* @__PURE__ */ defineComponent({
835
792
  }
836
793
  return result;
837
794
  };
838
- return travel((_props$data2 = props.data) !== null && _props$data2 !== void 0 ? _props$data2 : []);
795
+ return travel((_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : []);
839
796
  });
840
797
  const validData = computed(() => {
841
798
  const travel = (data) => data.filter((record) => {
@@ -864,7 +821,7 @@ var table_default = /* @__PURE__ */ defineComponent({
864
821
  dataIndex: field,
865
822
  direction
866
823
  });
867
- if (valueA == null || valueB == null) return 0;
824
+ if (valueA === void 0 || valueB === void 0) return 0;
868
825
  const result = valueA > valueB ? 1 : -1;
869
826
  return direction === "descend" ? -result : result;
870
827
  });
@@ -946,16 +903,19 @@ var table_default = /* @__PURE__ */ defineComponent({
946
903
  }
947
904
  return [];
948
905
  });
949
- const setAlignPosition = (element = getScrollContainer()) => {
950
- if (!element) {
951
- alignLeft.value = true;
952
- alignRight.value = true;
953
- return;
906
+ const containerScrollLeft = ref(0);
907
+ const alignLeft = ref(true);
908
+ const alignRight = ref(true);
909
+ const setAlignPosition = () => {
910
+ let _alignLeft = true;
911
+ let _alignRight = true;
912
+ const scrollContainer = containerElement.value;
913
+ if (scrollContainer) {
914
+ _alignLeft = containerScrollLeft.value === 0;
915
+ _alignRight = Math.ceil(containerScrollLeft.value + scrollContainer.offsetWidth) >= scrollContainer.scrollWidth;
954
916
  }
955
- const nextAlignLeft = containerScrollLeft.value === 0;
956
- const nextAlignRight = Math.ceil(containerScrollLeft.value + element.clientWidth) >= element.scrollWidth;
957
- if (nextAlignLeft !== alignLeft.value) alignLeft.value = nextAlignLeft;
958
- if (nextAlignRight !== alignRight.value) alignRight.value = nextAlignRight;
917
+ if (_alignLeft !== alignLeft.value) alignLeft.value = _alignLeft;
918
+ if (_alignRight !== alignRight.value) alignRight.value = _alignRight;
959
919
  };
960
920
  const getTableScrollCls = () => {
961
921
  if (alignLeft.value && alignRight.value) return `${prefixCls}-scroll-position-both`;
@@ -969,26 +929,13 @@ var table_default = /* @__PURE__ */ defineComponent({
969
929
  if (hasRightFixedColumn.value) cls.push(`${prefixCls}-has-fixed-col-right`);
970
930
  return cls;
971
931
  };
972
- const handleScroll = (event) => {
973
- const element = event.target;
974
- if (!element) return;
975
- if (element.scrollLeft !== containerScrollLeft.value) containerScrollLeft.value = element.scrollLeft;
976
- containerClientWidth.value = element.clientWidth;
977
- containerScrollWidth.value = element.scrollWidth;
978
- debugLog("scroll:x", {
979
- scrollLeft: element.scrollLeft,
980
- clientWidth: element.clientWidth,
981
- scrollWidth: element.scrollWidth,
982
- autoScrollX: autoScrollX.value,
983
- calculatedTableWidth: getCalculatedTableWidth()
984
- });
985
- setAlignPosition(element);
932
+ const handleScroll = (e) => {
933
+ if (e.target.scrollLeft !== containerScrollLeft.value) containerScrollLeft.value = e.target.scrollLeft;
934
+ setAlignPosition();
986
935
  };
987
- const onTbodyScroll = (event) => {
988
- handleScroll(event);
989
- const element = event.target;
990
- if (!element) return;
991
- const scrollLeft = element.scrollLeft;
936
+ const onTbodyScroll = (e) => {
937
+ handleScroll(e);
938
+ const { scrollLeft } = e.target;
992
939
  if (theadRef.value) theadRef.value.scrollLeft = scrollLeft;
993
940
  if (summaryRef.value) summaryRef.value.scrollLeft = scrollLeft;
994
941
  };
@@ -1061,7 +1008,26 @@ var table_default = /* @__PURE__ */ defineComponent({
1061
1008
  selection
1062
1009
  }) : operations;
1063
1010
  });
1064
- const hasResizedColumns = computed(() => Object.keys(columnWidth).length > 0);
1011
+ const tableGridTemplate = computed(() => getTableGridTemplate(dataColumns.value, operations.value, columnWidth));
1012
+ const getTableElementStyle = (base) => _objectSpread2(_objectSpread2({}, base), {}, { "--sd-table-grid-template": tableGridTemplate.value });
1013
+ const headerStyle = computed(() => {
1014
+ if (isScroll.value.x) {
1015
+ var _props$scroll5, _props$scroll6, _props$scroll7, _props$scroll8;
1016
+ const style = { width: isNumber((_props$scroll5 = props.scroll) === null || _props$scroll5 === void 0 ? void 0 : _props$scroll5.x) ? `${(_props$scroll6 = props.scroll) === null || _props$scroll6 === void 0 ? void 0 : _props$scroll6.x}px` : (_props$scroll7 = props.scroll) === null || _props$scroll7 === void 0 ? void 0 : _props$scroll7.x };
1017
+ if ((_props$scroll8 = props.scroll) === null || _props$scroll8 === void 0 ? void 0 : _props$scroll8.minWidth) style.minWidth = isNumber(props.scroll.minWidth) ? `${props.scroll.minWidth}px` : props.scroll.minWidth;
1018
+ return getTableElementStyle(style);
1019
+ }
1020
+ return getTableElementStyle();
1021
+ });
1022
+ const contentStyle = computed(() => {
1023
+ if (isScroll.value.x && flattenData.value.length > 0) {
1024
+ var _props$scroll9, _props$scroll10, _props$scroll11, _props$scroll12;
1025
+ const style = { width: isNumber((_props$scroll9 = props.scroll) === null || _props$scroll9 === void 0 ? void 0 : _props$scroll9.x) ? `${(_props$scroll10 = props.scroll) === null || _props$scroll10 === void 0 ? void 0 : _props$scroll10.x}px` : (_props$scroll11 = props.scroll) === null || _props$scroll11 === void 0 ? void 0 : _props$scroll11.x };
1026
+ if ((_props$scroll12 = props.scroll) === null || _props$scroll12 === void 0 ? void 0 : _props$scroll12.minWidth) style.minWidth = isNumber(props.scroll.minWidth) ? `${props.scroll.minWidth}px` : props.scroll.minWidth;
1027
+ return getTableElementStyle(style);
1028
+ }
1029
+ return getTableElementStyle();
1030
+ });
1065
1031
  const addColumn = (id, column) => {
1066
1032
  slotColumnMap.set(id, column);
1067
1033
  };
@@ -1100,7 +1066,8 @@ var table_default = /* @__PURE__ */ defineComponent({
1100
1066
  [`${prefixCls}-hover`]: props.hoverable,
1101
1067
  [`${prefixCls}-dragging`]: dragState.dragging,
1102
1068
  [`${prefixCls}-type-selection`]: Boolean(props.rowSelection),
1103
- [`${prefixCls}-empty`]: props.data && flattenData.value.length === 0
1069
+ [`${prefixCls}-empty`]: props.data && flattenData.value.length === 0,
1070
+ [`${prefixCls}-layout-fixed`]: props.tableLayoutFixed || isScroll.value.x || splitTable.value || hasEllipsis.value
1104
1071
  }
1105
1072
  ]);
1106
1073
  const paginationCls = computed(() => [`${prefixCls}-pagination`, {
@@ -1111,244 +1078,44 @@ var table_default = /* @__PURE__ */ defineComponent({
1111
1078
  }]);
1112
1079
  const tableCls = computed(() => {
1113
1080
  const cls = getTableFixedCls();
1114
- if (resolvedScroll.value.x) cls.push(getTableScrollCls());
1081
+ if (isScroll.value.x) cls.push(getTableScrollCls());
1115
1082
  if (splitTable.value) cls.push(`${prefixCls}-scroll-y`);
1116
1083
  return cls;
1117
1084
  });
1118
- const resolvedVirtualListProps = computed(() => {
1119
- var _ref5;
1120
- if (!props.virtualListProps) return;
1121
- const _props$virtualListPro = props.virtualListProps, { itemKey, keyField, estimatedSize, scrollbar: virtualScrollbar, itemSize, minItemSize, component: _component, listAttrs: _listAttrs, contentAttrs: _contentAttrs, listStyle: _listStyle, paddingPosition: _paddingPosition } = _props$virtualListPro;
1122
- return _objectSpread2(_objectSpread2({}, _objectWithoutProperties(_props$virtualListPro, _excluded)), {}, {
1123
- itemSize,
1124
- minItemSize: minItemSize !== null && minItemSize !== void 0 ? minItemSize : itemSize === void 0 ? estimatedSize : void 0,
1125
- keyField: (_ref5 = keyField !== null && keyField !== void 0 ? keyField : itemKey) !== null && _ref5 !== void 0 ? _ref5 : "key",
1126
- estimatedSize,
1127
- scrollbar: virtualScrollbar !== null && virtualScrollbar !== void 0 ? virtualScrollbar : props.scrollbar
1128
- });
1129
- });
1130
1085
  const tableVirtualListProps = computed(() => {
1131
- var _ref6, _ref7, _ref8, _props$scroll5, _props$scroll$y, _props$scroll6;
1132
- if (!resolvedVirtualListProps.value) return;
1133
- if ("prerender" in resolvedVirtualListProps.value && resolvedVirtualListProps.value.prerender !== void 0) return resolvedVirtualListProps.value;
1134
- const rowHeightSource = (_ref6 = (_ref7 = (_ref8 = typeof resolvedVirtualListProps.value.itemSize === "number" ? resolvedVirtualListProps.value.itemSize : void 0) !== null && _ref8 !== void 0 ? _ref8 : typeof resolvedVirtualListProps.value.minItemSize === "number" ? resolvedVirtualListProps.value.minItemSize : void 0) !== null && _ref7 !== void 0 ? _ref7 : resolvedVirtualListProps.value.estimatedSize) !== null && _ref6 !== void 0 ? _ref6 : 32;
1135
- const scrollY = typeof ((_props$scroll5 = props.scroll) === null || _props$scroll5 === void 0 ? void 0 : _props$scroll5.y) === "number" ? props.scroll.y : Number.parseFloat((_props$scroll$y = (_props$scroll6 = props.scroll) === null || _props$scroll6 === void 0 ? void 0 : _props$scroll6.y) !== null && _props$scroll$y !== void 0 ? _props$scroll$y : "") || rowHeightSource * 8;
1136
- const prerender = Math.max(Math.ceil(scrollY / Math.max(rowHeightSource, 1)), 8);
1137
- return _objectSpread2(_objectSpread2({}, resolvedVirtualListProps.value), {}, { prerender });
1086
+ if (!props.virtualListProps) return {};
1087
+ const _props$virtualListPro = props.virtualListProps, { data: _data, itemKey: _itemKey, component: _component, listAttrs: _listAttrs, contentAttrs: _contentAttrs, paddingPosition: _paddingPosition, isStaticItemHeight, fixedSize } = _props$virtualListPro;
1088
+ return _objectSpread2(_objectSpread2({}, _objectWithoutProperties(_props$virtualListPro, _excluded)), {}, { fixedSize: fixedSize !== null && fixedSize !== void 0 ? fixedSize : isStaticItemHeight });
1138
1089
  });
1090
+ const isVirtualList = computed(() => Boolean(props.virtualListProps));
1139
1091
  const thWidth = ref({});
1140
1092
  const getThWidth = () => {
1141
1093
  const width = {};
1142
1094
  for (const key of Object.keys(thRefs.value)) width[key] = thRefs.value[key].offsetWidth;
1143
1095
  thWidth.value = width;
1144
1096
  };
1145
- const getCalculatedTableWidth = () => {
1146
- return operations.value.reduce((sum, item) => {
1147
- var _item$width;
1148
- return sum + ((_item$width = item.width) !== null && _item$width !== void 0 ? _item$width : 40);
1149
- }, 0) + dataColumns.value.reduce((sum, item) => {
1150
- const resizedWidth = item.dataIndex ? columnWidth[item.dataIndex] : void 0;
1151
- if (resizedWidth) return sum + resizedWidth;
1152
- if (item.width) return sum + item.width;
1153
- if (item.minWidth) return sum + item.minWidth;
1154
- const measuredWidth = item.dataIndex ? thWidth.value[item.dataIndex] : void 0;
1155
- return sum + (measuredWidth !== null && measuredWidth !== void 0 ? measuredWidth : 0);
1156
- }, 0);
1157
- };
1158
- const resolvedColumnWidth = computed(() => {
1159
- var _props$scroll7, _props$scroll8;
1160
- if (Boolean(((_props$scroll7 = props.scroll) === null || _props$scroll7 === void 0 ? void 0 : _props$scroll7.x) || ((_props$scroll8 = props.scroll) === null || _props$scroll8 === void 0 ? void 0 : _props$scroll8.minWidth)) || autoScrollX.value || containerClientWidth.value <= 0) return _objectSpread2({}, columnWidth);
1161
- const operationWidth = operations.value.reduce((sum, item) => {
1162
- var _item$width2;
1163
- return sum + ((_item$width2 = item.width) !== null && _item$width2 !== void 0 ? _item$width2 : 40);
1164
- }, 0);
1165
- const availableDataWidth = containerClientWidth.value - operationWidth;
1166
- if (availableDataWidth <= 0) return columnWidth;
1167
- const nextColumnWidth = {};
1168
- const flexColumns = [];
1169
- let frozenWidth = 0;
1170
- for (const item of dataColumns.value) {
1171
- var _item$minWidth, _thWidth$value$key;
1172
- if (!item.dataIndex) continue;
1173
- const key = item.dataIndex;
1174
- const min = Math.max((_item$minWidth = item.minWidth) !== null && _item$minWidth !== void 0 ? _item$minWidth : 40, 40);
1175
- const resizedWidth = columnWidth[key];
1176
- const declaredWidth = item.width;
1177
- if (resizedWidth != null || declaredWidth != null) {
1178
- var _ref9;
1179
- const width = Math.max((_ref9 = resizedWidth !== null && resizedWidth !== void 0 ? resizedWidth : declaredWidth) !== null && _ref9 !== void 0 ? _ref9 : min, min);
1180
- nextColumnWidth[key] = width;
1181
- frozenWidth += width;
1182
- continue;
1183
- }
1184
- const measuredWidth = (_thWidth$value$key = thWidth.value[key]) !== null && _thWidth$value$key !== void 0 ? _thWidth$value$key : min;
1185
- flexColumns.push({
1186
- key,
1187
- min,
1188
- base: Math.max(measuredWidth, min)
1189
- });
1190
- }
1191
- if (flexColumns.length === 0) return nextColumnWidth;
1192
- let remaining = availableDataWidth - frozenWidth;
1193
- if (remaining <= 0) {
1194
- for (const item of flexColumns) nextColumnWidth[item.key] = item.base;
1195
- return nextColumnWidth;
1196
- }
1197
- let unfrozen = [...flexColumns];
1198
- while (unfrozen.length > 0) {
1199
- const ideal = remaining / unfrozen.length;
1200
- const idealRounded = Math.round(ideal);
1201
- const violated = unfrozen.filter((item) => idealRounded < item.min);
1202
- if (violated.length === 0) {
1203
- let assigned = 0;
1204
- unfrozen.forEach((item, index) => {
1205
- const width = index === unfrozen.length - 1 ? Math.max(Math.round(remaining - assigned), item.min) : idealRounded;
1206
- nextColumnWidth[item.key] = width;
1207
- assigned += width;
1208
- });
1209
- break;
1210
- }
1211
- for (const item of violated) {
1212
- nextColumnWidth[item.key] = item.min;
1213
- remaining -= item.min;
1214
- }
1215
- unfrozen = unfrozen.filter((item) => idealRounded >= item.min);
1216
- if (remaining <= 0) {
1217
- for (const item of unfrozen) nextColumnWidth[item.key] = item.min;
1218
- break;
1219
- }
1220
- }
1221
- return nextColumnWidth;
1222
- });
1223
- const collectColumnMetrics = () => dataColumns.value.map((item) => ({
1224
- dataIndex: item.dataIndex,
1225
- width: item.width,
1226
- minWidth: item.minWidth,
1227
- resizedWidth: item.dataIndex ? columnWidth[item.dataIndex] : void 0,
1228
- measuredThWidth: item.dataIndex ? thWidth.value[item.dataIndex] : void 0
1229
- }));
1230
- const resolvedTableMinWidth = computed(() => {
1231
- const totalWidth = getCalculatedTableWidth();
1232
- if (!autoScrollX.value) return;
1233
- return totalWidth > 0 ? `${totalWidth}px` : void 0;
1234
- });
1235
- const mergeMinWidth = (style = {}) => {
1236
- if (!resolvedTableMinWidth.value) return Object.keys(style).length > 0 ? style : void 0;
1237
- return _objectSpread2(_objectSpread2({}, style), {}, { minWidth: style.minWidth ? `max(${style.minWidth}, ${resolvedTableMinWidth.value})` : resolvedTableMinWidth.value });
1238
- };
1239
- const tableStyle = computed(() => {
1240
- if (resolvedScroll.value.x) {
1241
- var _props$scroll9, _props$scroll10, _props$scroll11, _props$scroll12;
1242
- const resolvedScrollWidth = isNumber((_props$scroll9 = props.scroll) === null || _props$scroll9 === void 0 ? void 0 : _props$scroll9.x) ? `${(_props$scroll10 = props.scroll) === null || _props$scroll10 === void 0 ? void 0 : _props$scroll10.x}px` : (_props$scroll11 = props.scroll) === null || _props$scroll11 === void 0 ? void 0 : _props$scroll11.x;
1243
- const style = { width: resolvedScrollWidth };
1244
- if ((_props$scroll12 = props.scroll) === null || _props$scroll12 === void 0 ? void 0 : _props$scroll12.minWidth) style.minWidth = isNumber(props.scroll.minWidth) ? `${props.scroll.minWidth}px` : props.scroll.minWidth;
1245
- else if (resolvedScrollWidth) style.minWidth = resolvedScrollWidth;
1246
- return mergeMinWidth(style);
1247
- }
1248
- return mergeMinWidth();
1249
- });
1250
- const gridTemplateColumns = computed(() => {
1251
- const operationTracks = operations.value.map((item) => {
1252
- var _item$width3;
1253
- return `${(_item$width3 = item.width) !== null && _item$width3 !== void 0 ? _item$width3 : 40}px`;
1254
- });
1255
- const dataTracks = dataColumns.value.map((item) => {
1256
- var _item$minWidth2;
1257
- const key = item.dataIndex;
1258
- const resizedWidth = key ? resolvedColumnWidth.value[key] : void 0;
1259
- const width = resizedWidth !== null && resizedWidth !== void 0 ? resizedWidth : item.width;
1260
- const minWidth = (_item$minWidth2 = item.minWidth) !== null && _item$minWidth2 !== void 0 ? _item$minWidth2 : 40;
1261
- if (width != null) return `${Math.max(width, minWidth)}px`;
1262
- return `minmax(${minWidth}px, 1fr)`;
1263
- });
1264
- return operationTracks.concat(dataTracks).join(" ");
1265
- });
1266
- const elementStyle = computed(() => {
1267
- return _objectSpread2(_objectSpread2({}, tableStyle.value ? _objectSpread2({}, tableStyle.value) : {}), {}, { "--sd-table-grid-template": gridTemplateColumns.value });
1268
- });
1269
- const syncContainerMetrics = (reason) => {
1270
- var _props$scroll13, _props$scroll14;
1271
- const { element, clientWidth, scrollWidth } = getContainerMetrics();
1272
- if (!element) return;
1273
- containerClientWidth.value = clientWidth;
1274
- containerScrollWidth.value = scrollWidth;
1275
- containerScrollLeft.value = element.scrollLeft;
1276
- const explicitScrollX = Boolean(((_props$scroll13 = props.scroll) === null || _props$scroll13 === void 0 ? void 0 : _props$scroll13.x) || ((_props$scroll14 = props.scroll) === null || _props$scroll14 === void 0 ? void 0 : _props$scroll14.minWidth));
1277
- const calculatedTableWidth = getCalculatedTableWidth();
1278
- autoScrollX.value = !explicitScrollX && containerClientWidth.value > 0 && calculatedTableWidth > containerClientWidth.value;
1279
- debugLog(`layout:${reason}`, {
1280
- explicitScroll: props.scroll,
1281
- resolvedScroll: resolvedScroll.value,
1282
- autoScrollX: autoScrollX.value,
1283
- calculatedTableWidth,
1284
- resolvedTableMinWidth: resolvedTableMinWidth.value,
1285
- container: {
1286
- clientWidth: containerClientWidth.value,
1287
- scrollWidth: containerScrollWidth.value,
1288
- scrollLeft: element.scrollLeft
1289
- },
1290
- splitTable: splitTable.value,
1291
- hasResizedColumns: hasResizedColumns.value,
1292
- columns: collectColumnMetrics()
1293
- });
1294
- setAlignPosition(element);
1295
- };
1296
1097
  const hasScrollBar = ref(false);
1297
- const { width: tbodyBorderWidth } = useElementBounding(tbodyRef);
1298
- const { width: tbodyContentWidth } = useElementSize(tbodyRef);
1299
1098
  const isTbodyHasScrollBar = () => {
1300
- if (tbodyRef.value) return tbodyBorderWidth.value > tbodyContentWidth.value + 1;
1099
+ if (tbodyRef.value) return tbodyRef.value.offsetWidth > tbodyRef.value.clientWidth;
1301
1100
  return false;
1302
1101
  };
1303
1102
  const handleTbodyResize = () => {
1304
1103
  const _hasScrollBar = isTbodyHasScrollBar();
1305
1104
  if (hasScrollBar.value !== _hasScrollBar) hasScrollBar.value = _hasScrollBar;
1105
+ setAlignPosition();
1306
1106
  getThWidth();
1307
- syncContainerMetrics("tbody-resize");
1308
1107
  };
1309
- useResizeObserver(tbodyRef, () => {
1310
- handleTbodyResize();
1311
- });
1312
- useResizeObserver(virtualRef, () => {
1313
- handleTbodyResize();
1314
- });
1315
- useResizeObserver(contentRef, () => {
1316
- getThWidth();
1317
- syncContainerMetrics("content-resize");
1318
- });
1319
1108
  onMounted(() => {
1320
1109
  hasScrollBar.value = isTbodyHasScrollBar();
1321
1110
  getThWidth();
1322
- syncContainerMetrics("mounted");
1323
- });
1324
- watch([
1325
- thWidth,
1326
- columnWidth,
1327
- dataColumns
1328
- ], _asyncToGenerator(function* () {
1329
- yield nextTick();
1330
- syncContainerMetrics("state-change");
1331
- }), { deep: true });
1332
- watchThrottled(columnWidth, _asyncToGenerator(function* () {
1333
- var _getVirtualListInstan, _getVirtualListInstan2;
1334
- if (!isVirtualList.value) return;
1335
- yield nextTick();
1336
- (_getVirtualListInstan = getVirtualListInstance()) === null || _getVirtualListInstan === void 0 || (_getVirtualListInstan2 = _getVirtualListInstan.forceUpdate) === null || _getVirtualListInstan2 === void 0 || _getVirtualListInstan2.call(_getVirtualListInstan, true);
1337
- }), {
1338
- deep: true,
1339
- throttle: 400
1340
1111
  });
1341
1112
  const spinProps = computed(() => isObject(props.loading) ? props.loading : { loading: props.loading });
1342
1113
  const renderEmpty = () => {
1343
1114
  return createVNode(table_tr_default, { "empty": true }, { default: () => [createVNode(table_td_default, { "colSpan": dataColumns.value.length + operations.value.length }, { default: () => {
1344
- var _ref10, _slots$empty, _slots$empty2, _configCtx$slots, _configCtx$slots$empt;
1345
- return [(_ref10 = (_slots$empty = (_slots$empty2 = slots.empty) === null || _slots$empty2 === void 0 ? void 0 : _slots$empty2.call(slots)) !== null && _slots$empty !== void 0 ? _slots$empty : configCtx === null || configCtx === void 0 || (_configCtx$slots$empt = (_configCtx$slots = configCtx.slots).empty) === null || _configCtx$slots$empt === void 0 ? void 0 : _configCtx$slots$empt.call(_configCtx$slots, { component: "table" })) !== null && _ref10 !== void 0 ? _ref10 : createVNode(Empty, null, null)];
1115
+ var _ref2, _slots$empty, _slots$empty2, _configCtx$slots, _configCtx$slots$empt;
1116
+ return [(_ref2 = (_slots$empty = (_slots$empty2 = slots.empty) === null || _slots$empty2 === void 0 ? void 0 : _slots$empty2.call(slots)) !== null && _slots$empty !== void 0 ? _slots$empty : configCtx === null || configCtx === void 0 || (_configCtx$slots$empt = (_configCtx$slots = configCtx.slots).empty) === null || _configCtx$slots$empt === void 0 ? void 0 : _configCtx$slots$empt.call(_configCtx$slots, { component: "table" })) !== null && _ref2 !== void 0 ? _ref2 : createVNode(Empty, null, null)];
1346
1117
  } })] });
1347
1118
  };
1348
- const renderAppend = () => {
1349
- if (!slots.append) return null;
1350
- return createVNode("div", { "class": `${prefixCls}-append` }, [slots.append()]);
1351
- };
1352
1119
  const renderExpandContent = (record) => {
1353
1120
  var _props$expandable2;
1354
1121
  if (record.expand) return isFunction(record.expand) ? record.expand() : record.expand;
@@ -1366,17 +1133,23 @@ var table_default = /* @__PURE__ */ defineComponent({
1366
1133
  data: summaryData,
1367
1134
  columns: allColumns
1368
1135
  });
1136
+ const getVirtualColumnStyle = (name) => {
1137
+ if (!isVirtualList.value || !name || !thWidth.value[name]) return;
1138
+ return { width: `${thWidth.value[name]}px` };
1139
+ };
1369
1140
  const renderSummaryRow = (record, rowIndex) => {
1370
- return createVNode(table_tr_default, mergeProps({
1141
+ return createVNode(table_tr_default, {
1371
1142
  "key": `table-summary-${rowIndex}`,
1372
- "class": [`${prefixCls}-tr-summary`, isFunction(props.rowClass) ? props.rowClass(record.raw, rowIndex) : props.rowClass]
1373
- }, { onClick: (ev) => handleRowClick(record, ev) }), {
1143
+ "class": [`${prefixCls}-tr-summary`, isFunction(props.rowClass) ? props.rowClass(record.raw, rowIndex) : props.rowClass],
1144
+ "onClick": (ev) => handleRowClick(record, ev)
1145
+ }, {
1374
1146
  default: () => [operations.value.map((operation, index) => {
1375
1147
  var _tableSummarySpan$val;
1376
1148
  const cellId = `${rowIndex}-${index}-${record.key}`;
1377
1149
  const [rowspan, colspan] = (_tableSummarySpan$val = tableSummarySpan.value[cellId]) !== null && _tableSummarySpan$val !== void 0 ? _tableSummarySpan$val : [1, 1];
1378
1150
  if (removedSummaryCells.value.includes(cellId)) return null;
1379
1151
  return createVNode(table_operation_td_default, {
1152
+ "style": getVirtualColumnStyle(operation.name),
1380
1153
  "operationColumn": operation,
1381
1154
  "operations": operations.value,
1382
1155
  "record": record,
@@ -1389,8 +1162,10 @@ var table_default = /* @__PURE__ */ defineComponent({
1389
1162
  const cellId = `${rowIndex}-${operations.value.length + index}-${record.key}`;
1390
1163
  const [rowspan, colspan] = (_tableSummarySpan$val2 = tableSummarySpan.value[cellId]) !== null && _tableSummarySpan$val2 !== void 0 ? _tableSummarySpan$val2 : [1, 1];
1391
1164
  if (removedSummaryCells.value.includes(cellId)) return null;
1392
- return createVNode(table_td_default, mergeProps({
1165
+ const style = getVirtualColumnStyle(column.dataIndex);
1166
+ return createVNode(table_td_default, {
1393
1167
  "key": `td-${cellId}`,
1168
+ "style": style,
1394
1169
  "rowIndex": rowIndex,
1395
1170
  "record": record,
1396
1171
  "column": column,
@@ -1398,14 +1173,13 @@ var table_default = /* @__PURE__ */ defineComponent({
1398
1173
  "dataColumns": dataColumns.value,
1399
1174
  "rowSpan": rowspan,
1400
1175
  "colSpan": colspan,
1401
- "summary": true
1176
+ "summary": true,
1177
+ "onClick": (ev) => handleCellClick(record, column, ev),
1178
+ "onDblclick": (ev) => handleCellDblclick(record, column, ev),
1179
+ "onMouseenter": (ev) => handleCellMouseEnter(record, column, ev),
1180
+ "onMouseleave": (ev) => handleCellMouseLeave(record, column, ev),
1181
+ "onContextmenu": (ev) => handleCellContextmenu(record, column, ev)
1402
1182
  }, {
1403
- onClick: (ev) => handleCellClick(record, column, ev),
1404
- onDblclick: (ev) => handleCellDblclick(record, column, ev),
1405
- onMouseenter: (ev) => handleCellMouseEnter(record, column, ev),
1406
- onMouseleave: (ev) => handleCellMouseLeave(record, column, ev),
1407
- onContextmenu: (ev) => handleCellContextmenu(record, column, ev)
1408
- }), {
1409
1183
  td: slots.td,
1410
1184
  cell: slots["summary-cell"]
1411
1185
  });
@@ -1418,7 +1192,7 @@ var table_default = /* @__PURE__ */ defineComponent({
1418
1192
  return null;
1419
1193
  };
1420
1194
  const renderExpandBtn = (record, stopPropagation = true) => {
1421
- var _ref11, _slots$expandIcon, _slots$expandIcon2, _props$expandable3, _props$expandable3$ic;
1195
+ var _ref3, _slots$expandIcon, _slots$expandIcon2, _props$expandable3, _props$expandable3$ic;
1422
1196
  const currentKey = record.key;
1423
1197
  const expanded = expandedRowKeys.value.includes(currentKey);
1424
1198
  return createVNode("button", {
@@ -1428,10 +1202,10 @@ var table_default = /* @__PURE__ */ defineComponent({
1428
1202
  handleExpand(currentKey, record.raw);
1429
1203
  if (stopPropagation) ev.stopPropagation();
1430
1204
  }
1431
- }, [(_ref11 = (_slots$expandIcon = (_slots$expandIcon2 = slots["expand-icon"]) === null || _slots$expandIcon2 === void 0 ? void 0 : _slots$expandIcon2.call(slots, {
1205
+ }, [(_ref3 = (_slots$expandIcon = (_slots$expandIcon2 = slots["expand-icon"]) === null || _slots$expandIcon2 === void 0 ? void 0 : _slots$expandIcon2.call(slots, {
1432
1206
  expanded,
1433
1207
  record: record.raw
1434
- })) !== null && _slots$expandIcon !== void 0 ? _slots$expandIcon : (_props$expandable3 = props.expandable) === null || _props$expandable3 === void 0 || (_props$expandable3$ic = _props$expandable3.icon) === null || _props$expandable3$ic === void 0 ? void 0 : _props$expandable3$ic.call(_props$expandable3, expanded, record.raw)) !== null && _ref11 !== void 0 ? _ref11 : expanded ? createVNode(IconMinus, null, null) : createVNode(IconPlus, null, null)]);
1208
+ })) !== null && _slots$expandIcon !== void 0 ? _slots$expandIcon : (_props$expandable3 = props.expandable) === null || _props$expandable3 === void 0 || (_props$expandable3$ic = _props$expandable3.icon) === null || _props$expandable3$ic === void 0 ? void 0 : _props$expandable3$ic.call(_props$expandable3, expanded, record.raw)) !== null && _ref3 !== void 0 ? _ref3 : expanded ? createVNode(IconMinus, null, null) : createVNode(IconPlus, null, null)]);
1435
1209
  };
1436
1210
  const renderExpand = (record, { indentSize, indexPath, allowDrag, expandContent }) => {
1437
1211
  if (record.hasSubtree) {
@@ -1443,14 +1217,17 @@ var table_default = /* @__PURE__ */ defineComponent({
1443
1217
  allowDrag
1444
1218
  }));
1445
1219
  }
1446
- if (expandContent) return createVNode(table_tr_default, {
1447
- "key": `${record.key}-expand`,
1448
- "expand": true
1449
- }, { default: () => [createVNode(table_td_default, {
1450
- "isFixedExpand": hasLeftFixedColumn.value || hasRightFixedColumn.value,
1451
- "containerWidth": containerClientWidth.value,
1452
- "colSpan": dataColumns.value.length + operations.value.length
1453
- }, _isSlot(expandContent) ? expandContent : { default: () => [expandContent] })] });
1220
+ if (expandContent) {
1221
+ const scrollContainer = containerElement.value;
1222
+ return createVNode(table_tr_default, {
1223
+ "key": `${record.key}-expand`,
1224
+ "expand": true
1225
+ }, { default: () => [createVNode(table_td_default, {
1226
+ "isFixedExpand": hasLeftFixedColumn.value || hasRightFixedColumn.value,
1227
+ "containerWidth": scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.clientWidth,
1228
+ "colSpan": dataColumns.value.length + operations.value.length
1229
+ }, _isSlot(expandContent) ? expandContent : { default: () => [expandContent] })] });
1230
+ }
1454
1231
  return null;
1455
1232
  };
1456
1233
  const renderRecord = (record, rowIndex, { indentSize = 0, indexPath, allowDrag = true } = {}) => {
@@ -1460,7 +1237,6 @@ var table_default = /* @__PURE__ */ defineComponent({
1460
1237
  const expandContent = renderExpandContent(record);
1461
1238
  const showExpand = expandedRowKeys.value.includes(currentKey);
1462
1239
  const isDragTarget = dragState.sourceKey === record.key;
1463
- const isDropTarget = dragState.dragging && dragState.dropIndicatorPath.toString() === currentPath.toString() && !isDragTarget;
1464
1240
  const dragSourceEvent = dragType.value ? {
1465
1241
  draggable: allowDrag,
1466
1242
  onDragstart: (ev) => {
@@ -1491,24 +1267,24 @@ var table_default = /* @__PURE__ */ defineComponent({
1491
1267
  "key": currentKey,
1492
1268
  "class": [{
1493
1269
  [`${prefixCls}-tr-draggable`]: dragType.value === "row",
1494
- [`${prefixCls}-tr-drag`]: isDragTarget,
1495
- [`${prefixCls}-tr-drop-target`]: isDropTarget
1270
+ [`${prefixCls}-tr-drag`]: isDragTarget
1496
1271
  }, isFunction(props.rowClass) ? props.rowClass(record.raw, rowIndex) : props.rowClass],
1497
1272
  "rowIndex": rowIndex,
1498
1273
  "record": record,
1499
- "checked": props.rowSelection && ((_selectedRowKeys$valu = selectedRowKeys.value) === null || _selectedRowKeys$valu === void 0 ? void 0 : _selectedRowKeys$valu.includes(currentKey))
1500
- }, {
1501
- onClick: (ev) => handleRowClick(record, ev),
1502
- onDblclick: (ev) => handleRowDblclick(record, ev),
1503
- onContextmenu: (ev) => handleRowContextMenu(record, ev)
1274
+ "checked": props.rowSelection && ((_selectedRowKeys$valu = selectedRowKeys.value) === null || _selectedRowKeys$valu === void 0 ? void 0 : _selectedRowKeys$valu.includes(currentKey)),
1275
+ "onClick": (ev) => handleRowClick(record, ev),
1276
+ "onDblclick": (ev) => handleRowDblclick(record, ev),
1277
+ "onContextmenu": (ev) => handleRowContextMenu(record, ev)
1504
1278
  }, dragType.value === "row" ? dragSourceEvent : {}, dragTargetEvent), {
1505
1279
  default: () => [operations.value.map((operation, index) => {
1506
1280
  var _tableSpan$value$cell;
1507
1281
  const cellId = `${rowIndex}-${index}-${record.key}`;
1508
1282
  const [rowspan, colspan] = props.spanAll ? (_tableSpan$value$cell = tableSpan.value[cellId]) !== null && _tableSpan$value$cell !== void 0 ? _tableSpan$value$cell : [1, 1] : [1, 1];
1509
1283
  if (props.spanAll && removedCells.value.includes(cellId)) return null;
1284
+ const style = getVirtualColumnStyle(operation.name);
1510
1285
  return createVNode(table_operation_td_default, mergeProps({
1511
1286
  "key": `operation-td-${index}`,
1287
+ "style": style,
1512
1288
  "operationColumn": operation,
1513
1289
  "operations": operations.value,
1514
1290
  "record": record,
@@ -1527,8 +1303,10 @@ var table_default = /* @__PURE__ */ defineComponent({
1527
1303
  showExpandBtn: record.hasSubtree,
1528
1304
  indentSize: record.hasSubtree ? indentSize - 20 : indentSize
1529
1305
  } : {};
1306
+ const style = getVirtualColumnStyle(column.dataIndex);
1530
1307
  return createVNode(table_td_default, mergeProps({
1531
1308
  "key": `td-${index}`,
1309
+ "style": style,
1532
1310
  "rowIndex": rowIndex,
1533
1311
  "record": record,
1534
1312
  "column": column,
@@ -1538,11 +1316,11 @@ var table_default = /* @__PURE__ */ defineComponent({
1538
1316
  "renderExpandBtn": renderExpandBtn,
1539
1317
  "colSpan": colspan
1540
1318
  }, extraProps, {
1541
- onClick: (ev) => handleCellClick(record, column, ev),
1542
- onDblclick: (ev) => handleCellDblclick(record, column, ev),
1543
- onMouseenter: (ev) => handleCellMouseEnter(record, column, ev),
1544
- onMouseleave: (ev) => handleCellMouseLeave(record, column, ev),
1545
- onContextmenu: (ev) => handleCellContextmenu(record, column, ev)
1319
+ "onClick": (ev) => handleCellClick(record, column, ev),
1320
+ "onDblclick": (ev) => handleCellDblclick(record, column, ev),
1321
+ "onMouseenter": (ev) => handleCellMouseEnter(record, column, ev),
1322
+ "onMouseleave": (ev) => handleCellMouseLeave(record, column, ev),
1323
+ "onContextmenu": (ev) => handleCellContextmenu(record, column, ev)
1546
1324
  }), { td: slots.td });
1547
1325
  })],
1548
1326
  tr: slots.tr
@@ -1560,112 +1338,115 @@ var table_default = /* @__PURE__ */ defineComponent({
1560
1338
  tbody: slots.tbody
1561
1339
  });
1562
1340
  };
1563
- const renderVirtualRecord = (record, index) => {
1564
- const hasSubData = flattenData.value.some((item) => Boolean(item.hasSubtree));
1565
- return createVNode("div", { "class": `${prefixCls}-virtual-item` }, [renderRecord(record, index, { indentSize: hasSubData ? 20 : 0 })]);
1566
- };
1567
1341
  const renderHeader = () => createVNode(table_thead_default, null, {
1568
1342
  default: () => [groupColumns.value.map((row, index) => createVNode(table_tr_default, { "key": `header-row-${index}` }, { default: () => [index === 0 && operations.value.map((operation, index) => {
1569
1343
  var _props$rowSelection2;
1570
- return createVNode(table_operation_th_default, mergeProps({ "key": `operation-th-${index}` }, { ref: (ins) => {
1571
- const instance = ins;
1572
- if ((instance === null || instance === void 0 ? void 0 : instance.$el) && operation.name) thRefs.value[operation.name] = instance.$el;
1573
- } }, {
1344
+ return createVNode(table_operation_th_default, {
1345
+ "key": `operation-th-${index}`,
1346
+ "ref": (ins) => {
1347
+ if ((ins === null || ins === void 0 ? void 0 : ins.$el) && operation.name) thRefs.value[operation.name] = ins.$el;
1348
+ },
1574
1349
  "operationColumn": operation,
1575
1350
  "operations": operations.value,
1576
1351
  "selectAll": Boolean(operation.name === "selection-checkbox" && ((_props$rowSelection2 = props.rowSelection) === null || _props$rowSelection2 === void 0 ? void 0 : _props$rowSelection2.showCheckedAll)),
1577
1352
  "rowSpan": groupColumns.value.length
1578
- }), null);
1353
+ }, null);
1579
1354
  }), row.map((column, index) => {
1580
1355
  const resizable = props.columnResizable && Boolean(column.dataIndex) && index < row.length - 1;
1581
- return createVNode(table_th_default, mergeProps({ "key": `th-${index}` }, { ref: (ins) => {
1582
- const instance = ins;
1583
- if ((instance === null || instance === void 0 ? void 0 : instance.$el) && column.dataIndex) thRefs.value[column.dataIndex] = instance.$el;
1584
- } }, {
1356
+ return createVNode(table_th_default, {
1357
+ "key": `th-${index}`,
1358
+ "ref": (ins) => {
1359
+ if ((ins === null || ins === void 0 ? void 0 : ins.$el) && column.dataIndex) thRefs.value[column.dataIndex] = ins.$el;
1360
+ },
1585
1361
  "column": column,
1586
1362
  "operations": operations.value,
1587
1363
  "dataColumns": dataColumns.value,
1588
- "resizable": resizable
1589
- }, { onClick: (ev) => handleHeaderClick(column, ev) }), { th: slots.th });
1364
+ "resizable": resizable,
1365
+ "onClick": (ev) => handleHeaderClick(column, ev)
1366
+ }, { th: slots.th });
1590
1367
  })] }))],
1591
1368
  thead: slots.thead
1592
1369
  });
1593
1370
  const renderContent = () => {
1594
1371
  if (splitTable.value) {
1595
- var _props$scroll15, _props$scroll16;
1372
+ var _props$scroll13, _props$scroll14;
1596
1373
  const top = isNumber(props.stickyHeader) ? `${props.stickyHeader}px` : void 0;
1597
- const bodyContent = isVirtualList.value && flattenData.value.length ? createVNode("div", {
1598
- "class": `${prefixCls}-element`,
1599
- "style": elementStyle.value
1600
- }, [createVNode("div", { "class": `${prefixCls}-tbody` }, [createVNode(virtual_list_default, mergeProps({
1601
- "ref": (ins) => {
1602
- var _ins$scrollerRef;
1603
- _virtualComRef.value = ins;
1604
- if (ins === null || ins === void 0 ? void 0 : ins.$el) tbodyRef.value = ins.$el;
1605
- if ((ins === null || ins === void 0 || (_ins$scrollerRef = ins.scrollerRef) === null || _ins$scrollerRef === void 0 ? void 0 : _ins$scrollerRef.$el) instanceof HTMLElement) virtualRef.value = ins.scrollerRef.$el;
1606
- else if (ins === null || ins === void 0 ? void 0 : ins.viewportRef) virtualRef.value = ins.viewportRef;
1607
- },
1608
- "class": `${prefixCls}-body`,
1609
- "items": flattenData.value,
1610
- "keyField": "key",
1611
- "height": "auto",
1612
- "onScroll": onTbodyScroll
1613
- }, tableVirtualListProps.value), { item: ({ item, index }) => renderVirtualRecord(item, index) })])]) : createVNode(Scrollbar, mergeProps({
1614
- "ref": tbodyComRef,
1615
- "class": `${prefixCls}-body`,
1616
- "style": { maxHeight: isNumber((_props$scroll15 = props.scroll) === null || _props$scroll15 === void 0 ? void 0 : _props$scroll15.y) ? `${(_props$scroll16 = props.scroll) === null || _props$scroll16 === void 0 ? void 0 : _props$scroll16.y}px` : "100%" }
1617
- }, _objectSpread2(_objectSpread2({}, scrollbarProps.value), {}, { outerStyle: _objectSpread2({
1618
- display: "flex",
1619
- minHeight: "0"
1620
- }, Array.isArray(scrollbarProps.value.outerStyle) ? Object.assign({}, ...scrollbarProps.value.outerStyle) : scrollbarProps.value.outerStyle) }), { "onScroll": onTbodyScroll }), { default: () => [createVNode("div", {
1621
- "class": `${prefixCls}-element`,
1622
- "style": elementStyle.value
1623
- }, [renderBody()])] });
1374
+ const bodyMaxHeight = isNumber((_props$scroll13 = props.scroll) === null || _props$scroll13 === void 0 ? void 0 : _props$scroll13.y) ? `${(_props$scroll14 = props.scroll) === null || _props$scroll14 === void 0 ? void 0 : _props$scroll14.y}px` : "100%";
1375
+ const _scrollbarProps$value = scrollbarProps.value, { outerStyle: bodyOuterStyle } = _scrollbarProps$value, bodyScrollbarRestProps = _objectWithoutProperties(_scrollbarProps$value, _excluded2);
1376
+ const bodyOuterBaseStyle = {
1377
+ maxHeight: bodyMaxHeight,
1378
+ minHeight: 0
1379
+ };
1380
+ const bodyScrollbarOuterStyle = Array.isArray(bodyOuterStyle) ? [bodyOuterBaseStyle, ...bodyOuterStyle] : bodyOuterStyle ? [bodyOuterBaseStyle, bodyOuterStyle] : bodyOuterBaseStyle;
1381
+ const BodyComponent = displayScrollbar.value ? Scrollbar : "div";
1624
1382
  return createVNode(Fragment, null, [
1625
1383
  props.showHeader && createVNode("div", {
1626
- "ref": theadRef,
1384
+ "ref": theadComRef,
1627
1385
  "class": [`${prefixCls}-header`, { [`${prefixCls}-header-sticky`]: props.stickyHeader }],
1628
- "style": {
1629
- overflowX: "hidden",
1630
- overflowY: "hidden",
1631
- top
1632
- }
1386
+ "style": { top }
1633
1387
  }, [createVNode("div", {
1634
1388
  "class": `${prefixCls}-element`,
1635
- "style": elementStyle.value
1389
+ "style": headerStyle.value
1636
1390
  }, [renderHeader()])]),
1637
- bodyContent,
1391
+ createVNode(resize_observer_default, { "onResize": handleTbodyResize }, { default: () => [isVirtualList.value && flattenData.value.length ? createVNode(virtual_list_v2_default, mergeProps({
1392
+ "ref": (ins) => {
1393
+ if (ins === null || ins === void 0 ? void 0 : ins.$el) tbodyRef.value = ins.$el;
1394
+ },
1395
+ "class": `${prefixCls}-body`,
1396
+ "data": flattenData.value,
1397
+ "itemKey": "_key",
1398
+ "component": {
1399
+ list: "div",
1400
+ content: "div"
1401
+ },
1402
+ "listAttrs": {
1403
+ class: `${prefixCls}-element`,
1404
+ style: contentStyle.value
1405
+ },
1406
+ "contentAttrs": { class: `${prefixCls}-tbody` },
1407
+ "paddingPosition": "list",
1408
+ "height": bodyMaxHeight
1409
+ }, tableVirtualListProps.value, {
1410
+ "scrollbar": displayScrollbar.value ? scrollbarProps.value : false,
1411
+ "onScroll": onTbodyScroll
1412
+ }), { item: ({ item, index }) => renderRecord(item, index) }) : createVNode(BodyComponent, mergeProps({
1413
+ "ref": tbodyComRef,
1414
+ "class": `${prefixCls}-body`,
1415
+ "style": { maxHeight: bodyMaxHeight }
1416
+ }, displayScrollbar.value ? _objectSpread2({ outerStyle: bodyScrollbarOuterStyle }, bodyScrollbarRestProps) : void 0, { "onScroll": onTbodyScroll }), { default: () => [createVNode("div", {
1417
+ "class": `${prefixCls}-element`,
1418
+ "style": contentStyle.value
1419
+ }, [renderBody()])] })] }),
1638
1420
  summaryData.value && summaryData.value.length > 0 && createVNode("div", {
1639
1421
  "ref": summaryRef,
1640
1422
  "class": `${prefixCls}-tfoot`,
1641
- "style": { overflowY: "hidden" }
1423
+ "style": { overflow: "hidden" }
1642
1424
  }, [createVNode("div", {
1643
1425
  "class": `${prefixCls}-element`,
1644
- "style": elementStyle.value
1645
- }, [renderSummary()])]),
1646
- renderAppend()
1426
+ "style": contentStyle.value
1427
+ }, [renderSummary()])])
1647
1428
  ]);
1648
1429
  }
1649
- return createVNode(Fragment, null, [createVNode("div", {
1430
+ return createVNode(resize_observer_default, { "onResize": () => setAlignPosition() }, { default: () => [createVNode("div", {
1650
1431
  "class": `${prefixCls}-element`,
1651
- "style": elementStyle.value
1432
+ "style": contentStyle.value
1652
1433
  }, [
1653
1434
  props.showHeader && renderHeader(),
1654
1435
  renderBody(),
1655
1436
  summaryData.value && summaryData.value.length > 0 && renderSummary()
1656
- ]), renderAppend()]);
1437
+ ])] });
1657
1438
  };
1658
1439
  const renderTable = (content) => {
1659
- var _props$scroll17;
1660
- const style = ((_props$scroll17 = props.scroll) === null || _props$scroll17 === void 0 ? void 0 : _props$scroll17.maxHeight) ? { maxHeight: props.scroll.maxHeight } : void 0;
1661
- return createVNode(Fragment, null, [createVNode("div", { "class": [`${prefixCls}-container`, tableCls.value] }, [createVNode(Scrollbar, mergeProps({
1440
+ var _props$scroll15;
1441
+ const style = ((_props$scroll15 = props.scroll) === null || _props$scroll15 === void 0 ? void 0 : _props$scroll15.maxHeight) ? { maxHeight: props.scroll.maxHeight } : void 0;
1442
+ const Component = displayScrollbar.value && !splitTable.value ? Scrollbar : "div";
1443
+ const _scrollbarProps$value2 = scrollbarProps.value, { outerStyle: contentOuterStyle } = _scrollbarProps$value2, contentScrollbarRestProps = _objectWithoutProperties(_scrollbarProps$value2, _excluded3);
1444
+ const contentScrollbarOuterStyle = Array.isArray(contentOuterStyle) ? [{ height: "100%" }, ...contentOuterStyle] : contentOuterStyle ? [{ height: "100%" }, contentOuterStyle] : { height: "100%" };
1445
+ return createVNode(Fragment, null, [createVNode("div", { "class": [`${prefixCls}-container`, tableCls.value] }, [createVNode(Component, mergeProps({
1662
1446
  "ref": contentComRef,
1663
1447
  "class": [`${prefixCls}-content`, { [`${prefixCls}-content-scroll-x`]: !splitTable.value }],
1664
1448
  "style": style
1665
- }, _objectSpread2(_objectSpread2({}, scrollbarProps.value), {}, { outerStyle: { height: "100%" } }), { "onScroll": handleScroll }), { default: () => [content ? createVNode("div", {
1666
- "class": `${prefixCls}-element`,
1667
- "style": elementStyle.value
1668
- }, [content()]) : renderContent()] })]), slots.footer && createVNode("div", { "class": `${prefixCls}-footer` }, [slots.footer()])]);
1449
+ }, scrollbar.value && !splitTable.value ? _objectSpread2({ outerStyle: contentScrollbarOuterStyle }, contentScrollbarRestProps) : void 0, { "onScroll": handleScroll }), { default: () => [content ? createVNode("div", { "class": `${prefixCls}-element` }, [content()]) : renderContent()] })]), slots.footer && createVNode("div", { "class": `${prefixCls}-footer` }, [slots.footer()])]);
1669
1450
  };
1670
1451
  const renderPagination = () => {
1671
1452
  var _slots$paginationLef, _slots$paginationRig;
@@ -1694,10 +1475,10 @@ var table_default = /* @__PURE__ */ defineComponent({
1694
1475
  ]);
1695
1476
  };
1696
1477
  const style = computed(() => {
1697
- var _props$scroll18;
1698
- if (isString((_props$scroll18 = props.scroll) === null || _props$scroll18 === void 0 ? void 0 : _props$scroll18.y)) {
1699
- var _props$scroll19;
1700
- return { height: (_props$scroll19 = props.scroll) === null || _props$scroll19 === void 0 ? void 0 : _props$scroll19.y };
1478
+ var _props$scroll16;
1479
+ if (isString((_props$scroll16 = props.scroll) === null || _props$scroll16 === void 0 ? void 0 : _props$scroll16.y)) {
1480
+ var _props$scroll17;
1481
+ return { height: (_props$scroll17 = props.scroll) === null || _props$scroll17 === void 0 ? void 0 : _props$scroll17.y };
1701
1482
  }
1702
1483
  });
1703
1484
  const render = () => {