hys-ui 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/README.md +3 -1
  3. package/dist/components/HysAccordion/HysAccordion.vue.js +1 -1
  4. package/dist/components/HysAccordion/HysAccordion2.vue.js +181 -47
  5. package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +7 -0
  6. package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +627 -0
  7. package/dist/components/HysAvatar/HysAvatar.vue.js +5 -35
  8. package/dist/components/HysAvatar/HysAvatar2.vue.js +221 -2
  9. package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +7 -0
  10. package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +252 -0
  11. package/dist/components/HysBadge/HysBadge.vue.js +2 -2
  12. package/dist/components/HysBadge/HysBadge2.vue.js +154 -27
  13. package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +5 -38
  14. package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +74 -2
  15. package/dist/components/HysButton/HysButton.vue.js +2 -2
  16. package/dist/components/HysButton/HysButton2.vue.js +29 -28
  17. package/dist/components/HysCalendar/HysCalendar.vue.js +5 -92
  18. package/dist/components/HysCalendar/HysCalendar2.vue.js +803 -2
  19. package/dist/components/HysCard/HysCard.vue.js +2 -2
  20. package/dist/components/HysCard/HysCard2.vue.js +175 -42
  21. package/dist/components/HysCascader/HysCascader.vue.js +5 -194
  22. package/dist/components/HysCascader/HysCascader2.vue.js +760 -2
  23. package/dist/components/HysCascader/HysCascaderColumn.vue.js +7 -0
  24. package/dist/components/HysCascader/HysCascaderColumn2.vue.js +232 -0
  25. package/dist/components/HysCheckbox/HysCheckbox.vue.js +3 -3
  26. package/dist/components/HysCheckbox/HysCheckbox2.vue.js +180 -65
  27. package/dist/components/HysCheckboxGroup/HysCheckboxGroup.vue.js +7 -0
  28. package/dist/components/HysCheckboxGroup/HysCheckboxGroup2.vue.js +237 -0
  29. package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
  30. package/dist/components/HysColorPicker/HysColorPicker2.vue.js +107 -106
  31. package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
  32. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +399 -392
  33. package/dist/components/HysDatePicker/HysDatePicker.vue.js +268 -139
  34. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +7 -0
  35. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +807 -0
  36. package/dist/components/HysDatePicker/HysDatePickerPanel.vue.js +7 -0
  37. package/dist/components/HysDatePicker/HysDatePickerPanel2.vue.js +357 -0
  38. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +268 -158
  39. package/dist/components/HysDivider/HysDivider.vue.js +2 -2
  40. package/dist/components/HysDivider/HysDivider2.vue.js +33 -13
  41. package/dist/components/HysFileManager/HysFileManager.vue.js +3 -3
  42. package/dist/components/HysFileManager/HysFileManager2.vue.js +43 -42
  43. package/dist/components/HysForm/HysForm.vue.js +3 -3
  44. package/dist/components/HysForm/HysForm2.vue.js +578 -92
  45. package/dist/components/HysFormItem/HysFormItem.vue.js +5 -85
  46. package/dist/components/HysFormItem/HysFormItem2.vue.js +521 -2
  47. package/dist/components/HysGantt/HysGantt.vue.js +1 -1
  48. package/dist/components/HysGantt/HysGantt2.vue.js +1369 -272
  49. package/dist/components/HysInput/HysInput.vue.js +2 -2
  50. package/dist/components/HysInput/HysInput2.vue.js +467 -120
  51. package/dist/components/HysMention/HysMention.vue.js +2 -2
  52. package/dist/components/HysMention/HysMention2.vue.js +89 -88
  53. package/dist/components/HysNumberInput/HysNumberInput.vue.js +2 -2
  54. package/dist/components/HysNumberInput/HysNumberInput2.vue.js +561 -79
  55. package/dist/components/HysOrgTree/HysOrgTree.vue.js +29 -26
  56. package/dist/components/HysPagination/HysPagination.vue.js +1 -1
  57. package/dist/components/HysPagination/HysPagination2.vue.js +2 -0
  58. package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +2 -2
  59. package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +52 -51
  60. package/dist/components/HysRadio/HysRadio.vue.js +7 -0
  61. package/dist/components/HysRadio/HysRadio2.vue.js +180 -0
  62. package/dist/components/HysRadioGroup/HysRadioGroup.vue.js +2 -2
  63. package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +190 -65
  64. package/dist/components/HysRating/HysRating.vue.js +1 -1
  65. package/dist/components/HysRating/HysRating2.vue.js +288 -68
  66. package/dist/components/HysRichTextEditor/HysRichTextEditor.vue.js +1 -1
  67. package/dist/components/HysRichTextEditor/HysRichTextEditor2.vue.js +70 -69
  68. package/dist/components/HysSearch/HysSearch.vue.js +37 -36
  69. package/dist/components/HysSegmented/HysSegmented.vue.js +5 -63
  70. package/dist/components/HysSegmented/HysSegmented2.vue.js +273 -2
  71. package/dist/components/HysSelect/HysSelect.vue.js +3 -2
  72. package/dist/components/HysSelect/HysSelect2.vue.js +859 -185
  73. package/dist/components/HysSkeleton/HysSkeleton.vue.js +2 -2
  74. package/dist/components/HysSkeleton/HysSkeleton2.vue.js +126 -29
  75. package/dist/components/HysSlider/HysSlider.vue.js +2 -2
  76. package/dist/components/HysSlider/HysSlider2.vue.js +532 -59
  77. package/dist/components/HysSlider/SliderTooltip.vue.js +7 -0
  78. package/dist/components/HysSlider/SliderTooltip2.vue.js +156 -0
  79. package/dist/components/HysSteps/HysSteps.vue.js +1 -1
  80. package/dist/components/HysSteps/HysSteps2.vue.js +110 -36
  81. package/dist/components/HysSwitch/HysSwitch.vue.js +2 -2
  82. package/dist/components/HysSwitch/HysSwitch2.vue.js +232 -50
  83. package/dist/components/HysTable/HysTable.vue.js +2 -2
  84. package/dist/components/HysTable/HysTable2.vue.js +1473 -88
  85. package/dist/components/HysTable/HysTableFilterOptions.vue.js +7 -0
  86. package/dist/components/HysTable/HysTableFilterOptions2.vue.js +133 -0
  87. package/dist/components/HysTabs/HysTabs.vue.js +2 -2
  88. package/dist/components/HysTabs/HysTabs2.vue.js +262 -68
  89. package/dist/components/HysTagInput/HysTagInput.vue.js +43 -42
  90. package/dist/components/HysTextarea/HysTextarea.vue.js +138 -77
  91. package/dist/components/HysTransfer/HysTransfer.vue.js +5 -223
  92. package/dist/components/HysTransfer/HysTransfer2.vue.js +416 -2
  93. package/dist/components/HysTransfer/HysTransferPanel.vue.js +7 -0
  94. package/dist/components/HysTransfer/HysTransferPanel2.vue.js +454 -0
  95. package/dist/components/HysTree/HysTree.vue.js +2 -3
  96. package/dist/components/HysTree/HysTree2.vue.js +641 -302
  97. package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +5 -136
  98. package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +558 -2
  99. package/dist/components/HysTreeSelect/HysTreeSelectPanel.vue.js +7 -0
  100. package/dist/components/HysTreeSelect/HysTreeSelectPanel2.vue.js +323 -0
  101. package/dist/components/HysUpload/HysUpload.vue.js +2 -2
  102. package/dist/components/HysUpload/HysUpload2.vue.js +77 -76
  103. package/dist/composables/autocomplete.js +50 -0
  104. package/dist/composables/avatar.js +57 -0
  105. package/dist/composables/calendar.js +96 -0
  106. package/dist/composables/cascader.js +79 -0
  107. package/dist/composables/choice.js +38 -0
  108. package/dist/composables/choiceModel.js +67 -0
  109. package/dist/composables/datePicker.js +227 -0
  110. package/dist/composables/formContext.js +92 -7
  111. package/dist/composables/formLayout.js +57 -0
  112. package/dist/composables/formValidation.js +240 -0
  113. package/dist/composables/ganttConflicts.js +143 -0
  114. package/dist/composables/numberInput.js +91 -0
  115. package/dist/composables/rating.js +16 -0
  116. package/dist/composables/selectOptions.js +54 -0
  117. package/dist/composables/table.js +150 -0
  118. package/dist/composables/textInput.js +34 -0
  119. package/dist/composables/transfer.js +63 -0
  120. package/dist/composables/tree.js +118 -0
  121. package/dist/composables/treeSelect.js +71 -0
  122. package/dist/composables/useCascader.js +438 -0
  123. package/dist/composables/useDatePicker.js +425 -0
  124. package/dist/composables/useFloating.js +97 -51
  125. package/dist/composables/useGanttDependencies.js +306 -0
  126. package/dist/composables/useGanttHistory.js +157 -0
  127. package/dist/composables/useGanttLabelResize.js +100 -0
  128. package/dist/composables/useTable.js +474 -0
  129. package/dist/composables/useTextareaSize.js +72 -0
  130. package/dist/composables/useTransfer.js +257 -0
  131. package/dist/composables/useTree.js +439 -0
  132. package/dist/composables/useTreeSelect.js +361 -0
  133. package/dist/index.js +149 -139
  134. package/dist/style.css +1 -1
  135. package/dist/types/components/HysAccordion/HysAccordion.vue.d.ts +61 -22
  136. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +201 -0
  137. package/dist/types/components/HysAvatar/HysAvatar.vue.d.ts +28 -15
  138. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +99 -0
  139. package/dist/types/components/HysBadge/HysBadge.vue.d.ts +41 -4
  140. package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +38 -10
  141. package/dist/types/components/HysButton/HysButton.vue.d.ts +0 -1
  142. package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +119 -31
  143. package/dist/types/components/HysCard/HysCard.vue.d.ts +55 -7
  144. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +129 -41
  145. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +55 -0
  146. package/dist/types/components/HysCheckbox/HysCheckbox.vue.d.ts +50 -39
  147. package/dist/types/components/HysCheckboxGroup/HysCheckboxGroup.vue.d.ts +73 -0
  148. package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +1 -1
  149. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +66 -14
  150. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +90 -0
  151. package/dist/types/components/HysDatePicker/HysDatePickerPanel.vue.d.ts +93 -0
  152. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +66 -14
  153. package/dist/types/components/HysDivider/HysDivider.vue.d.ts +8 -3
  154. package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
  155. package/dist/types/components/HysForm/HysForm.vue.d.ts +110 -18
  156. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +108 -2
  157. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +82 -4
  158. package/dist/types/components/HysInput/HysInput.vue.d.ts +52 -29
  159. package/dist/types/components/HysMention/HysMention.vue.d.ts +2 -2
  160. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +93 -35
  161. package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +1 -0
  162. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +1 -1
  163. package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +2 -2
  164. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +3 -3
  165. package/dist/types/components/HysProgress/HysProgress.vue.d.ts +1 -1
  166. package/dist/types/components/HysRadio/HysRadio.vue.d.ts +56 -0
  167. package/dist/types/components/HysRadioGroup/HysRadioGroup.vue.d.ts +34 -12
  168. package/dist/types/components/HysRating/HysRating.vue.d.ts +85 -5
  169. package/dist/types/components/HysRichTextEditor/HysRichTextEditor.vue.d.ts +4 -4
  170. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +2 -2
  171. package/dist/types/components/HysSegmented/HysSegmented.vue.d.ts +64 -32
  172. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +120 -20
  173. package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +30 -2
  174. package/dist/types/components/HysSlider/HysSlider.vue.d.ts +66 -9
  175. package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +22 -0
  176. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +1 -1
  177. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +64 -9
  178. package/dist/types/components/HysSwitch/HysSwitch.vue.d.ts +76 -17
  179. package/dist/types/components/HysTable/HysTable.vue.d.ts +206 -32
  180. package/dist/types/components/HysTable/HysTableFilterOptions.vue.d.ts +18 -0
  181. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +76 -23
  182. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +5 -5
  183. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +44 -27
  184. package/dist/types/components/HysToast/HysToast.vue.d.ts +3 -3
  185. package/dist/types/components/HysTour/HysTour.vue.d.ts +2 -2
  186. package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +55 -40
  187. package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +105 -0
  188. package/dist/types/components/HysTree/HysTree.vue.d.ts +140 -73
  189. package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +102 -23
  190. package/dist/types/components/HysTreeSelect/HysTreeSelectPanel.vue.d.ts +56 -0
  191. package/dist/types/composables/autocomplete.d.ts +106 -0
  192. package/dist/types/composables/avatar.d.ts +70 -0
  193. package/dist/types/composables/calendar.d.ts +66 -0
  194. package/dist/types/composables/cascader.d.ts +192 -0
  195. package/dist/types/composables/choice.d.ts +110 -0
  196. package/dist/types/composables/choiceModel.d.ts +11 -0
  197. package/dist/types/composables/datePicker.d.ts +247 -0
  198. package/dist/types/composables/formContext.d.ts +133 -8
  199. package/dist/types/composables/formLayout.d.ts +11 -0
  200. package/dist/types/composables/formValidation.d.ts +13 -0
  201. package/dist/types/composables/gantt.d.ts +68 -0
  202. package/dist/types/composables/ganttConflicts.d.ts +30 -0
  203. package/dist/types/composables/numberInput.d.ts +45 -0
  204. package/dist/types/composables/rating.d.ts +18 -0
  205. package/dist/types/composables/segmented.d.ts +15 -0
  206. package/dist/types/composables/selectOptions.d.ts +44 -0
  207. package/dist/types/composables/slider.d.ts +21 -0
  208. package/dist/types/composables/table.d.ts +309 -0
  209. package/dist/types/composables/textInput.d.ts +76 -0
  210. package/dist/types/composables/transfer.d.ts +180 -0
  211. package/dist/types/composables/tree.d.ts +237 -0
  212. package/dist/types/composables/treeSelect.d.ts +167 -0
  213. package/dist/types/composables/useCascader.d.ts +162 -0
  214. package/dist/types/composables/useDatePicker.d.ts +79 -0
  215. package/dist/types/composables/useFloating.d.ts +8 -5
  216. package/dist/types/composables/useGanttDependencies.d.ts +83 -0
  217. package/dist/types/composables/useGanttHistory.d.ts +42 -0
  218. package/dist/types/composables/useGanttLabelResize.d.ts +23 -0
  219. package/dist/types/composables/useTable.d.ts +60 -0
  220. package/dist/types/composables/useTextareaSize.d.ts +3 -0
  221. package/dist/types/composables/useTransfer.d.ts +58 -0
  222. package/dist/types/composables/useTree.d.ts +77 -0
  223. package/dist/types/composables/useTreeSelect.d.ts +117 -0
  224. package/dist/types/index.d.ts +33 -7
  225. package/package.json +2 -1
@@ -1,361 +1,700 @@
1
- import { defineComponent as he, ref as p, computed as s, watch as W, onDeactivated as fe, openBlock as r, createElementBlock as v, mergeProps as G, unref as I, withDirectives as pe, vModelText as ye, createCommentVNode as w, createElementVNode as E, normalizeStyle as F, Fragment as me, renderList as be, normalizeClass as ge, withModifiers as J, createBlock as O, resolveDynamicComponent as ke, toDisplayString as P, renderSlot as we, Teleport as Ce, withKeys as De, nextTick as Ke } from "vue";
2
- import Ae from "../HysCheckbox/HysCheckbox.vue.js";
3
- import { useHysRootAttrs as Me } from "../../config.js";
4
- import { LoaderCircle as Se, ChevronDown as Te, ChevronRight as Ie } from "lucide-vue-next";
5
- const Be = ["disabled"], Ve = ["aria-multiselectable"], He = ["aria-level", "aria-expanded", "aria-selected", "aria-disabled", "aria-checked", "tabindex", "draggable", "data-tree-id", "onFocus", "onKeydown", "onClick", "onDragstart", "onDragover", "onDrop", "onContextmenu", "data-drop-position"], $e = ["aria-label", "disabled", "onClick"], Ee = {
1
+ import { defineComponent as sa, useId as ua, ref as p, provide as ra, computed as E, onActivated as ca, watch as Z, shallowRef as va, onDeactivated as ya, onBeforeUnmount as fa, openBlock as r, createElementBlock as h, mergeProps as B, unref as l, createBlock as R, withCtx as ue, createVNode as w, createCommentVNode as M, createElementVNode as Y, normalizeStyle as re, normalizeClass as Se, withModifiers as X, renderSlot as H, createTextVNode as P, toDisplayString as S, Fragment as xe, renderList as ha, resolveDynamicComponent as ze, Teleport as ka, nextTick as _ } from "vue";
2
+ import { Search as ga, LoaderCircle as Ae, ChevronDown as pa, ChevronRight as ma, GripVertical as ba } from "lucide-vue-next";
3
+ import Ca from "../HysInput/HysInput.vue.js";
4
+ import xa from "../HysCheckbox/HysCheckbox.vue.js";
5
+ import De from "../HysButton/HysButton.vue.js";
6
+ import { useHysRootAttrs as Da } from "../../config.js";
7
+ import { useHysControlState as Ta, useHysFormItemContext as Ka, fieldKey as Na } from "../../composables/formContext.js";
8
+ import { useTree as Ea } from "../../composables/useTree.js";
9
+ const Ba = ["data-size"], Ma = ["id", "tabindex", "aria-label", "aria-multiselectable", "aria-disabled", "aria-busy", "aria-invalid", "aria-describedby"], Ha = {
10
+ key: 0,
11
+ class: "hys-ui-tree-loading",
12
+ role: "status"
13
+ }, Sa = ["aria-level", "aria-posinset", "aria-setsize", "aria-expanded", "aria-selected", "aria-disabled", "aria-checked", "tabindex", "draggable", "data-tree-id", "data-tree-key", "data-drop-position", "onFocus", "onKeydown", "onClick", "onDblclick", "onDragstart", "onDragover", "onDragleave", "onDrop", "onContextmenu"], za = ["aria-label", "disabled", "onClick"], Aa = {
6
14
  key: 1,
7
- class: "hys-ui-pf-tree-spacer",
8
- "aria-hidden": "true"
9
- }, Le = {
15
+ class: "hys-ui-pf-tree-spacer"
16
+ }, $a = {
10
17
  key: 3,
18
+ class: "hys-ui-tree-icon",
11
19
  "aria-hidden": "true"
12
- }, Ne = { class: "hys-ui-pf-tree-label" }, Re = {
13
- key: 4,
14
- class: "hys-ui-pf-tree-error",
15
- role: "alert"
16
- }, qe = {
17
- key: 2,
20
+ }, Ia = { class: "hys-ui-pf-tree-label" }, Va = ["disabled", "onClick"], Fa = {
21
+ key: 1,
18
22
  class: "hys-ui-pf-tree-empty"
19
- }, Ye = /* @__PURE__ */ he({
23
+ }, Ga = /* @__PURE__ */ sa({
20
24
  __name: "HysTree",
21
25
  props: {
22
26
  nodes: {},
23
27
  modelValue: {},
24
- checkedKeys: { default: () => [] },
28
+ defaultValue: {},
29
+ checkedKeys: {},
30
+ defaultCheckedKeys: {},
31
+ halfCheckedKeys: {},
25
32
  expandedKeys: {},
33
+ defaultExpandedKeys: {},
34
+ loadedKeys: {},
26
35
  multiple: { type: Boolean },
36
+ selectable: { type: Boolean, default: !0 },
27
37
  checkable: { type: Boolean },
28
38
  searchable: { type: Boolean, default: !0 },
29
39
  disabled: { type: Boolean },
40
+ inheritDisabled: { type: Boolean },
41
+ loading: { type: Boolean },
42
+ size: {},
30
43
  defaultExpandAll: { type: Boolean },
44
+ autoExpandParent: { type: Boolean },
45
+ accordion: { type: Boolean },
46
+ expandOnClickNode: { type: Boolean },
47
+ expandOnDoubleClick: { type: Boolean },
48
+ checkOnClickNode: { type: Boolean },
49
+ checkOnClickLeaf: { type: Boolean },
50
+ selectOnClickNode: { type: Boolean, default: !0 },
51
+ allowDeselect: { type: Boolean },
52
+ highlightCurrent: { type: Boolean, default: !0 },
53
+ fieldNames: {},
54
+ nodeKey: {},
31
55
  showLine: { type: Boolean },
56
+ showIcon: { type: Boolean, default: !0 },
57
+ indent: { default: 20 },
58
+ blockNode: { type: Boolean, default: !0 },
32
59
  virtual: { type: Boolean },
33
60
  rowHeight: { default: 38 },
34
61
  viewportHeight: { default: 340 },
62
+ overscan: { default: 4 },
35
63
  draggable: { type: Boolean },
64
+ dragExpandDelay: { default: 700 },
65
+ allowDrag: {},
66
+ allowDrop: {},
36
67
  contextMenu: { type: Boolean },
37
68
  checkStrictly: { type: Boolean },
69
+ searchValue: {},
70
+ defaultSearchValue: {},
71
+ searchPlaceholder: {},
38
72
  filterNode: {},
39
- loadChildren: {}
73
+ filterMode: {},
74
+ showMatchedChildren: { type: Boolean },
75
+ emptyText: {},
76
+ ariaLabel: {},
77
+ locale: {},
78
+ loadChildren: {},
79
+ renderContent: {},
80
+ nodeClass: {},
81
+ nodeStyle: {},
82
+ validateEvent: { type: Boolean, default: !0 }
40
83
  },
41
- emits: ["update:modelValue", "update:checkedKeys", "update:expandedKeys", "select", "check", "node-drop", "node-contextmenu", "load-error", "children-loaded"],
42
- setup(i, { expose: ee, emit: le }) {
43
- const Y = Me(), d = i, c = le, b = p(""), C = p({}), K = p([]), M = p({}), S = p(0), A = p(""), B = p(""), U = p("inside"), h = p(null), V = p(""), m = p(null), u = s(() => {
44
- const e = /* @__PURE__ */ new Map(), t = (l, n = 0, a, o = /* @__PURE__ */ new Set()) => {
45
- var $, k;
46
- for (const y of l)
47
- e.has(y.id) || o.has(y.id) || (e.set(y.id, { node: y, depth: n, parentId: a, hasChildren: !!(($ = y.children) != null && $.length || (k = C.value[y.id]) != null && k.length || y.hasChildren) }), t(C.value[y.id] ?? y.children ?? [], n + 1, y.id, /* @__PURE__ */ new Set([...o, y.id])));
48
- };
49
- return t(d.nodes), e;
50
- }), H = p([]);
51
- W(() => [d.nodes, d.defaultExpandAll], () => {
52
- d.defaultExpandAll && d.expandedKeys === void 0 && (H.value = [...u.value.values()].filter((e) => e.hasChildren).map((e) => e.node.id));
53
- }, { immediate: !0, deep: !0 }), W(() => d.nodes, () => {
54
- C.value = {}, M.value = {}, S.value = 0;
55
- }, { deep: !1 });
56
- const f = s(() => d.expandedKeys ?? H.value), te = s(() => {
57
- const e = /* @__PURE__ */ new Set(), t = b.value.trim().toLocaleLowerCase();
58
- if (!t) return e;
59
- for (const l of u.value.values()) {
60
- if (!(d.filterNode ? d.filterNode(t, l.node) : l.node.label.toLocaleLowerCase().includes(t))) continue;
61
- let n = l;
62
- for (; n; )
63
- e.add(n.node.id), n = n.parentId ? u.value.get(n.parentId) : void 0;
84
+ emits: ["update:modelValue", "update:checkedKeys", "update:expandedKeys", "update:loadedKeys", "update:searchValue", "update:nodes", "select", "check", "check-change", "selection-change", "node-click", "node-expand", "node-collapse", "node-drop", "node-drag-start", "node-drag-over", "node-drag-end", "node-contextmenu", "load-error", "children-loaded", "load", "data-change", "search", "scroll", "focus", "blur"],
85
+ setup(o, { expose: $e, emit: Ie }) {
86
+ const i = o, m = Ie, ce = Da(), ee = Ta(i), U = Ka(), Ve = ua(), ae = p(), y = p(), Te = p();
87
+ ra(Na, void 0);
88
+ const s = Ea(
89
+ i,
90
+ ee.disabled,
91
+ (e, ...a) => m(e, ...a),
92
+ () => {
93
+ i.validateEvent && U.validate("change");
94
+ }
95
+ ), {
96
+ index: G,
97
+ visible: k,
98
+ words: v,
99
+ busy: u,
100
+ live: ve,
101
+ query: q,
102
+ expanded: b,
103
+ selection: ye,
104
+ selected: Fe,
105
+ multiple: Le,
106
+ checked: W,
107
+ halfChecked: fe,
108
+ loadingKeys: he,
109
+ failures: Oe,
110
+ matches: Re,
111
+ expandNode: z,
112
+ setChecked: ke,
113
+ selectNode: ge,
114
+ filter: Ke
115
+ } = s, A = E(
116
+ () => Number.isFinite(i.rowHeight) ? Math.min(240, Math.max(24, i.rowHeight)) : 38
117
+ ), j = E(
118
+ () => Number.isFinite(i.viewportHeight) ? Math.min(1600, Math.max(80, i.viewportHeight)) : 340
119
+ ), Ne = E(
120
+ () => Number.isFinite(i.overscan) ? Math.min(30, Math.max(0, Math.floor(i.overscan))) : 4
121
+ ), Pe = E(
122
+ () => Number.isFinite(i.indent) ? Math.min(80, Math.max(0, i.indent)) : 20
123
+ ), V = p(0), te = p(0), $ = p(null), Ee = E(
124
+ () => i.virtual ? Math.max(0, Math.floor(V.value / A.value) - Ne.value) : 0
125
+ ), Ue = E(
126
+ () => i.virtual ? Math.min(
127
+ k.value.length,
128
+ Math.ceil(
129
+ (V.value + (te.value || j.value)) / A.value
130
+ ) + Ne.value
131
+ ) : k.value.length
132
+ ), qe = E(() => k.value.slice(Ee.value, Ue.value)), I = E(() => k.value.filter((e) => !e.disabled)), Ye = E(
133
+ () => {
134
+ var e;
135
+ return $.value !== null && k.value.some((a) => a.key === $.value && !a.disabled) ? $.value : (e = I.value[0]) == null ? void 0 : e.key;
64
136
  }
65
- return e;
66
- }), g = s(() => {
67
- const e = b.value.trim();
68
- return [...u.value.values()].filter((t) => {
69
- var n;
70
- if (e) return te.value.has(t.node.id);
71
- let l = t.parentId;
72
- for (; l; ) {
73
- if (!f.value.includes(l)) return !1;
74
- l = (n = u.value.get(l)) == null ? void 0 : n.parentId;
137
+ );
138
+ let J = 0, F = 0, x, pe = 0;
139
+ function Xe() {
140
+ x == null || x.disconnect(), i.virtual && y.value && typeof ResizeObserver < "u" && (x = new ResizeObserver((e) => {
141
+ var a;
142
+ te.value = ((a = e[0]) == null ? void 0 : a.contentRect.height) || 0;
143
+ }), x.observe(y.value));
144
+ }
145
+ function Ge() {
146
+ pe++, cancelAnimationFrame(J), J = 0, x == null || x.disconnect(), x = void 0;
147
+ }
148
+ async function Be() {
149
+ const e = ++pe;
150
+ await _(), !(!ve.value || e !== pe || !y.value) && (y.value.scrollTop = F, V.value = y.value.scrollTop, Xe());
151
+ }
152
+ ca(Be), Z([y, () => i.virtual], Be);
153
+ function We(e) {
154
+ var a;
155
+ !ve.value || !((a = y.value) != null && a.isConnected) || (F = y.value.scrollTop, i.virtual && !J && (J = requestAnimationFrame(() => {
156
+ J = 0, V.value = F;
157
+ })), m("scroll", e));
158
+ }
159
+ function je() {
160
+ F = 0, V.value = 0, y.value && (y.value.scrollTop = 0);
161
+ }
162
+ Z(q, je), Z(
163
+ () => k.value.length,
164
+ () => {
165
+ if (y.value) {
166
+ const e = Math.max(
167
+ 0,
168
+ k.value.length * A.value - (te.value || j.value)
169
+ );
170
+ i.virtual && F > e && (F = e, V.value = e, y.value.scrollTop = e);
75
171
  }
76
- return !0;
77
- });
78
- }), L = s(() => new Set(d.checkedKeys)), Q = s(() => {
79
- var t;
80
- const e = /* @__PURE__ */ new Set();
81
- for (const l of u.value.values()) {
82
- if (!L.value.has(l.node.id)) continue;
83
- let n = l.parentId;
84
- for (; n; )
85
- L.value.has(n) || e.add(n), n = (t = u.value.get(n)) == null ? void 0 : t.parentId;
86
172
  }
87
- return e;
88
- });
89
- async function N(e) {
90
- var n;
91
- const t = u.value.get(e);
92
- if (!t) return;
93
- if (!f.value.includes(e) && t.node.hasChildren && !((n = t.node.children) != null && n.length) && !Object.prototype.hasOwnProperty.call(C.value, e) && d.loadChildren && !K.value.includes(e)) {
94
- K.value = [...K.value, e], delete M.value[e];
95
- try {
96
- const a = await d.loadChildren(t.node);
97
- C.value = { ...C.value, [e]: a }, c("children-loaded", { node: t.node, children: a });
98
- } catch (a) {
99
- M.value = { ...M.value, [e]: "加载失败,点击重试" }, c("load-error", { node: t.node, error: a });
100
- return;
101
- } finally {
102
- K.value = K.value.filter((a) => a !== e);
173
+ );
174
+ const le = /* @__PURE__ */ new Map();
175
+ function Je(e, a) {
176
+ a instanceof HTMLElement ? le.set(e, a) : le.delete(e);
177
+ }
178
+ async function Me(e) {
179
+ if (u.value) return;
180
+ e.key !== void 0 && (await s.setExpandedKeys([
181
+ .../* @__PURE__ */ new Set([...s.rawExpanded.value, ...s.ancestors(e.key)])
182
+ ]), await _());
183
+ const a = y.value;
184
+ if (!a) return;
185
+ let t = e.top ?? a.scrollTop;
186
+ if (e.key !== void 0) {
187
+ const d = k.value.findIndex((n) => n.key === e.key);
188
+ if (d < 0) return;
189
+ if (i.virtual) {
190
+ const n = d * A.value, c = n + A.value, N = te.value || j.value;
191
+ t = e.align === "top" ? n : e.align === "bottom" ? c - N : n < a.scrollTop ? n : c > a.scrollTop + N ? c - N : a.scrollTop;
192
+ } else {
193
+ const n = le.get(e.key);
194
+ if (n) {
195
+ const c = n.getBoundingClientRect().top - a.getBoundingClientRect().top + a.scrollTop, N = c + n.offsetHeight;
196
+ t = e.align === "top" ? c : e.align === "bottom" ? N - a.clientHeight : c < a.scrollTop ? c : N > a.scrollTop + a.clientHeight ? N - a.clientHeight : a.scrollTop;
197
+ }
103
198
  }
104
199
  }
105
- const l = f.value.includes(e) ? f.value.filter((a) => a !== e) : [...f.value, e];
106
- d.expandedKeys === void 0 && (H.value = l), c("update:expandedKeys", l);
200
+ t = Math.max(0, Number.isFinite(t) ? t + (e.offset ?? 0) : 0), F = t, V.value = t, e.behavior === "smooth" && a.scrollTo ? a.scrollTo({ top: t, behavior: "smooth" }) : a.scrollTop = t, await _();
107
201
  }
108
- const R = s(() => new Set((Array.isArray(d.modelValue) ? d.modelValue : [d.modelValue]).filter((e) => typeof e == "string")));
109
- function q(e) {
110
- d.disabled || e.node.disabled || e.node.selectable === !1 || (c("update:modelValue", d.multiple || Array.isArray(d.modelValue) ? R.value.has(e.node.id) ? [...R.value].filter((t) => t !== e.node.id) : [...R.value, e.node.id] : e.node.id), c("select", e.node), V.value = e.node.id);
202
+ async function L(e) {
203
+ var d, n, c;
204
+ if (u.value) return;
205
+ const a = e ?? ($.value !== null ? $.value : void 0) ?? ((d = I.value[0]) == null ? void 0 : d.key);
206
+ if (a === void 0) {
207
+ (n = Te.value) == null || n.focus();
208
+ return;
209
+ }
210
+ const t = G.value.map.get(a);
211
+ !t || t.disabled || (await Me({ key: a }), !(!ve.value || !k.value.some((N) => N.key === a)) && ($.value = a, await _(), (c = le.get(a)) == null || c.focus({ preventScroll: !!i.virtual })));
111
212
  }
112
- function ne(e) {
113
- const t = [], l = (n) => {
114
- const a = u.value.get(n);
115
- if (a) {
116
- !a.node.disabled && a.node.checkable !== !1 && t.push(n);
117
- for (const o of C.value[n] ?? a.node.children ?? []) l(o.id);
118
- }
213
+ function C(e) {
214
+ return {
215
+ node: e.node,
216
+ key: e.key,
217
+ label: e.label,
218
+ depth: e.depth,
219
+ expanded: b.value.has(e.key) || !!q.value.trim() && i.filterMode !== "highlight",
220
+ selected: ye.value.has(e.key),
221
+ checked: W.value.has(e.key),
222
+ indeterminate: fe.value.has(e.key),
223
+ disabled: u.value || e.disabled,
224
+ loading: he.value.has(e.key),
225
+ leaf: !e.hasChildren
119
226
  };
120
- return l(e), t;
121
227
  }
122
- function Z(e) {
123
- if (d.disabled || e.node.disabled || e.node.checkable === !1) return;
124
- const t = d.checkStrictly ? [e.node.id] : ne(e.node.id), l = new Set(d.checkedKeys), n = !t.every((o) => l.has(o));
125
- for (const o of t)
126
- n ? l.add(o) : l.delete(o);
127
- for (const o of d.checkStrictly ? [] : [...u.value.values()].reverse()) {
128
- if (!o.hasChildren || o.node.disabled || o.node.checkable === !1) continue;
129
- const $ = (C.value[o.node.id] ?? o.node.children ?? []).filter((k) => !k.disabled && k.checkable !== !1).map((k) => k.id);
130
- $.length && $.every((k) => l.has(k)) ? l.add(o.node.id) : l.delete(o.node.id);
131
- }
132
- const a = [...l];
133
- c("update:checkedKeys", a), c("check", a);
228
+ const ne = (e, a) => e instanceof Element && !!e.closest(
229
+ 'button,input,textarea,select,a,[contenteditable="true"],[role="button"]'
230
+ ) && e !== a;
231
+ function Qe(e, a) {
232
+ ne(e.target, e.currentTarget) || u.value || a.disabled || ($.value = a.key, m("node-click", a.node, e), i.selectOnClickNode && ge(a, e), i.checkable && (i.checkOnClickNode || i.checkOnClickLeaf && !a.hasChildren) && ke(
233
+ a.key,
234
+ !W.value.has(a.key),
235
+ !i.checkStrictly,
236
+ e
237
+ ), i.expandOnClickNode && a.hasChildren && z(a.key, !b.value.has(a.key)));
134
238
  }
135
- function T(e) {
136
- const t = g.value;
137
- if (!t.length) return;
138
- const l = t[Math.max(0, Math.min(e, t.length - 1))];
139
- if (V.value = l.node.id, d.virtual && m.value) {
140
- const n = e * D.value, a = n + D.value;
141
- n < m.value.scrollTop ? m.value.scrollTop = n : a > m.value.scrollTop + z.value && (m.value.scrollTop = a - z.value), S.value = m.value.scrollTop;
142
- }
143
- Ke(() => {
144
- var a;
145
- const n = [...((a = m.value) == null ? void 0 : a.querySelectorAll("[data-tree-id]")) || []].find((o) => o.dataset.treeId === l.node.id);
146
- n == null || n.focus();
147
- });
239
+ function Ze(e, a) {
240
+ i.expandOnDoubleClick && !i.expandOnClickNode && !ne(e.target, e.currentTarget) && a.hasChildren && z(a.key, !b.value.has(a.key));
148
241
  }
149
- function ae(e, t) {
150
- const l = g.value.findIndex((n) => n.node.id === t.node.id);
151
- if (e.key === "ArrowDown")
152
- e.preventDefault(), T(l + 1);
153
- else if (e.key === "ArrowUp")
154
- e.preventDefault(), T(l - 1);
155
- else if (e.key === "Home")
156
- e.preventDefault(), T(0);
157
- else if (e.key === "End")
158
- e.preventDefault(), T(g.value.length - 1);
159
- else if (e.key === "ArrowRight")
160
- e.preventDefault(), t.hasChildren && !f.value.includes(t.node.id) ? N(t.node.id) : t.hasChildren && T(l + 1);
161
- else if (e.key === "ArrowLeft") {
162
- if (e.preventDefault(), t.hasChildren && f.value.includes(t.node.id)) N(t.node.id);
163
- else if (t.parentId) {
164
- const n = g.value.findIndex((a) => a.node.id === t.parentId);
165
- T(n);
166
- }
167
- } else e.key === "Enter" ? (e.preventDefault(), q(t)) : e.key === " " && (e.preventDefault(), d.checkable ? Z(t) : q(t));
242
+ function we(e, a) {
243
+ var d, n;
244
+ if (e.isComposing || e.keyCode === 229 || ne(e.target, e.currentTarget) || u.value)
245
+ return;
246
+ const t = I.value.findIndex((c) => c.key === a.key);
247
+ if (["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) {
248
+ e.preventDefault();
249
+ const c = e.key === "Home" ? 0 : e.key === "End" ? I.value.length - 1 : Math.max(
250
+ 0,
251
+ Math.min(
252
+ I.value.length - 1,
253
+ t + (e.key === "ArrowDown" ? 1 : -1)
254
+ )
255
+ );
256
+ L((d = I.value[c]) == null ? void 0 : d.key);
257
+ } else e.key === "ArrowRight" ? (e.preventDefault(), a.hasChildren && !b.value.has(a.key) ? z(a.key) : a.hasChildren && L((n = I.value[t + 1]) == null ? void 0 : n.key)) : e.key === "ArrowLeft" ? (e.preventDefault(), a.hasChildren && b.value.has(a.key) ? z(a.key, !1) : a.parent !== void 0 && L(a.parent)) : e.key === "Enter" ? (e.preventDefault(), ge(a, e)) : e.key === " " ? (e.preventDefault(), i.checkable ? ke(
258
+ a.key,
259
+ !W.value.has(a.key),
260
+ !i.checkStrictly,
261
+ e
262
+ ) : ge(a, e)) : e.key === "Escape" && (e.preventDefault(), f.value ? g() : D.value !== null ? O(e) : i.allowDeselect && s.setSelectedKeys([]));
168
263
  }
169
- const D = s(() => Math.max(24, d.rowHeight)), z = s(() => Math.max(120, d.viewportHeight)), X = s(() => d.virtual ? Math.max(0, Math.floor(S.value / D.value) - 5) : 0), x = s(() => d.virtual ? Math.min(g.value.length, Math.ceil((S.value + z.value) / D.value) + 5) : g.value.length), de = s(() => g.value.slice(X.value, x.value)), oe = s(() => X.value * D.value), ie = s(() => Math.max(0, (g.value.length - x.value) * D.value));
170
- W([b, f], () => {
171
- S.value = 0, m.value && (m.value.scrollTop = 0);
172
- });
173
- function re(e) {
174
- S.value = e.target.scrollTop;
264
+ function _e(e) {
265
+ var a;
266
+ e.key === "Enter" && !e.isComposing && e.keyCode !== 229 ? e.preventDefault() : e.key === "ArrowDown" && !e.isComposing && (e.preventDefault(), L((a = I.value[0]) == null ? void 0 : a.key));
175
267
  }
176
- function ue(e, t) {
177
- var l;
178
- if (!d.draggable || d.disabled || t.node.disabled) {
268
+ const D = p(null), T = p(null), ie = p("inside");
269
+ let K, de, me = null;
270
+ function Q() {
271
+ clearTimeout(de), de = void 0, me = null;
272
+ }
273
+ function oe(e) {
274
+ (e.type === "blur" || e instanceof KeyboardEvent && e.key === "Escape") && O(e);
275
+ }
276
+ function O(e) {
277
+ const a = K;
278
+ D.value = null, T.value = null, K = void 0, Q(), window.removeEventListener("blur", oe), window.removeEventListener("keydown", oe, !0), a && m("node-drag-end", { node: a, event: e });
279
+ }
280
+ function ea(e, a) {
281
+ var t, d;
282
+ if (u.value || !i.draggable || a.disabled || ((t = i.allowDrag) == null ? void 0 : t.call(i, a.node)) === !1 || ne(e.target, e.currentTarget)) {
179
283
  e.preventDefault();
180
284
  return;
181
285
  }
182
- A.value = t.node.id, (l = e.dataTransfer) == null || l.setData("text/plain", t.node.id), e.dataTransfer && (e.dataTransfer.effectAllowed = "move");
286
+ O(), D.value = a.key, K = a.node, (d = e.dataTransfer) == null || d.setData("text/plain", String(a.key)), e.dataTransfer && (e.dataTransfer.effectAllowed = "move"), window.addEventListener("blur", oe), window.addEventListener("keydown", oe, !0), m("node-drag-start", { node: a.node, event: e });
287
+ }
288
+ function be(e, a) {
289
+ var d, n;
290
+ const t = D.value;
291
+ return t === null || t === e.key || u.value || !i.draggable || e.disabled || !K || ((d = G.value.map.get(t)) == null ? void 0 : d.node) !== K || s.ancestors(e.key).includes(t) || a === "inside" && e.leaf ? !1 : ((n = i.allowDrop) == null ? void 0 : n.call(i, K, e.node, a)) !== !1;
183
292
  }
184
- function se(e, t) {
185
- if (!d.draggable || !A.value || A.value === t.node.id) return;
186
- const l = u.value.get(A.value);
187
- let n = t;
188
- for (; n; ) {
189
- if (n.node.id === (l == null ? void 0 : l.node.id)) return;
190
- n = n.parentId ? u.value.get(n.parentId) : void 0;
293
+ function aa(e, a) {
294
+ const t = e.currentTarget.getBoundingClientRect(), d = (e.clientY - t.top) / (t.height || 1), n = d < 0.25 ? "before" : d > 0.75 ? "after" : "inside";
295
+ if (!be(a, n)) {
296
+ T.value = null, Q();
297
+ return;
191
298
  }
192
- e.preventDefault();
193
- const a = e.currentTarget.getBoundingClientRect(), o = (e.clientY - a.top) / a.height;
194
- U.value = o < 0.25 ? "before" : o > 0.75 ? "after" : "inside", B.value = t.node.id;
299
+ e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move"), T.value = a.key, ie.value = n, m("node-drag-over", {
300
+ dragId: D.value,
301
+ targetId: a.key,
302
+ dragNode: K,
303
+ targetNode: a.node,
304
+ position: n,
305
+ event: e
306
+ }), n === "inside" && a.hasChildren && !b.value.has(a.key) && me !== a.key ? (Q(), me = a.key, Number.isFinite(i.dragExpandDelay) && i.dragExpandDelay >= 0 && (de = setTimeout(() => {
307
+ de = void 0, T.value === a.key && be(a, "inside") && z(a.key);
308
+ }, i.dragExpandDelay))) : n !== "inside" && Q();
309
+ }
310
+ function ta(e, a) {
311
+ (!(e.relatedTarget instanceof Node) || !e.currentTarget.contains(e.relatedTarget)) && (T.value === a.key && (T.value = null), Q());
195
312
  }
196
- function ce(e, t) {
197
- B.value !== t.node.id || !A.value || (e.preventDefault(), c("node-drop", { dragId: A.value, targetId: t.node.id, position: U.value }), j());
313
+ function la(e, a) {
314
+ T.value === a.key && be(a, ie.value) && (e.preventDefault(), m("node-drop", {
315
+ dragId: D.value,
316
+ targetId: a.key,
317
+ position: ie.value,
318
+ dragNode: K,
319
+ targetNode: a.node,
320
+ event: e
321
+ })), O(e);
198
322
  }
199
- function j() {
200
- A.value = "", B.value = "";
323
+ Z(
324
+ () => [u.value, i.draggable, i.nodes],
325
+ () => {
326
+ var e;
327
+ (u.value || !i.draggable || D.value !== null && ((e = G.value.map.get(D.value)) == null ? void 0 : e.node) !== K) && O();
328
+ },
329
+ { flush: "sync" }
330
+ );
331
+ const f = va(), se = p(), Ce = p();
332
+ function g(e = !0) {
333
+ f.value = void 0, e && Ce.value !== void 0 && L(Ce.value);
201
334
  }
202
- function ve(e, t) {
203
- d.contextMenu && (e.preventDefault(), h.value = { node: t.node, x: Math.max(0, Math.min(e.clientX, window.innerWidth - 190)), y: Math.max(0, Math.min(e.clientY, window.innerHeight - 130)) }, c("node-contextmenu", { node: t.node, x: e.clientX, y: e.clientY }));
335
+ async function na(e, a) {
336
+ var t, d;
337
+ !i.contextMenu || u.value || a.disabled || (e.preventDefault(), Ce.value = a.key, f.value = {
338
+ node: a.node,
339
+ key: a.key,
340
+ x: Math.max(8, Math.min(e.clientX, window.innerWidth - 230)),
341
+ y: Math.max(8, Math.min(e.clientY, window.innerHeight - 155))
342
+ }, m("node-contextmenu", {
343
+ node: a.node,
344
+ x: e.clientX,
345
+ y: e.clientY,
346
+ event: e
347
+ }), await _(), (d = (t = se.value) == null ? void 0 : t.querySelector('button,[tabindex="0"]')) == null || d.focus());
204
348
  }
205
- function _(e) {
206
- const t = h.value;
207
- if (t) {
208
- if (e === "select") {
209
- const l = u.value.get(t.node.id);
210
- l && q(l);
211
- } else N(t.node.id);
212
- h.value = null;
349
+ function ia(e) {
350
+ var a, t;
351
+ if (e.key === "Escape")
352
+ e.preventDefault(), g();
353
+ else if (e.key === "Tab") g(!1);
354
+ else if (["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) {
355
+ e.preventDefault();
356
+ const d = [
357
+ ...((a = se.value) == null ? void 0 : a.querySelectorAll(
358
+ "[role=menuitem]:not(:disabled)"
359
+ )) ?? []
360
+ ], n = d.indexOf(document.activeElement), c = e.key === "Home" ? 0 : e.key === "End" ? d.length - 1 : (n + (e.key === "ArrowDown" ? 1 : -1) + d.length) % d.length;
361
+ (t = d[c]) == null || t.focus();
213
362
  }
214
363
  }
215
- return fe(() => {
216
- h.value = null, j();
217
- }), ee({ getNode: (e) => {
218
- var t;
219
- return (t = u.value.get(e)) == null ? void 0 : t.node;
220
- }, getCheckedKeys: () => [...d.checkedKeys], setCheckedKeys: (e) => {
221
- c("update:checkedKeys", e), c("check", e);
222
- }, filter: (e) => b.value = e, expandAll: () => {
223
- const e = [...u.value.values()].filter((t) => t.hasChildren).map((t) => t.node.id);
224
- H.value = e, c("update:expandedKeys", e);
225
- }, collapseAll: () => {
226
- H.value = [], c("update:expandedKeys", []);
227
- } }), (e, t) => (r(), v("div", G(I(Y), {
228
- class: ["hys-ui-pf-tree", { "hys-ui-pf-tree-disabled": i.disabled }]
364
+ function da(e) {
365
+ var a;
366
+ (!(e.relatedTarget instanceof Node) || !((a = ae.value) != null && a.contains(e.relatedTarget))) && m("focus", e);
367
+ }
368
+ function oa(e) {
369
+ var a, t;
370
+ e.relatedTarget instanceof Node && ((a = ae.value) != null && a.contains(e.relatedTarget) || (t = se.value) != null && t.contains(e.relatedTarget)) || (m("blur", e), i.validateEvent && U.validate("blur"));
371
+ }
372
+ function He() {
373
+ O(), g(!1), Ge();
374
+ }
375
+ return Z(u, (e) => {
376
+ e && g(!1);
377
+ }), ya(He), fa(He), $e({
378
+ element: ae,
379
+ getNode: s.getNode,
380
+ getNodeInfo: s.getNodeInfo,
381
+ getCheckedKeys: s.getCheckedKeys,
382
+ getCheckedNodes: s.getCheckedNodes,
383
+ getHalfCheckedKeys: s.getHalfCheckedKeys,
384
+ getHalfCheckedNodes: () => s.checkInfo().halfCheckedNodes,
385
+ setCheckedKeys: s.setCheckedKeys,
386
+ setCheckedNodes: (e, a = !1) => s.setCheckedKeys(
387
+ e.flatMap((t) => {
388
+ var d;
389
+ return ((d = s.getNodeInfo(t)) == null ? void 0 : d.key) ?? [];
390
+ }),
391
+ a
392
+ ),
393
+ setChecked: s.setChecked,
394
+ getCurrentKey: s.getCurrentKey,
395
+ getCurrentNode: s.getCurrentNode,
396
+ getSelectedKeys: () => [...Fe.value],
397
+ setCurrentKey: s.setCurrentKey,
398
+ setCurrentNode: (e, a = !0) => {
399
+ var t;
400
+ return s.setCurrentKey(
401
+ e === null ? null : ((t = s.getNodeInfo(e)) == null ? void 0 : t.key) ?? null,
402
+ a
403
+ );
404
+ },
405
+ setSelectedKeys: s.setSelectedKeys,
406
+ getExpandedKeys: () => [...b.value],
407
+ setExpandedKeys: s.setExpandedKeys,
408
+ expandNode: z,
409
+ expandAll: () => s.setExpandedKeys(
410
+ G.value.rows.filter((e) => e.hasChildren).map((e) => e.key)
411
+ ),
412
+ collapseAll: () => s.setExpandedKeys([]),
413
+ filter: Ke,
414
+ reloadNode: s.reloadNode,
415
+ updateKeyChildren: s.updateKeyChildren,
416
+ append: s.append,
417
+ insertBefore: s.insertBefore,
418
+ insertAfter: s.insertAfter,
419
+ remove: s.remove,
420
+ scrollTo: Me,
421
+ focus: L
422
+ }), (e, a) => (r(), h("div", B({
423
+ ref_key: "element",
424
+ ref: ae
425
+ }, l(ce), {
426
+ class: ["hys-ui-pf-tree", {
427
+ "hys-ui-pf-tree-disabled": l(ee).disabled.value,
428
+ "hys-ui-tree-inline": !o.blockNode
429
+ }],
430
+ "data-size": l(ee).size.value,
431
+ onFocusin: da,
432
+ onFocusout: oa
229
433
  }), [
230
- i.searchable ? pe((r(), v("input", {
434
+ o.searchable ? (r(), R(Ca, {
231
435
  key: 0,
232
- "onUpdate:modelValue": t[0] || (t[0] = (l) => b.value = l),
233
- class: "hys-ui-pf-tree-search",
234
- type: "search",
235
- placeholder: "搜索节点…",
236
- "aria-label": "搜索树节点",
237
- disabled: i.disabled
238
- }, null, 8, Be)), [
239
- [ye, b.value]
240
- ]) : w("", !0),
241
- E("div", {
436
+ ref_key: "search",
437
+ ref: Te,
438
+ class: "hys-ui-tree-search",
439
+ "data-hys-ui-form-internal": "",
440
+ "model-value": l(q),
441
+ placeholder: o.searchPlaceholder || l(v).search,
442
+ "aria-label": l(v).search,
443
+ disabled: l(u),
444
+ size: l(ee).size.value,
445
+ clearable: "",
446
+ "onUpdate:modelValue": l(Ke),
447
+ onKeydown: _e
448
+ }, {
449
+ prefix: ue(() => [
450
+ w(l(ga), {
451
+ size: 15,
452
+ "aria-hidden": "true"
453
+ })
454
+ ]),
455
+ _: 1
456
+ }, 8, ["model-value", "placeholder", "aria-label", "disabled", "size", "onUpdate:modelValue"])) : M("", !0),
457
+ Y("div", {
242
458
  ref_key: "root",
243
- ref: m,
459
+ ref: y,
460
+ id: l(U).id.value || l(Ve),
244
461
  role: "tree",
245
- "aria-multiselectable": i.multiple || i.checkable || Array.isArray(i.modelValue),
246
- "aria-label": "树形列表",
247
- class: "hys-ui-pf-tree-list",
248
- style: F({ maxHeight: z.value + "px" }),
249
- onScroll: re
462
+ "data-hys-ui-field-managed": "",
463
+ tabindex: l(u) ? -1 : 0,
464
+ onFocus: a[2] || (a[2] = X((t) => L(), ["self"])),
465
+ "aria-label": o.ariaLabel || l(U).label.value || l(v).tree,
466
+ "aria-multiselectable": l(Le) || o.checkable || void 0,
467
+ "aria-disabled": l(u) || void 0,
468
+ "aria-busy": o.loading || l(he).size > 0 || void 0,
469
+ "aria-invalid": l(U).invalid.value || void 0,
470
+ "aria-describedby": l(U).describedBy.value,
471
+ class: Se(["hys-ui-pf-tree-list", { "hys-ui-tree-virtual": o.virtual }]),
472
+ style: re({
473
+ maxHeight: j.value + "px",
474
+ height: o.virtual ? j.value + "px" : void 0,
475
+ "--hys-ui-tree-indent": Pe.value + "px",
476
+ "--hys-ui-tree-row-height": A.value + "px"
477
+ }),
478
+ onScroll: We
250
479
  }, [
251
- i.virtual ? (r(), v("div", {
252
- key: 0,
253
- style: F({ height: oe.value + "px" }),
254
- "aria-hidden": "true"
255
- }, null, 4)) : w("", !0),
256
- (r(!0), v(me, null, be(de.value, (l, n) => (r(), v("div", {
257
- key: l.node.id,
258
- class: ge(["hys-ui-pf-tree-row", { "hys-ui-pf-tree-selected": R.value.has(l.node.id), "hys-ui-pf-tree-line": i.showLine, "hys-ui-pf-tree-drop": B.value === l.node.id }]),
259
- role: "treeitem",
260
- "aria-level": l.depth + 1,
261
- "aria-expanded": l.hasChildren ? b.value.trim() ? !0 : f.value.includes(l.node.id) : void 0,
262
- "aria-selected": i.modelValue === l.node.id,
263
- "aria-disabled": i.disabled || l.node.disabled,
264
- "aria-checked": i.checkable ? L.value.has(l.node.id) ? "true" : Q.value.has(l.node.id) ? "mixed" : "false" : void 0,
265
- tabindex: V.value === l.node.id || !V.value && n === 0 && X.value === 0 ? 0 : -1,
266
- draggable: i.draggable && !i.disabled && !l.node.disabled,
267
- "data-tree-id": l.node.id,
268
- onFocus: (a) => V.value = l.node.id,
269
- onKeydown: (a) => ae(a, l),
270
- onClick: (a) => q(l),
271
- onDragstart: (a) => ue(a, l),
272
- onDragover: (a) => se(a, l),
273
- onDrop: (a) => ce(a, l),
274
- onDragend: j,
275
- onContextmenu: (a) => ve(a, l),
276
- "data-drop-position": B.value === l.node.id ? U.value : void 0,
277
- style: F({ "--hys-ui-tree-depth": l.depth, minHeight: i.virtual ? D.value + "px" : void 0, height: i.virtual ? D.value + "px" : void 0 })
480
+ o.loading ? (r(), h("div", Ha, [
481
+ H(e.$slots, "loading", {}, () => [
482
+ w(l(Ae), {
483
+ size: 18,
484
+ class: "hys-ui-icon-spin",
485
+ "aria-hidden": "true"
486
+ }),
487
+ P(S(l(v).loading), 1)
488
+ ], !0)
489
+ ])) : M("", !0),
490
+ Y("div", {
491
+ class: "hys-ui-tree-space",
492
+ style: re(
493
+ o.virtual ? { height: l(k).length * A.value + "px" } : void 0
494
+ )
278
495
  }, [
279
- l.hasChildren ? (r(), v("button", {
280
- key: 0,
281
- class: "hys-ui-pf-tree-expander",
282
- type: "button",
283
- "aria-label": f.value.includes(l.node.id) ? "折叠" : "展开",
284
- disabled: i.disabled || l.node.disabled || K.value.includes(l.node.id),
285
- onClick: J((a) => N(l.node.id), ["stop"])
496
+ Y("div", {
497
+ class: "hys-ui-tree-rows",
498
+ style: re(
499
+ o.virtual ? {
500
+ position: "absolute",
501
+ top: Ee.value * A.value + "px",
502
+ insetInline: "0"
503
+ } : void 0
504
+ )
286
505
  }, [
287
- K.value.includes(l.node.id) ? (r(), O(I(Se), {
288
- key: 0,
289
- size: 15,
290
- "aria-hidden": "true",
291
- class: "hys-ui-icon-spin"
292
- })) : (r(), O(ke(b.value.trim() || f.value.includes(l.node.id) ? I(Te) : I(Ie)), {
293
- key: 1,
294
- size: 15,
295
- "aria-hidden": "true"
296
- }))
297
- ], 8, $e)) : (r(), v("span", Ee)),
298
- i.checkable ? (r(), O(Ae, {
299
- key: 2,
300
- tabindex: -1,
301
- "model-value": L.value.has(l.node.id),
302
- disabled: i.disabled || l.node.disabled || l.node.checkable === !1,
303
- "aria-label": `勾选${l.node.label}`,
304
- indeterminate: Q.value.has(l.node.id),
305
- onClick: t[1] || (t[1] = J(() => {
306
- }, ["stop"])),
307
- onChange: (a) => Z(l)
308
- }, null, 8, ["model-value", "disabled", "aria-label", "indeterminate", "onChange"])) : w("", !0),
309
- l.node.icon ? (r(), v("span", Le, P(l.node.icon), 1)) : w("", !0),
310
- we(e.$slots, "node", {
311
- node: l.node,
312
- depth: l.depth,
313
- expanded: f.value.includes(l.node.id),
314
- selected: i.modelValue === l.node.id
315
- }, () => [
316
- E("span", Ne, P(l.node.label), 1)
317
- ], !0),
318
- M.value[l.node.id] ? (r(), v("span", Re, P(M.value[l.node.id]), 1)) : w("", !0)
319
- ], 46, He))), 128)),
320
- i.virtual ? (r(), v("div", {
321
- key: 1,
322
- style: F({ height: ie.value + "px" }),
323
- "aria-hidden": "true"
324
- }, null, 4)) : w("", !0),
325
- g.value.length ? w("", !0) : (r(), v("div", qe, P(b.value ? "无匹配节点" : "暂无数据"), 1))
326
- ], 44, Ve),
327
- (r(), O(Ce, { to: "body" }, [
328
- h.value ? (r(), v("div", G({ key: 0 }, I(Y), {
329
- class: "hys-ui-pf-tree-context",
330
- style: { left: h.value.x + "px", top: h.value.y + "px" },
331
- role: "menu",
332
- onKeydown: t[5] || (t[5] = De((l) => h.value = null, ["esc"]))
333
- }), [
334
- E("button", {
335
- type: "button",
336
- role: "menuitem",
337
- onClick: t[2] || (t[2] = (l) => _("select"))
338
- }, "选择节点"),
339
- E("button", {
340
- type: "button",
341
- role: "menuitem",
342
- onClick: t[3] || (t[3] = (l) => _("expand"))
343
- }, "展开 / 折叠"),
344
- E("button", {
345
- type: "button",
346
- role: "menuitem",
347
- onClick: t[4] || (t[4] = (l) => h.value = null)
348
- }, "关闭")
349
- ], 16)) : w("", !0),
350
- h.value ? (r(), v("div", G({ key: 1 }, I(Y), {
351
- class: "hys-ui-pf-tree-context-backdrop",
352
- onClick: t[6] || (t[6] = (l) => h.value = null),
353
- onContextmenu: t[7] || (t[7] = J((l) => h.value = null, ["prevent"]))
354
- }), null, 16)) : w("", !0)
506
+ (r(!0), h(xe, null, ha(qe.value, (t) => {
507
+ var d;
508
+ return r(), h("div", {
509
+ key: typeof t.key + ":" + t.key,
510
+ ref_for: !0,
511
+ ref: (n) => Je(t.key, n),
512
+ class: Se(["hys-ui-pf-tree-row", [
513
+ typeof o.nodeClass == "function" ? o.nodeClass(t.node) : o.nodeClass,
514
+ {
515
+ "hys-ui-pf-tree-selected": o.highlightCurrent && l(ye).has(t.key),
516
+ "hys-ui-pf-tree-line": o.showLine,
517
+ "hys-ui-pf-tree-drop": T.value === t.key,
518
+ "hys-ui-tree-matched": l(q).trim() && l(Re).has(t.key),
519
+ "hys-ui-tree-row-disabled": t.disabled,
520
+ "hys-ui-tree-row-dragging": D.value === t.key
521
+ }
522
+ ]]),
523
+ style: re([
524
+ { "--hys-ui-tree-depth": t.depth },
525
+ typeof o.nodeStyle == "function" ? o.nodeStyle(t.node) : o.nodeStyle
526
+ ]),
527
+ role: "treeitem",
528
+ "aria-level": t.depth + 1,
529
+ "aria-posinset": t.pos,
530
+ "aria-setsize": t.size,
531
+ "aria-expanded": t.hasChildren ? C(t).expanded : void 0,
532
+ "aria-selected": o.selectable && t.selectable ? l(ye).has(t.key) : void 0,
533
+ "aria-disabled": l(u) || t.disabled || void 0,
534
+ "aria-checked": o.checkable && t.checkable ? l(fe).has(t.key) ? "mixed" : l(W).has(t.key) : void 0,
535
+ tabindex: !l(u) && Ye.value === t.key ? 0 : -1,
536
+ draggable: o.draggable && !l(u) && !t.disabled && ((d = o.allowDrag) == null ? void 0 : d.call(o, t.node)) !== !1,
537
+ "data-tree-id": t.key,
538
+ "data-tree-key": typeof t.key + ":" + t.key,
539
+ "data-drop-position": T.value === t.key ? ie.value : void 0,
540
+ onFocus: (n) => $.value = t.key,
541
+ onKeydown: (n) => we(n, t),
542
+ onClick: (n) => Qe(n, t),
543
+ onDblclick: (n) => Ze(n, t),
544
+ onDragstart: (n) => ea(n, t),
545
+ onDragover: (n) => aa(n, t),
546
+ onDragleave: (n) => ta(n, t),
547
+ onDrop: (n) => la(n, t),
548
+ onDragend: O,
549
+ onContextmenu: (n) => na(n, t)
550
+ }, [
551
+ t.hasChildren ? (r(), h("button", {
552
+ key: 0,
553
+ type: "button",
554
+ class: "hys-ui-pf-tree-expander",
555
+ "aria-label": (C(t).expanded ? l(v).collapse : l(v).expand) + " " + t.label,
556
+ disabled: l(u) || t.disabled,
557
+ tabindex: "-1",
558
+ onClick: X((n) => l(z)(t.key, !l(b).has(t.key)), ["stop"])
559
+ }, [
560
+ H(e.$slots, "switcher", B({ ref_for: !0 }, C(t)), () => [
561
+ l(he).has(t.key) ? (r(), R(l(Ae), {
562
+ key: 0,
563
+ size: 15,
564
+ class: "hys-ui-icon-spin",
565
+ "aria-hidden": "true"
566
+ })) : (r(), R(ze(C(t).expanded ? l(pa) : l(ma)), {
567
+ key: 1,
568
+ size: 15,
569
+ "aria-hidden": "true"
570
+ }))
571
+ ], !0)
572
+ ], 8, za)) : (r(), h("span", Aa, [
573
+ H(e.$slots, "switcher", B({ ref_for: !0 }, C(t)), void 0, !0)
574
+ ])),
575
+ o.checkable && t.checkable ? (r(), R(xa, {
576
+ key: 2,
577
+ tabindex: -1,
578
+ "model-value": l(W).has(t.key),
579
+ indeterminate: l(fe).has(t.key),
580
+ disabled: l(u) || t.checkboxDisabled,
581
+ "aria-label": l(v).check + " " + t.label,
582
+ onClick: a[0] || (a[0] = X(() => {
583
+ }, ["stop"])),
584
+ "onUpdate:modelValue": (n) => l(ke)(t.key, n, !o.checkStrictly)
585
+ }, null, 8, ["model-value", "indeterminate", "disabled", "aria-label", "onUpdate:modelValue"])) : M("", !0),
586
+ o.showIcon && (t.icon || e.$slots.icon) ? (r(), h("span", $a, [
587
+ H(e.$slots, "icon", B({ ref_for: !0 }, C(t)), () => [
588
+ P(S(t.icon), 1)
589
+ ], !0)
590
+ ])) : M("", !0),
591
+ Y("span", Ia, [
592
+ H(e.$slots, "node", B({ ref_for: !0 }, C(t)), () => [
593
+ H(e.$slots, "default", B({ ref_for: !0 }, C(t)), () => [
594
+ o.renderContent ? (r(), R(ze(() => o.renderContent(C(t))), { key: 0 })) : (r(), h(xe, { key: 1 }, [
595
+ P(S(t.label), 1)
596
+ ], 64))
597
+ ], !0)
598
+ ], !0)
599
+ ]),
600
+ l(Oe).has(t.key) ? (r(), h("button", {
601
+ key: 4,
602
+ type: "button",
603
+ class: "hys-ui-tree-retry",
604
+ disabled: l(u) || t.disabled,
605
+ onClick: X((n) => l(s).reloadNode(t.key), ["stop"])
606
+ }, S(l(v).loadError) + " · " + S(l(v).retry), 9, Va)) : M("", !0),
607
+ e.$slots.actions ? (r(), h("span", {
608
+ key: 5,
609
+ class: "hys-ui-tree-actions",
610
+ onClick: a[1] || (a[1] = X(() => {
611
+ }, ["stop"]))
612
+ }, [
613
+ H(e.$slots, "actions", B({ ref_for: !0 }, C(t)), void 0, !0)
614
+ ])) : M("", !0),
615
+ o.draggable ? (r(), R(l(ba), {
616
+ key: 6,
617
+ class: "hys-ui-tree-grip",
618
+ size: 13,
619
+ "aria-hidden": "true"
620
+ })) : M("", !0)
621
+ ], 46, Sa);
622
+ }), 128))
623
+ ], 4)
624
+ ], 4),
625
+ !l(k).length && !o.loading ? (r(), h("div", Fa, [
626
+ H(e.$slots, "empty", { query: l(q) }, () => [
627
+ P(S(l(q).trim() ? l(v).noMatch : o.emptyText || l(v).empty), 1)
628
+ ], !0)
629
+ ])) : M("", !0)
630
+ ], 46, Ma),
631
+ (r(), R(ka, { to: "body" }, [
632
+ f.value ? (r(), h(xe, { key: 0 }, [
633
+ Y("div", B(l(ce), {
634
+ class: "hys-ui-tree-menu-backdrop",
635
+ onClick: a[3] || (a[3] = (t) => g()),
636
+ onContextmenu: a[4] || (a[4] = X((t) => g(), ["prevent"]))
637
+ }), null, 16),
638
+ Y("div", B({
639
+ ref_key: "menuPanel",
640
+ ref: se
641
+ }, l(ce), {
642
+ class: "hys-ui-tree-context",
643
+ style: { left: f.value.x + "px", top: f.value.y + "px" },
644
+ role: "menu",
645
+ onKeydown: ia
646
+ }), [
647
+ H(e.$slots, "contextmenu", {
648
+ node: f.value.node,
649
+ key: f.value.key,
650
+ close: g
651
+ }, () => {
652
+ var t;
653
+ return [
654
+ w(De, {
655
+ role: "menuitem",
656
+ variant: "ghost",
657
+ disabled: l(u),
658
+ onClick: a[5] || (a[5] = (d) => {
659
+ l(s).setCurrentKey(f.value.key), g();
660
+ })
661
+ }, {
662
+ default: ue(() => [
663
+ P(S(l(v).select), 1)
664
+ ]),
665
+ _: 1
666
+ }, 8, ["disabled"]),
667
+ w(De, {
668
+ role: "menuitem",
669
+ variant: "ghost",
670
+ disabled: l(u) || !((t = l(G).map.get(f.value.key)) != null && t.hasChildren),
671
+ onClick: a[6] || (a[6] = (d) => {
672
+ l(z)(f.value.key, !l(b).has(f.value.key)), g();
673
+ })
674
+ }, {
675
+ default: ue(() => [
676
+ P(S(l(b).has(f.value.key) ? l(v).collapse : l(v).expand), 1)
677
+ ]),
678
+ _: 1
679
+ }, 8, ["disabled"]),
680
+ w(De, {
681
+ role: "menuitem",
682
+ variant: "ghost",
683
+ onClick: a[7] || (a[7] = (d) => g())
684
+ }, {
685
+ default: ue(() => [
686
+ P(S(l(v).close), 1)
687
+ ]),
688
+ _: 1
689
+ })
690
+ ];
691
+ }, !0)
692
+ ], 16)
693
+ ], 64)) : M("", !0)
355
694
  ]))
356
- ], 16));
695
+ ], 16, Ba));
357
696
  }
358
697
  });
359
698
  export {
360
- Ye as default
699
+ Ga as default
361
700
  };