@dt-frames/ui 2.0.14 → 2.0.16

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 +56 -40
  10. package/es/components/form/index.less +44 -3
  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 +72 -88
  16. package/es/components/table/src/components/TableAction.d.ts +6 -0
  17. package/es/components/table/src/index.d.ts +4 -4
  18. package/es/components/table/src/props.d.ts +1 -1
  19. package/es/components/tree/index.js +197 -93
  20. package/es/components/tree/index.less +75 -13
  21. package/es/components/tree/src/basicProps.d.ts +46 -7
  22. package/es/components/tree/src/components/TreeHeader.d.ts +2 -2
  23. package/es/components/tree/src/hooks/useTree.d.ts +3 -2
  24. package/es/components/tree/src/index.d.ts +120 -29
  25. package/es/components/upload/index.js +79 -75
  26. package/es/components/upload/index.less +19 -5
  27. package/es/components/upload/src/basicProps.d.ts +1 -1
  28. package/es/components/upload/src/index.d.ts +6 -6
  29. package/es/components/upload/src/utils/upload.d.ts +1 -1
  30. package/es/theme/index.js +387 -431
  31. package/es/theme/index.less +24 -0
  32. package/es/theme/src/components/header/components/lock/Lockscreen.d.ts +34 -3
  33. package/es/theme/src/components/header/components/lock/index.d.ts +1 -2
  34. package/es/theme/src/components/header/components/lock/useTime.d.ts +7 -0
  35. package/es/theme/src/components/header/components/size.d.ts +5 -5
  36. package/es/theme/src/components/header/components/user-info.d.ts +7 -0
  37. package/es/theme/src/components/header/index.d.ts +12 -5
  38. package/es/theme/src/components/header/multiple-header.d.ts +12 -5
  39. package/es/theme/src/index.d.ts +63 -13
  40. package/es/theme/src/stores/lockscreen.store.d.ts +7 -0
  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
@@ -1,8 +1,8 @@
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";
5
+ import { unref, defineComponent, useSlots, ref, computed, watch, openBlock, createElementBlock, toDisplayString, createCommentVNode, renderSlot, createVNode, createBlock, withModifiers, withCtx, Fragment, renderList, normalizeProps, guardReactiveProps, createTextVNode, createElementVNode, onMounted, onUnmounted, isVNode, getCurrentInstance, render as render$2, useAttrs, reactive, toRaw, watchEffect, normalizeClass, createSlots, withDirectives, mergeProps, vShow } from "vue";
6
6
  import { useI18n, useSlots as useSlots$1, isArray, isFunction, isEmpty, isBoolean } from "@dt-frames/core";
7
7
  import { cloneDeep, difference, omit, get } from "lodash-es";
8
8
  import "ant-design-vue/es/dropdown/style";
@@ -10,6 +10,7 @@ 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
@@ -18,9 +19,47 @@ const BasicProps = {
18
19
  type: Boolean
19
20
  },
20
21
  showIcon: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ blockNode: {
21
26
  type: Boolean,
22
27
  default: true
23
28
  },
29
+ fieldNames: {
30
+ type: Object,
31
+ default: {
32
+ children: "children",
33
+ title: "title",
34
+ key: "key"
35
+ }
36
+ },
37
+ disabled: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ draggable: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ filterTreeNode: {
46
+ type: Function
47
+ },
48
+ multiple: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ selectable: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ showLine: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ activeKey: {
61
+ type: [String, Number]
62
+ },
24
63
  loading: {
25
64
  type: Boolean,
26
65
  default: false
@@ -41,9 +80,6 @@ const BasicProps = {
41
80
  type: Array,
42
81
  default: () => []
43
82
  },
44
- fieldNames: {
45
- type: Object
46
- },
47
83
  beforeRightClick: {
48
84
  type: Function,
49
85
  default: void 0
@@ -74,10 +110,14 @@ const BasicProps = {
74
110
  type: Function,
75
111
  default: void 0
76
112
  },
77
- checkable: Boolean,
78
- expandOnSearch: Boolean,
79
- checkOnSearch: Boolean,
80
- selectedOnSearch: Boolean,
113
+ checkable: {
114
+ type: Boolean,
115
+ default: false
116
+ },
117
+ expandOnSearch: {
118
+ type: Boolean,
119
+ default: true
120
+ },
81
121
  treeData: {
82
122
  type: Array
83
123
  },
@@ -127,7 +167,7 @@ const searchProps = {
127
167
  const rightMenuProps = {
128
168
  width: {
129
169
  type: Number,
130
- default: 156
170
+ default: 106
131
171
  },
132
172
  customEvent: {
133
173
  type: Object,
@@ -189,15 +229,15 @@ function treeToList(tree, config = {}) {
189
229
  }
190
230
  return result;
191
231
  }
192
- function useTree(treeDataRef, getFieldNames) {
232
+ function useTree(treeDataRef, getFieldNames, emit) {
193
233
  function getAllKeys(list) {
194
234
  const keys = [];
195
235
  const treeData = list || unref(treeDataRef);
196
236
  const { key: keyField, children: childrenField } = unref(getFieldNames);
197
237
  if (!childrenField || !keyField)
198
238
  return keys;
199
- for (let index2 = 0; index2 < treeData.length; index2++) {
200
- const node = treeData[index2];
239
+ for (let index = 0; index < treeData.length; index++) {
240
+ const node = treeData[index];
201
241
  keys.push(node[keyField]);
202
242
  const children = node[childrenField];
203
243
  if (children && children.length) {
@@ -212,8 +252,8 @@ function useTree(treeDataRef, getFieldNames) {
212
252
  const { key: keyField, children: childrenField } = unref(getFieldNames);
213
253
  if (!childrenField || !keyField)
214
254
  return keys;
215
- for (let index2 = 0; index2 < treeData.length; index2++) {
216
- const node = treeData[index2];
255
+ for (let index = 0; index < treeData.length; index++) {
256
+ const node = treeData[index];
217
257
  node.disabled !== true && node.selectable !== false && keys.push(node[keyField]);
218
258
  const children = node[childrenField];
219
259
  if (children && children.length) {
@@ -228,8 +268,8 @@ function useTree(treeDataRef, getFieldNames) {
228
268
  const { key: keyField, children: childrenField } = unref(getFieldNames);
229
269
  if (!childrenField || !keyField)
230
270
  return keys;
231
- for (let index2 = 0; index2 < treeData.length; index2++) {
232
- const node = treeData[index2];
271
+ for (let index = 0; index < treeData.length; index++) {
272
+ const node = treeData[index];
233
273
  const children = node[childrenField];
234
274
  if (nodeKey === node[keyField]) {
235
275
  keys.push(node[keyField]);
@@ -251,11 +291,11 @@ function useTree(treeDataRef, getFieldNames) {
251
291
  const { key: keyField, children: childrenField } = unref(getFieldNames);
252
292
  if (!childrenField || !keyField)
253
293
  return;
254
- for (let index2 = 0; index2 < treeData.length; index2++) {
255
- const element = treeData[index2];
294
+ for (let index = 0; index < treeData.length; index++) {
295
+ const element = treeData[index];
256
296
  const children = element[childrenField];
257
297
  if (element[keyField] === key) {
258
- treeData[index2] = { ...treeData[index2], ...node };
298
+ treeData[index] = { ...treeData[index], ...node };
259
299
  break;
260
300
  } else if (children && children.length) {
261
301
  updateNodeByKey(key, node, element[childrenField]);
@@ -267,8 +307,8 @@ function useTree(treeDataRef, getFieldNames) {
267
307
  return [];
268
308
  const res = [];
269
309
  const data = list || unref(treeDataRef) || [];
270
- for (let index2 = 0; index2 < data.length; index2++) {
271
- const item = data[index2];
310
+ for (let index = 0; index < data.length; index++) {
311
+ const item = data[index];
272
312
  const { key: keyField, children: childrenField } = unref(getFieldNames);
273
313
  const key = keyField ? item[keyField] : "";
274
314
  const children = childrenField ? item[childrenField] : [];
@@ -330,11 +370,11 @@ function useTree(treeDataRef, getFieldNames) {
330
370
  const { key: keyField, children: childrenField } = unref(getFieldNames);
331
371
  if (!childrenField || !keyField)
332
372
  return;
333
- for (let index2 = 0; index2 < treeData.length; index2++) {
334
- const element = treeData[index2];
373
+ for (let index = 0; index < treeData.length; index++) {
374
+ const element = treeData[index];
335
375
  const children = element[childrenField];
336
376
  if (element[keyField] === key) {
337
- treeData.splice(index2, 1);
377
+ treeData.splice(index, 1);
338
378
  break;
339
379
  } else if (children && children.length) {
340
380
  deleteNodeByKey(key, element[childrenField]);
@@ -358,6 +398,47 @@ function useTree(treeDataRef, getFieldNames) {
358
398
  });
359
399
  return selectedNode || null;
360
400
  }
401
+ function onDrop(info) {
402
+ const dropKey = info.node.key;
403
+ const dragKey = info.dragNode.key;
404
+ const dropPos = info.node.pos.split("-");
405
+ const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);
406
+ const loop = (data2, key, callback) => {
407
+ data2.forEach((item, index) => {
408
+ if (item.key === key)
409
+ return callback(item, index, data2);
410
+ if (item.children)
411
+ return loop(item.children, key, callback);
412
+ });
413
+ };
414
+ const data = [...treeDataRef.value];
415
+ let dragObj;
416
+ loop(data, dragKey, (item, index, arr) => {
417
+ arr.splice(index, 1);
418
+ dragObj = item;
419
+ });
420
+ if (!info.dropToGap) {
421
+ loop(data, dropKey, (item) => {
422
+ item.children = item.children || [];
423
+ item.children.unshift(dragObj);
424
+ });
425
+ } else if ((info.node.children || []).length > 0 && info.node.expanded && dropPosition === 1) {
426
+ loop(data, dropKey, (item) => {
427
+ item.children = item.children || [];
428
+ item.children.unshift(dragObj);
429
+ });
430
+ } else {
431
+ let ar = [];
432
+ let i = 0;
433
+ loop(data, dropKey, (_item, index, arr) => {
434
+ ar = arr;
435
+ i = index;
436
+ });
437
+ dropPosition === -1 ? ar.splice(i, 0, dragObj) : ar.splice(i + 1, 0, dragObj);
438
+ }
439
+ emit("drop", { data, info });
440
+ treeDataRef.value = data;
441
+ }
361
442
  return {
362
443
  getAllKeys,
363
444
  getEnabledKeys,
@@ -367,7 +448,8 @@ function useTree(treeDataRef, getFieldNames) {
367
448
  insertNodeByKey,
368
449
  insertNodesByKey,
369
450
  deleteNodeByKey,
370
- getSelectedNode
451
+ getSelectedNode,
452
+ onDrop
371
453
  };
372
454
  }
373
455
  var ToolbarEnum = /* @__PURE__ */ ((ToolbarEnum2) => {
@@ -377,20 +459,20 @@ var ToolbarEnum = /* @__PURE__ */ ((ToolbarEnum2) => {
377
459
  ToolbarEnum2[ToolbarEnum2["UN_EXPAND_ALL"] = 3] = "UN_EXPAND_ALL";
378
460
  return ToolbarEnum2;
379
461
  })(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,
462
+ const _hoisted_1$2 = { class: "dt-tree-header flex px-2 py-1.5 items-center" };
463
+ const _hoisted_2$2 = {
464
+ key: 0,
383
465
  class: "text-center leading-8 m-0"
384
466
  };
385
- const _hoisted_3 = {
386
- key: 2,
467
+ const _hoisted_3$2 = {
468
+ key: 1,
387
469
  class: "dt-tree-search flex flex-1 items-center"
388
470
  };
389
471
  const _hoisted_4 = {
390
472
  key: 0,
391
- class: "flex-1"
473
+ class: "flex-1 flex items-center"
392
474
  };
393
- const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "i ic:baseline-more-vert text-center cursor-pointer" }, null, -1);
475
+ const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "i ic:baseline-format-list-bulleted text-right cursor-pointer toolbar" }, null, -1);
394
476
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
395
477
  __name: "TreeHeader",
396
478
  props: searchProps,
@@ -449,24 +531,25 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
449
531
  }
450
532
  );
451
533
  return (_ctx, _cache) => {
452
- const _component_AInputSearch = InputSearch;
534
+ const _component_AInput = Input;
453
535
  const _component_AMenuItem = MenuItem;
454
536
  const _component_AMenuDivider = MenuDivider;
455
537
  const _component_AMenu = Menu;
456
538
  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, [
539
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
540
+ _ctx.title ? (openBlock(), createElementBlock("h4", _hoisted_2$2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
541
+ _ctx.search || _ctx.toolbar ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
461
542
  _ctx.search ? (openBlock(), createElementBlock("div", _hoisted_4, [
462
- createVNode(_component_AInputSearch, {
543
+ unref(slots).addonBefore ? renderSlot(_ctx.$slots, "addonBefore", { key: 0 }) : createCommentVNode("", true),
544
+ createVNode(_component_AInput, {
463
545
  size: "small",
464
546
  allowClear: "",
465
547
  value: searchValue.value,
466
548
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
467
549
  placeholder: unref(t)("FILTER")
468
- }, null, 8, ["value", "placeholder"])
469
- ])) : createCommentVNode("v-if", true),
550
+ }, null, 8, ["value", "placeholder"]),
551
+ unref(slots).addonAfter ? renderSlot(_ctx.$slots, "addonAfter", { key: 1 }) : createCommentVNode("", true)
552
+ ])) : createCommentVNode("", true),
470
553
  _ctx.toolbar ? (openBlock(), createBlock(_component_ADropdown, {
471
554
  key: 1,
472
555
  onClick: _cache[1] || (_cache[1] = withModifiers(() => {
@@ -485,7 +568,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
485
568
  ]),
486
569
  _: 2
487
570
  }, 1040),
488
- item.divider ? (openBlock(), createBlock(_component_AMenuDivider, { key: 0 })) : createCommentVNode("v-if", true)
571
+ item.divider ? (openBlock(), createBlock(_component_AMenuDivider, { key: 0 })) : createCommentVNode("", true)
489
572
  ], 64);
490
573
  }), 128))
491
574
  ]),
@@ -496,20 +579,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
496
579
  _hoisted_5
497
580
  ]),
498
581
  _: 1
499
- })) : createCommentVNode("v-if", true)
500
- ])) : createCommentVNode("v-if", true)
582
+ })) : createCommentVNode("", true)
583
+ ])) : createCommentVNode("", true)
501
584
  ]);
502
585
  };
503
586
  }
504
587
  });
505
- const _export_sfc = (sfc, props) => {
506
- const target = sfc.__vccOpts || sfc;
507
- for (const [key, val] of props) {
508
- target[key] = val;
509
- }
510
- return target;
511
- };
512
- const TreeHeader = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/tree/src/components/TreeHeader.vue"]]);
513
588
  function _isSlot(s) {
514
589
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
515
590
  }
@@ -632,7 +707,6 @@ const _sfc_main$1 = defineComponent({
632
707
  };
633
708
  }
634
709
  });
635
- const contextMenuVue = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/tree/src/components/ContextMenu.vue"]]);
636
710
  function useContextMenu() {
637
711
  const menuManager = {
638
712
  domList: [],
@@ -656,8 +730,8 @@ function useContextMenu() {
656
730
  propsData.customEvent = event;
657
731
  propsData.axis = { x: event.clientX, y: event.clientY };
658
732
  }
659
- const vm = createVNode(contextMenuVue, propsData);
660
- render(vm, container);
733
+ const vm = createVNode(_sfc_main$1, propsData);
734
+ render$2(vm, container);
661
735
  const handleClick = function() {
662
736
  menuManager.resolve("");
663
737
  };
@@ -695,13 +769,42 @@ function useContextMenu() {
695
769
  }
696
770
  return [createContextMenu, destroyContextMenu];
697
771
  }
772
+ const _hoisted_1$1 = {
773
+ width: "1em",
774
+ height: "1em",
775
+ fill: "currentColor",
776
+ "aria-hidden": "true",
777
+ "data-icon": "folder-open",
778
+ viewBox: "64 64 896 896"
779
+ };
780
+ 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);
781
+ const _hoisted_3$1 = [
782
+ _hoisted_2$1
783
+ ];
784
+ function render$1(_ctx, _cache) {
785
+ return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_3$1);
786
+ }
787
+ const ForderOpen = { render: render$1 };
698
788
  const _hoisted_1 = {
699
- class: "dt-tree h-full flex flex-col"
789
+ width: "1em",
790
+ height: "1em",
791
+ fill: "currentColor",
792
+ "aria-hidden": "true",
793
+ "data-icon": "folder",
794
+ viewBox: "64 64 896 896"
700
795
  };
796
+ 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);
797
+ const _hoisted_3 = [
798
+ _hoisted_2
799
+ ];
800
+ function render(_ctx, _cache) {
801
+ return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_3);
802
+ }
803
+ const Forder = { render };
701
804
  const _sfc_main = /* @__PURE__ */ defineComponent({
702
805
  __name: "index",
703
806
  props: BasicProps,
704
- emits: ["update:expandedKeys", "update:selectedKeys", "update:value", "check", "change", "clickNode", "update:searchValue"],
807
+ emits: ["update:expandedKeys", "update:selectedKeys", "update:value", "check", "change", "clickNode", "drop", "update:searchValue"],
705
808
  setup(__props, {
706
809
  expose,
707
810
  emit
@@ -714,8 +817,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
714
817
  getSlot,
715
818
  extendSlots
716
819
  } = useSlots$1();
820
+ const {
821
+ getUiSize
822
+ } = useHeader();
717
823
  const attrs = useAttrs();
718
824
  const slots = useSlots();
825
+ const activeKey = ref(props.activeKey);
719
826
  const state = reactive({
720
827
  checkStrictly: props.checkStrictly,
721
828
  expandedKeys: props.expandedKeys || [],
@@ -749,9 +856,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
749
856
  if (!icon) {
750
857
  if (props.renderIcon && isFunction(props.renderIcon)) {
751
858
  return props.renderIcon(params);
859
+ } else if (params.children?.length) {
860
+ return state.expandedKeys.includes(params.key) ? createVNode(ForderOpen, null, null) : createVNode(Forder, null, null);
752
861
  }
753
862
  }
754
- return icon;
863
+ return createVNode("i", {
864
+ "class": `i ${icon}`
865
+ }, null);
755
866
  };
756
867
  const treeData = computed(() => {
757
868
  const data = cloneDeep(getTreeData.value);
@@ -777,11 +888,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
777
888
  }, [searchText]), createVNode("span", null, [title.substr(searchIdx + searchText.length)])]) : title;
778
889
  item._title = item.title;
779
890
  item[titleField] = createVNode("span", {
780
- "class": "tree-title",
891
+ "class": `tree-title ${unref(activeKey) === item[keyField] ? "tree-active-node" : ""}`,
781
892
  "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", {
893
+ }, [slots?.title ? getSlot(slots, "title", item) : createVNode(Fragment, null, [unref(getBindValues).showIcon && icon, titleDom, createVNode("span", {
785
894
  "class": "tree-action"
786
895
  }, [renderAction(item)])])]);
787
896
  });
@@ -789,7 +898,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
789
898
  });
790
899
  const getBindValues = computed(() => {
791
900
  let propsData = {
792
- blockNode: true,
793
901
  ...attrs,
794
902
  ...props,
795
903
  expandedKeys: state.expandedKeys,
@@ -837,15 +945,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
837
945
  });
838
946
  function handleClickNode(key, children, node) {
839
947
  emit("clickNode", node);
948
+ activeKey.value = node[unref(getFieldNames).key];
840
949
  if (!props.clickRowToExpand || !children || children.length === 0)
841
950
  return;
842
951
  if (!state.expandedKeys.includes(key)) {
843
952
  setExpandedKeys([...state.expandedKeys, key]);
844
953
  } else {
845
954
  const keys = [...state.expandedKeys];
846
- const index2 = keys.findIndex((item) => item === key);
847
- if (index2 !== -1) {
848
- keys.splice(index2, 1);
955
+ const index = keys.findIndex((item) => item === key);
956
+ if (index !== -1) {
957
+ keys.splice(index, 1);
849
958
  }
850
959
  setExpandedKeys(keys);
851
960
  }
@@ -856,7 +965,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
856
965
  } = props;
857
966
  if (!actionList || actionList.length === 0)
858
967
  return;
859
- return actionList.map((item, index2) => {
968
+ return actionList.map((item, index) => {
860
969
  let nodeShow = true;
861
970
  if (isFunction(item.show)) {
862
971
  nodeShow = item.show?.(node);
@@ -865,10 +974,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
865
974
  }
866
975
  if (!nodeShow)
867
976
  return null;
868
- return createVNode("span", {
869
- "key": index2,
870
- "class": "tree-action"
871
- }, [item.render(node)]);
977
+ return createVNode(Fragment, null, [item.render(node)]);
872
978
  });
873
979
  }
874
980
  function handleSearch(searchValue) {
@@ -881,10 +987,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
881
987
  }
882
988
  const {
883
989
  filterFn,
884
- checkable,
885
- expandOnSearch,
886
- checkOnSearch,
887
- selectedOnSearch
990
+ expandOnSearch
888
991
  } = unref(props);
889
992
  const {
890
993
  title: titleField,
@@ -907,12 +1010,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
907
1010
  setExpandedKeys(expandKeys);
908
1011
  }
909
1012
  }
910
- if (checkOnSearch && checkable && matchedKeys.length) {
911
- setCheckedKeys(matchedKeys);
912
- }
913
- if (selectedOnSearch && matchedKeys.length) {
914
- setSelectedKeys(matchedKeys);
915
- }
916
1013
  }
917
1014
  const [createContextMenu] = useContextMenu();
918
1015
  async function handleRightClick({
@@ -951,8 +1048,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
951
1048
  getAllKeys,
952
1049
  getChildrenKeys,
953
1050
  getEnabledKeys,
954
- getSelectedNode
955
- } = useTree(treeDataRef, getFieldNames);
1051
+ getSelectedNode,
1052
+ onDrop
1053
+ } = useTree(treeDataRef, getFieldNames, emit);
956
1054
  function setExpandedKeys(keys) {
957
1055
  state.expandedKeys = keys;
958
1056
  }
@@ -1055,7 +1153,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1055
1153
  const _component_ATree = Tree;
1056
1154
  const _component_AEmpty = Empty;
1057
1155
  const _component_ASpin = Spin;
1058
- return openBlock(), createElementBlock("div", _hoisted_1, [unref(showTitle) ? (openBlock(), createBlock(TreeHeader, {
1156
+ return openBlock(), createElementBlock("div", {
1157
+ class: normalizeClass(["dt-tree h-full flex flex-col", `dt-tree-${unref(getUiSize)}`])
1158
+ }, [unref(showTitle) ? (openBlock(), createBlock(_sfc_main$2, {
1059
1159
  key: 0,
1060
1160
  title: _ctx.title,
1061
1161
  toolbar: _ctx.toolbar,
@@ -1065,23 +1165,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1065
1165
  checkAll,
1066
1166
  expandAll,
1067
1167
  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, {
1168
+ }, createSlots({
1169
+ _: 2
1170
+ }, [renderList(Object.keys(_ctx.$slots), (item) => {
1171
+ return {
1172
+ name: item,
1173
+ fn: withCtx(() => [renderSlot(_ctx.$slots, item)])
1174
+ };
1175
+ })]), 1032, ["title", "toolbar", "search", "checkable", "searchText"])) : createCommentVNode("", true), createVNode(_component_ASpin, {
1072
1176
  spinning: _ctx.loading,
1073
1177
  tip: unref(t)("LOADING")
1074
1178
  }, {
1075
1179
  default: withCtx(() => [withDirectives(createElementVNode("div", null, [createVNode(_component_ATree, mergeProps(unref(getBindValues), {
1076
1180
  showIcon: false,
1077
- treeData: unref(treeData)
1078
- }), null, 16, ["treeData"])], 512), [[vShow, !unref(getNotFound)]]), withDirectives(createVNode(_component_AEmpty, null, null, 512), [[vShow, unref(getNotFound)]])]),
1181
+ treeData: unref(treeData),
1182
+ onDrop: unref(onDrop)
1183
+ }), null, 16, ["treeData", "onDrop"])], 512), [[vShow, !unref(getNotFound)]]), withDirectives(createVNode(_component_AEmpty, null, null, 512), [[vShow, unref(getNotFound)]])]),
1079
1184
  _: 1
1080
- }, 8, ["spinning", "tip"])]);
1185
+ }, 8, ["spinning", "tip"])], 2);
1081
1186
  };
1082
1187
  }
1083
1188
  });
1084
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/tree/src/index.vue"]]);
1085
1189
  export {
1086
- index as DtTree
1190
+ _sfc_main as DtTree
1087
1191
  };