@dt-frames/ui 2.0.15 → 2.0.17

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 (99) hide show
  1. package/es/assets/imgs/tree/forder-open.svg +1 -0
  2. package/es/assets/imgs/tree/forder.svg +1 -0
  3. package/es/assets/locales/zh.ts +1 -1
  4. package/es/components/curd/index.js +28 -8
  5. package/es/components/curd/src/components/Curd.d.ts +10 -0
  6. package/es/components/curd/src/hooks/useCurd.d.ts +2 -4
  7. package/es/components/curd/src/props.d.ts +5 -1
  8. package/es/components/drawer/index.js +25 -24
  9. package/es/components/form/index.js +75 -40
  10. package/es/components/form/index.less +16 -0
  11. package/es/components/form/src/props.d.ts +3 -3
  12. package/es/components/modal/index.js +8 -143
  13. package/es/components/modal/index.less +23 -0
  14. package/es/components/modal/src/index.d.ts +2 -84
  15. package/es/components/table/index.js +61 -134
  16. package/es/components/table/index.less +25 -0
  17. package/es/components/table/src/components/editTable/EditTableCell.d.ts +1 -0
  18. package/es/components/table/src/index.d.ts +0 -10
  19. package/es/components/table/src/props.d.ts +0 -4
  20. package/es/components/table/src/types/table.type.d.ts +8 -0
  21. package/es/components/tree/index.js +203 -89
  22. package/es/components/tree/index.less +88 -13
  23. package/es/components/tree/src/basicProps.d.ts +55 -11
  24. package/es/components/tree/src/components/ContextMenu.d.ts +6 -0
  25. package/es/components/tree/src/components/TreeHeader.d.ts +2 -2
  26. package/es/components/tree/src/hooks/useTree.d.ts +3 -2
  27. package/es/components/tree/src/index.d.ts +131 -40
  28. package/es/components/tree/src/type/menu.d.ts +3 -0
  29. package/es/components/tree/src/type/tree.d.ts +0 -1
  30. package/es/components/upload/index.js +112 -65
  31. package/es/components/upload/index.less +17 -1
  32. package/es/components/upload/src/components/WordView.d.ts +1 -0
  33. package/es/components/upload/src/index.d.ts +2 -1
  34. package/es/components/upload/src/utils/upload.d.ts +1 -1
  35. package/es/theme/index.js +314 -309
  36. package/es/theme/index.less +1 -0
  37. package/es/theme/src/components/header/components/size.d.ts +5 -5
  38. package/es/theme/src/components/header/index.d.ts +5 -5
  39. package/es/theme/src/components/header/multiple-header.d.ts +5 -5
  40. package/es/theme/src/index.d.ts +10 -10
  41. package/manualContentPath.js +10 -0
  42. package/package.json +1 -1
  43. package/tsconfig.json +1 -1
  44. package/es/packages/ui/src/assets/locales/en.d.ts +0 -103
  45. package/es/packages/ui/src/assets/locales/index.d.ts +0 -2
  46. package/es/packages/ui/src/assets/locales/zh.d.ts +0 -104
  47. package/es/packages/ui/src/components/form/index.d.ts +0 -7
  48. package/es/packages/ui/src/components/form/src/components/FormButtons.d.ts +0 -105
  49. package/es/packages/ui/src/components/form/src/components/FormItem.d.ts +0 -159
  50. package/es/packages/ui/src/components/form/src/components/componentMap.d.ts +0 -4
  51. package/es/packages/ui/src/components/form/src/components/formIcon.d.ts +0 -1223
  52. package/es/packages/ui/src/components/form/src/components/formInputUseDialog.d.ts +0 -911
  53. package/es/packages/ui/src/components/form/src/components/index.d.ts +0 -4
  54. package/es/packages/ui/src/components/form/src/components/radioButton.d.ts +0 -34
  55. package/es/packages/ui/src/components/form/src/enums/index.d.ts +0 -7
  56. package/es/packages/ui/src/components/form/src/hooks/helper.d.ts +0 -14
  57. package/es/packages/ui/src/components/form/src/hooks/useForm.d.ts +0 -6
  58. package/es/packages/ui/src/components/form/src/hooks/useFormActions.d.ts +0 -12
  59. package/es/packages/ui/src/components/form/src/hooks/useFormEvent.d.ts +0 -25
  60. package/es/packages/ui/src/components/form/src/hooks/useFormValue.d.ts +0 -3
  61. package/es/packages/ui/src/components/form/src/hooks/useFormValues.d.ts +0 -11
  62. package/es/packages/ui/src/components/form/src/hooks/useLabelWidth.d.ts +0 -6
  63. package/es/packages/ui/src/components/form/src/props.d.ts +0 -127
  64. package/es/packages/ui/src/components/form/src/types/actions.type.d.ts +0 -15
  65. package/es/packages/ui/src/components/form/src/types/form.type.d.ts +0 -79
  66. package/es/packages/ui/src/components/form/src/types/items.type.d.ts +0 -409
  67. package/es/packages/ui/src/components/iframe/index.d.ts +0 -2
  68. package/es/packages/ui/src/components/modal/index.d.ts +0 -4
  69. package/es/packages/ui/src/components/modal/src/hooks/useModal.d.ts +0 -5
  70. package/es/packages/ui/src/components/modal/src/props.d.ts +0 -101
  71. package/es/packages/ui/src/components/modal/src/types/modal.type.d.ts +0 -17
  72. package/es/packages/ui/src/components/upload/index.d.ts +0 -4
  73. package/es/packages/ui/src/components/upload/src/basicProps.d.ts +0 -87
  74. package/es/packages/ui/src/components/upload/src/components/PdfView.d.ts +0 -9
  75. package/es/packages/ui/src/components/upload/src/components/WordView.d.ts +0 -6
  76. package/es/packages/ui/src/components/upload/src/hooks/useFile.d.ts +0 -16
  77. package/es/packages/ui/src/components/upload/src/index.d.ts +0 -242
  78. package/es/packages/ui/src/components/upload/src/type/file.d.ts +0 -10
  79. package/es/packages/ui/src/components/upload/src/utils/upload.d.ts +0 -2
  80. package/es/packages/ui/src/global.d.ts +0 -7
  81. package/es/packages/ui/src/theme/index.d.ts +0 -12
  82. package/es/packages/ui/src/theme/src/components/header/helper/menu-tree.d.ts +0 -4
  83. package/es/packages/ui/src/theme/src/enums/index.d.ts +0 -1
  84. package/es/packages/ui/src/theme/src/enums/theme.enum.d.ts +0 -34
  85. package/es/packages/ui/src/theme/src/hooks/index.d.ts +0 -6
  86. package/es/packages/ui/src/theme/src/hooks/useDragLine.d.ts +0 -2
  87. package/es/packages/ui/src/theme/src/hooks/useHeader.d.ts +0 -25
  88. package/es/packages/ui/src/theme/src/hooks/useMenu.d.ts +0 -29
  89. package/es/packages/ui/src/theme/src/hooks/useMultifyTab.d.ts +0 -8
  90. package/es/packages/ui/src/theme/src/hooks/useOpenKeys.d.ts +0 -7
  91. package/es/packages/ui/src/theme/src/hooks/useTheme.d.ts +0 -9
  92. package/es/packages/ui/src/theme/src/setting/theme.setting.d.ts +0 -2
  93. package/es/packages/ui/src/theme/src/stores/index.d.ts +0 -3
  94. package/es/packages/ui/src/theme/src/stores/routeReuse.store.d.ts +0 -25
  95. package/es/packages/ui/src/theme/src/stores/theme.store.d.ts +0 -19
  96. package/es/packages/ui/src/theme/src/types/index.d.ts +0 -3
  97. package/es/packages/ui/src/theme/src/types/menu.type.d.ts +0 -15
  98. package/es/packages/ui/src/theme/src/types/theme.type.d.ts +0 -62
  99. package/es/packages/ui/src/utils/withInstall.d.ts +0 -4
@@ -27,6 +27,27 @@
27
27
 
28
28
  .ant-table-empty {
29
29
  border-bottom: 1px solid #f0f0f0;
30
+ .ant-table-cell {
31
+ border: none;
32
+ }
33
+ }
34
+
35
+ .ant-spin-nested-loading, .ant-spin-container {
36
+ height: 100%;
37
+ }
38
+
39
+ .ant-spin-container, .ant-table-container, .ant-table {
40
+ flex: 1;
41
+ display: flex;
42
+ flex-direction: column;
43
+ }
44
+
45
+ .ant-table, .ant-table-container {
46
+ height: 0;
47
+ }
48
+
49
+ .ant-table-body {
50
+ flex: 1;
30
51
  }
31
52
 
32
53
  .dt-pagination{
@@ -108,6 +129,10 @@
108
129
  }
109
130
  }
110
131
  }
132
+
133
+ .primary-color{
134
+ color: @primary-color;
135
+ }
111
136
  }
112
137
 
113
138
  .ant-table{
@@ -62,6 +62,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
62
62
  handleChange: (e: any) => Promise<void>;
63
63
  handleSubmitRule: () => Promise<boolean>;
64
64
  handleOptionsChange: (options: LableValOptions) => void;
65
+ readonly omit: any;
65
66
  readonly CellComponent: import("vue").FunctionalComponent<{}, {}>;
66
67
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
67
68
  value: {
@@ -91,10 +91,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
91
91
  type: BooleanConstructor;
92
92
  default: boolean;
93
93
  };
94
- canResize: {
95
- type: BooleanConstructor;
96
- default: boolean;
97
- };
98
94
  pagination: {
99
95
  type: import("vue").PropType<Boolean | import("./types/table.type").PaginationProps>;
100
96
  default: any;
@@ -313,7 +309,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
313
309
  showCheckboxColumn: boolean;
314
310
  expandActions: boolean;
315
311
  ellipsis: boolean;
316
- canResize: boolean;
317
312
  onTableChange: Function;
318
313
  onDownload: Function;
319
314
  indexColumnProps: import("./types/table.type").BasicColumn[];
@@ -494,10 +489,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
494
489
  type: BooleanConstructor;
495
490
  default: boolean;
496
491
  };
497
- canResize: {
498
- type: BooleanConstructor;
499
- default: boolean;
500
- };
501
492
  pagination: {
502
493
  type: import("vue").PropType<Boolean | import("./types/table.type").PaginationProps>;
503
494
  default: any;
@@ -611,7 +602,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
611
602
  ellipsis: boolean;
612
603
  dataSource: import("@dt-frames/core").Recordable<any>[];
613
604
  bordered: boolean;
614
- canResize: boolean;
615
605
  pagination: any;
616
606
  loading: boolean;
617
607
  scroll: {};
@@ -95,10 +95,6 @@ export declare const TableProps: {
95
95
  type: BooleanConstructor;
96
96
  default: boolean;
97
97
  };
98
- canResize: {
99
- type: BooleanConstructor;
100
- default: boolean;
101
- };
102
98
  pagination: {
103
99
  type: PropType<Boolean | PaginationProps>;
104
100
  default: any;
@@ -20,6 +20,14 @@ export declare type CellFormat = ((record: Recordable, index: Number, text: stri
20
20
  date: string;
21
21
  } | {
22
22
  percent: string;
23
+ } | {
24
+ tag: (row: Recordable) => {
25
+ color: string;
26
+ text: string | number;
27
+ };
28
+ } | {
29
+ link: (row: Recordable, index: number) => void;
30
+ text?: any;
23
31
  } | {
24
32
  [key: string]: Recordable;
25
33
  } | VNode | JSX.Element;
@@ -1,15 +1,16 @@
1
- import { InputSearch, MenuItem, MenuDivider, Menu, Dropdown, Tree, Empty, Spin } from "ant-design-vue/es";
1
+ import { Input, MenuItem, MenuDivider, Menu, Dropdown, Tree, Empty, Spin } from "ant-design-vue/es";
2
2
  import "ant-design-vue/es/spin/style";
3
3
  import "ant-design-vue/es/empty/style";
4
4
  import "ant-design-vue/es/tree/style";
5
- import { unref, defineComponent, useSlots, ref, computed, watch, openBlock, createElementBlock, renderSlot, createCommentVNode, toDisplayString, createVNode, createBlock, withModifiers, withCtx, Fragment, renderList, normalizeProps, guardReactiveProps, createTextVNode, createElementVNode, onMounted, onUnmounted, isVNode, getCurrentInstance, render, useAttrs, reactive, toRaw, watchEffect, withDirectives, mergeProps, vShow } from "vue";
6
- import { useI18n, useSlots as useSlots$1, isArray, isFunction, isEmpty, isBoolean } from "@dt-frames/core";
7
- import { cloneDeep, difference, omit, get } from "lodash-es";
5
+ import { unref, defineComponent, useSlots, ref, computed, watch, openBlock, createElementBlock, toDisplayString, createCommentVNode, renderSlot, createVNode, createBlock, withModifiers, withCtx, Fragment, renderList, normalizeProps, guardReactiveProps, createTextVNode, createElementVNode, onMounted, nextTick, onUnmounted, isVNode, getCurrentInstance, render as render$2, useAttrs, reactive, toRaw, watchEffect, normalizeClass, createSlots, withDirectives, mergeProps, vShow } from "vue";
6
+ import { useI18n, useSlots as useSlots$1, isEmpty, isBoolean, isArray, isFunction } from "@dt-frames/core";
7
+ import { cloneDeep, get, difference, omit } from "lodash-es";
8
8
  import "ant-design-vue/es/dropdown/style";
9
9
  import "ant-design-vue/es/menu/style";
10
10
  import "ant-design-vue/es/input/style";
11
11
  import { useDebounceFn } from "@vueuse/core";
12
12
  import { Menu as Menu$1, Divider } from "ant-design-vue";
13
+ import { useHeader } from "../../theme";
13
14
  const BasicProps = {
14
15
  defaultExpandLevel: {
15
16
  type: String
@@ -17,10 +18,51 @@ const BasicProps = {
17
18
  defaultExpandAll: {
18
19
  type: Boolean
19
20
  },
21
+ height: {
22
+ type: [Number, String]
23
+ },
20
24
  showIcon: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ blockNode: {
21
29
  type: Boolean,
22
30
  default: true
23
31
  },
32
+ fieldNames: {
33
+ type: Object,
34
+ default: {
35
+ children: "children",
36
+ title: "title",
37
+ key: "key"
38
+ }
39
+ },
40
+ disabled: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ draggable: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ filterTreeNode: {
49
+ type: Function
50
+ },
51
+ multiple: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ selectable: {
56
+ type: Boolean,
57
+ default: false
58
+ },
59
+ showLine: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ activeKey: {
64
+ type: [String, Number]
65
+ },
24
66
  loading: {
25
67
  type: Boolean,
26
68
  default: false
@@ -41,9 +83,6 @@ const BasicProps = {
41
83
  type: Array,
42
84
  default: () => []
43
85
  },
44
- fieldNames: {
45
- type: Object
46
- },
47
86
  beforeRightClick: {
48
87
  type: Function,
49
88
  default: void 0
@@ -58,9 +97,8 @@ const BasicProps = {
58
97
  type: [Boolean, String],
59
98
  default: false
60
99
  },
61
- actionList: {
62
- type: Array,
63
- default: () => []
100
+ action: {
101
+ type: Function
64
102
  },
65
103
  clickRowToExpand: {
66
104
  type: Boolean,
@@ -74,10 +112,14 @@ const BasicProps = {
74
112
  type: Function,
75
113
  default: void 0
76
114
  },
77
- checkable: Boolean,
78
- expandOnSearch: Boolean,
79
- checkOnSearch: Boolean,
80
- selectedOnSearch: Boolean,
115
+ checkable: {
116
+ type: Boolean,
117
+ default: false
118
+ },
119
+ expandOnSearch: {
120
+ type: Boolean,
121
+ default: true
122
+ },
81
123
  treeData: {
82
124
  type: Array
83
125
  },
@@ -127,7 +169,7 @@ const searchProps = {
127
169
  const rightMenuProps = {
128
170
  width: {
129
171
  type: Number,
130
- default: 156
172
+ default: 106
131
173
  },
132
174
  customEvent: {
133
175
  type: Object,
@@ -149,13 +191,16 @@ const rightMenuProps = {
149
191
  items: {
150
192
  type: Array,
151
193
  default: () => []
194
+ },
195
+ node: {
196
+ type: Object
152
197
  }
153
198
  };
154
- function eachTree(treeDatas, callBack, parentNode = {}) {
199
+ function eachTree(treeDatas, callBack, parentNode = {}, config = { children: "children" }) {
155
200
  treeDatas.forEach((el) => {
156
201
  const newNode = callBack(el, parentNode) || el;
157
- if (el.children) {
158
- eachTree(el.children, callBack, newNode);
202
+ if (el[config.children]) {
203
+ eachTree(el[config.children], callBack, newNode);
159
204
  }
160
205
  });
161
206
  }
@@ -189,7 +234,7 @@ function treeToList(tree, config = {}) {
189
234
  }
190
235
  return result;
191
236
  }
192
- function useTree(treeDataRef, getFieldNames) {
237
+ function useTree(treeDataRef, getFieldNames, emit) {
193
238
  function getAllKeys(list) {
194
239
  const keys = [];
195
240
  const treeData = list || unref(treeDataRef);
@@ -345,6 +390,7 @@ function useTree(treeDataRef, getFieldNames) {
345
390
  if (!key && key !== 0)
346
391
  return null;
347
392
  const treeData = list || unref(treeDataRef);
393
+ const { children: childrenField } = unref(getFieldNames);
348
394
  treeData.forEach((item) => {
349
395
  if (selectedNode?.key || selectedNode?.key === 0)
350
396
  return selectedNode;
@@ -352,12 +398,54 @@ function useTree(treeDataRef, getFieldNames) {
352
398
  selectedNode = item;
353
399
  return;
354
400
  }
355
- if (item.children && item.children.length) {
356
- selectedNode = getSelectedNode(key, item.children, selectedNode);
401
+ if (item[childrenField] && item[childrenField].length) {
402
+ selectedNode = getSelectedNode(key, item[childrenField], selectedNode);
357
403
  }
358
404
  });
359
405
  return selectedNode || null;
360
406
  }
407
+ function onDrop(info) {
408
+ const dropKey = info.node.key;
409
+ const dragKey = info.dragNode.key;
410
+ const dropPos = info.node.pos.split("-");
411
+ const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);
412
+ const { children: childrenField } = unref(getFieldNames);
413
+ const loop = (data2, key, callback) => {
414
+ data2.forEach((item, index2) => {
415
+ if (item.key === key)
416
+ return callback(item, index2, data2);
417
+ if (item[childrenField])
418
+ return loop(item[childrenField], key, callback);
419
+ });
420
+ };
421
+ const data = [...treeDataRef.value];
422
+ let dragObj;
423
+ loop(data, dragKey, (item, index2, arr) => {
424
+ arr.splice(index2, 1);
425
+ dragObj = item;
426
+ });
427
+ if (!info.dropToGap) {
428
+ loop(data, dropKey, (item) => {
429
+ item[childrenField] = item[childrenField] || [];
430
+ item[childrenField].unshift(dragObj);
431
+ });
432
+ } else if ((info.node.children || []).length > 0 && info.node.expanded && dropPosition === 1) {
433
+ loop(data, dropKey, (item) => {
434
+ item[childrenField] = item[childrenField] || [];
435
+ item[childrenField].unshift(dragObj);
436
+ });
437
+ } else {
438
+ let ar = [];
439
+ let i = 0;
440
+ loop(data, dropKey, (_item, index2, arr) => {
441
+ ar = arr;
442
+ i = index2;
443
+ });
444
+ dropPosition === -1 ? ar.splice(i, 0, dragObj) : ar.splice(i + 1, 0, dragObj);
445
+ }
446
+ emit("drop", { data, info });
447
+ treeDataRef.value = data;
448
+ }
361
449
  return {
362
450
  getAllKeys,
363
451
  getEnabledKeys,
@@ -367,7 +455,8 @@ function useTree(treeDataRef, getFieldNames) {
367
455
  insertNodeByKey,
368
456
  insertNodesByKey,
369
457
  deleteNodeByKey,
370
- getSelectedNode
458
+ getSelectedNode,
459
+ onDrop
371
460
  };
372
461
  }
373
462
  var ToolbarEnum = /* @__PURE__ */ ((ToolbarEnum2) => {
@@ -377,20 +466,20 @@ var ToolbarEnum = /* @__PURE__ */ ((ToolbarEnum2) => {
377
466
  ToolbarEnum2[ToolbarEnum2["UN_EXPAND_ALL"] = 3] = "UN_EXPAND_ALL";
378
467
  return ToolbarEnum2;
379
468
  })(ToolbarEnum || {});
380
- const _hoisted_1$1 = { class: "dt-tree-header flex px-2 py-1.5 items-center" };
381
- const _hoisted_2 = {
382
- key: 1,
469
+ const _hoisted_1$2 = { class: "dt-tree-header flex px-2 py-1.5 items-center" };
470
+ const _hoisted_2$2 = {
471
+ key: 0,
383
472
  class: "text-center leading-8 m-0"
384
473
  };
385
- const _hoisted_3 = {
386
- key: 2,
474
+ const _hoisted_3$2 = {
475
+ key: 1,
387
476
  class: "dt-tree-search flex flex-1 items-center"
388
477
  };
389
478
  const _hoisted_4 = {
390
479
  key: 0,
391
- class: "flex-1"
480
+ class: "flex-1 flex items-center"
392
481
  };
393
- const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "i ic:baseline-more-vert text-center cursor-pointer" }, null, -1);
482
+ const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "i ic:baseline-format-list-bulleted text-right cursor-pointer toolbar" }, null, -1);
394
483
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
395
484
  __name: "TreeHeader",
396
485
  props: searchProps,
@@ -449,23 +538,24 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
449
538
  }
450
539
  );
451
540
  return (_ctx, _cache) => {
452
- const _component_AInputSearch = InputSearch;
541
+ const _component_AInput = Input;
453
542
  const _component_AMenuItem = MenuItem;
454
543
  const _component_AMenuDivider = MenuDivider;
455
544
  const _component_AMenu = Menu;
456
545
  const _component_ADropdown = Dropdown;
457
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
458
- unref(slots).headerTitle ? renderSlot(_ctx.$slots, "headerTitle", { key: 0 }) : createCommentVNode("v-if", true),
459
- !unref(slots).headerTitle && _ctx.title ? (openBlock(), createElementBlock("h4", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("v-if", true),
460
- _ctx.search || _ctx.toolbar ? (openBlock(), createElementBlock("div", _hoisted_3, [
546
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
547
+ _ctx.title ? (openBlock(), createElementBlock("h4", _hoisted_2$2, toDisplayString(_ctx.title), 1)) : createCommentVNode("v-if", true),
548
+ _ctx.search || _ctx.toolbar ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
461
549
  _ctx.search ? (openBlock(), createElementBlock("div", _hoisted_4, [
462
- createVNode(_component_AInputSearch, {
550
+ unref(slots).addonBefore ? renderSlot(_ctx.$slots, "addonBefore", { key: 0 }) : createCommentVNode("v-if", true),
551
+ createVNode(_component_AInput, {
463
552
  size: "small",
464
553
  allowClear: "",
465
554
  value: searchValue.value,
466
555
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
467
556
  placeholder: unref(t)("FILTER")
468
- }, null, 8, ["value", "placeholder"])
557
+ }, null, 8, ["value", "placeholder"]),
558
+ unref(slots).addonAfter ? renderSlot(_ctx.$slots, "addonAfter", { key: 1 }) : createCommentVNode("v-if", true)
469
559
  ])) : createCommentVNode("v-if", true),
470
560
  _ctx.toolbar ? (openBlock(), createBlock(_component_ADropdown, {
471
561
  key: 1,
@@ -567,7 +657,7 @@ const _sfc_main$1 = defineComponent({
567
657
  showRef.value = false;
568
658
  e?.stopPropagation();
569
659
  e?.preventDefault();
570
- handler?.();
660
+ handler?.(props.node);
571
661
  }
572
662
  function renderMenuItem(items) {
573
663
  const visibleItems = items.filter((item) => !item.hidden);
@@ -640,12 +730,12 @@ function useContextMenu() {
640
730
  }
641
731
  };
642
732
  function createContextMenu(options) {
643
- const { event } = options || {};
733
+ const { event, node } = options || {};
644
734
  event && event?.preventDefault();
645
735
  return new Promise((resolve) => {
646
736
  const body = document.body;
647
737
  const container = document.createElement("div");
648
- const propsData = {};
738
+ const propsData = { node };
649
739
  if (options.styles) {
650
740
  propsData.styles = options.styles;
651
741
  }
@@ -657,7 +747,7 @@ function useContextMenu() {
657
747
  propsData.axis = { x: event.clientX, y: event.clientY };
658
748
  }
659
749
  const vm = createVNode(contextMenuVue, propsData);
660
- render(vm, container);
750
+ render$2(vm, container);
661
751
  const handleClick = function() {
662
752
  menuManager.resolve("");
663
753
  };
@@ -695,13 +785,42 @@ function useContextMenu() {
695
785
  }
696
786
  return [createContextMenu, destroyContextMenu];
697
787
  }
788
+ const _hoisted_1$1 = {
789
+ width: "1em",
790
+ height: "1em",
791
+ fill: "currentColor",
792
+ "aria-hidden": "true",
793
+ "data-icon": "folder-open",
794
+ viewBox: "64 64 896 896"
795
+ };
796
+ const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("path", { d: "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 0 0-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z" }, null, -1);
797
+ const _hoisted_3$1 = [
798
+ _hoisted_2$1
799
+ ];
800
+ function render$1(_ctx, _cache) {
801
+ return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_3$1);
802
+ }
803
+ const ForderOpen = { render: render$1 };
698
804
  const _hoisted_1 = {
699
- class: "dt-tree h-full flex flex-col"
805
+ width: "1em",
806
+ height: "1em",
807
+ fill: "currentColor",
808
+ "aria-hidden": "true",
809
+ "data-icon": "folder",
810
+ viewBox: "64 64 896 896"
700
811
  };
812
+ const _hoisted_2 = /* @__PURE__ */ createElementVNode("path", { d: "M880 298.4H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" }, null, -1);
813
+ const _hoisted_3 = [
814
+ _hoisted_2
815
+ ];
816
+ function render(_ctx, _cache) {
817
+ return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_3);
818
+ }
819
+ const Forder = { render };
701
820
  const _sfc_main = /* @__PURE__ */ defineComponent({
702
821
  __name: "index",
703
822
  props: BasicProps,
704
- emits: ["update:expandedKeys", "update:selectedKeys", "update:value", "check", "change", "clickNode", "update:searchValue"],
823
+ emits: ["update:expandedKeys", "update:selectedKeys", "update:value", "check", "change", "clickNode", "drop", "update:searchValue"],
705
824
  setup(__props, {
706
825
  expose,
707
826
  emit
@@ -711,11 +830,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
711
830
  t
712
831
  } = useI18n("UI");
713
832
  const {
714
- getSlot,
715
- extendSlots
833
+ getSlot
716
834
  } = useSlots$1();
835
+ const {
836
+ getUiSize
837
+ } = useHeader();
717
838
  const attrs = useAttrs();
718
839
  const slots = useSlots();
840
+ const activeKey = ref(props.activeKey);
719
841
  const state = reactive({
720
842
  checkStrictly: props.checkStrictly,
721
843
  expandedKeys: props.expandedKeys || [],
@@ -749,9 +871,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
749
871
  if (!icon) {
750
872
  if (props.renderIcon && isFunction(props.renderIcon)) {
751
873
  return props.renderIcon(params);
874
+ } else if (!params?.isLeaf) {
875
+ return state.expandedKeys.includes(params.key) ? createVNode(ForderOpen, null, null) : createVNode(Forder, null, null);
752
876
  }
753
877
  }
754
- return icon;
878
+ return createVNode("i", {
879
+ "class": `i ${icon}`
880
+ }, null);
755
881
  };
756
882
  const treeData = computed(() => {
757
883
  const data = cloneDeep(getTreeData.value);
@@ -775,21 +901,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
775
901
  }, [createVNode("span", null, [title.substr(0, searchIdx)]), createVNode("span", {
776
902
  "style": highlightStyle
777
903
  }, [searchText]), createVNode("span", null, [title.substr(searchIdx + searchText.length)])]) : title;
778
- item._title = item.title;
904
+ item._title = item[titleField];
779
905
  item[titleField] = createVNode("span", {
780
- "class": "tree-title",
906
+ "class": `tree-title ${unref(activeKey) === item[keyField] ? "tree-active-node" : ""}`,
781
907
  "onClick": handleClickNode.bind(null, item[keyField], item[childrenField], item)
782
- }, [slots?.title ? getSlot(slots, "title", item) : createVNode(Fragment, null, [unref(getBindValues).showIcon && icon && createVNode("i", {
783
- "class": `i ${icon}`
784
- }, null), titleDom, createVNode("span", {
908
+ }, [slots?.title ? getSlot(slots, "title", item) : createVNode(Fragment, null, [unref(getBindValues).showIcon && icon, titleDom, createVNode("span", {
785
909
  "class": "tree-action"
786
910
  }, [renderAction(item)])])]);
911
+ }, {}, {
912
+ children: unref(getFieldNames).children
787
913
  });
788
914
  return data;
789
915
  });
790
916
  const getBindValues = computed(() => {
791
917
  let propsData = {
792
- blockNode: true,
793
918
  ...attrs,
794
919
  ...props,
795
920
  expandedKeys: state.expandedKeys,
@@ -837,6 +962,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
837
962
  });
838
963
  function handleClickNode(key, children, node) {
839
964
  emit("clickNode", node);
965
+ activeKey.value = node[unref(getFieldNames).key];
840
966
  if (!props.clickRowToExpand || !children || children.length === 0)
841
967
  return;
842
968
  if (!state.expandedKeys.includes(key)) {
@@ -852,24 +978,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
852
978
  }
853
979
  function renderAction(node) {
854
980
  const {
855
- actionList
981
+ action
856
982
  } = props;
857
- if (!actionList || actionList.length === 0)
858
- return;
859
- return actionList.map((item, index2) => {
860
- let nodeShow = true;
861
- if (isFunction(item.show)) {
862
- nodeShow = item.show?.(node);
863
- } else if (isBoolean(item.show)) {
864
- nodeShow = item.show;
865
- }
866
- if (!nodeShow)
867
- return null;
868
- return createVNode("span", {
869
- "key": index2,
870
- "class": "tree-action"
871
- }, [item.render(node)]);
872
- });
983
+ if (action && isFunction(action)) {
984
+ return createVNode(Fragment, null, [action(node)]);
985
+ }
986
+ return null;
873
987
  }
874
988
  function handleSearch(searchValue) {
875
989
  if (searchValue !== searchState.searchText)
@@ -881,10 +995,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
881
995
  }
882
996
  const {
883
997
  filterFn,
884
- checkable,
885
- expandOnSearch,
886
- checkOnSearch,
887
- selectedOnSearch
998
+ expandOnSearch
888
999
  } = unref(props);
889
1000
  const {
890
1001
  title: titleField,
@@ -907,12 +1018,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
907
1018
  setExpandedKeys(expandKeys);
908
1019
  }
909
1020
  }
910
- if (checkOnSearch && checkable && matchedKeys.length) {
911
- setCheckedKeys(matchedKeys);
912
- }
913
- if (selectedOnSearch && matchedKeys.length) {
914
- setSelectedKeys(matchedKeys);
915
- }
916
1021
  }
917
1022
  const [createContextMenu] = useContextMenu();
918
1023
  async function handleRightClick({
@@ -925,7 +1030,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
925
1030
  } = props;
926
1031
  let contextMenuOptions = {
927
1032
  event,
928
- items: []
1033
+ items: [],
1034
+ node
929
1035
  };
930
1036
  if (beforeRightClick && isFunction(beforeRightClick)) {
931
1037
  let result = await beforeRightClick(node, event);
@@ -951,8 +1057,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
951
1057
  getAllKeys,
952
1058
  getChildrenKeys,
953
1059
  getEnabledKeys,
954
- getSelectedNode
955
- } = useTree(treeDataRef, getFieldNames);
1060
+ getSelectedNode,
1061
+ onDrop
1062
+ } = useTree(treeDataRef, getFieldNames, emit);
956
1063
  function setExpandedKeys(keys) {
957
1064
  state.expandedKeys = keys;
958
1065
  }
@@ -1055,7 +1162,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1055
1162
  const _component_ATree = Tree;
1056
1163
  const _component_AEmpty = Empty;
1057
1164
  const _component_ASpin = Spin;
1058
- return openBlock(), createElementBlock("div", _hoisted_1, [unref(showTitle) ? (openBlock(), createBlock(TreeHeader, {
1165
+ return openBlock(), createElementBlock("div", {
1166
+ class: normalizeClass(["dt-tree h-full flex flex-col", `dt-tree-${unref(getUiSize)}`])
1167
+ }, [unref(showTitle) ? (openBlock(), createBlock(TreeHeader, {
1059
1168
  key: 0,
1060
1169
  title: _ctx.title,
1061
1170
  toolbar: _ctx.toolbar,
@@ -1065,19 +1174,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1065
1174
  checkAll,
1066
1175
  expandAll,
1067
1176
  onSearch: handleSearch
1068
- }, {
1069
- default: withCtx(() => [createTextVNode(toDisplayString(unref(extendSlots)(unref(slots))), 1)]),
1070
- _: 1
1071
- }, 8, ["title", "toolbar", "search", "checkable", "searchText"])) : createCommentVNode("v-if", true), createVNode(_component_ASpin, {
1177
+ }, createSlots({
1178
+ _: 2
1179
+ }, [renderList(Object.keys(_ctx.$slots), (item) => {
1180
+ return {
1181
+ name: item,
1182
+ fn: withCtx(() => [renderSlot(_ctx.$slots, item)])
1183
+ };
1184
+ })]), 1032, ["title", "toolbar", "search", "checkable", "searchText"])) : createCommentVNode("v-if", true), createVNode(_component_ASpin, {
1072
1185
  spinning: _ctx.loading,
1073
1186
  tip: unref(t)("LOADING")
1074
1187
  }, {
1075
1188
  default: withCtx(() => [withDirectives(createElementVNode("div", null, [createVNode(_component_ATree, mergeProps(unref(getBindValues), {
1076
1189
  showIcon: false,
1077
- treeData: unref(treeData)
1078
- }), null, 16, ["treeData"])], 512), [[vShow, !unref(getNotFound)]]), withDirectives(createVNode(_component_AEmpty, null, null, 512), [[vShow, unref(getNotFound)]])]),
1190
+ treeData: unref(treeData),
1191
+ onDrop: unref(onDrop)
1192
+ }), null, 16, ["treeData", "onDrop"])], 512), [[vShow, !unref(getNotFound)]]), withDirectives(createVNode(_component_AEmpty, null, null, 512), [[vShow, unref(getNotFound)]])]),
1079
1193
  _: 1
1080
- }, 8, ["spinning", "tip"])]);
1194
+ }, 8, ["spinning", "tip"])], 2);
1081
1195
  };
1082
1196
  }
1083
1197
  });