@sdata/web-vue 1.10.0 → 1.11.0

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 (117) hide show
  1. package/dist/sd.css +148 -952
  2. package/dist/sd.min.css +1 -1
  3. package/es/_components/input-label/style/input-label.scss +11 -51
  4. package/es/_components/select-view/select-view.d.ts +1 -1
  5. package/es/_components/select-view/style/index.css +0 -84
  6. package/es/_components/virtual-list/interface.d.ts +10 -1
  7. package/es/{table/hooks/use-table-virtual-size.d.ts → _components/virtual-list/use-virtual-size.d.ts} +4 -2
  8. package/es/{table/hooks/use-table-virtual-size.js → _components/virtual-list/use-virtual-size.js} +17 -20
  9. package/es/_components/virtual-list/virtual-list.js +64 -2
  10. package/es/_components/virtual-list/virtual-list.vue.d.ts +208 -0
  11. package/es/_components/virtual-list/virtual-list.vue_vue_type_script_lang.js +277 -5
  12. package/es/_utils/clipboard.js +2 -1
  13. package/es/auto-complete/auto-complete.d.ts +1 -1
  14. package/es/auto-complete/index.d.ts +24 -15
  15. package/es/auto-complete/style/index.css +0 -16
  16. package/es/auto-complete/style/index.scss +11 -26
  17. package/es/badge/style/index.scss +11 -41
  18. package/es/button/style/index.css +35 -445
  19. package/es/button/style/index.scss +57 -332
  20. package/es/card/style/index.scss +18 -52
  21. package/es/carousel/index.d.ts +1 -0
  22. package/es/cascader/cascader-panel.vue.d.ts +1 -1
  23. package/es/cascader/cascader.vue.d.ts +3 -3
  24. package/es/cascader/index.d.ts +10 -10
  25. package/es/cascader/interface.d.ts +5 -0
  26. package/es/color-picker/style/index.scss +17 -99
  27. package/es/config-provider/config-provider.vue.d.ts +1 -1
  28. package/es/config-provider/index.d.ts +4 -3
  29. package/es/date-picker/index.d.ts +21 -14
  30. package/es/date-picker/panels/date/index.vue.d.ts +1 -1
  31. package/es/date-picker/panels/week/index.vue.d.ts +7 -7
  32. package/es/date-picker/picker.vue.d.ts +1 -1
  33. package/es/date-picker/range-picker.vue.d.ts +1 -1
  34. package/es/descriptions/descriptions.d.ts +1 -1
  35. package/es/descriptions/index.d.ts +4 -4
  36. package/es/descriptions/style/index.scss +18 -63
  37. package/es/form/style/index.css +12 -176
  38. package/es/form/style/status.scss +36 -73
  39. package/es/index.css +148 -952
  40. package/es/index.d.ts +21 -20
  41. package/es/input/style/input.scss +14 -66
  42. package/es/input-number/index.d.ts +5 -0
  43. package/es/input-tag/style/index.css +0 -84
  44. package/es/input-tag/style/input-tag.scss +16 -170
  45. package/es/list/style/index.scss +12 -42
  46. package/es/menu/index.d.ts +8 -0
  47. package/es/menu/style/index.css +0 -178
  48. package/es/menu/style/index.scss +36 -139
  49. package/es/pagination/index.d.ts +3 -3
  50. package/es/pagination/interface.d.ts +2 -1
  51. package/es/pagination/page-options.js +1 -1
  52. package/es/pagination/page-options.vue.d.ts +72 -71
  53. package/es/pagination/page-options.vue_vue_type_script_lang.js +6 -0
  54. package/es/pagination/pagination.d.ts +3 -3
  55. package/es/pagination/style/index.css +0 -12
  56. package/es/pagination/style/index.scss +19 -76
  57. package/es/radio/index.d.ts +3 -0
  58. package/es/result/style/index.css +0 -16
  59. package/es/result/style/index.scss +12 -34
  60. package/es/select/index.d.ts +9 -9
  61. package/es/select/interface.d.ts +2 -1
  62. package/es/select/select.d.ts +3 -3
  63. package/es/slider/index.d.ts +6 -3
  64. package/es/slider/slider.vue.d.ts +1 -1
  65. package/es/steps/index.d.ts +2 -0
  66. package/es/switch/index.d.ts +3 -0
  67. package/es/table/context.d.ts +1 -1
  68. package/es/table/hooks/use-column-resize.d.ts +2 -3
  69. package/es/table/hooks/use-column-resize.js +48 -21
  70. package/es/table/hooks/use-drag.d.ts +4 -2
  71. package/es/table/hooks/use-drag.js +16 -2
  72. package/es/table/index.d.ts +22 -34
  73. package/es/table/interface.d.ts +21 -2
  74. package/es/table/style/index.css +97 -21
  75. package/es/table/style/index.scss +137 -125
  76. package/es/table/table-operation-td.d.ts +2 -2
  77. package/es/table/table-operation-td.js +4 -5
  78. package/es/table/table-operation-th.js +4 -4
  79. package/es/table/table-tbody.js +1 -1
  80. package/es/table/table-td.js +5 -6
  81. package/es/table/table-th.js +25 -24
  82. package/es/table/table-thead.js +1 -1
  83. package/es/table/table-tr.js +1 -1
  84. package/es/table/table.d.ts +12 -16
  85. package/es/table/table.js +399 -190
  86. package/es/tabs/index.d.ts +1 -0
  87. package/es/tabs/style/index.scss +53 -135
  88. package/es/tag/index.d.ts +3 -3
  89. package/es/tag/style/index.css +0 -84
  90. package/es/tag/style/index.scss +19 -146
  91. package/es/tag/tag.vue.d.ts +1 -1
  92. package/es/theme-provider/index.d.ts +9 -9
  93. package/es/time-picker/index.d.ts +1 -0
  94. package/es/timeline/index.d.ts +1 -0
  95. package/es/transfer/index.d.ts +1 -0
  96. package/es/transfer/interface.d.ts +1 -1
  97. package/es/tree/hooks/use-tree-data.d.ts +17 -29
  98. package/es/tree/index.d.ts +6 -1
  99. package/es/tree/interface.d.ts +2 -0
  100. package/es/tree/tree.js +1 -1
  101. package/es/tree/tree.vue.d.ts +3561 -13
  102. package/es/tree/tree.vue_vue_type_script_lang.js +21 -9
  103. package/es/tree-select/hooks/use-selected-state.js +3 -1
  104. package/es/tree-select/index.d.ts +3 -0
  105. package/es/tree-select/tree-select.vue.d.ts +1367 -3
  106. package/json/vetur-attributes.json +1 -6
  107. package/json/vetur-tags.json +0 -1
  108. package/json/web-types.json +7 -11
  109. package/package.json +1 -1
  110. package/es/style/theme/legacy-less-var.scss +0 -15
  111. package/es/table/table-col-group.js +0 -21
  112. package/es/table/table-col-group.vue_vue_type_script_lang.js +0 -32
  113. package/es/table/table-legacy-virtual-list.js +0 -47
  114. package/es/table/table-legacy-virtual-list.vue.d.ts +0 -156
  115. package/es/table/table-legacy-virtual-list.vue_vue_type_script_lang.js +0 -148
  116. package/es/table/table-virtual-list-item.d.ts +0 -22
  117. package/es/table/table-virtual-list-item.js +0 -37
package/es/table/table.js CHANGED
@@ -2,13 +2,15 @@ import { configProviderInjectionKey } from "../config-provider/context.js";
2
2
  import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.124.0/helpers/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 resize_observer_default from "../_components/resize-observer.js";
5
+ import { _asyncToGenerator } from "../_virtual/_@oxc-project_runtime@0.124.0/helpers/asyncToGenerator.js";
6
+ import virtual_list_default from "../_components/virtual-list/index.js";
6
7
  import { omit } from "../_utils/omit.js";
7
8
  import { useComponentRef } from "../_hooks/use-component-ref.js";
8
9
  import { useScrollbar } from "../_hooks/use-scrollbar.js";
9
10
  import Empty from "../empty/index.js";
10
11
  import Scrollbar from "../scrollbar/index.js";
11
12
  import Spin from "../spin/index.js";
13
+ import { _objectWithoutProperties } from "../_virtual/_@oxc-project_runtime@0.124.0/helpers/objectWithoutProperties.js";
12
14
  import { debounce } from "../_utils/debounce.js";
13
15
  import { useChildrenComponents } from "../_hooks/use-children-components.js";
14
16
  import IconMinus from "../icon/icon-minus/index.js";
@@ -25,8 +27,6 @@ import { getGroupColumns, mapArrayWithChildren, mapRawTableData } from "./utils.
25
27
  import { useRowSelection } from "./hooks/use-row-selection.js";
26
28
  import { useSorter } from "./hooks/use-sorter.js";
27
29
  import { useSpan } from "./hooks/use-span.js";
28
- import table_col_group_default from "./table-col-group.js";
29
- import table_legacy_virtual_list_default from "./table-legacy-virtual-list.js";
30
30
  import table_operation_td_default from "./table-operation-td.js";
31
31
  import table_operation_th_default from "./table-operation-th.js";
32
32
  import table_tbody_default from "./table-tbody.js";
@@ -34,11 +34,26 @@ 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, onMounted, provide, reactive, ref, toRefs, watch, watchEffect } from "vue";
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";
38
39
  //#region components/table/table.tsx
40
+ var _excluded = [
41
+ "itemKey",
42
+ "keyField",
43
+ "estimatedSize",
44
+ "scrollbar",
45
+ "itemSize",
46
+ "minItemSize",
47
+ "component",
48
+ "listAttrs",
49
+ "contentAttrs",
50
+ "listStyle",
51
+ "paddingPosition"
52
+ ];
39
53
  function _isSlot(s) {
40
54
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
41
55
  }
56
+ var getRecordKey = (record, rowKey) => isFunction(rowKey) ? rowKey(record) : record[rowKey];
42
57
  var DEFAULT_BORDERED = {
43
58
  wrapper: true,
44
59
  cell: false,
@@ -75,10 +90,6 @@ var table_default = /* @__PURE__ */ defineComponent({
75
90
  return (_inject$size = (_inject = inject(configProviderInjectionKey, void 0)) === null || _inject === void 0 ? void 0 : _inject.size) !== null && _inject$size !== void 0 ? _inject$size : "large";
76
91
  }
77
92
  },
78
- tableLayoutFixed: {
79
- type: Boolean,
80
- default: false
81
- },
82
93
  loading: {
83
94
  type: [Boolean, Object],
84
95
  default: false
@@ -99,7 +110,7 @@ var table_default = /* @__PURE__ */ defineComponent({
99
110
  default: 16
100
111
  },
101
112
  rowKey: {
102
- type: String,
113
+ type: [String, Function],
103
114
  default: "key"
104
115
  },
105
116
  showHeader: {
@@ -153,6 +164,10 @@ var table_default = /* @__PURE__ */ defineComponent({
153
164
  type: [Object, Boolean],
154
165
  default: true
155
166
  },
167
+ debug: {
168
+ type: Boolean,
169
+ default: false
170
+ },
156
171
  showEmptyTree: {
157
172
  type: Boolean,
158
173
  default: false
@@ -196,6 +211,12 @@ var table_default = /* @__PURE__ */ defineComponent({
196
211
  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;
197
212
  });
198
213
  const { displayScrollbar, scrollbarProps } = useScrollbar(scrollbar);
214
+ const containerClientWidth = ref(0);
215
+ const containerScrollWidth = ref(0);
216
+ const autoScrollX = ref(false);
217
+ const debugLog = (_phase, _payload) => {
218
+ if (!props.debug) return;
219
+ };
199
220
  const isScroll = computed(() => {
200
221
  var _props$scroll, _props$scroll2, _props$scroll3, _props$scroll4;
201
222
  return {
@@ -203,20 +224,53 @@ var table_default = /* @__PURE__ */ defineComponent({
203
224
  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))
204
225
  };
205
226
  });
227
+ const resolvedScroll = computed(() => ({
228
+ x: isScroll.value.x || autoScrollX.value,
229
+ y: isScroll.value.y
230
+ }));
206
231
  const summaryRef = ref();
207
232
  const thRefs = ref({});
208
233
  const { componentRef: contentComRef, elementRef: contentRef } = useComponentRef("containerRef");
209
234
  const { componentRef: tbodyComRef, elementRef: tbodyRef } = useComponentRef("containerRef");
210
235
  const { componentRef: _virtualComRef, elementRef: virtualRef } = useComponentRef("viewportRef");
211
- const { componentRef: theadComRef, elementRef: theadRef } = useComponentRef("containerRef");
212
- const containerElement = computed(() => {
236
+ const getVirtualListInstance = () => _virtualComRef.value;
237
+ const theadRef = ref();
238
+ const isVirtualList = computed(() => Boolean(props.virtualListProps));
239
+ const splitTable = computed(() => {
240
+ var _props$data$length, _props$data;
241
+ 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;
242
+ });
243
+ const containerScrollLeft = ref(0);
244
+ const alignLeft = ref(true);
245
+ const alignRight = ref(true);
246
+ const getScrollbarScrollElement = (component) => {
247
+ var _ref, _scrollbar$elements$s, _scrollbar$elements, _scrollbar$elements2;
248
+ if (component instanceof HTMLElement) return component;
249
+ const scrollbar = component;
250
+ 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;
251
+ };
252
+ const getScrollContainer = () => {
253
+ var _ref3, _getScrollbarScrollEl2;
213
254
  if (splitTable.value) {
214
- if (isVirtualList.value) return virtualRef.value;
215
- return tbodyRef.value;
255
+ var _ref2, _getScrollbarScrollEl;
256
+ if (isVirtualList.value) {
257
+ var _virtualRef$value;
258
+ return (_virtualRef$value = virtualRef.value) !== null && _virtualRef$value !== void 0 ? _virtualRef$value : null;
259
+ }
260
+ return (_ref2 = (_getScrollbarScrollEl = getScrollbarScrollElement(tbodyComRef.value)) !== null && _getScrollbarScrollEl !== void 0 ? _getScrollbarScrollEl : tbodyRef.value) !== null && _ref2 !== void 0 ? _ref2 : null;
216
261
  }
217
- return contentRef.value;
218
- });
219
- const splitTable = computed(() => isScroll.value.y || props.stickyHeader || isVirtualList.value || isScroll.value.x && flattenData.value.length === 0);
262
+ return (_ref3 = (_getScrollbarScrollEl2 = getScrollbarScrollElement(contentComRef.value)) !== null && _getScrollbarScrollEl2 !== void 0 ? _getScrollbarScrollEl2 : contentRef.value) !== null && _ref3 !== void 0 ? _ref3 : null;
263
+ };
264
+ const { width: containerElementWidth } = useElementSize(computed(() => getScrollContainer()));
265
+ const getContainerMetrics = () => {
266
+ var _element$scrollWidth;
267
+ const element = getScrollContainer();
268
+ return {
269
+ element,
270
+ clientWidth: containerElementWidth.value || (element === null || element === void 0 ? void 0 : element.clientWidth) || containerClientWidth.value,
271
+ scrollWidth: (_element$scrollWidth = element === null || element === void 0 ? void 0 : element.scrollWidth) !== null && _element$scrollWidth !== void 0 ? _element$scrollWidth : containerScrollWidth.value
272
+ };
273
+ };
220
274
  const slotColumnMap = reactive(/* @__PURE__ */ new Map());
221
275
  const slotColumns = ref();
222
276
  watch([components, slotColumnMap], ([components, slotColumnMap]) => {
@@ -232,14 +286,17 @@ var table_default = /* @__PURE__ */ defineComponent({
232
286
  const dataColumnMap = /* @__PURE__ */ new Map();
233
287
  const dataColumns = ref([]);
234
288
  const groupColumns = ref([]);
235
- const { resizingColumn, columnWidth, handleThMouseDown } = useColumnResize(thRefs, emit);
289
+ const { resizingColumn, columnWidth, handleThMouseDown } = useColumnResize(thRefs, emit, (dataIndex) => {
290
+ var _dataColumnMap$get;
291
+ return (_dataColumnMap$get = dataColumnMap.get(dataIndex)) === null || _dataColumnMap$get === void 0 ? void 0 : _dataColumnMap$get.width;
292
+ });
236
293
  watch([
237
294
  columns,
238
295
  slotColumns,
239
296
  columnWidth
240
297
  ], ([columns, slotColumns]) => {
241
- var _ref;
242
- const result = getGroupColumns((_ref = slotColumns !== null && slotColumns !== void 0 ? slotColumns : columns) !== null && _ref !== void 0 ? _ref : [], dataColumnMap, columnWidth);
298
+ var _ref4;
299
+ const result = getGroupColumns((_ref4 = slotColumns !== null && slotColumns !== void 0 ? slotColumns : columns) !== null && _ref4 !== void 0 ? _ref4 : [], dataColumnMap, columnWidth);
243
300
  dataColumns.value = result.dataColumns;
244
301
  groupColumns.value = result.groupColumns;
245
302
  }, {
@@ -268,10 +325,6 @@ var table_default = /* @__PURE__ */ defineComponent({
268
325
  if (_hasRightFixedColumn !== hasRightFixedColumn.value) hasRightFixedColumn.value = _hasRightFixedColumn;
269
326
  if (_hasLeftFixedDataColumns !== hasLeftFixedDataColumns.value) hasLeftFixedDataColumns.value = _hasLeftFixedDataColumns;
270
327
  });
271
- const hasEllipsis = computed(() => {
272
- for (const col of dataColumns.value) if (col.ellipsis) return true;
273
- return false;
274
- });
275
328
  const handleChange = (type) => {
276
329
  const extra = {
277
330
  type,
@@ -310,8 +363,9 @@ var table_default = /* @__PURE__ */ defineComponent({
310
363
  disabledKeys.clear();
311
364
  const travelData = (data) => {
312
365
  if (isArray(data) && data.length > 0) for (const record of data) {
313
- allRowKeys.push(record[rowKey.value]);
314
- if (record.disabled) disabledKeys.add(record[rowKey.value]);
366
+ const recordKey = getRecordKey(record, rowKey.value);
367
+ allRowKeys.push(recordKey);
368
+ if (record.disabled) disabledKeys.add(recordKey);
315
369
  if (record.children) travelData(record.children);
316
370
  }
317
371
  };
@@ -375,13 +429,13 @@ var table_default = /* @__PURE__ */ defineComponent({
375
429
  };
376
430
  const { dragType, dragState, handleDragStart, handleDragEnter, handleDragover, handleDragEnd, handleDrop } = useDrag(draggable);
377
431
  const processedData = computed(() => {
378
- var _props$data;
432
+ var _props$data2;
379
433
  const travel = (data) => {
380
434
  const result = [];
381
435
  for (const _record of data) {
382
436
  const record = {
383
437
  raw: _record,
384
- key: _record[props.rowKey],
438
+ key: getRecordKey(_record, props.rowKey),
385
439
  disabled: _record.disabled,
386
440
  expand: _record.expand,
387
441
  isLeaf: _record.isLeaf
@@ -398,7 +452,7 @@ var table_default = /* @__PURE__ */ defineComponent({
398
452
  }
399
453
  return result;
400
454
  };
401
- return travel((_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : []);
455
+ return travel((_props$data2 = props.data) !== null && _props$data2 !== void 0 ? _props$data2 : []);
402
456
  });
403
457
  const validData = computed(() => {
404
458
  const travel = (data) => data.filter((record) => {
@@ -493,7 +547,7 @@ var table_default = /* @__PURE__ */ defineComponent({
493
547
  if (data && data.length > 0) return data.map((raw) => {
494
548
  return {
495
549
  raw,
496
- key: raw[props.rowKey]
550
+ key: getRecordKey(raw, props.rowKey)
497
551
  };
498
552
  });
499
553
  return [];
@@ -508,19 +562,16 @@ var table_default = /* @__PURE__ */ defineComponent({
508
562
  }
509
563
  return [];
510
564
  });
511
- const containerScrollLeft = ref(0);
512
- const alignLeft = ref(true);
513
- const alignRight = ref(true);
514
- const setAlignPosition = () => {
515
- let _alignLeft = true;
516
- let _alignRight = true;
517
- const scrollContainer = containerElement.value;
518
- if (scrollContainer) {
519
- _alignLeft = containerScrollLeft.value === 0;
520
- _alignRight = Math.ceil(containerScrollLeft.value + scrollContainer.offsetWidth) >= scrollContainer.scrollWidth;
565
+ const setAlignPosition = (element = getScrollContainer()) => {
566
+ if (!element) {
567
+ alignLeft.value = true;
568
+ alignRight.value = true;
569
+ return;
521
570
  }
522
- if (_alignLeft !== alignLeft.value) alignLeft.value = _alignLeft;
523
- if (_alignRight !== alignRight.value) alignRight.value = _alignRight;
571
+ const nextAlignLeft = containerScrollLeft.value === 0;
572
+ const nextAlignRight = Math.ceil(containerScrollLeft.value + element.clientWidth) >= element.scrollWidth;
573
+ if (nextAlignLeft !== alignLeft.value) alignLeft.value = nextAlignLeft;
574
+ if (nextAlignRight !== alignRight.value) alignRight.value = nextAlignRight;
524
575
  };
525
576
  const getTableScrollCls = () => {
526
577
  if (alignLeft.value && alignRight.value) return `${prefixCls}-scroll-position-both`;
@@ -534,13 +585,26 @@ var table_default = /* @__PURE__ */ defineComponent({
534
585
  if (hasRightFixedColumn.value) cls.push(`${prefixCls}-has-fixed-col-right`);
535
586
  return cls;
536
587
  };
537
- const handleScroll = (e) => {
538
- if (e.target.scrollLeft !== containerScrollLeft.value) containerScrollLeft.value = e.target.scrollLeft;
539
- setAlignPosition();
588
+ const handleScroll = (event) => {
589
+ const element = event.target;
590
+ if (!element) return;
591
+ if (element.scrollLeft !== containerScrollLeft.value) containerScrollLeft.value = element.scrollLeft;
592
+ containerClientWidth.value = element.clientWidth;
593
+ containerScrollWidth.value = element.scrollWidth;
594
+ debugLog("scroll:x", {
595
+ scrollLeft: element.scrollLeft,
596
+ clientWidth: element.clientWidth,
597
+ scrollWidth: element.scrollWidth,
598
+ autoScrollX: autoScrollX.value,
599
+ calculatedTableWidth: getCalculatedTableWidth()
600
+ });
601
+ setAlignPosition(element);
540
602
  };
541
- const onTbodyScroll = (e) => {
542
- handleScroll(e);
543
- const { scrollLeft } = e.target;
603
+ const onTbodyScroll = (event) => {
604
+ handleScroll(event);
605
+ const element = event.target;
606
+ if (!element) return;
607
+ const scrollLeft = element.scrollLeft;
544
608
  if (theadRef.value) theadRef.value.scrollLeft = scrollLeft;
545
609
  if (summaryRef.value) summaryRef.value.scrollLeft = scrollLeft;
546
610
  };
@@ -613,22 +677,7 @@ var table_default = /* @__PURE__ */ defineComponent({
613
677
  selection
614
678
  }) : operations;
615
679
  });
616
- const headerStyle = computed(() => {
617
- if (isScroll.value.x) {
618
- var _props$scroll5, _props$scroll6, _props$scroll7, _props$scroll8;
619
- 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 };
620
- 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;
621
- return style;
622
- }
623
- });
624
- const contentStyle = computed(() => {
625
- if (isScroll.value.x && flattenData.value.length > 0) {
626
- var _props$scroll9, _props$scroll10, _props$scroll11, _props$scroll12;
627
- 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 };
628
- 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;
629
- return style;
630
- }
631
- });
680
+ const hasResizedColumns = computed(() => Object.keys(columnWidth).length > 0);
632
681
  const addColumn = (id, column) => {
633
682
  slotColumnMap.set(id, column);
634
683
  };
@@ -667,8 +716,7 @@ var table_default = /* @__PURE__ */ defineComponent({
667
716
  [`${prefixCls}-hover`]: props.hoverable,
668
717
  [`${prefixCls}-dragging`]: dragState.dragging,
669
718
  [`${prefixCls}-type-selection`]: Boolean(props.rowSelection),
670
- [`${prefixCls}-empty`]: props.data && flattenData.value.length === 0,
671
- [`${prefixCls}-layout-fixed`]: props.tableLayoutFixed || isScroll.value.x || splitTable.value || hasEllipsis.value
719
+ [`${prefixCls}-empty`]: props.data && flattenData.value.length === 0
672
720
  }
673
721
  ]);
674
722
  const paginationCls = computed(() => [`${prefixCls}-pagination`, {
@@ -679,39 +727,244 @@ var table_default = /* @__PURE__ */ defineComponent({
679
727
  }]);
680
728
  const tableCls = computed(() => {
681
729
  const cls = getTableFixedCls();
682
- if (isScroll.value.x) cls.push(getTableScrollCls());
730
+ if (resolvedScroll.value.x) cls.push(getTableScrollCls());
683
731
  if (splitTable.value) cls.push(`${prefixCls}-scroll-y`);
684
732
  return cls;
685
733
  });
686
- const isVirtualList = computed(() => Boolean(props.virtualListProps));
734
+ const resolvedVirtualListProps = computed(() => {
735
+ var _ref5;
736
+ if (!props.virtualListProps) return;
737
+ const _props$virtualListPro = props.virtualListProps, { itemKey, keyField, estimatedSize, scrollbar: virtualScrollbar, itemSize, minItemSize, component: _component, listAttrs: _listAttrs, contentAttrs: _contentAttrs, listStyle: _listStyle, paddingPosition: _paddingPosition } = _props$virtualListPro;
738
+ return _objectSpread2(_objectSpread2({}, _objectWithoutProperties(_props$virtualListPro, _excluded)), {}, {
739
+ itemSize,
740
+ minItemSize: minItemSize !== null && minItemSize !== void 0 ? minItemSize : itemSize === void 0 ? estimatedSize : void 0,
741
+ keyField: (_ref5 = keyField !== null && keyField !== void 0 ? keyField : itemKey) !== null && _ref5 !== void 0 ? _ref5 : "key",
742
+ estimatedSize,
743
+ scrollbar: virtualScrollbar !== null && virtualScrollbar !== void 0 ? virtualScrollbar : props.scrollbar
744
+ });
745
+ });
746
+ const tableVirtualListProps = computed(() => {
747
+ var _ref6, _ref7, _ref8, _props$scroll5, _props$scroll$y, _props$scroll6;
748
+ if (!resolvedVirtualListProps.value) return;
749
+ if ("prerender" in resolvedVirtualListProps.value && resolvedVirtualListProps.value.prerender !== void 0) return resolvedVirtualListProps.value;
750
+ 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;
751
+ 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;
752
+ const prerender = Math.max(Math.ceil(scrollY / Math.max(rowHeightSource, 1)), 8);
753
+ return _objectSpread2(_objectSpread2({}, resolvedVirtualListProps.value), {}, { prerender });
754
+ });
687
755
  const thWidth = ref({});
688
756
  const getThWidth = () => {
689
757
  const width = {};
690
758
  for (const key of Object.keys(thRefs.value)) width[key] = thRefs.value[key].offsetWidth;
691
759
  thWidth.value = width;
692
760
  };
761
+ const getCalculatedTableWidth = () => {
762
+ return operations.value.reduce((sum, item) => {
763
+ var _item$width;
764
+ return sum + ((_item$width = item.width) !== null && _item$width !== void 0 ? _item$width : 40);
765
+ }, 0) + dataColumns.value.reduce((sum, item) => {
766
+ const resizedWidth = item.dataIndex ? columnWidth[item.dataIndex] : void 0;
767
+ if (resizedWidth) return sum + resizedWidth;
768
+ if (item.width) return sum + item.width;
769
+ if (item.minWidth) return sum + item.minWidth;
770
+ const measuredWidth = item.dataIndex ? thWidth.value[item.dataIndex] : void 0;
771
+ return sum + (measuredWidth !== null && measuredWidth !== void 0 ? measuredWidth : 0);
772
+ }, 0);
773
+ };
774
+ const resolvedColumnWidth = computed(() => {
775
+ var _props$scroll7, _props$scroll8;
776
+ 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);
777
+ const operationWidth = operations.value.reduce((sum, item) => {
778
+ var _item$width2;
779
+ return sum + ((_item$width2 = item.width) !== null && _item$width2 !== void 0 ? _item$width2 : 40);
780
+ }, 0);
781
+ const availableDataWidth = containerClientWidth.value - operationWidth;
782
+ if (availableDataWidth <= 0) return columnWidth;
783
+ const nextColumnWidth = {};
784
+ const flexColumns = [];
785
+ let frozenWidth = 0;
786
+ for (const item of dataColumns.value) {
787
+ var _item$minWidth, _thWidth$value$key;
788
+ if (!item.dataIndex) continue;
789
+ const key = item.dataIndex;
790
+ const min = Math.max((_item$minWidth = item.minWidth) !== null && _item$minWidth !== void 0 ? _item$minWidth : 40, 40);
791
+ const resizedWidth = columnWidth[key];
792
+ const declaredWidth = item.width;
793
+ if (resizedWidth != null || declaredWidth != null) {
794
+ var _ref9;
795
+ const width = Math.max((_ref9 = resizedWidth !== null && resizedWidth !== void 0 ? resizedWidth : declaredWidth) !== null && _ref9 !== void 0 ? _ref9 : min, min);
796
+ nextColumnWidth[key] = width;
797
+ frozenWidth += width;
798
+ continue;
799
+ }
800
+ const measuredWidth = (_thWidth$value$key = thWidth.value[key]) !== null && _thWidth$value$key !== void 0 ? _thWidth$value$key : min;
801
+ flexColumns.push({
802
+ key,
803
+ min,
804
+ base: Math.max(measuredWidth, min)
805
+ });
806
+ }
807
+ if (flexColumns.length === 0) return nextColumnWidth;
808
+ let remaining = availableDataWidth - frozenWidth;
809
+ if (remaining <= 0) {
810
+ for (const item of flexColumns) nextColumnWidth[item.key] = item.base;
811
+ return nextColumnWidth;
812
+ }
813
+ let unfrozen = [...flexColumns];
814
+ while (unfrozen.length > 0) {
815
+ const ideal = remaining / unfrozen.length;
816
+ const idealRounded = Math.round(ideal);
817
+ const violated = unfrozen.filter((item) => idealRounded < item.min);
818
+ if (violated.length === 0) {
819
+ let assigned = 0;
820
+ unfrozen.forEach((item, index) => {
821
+ const width = index === unfrozen.length - 1 ? Math.max(Math.round(remaining - assigned), item.min) : idealRounded;
822
+ nextColumnWidth[item.key] = width;
823
+ assigned += width;
824
+ });
825
+ break;
826
+ }
827
+ for (const item of violated) {
828
+ nextColumnWidth[item.key] = item.min;
829
+ remaining -= item.min;
830
+ }
831
+ unfrozen = unfrozen.filter((item) => idealRounded >= item.min);
832
+ if (remaining <= 0) {
833
+ for (const item of unfrozen) nextColumnWidth[item.key] = item.min;
834
+ break;
835
+ }
836
+ }
837
+ return nextColumnWidth;
838
+ });
839
+ const collectColumnMetrics = () => dataColumns.value.map((item) => ({
840
+ dataIndex: item.dataIndex,
841
+ width: item.width,
842
+ minWidth: item.minWidth,
843
+ resizedWidth: item.dataIndex ? columnWidth[item.dataIndex] : void 0,
844
+ measuredThWidth: item.dataIndex ? thWidth.value[item.dataIndex] : void 0
845
+ }));
846
+ const resolvedTableMinWidth = computed(() => {
847
+ const totalWidth = getCalculatedTableWidth();
848
+ if (!autoScrollX.value) return;
849
+ return totalWidth > 0 ? `${totalWidth}px` : void 0;
850
+ });
851
+ const mergeMinWidth = (style = {}) => {
852
+ if (!resolvedTableMinWidth.value) return Object.keys(style).length > 0 ? style : void 0;
853
+ return _objectSpread2(_objectSpread2({}, style), {}, { minWidth: style.minWidth ? `max(${style.minWidth}, ${resolvedTableMinWidth.value})` : resolvedTableMinWidth.value });
854
+ };
855
+ const tableStyle = computed(() => {
856
+ if (resolvedScroll.value.x) {
857
+ var _props$scroll9, _props$scroll10, _props$scroll11, _props$scroll12;
858
+ 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;
859
+ const style = { width: resolvedScrollWidth };
860
+ 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;
861
+ else if (resolvedScrollWidth) style.minWidth = resolvedScrollWidth;
862
+ return mergeMinWidth(style);
863
+ }
864
+ return mergeMinWidth();
865
+ });
866
+ const gridTemplateColumns = computed(() => {
867
+ const operationTracks = operations.value.map((item) => {
868
+ var _item$width3;
869
+ return `${(_item$width3 = item.width) !== null && _item$width3 !== void 0 ? _item$width3 : 40}px`;
870
+ });
871
+ const dataTracks = dataColumns.value.map((item) => {
872
+ var _item$minWidth2;
873
+ const key = item.dataIndex;
874
+ const resizedWidth = key ? resolvedColumnWidth.value[key] : void 0;
875
+ const width = resizedWidth !== null && resizedWidth !== void 0 ? resizedWidth : item.width;
876
+ const minWidth = (_item$minWidth2 = item.minWidth) !== null && _item$minWidth2 !== void 0 ? _item$minWidth2 : 40;
877
+ if (width != null) return `${Math.max(width, minWidth)}px`;
878
+ return `minmax(${minWidth}px, 1fr)`;
879
+ });
880
+ return operationTracks.concat(dataTracks).join(" ");
881
+ });
882
+ const elementStyle = computed(() => {
883
+ return _objectSpread2(_objectSpread2({}, tableStyle.value ? _objectSpread2({}, tableStyle.value) : {}), {}, { "--sd-table-grid-template": gridTemplateColumns.value });
884
+ });
885
+ const syncContainerMetrics = (reason) => {
886
+ var _props$scroll13, _props$scroll14;
887
+ const { element, clientWidth, scrollWidth } = getContainerMetrics();
888
+ if (!element) return;
889
+ containerClientWidth.value = clientWidth;
890
+ containerScrollWidth.value = scrollWidth;
891
+ containerScrollLeft.value = element.scrollLeft;
892
+ 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));
893
+ const calculatedTableWidth = getCalculatedTableWidth();
894
+ autoScrollX.value = !explicitScrollX && containerClientWidth.value > 0 && calculatedTableWidth > containerClientWidth.value;
895
+ debugLog(`layout:${reason}`, {
896
+ explicitScroll: props.scroll,
897
+ resolvedScroll: resolvedScroll.value,
898
+ autoScrollX: autoScrollX.value,
899
+ calculatedTableWidth,
900
+ resolvedTableMinWidth: resolvedTableMinWidth.value,
901
+ container: {
902
+ clientWidth: containerClientWidth.value,
903
+ scrollWidth: containerScrollWidth.value,
904
+ scrollLeft: element.scrollLeft
905
+ },
906
+ splitTable: splitTable.value,
907
+ hasResizedColumns: hasResizedColumns.value,
908
+ columns: collectColumnMetrics()
909
+ });
910
+ setAlignPosition(element);
911
+ };
693
912
  const hasScrollBar = ref(false);
913
+ const { width: tbodyBorderWidth } = useElementBounding(tbodyRef);
914
+ const { width: tbodyContentWidth } = useElementSize(tbodyRef);
694
915
  const isTbodyHasScrollBar = () => {
695
- if (tbodyRef.value) return tbodyRef.value.offsetWidth > tbodyRef.value.clientWidth;
916
+ if (tbodyRef.value) return tbodyBorderWidth.value > tbodyContentWidth.value + 1;
696
917
  return false;
697
918
  };
698
919
  const handleTbodyResize = () => {
699
920
  const _hasScrollBar = isTbodyHasScrollBar();
700
921
  if (hasScrollBar.value !== _hasScrollBar) hasScrollBar.value = _hasScrollBar;
701
- setAlignPosition();
702
922
  getThWidth();
923
+ syncContainerMetrics("tbody-resize");
703
924
  };
925
+ useResizeObserver(tbodyRef, () => {
926
+ handleTbodyResize();
927
+ });
928
+ useResizeObserver(virtualRef, () => {
929
+ handleTbodyResize();
930
+ });
931
+ useResizeObserver(contentRef, () => {
932
+ getThWidth();
933
+ syncContainerMetrics("content-resize");
934
+ });
704
935
  onMounted(() => {
705
936
  hasScrollBar.value = isTbodyHasScrollBar();
706
937
  getThWidth();
938
+ syncContainerMetrics("mounted");
939
+ });
940
+ watch([
941
+ thWidth,
942
+ columnWidth,
943
+ dataColumns
944
+ ], _asyncToGenerator(function* () {
945
+ yield nextTick();
946
+ syncContainerMetrics("state-change");
947
+ }), { deep: true });
948
+ watchThrottled(columnWidth, _asyncToGenerator(function* () {
949
+ var _getVirtualListInstan, _getVirtualListInstan2;
950
+ if (!isVirtualList.value) return;
951
+ yield nextTick();
952
+ (_getVirtualListInstan = getVirtualListInstance()) === null || _getVirtualListInstan === void 0 || (_getVirtualListInstan2 = _getVirtualListInstan.forceUpdate) === null || _getVirtualListInstan2 === void 0 || _getVirtualListInstan2.call(_getVirtualListInstan, true);
953
+ }), {
954
+ deep: true,
955
+ throttle: 400
707
956
  });
708
957
  const spinProps = computed(() => isObject(props.loading) ? props.loading : { loading: props.loading });
709
958
  const renderEmpty = () => {
710
959
  return createVNode(table_tr_default, { "empty": true }, { default: () => [createVNode(table_td_default, { "colSpan": dataColumns.value.length + operations.value.length }, { default: () => {
711
- var _ref2, _slots$empty, _slots$empty2, _configCtx$slots, _configCtx$slots$empt;
712
- 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)];
960
+ var _ref10, _slots$empty, _slots$empty2, _configCtx$slots, _configCtx$slots$empt;
961
+ 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)];
713
962
  } })] });
714
963
  };
964
+ const renderAppend = () => {
965
+ if (!slots.append) return null;
966
+ return createVNode("div", { "class": `${prefixCls}-append` }, [slots.append()]);
967
+ };
715
968
  const renderExpandContent = (record) => {
716
969
  var _props$expandable2;
717
970
  if (record.expand) return isFunction(record.expand) ? record.expand() : record.expand;
@@ -729,10 +982,6 @@ var table_default = /* @__PURE__ */ defineComponent({
729
982
  data: summaryData,
730
983
  columns: allColumns
731
984
  });
732
- const getVirtualColumnStyle = (name) => {
733
- if (!isVirtualList.value || !name || !thWidth.value[name]) return;
734
- return { width: `${thWidth.value[name]}px` };
735
- };
736
985
  const renderSummaryRow = (record, rowIndex) => {
737
986
  return createVNode(table_tr_default, {
738
987
  "key": `table-summary-${rowIndex}`,
@@ -745,7 +994,6 @@ var table_default = /* @__PURE__ */ defineComponent({
745
994
  const [rowspan, colspan] = (_tableSummarySpan$val = tableSummarySpan.value[cellId]) !== null && _tableSummarySpan$val !== void 0 ? _tableSummarySpan$val : [1, 1];
746
995
  if (removedSummaryCells.value.includes(cellId)) return null;
747
996
  return createVNode(table_operation_td_default, {
748
- "style": getVirtualColumnStyle(operation.name),
749
997
  "operationColumn": operation,
750
998
  "operations": operations.value,
751
999
  "record": record,
@@ -758,10 +1006,8 @@ var table_default = /* @__PURE__ */ defineComponent({
758
1006
  const cellId = `${rowIndex}-${operations.value.length + index}-${record.key}`;
759
1007
  const [rowspan, colspan] = (_tableSummarySpan$val2 = tableSummarySpan.value[cellId]) !== null && _tableSummarySpan$val2 !== void 0 ? _tableSummarySpan$val2 : [1, 1];
760
1008
  if (removedSummaryCells.value.includes(cellId)) return null;
761
- const style = getVirtualColumnStyle(column.dataIndex);
762
1009
  return createVNode(table_td_default, {
763
1010
  "key": `td-${cellId}`,
764
- "style": style,
765
1011
  "rowIndex": rowIndex,
766
1012
  "record": record,
767
1013
  "column": column,
@@ -784,11 +1030,11 @@ var table_default = /* @__PURE__ */ defineComponent({
784
1030
  });
785
1031
  };
786
1032
  const renderSummary = () => {
787
- if (summaryData.value && summaryData.value.length > 0) return createVNode("tfoot", null, [summaryData.value.map((data, index) => renderSummaryRow(data, index))]);
1033
+ if (summaryData.value && summaryData.value.length > 0) return createVNode("div", { "class": `${prefixCls}-tfoot-content` }, [summaryData.value.map((data, index) => renderSummaryRow(data, index))]);
788
1034
  return null;
789
1035
  };
790
1036
  const renderExpandBtn = (record, stopPropagation = true) => {
791
- var _ref3, _slots$expandIcon, _slots$expandIcon2, _props$expandable3, _props$expandable3$ic;
1037
+ var _ref11, _slots$expandIcon, _slots$expandIcon2, _props$expandable3, _props$expandable3$ic;
792
1038
  const currentKey = record.key;
793
1039
  const expanded = expandedRowKeys.value.includes(currentKey);
794
1040
  return createVNode("button", {
@@ -798,10 +1044,10 @@ var table_default = /* @__PURE__ */ defineComponent({
798
1044
  handleExpand(currentKey, record.raw);
799
1045
  if (stopPropagation) ev.stopPropagation();
800
1046
  }
801
- }, [(_ref3 = (_slots$expandIcon = (_slots$expandIcon2 = slots["expand-icon"]) === null || _slots$expandIcon2 === void 0 ? void 0 : _slots$expandIcon2.call(slots, {
1047
+ }, [(_ref11 = (_slots$expandIcon = (_slots$expandIcon2 = slots["expand-icon"]) === null || _slots$expandIcon2 === void 0 ? void 0 : _slots$expandIcon2.call(slots, {
802
1048
  expanded,
803
1049
  record: record.raw
804
- })) !== 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)]);
1050
+ })) !== 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)]);
805
1051
  };
806
1052
  const renderExpand = (record, { indentSize, indexPath, allowDrag, expandContent }) => {
807
1053
  if (record.hasSubtree) {
@@ -813,17 +1059,14 @@ var table_default = /* @__PURE__ */ defineComponent({
813
1059
  allowDrag
814
1060
  }));
815
1061
  }
816
- if (expandContent) {
817
- const scrollContainer = containerElement.value;
818
- return createVNode(table_tr_default, {
819
- "key": `${record.key}-expand`,
820
- "expand": true
821
- }, { default: () => [createVNode(table_td_default, {
822
- "isFixedExpand": hasLeftFixedColumn.value || hasRightFixedColumn.value,
823
- "containerWidth": scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.clientWidth,
824
- "colSpan": dataColumns.value.length + operations.value.length
825
- }, _isSlot(expandContent) ? expandContent : { default: () => [expandContent] })] });
826
- }
1062
+ if (expandContent) return createVNode(table_tr_default, {
1063
+ "key": `${record.key}-expand`,
1064
+ "expand": true
1065
+ }, { default: () => [createVNode(table_td_default, {
1066
+ "isFixedExpand": hasLeftFixedColumn.value || hasRightFixedColumn.value,
1067
+ "containerWidth": containerClientWidth.value,
1068
+ "colSpan": dataColumns.value.length + operations.value.length
1069
+ }, _isSlot(expandContent) ? expandContent : { default: () => [expandContent] })] });
827
1070
  return null;
828
1071
  };
829
1072
  const renderRecord = (record, rowIndex, { indentSize = 0, indexPath, allowDrag = true } = {}) => {
@@ -833,6 +1076,7 @@ var table_default = /* @__PURE__ */ defineComponent({
833
1076
  const expandContent = renderExpandContent(record);
834
1077
  const showExpand = expandedRowKeys.value.includes(currentKey);
835
1078
  const isDragTarget = dragState.sourceKey === record.key;
1079
+ const isDropTarget = dragState.dragging && dragState.dropIndicatorPath.toString() === currentPath.toString() && !isDragTarget;
836
1080
  const dragSourceEvent = dragType.value ? {
837
1081
  draggable: allowDrag,
838
1082
  onDragstart: (ev) => {
@@ -863,7 +1107,8 @@ var table_default = /* @__PURE__ */ defineComponent({
863
1107
  "key": currentKey,
864
1108
  "class": [{
865
1109
  [`${prefixCls}-tr-draggable`]: dragType.value === "row",
866
- [`${prefixCls}-tr-drag`]: isDragTarget
1110
+ [`${prefixCls}-tr-drag`]: isDragTarget,
1111
+ [`${prefixCls}-tr-drop-target`]: isDropTarget
867
1112
  }, isFunction(props.rowClass) ? props.rowClass(record.raw, rowIndex) : props.rowClass],
868
1113
  "rowIndex": rowIndex,
869
1114
  "record": record,
@@ -877,10 +1122,8 @@ var table_default = /* @__PURE__ */ defineComponent({
877
1122
  const cellId = `${rowIndex}-${index}-${record.key}`;
878
1123
  const [rowspan, colspan] = props.spanAll ? (_tableSpan$value$cell = tableSpan.value[cellId]) !== null && _tableSpan$value$cell !== void 0 ? _tableSpan$value$cell : [1, 1] : [1, 1];
879
1124
  if (props.spanAll && removedCells.value.includes(cellId)) return null;
880
- const style = getVirtualColumnStyle(operation.name);
881
1125
  return createVNode(table_operation_td_default, mergeProps({
882
1126
  "key": `operation-td-${index}`,
883
- "style": style,
884
1127
  "operationColumn": operation,
885
1128
  "operations": operations.value,
886
1129
  "record": record,
@@ -899,10 +1142,8 @@ var table_default = /* @__PURE__ */ defineComponent({
899
1142
  showExpandBtn: record.hasSubtree,
900
1143
  indentSize: record.hasSubtree ? indentSize - 20 : indentSize
901
1144
  } : {};
902
- const style = getVirtualColumnStyle(column.dataIndex);
903
1145
  return createVNode(table_td_default, mergeProps({
904
1146
  "key": `td-${index}`,
905
- "style": style,
906
1147
  "rowIndex": rowIndex,
907
1148
  "record": record,
908
1149
  "column": column,
@@ -934,6 +1175,10 @@ var table_default = /* @__PURE__ */ defineComponent({
934
1175
  tbody: slots.tbody
935
1176
  });
936
1177
  };
1178
+ const renderVirtualRecord = (record, index) => {
1179
+ const hasSubData = flattenData.value.some((item) => Boolean(item.hasSubtree));
1180
+ return createVNode("div", { "class": `${prefixCls}-virtual-item` }, [renderRecord(record, index, { indentSize: hasSubData ? 20 : 0 })]);
1181
+ };
937
1182
  const renderHeader = () => createVNode(table_thead_default, null, {
938
1183
  default: () => [groupColumns.value.map((row, index) => createVNode(table_tr_default, { "key": `header-row-${index}` }, { default: () => [index === 0 && operations.value.map((operation, index) => {
939
1184
  var _props$rowSelection2;
@@ -965,117 +1210,81 @@ var table_default = /* @__PURE__ */ defineComponent({
965
1210
  });
966
1211
  const renderContent = () => {
967
1212
  if (splitTable.value) {
968
- var _scrollbarProps$value, _scrollbarProps$value2;
1213
+ var _props$scroll15, _props$scroll16;
969
1214
  const top = isNumber(props.stickyHeader) ? `${props.stickyHeader}px` : void 0;
970
- const mergeOuterClass = [(_scrollbarProps$value = scrollbarProps.value) === null || _scrollbarProps$value === void 0 ? void 0 : _scrollbarProps$value.outerClass];
971
- if (props.stickyHeader) mergeOuterClass.push(`${prefixCls}-header-sticky`);
972
- const mergeOuterStyle = _objectSpread2({ top }, (_scrollbarProps$value2 = scrollbarProps.value) === null || _scrollbarProps$value2 === void 0 ? void 0 : _scrollbarProps$value2.outerStyle);
973
- const Component = displayScrollbar.value ? Scrollbar : "div";
1215
+ const BodyComponent = displayScrollbar.value ? Scrollbar : "div";
1216
+ const bodyContent = isVirtualList.value && flattenData.value.length ? createVNode("div", {
1217
+ "class": `${prefixCls}-element`,
1218
+ "style": elementStyle.value
1219
+ }, [createVNode("div", { "class": `${prefixCls}-tbody` }, [createVNode(virtual_list_default, mergeProps({
1220
+ "ref": (ins) => {
1221
+ var _ins$scrollerRef;
1222
+ _virtualComRef.value = ins;
1223
+ if (ins === null || ins === void 0 ? void 0 : ins.$el) tbodyRef.value = ins.$el;
1224
+ 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;
1225
+ else if (ins === null || ins === void 0 ? void 0 : ins.viewportRef) virtualRef.value = ins.viewportRef;
1226
+ },
1227
+ "class": `${prefixCls}-body`,
1228
+ "items": flattenData.value,
1229
+ "keyField": "key",
1230
+ "height": "auto",
1231
+ "onScroll": onTbodyScroll
1232
+ }, tableVirtualListProps.value), { item: ({ item, index }) => renderVirtualRecord(item, index) })])]) : createVNode(BodyComponent, mergeProps({
1233
+ "ref": tbodyComRef,
1234
+ "class": `${prefixCls}-body`,
1235
+ "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%" }
1236
+ }, scrollbar.value ? _objectSpread2({ outerStyle: {
1237
+ display: "flex",
1238
+ minHeight: "0"
1239
+ } }, scrollbarProps.value) : void 0, { "onScroll": onTbodyScroll }), { default: () => [createVNode("div", {
1240
+ "class": `${prefixCls}-element`,
1241
+ "style": elementStyle.value
1242
+ }, [renderBody()])] });
974
1243
  return createVNode(Fragment, null, [
975
- props.showHeader && createVNode(Component, mergeProps({
976
- "ref": theadComRef,
977
- "class": [`${prefixCls}-header`, { [`${prefixCls}-header-sticky`]: props.stickyHeader && !displayScrollbar.value }],
1244
+ props.showHeader && createVNode("div", {
1245
+ "ref": theadRef,
1246
+ "class": [`${prefixCls}-header`, { [`${prefixCls}-header-sticky`]: props.stickyHeader }],
978
1247
  "style": {
979
- overflowY: hasScrollBar.value ? "scroll" : void 0,
980
- top: !displayScrollbar.value ? top : void 0
1248
+ overflowX: "hidden",
1249
+ overflowY: hasScrollBar.value && !displayScrollbar.value ? "scroll" : "hidden",
1250
+ top
981
1251
  }
982
- }, scrollbar.value ? _objectSpread2(_objectSpread2({
983
- hide: flattenData.value.length !== 0,
984
- disableVertical: true
985
- }, scrollbarProps.value), {}, {
986
- outerClass: mergeOuterClass,
987
- outerStyle: mergeOuterStyle
988
- }) : void 0), { default: () => [createVNode("table", {
1252
+ }, [createVNode("div", {
989
1253
  "class": `${prefixCls}-element`,
990
- "style": headerStyle.value,
991
- "cellpadding": 0,
992
- "cellspacing": 0
993
- }, [createVNode(table_col_group_default, {
994
- "dataColumns": dataColumns.value,
995
- "operations": operations.value,
996
- "columnWidth": columnWidth
997
- }, null), renderHeader()])] }),
998
- createVNode(resize_observer_default, { "onResize": handleTbodyResize }, { default: () => {
999
- var _props$scroll13, _props$scroll14;
1000
- return [isVirtualList.value && flattenData.value.length ? createVNode(table_legacy_virtual_list_default, mergeProps({
1001
- "ref": (ins) => {
1002
- if (ins === null || ins === void 0 ? void 0 : ins.$el) tbodyRef.value = ins.$el;
1003
- },
1004
- "class": `${prefixCls}-body`,
1005
- "data": flattenData.value,
1006
- "itemKey": "_key",
1007
- "component": {
1008
- list: "table",
1009
- content: "tbody"
1010
- },
1011
- "listAttrs": {
1012
- class: `${prefixCls}-element`,
1013
- style: contentStyle.value
1014
- },
1015
- "paddingPosition": "list",
1016
- "height": "auto"
1017
- }, props.virtualListProps, { "onScroll": onTbodyScroll }), { item: ({ item, index }) => renderRecord(item, index) }) : createVNode(Component, mergeProps({
1018
- "ref": tbodyComRef,
1019
- "class": `${prefixCls}-body`,
1020
- "style": { maxHeight: 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%" }
1021
- }, scrollbar.value ? _objectSpread2({ outerStyle: {
1022
- display: "flex",
1023
- minHeight: "0"
1024
- } }, scrollbarProps.value) : void 0, { "onScroll": onTbodyScroll }), { default: () => [createVNode("table", {
1025
- "class": `${prefixCls}-element`,
1026
- "style": contentStyle.value,
1027
- "cellpadding": 0,
1028
- "cellspacing": 0
1029
- }, [flattenData.value.length !== 0 && createVNode(table_col_group_default, {
1030
- "dataColumns": dataColumns.value,
1031
- "operations": operations.value,
1032
- "columnWidth": columnWidth
1033
- }, null), renderBody()])] })];
1034
- } }),
1254
+ "style": elementStyle.value
1255
+ }, [renderHeader()])]),
1256
+ bodyContent,
1035
1257
  summaryData.value && summaryData.value.length > 0 && createVNode("div", {
1036
1258
  "ref": summaryRef,
1037
1259
  "class": `${prefixCls}-tfoot`,
1038
1260
  "style": { overflowY: hasScrollBar.value ? "scroll" : "hidden" }
1039
- }, [createVNode("table", {
1261
+ }, [createVNode("div", {
1040
1262
  "class": `${prefixCls}-element`,
1041
- "style": contentStyle.value,
1042
- "cellpadding": 0,
1043
- "cellspacing": 0
1044
- }, [createVNode(table_col_group_default, {
1045
- "dataColumns": dataColumns.value,
1046
- "operations": operations.value,
1047
- "columnWidth": columnWidth
1048
- }, null), renderSummary()])])
1263
+ "style": elementStyle.value
1264
+ }, [renderSummary()])]),
1265
+ renderAppend()
1049
1266
  ]);
1050
1267
  }
1051
- return createVNode(resize_observer_default, { "onResize": () => setAlignPosition() }, { default: () => [createVNode("table", {
1268
+ return createVNode(Fragment, null, [createVNode("div", {
1052
1269
  "class": `${prefixCls}-element`,
1053
- "cellpadding": 0,
1054
- "cellspacing": 0,
1055
- "style": contentStyle.value
1270
+ "style": elementStyle.value
1056
1271
  }, [
1057
- createVNode(table_col_group_default, {
1058
- "dataColumns": dataColumns.value,
1059
- "operations": operations.value,
1060
- "columnWidth": columnWidth
1061
- }, null),
1062
1272
  props.showHeader && renderHeader(),
1063
1273
  renderBody(),
1064
1274
  summaryData.value && summaryData.value.length > 0 && renderSummary()
1065
- ])] });
1275
+ ]), renderAppend()]);
1066
1276
  };
1067
1277
  const renderTable = (content) => {
1068
- var _props$scroll15;
1069
- const style = ((_props$scroll15 = props.scroll) === null || _props$scroll15 === void 0 ? void 0 : _props$scroll15.maxHeight) ? { maxHeight: props.scroll.maxHeight } : void 0;
1070
- const Component = displayScrollbar.value ? Scrollbar : "div";
1071
- return createVNode(Fragment, null, [createVNode("div", { "class": [`${prefixCls}-container`, tableCls.value] }, [createVNode(Component, mergeProps({
1278
+ var _props$scroll17;
1279
+ const style = ((_props$scroll17 = props.scroll) === null || _props$scroll17 === void 0 ? void 0 : _props$scroll17.maxHeight) ? { maxHeight: props.scroll.maxHeight } : void 0;
1280
+ const ContentComponent = !splitTable.value && displayScrollbar.value ? Scrollbar : "div";
1281
+ return createVNode(Fragment, null, [createVNode("div", { "class": [`${prefixCls}-container`, tableCls.value] }, [createVNode(ContentComponent, mergeProps({
1072
1282
  "ref": contentComRef,
1073
1283
  "class": [`${prefixCls}-content`, { [`${prefixCls}-content-scroll-x`]: !splitTable.value }],
1074
1284
  "style": style
1075
- }, scrollbar.value ? _objectSpread2({ outerStyle: { height: "100%" } }, scrollbarProps.value) : void 0, { "onScroll": handleScroll }), { default: () => [content ? createVNode("table", {
1285
+ }, !splitTable.value && scrollbar.value ? _objectSpread2({ outerStyle: { height: "100%" } }, scrollbarProps.value) : void 0, { "onScroll": handleScroll }), { default: () => [content ? createVNode("div", {
1076
1286
  "class": `${prefixCls}-element`,
1077
- "cellpadding": 0,
1078
- "cellspacing": 0
1287
+ "style": elementStyle.value
1079
1288
  }, [content()]) : renderContent()] })]), slots.footer && createVNode("div", { "class": `${prefixCls}-footer` }, [slots.footer()])]);
1080
1289
  };
1081
1290
  const renderPagination = () => {
@@ -1105,10 +1314,10 @@ var table_default = /* @__PURE__ */ defineComponent({
1105
1314
  ]);
1106
1315
  };
1107
1316
  const style = computed(() => {
1108
- var _props$scroll16;
1109
- if (isString((_props$scroll16 = props.scroll) === null || _props$scroll16 === void 0 ? void 0 : _props$scroll16.y)) {
1110
- var _props$scroll17;
1111
- return { height: (_props$scroll17 = props.scroll) === null || _props$scroll17 === void 0 ? void 0 : _props$scroll17.y };
1317
+ var _props$scroll18;
1318
+ if (isString((_props$scroll18 = props.scroll) === null || _props$scroll18 === void 0 ? void 0 : _props$scroll18.y)) {
1319
+ var _props$scroll19;
1320
+ return { height: (_props$scroll19 = props.scroll) === null || _props$scroll19 === void 0 ? void 0 : _props$scroll19.y };
1112
1321
  }
1113
1322
  });
1114
1323
  const render = () => {