vue-devui 1.0.0-rc.10 → 1.0.0-rc.13

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 (137) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +156 -149
  3. package/auto-complete/index.es.js +53 -23
  4. package/auto-complete/index.umd.js +15 -15
  5. package/auto-complete/style.css +1 -1
  6. package/badge/index.es.js +8 -2
  7. package/badge/index.umd.js +1 -1
  8. package/badge/style.css +1 -1
  9. package/button/index.es.js +5 -3
  10. package/button/index.umd.js +6 -6
  11. package/button/style.css +1 -1
  12. package/card/index.es.js +5 -1
  13. package/card/index.umd.js +1 -1
  14. package/card/style.css +1 -1
  15. package/checkbox/index.es.js +22 -14
  16. package/checkbox/index.umd.js +7 -7
  17. package/checkbox/style.css +1 -1
  18. package/collapse/index.es.js +20 -186
  19. package/collapse/index.umd.js +1 -1
  20. package/collapse/style.css +1 -1
  21. package/countdown/index.es.js +56 -13
  22. package/countdown/index.umd.js +1 -1
  23. package/{date-picker → date-picker-pro}/index.d.ts +0 -0
  24. package/date-picker-pro/index.es.js +10867 -0
  25. package/date-picker-pro/index.umd.js +27 -0
  26. package/date-picker-pro/package.json +7 -0
  27. package/date-picker-pro/style.css +1 -0
  28. package/dropdown/index.es.js +9 -2
  29. package/dropdown/index.umd.js +1 -1
  30. package/editable-select/index.es.js +98 -56
  31. package/editable-select/index.umd.js +1 -1
  32. package/editable-select/style.css +1 -1
  33. package/form/index.es.js +22 -14
  34. package/form/index.umd.js +11 -11
  35. package/icon/index.es.js +5 -3
  36. package/icon/index.umd.js +1 -1
  37. package/icon/style.css +1 -1
  38. package/image-preview/style.css +1 -1
  39. package/input/index.es.js +59 -23
  40. package/input/index.umd.js +7 -7
  41. package/input/style.css +1 -1
  42. package/input-number/index.es.js +1 -4
  43. package/input-number/index.umd.js +1 -1
  44. package/input-number/style.css +1 -1
  45. package/modal/index.es.js +5 -3
  46. package/modal/index.umd.js +1 -1
  47. package/modal/style.css +1 -1
  48. package/notification/index.es.js +32 -34
  49. package/notification/index.umd.js +1 -1
  50. package/notification/style.css +1 -1
  51. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  52. package/nuxt/components/DatePickerPro.js +3 -0
  53. package/nuxt/components/OptionGroup.js +3 -0
  54. package/nuxt/components/Step.js +3 -0
  55. package/nuxt/components/Steps.js +3 -0
  56. package/nuxt/components/TABLE_TOKEN.js +3 -0
  57. package/nuxt/components/TimePicker.js +3 -0
  58. package/nuxt/components/TimeSelect.js +3 -0
  59. package/nuxt/components/datePickerProCommonProps.js +3 -0
  60. package/nuxt/components/datePickerProPanelProps.js +3 -0
  61. package/nuxt/components/datePickerProProps.js +3 -0
  62. package/nuxt/components/stepProps.js +3 -0
  63. package/nuxt/components/stepsProps.js +3 -0
  64. package/nuxt/components/tableProps.js +3 -0
  65. package/nuxt/components/timerPickerPanelProps.js +3 -0
  66. package/package.json +2 -1
  67. package/pagination/index.es.js +25 -7
  68. package/pagination/index.umd.js +1 -1
  69. package/pagination/style.css +1 -1
  70. package/panel/style.css +1 -1
  71. package/radio/index.es.js +22 -14
  72. package/radio/index.umd.js +8 -8
  73. package/radio/style.css +1 -1
  74. package/rate/style.css +1 -1
  75. package/result/index.es.js +5 -3
  76. package/result/index.umd.js +1 -1
  77. package/result/style.css +1 -1
  78. package/search/index.es.js +65 -26
  79. package/search/index.umd.js +7 -7
  80. package/search/style.css +1 -1
  81. package/select/index.es.js +270 -269
  82. package/select/index.umd.js +13 -13
  83. package/select/style.css +1 -1
  84. package/slider/index.es.js +116 -143
  85. package/slider/index.umd.js +1 -1
  86. package/slider/style.css +1 -1
  87. package/splitter/index.es.js +27 -7
  88. package/splitter/index.umd.js +10 -10
  89. package/statistic/index.es.js +34 -16
  90. package/statistic/index.umd.js +1 -1
  91. package/statistic/style.css +1 -1
  92. package/status/style.css +1 -1
  93. package/steps/index.d.ts +7 -0
  94. package/steps/index.es.js +386 -0
  95. package/steps/index.umd.js +1 -0
  96. package/{date-picker → steps}/package.json +1 -1
  97. package/steps/style.css +1 -0
  98. package/style.css +1 -1
  99. package/switch/index.es.js +22 -14
  100. package/switch/index.umd.js +9 -9
  101. package/switch/style.css +1 -1
  102. package/table/index.es.js +873 -441
  103. package/table/index.umd.js +15 -15
  104. package/table/style.css +1 -1
  105. package/tabs/index.es.js +25 -13
  106. package/tabs/index.umd.js +1 -1
  107. package/tabs/style.css +1 -1
  108. package/textarea/index.es.js +22 -14
  109. package/textarea/index.umd.js +10 -10
  110. package/textarea/style.css +1 -1
  111. package/time-picker/index.d.ts +7 -0
  112. package/{date-picker → time-picker}/index.es.js +1408 -1053
  113. package/time-picker/index.umd.js +27 -0
  114. package/time-picker/package.json +7 -0
  115. package/time-picker/style.css +1 -0
  116. package/time-select/index.d.ts +7 -0
  117. package/time-select/index.es.js +9435 -0
  118. package/time-select/index.umd.js +27 -0
  119. package/time-select/package.json +7 -0
  120. package/time-select/style.css +1 -0
  121. package/timeline/index.es.js +5 -3
  122. package/timeline/index.umd.js +1 -1
  123. package/timeline/style.css +1 -1
  124. package/tooltip/index.es.js +1 -1
  125. package/tooltip/index.umd.js +1 -1
  126. package/tree/index.es.js +1322 -126
  127. package/tree/index.umd.js +17 -17
  128. package/tree/style.css +1 -1
  129. package/upload/index.es.js +128 -67
  130. package/upload/index.umd.js +1 -1
  131. package/upload/style.css +1 -1
  132. package/vue-devui.es.js +6605 -2566
  133. package/vue-devui.umd.js +23 -23
  134. package/date-picker/index.umd.js +0 -27
  135. package/date-picker/style.css +0 -1
  136. package/nuxt/components/DatePicker.js +0 -3
  137. package/nuxt/components/StickSlider.js +0 -3
package/table/index.es.js CHANGED
@@ -33,10 +33,10 @@ var __publicField = (obj, key, value) => {
33
33
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
  return value;
35
35
  };
36
- import { computed, ref, watch, unref, defineComponent, inject, createVNode, toRefs, onMounted, onUnmounted, Transition, mergeProps, nextTick, Comment, Text, h, Fragment, withDirectives, cloneVNode, provide, Teleport, vShow, resolveDynamicComponent, render, resolveDirective, toRef, reactive, createTextVNode, onBeforeUnmount, isVNode, getCurrentInstance, onBeforeMount } from "vue";
36
+ import { computed, ref, watchEffect, watch, getCurrentInstance, unref, defineComponent, inject, createVNode, mergeProps, toRefs, onMounted, onUnmounted, Transition, nextTick, Comment, Text, h, Fragment, withDirectives, cloneVNode, provide, Teleport, vShow, resolveDynamicComponent, render, resolveDirective, toRef, reactive, createTextVNode, onBeforeUnmount, isVNode, onBeforeMount, onUpdated } from "vue";
37
37
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
38
38
  import { onClickOutside } from "@vueuse/core";
39
- const TableProps = {
39
+ const tableProps = {
40
40
  data: {
41
41
  type: Array,
42
42
  default: []
@@ -111,10 +111,19 @@ const TableProps = {
111
111
  default: true
112
112
  },
113
113
  rowKey: {
114
- type: String
114
+ type: [Function, String],
115
+ default: "id"
115
116
  },
116
- trackBy: {
117
- type: Function
117
+ defaultExpandAll: {
118
+ type: Boolean,
119
+ default: false
120
+ },
121
+ expandRowKeys: {
122
+ type: Array
123
+ },
124
+ indent: {
125
+ type: Number,
126
+ default: 16
118
127
  }
119
128
  };
120
129
  const TABLE_TOKEN = Symbol();
@@ -159,18 +168,18 @@ function useTable(props, tableWidth) {
159
168
  }));
160
169
  return { classes, styles };
161
170
  }
162
- const useFixedColumn = (column) => {
171
+ const useFixedColumn = (column2) => {
163
172
  const ns2 = useNamespace("table");
164
173
  const stickyClass = computed(() => ({
165
- [ns2.e("checkable-cell")]: column.value.type === "checkable",
166
- [ns2.m("sticky-cell")]: Boolean(column.value.fixedLeft) || Boolean(column.value.fixedRight),
167
- left: Boolean(column.value.fixedLeft),
168
- right: Boolean(column.value.fixedRight),
169
- [`is-${column.value.align}`]: true
174
+ [ns2.e("checkable-cell")]: column2.value.type === "checkable",
175
+ [ns2.m("sticky-cell")]: Boolean(column2.value.fixedLeft) || Boolean(column2.value.fixedRight),
176
+ left: Boolean(column2.value.fixedLeft),
177
+ right: Boolean(column2.value.fixedRight),
178
+ [`is-${column2.value.align}`]: true
170
179
  }));
171
180
  const stickyStyle = computed(() => ({
172
- left: column.value.fixedLeft,
173
- right: column.value.fixedRight
181
+ left: column2.value.fixedLeft,
182
+ right: column2.value.fixedRight
174
183
  }));
175
184
  return { stickyClass, stickyStyle };
176
185
  };
@@ -184,15 +193,15 @@ function useTableLayout(table2) {
184
193
  }
185
194
  const flatColumns = table2.store.states.flatColumns;
186
195
  const columnMap = {};
187
- flatColumns.value.forEach((column) => {
188
- columnMap[column.id] = column;
196
+ flatColumns.value.forEach((column2) => {
197
+ columnMap[column2.id] = column2;
189
198
  });
190
199
  for (let i = 0, len = cols.length; i < len; i++) {
191
200
  const col = cols[i];
192
201
  const columnId = col.getAttribute("column-id");
193
- const column = columnMap[columnId];
194
- if (column) {
195
- col.setAttribute("width", column.realWidth);
202
+ const column2 = columnMap[columnId];
203
+ if (column2) {
204
+ col.setAttribute("width", column2.realWidth);
196
205
  }
197
206
  }
198
207
  };
@@ -201,39 +210,39 @@ function useTableLayout(table2) {
201
210
  const tableClientWidth = (_b = (_a = table2 == null ? void 0 : table2.vnode) == null ? void 0 : _a.el) == null ? void 0 : _b.clientWidth;
202
211
  let tableMinWidth = 0;
203
212
  const flatColumns = table2.store.states.flatColumns;
204
- const flexColumns = flatColumns.value.filter((column) => typeof column.width !== "number");
213
+ const flexColumns = flatColumns.value.filter((column2) => typeof column2.width !== "number");
205
214
  if (flexColumns.length) {
206
- flatColumns.value.forEach((column) => {
207
- tableMinWidth += Number(column.width || 80);
215
+ flatColumns.value.forEach((column2) => {
216
+ tableMinWidth += Number(column2.width || 80);
208
217
  });
209
218
  if (tableMinWidth <= tableClientWidth) {
210
219
  const totalFlexWidth = tableClientWidth - tableMinWidth;
211
220
  if (flexColumns.length === 1) {
212
221
  flexColumns[0].realWidth = Number(flexColumns[0].width || 80) + totalFlexWidth;
213
222
  } else {
214
- const allFlexColumnWidth = flexColumns.reduce((pre, column) => pre + Number(column.width || 80), 0);
223
+ const allFlexColumnWidth = flexColumns.reduce((pre, column2) => pre + Number(column2.width || 80), 0);
215
224
  const flexWidthPercent = totalFlexWidth / allFlexColumnWidth;
216
225
  let exceptFistWidth = 0;
217
- flexColumns.forEach((column, index2) => {
226
+ flexColumns.forEach((column2, index2) => {
218
227
  if (index2 === 0) {
219
228
  return;
220
229
  }
221
- const perFlexWidth = Math.floor(Number(column.width || 80) * flexWidthPercent);
230
+ const perFlexWidth = Math.floor(Number(column2.width || 80) * flexWidthPercent);
222
231
  exceptFistWidth += perFlexWidth;
223
- column.realWidth = Number(column.width || 80) + perFlexWidth;
232
+ column2.realWidth = Number(column2.width || 80) + perFlexWidth;
224
233
  });
225
234
  flexColumns[0].realWidth = Number(flexColumns[0].width || 80) + totalFlexWidth - exceptFistWidth;
226
235
  }
227
236
  } else {
228
- flexColumns.forEach((column) => {
229
- column.realWidth = Number(column.width || 80);
237
+ flexColumns.forEach((column2) => {
238
+ column2.realWidth = Number(column2.width || 80);
230
239
  });
231
240
  }
232
241
  tableWidth.value = Math.max(tableMinWidth, tableClientWidth);
233
242
  } else {
234
- flatColumns.value.forEach((column) => {
235
- column.realWidth = column.width || 80;
236
- tableMinWidth += Number(column.realWidth);
243
+ flatColumns.value.forEach((column2) => {
244
+ column2.realWidth = column2.width || 80;
245
+ tableMinWidth += Number(column2.realWidth);
237
246
  });
238
247
  tableWidth.value = tableMinWidth;
239
248
  }
@@ -241,29 +250,234 @@ function useTableLayout(table2) {
241
250
  };
242
251
  return { tableWidth, updateColumnWidth };
243
252
  }
244
- function replaceColumn(array4, column) {
253
+ function useTableWatcher(props, store) {
254
+ watchEffect(() => {
255
+ if (props.expandRowKeys) {
256
+ store.setExpandRows(props.expandRowKeys);
257
+ }
258
+ });
259
+ watch(() => props.data, () => {
260
+ store.updateRows();
261
+ }, { deep: true });
262
+ }
263
+ const inBrowser = typeof window !== "undefined";
264
+ function getElement(element) {
265
+ if (element instanceof Element) {
266
+ return element;
267
+ }
268
+ if (element && typeof element === "object" && element.$el instanceof Element) {
269
+ return element.$el;
270
+ }
271
+ return null;
272
+ }
273
+ function lockScroll() {
274
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
275
+ const scrollTop = document.documentElement.scrollTop;
276
+ const style = document.documentElement.getAttribute("style");
277
+ document.documentElement.style.position = "fixed";
278
+ document.documentElement.style.top = `-${scrollTop}px`;
279
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
280
+ document.documentElement.style.overflowY = "scroll";
281
+ return () => {
282
+ if (style) {
283
+ document.documentElement.setAttribute("style", style);
284
+ } else {
285
+ document.documentElement.removeAttribute("style");
286
+ }
287
+ document.documentElement.scrollTop = scrollTop;
288
+ };
289
+ }
290
+ return;
291
+ }
292
+ const isBoolean = (value) => typeof value === "boolean";
293
+ const isString = (value) => typeof value === "string";
294
+ const isFunction = (value) => Object.prototype.toString.call(value) === "[object Function]";
295
+ function formatWidth(width) {
296
+ if (width === "") {
297
+ return width;
298
+ }
299
+ if (typeof width === "number") {
300
+ return width;
301
+ }
302
+ return parseInt(width, 10) || 80;
303
+ }
304
+ function getRowIdentity(row, rowKey, index2) {
305
+ if (isFunction(rowKey)) {
306
+ return rowKey(row, index2);
307
+ } else if (isString(rowKey)) {
308
+ const paths = rowKey.split(".");
309
+ let obj = row;
310
+ for (const p of paths) {
311
+ obj = obj[p];
312
+ }
313
+ return `${obj}`;
314
+ }
315
+ return "";
316
+ }
317
+ function getRowKeysMap(data, rowKey) {
318
+ const rowKeyMap = {};
319
+ (data || []).forEach((row, index2) => {
320
+ rowKeyMap[getRowIdentity(row, rowKey)] = { row, index: index2 };
321
+ });
322
+ return rowKeyMap;
323
+ }
324
+ function toggleRowExpandStatus(rowsArr, row, status) {
325
+ let isChanged = false;
326
+ const index2 = rowsArr.indexOf(row);
327
+ const isIncluded = index2 !== -1;
328
+ const addRow = () => {
329
+ rowsArr.push(row);
330
+ isChanged = true;
331
+ };
332
+ const deleteRow = () => {
333
+ rowsArr.splice(index2, 1);
334
+ isChanged = true;
335
+ };
336
+ if (isBoolean(status)) {
337
+ if (status && !isIncluded) {
338
+ addRow();
339
+ } else if (!status && isIncluded) {
340
+ deleteRow();
341
+ }
342
+ } else {
343
+ if (isIncluded) {
344
+ deleteRow();
345
+ } else {
346
+ addRow();
347
+ }
348
+ }
349
+ return isChanged;
350
+ }
351
+ function toggleRowVisible(expand, table2, key) {
352
+ const rowLevelMap = (table2 == null ? void 0 : table2.store.states.rowLevelMap.value) || {};
353
+ const levelKeys = Object.keys(rowLevelMap);
354
+ const hiddenRowKeys = table2 == null ? void 0 : table2.store.states.hiddenRowKeys;
355
+ let start = false;
356
+ for (let index2 = 0; index2 < levelKeys.length; index2++) {
357
+ if (levelKeys[index2] === key) {
358
+ start = true;
359
+ index2++;
360
+ }
361
+ if (start && rowLevelMap[levelKeys[index2]] !== rowLevelMap[key] + 1) {
362
+ break;
363
+ }
364
+ if (start && rowLevelMap[levelKeys[index2]] === rowLevelMap[key] + 1) {
365
+ if (expand) {
366
+ hiddenRowKeys.value = hiddenRowKeys.value.filter((rowKey) => rowKey !== levelKeys[index2]);
367
+ } else {
368
+ if (!hiddenRowKeys.value.includes(levelKeys[index2])) {
369
+ hiddenRowKeys.value.push(levelKeys[index2]);
370
+ }
371
+ }
372
+ }
373
+ }
374
+ }
375
+ function useExpand(dataSource, table2) {
376
+ const tableInstance = getCurrentInstance();
377
+ const rowKey = tableInstance.props.rowKey || "";
378
+ const defaultExpandAll = ref(tableInstance.props.defaultExpandAll);
379
+ const _expandedRows = ref([]);
380
+ const updateExpandRows = () => {
381
+ if (defaultExpandAll.value) {
382
+ _expandedRows.value = dataSource.value.slice();
383
+ } else {
384
+ _expandedRows.value = [];
385
+ }
386
+ };
387
+ const setExpandRows = (rowKeys) => {
388
+ const data = dataSource.value || [];
389
+ const rowKeysMap = getRowKeysMap(data, rowKey);
390
+ _expandedRows.value = rowKeys.reduce((pre, cur) => {
391
+ const currentRow = rowKeysMap[cur];
392
+ if (currentRow) {
393
+ pre.push(currentRow.row);
394
+ }
395
+ return pre;
396
+ }, []);
397
+ };
398
+ const isRowExpanded = (row) => {
399
+ return _expandedRows.value.includes(row);
400
+ };
401
+ const doToggleRowVisible = (expand, row) => {
402
+ var _a;
403
+ if ((_a = row.children) == null ? void 0 : _a.length) {
404
+ const key = getRowIdentity(row, rowKey);
405
+ if (expand && isRowExpanded(row)) {
406
+ toggleRowVisible(true, table2, key);
407
+ }
408
+ if (!expand) {
409
+ toggleRowVisible(false, table2, key);
410
+ }
411
+ row.children.forEach((child) => {
412
+ doToggleRowVisible(expand, child);
413
+ });
414
+ }
415
+ };
416
+ const toggleRowExpansion = (row, expanded) => {
417
+ const isChanged = toggleRowExpandStatus(_expandedRows.value, row, expanded);
418
+ if (isChanged) {
419
+ tableInstance.emit("expand-change", row, _expandedRows.value.slice());
420
+ }
421
+ if (!table2.store.states.flatColumns.value.some((column2) => column2.type === "expand")) {
422
+ doToggleRowVisible(isRowExpanded(row), row);
423
+ }
424
+ };
425
+ return {
426
+ isRowExpanded,
427
+ updateExpandRows,
428
+ setExpandRows,
429
+ toggleRowExpansion
430
+ };
431
+ }
432
+ function useEditTableCell() {
433
+ const tableInstance = getCurrentInstance();
434
+ const rowKey = tableInstance.props.rowKey || "";
435
+ const tableCellModeMap = ref(/* @__PURE__ */ new Map());
436
+ const setCellMode = (row, rowIndex, fields, cellMode) => {
437
+ if (Array.isArray(fields)) {
438
+ fields.forEach((item) => {
439
+ const cellKey = `${getRowIdentity(row, rowKey, rowIndex)}-${item}-cell`;
440
+ tableCellModeMap.value.set(cellKey, cellMode);
441
+ });
442
+ } else {
443
+ const cellKey = `${getRowIdentity(row, rowKey, rowIndex)}-${fields}-cell`;
444
+ tableCellModeMap.value.set(cellKey, cellMode);
445
+ }
446
+ };
447
+ const resetCellMode = () => {
448
+ for (const item of tableCellModeMap.value.keys()) {
449
+ tableCellModeMap.value.set(item, "readonly");
450
+ }
451
+ };
452
+ return {
453
+ tableCellModeMap,
454
+ setCellMode,
455
+ resetCellMode
456
+ };
457
+ }
458
+ function replaceColumn(array4, column2) {
245
459
  return array4.map((item) => {
246
460
  var _a;
247
- if (item.id === column.id) {
248
- return column;
461
+ if (item.id === column2.id) {
462
+ return column2;
249
463
  } else if ((_a = item.children) == null ? void 0 : _a.length) {
250
- item.children = replaceColumn(item.children, column);
464
+ item.children = replaceColumn(item.children, column2);
251
465
  }
252
466
  return item;
253
467
  });
254
468
  }
255
469
  function doFlattenColumns(columns) {
256
470
  const result = [];
257
- columns.forEach((column) => {
258
- if (column.children) {
259
- result.push.apply(result, doFlattenColumns(column.children));
471
+ columns.forEach((column2) => {
472
+ if (column2.children) {
473
+ result.push.apply(result, doFlattenColumns(column2.children));
260
474
  } else {
261
- result.push(column);
475
+ result.push(column2);
262
476
  }
263
477
  });
264
478
  return result;
265
479
  }
266
- const createColumnGenerator = () => {
480
+ function createColumnGenerator() {
267
481
  const _columns = ref([]);
268
482
  const flatColumns = ref([]);
269
483
  const sortColumn = () => {
@@ -272,24 +486,25 @@ const createColumnGenerator = () => {
272
486
  return ((_a = a.order) != null ? _a : 0) - ((_b = b.order) != null ? _b : 0);
273
487
  });
274
488
  };
275
- const insertColumn = (column, parent) => {
489
+ const insertColumn = (column2, parent) => {
490
+ var _a;
276
491
  const array4 = unref(_columns);
277
492
  let newColumns = [];
278
493
  if (!parent) {
279
- array4.push(column);
494
+ array4.push(column2);
280
495
  newColumns = array4;
281
496
  } else {
282
497
  if (parent && !parent.children) {
283
498
  parent.children = [];
284
499
  }
285
- parent.children.push(column);
500
+ (_a = parent == null ? void 0 : parent.children) == null ? void 0 : _a.push(column2);
286
501
  newColumns = replaceColumn(array4, parent);
287
502
  }
288
503
  sortColumn();
289
504
  _columns.value = newColumns;
290
505
  };
291
- const removeColumn = (column) => {
292
- const i = _columns.value.findIndex((v) => v === column);
506
+ const removeColumn = (column2) => {
507
+ const i = _columns.value.findIndex((v) => v === column2);
293
508
  if (i === -1) {
294
509
  return;
295
510
  }
@@ -298,30 +513,100 @@ const createColumnGenerator = () => {
298
513
  const updateColumns = () => {
299
514
  flatColumns.value = [].concat(doFlattenColumns(_columns.value));
300
515
  };
301
- return { _columns, flatColumns, insertColumn, removeColumn, sortColumn, updateColumns };
302
- };
303
- const createSelection = (dataSource, trackBy) => {
516
+ return {
517
+ _columns,
518
+ flatColumns,
519
+ insertColumn,
520
+ removeColumn,
521
+ sortColumn,
522
+ updateColumns
523
+ };
524
+ }
525
+ function doFlattenRows(dataList, level, rowKey, rowLevelMap, hiddenRowKeys) {
526
+ const result = [];
527
+ dataList.forEach((data) => {
528
+ result.push(data);
529
+ if (level > 0) {
530
+ const key = getRowIdentity(data, rowKey);
531
+ rowLevelMap.value[key] = level;
532
+ hiddenRowKeys.value.push(key);
533
+ }
534
+ if (data.children) {
535
+ rowLevelMap.value[getRowIdentity(data, rowKey)] = level;
536
+ result.push.apply(result, doFlattenRows(data.children, level + 1, rowKey, rowLevelMap, hiddenRowKeys));
537
+ }
538
+ });
539
+ return result;
540
+ }
541
+ function createRowGenerator(dataSource, rowKey, flatColumns) {
542
+ const flatRows = ref([]);
543
+ const hiddenRowKeys = ref([]);
544
+ const rowLevelMap = ref({});
545
+ const firstDefaultColumn = ref("");
546
+ const updateRows = () => {
547
+ const hasExpand = flatColumns.value.some((column2) => column2.type === "expand");
548
+ const result = hasExpand ? dataSource.value : doFlattenRows(dataSource.value, 0, rowKey, rowLevelMap, hiddenRowKeys);
549
+ flatRows.value = [].concat(result);
550
+ };
551
+ const updateFirstDefaultColumn = () => {
552
+ const index2 = flatColumns.value.findIndex((column2) => column2.type === "");
553
+ firstDefaultColumn.value = index2 !== -1 ? flatColumns.value[index2].id : "";
554
+ };
555
+ return {
556
+ flatRows,
557
+ hiddenRowKeys,
558
+ rowLevelMap,
559
+ updateRows,
560
+ firstDefaultColumn,
561
+ updateFirstDefaultColumn
562
+ };
563
+ }
564
+ function createSelection(dataSource, rowKey, flatRows) {
304
565
  const _checkSet = ref(/* @__PURE__ */ new Set());
305
- const checkRow = (toggle, row) => {
566
+ const checkRow = (toggle, row, index2) => {
567
+ const key = getRowIdentity(row, rowKey, index2);
306
568
  if (toggle) {
307
- _checkSet.value.add(trackBy(row));
569
+ _checkSet.value.add(key);
308
570
  } else {
309
- _checkSet.value.delete(trackBy(row));
571
+ _checkSet.value.delete(key);
310
572
  }
311
573
  };
312
- const isRowChecked = (row) => {
313
- return _checkSet.value.has(trackBy(row));
574
+ const toggleRowSelection = (row, checked, index2) => {
575
+ const key = getRowIdentity(row, rowKey, index2);
576
+ const isIncluded = _checkSet.value.has(key);
577
+ const addRow = () => {
578
+ _checkSet.value.add(key);
579
+ };
580
+ const deleteRow = () => {
581
+ _checkSet.value.delete(key);
582
+ };
583
+ if (isBoolean(checked)) {
584
+ if (checked && !isIncluded) {
585
+ addRow();
586
+ } else if (!checked && isIncluded) {
587
+ deleteRow();
588
+ }
589
+ } else {
590
+ if (isIncluded) {
591
+ deleteRow();
592
+ } else {
593
+ addRow();
594
+ }
595
+ }
596
+ };
597
+ const isRowChecked = (row, index2) => {
598
+ return _checkSet.value.has(getRowIdentity(row, rowKey, index2));
314
599
  };
315
600
  const getCheckedRows = () => {
316
- return dataSource.value.filter((item) => isRowChecked(item));
601
+ return flatRows.value.filter((item, index2) => isRowChecked(item, index2));
317
602
  };
318
603
  const _checkAllRecord = ref(false);
319
604
  const _checkAll = computed({
320
605
  get: () => _checkAllRecord.value,
321
606
  set: (val) => {
322
607
  _checkAllRecord.value = val;
323
- dataSource.value.forEach((item) => {
324
- checkRow(val, item);
608
+ dataSource.value.forEach((item, index2) => {
609
+ checkRow(val, item, index2);
325
610
  });
326
611
  }
327
612
  });
@@ -332,9 +617,9 @@ const createSelection = (dataSource, trackBy) => {
332
617
  }
333
618
  let allTrue = true;
334
619
  let allFalse = true;
335
- const items = dataSource.value;
620
+ const items = flatRows.value;
336
621
  for (let i = 0; i < items.length; i++) {
337
- const checked = isRowChecked(items[i]);
622
+ const checked = isRowChecked(items[i], i);
338
623
  allTrue && (allTrue = checked);
339
624
  allFalse && (allFalse = !checked);
340
625
  }
@@ -342,7 +627,7 @@ const createSelection = (dataSource, trackBy) => {
342
627
  _halfChecked.value = !(allFalse || allTrue);
343
628
  }, { immediate: true, deep: true });
344
629
  watch(dataSource, (value) => {
345
- _checkAllRecord.value = value.findIndex((item) => !isRowChecked(item)) === -1;
630
+ _checkAllRecord.value = value.findIndex((item, index2) => !isRowChecked(item, index2)) === -1;
346
631
  });
347
632
  return {
348
633
  _checkSet,
@@ -350,10 +635,11 @@ const createSelection = (dataSource, trackBy) => {
350
635
  _halfChecked,
351
636
  getCheckedRows,
352
637
  checkRow,
353
- isRowChecked
638
+ isRowChecked,
639
+ toggleRowSelection
354
640
  };
355
- };
356
- const createSorter = (dataSource, _data) => {
641
+ }
642
+ function createSorter(dataSource, _data) {
357
643
  const sortData = (direction, sortMethod) => {
358
644
  if (direction === "ASC") {
359
645
  _data.value = _data.value.sort((a, b) => sortMethod ? sortMethod(a, b) ? 1 : -1 : 0);
@@ -365,92 +651,33 @@ const createSorter = (dataSource, _data) => {
365
651
  };
366
652
  const thList = [];
367
653
  return { sortData, thList };
368
- };
369
- const createFixedLogic = (columns) => {
654
+ }
655
+ function createFixedLogic(columns) {
370
656
  const isFixedLeft = computed(() => {
371
657
  return columns.value.reduce((prev, current) => prev || !!current.fixedLeft, false);
372
658
  });
373
659
  return { isFixedLeft };
374
- };
375
- const createExpandRow = (dataSource, trackBy) => {
376
- const _expandedRows = ref(/* @__PURE__ */ new Set());
377
- const isRowExpanded = (row) => {
378
- return _expandedRows.value.has(trackBy(row));
379
- };
380
- const expandRow = (row) => {
381
- _expandedRows.value.add(trackBy(row));
382
- };
383
- const collapseRow = (row) => {
384
- _expandedRows.value.delete(trackBy(row));
385
- };
386
- const toggleRow = (row) => {
387
- if (isRowExpanded(row)) {
388
- collapseRow(row);
389
- } else {
390
- expandRow(row);
391
- }
392
- };
393
- const getExpandedRows = () => {
394
- return dataSource.value.filter((item) => isRowExpanded(item));
395
- };
396
- const expandAllRows = () => {
397
- dataSource.value.forEach((item) => {
398
- expandRow(item);
399
- });
400
- };
401
- const collapseAllRows = () => {
402
- dataSource.value.forEach((item) => {
403
- collapseRow(item);
404
- });
405
- };
406
- return {
407
- _expandedRows,
408
- toggleRow,
409
- expandRow,
410
- collapseRow,
411
- isRowExpanded,
412
- getExpandedRows,
413
- expandAllRows,
414
- collapseAllRows
415
- };
416
- };
660
+ }
417
661
  function createStore(dataSource, table2) {
418
662
  const _data = ref([]);
663
+ const { _columns, flatColumns, insertColumn, removeColumn, sortColumn, updateColumns } = createColumnGenerator();
664
+ const { flatRows, hiddenRowKeys, rowLevelMap, updateRows, firstDefaultColumn, updateFirstDefaultColumn } = createRowGenerator(dataSource, table2.props.rowKey, flatColumns);
665
+ const { _checkAll, _checkSet, _halfChecked, getCheckedRows, isRowChecked, checkRow, toggleRowSelection } = createSelection(_data, table2.props.rowKey, flatRows);
666
+ const { sortData, thList } = createSorter(dataSource, flatRows);
667
+ const { isFixedLeft } = createFixedLogic(_columns);
668
+ const { isRowExpanded, updateExpandRows, setExpandRows, toggleRowExpansion } = useExpand(_data, table2);
669
+ const { tableCellModeMap, setCellMode, resetCellMode } = useEditTableCell();
419
670
  watch(dataSource, (value) => {
420
671
  _data.value = [...value];
672
+ updateExpandRows();
421
673
  }, { deep: true, immediate: true });
422
- const {
423
- _columns,
424
- flatColumns,
425
- insertColumn,
426
- removeColumn,
427
- sortColumn,
428
- updateColumns
429
- } = createColumnGenerator();
430
- const {
431
- _checkAll,
432
- _checkSet,
433
- _halfChecked,
434
- getCheckedRows,
435
- isRowChecked,
436
- checkRow
437
- } = createSelection(_data, table2.props.trackBy);
438
- const { sortData, thList } = createSorter(dataSource, _data);
439
- const { isFixedLeft } = createFixedLogic(_columns);
440
- const {
441
- _expandedRows,
442
- toggleRow,
443
- expandRow,
444
- collapseRow,
445
- isRowExpanded,
446
- getExpandedRows,
447
- expandAllRows,
448
- collapseAllRows
449
- } = createExpandRow(dataSource, table2.props.trackBy);
450
674
  return {
451
675
  _table: table2,
452
676
  states: {
453
677
  _data,
678
+ flatRows,
679
+ hiddenRowKeys,
680
+ rowLevelMap,
454
681
  _columns,
455
682
  flatColumns,
456
683
  _checkSet,
@@ -458,23 +685,25 @@ function createStore(dataSource, table2) {
458
685
  _halfChecked,
459
686
  isFixedLeft,
460
687
  thList,
461
- _expandedRows
688
+ firstDefaultColumn,
689
+ tableCellModeMap
462
690
  },
463
691
  insertColumn,
464
692
  sortColumn,
465
693
  removeColumn,
466
694
  updateColumns,
695
+ updateRows,
467
696
  getCheckedRows,
468
697
  sortData,
469
698
  isRowChecked,
470
699
  checkRow,
471
- toggleRow,
472
- expandRow,
473
- collapseRow,
474
700
  isRowExpanded,
475
- getExpandedRows,
476
- expandAllRows,
477
- collapseAllRows
701
+ setExpandRows,
702
+ toggleRowExpansion,
703
+ toggleRowSelection,
704
+ updateFirstDefaultColumn,
705
+ setCellMode,
706
+ resetCellMode
478
707
  };
479
708
  }
480
709
  var ColGroup = defineComponent({
@@ -483,11 +712,11 @@ var ColGroup = defineComponent({
483
712
  const parent = inject(TABLE_TOKEN);
484
713
  const columns = parent == null ? void 0 : parent.store.states.flatColumns;
485
714
  const isFixed = computed(() => (parent == null ? void 0 : parent.props.tableLayout) === "fixed");
486
- return () => createVNode("colgroup", null, [columns == null ? void 0 : columns.value.map((column, index2) => {
715
+ return () => createVNode("colgroup", null, [columns == null ? void 0 : columns.value.map((column2, index2) => {
487
716
  return createVNode("col", {
488
717
  "key": index2,
489
- "column-id": isFixed.value ? column.id : "",
490
- "width": column.type === "expand" ? 60 : isFixed.value ? column.realWidth : column.width || ""
718
+ "column-id": isFixed.value ? column2.id : "",
719
+ "width": column2.type === "expand" ? 60 : isFixed.value ? column2.realWidth : column2.width || ""
491
720
  }, null);
492
721
  })]);
493
722
  }
@@ -499,6 +728,9 @@ const sortProps = {
499
728
  }
500
729
  };
501
730
  var sort = "";
731
+ const XLINK_HREF = {
732
+ "xlink:href": "#sort-svg-path-1"
733
+ };
502
734
  var Sort = defineComponent({
503
735
  props: sortProps,
504
736
  emits: ["sort"],
@@ -557,10 +789,9 @@ var Sort = defineComponent({
557
789
  "stroke-width": "1",
558
790
  "fill": "none",
559
791
  "fill-rule": "evenodd"
560
- }, [createVNode("use", {
561
- "fill-rule": "evenodd",
562
- "xlink:href": "#sort-svg-path-1"
563
- }, null), createVNode("polygon", {
792
+ }, [createVNode("use", mergeProps({
793
+ "fill-rule": "evenodd"
794
+ }, XLINK_HREF), null), createVNode("polygon", {
564
795
  "points": "8 4 11 7 5 7"
565
796
  }, null), createVNode("polygon", {
566
797
  "points": "8 12 5 9 11 9"
@@ -623,15 +854,6 @@ const dropdownProps = {
623
854
  }
624
855
  };
625
856
  const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
626
- function getElement(element) {
627
- if (element instanceof Element) {
628
- return element;
629
- }
630
- if (element && typeof element === "object" && element.$el instanceof Element) {
631
- return element.$el;
632
- }
633
- return null;
634
- }
635
857
  const dropdownMap = /* @__PURE__ */ new Map();
636
858
  function subscribeEvent(dom, type4, callback) {
637
859
  dom == null ? void 0 : dom.addEventListener(type4, callback);
@@ -639,7 +861,14 @@ function subscribeEvent(dom, type4, callback) {
639
861
  dom == null ? void 0 : dom.removeEventListener(type4, callback);
640
862
  };
641
863
  }
642
- const useDropdownEvent = ({ id, isOpen, origin, dropdownRef, props, emit }) => {
864
+ const useDropdownEvent = ({
865
+ id,
866
+ isOpen,
867
+ origin,
868
+ dropdownRef,
869
+ props,
870
+ emit
871
+ }) => {
643
872
  let overlayEnter = false;
644
873
  let originEnter = false;
645
874
  const { trigger, closeScope, closeOnMouseLeaveMenu } = toRefs(props);
@@ -797,25 +1026,6 @@ const fixedOverlayProps = {
797
1026
  default: true
798
1027
  }
799
1028
  };
800
- function lockScroll() {
801
- if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
802
- const scrollTop = document.documentElement.scrollTop;
803
- const style = document.documentElement.getAttribute("style");
804
- document.documentElement.style.position = "fixed";
805
- document.documentElement.style.top = `-${scrollTop}px`;
806
- document.documentElement.style.width = document.documentElement.style.width || "100%";
807
- document.documentElement.style.overflowY = "scroll";
808
- return () => {
809
- if (style) {
810
- document.documentElement.setAttribute("style", style);
811
- } else {
812
- document.documentElement.removeAttribute("style");
813
- }
814
- document.documentElement.scrollTop = scrollTop;
815
- };
816
- }
817
- return;
818
- }
819
1029
  function useFixedOverlay(props, ctx) {
820
1030
  let lockScrollCb;
821
1031
  const onClick = (event) => {
@@ -1031,11 +1241,10 @@ const FlexibleOverlay = defineComponent({
1031
1241
  };
1032
1242
  }
1033
1243
  });
1034
- const inBrowser = typeof window !== "undefined";
1035
1244
  const isObject = (val) => val !== null && typeof val === "object";
1036
- const ns$1 = useNamespace("popper-trigger");
1245
+ const ns$3 = useNamespace("popper-trigger");
1037
1246
  function wrapContent(content) {
1038
- return h("span", { class: ns$1.b() }, content);
1247
+ return h("span", { class: ns$3.b() }, content);
1039
1248
  }
1040
1249
  function getFirstValidChild(nodes) {
1041
1250
  for (const child of nodes) {
@@ -1381,7 +1590,8 @@ function useIconDom(props, ctx) {
1381
1590
  "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
1382
1591
  "style": {
1383
1592
  width: iconSize.value || "",
1384
- transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
1593
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
1594
+ verticalAlign: "middle"
1385
1595
  }
1386
1596
  }, ctx.attrs), null);
1387
1597
  };
@@ -1417,6 +1627,7 @@ function useIconDom(props, ctx) {
1417
1627
  var Icon = defineComponent({
1418
1628
  name: "DIcon",
1419
1629
  props: iconProps,
1630
+ emits: ["click"],
1420
1631
  setup(props, ctx) {
1421
1632
  const {
1422
1633
  disabled,
@@ -1433,9 +1644,9 @@ var Icon = defineComponent({
1433
1644
  }));
1434
1645
  const onClick = (e) => {
1435
1646
  if (disabled.value) {
1436
- e.preventDefault();
1437
- e.stopImmediatePropagation();
1647
+ return;
1438
1648
  }
1649
+ ctx.emit("click", e);
1439
1650
  };
1440
1651
  return () => {
1441
1652
  var _a, _b, _c, _d;
@@ -2780,7 +2991,7 @@ var lodash = { exports: {} };
2780
2991
  function baseAt(object4, paths) {
2781
2992
  var index2 = -1, length = paths.length, result2 = Array2(length), skip = object4 == null;
2782
2993
  while (++index2 < length) {
2783
- result2[index2] = skip ? undefined$1 : get(object4, paths[index2]);
2994
+ result2[index2] = skip ? undefined$1 : get2(object4, paths[index2]);
2784
2995
  }
2785
2996
  return result2;
2786
2997
  }
@@ -2990,7 +3201,7 @@ var lodash = { exports: {} };
2990
3201
  }
2991
3202
  function baseFunctions(object4, props) {
2992
3203
  return arrayFilter(props, function(key) {
2993
- return isFunction(object4[key]);
3204
+ return isFunction2(object4[key]);
2994
3205
  });
2995
3206
  }
2996
3207
  function baseGet(object4, path) {
@@ -3153,7 +3364,7 @@ var lodash = { exports: {} };
3153
3364
  if (!isObject2(value) || isMasked(value)) {
3154
3365
  return false;
3155
3366
  }
3156
- var pattern4 = isFunction(value) ? reIsNative : reIsHostCtor;
3367
+ var pattern4 = isFunction2(value) ? reIsNative : reIsHostCtor;
3157
3368
  return pattern4.test(toSource(value));
3158
3369
  }
3159
3370
  function baseIsRegExp(value) {
@@ -3225,7 +3436,7 @@ var lodash = { exports: {} };
3225
3436
  return matchesStrictComparable(toKey(path), srcValue);
3226
3437
  }
3227
3438
  return function(object4) {
3228
- var objValue = get(object4, path);
3439
+ var objValue = get2(object4, path);
3229
3440
  return objValue === undefined$1 && objValue === srcValue ? hasIn(object4, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
3230
3441
  };
3231
3442
  }
@@ -3275,7 +3486,7 @@ var lodash = { exports: {} };
3275
3486
  newValue = objValue;
3276
3487
  if (isArguments(objValue)) {
3277
3488
  newValue = toPlainObject(objValue);
3278
- } else if (!isObject2(objValue) || isFunction(objValue)) {
3489
+ } else if (!isObject2(objValue) || isFunction2(objValue)) {
3279
3490
  newValue = initCloneObject(srcValue);
3280
3491
  }
3281
3492
  } else {
@@ -4577,7 +4788,7 @@ var lodash = { exports: {} };
4577
4788
  function isMasked(func) {
4578
4789
  return !!maskSrcKey && maskSrcKey in func;
4579
4790
  }
4580
- var isMaskable = coreJsData ? isFunction : stubFalse;
4791
+ var isMaskable = coreJsData ? isFunction2 : stubFalse;
4581
4792
  function isPrototype(value) {
4582
4793
  var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
4583
4794
  return value === proto;
@@ -5301,7 +5512,7 @@ var lodash = { exports: {} };
5301
5512
  if (fromIndex < 0) {
5302
5513
  fromIndex = nativeMax(length + fromIndex, 0);
5303
5514
  }
5304
- return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
5515
+ return isString2(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
5305
5516
  }
5306
5517
  var invokeMap = baseRest(function(collection, path, args) {
5307
5518
  var index2 = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
@@ -5369,7 +5580,7 @@ var lodash = { exports: {} };
5369
5580
  return 0;
5370
5581
  }
5371
5582
  if (isArrayLike(collection)) {
5372
- return isString(collection) ? stringSize(collection) : collection.length;
5583
+ return isString2(collection) ? stringSize(collection) : collection.length;
5373
5584
  }
5374
5585
  var tag = getTag(collection);
5375
5586
  if (tag == mapTag || tag == setTag) {
@@ -5690,12 +5901,12 @@ var lodash = { exports: {} };
5690
5901
  var isArray = Array2.isArray;
5691
5902
  var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
5692
5903
  function isArrayLike(value) {
5693
- return value != null && isLength(value.length) && !isFunction(value);
5904
+ return value != null && isLength(value.length) && !isFunction2(value);
5694
5905
  }
5695
5906
  function isArrayLikeObject(value) {
5696
5907
  return isObjectLike(value) && isArrayLike(value);
5697
5908
  }
5698
- function isBoolean(value) {
5909
+ function isBoolean2(value) {
5699
5910
  return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
5700
5911
  }
5701
5912
  var isBuffer = nativeIsBuffer || stubFalse;
@@ -5742,7 +5953,7 @@ var lodash = { exports: {} };
5742
5953
  function isFinite(value) {
5743
5954
  return typeof value == "number" && nativeIsFinite(value);
5744
5955
  }
5745
- function isFunction(value) {
5956
+ function isFunction2(value) {
5746
5957
  if (!isObject2(value)) {
5747
5958
  return false;
5748
5959
  }
@@ -5804,7 +6015,7 @@ var lodash = { exports: {} };
5804
6015
  return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
5805
6016
  }
5806
6017
  var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
5807
- function isString(value) {
6018
+ function isString2(value) {
5808
6019
  return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
5809
6020
  }
5810
6021
  function isSymbol(value) {
@@ -5829,7 +6040,7 @@ var lodash = { exports: {} };
5829
6040
  return [];
5830
6041
  }
5831
6042
  if (isArrayLike(value)) {
5832
- return isString(value) ? stringToArray(value) : copyArray(value);
6043
+ return isString2(value) ? stringToArray(value) : copyArray(value);
5833
6044
  }
5834
6045
  if (symIterator && value[symIterator]) {
5835
6046
  return iteratorToArray(value[symIterator]());
@@ -5958,7 +6169,7 @@ var lodash = { exports: {} };
5958
6169
  function functionsIn(object4) {
5959
6170
  return object4 == null ? [] : baseFunctions(object4, keysIn(object4));
5960
6171
  }
5961
- function get(object4, path, defaultValue) {
6172
+ function get2(object4, path, defaultValue) {
5962
6173
  var result2 = object4 == null ? undefined$1 : baseGet(object4, path);
5963
6174
  return result2 === undefined$1 ? defaultValue : result2;
5964
6175
  }
@@ -6065,7 +6276,7 @@ var lodash = { exports: {} };
6065
6276
  index2 = length;
6066
6277
  value = defaultValue;
6067
6278
  }
6068
- object4 = isFunction(value) ? value.call(object4) : value;
6279
+ object4 = isFunction2(value) ? value.call(object4) : value;
6069
6280
  }
6070
6281
  return object4;
6071
6282
  }
@@ -6086,7 +6297,7 @@ var lodash = { exports: {} };
6086
6297
  if (isArrLike) {
6087
6298
  accumulator = isArr ? new Ctor() : [];
6088
6299
  } else if (isObject2(object4)) {
6089
- accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object4)) : {};
6300
+ accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object4)) : {};
6090
6301
  } else {
6091
6302
  accumulator = {};
6092
6303
  }
@@ -6503,7 +6714,7 @@ var lodash = { exports: {} };
6503
6714
  object4 = this;
6504
6715
  methodNames = baseFunctions(source, keys(source));
6505
6716
  }
6506
- var chain2 = !(isObject2(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object4);
6717
+ var chain2 = !(isObject2(options) && "chain" in options) || !!options.chain, isFunc = isFunction2(object4);
6507
6718
  arrayEach(methodNames, function(methodName) {
6508
6719
  var func = source[methodName];
6509
6720
  object4[methodName] = func;
@@ -6813,7 +7024,7 @@ var lodash = { exports: {} };
6813
7024
  lodash2.forInRight = forInRight;
6814
7025
  lodash2.forOwn = forOwn;
6815
7026
  lodash2.forOwnRight = forOwnRight;
6816
- lodash2.get = get;
7027
+ lodash2.get = get2;
6817
7028
  lodash2.gt = gt;
6818
7029
  lodash2.gte = gte;
6819
7030
  lodash2.has = has;
@@ -6829,7 +7040,7 @@ var lodash = { exports: {} };
6829
7040
  lodash2.isArrayBuffer = isArrayBuffer;
6830
7041
  lodash2.isArrayLike = isArrayLike;
6831
7042
  lodash2.isArrayLikeObject = isArrayLikeObject;
6832
- lodash2.isBoolean = isBoolean;
7043
+ lodash2.isBoolean = isBoolean2;
6833
7044
  lodash2.isBuffer = isBuffer;
6834
7045
  lodash2.isDate = isDate;
6835
7046
  lodash2.isElement = isElement;
@@ -6838,7 +7049,7 @@ var lodash = { exports: {} };
6838
7049
  lodash2.isEqualWith = isEqualWith;
6839
7050
  lodash2.isError = isError;
6840
7051
  lodash2.isFinite = isFinite;
6841
- lodash2.isFunction = isFunction;
7052
+ lodash2.isFunction = isFunction2;
6842
7053
  lodash2.isInteger = isInteger;
6843
7054
  lodash2.isLength = isLength;
6844
7055
  lodash2.isMap = isMap;
@@ -6855,7 +7066,7 @@ var lodash = { exports: {} };
6855
7066
  lodash2.isRegExp = isRegExp;
6856
7067
  lodash2.isSafeInteger = isSafeInteger;
6857
7068
  lodash2.isSet = isSet;
6858
- lodash2.isString = isString;
7069
+ lodash2.isString = isString2;
6859
7070
  lodash2.isSymbol = isSymbol;
6860
7071
  lodash2.isTypedArray = isTypedArray;
6861
7072
  lodash2.isUndefined = isUndefined;
@@ -7645,10 +7856,10 @@ function usePopoverEvent(props, visible, origin) {
7645
7856
  });
7646
7857
  return { placement, handlePositionChange, onMouseenter, onMouseleave };
7647
7858
  }
7648
- const ns = useNamespace("popover");
7859
+ const ns$2 = useNamespace("popover");
7649
7860
  function SuccessIcon$1() {
7650
7861
  return createVNode("svg", {
7651
- "class": [ns.e("icon"), ns.em("icon", "success")],
7862
+ "class": [ns$2.e("icon"), ns$2.em("icon", "success")],
7652
7863
  "viewBox": "0 0 16 16",
7653
7864
  "version": "1.1",
7654
7865
  "xmlns": "http://www.w3.org/2000/svg"
@@ -7672,7 +7883,7 @@ function SuccessIcon$1() {
7672
7883
  }
7673
7884
  function WarningIcon() {
7674
7885
  return createVNode("svg", {
7675
- "class": [ns.e("icon"), ns.em("icon", "warning")],
7886
+ "class": [ns$2.e("icon"), ns$2.em("icon", "warning")],
7676
7887
  "viewBox": "0 0 16 16",
7677
7888
  "version": "1.1",
7678
7889
  "xmlns": "http://www.w3.org/2000/svg"
@@ -7689,7 +7900,7 @@ function WarningIcon() {
7689
7900
  }
7690
7901
  function InfoIcon() {
7691
7902
  return createVNode("svg", {
7692
- "class": [ns.e("icon"), ns.em("icon", "info")],
7903
+ "class": [ns$2.e("icon"), ns$2.em("icon", "info")],
7693
7904
  "viewBox": "0 0 16 16",
7694
7905
  "version": "1.1",
7695
7906
  "xmlns": "http://www.w3.org/2000/svg"
@@ -7710,7 +7921,7 @@ function InfoIcon() {
7710
7921
  }
7711
7922
  function ErrorIcon$1() {
7712
7923
  return createVNode("svg", {
7713
- "class": [ns.e("icon"), ns.em("icon", "error")],
7924
+ "class": [ns$2.e("icon"), ns$2.em("icon", "error")],
7714
7925
  "width": "16px",
7715
7926
  "height": "16px",
7716
7927
  "viewBox": "0 0 16 16",
@@ -9025,6 +9236,16 @@ Schema.register = function register(type4, validator) {
9025
9236
  Schema.warning = warning;
9026
9237
  Schema.messages = messages;
9027
9238
  Schema.validators = validators;
9239
+ function getFieldValue(obj, path) {
9240
+ return {
9241
+ get value() {
9242
+ return lodash.exports.get(obj, path);
9243
+ },
9244
+ set value(val) {
9245
+ lodash.exports.set(obj, path, val);
9246
+ }
9247
+ };
9248
+ }
9028
9249
  function useFormItem(messageType, _rules, validateState) {
9029
9250
  const formContext = inject(FORM_TOKEN);
9030
9251
  const ns2 = useNamespace("form");
@@ -9063,17 +9284,12 @@ function useFormItemValidate(props, _rules) {
9063
9284
  const computedField = computed(() => {
9064
9285
  return typeof props.field === "string" ? props.field : "";
9065
9286
  });
9066
- const fieldValue = computed({
9067
- get: () => {
9068
- const formData = formContext.data;
9069
- if (!formData || !props.field) {
9070
- return;
9071
- }
9072
- return formData[props.field];
9073
- },
9074
- set: (val) => {
9075
- formContext.data[props.field] = val;
9287
+ const fieldValue = computed(() => {
9288
+ const formData = formContext.data;
9289
+ if (!formData || !props.field) {
9290
+ return;
9076
9291
  }
9292
+ return getFieldValue(formData, props.field).value;
9077
9293
  });
9078
9294
  const getRuleByTrigger = (triggerVal) => {
9079
9295
  return _rules.value.filter((rule) => {
@@ -9086,7 +9302,7 @@ function useFormItemValidate(props, _rules) {
9086
9302
  return rule.trigger === triggerVal;
9087
9303
  }
9088
9304
  }).map((_a) => {
9089
- var _b = _a, { trigger } = _b, rule = __objRest(_b, ["trigger"]);
9305
+ var rule = __objRest(_a, []);
9090
9306
  return rule;
9091
9307
  });
9092
9308
  };
@@ -9142,13 +9358,16 @@ function useFormItemValidate(props, _rules) {
9142
9358
  if (!formContext.data || !props.field) {
9143
9359
  return;
9144
9360
  }
9145
- isResetting = true;
9146
- fieldValue.value = initFieldValue;
9361
+ const currentValue = getFieldValue(formContext.data, props.field);
9362
+ if (!lodash.exports.isEqual(currentValue.value, initFieldValue)) {
9363
+ isResetting = true;
9364
+ }
9365
+ currentValue.value = initFieldValue;
9147
9366
  await nextTick();
9148
9367
  clearValidate();
9149
9368
  };
9150
9369
  onMounted(() => {
9151
- initFieldValue = lodash.exports.cloneDeep(formContext.data[props.field]);
9370
+ initFieldValue = lodash.exports.clone(fieldValue.value);
9152
9371
  });
9153
9372
  return { validateState, validateMessage, validate, resetField, clearValidate };
9154
9373
  }
@@ -9683,6 +9902,27 @@ function useFilterSingle(ctx) {
9683
9902
  };
9684
9903
  return { selectedItem, handleSelect };
9685
9904
  }
9905
+ const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
9906
+ function get(object4, path) {
9907
+ const keys = path.split(".");
9908
+ let result = object4;
9909
+ keys.forEach((key) => {
9910
+ var _a;
9911
+ result = (_a = result[key]) != null ? _a : "";
9912
+ });
9913
+ return result;
9914
+ }
9915
+ function createI18nTranslate(name, app, newPrefix) {
9916
+ const prefix = newPrefix || camelize(name) + ".";
9917
+ return (path) => {
9918
+ const messages2 = app == null ? void 0 : app.appContext.config.globalProperties.langMessages.value;
9919
+ const message = get(messages2, prefix + path) || get(messages2, path);
9920
+ return message;
9921
+ };
9922
+ }
9923
+ function _isSlot$1(s) {
9924
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
9925
+ }
9686
9926
  var MultipleFilter = defineComponent({
9687
9927
  props: {
9688
9928
  filterList: {
@@ -9692,37 +9932,42 @@ var MultipleFilter = defineComponent({
9692
9932
  },
9693
9933
  emits: ["confirm"],
9694
9934
  setup(props, ctx) {
9935
+ const app = getCurrentInstance();
9936
+ const t = createI18nTranslate("DTable", app);
9695
9937
  const {
9696
9938
  _checkList,
9697
9939
  _checkAll,
9698
9940
  _halfChecked,
9699
9941
  handleConfirm
9700
9942
  } = useFilterMultiple(props.filterList, ctx);
9701
- return () => createVNode(Fragment, null, [createVNode("div", {
9702
- "class": "filter-all-check"
9703
- }, [createVNode("div", {
9704
- "class": "filter-item"
9705
- }, [createVNode(Checkbox, {
9706
- "modelValue": _checkAll.value,
9707
- "onUpdate:modelValue": ($event) => _checkAll.value = $event,
9708
- "halfChecked": _halfChecked.value,
9709
- "label": "\u5168\u9009"
9710
- }, null)])]), createVNode("div", {
9711
- "class": "filter-multiple-menu"
9712
- }, [_checkList.value.map((item) => createVNode("div", {
9713
- "class": "filter-item"
9714
- }, [createVNode(Checkbox, {
9715
- "modelValue": item.checked,
9716
- "onUpdate:modelValue": ($event) => item.checked = $event,
9717
- "label": item.name
9718
- }, null)]))]), createVNode("div", {
9719
- "class": "filter-operation"
9720
- }, [createVNode(Button, {
9721
- "variant": "text",
9722
- "onClick": handleConfirm
9723
- }, {
9724
- default: () => [createTextVNode("\u786E\u5B9A")]
9725
- })])]);
9943
+ return () => {
9944
+ let _slot;
9945
+ return createVNode(Fragment, null, [createVNode("div", {
9946
+ "class": "filter-all-check"
9947
+ }, [createVNode("div", {
9948
+ "class": "filter-item"
9949
+ }, [createVNode(Checkbox, {
9950
+ "modelValue": _checkAll.value,
9951
+ "onUpdate:modelValue": ($event) => _checkAll.value = $event,
9952
+ "halfChecked": _halfChecked.value,
9953
+ "label": t("selectAll")
9954
+ }, null)])]), createVNode("div", {
9955
+ "class": "filter-multiple-menu"
9956
+ }, [_checkList.value.map((item) => createVNode("div", {
9957
+ "class": "filter-item"
9958
+ }, [createVNode(Checkbox, {
9959
+ "modelValue": item.checked,
9960
+ "onUpdate:modelValue": ($event) => item.checked = $event,
9961
+ "label": item.name
9962
+ }, null)]))]), createVNode("div", {
9963
+ "class": "filter-operation"
9964
+ }, [createVNode(Button, {
9965
+ "variant": "text",
9966
+ "onClick": handleConfirm
9967
+ }, _isSlot$1(_slot = t("ok")) ? _slot : {
9968
+ default: () => [_slot]
9969
+ })])]);
9970
+ };
9726
9971
  }
9727
9972
  });
9728
9973
  var list = "";
@@ -9842,17 +10087,17 @@ var Filter = defineComponent({
9842
10087
  });
9843
10088
  }
9844
10089
  });
9845
- function useBaseRender(column) {
10090
+ function useBaseRender(column2) {
9846
10091
  const baseClass = computed(() => ({
9847
- operable: column.value.filterable || column.value.sortable || column.value.resizeable,
9848
- resizeable: column.value.resizeable
10092
+ operable: column2.value.filterable || column2.value.sortable || column2.value.resizeable,
10093
+ resizeable: column2.value.resizeable
9849
10094
  }));
9850
10095
  return { baseClass };
9851
10096
  }
9852
- function useSort(column) {
10097
+ function useSort(column2) {
9853
10098
  const table2 = inject(TABLE_TOKEN);
9854
10099
  const store = table2.store;
9855
- const direction = ref(column.value.sortDirection);
10100
+ const direction = ref(column2.value.sortDirection);
9856
10101
  const sortClass = computed(() => ({
9857
10102
  "sort-active": Boolean(direction.value)
9858
10103
  }));
@@ -9860,7 +10105,7 @@ function useSort(column) {
9860
10105
  thInstance && store.states.thList.push(thInstance);
9861
10106
  onMounted(() => {
9862
10107
  var _a;
9863
- column.value.sortable && column.value.sortDirection && ((_a = store.sortData) == null ? void 0 : _a.call(store, direction.value, column.value.sortMethod));
10108
+ column2.value.sortable && column2.value.sortDirection && ((_a = store.sortData) == null ? void 0 : _a.call(store, direction.value, column2.value.sortMethod));
9864
10109
  });
9865
10110
  const execClearSortOrder = () => {
9866
10111
  store.states.thList.forEach((th) => {
@@ -9874,22 +10119,23 @@ function useSort(column) {
9874
10119
  var _a;
9875
10120
  direction.value = val;
9876
10121
  execClearSortOrder();
9877
- (_a = store.sortData) == null ? void 0 : _a.call(store, direction.value, column.value.sortMethod);
9878
- table2.emit("sort-change", { field: column.value.field, direction: direction.value });
10122
+ (_a = store.sortData) == null ? void 0 : _a.call(store, direction.value, column2.value.sortMethod);
10123
+ table2.emit("sort-change", { field: column2.value.field, direction: direction.value });
9879
10124
  };
9880
10125
  const clearSortOrder = () => {
9881
10126
  direction.value = "";
9882
10127
  };
9883
10128
  return { direction, sortClass, handleSort, clearSortOrder };
9884
10129
  }
9885
- function useFilter(column) {
10130
+ function useFilter(column2) {
9886
10131
  const filter2 = ref(null);
9887
10132
  const filterClass = computed(() => ({
9888
10133
  "filter-active": Boolean(filter2.value || Array.isArray(filter2.value) && filter2.value.length)
9889
10134
  }));
9890
10135
  const handleFilter = (val) => {
10136
+ var _a;
9891
10137
  filter2.value = val;
9892
- column.value.ctx.emit("filter-change", val);
10138
+ (_a = column2.value.ctx) == null ? void 0 : _a.emit("filter-change", val);
9893
10139
  };
9894
10140
  return { filterClass, handleFilter };
9895
10141
  }
@@ -9910,7 +10156,7 @@ function getFinalWidth(newWidth, minWidth, maxWidth) {
9910
10156
  const finalWidth = !overMinWidth ? realMinWidth : !underMaxWidth ? realMaxWidth : newWidth;
9911
10157
  return finalWidth;
9912
10158
  }
9913
- function useDragColumnWidth(elementRef, column) {
10159
+ function useDragColumnWidth(elementRef, column2) {
9914
10160
  let initialWidth = 0;
9915
10161
  let mouseDownScreenX = 0;
9916
10162
  let resizeBarElement;
@@ -9919,33 +10165,36 @@ function useDragColumnWidth(elementRef, column) {
9919
10165
  const resizing = ref(false);
9920
10166
  const tableElement = table2.tableRef;
9921
10167
  const onMousemove = (e) => {
10168
+ var _a;
9922
10169
  const movementX = e.clientX - mouseDownScreenX;
9923
10170
  const newWidth = initialWidth + movementX;
9924
- const finalWidth = getFinalWidth(newWidth, column.value.minWidth, column.value.maxWidth);
10171
+ const finalWidth = getFinalWidth(newWidth, column2.value.minWidth, column2.value.maxWidth);
9925
10172
  if (resizeBarElement) {
9926
10173
  resizeBarElement.style.left = `${finalWidth + elementRef.value.offsetLeft}px`;
9927
10174
  }
9928
- column.value.ctx.emit("resizing", { width: finalWidth });
10175
+ (_a = column2.value.ctx) == null ? void 0 : _a.emit("resizing", { width: finalWidth });
9929
10176
  };
9930
10177
  const onMouseup = (e) => {
10178
+ var _a;
9931
10179
  const movementX = e.clientX - mouseDownScreenX;
9932
10180
  const newWidth = initialWidth + movementX;
9933
- const finalWidth = getFinalWidth(newWidth, column.value.minWidth, column.value.maxWidth);
9934
- column.value.width = finalWidth;
9935
- column.value.realWidth = finalWidth;
10181
+ const finalWidth = getFinalWidth(newWidth, column2.value.minWidth, column2.value.maxWidth);
10182
+ column2.value.width = finalWidth;
10183
+ column2.value.realWidth = finalWidth;
9936
10184
  table2.updateColumnWidth();
9937
10185
  resizing.value = false;
9938
10186
  tableElement == null ? void 0 : tableElement.value.classList.remove("table-selector");
9939
10187
  dragClass.value = "";
9940
10188
  tableElement == null ? void 0 : tableElement.value.removeChild(resizeBarElement);
9941
- column.value.ctx.emit("resize-end", { width: finalWidth, beforeWidth: initialWidth });
10189
+ (_a = column2.value.ctx) == null ? void 0 : _a.emit("resize-end", { width: finalWidth, beforeWidth: initialWidth });
9942
10190
  document.removeEventListener("mouseup", onMouseup);
9943
10191
  document.removeEventListener("mousemove", onMousemove);
9944
10192
  };
9945
10193
  const onMousedown = (e) => {
10194
+ var _a;
9946
10195
  const isHandle = e.target.classList.contains("resize-handle");
9947
10196
  if (isHandle) {
9948
- column.value.ctx.emit("resize-start");
10197
+ (_a = column2.value.ctx) == null ? void 0 : _a.emit("resize-start");
9949
10198
  const initialOffset = elementRef.value.offsetLeft;
9950
10199
  initialWidth = elementRef.value.clientWidth;
9951
10200
  mouseDownScreenX = e.clientX;
@@ -9966,14 +10215,21 @@ function useDragColumnWidth(elementRef, column) {
9966
10215
  };
9967
10216
  return { resizing, dragClass, onMousedown };
9968
10217
  }
10218
+ const headerThProps = {
10219
+ column: {
10220
+ type: Object,
10221
+ required: true
10222
+ },
10223
+ colspan: {
10224
+ type: Number
10225
+ },
10226
+ rowspan: {
10227
+ type: Number
10228
+ }
10229
+ };
9969
10230
  var TH = defineComponent({
9970
10231
  name: "DTableHeaderTh",
9971
- props: {
9972
- column: {
9973
- type: Object,
9974
- required: true
9975
- }
9976
- },
10232
+ props: headerThProps,
9977
10233
  setup(props, {
9978
10234
  expose
9979
10235
  }) {
@@ -9981,30 +10237,30 @@ var TH = defineComponent({
9981
10237
  const store = table2.store;
9982
10238
  const headerContainerRef = ref();
9983
10239
  const {
9984
- column
10240
+ column: column2
9985
10241
  } = toRefs(props);
9986
10242
  const {
9987
10243
  baseClass
9988
- } = useBaseRender(column);
10244
+ } = useBaseRender(column2);
9989
10245
  const {
9990
10246
  direction,
9991
10247
  sortClass,
9992
10248
  handleSort,
9993
10249
  clearSortOrder
9994
- } = useSort(column);
10250
+ } = useSort(column2);
9995
10251
  const {
9996
10252
  filterClass,
9997
10253
  handleFilter
9998
- } = useFilter(column);
10254
+ } = useFilter(column2);
9999
10255
  const {
10000
10256
  stickyClass,
10001
10257
  stickyStyle
10002
- } = useFixedColumn(column);
10258
+ } = useFixedColumn(column2);
10003
10259
  const {
10004
10260
  resizing,
10005
10261
  dragClass,
10006
10262
  onMousedown
10007
- } = useDragColumnWidth(headerContainerRef, column);
10263
+ } = useDragColumnWidth(headerContainerRef, column2);
10008
10264
  expose({
10009
10265
  clearSortOrder
10010
10266
  });
@@ -10017,17 +10273,17 @@ var TH = defineComponent({
10017
10273
  "ref": headerContainerRef,
10018
10274
  "class": "header-container",
10019
10275
  "onMousedown": onMousedown
10020
- }, [(_b = (_a = column.value).renderHeader) == null ? void 0 : _b.call(_a, column.value, store), column.value.filterable && createVNode(Filter, {
10021
- "filterList": column.value.filterList,
10022
- "multiple": column.value.filterMultiple,
10276
+ }, [(_b = (_a = column2.value).renderHeader) == null ? void 0 : _b.call(_a, column2.value, store), column2.value.filterable && createVNode(Filter, {
10277
+ "filterList": column2.value.filterList,
10278
+ "multiple": column2.value.filterMultiple,
10023
10279
  "onFilter": handleFilter
10024
- }, null), column.value.sortable && createVNode(Sort, {
10280
+ }, null), column2.value.sortable && createVNode(Sort, {
10025
10281
  "sort-direction": direction.value,
10026
10282
  "onSort": handleSort
10027
- }, null), column.value.resizeable && createVNode("span", {
10283
+ }, null), column2.value.resizeable && createVNode("span", {
10028
10284
  "class": "resize-handle",
10029
10285
  "onClick": (e) => e.stopPropagation()
10030
- }, null), column.value.resizeable && resizing.value && createVNode("div", {
10286
+ }, null), column2.value.resizeable && resizing.value && createVNode("div", {
10031
10287
  "class": "resize-overlay",
10032
10288
  "onClick": (e) => e.stopPropagation()
10033
10289
  }, null)])]);
@@ -10036,53 +10292,53 @@ var TH = defineComponent({
10036
10292
  });
10037
10293
  function getAllColumns(columns) {
10038
10294
  const result = [];
10039
- columns.forEach((column) => {
10040
- if (column.children) {
10041
- result.push(column);
10042
- result.push.apply(result, getAllColumns(column.children));
10295
+ columns.forEach((column2) => {
10296
+ if (column2.children) {
10297
+ result.push(column2);
10298
+ result.push.apply(result, getAllColumns(column2.children));
10043
10299
  } else {
10044
- result.push(column);
10300
+ result.push(column2);
10045
10301
  }
10046
10302
  });
10047
10303
  return result;
10048
10304
  }
10049
10305
  function convertToRows(originColumns) {
10050
10306
  let maxLevel = 1;
10051
- const traverse = (column, parent) => {
10307
+ const traverse = (column2, parent) => {
10052
10308
  if (parent) {
10053
- column.level = parent.level + 1;
10054
- if (maxLevel < column.level) {
10055
- maxLevel = column.level;
10309
+ column2.level = parent.level + 1;
10310
+ if (maxLevel < column2.level) {
10311
+ maxLevel = column2.level;
10056
10312
  }
10057
10313
  }
10058
- if (column.children) {
10314
+ if (column2.children) {
10059
10315
  let colSpan = 0;
10060
- column.children.forEach((subColumn) => {
10061
- traverse(subColumn, column);
10062
- colSpan += subColumn.colSpan;
10316
+ column2.children.forEach((subColumn) => {
10317
+ traverse(subColumn, column2);
10318
+ colSpan += subColumn.colSpan || 0;
10063
10319
  });
10064
- column.colSpan = colSpan;
10320
+ column2.colSpan = colSpan;
10065
10321
  } else {
10066
- column.colSpan = 1;
10322
+ column2.colSpan = 1;
10067
10323
  }
10068
10324
  };
10069
- originColumns.forEach((column) => {
10070
- column.level = 1;
10071
- traverse(column, void 0);
10325
+ originColumns.forEach((column2) => {
10326
+ column2.level = 1;
10327
+ traverse(column2, void 0);
10072
10328
  });
10073
10329
  const rows = [];
10074
10330
  for (let i = 0; i < maxLevel; i++) {
10075
10331
  rows.push([]);
10076
10332
  }
10077
10333
  const allColumns = getAllColumns(originColumns);
10078
- allColumns.forEach((column) => {
10079
- if (!column.children) {
10080
- column.rowSpan = maxLevel - column.level + 1;
10334
+ allColumns.forEach((column2) => {
10335
+ if (!column2.children) {
10336
+ column2.rowSpan = maxLevel - (column2.level || 0) + 1;
10081
10337
  } else {
10082
- column.rowSpan = 1;
10083
- column.children.forEach((col) => col.isSubColumn = true);
10338
+ column2.rowSpan = 1;
10339
+ column2.children.forEach((col) => col.isSubColumn = true);
10084
10340
  }
10085
- rows[column.level - 1].push(column);
10341
+ rows[column2.level - 1].push(column2);
10086
10342
  });
10087
10343
  return rows;
10088
10344
  }
@@ -10102,12 +10358,12 @@ var TableHeader = defineComponent({
10102
10358
  } = useHeader();
10103
10359
  return () => createVNode("thead", {
10104
10360
  "class": ns2.e("thead")
10105
- }, [headerRows.value.map((subColumns) => createVNode("tr", null, [subColumns.map((column, columnIndex) => {
10361
+ }, [headerRows.value.map((subColumns) => createVNode("tr", null, [subColumns.map((column2, columnIndex) => {
10106
10362
  return createVNode(TH, {
10107
10363
  "key": columnIndex,
10108
- "column": column,
10109
- "colspan": column.colSpan,
10110
- "rowspan": column.rowSpan
10364
+ "column": column2,
10365
+ "colspan": column2.colSpan,
10366
+ "rowspan": column2.rowSpan
10111
10367
  }, null);
10112
10368
  })]))]);
10113
10369
  }
@@ -10121,6 +10377,12 @@ const bodyTdProps = {
10121
10377
  type: Object,
10122
10378
  default: () => ({})
10123
10379
  },
10380
+ rowspan: {
10381
+ type: Number
10382
+ },
10383
+ colspan: {
10384
+ type: Number
10385
+ },
10124
10386
  index: {
10125
10387
  type: Number,
10126
10388
  default: 0
@@ -10276,11 +10538,12 @@ var Tooltip = defineComponent({
10276
10538
  })]);
10277
10539
  }
10278
10540
  });
10279
- function useBodyTd(props) {
10541
+ function useBodyTd(props, ctx) {
10280
10542
  const tooltipContent = ref();
10281
10543
  const isShowTooltip = ref(false);
10282
10544
  const tdRef = ref();
10283
10545
  let observer;
10546
+ const table2 = inject(TABLE_TOKEN);
10284
10547
  function getTooltipContent() {
10285
10548
  var _a, _b;
10286
10549
  return ((_a = tdRef.value) == null ? void 0 : _a.innerText) || ((_b = tdRef.value) == null ? void 0 : _b.textContent);
@@ -10294,36 +10557,64 @@ function useBodyTd(props) {
10294
10557
  range3.setEnd(tdRef.value, tdRef.value.childNodes.length);
10295
10558
  const rangeWidth = range3.getBoundingClientRect().width;
10296
10559
  const padding = parseInt(window.getComputedStyle(tdRef.value)["paddingLeft"], 10) + parseInt(window.getComputedStyle(tdRef.value)["paddingRight"], 10);
10297
- isShowTooltip.value = props.column.showOverflowTooltip && rangeWidth + padding > tdRef.value.offsetWidth;
10560
+ isShowTooltip.value = !!(props.column.showOverflowTooltip && rangeWidth + padding > tdRef.value.offsetWidth);
10298
10561
  }
10299
10562
  onMounted(() => {
10300
10563
  if (inBrowser && window.ResizeObserver && props.column.showOverflowTooltip) {
10301
- const observer2 = new window.ResizeObserver(shouldShowTooltip);
10302
- tdRef.value && observer2.observe(tdRef.value);
10564
+ const innerObserver = new window.ResizeObserver(shouldShowTooltip);
10565
+ tdRef.value && innerObserver.observe(tdRef.value);
10303
10566
  }
10304
10567
  tooltipContent.value = getTooltipContent();
10305
10568
  });
10306
10569
  onBeforeMount(() => {
10307
10570
  tdRef.value && observer.unobserve(tdRef.value);
10308
10571
  });
10309
- return { tdRef, isShowTooltip, tooltipContent };
10572
+ onUpdated(() => {
10573
+ const modeMap = table2.store.states.tableCellModeMap.value;
10574
+ for (const child of modeMap.keys()) {
10575
+ modeMap.set(child, "readonly");
10576
+ }
10577
+ });
10578
+ const getCellKsy = () => {
10579
+ return `${getRowIdentity(props.row, table2.props.rowKey, props.index)}-${props.column.field}-cell`;
10580
+ };
10581
+ const cellMode = computed(() => {
10582
+ const cellKey = getCellKsy();
10583
+ const mode = table2.store.states.tableCellModeMap.value.get(cellKey);
10584
+ return mode || "readonly";
10585
+ });
10586
+ const onCellClick = () => {
10587
+ const modeMap = table2.store.states.tableCellModeMap.value;
10588
+ const cellKey = getCellKsy();
10589
+ for (const child of modeMap.keys()) {
10590
+ modeMap.set(child, "readonly");
10591
+ }
10592
+ if (props.column.type === "editable" && modeMap.get(cellKey) === "edit") {
10593
+ return;
10594
+ }
10595
+ ctx.emit("cellClick");
10596
+ };
10597
+ return { tdRef, isShowTooltip, tooltipContent, cellMode, onCellClick };
10310
10598
  }
10311
10599
  var TD = defineComponent({
10312
10600
  name: "DTableBodyTd",
10313
10601
  inheritAttrs: false,
10314
10602
  props: bodyTdProps,
10603
+ emits: ["cellClick"],
10315
10604
  setup(props, ctx) {
10316
- const column = toRef(props, "column");
10605
+ const column2 = toRef(props, "column");
10317
10606
  const table2 = inject(TABLE_TOKEN);
10318
10607
  const {
10319
10608
  stickyClass,
10320
10609
  stickyStyle
10321
- } = useFixedColumn(column);
10610
+ } = useFixedColumn(column2);
10322
10611
  const {
10323
10612
  tdRef,
10324
10613
  isShowTooltip,
10325
- tooltipContent
10326
- } = useBodyTd(props);
10614
+ tooltipContent,
10615
+ cellMode,
10616
+ onCellClick
10617
+ } = useBodyTd(props, ctx);
10327
10618
  return () => {
10328
10619
  return createVNode(Tooltip, {
10329
10620
  "content": tooltipContent.value,
@@ -10335,21 +10626,24 @@ var TD = defineComponent({
10335
10626
  "ref": tdRef,
10336
10627
  "class": stickyClass.value,
10337
10628
  "style": stickyStyle.value
10338
- }, ctx.attrs), [(_b = (_a = props.column).renderCell) == null ? void 0 : _b.call(_a, props.row, props.column, table2.store, props.index)])];
10629
+ }, ctx.attrs, {
10630
+ "onClick": onCellClick
10631
+ }), [(_b = (_a = props.column).renderCell) == null ? void 0 : _b.call(_a, props.row, props.column, table2.store, props.index, table2.props, cellMode)])];
10339
10632
  }
10340
10633
  });
10341
10634
  };
10342
10635
  }
10343
10636
  });
10637
+ const ns$1 = useNamespace("table");
10344
10638
  function useMergeCell() {
10345
10639
  const table2 = inject(TABLE_TOKEN);
10346
10640
  const { _data: data, _columns: columns } = table2.store.states;
10347
- const getSpan = (row, column, rowIndex, columnIndex) => {
10641
+ const getSpan = (row, column2, rowIndex, columnIndex) => {
10348
10642
  const fn = table2 == null ? void 0 : table2.props.spanMethod;
10349
10643
  let rowspan = 1;
10350
10644
  let colspan = 1;
10351
10645
  if (typeof fn === "function") {
10352
- const result = fn({ row, column, rowIndex, columnIndex });
10646
+ const result = fn({ row, column: column2, rowIndex, columnIndex });
10353
10647
  if (Array.isArray(result)) {
10354
10648
  rowspan = result[0];
10355
10649
  colspan = result[1];
@@ -10364,8 +10658,8 @@ function useMergeCell() {
10364
10658
  const result = {};
10365
10659
  if (table2 == null ? void 0 : table2.props.spanMethod) {
10366
10660
  data.value.forEach((row, rowIndex) => {
10367
- columns.value.forEach((column, columnIndex) => {
10368
- const { rowspan, colspan } = getSpan(row, column, rowIndex, columnIndex);
10661
+ columns.value.forEach((column2, columnIndex) => {
10662
+ const { rowspan, colspan } = getSpan(row, column2, rowIndex, columnIndex);
10369
10663
  if (rowspan > 1 || colspan > 1) {
10370
10664
  result[`${rowIndex}-${columnIndex}`] = [rowspan, colspan];
10371
10665
  }
@@ -10393,64 +10687,80 @@ function useMergeCell() {
10393
10687
  });
10394
10688
  return { tableSpans, removeCells };
10395
10689
  }
10690
+ function useBodyRender() {
10691
+ const table2 = inject(TABLE_TOKEN);
10692
+ const hoverEnabled = computed(() => table2 == null ? void 0 : table2.props.rowHoveredHighlight);
10693
+ const rowLevelMap = (table2 == null ? void 0 : table2.store.states.rowLevelMap) || {};
10694
+ const rowKey = (table2 == null ? void 0 : table2.props.rowKey) || "id";
10695
+ const getTableRowClass = (row) => {
10696
+ const level = rowLevelMap.value[getRowIdentity(row, rowKey)];
10697
+ return {
10698
+ [ns$1.e("row")]: true,
10699
+ ["hover-enabled"]: hoverEnabled.value,
10700
+ ["expanded"]: table2 == null ? void 0 : table2.store.isRowExpanded(row),
10701
+ [ns$1.em("row", `level-${level}`)]: level !== void 0,
10702
+ ["is-hidden"]: table2 == null ? void 0 : table2.store.states.hiddenRowKeys.value.includes(getRowIdentity(row, rowKey))
10703
+ };
10704
+ };
10705
+ return { getTableRowClass };
10706
+ }
10396
10707
  var TableBody = defineComponent({
10397
10708
  name: "DTableBody",
10398
10709
  setup() {
10399
10710
  const table2 = inject(TABLE_TOKEN);
10400
10711
  const {
10401
- _data: data,
10402
- flatColumns
10712
+ flatColumns,
10713
+ flatRows
10403
10714
  } = table2.store.states;
10404
10715
  const ns2 = useNamespace("table");
10405
- const hoverEnabled = computed(() => table2.props.rowHoveredHighlight);
10406
10716
  const {
10407
10717
  tableSpans,
10408
10718
  removeCells
10409
10719
  } = useMergeCell();
10720
+ const {
10721
+ getTableRowClass
10722
+ } = useBodyRender();
10410
10723
  const onCellClick = (cellClickArg) => {
10411
10724
  table2.emit("cell-click", cellClickArg);
10412
10725
  };
10726
+ const onRowClick = (rowClickArg) => {
10727
+ table2.emit("row-click", rowClickArg);
10728
+ };
10413
10729
  return () => createVNode("tbody", {
10414
10730
  "class": ns2.e("tbody")
10415
- }, [data.value.map((row, rowIndex) => {
10416
- const tableRow = () => {
10417
- return createVNode("tr", {
10418
- "key": rowIndex,
10419
- "class": {
10420
- "hover-enabled": hoverEnabled.value,
10421
- "expanded": table2.store.isRowExpanded(row)
10422
- }
10423
- }, [flatColumns.value.map((column, columnIndex) => {
10424
- var _a;
10425
- const cellId = `${rowIndex}-${columnIndex}`;
10426
- const [rowspan, colspan] = (_a = tableSpans.value[cellId]) != null ? _a : [1, 1];
10427
- if (removeCells.value.includes(cellId)) {
10428
- return null;
10429
- }
10430
- return createVNode(TD, {
10431
- "column": column,
10432
- "index": rowIndex,
10433
- "row": row,
10434
- "rowspan": rowspan,
10435
- "colspan": colspan,
10436
- "onClick": () => onCellClick({
10437
- rowIndex,
10438
- columnIndex,
10439
- column,
10440
- row
10441
- })
10442
- }, null);
10443
- })]);
10444
- };
10445
- const expandedRow = () => {
10446
- var _a, _b, _c, _d;
10447
- return flatColumns.value.some((column) => column.type === "expand") && createVNode("tr", null, [createVNode("td", {
10448
- "colspan": flatColumns.value.length
10449
- }, [(_d = (_c = (_b = (_a = flatColumns.value.filter((column) => column.type === "expand")) == null ? void 0 : _a[0]) == null ? void 0 : _b.slots) == null ? void 0 : _c.default) == null ? void 0 : _d.call(_c, {
10731
+ }, [flatRows.value.map((row, rowIndex) => {
10732
+ var _a, _b, _c, _d;
10733
+ return createVNode(Fragment, null, [createVNode("tr", {
10734
+ "key": rowIndex,
10735
+ "class": getTableRowClass(row),
10736
+ "onClick": () => onRowClick({
10450
10737
  row
10451
- })])]);
10452
- };
10453
- return createVNode(Fragment, null, [tableRow(), table2.store.isRowExpanded(row) && expandedRow()]);
10738
+ })
10739
+ }, [flatColumns.value.map((column2, columnIndex) => {
10740
+ var _a2;
10741
+ const cellId = `${rowIndex}-${columnIndex}`;
10742
+ const [rowspan, colspan] = (_a2 = tableSpans.value[cellId]) != null ? _a2 : [1, 1];
10743
+ if (removeCells.value.includes(cellId)) {
10744
+ return null;
10745
+ }
10746
+ return createVNode(TD, {
10747
+ "column": column2,
10748
+ "index": rowIndex,
10749
+ "row": row,
10750
+ "rowspan": rowspan,
10751
+ "colspan": colspan,
10752
+ "onCellClick": () => onCellClick({
10753
+ rowIndex,
10754
+ columnIndex,
10755
+ column: column2,
10756
+ row
10757
+ })
10758
+ }, null);
10759
+ })]), flatColumns.value.some((column2) => column2.type === "expand") && table2.store.isRowExpanded(row) && createVNode("tr", null, [createVNode("td", {
10760
+ "colspan": flatColumns.value.length
10761
+ }, [(_d = (_c = (_b = (_a = flatColumns.value.filter((column2) => column2.type === "expand")) == null ? void 0 : _a[0]) == null ? void 0 : _b.slots) == null ? void 0 : _c.default) == null ? void 0 : _d.call(_c, {
10762
+ row
10763
+ })])])]);
10454
10764
  })]);
10455
10765
  }
10456
10766
  });
@@ -10517,8 +10827,8 @@ var Table = defineComponent({
10517
10827
  directives: {
10518
10828
  dLoading: loadingDirective
10519
10829
  },
10520
- props: TableProps,
10521
- emits: ["sort-change", "cell-click", "check-change", "check-all-change", "expand-change"],
10830
+ props: tableProps,
10831
+ emits: ["sort-change", "cell-click", "row-click", "check-change", "check-all-change", "expand-change"],
10522
10832
  setup(props, ctx) {
10523
10833
  const table2 = getCurrentInstance();
10524
10834
  const store = createStore(toRef(props, "data"), table2);
@@ -10535,6 +10845,7 @@ var Table = defineComponent({
10535
10845
  classes,
10536
10846
  styles
10537
10847
  } = useTable(props, tableWidth);
10848
+ useTableWatcher(props, store);
10538
10849
  const isEmpty2 = computed(() => props.data.length === 0);
10539
10850
  const ns2 = useNamespace("table");
10540
10851
  const hiddenColumns = ref(null);
@@ -10547,6 +10858,8 @@ var Table = defineComponent({
10547
10858
  onMounted(async () => {
10548
10859
  await nextTick();
10549
10860
  store.updateColumns();
10861
+ store.updateFirstDefaultColumn();
10862
+ store.updateRows();
10550
10863
  updateColumnWidth();
10551
10864
  });
10552
10865
  return () => {
@@ -10650,45 +10963,86 @@ const tableColumnProps = {
10650
10963
  default: false
10651
10964
  }
10652
10965
  };
10653
- function formatWidth(width) {
10654
- if (width === "") {
10655
- return width;
10656
- }
10657
- if (typeof width === "number") {
10658
- return width;
10659
- }
10660
- return parseInt(width, 10) || 80;
10661
- }
10966
+ var column = "";
10967
+ const IconOpen = () => createVNode("svg", {
10968
+ "width": "16px",
10969
+ "height": "16px",
10970
+ "viewBox": "0 0 16 16",
10971
+ "version": "1.1",
10972
+ "xmlns": "http://www.w3.org/2000/svg",
10973
+ "class": "svg-icon svg-icon-close"
10974
+ }, [createVNode("g", {
10975
+ "stroke-width": "1",
10976
+ "fill": "none",
10977
+ "fill-rule": "evenodd"
10978
+ }, [createVNode("rect", {
10979
+ "x": "0.5",
10980
+ "y": "0.5",
10981
+ "width": "15",
10982
+ "height": "15",
10983
+ "rx": "2",
10984
+ "stroke": "#5e7ce0"
10985
+ }, null), createVNode("rect", {
10986
+ "x": "4",
10987
+ "y": "7",
10988
+ "width": "8",
10989
+ "height": "2",
10990
+ "fill": "#5e7ce0"
10991
+ }, null)])]);
10992
+ const IconClose = () => createVNode("svg", {
10993
+ "width": "16px",
10994
+ "height": "16px",
10995
+ "viewBox": "0 0 16 16",
10996
+ "version": "1.1",
10997
+ "xmlns": "http://www.w3.org/2000/svg",
10998
+ "class": "svg-icon"
10999
+ }, [createVNode("g", {
11000
+ "stroke": "none",
11001
+ "stroke-width": "1",
11002
+ "fill": "none",
11003
+ "fill-rule": "evenodd"
11004
+ }, [createVNode("rect", {
11005
+ "x": "0.5",
11006
+ "y": "0.5",
11007
+ "width": "15",
11008
+ "height": "15",
11009
+ "rx": "2",
11010
+ "stroke": "#252b3a"
11011
+ }, null), createVNode("path", {
11012
+ "fill": "#252b3a",
11013
+ "d": "M8.75,4 L8.75,7.25 L12,7.25 L12,8.75 L8.749,8.75 L8.75,12 L7.25,12 L7.249,8.75 L4,8.75 L4,7.25 L7.25,7.25 L7.25,4 L8.75,4 Z"
11014
+ }, null)])]);
11015
+ const ns = useNamespace("table");
10662
11016
  const cellMap = {
10663
11017
  checkable: {
10664
- renderHeader(column, store) {
11018
+ renderHeader(column2, store) {
10665
11019
  return h(Checkbox, {
10666
11020
  modelValue: store.states._checkAll.value,
10667
- halfchecked: store.states._halfChecked.value,
11021
+ halfChecked: store.states._halfChecked.value,
10668
11022
  onChange: (val) => {
10669
11023
  store.states._checkAll.value = val;
10670
- store._table.emit("check-all-change", val);
11024
+ store._table.emit("check-all-change", val, store.getCheckedRows());
10671
11025
  }
10672
11026
  });
10673
11027
  },
10674
- renderCell(rowData, column, store, rowIndex) {
11028
+ renderCell(rowData, column2, store, rowIndex) {
10675
11029
  return h(Checkbox, {
10676
- modelValue: store.isRowChecked(rowData),
11030
+ modelValue: store.isRowChecked(rowData, rowIndex),
10677
11031
  onChange: (val) => {
10678
- store.checkRow(val, rowData);
10679
- store._table.emit("check-change", val, store.states._data.value[rowIndex]);
11032
+ store.checkRow(val, rowData, rowIndex);
11033
+ store._table.emit("check-change", val, store.states._data.value[rowIndex], store.getCheckedRows());
10680
11034
  }
10681
11035
  });
10682
11036
  }
10683
11037
  },
10684
11038
  index: {
10685
- renderHeader(column) {
11039
+ renderHeader(column2) {
10686
11040
  var _a;
10687
11041
  return h("span", {
10688
11042
  class: "title"
10689
- }, (_a = column.header) != null ? _a : "#");
11043
+ }, (_a = column2.header) != null ? _a : "#");
10690
11044
  },
10691
- renderCell(rowData, column, store, rowIndex) {
11045
+ renderCell(rowData, column2, store, rowIndex) {
10692
11046
  return rowIndex + 1;
10693
11047
  }
10694
11048
  },
@@ -10696,31 +11050,109 @@ const cellMap = {
10696
11050
  renderHeader() {
10697
11051
  return createVNode("span", null, null);
10698
11052
  },
10699
- renderCell(rowData, column, store, rowIndex) {
11053
+ renderCell(rowData, column2, store) {
10700
11054
  return createVNode(Icon, {
10701
11055
  "name": "chevron-right",
10702
11056
  "class": "icon-expand-row",
10703
11057
  "onClick": () => {
10704
- store.toggleRow(rowData);
10705
- store._table.emit("expand-change", rowData, store.getExpandedRows());
11058
+ store.toggleRowExpansion(rowData);
10706
11059
  }
10707
11060
  }, null);
10708
11061
  }
10709
11062
  },
10710
- default: {
10711
- renderHeader(column) {
11063
+ editable: {
11064
+ renderHeader(column2) {
10712
11065
  var _a;
10713
11066
  return h("span", {
10714
11067
  class: "title"
10715
- }, (_a = column.header) != null ? _a : "");
11068
+ }, (_a = column2.header) != null ? _a : "");
10716
11069
  },
10717
- renderCell(rowData, column, store, rowIndex) {
11070
+ renderCell(rowData, column2, store, rowIndex, props, cellMode, ctx) {
10718
11071
  var _a, _b;
10719
- const value = column.field ? rowData[column.field] : "";
10720
- if (column.formatter) {
10721
- return column.formatter(rowData, column, value, rowIndex);
11072
+ let columnValue;
11073
+ if (cellMode.value === "edit") {
11074
+ columnValue = ctx.slots.cellEdit ? ctx.slots.cellEdit({
11075
+ row: rowData,
11076
+ rowIndex
11077
+ }) : "";
11078
+ } else {
11079
+ if (ctx.slots.cell) {
11080
+ columnValue = createVNode("div", {
11081
+ "class": "cell-text"
11082
+ }, [ctx.slots.cell({
11083
+ row: rowData,
11084
+ rowIndex
11085
+ })]);
11086
+ } else {
11087
+ const value = column2.field ? rowData[column2.field] : "";
11088
+ if (column2.formatter) {
11089
+ columnValue = column2.formatter(rowData, column2, value, rowIndex);
11090
+ }
11091
+ columnValue = createVNode("div", {
11092
+ "class": "cell-text"
11093
+ }, [(_b = (_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) != null ? _b : ""]);
11094
+ }
10722
11095
  }
10723
- return (_b = (_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) != null ? _b : "";
11096
+ return h("div", {
11097
+ class: [ns.e("cell"), column2.type === "editable" && (cellMode == null ? void 0 : cellMode.value) === "readonly" && "editable-cell"]
11098
+ }, columnValue);
11099
+ }
11100
+ },
11101
+ default: {
11102
+ renderHeader(column2) {
11103
+ var _a;
11104
+ return h("span", {
11105
+ class: "title"
11106
+ }, (_a = column2.header) != null ? _a : "");
11107
+ },
11108
+ renderCell(rowData, column2, store, rowIndex, props, cellMode, ctx) {
11109
+ var _a, _b, _c;
11110
+ let columnValue;
11111
+ if (ctx.slots.default) {
11112
+ columnValue = ctx.slots.default({
11113
+ row: rowData,
11114
+ rowIndex
11115
+ });
11116
+ } else {
11117
+ const value = column2.field ? rowData[column2.field] : "";
11118
+ if (column2.formatter) {
11119
+ columnValue = column2.formatter(rowData, column2, value, rowIndex);
11120
+ }
11121
+ columnValue = (_b = (_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) != null ? _b : "";
11122
+ }
11123
+ const hasExpandColumn = store.states.flatColumns.value.some((column22) => column22.type === "expand");
11124
+ const hasChildren = store.states._data.value.some((row) => {
11125
+ var _a2;
11126
+ return (_a2 = row.children) == null ? void 0 : _a2.length;
11127
+ });
11128
+ const level = store.states.rowLevelMap.value[getRowIdentity(rowData, props.rowKey)] || 0;
11129
+ const indentDom = h("span", {
11130
+ class: `${ns.e("indent")}`,
11131
+ style: {
11132
+ paddingLeft: `${level * props.indent}px`
11133
+ }
11134
+ }, "");
11135
+ const isTreeCell = store.states.firstDefaultColumn.value === column2.id;
11136
+ const showIndentDom = isTreeCell && level;
11137
+ const showExpendIconDom = isTreeCell && ((_c = rowData.children) == null ? void 0 : _c.length);
11138
+ const expendIconDom = createVNode("span", {
11139
+ "class": ns.e("tree-operate"),
11140
+ "onClick": () => {
11141
+ store.toggleRowExpansion(rowData);
11142
+ },
11143
+ "style": showExpendIconDom ? "" : "visibility: hidden;"
11144
+ }, [store.isRowExpanded(rowData) ? createVNode(IconOpen, null, null) : createVNode(IconClose, null, null)]);
11145
+ const cellDom = [];
11146
+ if (showIndentDom) {
11147
+ cellDom.push(indentDom);
11148
+ }
11149
+ if (hasChildren && !hasExpandColumn && isTreeCell) {
11150
+ cellDom.push(expendIconDom);
11151
+ }
11152
+ cellDom.push(columnValue);
11153
+ return h("div", {
11154
+ class: `${ns.e("cell")} `
11155
+ }, cellDom);
10724
11156
  }
10725
11157
  }
10726
11158
  };
@@ -10746,64 +11178,65 @@ function createColumn(id, props, ctx) {
10746
11178
  showOverflowTooltip,
10747
11179
  resizeable
10748
11180
  } = props;
10749
- const column = reactive({ id });
10750
- column.type = type4.value;
11181
+ const column2 = reactive({ id });
11182
+ column2.type = type4.value;
10751
11183
  function renderHeader(columnItem, store) {
10752
11184
  if (ctx.slots.header) {
10753
11185
  return ctx.slots.header(columnItem);
10754
11186
  }
10755
11187
  return cellMap[type4.value || "default"].renderHeader(columnItem, store);
10756
11188
  }
10757
- function renderCell(rowData, columnItem, store, rowIndex) {
10758
- if (ctx.slots.default && columnItem.type !== "expand") {
11189
+ function renderCell(rowData, columnItem, store, rowIndex, tableProps2, cellMode) {
11190
+ if (ctx.slots.default && columnItem.type === "index") {
10759
11191
  return ctx.slots.default({ row: rowData, rowIndex });
10760
11192
  }
10761
- return cellMap[type4.value || "default"].renderCell(rowData, columnItem, store, rowIndex);
11193
+ return cellMap[type4.value || "default"].renderCell(rowData, columnItem, store, rowIndex, tableProps2, cellMode, ctx);
10762
11194
  }
10763
11195
  watch([field, header2, order], ([fieldVal, headerVal, orderVal]) => {
10764
- column.field = fieldVal;
10765
- column.header = headerVal;
10766
- column.order = orderVal;
11196
+ column2.field = fieldVal;
11197
+ column2.header = headerVal;
11198
+ column2.order = orderVal;
10767
11199
  }, { immediate: true });
10768
11200
  watch([sortable, sortDirection, sortMethod], ([sortableVal, sortDirectionVal, sortMethodVal]) => {
10769
- column.sortable = sortableVal;
10770
- column.sortDirection = sortDirectionVal;
10771
- column.sortMethod = sortMethodVal;
11201
+ column2.sortable = sortableVal;
11202
+ column2.sortDirection = sortDirectionVal;
11203
+ column2.sortMethod = sortMethodVal;
10772
11204
  }, { immediate: true });
10773
11205
  watch([filterable, filterList, filterMultiple], ([filterableVal, filterListVal, filterMultipleVal]) => {
10774
- column.filterable = filterableVal;
10775
- column.filterMultiple = filterMultipleVal;
10776
- column.filterList = filterListVal;
11206
+ column2.filterable = filterableVal;
11207
+ column2.filterMultiple = filterMultipleVal;
11208
+ column2.filterList = filterListVal;
10777
11209
  }, { immediate: true });
10778
11210
  watch([fixedLeft, fixedRight], ([left, right]) => {
10779
- column.fixedLeft = left;
10780
- column.fixedRight = right;
11211
+ column2.fixedLeft = left;
11212
+ column2.fixedRight = right;
10781
11213
  }, { immediate: true });
10782
11214
  watch(align, (alignVal) => {
10783
- column.align = alignVal;
11215
+ column2.align = alignVal;
10784
11216
  }, { immediate: true });
10785
11217
  watch(showOverflowTooltip, (showVal) => {
10786
- column.showOverflowTooltip = showVal;
11218
+ column2.showOverflowTooltip = showVal;
10787
11219
  }, { immediate: true });
10788
11220
  watch(resizeable, (resizeVal) => {
10789
- column.resizeable = resizeVal;
11221
+ column2.resizeable = resizeVal;
10790
11222
  }, { immediate: true });
10791
11223
  watch([width, minWidth, maxWidth], ([widthVal, minWidthVal, maxWidthVal]) => {
10792
- column.width = formatWidth(widthVal);
10793
- column.minWidth = minWidthVal;
10794
- column.maxWidth = maxWidthVal;
10795
- column.realWidth = column.width;
11224
+ column2.width = formatWidth(widthVal);
11225
+ column2.minWidth = minWidthVal;
11226
+ column2.maxWidth = maxWidthVal;
11227
+ column2.realWidth = column2.width;
10796
11228
  }, { immediate: true });
10797
11229
  onBeforeMount(() => {
10798
- column.id = id;
10799
- column.renderHeader = renderHeader;
10800
- column.renderCell = renderCell;
10801
- column.formatter = formatter == null ? void 0 : formatter.value;
10802
- column.customFilterTemplate = ctx.slots.customFilterTemplate;
10803
- column.subColumns = ctx.slots.subColumns;
10804
- column.slots = ctx.slots;
11230
+ column2.id = id;
11231
+ column2.renderHeader = renderHeader;
11232
+ column2.renderCell = renderCell;
11233
+ column2.formatter = formatter == null ? void 0 : formatter.value;
11234
+ column2.customFilterTemplate = ctx.slots.customFilterTemplate;
11235
+ column2.subColumns = ctx.slots.subColumns;
11236
+ column2.slots = ctx.slots;
11237
+ column2.ctx = ctx;
10805
11238
  });
10806
- return column;
11239
+ return column2;
10807
11240
  }
10808
11241
  function useRender() {
10809
11242
  const instance = getCurrentInstance();
@@ -10825,7 +11258,6 @@ var Column = defineComponent({
10825
11258
  props: tableColumnProps,
10826
11259
  emits: ["filter-change", "resize-start", "resizing", "resize-end"],
10827
11260
  setup(props, ctx) {
10828
- toRefs(props);
10829
11261
  const owner = inject(TABLE_TOKEN);
10830
11262
  const isSubColumn = ref(false);
10831
11263
  const {
@@ -10835,16 +11267,16 @@ var Column = defineComponent({
10835
11267
  const parent = columnOrTableParent.value;
10836
11268
  const instance = getCurrentInstance();
10837
11269
  instance.columnId = `${parent.tableId || parent.columnId}_column_${columnIdInit++}`;
10838
- const column = createColumn(instance.columnId, toRefs(props), ctx);
10839
- instance.columnConfig = column;
11270
+ const column2 = createColumn(instance.columnId, toRefs(props), ctx);
11271
+ instance.columnConfig = column2;
10840
11272
  onBeforeMount(() => {
10841
11273
  isSubColumn.value = owner !== parent;
10842
11274
  });
10843
11275
  onMounted(() => {
10844
- var _a;
10845
- const children = isSubColumn.value ? parent.vnode.el.children : (_a = owner == null ? void 0 : owner.hiddenColumns.value) == null ? void 0 : _a.children;
11276
+ var _a, _b, _c;
11277
+ const children = isSubColumn.value ? (_b = (_a = parent == null ? void 0 : parent.vnode) == null ? void 0 : _a.el) == null ? void 0 : _b.children : (_c = owner == null ? void 0 : owner.hiddenColumns.value) == null ? void 0 : _c.children;
10846
11278
  const columnIndex = getColumnIndex(children || [], instance.vnode.el);
10847
- columnIndex > -1 && (owner == null ? void 0 : owner.store.insertColumn(column, isSubColumn.value ? parent.columnConfig : null));
11279
+ columnIndex > -1 && (owner == null ? void 0 : owner.store.insertColumn(column2, isSubColumn.value ? parent.columnConfig : null));
10848
11280
  if (typeof props.checkable === "function") {
10849
11281
  for (const [rowIndex, row] of owner == null ? void 0 : owner.store.states._data.value.entries()) {
10850
11282
  if (props.checkable(row, rowIndex)) {
@@ -10853,11 +11285,11 @@ var Column = defineComponent({
10853
11285
  }
10854
11286
  }
10855
11287
  });
10856
- watch(() => column.order, () => {
11288
+ watch(() => column2.order, () => {
10857
11289
  owner == null ? void 0 : owner.store.sortColumn();
10858
11290
  });
10859
11291
  onBeforeUnmount(() => {
10860
- owner == null ? void 0 : owner.store.removeColumn(column);
11292
+ owner == null ? void 0 : owner.store.removeColumn(column2);
10861
11293
  });
10862
11294
  return () => {
10863
11295
  var _a, _b;
@@ -10866,17 +11298,17 @@ var Column = defineComponent({
10866
11298
  column: {},
10867
11299
  $index: -1
10868
11300
  });
10869
- return createVNode("div", null, [Array.isArray(defaultSlot) ? defaultSlot.filter((child) => child.type.name === "DColumn").map((child) => createVNode(Fragment, null, [child])) : createVNode("div", null, null)]);
11301
+ return createVNode("div", null, [defaultSlot && Array.isArray(defaultSlot) ? defaultSlot.filter((child) => child.type.name === "DColumn").map((child) => createVNode(Fragment, null, [child])) : createVNode("div", null, null)]);
10870
11302
  };
10871
11303
  }
10872
11304
  });
10873
11305
  var index = {
10874
11306
  title: "Table \u8868\u683C",
10875
11307
  category: "\u6570\u636E\u5C55\u793A",
10876
- status: "20%",
11308
+ status: "50%",
10877
11309
  install(app) {
10878
11310
  app.component(Table.name, Table);
10879
11311
  app.component(Column.name, Column);
10880
11312
  }
10881
11313
  };
10882
- export { Column, Table, index as default };
11314
+ export { Column, TABLE_TOKEN, Table, index as default, tableProps };