@web-utils/component 4.0.15 → 5.0.0-beta01

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 (307) hide show
  1. package/address-input/index.mjs +76 -76
  2. package/affix/index.mjs +71 -78
  3. package/aside-menu/index.mjs +20 -31
  4. package/avatar/index.mjs +94 -82
  5. package/awesome-button/index.mjs +54 -71
  6. package/capsule-tab/index.mjs +27 -32
  7. package/card/index.mjs +86 -71
  8. package/carousel/index.mjs +45 -34
  9. package/chat/index.mjs +440 -276
  10. package/chunk-file-uploader/index.mjs +2 -445
  11. package/chunk-file-uploader/style.css +1 -1
  12. package/chunks/ChunkFileUploader.C3EA0e5t.mjs +114 -0
  13. package/chunks/EditableTree.C_IJBL5b.mjs +648 -0
  14. package/chunks/ElementBaseInfo.DyuFR6fE.mjs +209 -0
  15. package/chunks/ElementDialog.C0IjriTW.mjs +681 -0
  16. package/chunks/ElementForm.ButuYDPA.mjs +627 -0
  17. package/chunks/ElementListeners.Dg3e_dmp.mjs +656 -0
  18. package/chunks/ElementMultiInstance.Dmi79FqA.mjs +290 -0
  19. package/chunks/ElementOtherConfig.C2AddGTp.mjs +51 -0
  20. package/chunks/ElementProperties.CfV8UF7L.mjs +196 -0
  21. package/chunks/ElementTaskConfig.Bn7ycGGn.mjs +446 -0
  22. package/chunks/FlowCondition.C6PdqOAW.mjs +194 -0
  23. package/chunks/FlowDesigner.uJYFfKpR.mjs +5101 -0
  24. package/chunks/FormBlock.BEENc22F.mjs +117 -0
  25. package/chunks/FormCascader.CaM-oEhv.mjs +1226 -0
  26. package/chunks/FormInputTime.Bg3UIP8H.mjs +1773 -0
  27. package/chunks/FormItem.H9OOvNzT.mjs +90 -0
  28. package/chunks/FormItemGroup.D9eRy-cZ.mjs +147 -0
  29. package/chunks/FormSelect.CanodoAI.mjs +1472 -0
  30. package/chunks/FormSwitch.DTqdaFjv.mjs +296 -0
  31. package/chunks/FormTemp.DiI5EfgK.mjs +139 -0
  32. package/chunks/FyCurd.DMj1dMK9.mjs +2622 -0
  33. package/chunks/FyForm.vgR8ujEF.mjs +904 -0
  34. package/chunks/FyFormDesign.DEWT6LsX.mjs +5600 -0
  35. package/chunks/FyUEditor.D_rEYfll.mjs +221 -0
  36. package/chunks/FyUpload.B2QKfTxF.mjs +504 -0
  37. package/chunks/Keyboard.ItiRy7Gb.mjs +379 -0
  38. package/chunks/MonacoEditor.Bd5Kui-Y.mjs +301 -0
  39. package/chunks/PageableTable.Bujb0NUx.mjs +658 -0
  40. package/chunks/RecordVideo.B35_dLty.mjs +116 -0
  41. package/chunks/SignalAndMessage.CYVzlFuL.mjs +198 -0
  42. package/chunks/SplitPane.Dw96M0Yf.mjs +219 -0
  43. package/chunks/TableColumn.DJYkznbJ.mjs +180 -0
  44. package/chunks/TableView.DyIdIxAg.mjs +484 -0
  45. package/chunks/Toolbar.DHuXJAoG.mjs +219 -0
  46. package/chunks/UserTaskListeners.Bp-2qkHs.mjs +599 -0
  47. package/chunks/VueCron.GfjodnyM.mjs +1766 -0
  48. package/chunks/VueTreeSelect.9Ywl-I8e.mjs +1872 -0
  49. package/chunks/_plugin-vue_export-helper.7vrlOII_.mjs +8 -0
  50. package/chunks/checkbox.emIuFmnt.mjs +437 -0
  51. package/chunks/confirmable-mixin.BBil7dto.mjs +1646 -0
  52. package/chunks/core.DJv6Qrae.mjs +51 -0
  53. package/chunks/dataformat.Bfr4nOcA.mjs +144 -0
  54. package/chunks/dic.DgDfnovD.mjs +116 -0
  55. package/chunks/dictionary.5eKjWeAp.mjs +19 -0
  56. package/chunks/dictionary.DxZxP0ej.mjs +87 -0
  57. package/chunks/event.B4iwtUNO.mjs +4 -0
  58. package/chunks/event.eJ-c1Z3a.mjs +224 -0
  59. package/chunks/focus-trap.DT4GnqQI.mjs +211 -0
  60. package/chunks/form-input.D25eDRMq.mjs +34 -0
  61. package/chunks/form-item.CgmUuw_n.mjs +714 -0
  62. package/chunks/form-pick.Axem0gOO.mjs +7 -0
  63. package/chunks/form-validate.B1KPCHqN.mjs +11 -0
  64. package/chunks/icon.CbS8-322.mjs +259 -0
  65. package/chunks/init.DwpukyOB.mjs +115 -0
  66. package/chunks/input.PejnqwSH.mjs +547 -0
  67. package/chunks/install.yLcn5MLL.mjs +84 -0
  68. package/chunks/message.BCmee5N0.mjs +400 -0
  69. package/chunks/overlay.DubSnqma.mjs +122 -0
  70. package/chunks/packages.BGjydzjm.mjs +56 -0
  71. package/chunks/permission.DgEVNWlh.mjs +16 -0
  72. package/chunks/photo-swipe.BB0SJZg9.mjs +55 -0
  73. package/chunks/radio.BotKXqJr.mjs +274 -0
  74. package/chunks/scroll.CzORc5Zk.mjs +28 -0
  75. package/chunks/scrollbar.CAmrlKi9.mjs +345 -0
  76. package/chunks/slot.C6Ozd2e7.mjs +25 -0
  77. package/chunks/style.BmlGmjpO.mjs +325 -0
  78. package/chunks/sub-table-plus-props.B_lLth3j.mjs +28 -0
  79. package/chunks/tab-mixin.u0EZpx3j.mjs +70 -0
  80. package/chunks/tag.DPi-PLbb.mjs +141 -0
  81. package/chunks/teleport._VGEzK4d.mjs +22 -0
  82. package/chunks/tooltip.D50x7Rva.mjs +1926 -0
  83. package/chunks/typescript.DiWBU4nj.mjs +4 -0
  84. package/chunks/use-aria.BW7nWOl1.mjs +17 -0
  85. package/chunks/use-composition.mUaomyno.mjs +47 -0
  86. package/chunks/use-deprecated.BfDSbZS9.mjs +12 -0
  87. package/chunks/use-empty-values.Dy_r78F6.mjs +263 -0
  88. package/chunks/use-form-item.wsRjehHp.mjs +47 -0
  89. package/chunks/use-global-config.C9hs-O_x.mjs +56 -0
  90. package/chunks/use-id.CFO5NeoV.mjs +15 -0
  91. package/chunks/use-size.DxrwTUwf.mjs +18 -0
  92. package/chunks/util.B3sjVZoZ.mjs +103 -0
  93. package/chunks/util.g-WQEec9.mjs +223 -0
  94. package/chunks/utilSelf.ZED4DmCU.mjs +46 -0
  95. package/chunks/utils.Cs2fYBrT.mjs +60 -0
  96. package/chunks/utils.DsGhtCIO.mjs +14 -0
  97. package/chunks/validator.C4-z_t9p.mjs +5 -0
  98. package/chunks/vnode.D_SioRnx.mjs +14 -0
  99. package/code-mirror-editor/index.mjs +89 -88
  100. package/comment/index.mjs +62 -57
  101. package/configComponents.mjs +40 -50
  102. package/confirm-button/index.mjs +34 -46
  103. package/confirmable/index.mjs +7 -17
  104. package/context-menu/index.mjs +195 -174
  105. package/count-up/index.mjs +97 -105
  106. package/custom-scrollbar/index.mjs +91 -98
  107. package/data-box/index.mjs +64 -47
  108. package/data-card/index.mjs +60 -49
  109. package/data-card-text/index.mjs +63 -51
  110. package/data-display/index.mjs +71 -53
  111. package/data-icons/index.mjs +70 -53
  112. package/data-imgtext/index.mjs +67 -46
  113. package/data-operatext/index.mjs +51 -42
  114. package/data-panel/index.mjs +57 -47
  115. package/data-pay/index.mjs +105 -52
  116. package/data-price/index.mjs +48 -42
  117. package/data-progress/index.mjs +67 -48
  118. package/data-rotate/index.mjs +61 -47
  119. package/data-table-picker/index.mjs +119 -74
  120. package/data-tabs/index.mjs +67 -47
  121. package/dialog-form/index.mjs +139 -89
  122. package/dynamic-table/index.mjs +166 -114
  123. package/e-charts/index.mjs +174 -200
  124. package/easy-popup/index.mjs +91 -102
  125. package/editable-progress/index.mjs +112 -85
  126. package/editable-tree/index.mjs +2 -485
  127. package/element-dialog/index.mjs +2 -307
  128. package/element-listeners/style.css +1 -0
  129. package/element-multi-instance/style.css +1 -0
  130. package/ellipsis/index.mjs +124 -148
  131. package/empty-view/index.mjs +48 -65
  132. package/error-view/index.mjs +39 -51
  133. package/flex-column/index.mjs +32 -51
  134. package/flex-item/index.mjs +54 -64
  135. package/flex-row/index.mjs +32 -39
  136. package/flex-scroller/index.mjs +29 -30
  137. package/flow/index.mjs +240 -248
  138. package/flow-designer/index.mjs +2 -5983
  139. package/flow-designer/style.css +1 -1
  140. package/flow-node/index.mjs +56 -64
  141. package/flow-viewer/index.mjs +159 -157
  142. package/form-block/index.mjs +2 -149
  143. package/form-button/index.mjs +35 -47
  144. package/form-card/index.mjs +14 -25
  145. package/form-cascader/index.mjs +2 -116
  146. package/form-checkbox/index.mjs +89 -71
  147. package/form-checkbox-group/index.mjs +161 -116
  148. package/form-date-picker/index.mjs +155 -144
  149. package/form-holder/index.mjs +137 -110
  150. package/form-input/index.mjs +113 -87
  151. package/form-input-cron-expression/index.mjs +97 -79
  152. package/form-input-email/index.mjs +64 -52
  153. package/form-input-id-card/index.mjs +72 -55
  154. package/form-input-phone-number/index.mjs +71 -57
  155. package/form-input-tag/index.mjs +88 -62
  156. package/form-input-time/index.mjs +2 -74
  157. package/form-item/index.mjs +2 -5
  158. package/form-item-config-provider/index.mjs +46 -60
  159. package/form-item-group/index.mjs +2 -160
  160. package/form-radio-group/index.mjs +161 -122
  161. package/form-select/index.mjs +2 -181
  162. package/form-switch/index.mjs +2 -55
  163. package/form-table/index.mjs +131 -85
  164. package/form-table-plus/index.mjs +164 -109
  165. package/form-textarea/index.mjs +90 -57
  166. package/form-tree-select/index.mjs +89 -72
  167. package/form-tree-select-multiple/index.mjs +92 -78
  168. package/form-view/index.mjs +275 -211
  169. package/fy-array/index.mjs +121 -74
  170. package/fy-article/index.mjs +73 -60
  171. package/fy-cascader/index.mjs +113 -91
  172. package/fy-checkbox/index.mjs +96 -66
  173. package/fy-code/index.mjs +48 -50
  174. package/fy-curd/index.mjs +2 -1903
  175. package/fy-date/index.mjs +76 -42
  176. package/fy-draggable/index.mjs +322 -318
  177. package/fy-dynamic/index.mjs +259 -227
  178. package/fy-empty/index.mjs +35 -36
  179. package/fy-form/index.mjs +2 -17
  180. package/fy-form-design/index.mjs +2 -2890
  181. package/fy-form-design/style.css +1 -1
  182. package/fy-from/crud/zh.d.ts +6 -6
  183. package/fy-input/index.mjs +117 -99
  184. package/fy-input-color/index.mjs +77 -56
  185. package/fy-input-icon/index.mjs +129 -85
  186. package/fy-input-map/index.mjs +242 -186
  187. package/fy-input-number/index.mjs +74 -50
  188. package/fy-input-table/index.mjs +160 -109
  189. package/fy-input-tree/index.mjs +259 -182
  190. package/fy-progress/index.mjs +36 -40
  191. package/fy-radio/index.mjs +53 -38
  192. package/fy-rate/index.mjs +86 -71
  193. package/fy-select/index.mjs +223 -140
  194. package/fy-slider/index.mjs +68 -44
  195. package/fy-switch/index.mjs +67 -42
  196. package/fy-tabs/index.mjs +46 -48
  197. package/fy-time/index.mjs +81 -53
  198. package/fy-title/index.mjs +18 -27
  199. package/fy-tree/index.mjs +382 -292
  200. package/fy-u-editor/index.mjs +2 -357
  201. package/fy-upload/index.mjs +2 -423
  202. package/guide-steps/index.mjs +72 -73
  203. package/helper-function.d.ts +2 -30
  204. package/helper-function.mjs +41 -67
  205. package/highlight-j-s/index.mjs +50 -59
  206. package/icon-card/index.mjs +34 -36
  207. package/icon-temp/index.mjs +27 -27
  208. package/iframe-window/index.mjs +39 -33
  209. package/image-cropper/index.mjs +171 -75
  210. package/image-preview/index.mjs +187 -118
  211. package/image-viewer/index.mjs +69 -66
  212. package/index.d.ts +3 -9
  213. package/index.mjs +173 -488
  214. package/input-number-range/index.mjs +78 -59
  215. package/j-s-x-component/index.mjs +13 -15
  216. package/keyboard/index.mjs +2 -369
  217. package/license/index.mjs +106 -115
  218. package/loading-view/index.mjs +39 -51
  219. package/login/index.mjs +252 -125
  220. package/monaco-editor/index.mjs +2 -7
  221. package/name-avatar/index.mjs +61 -53
  222. package/nav-bar/index.mjs +33 -31
  223. package/not-implement/index.mjs +10 -22
  224. package/notice/index.mjs +100 -94
  225. package/package.json +3 -3
  226. package/page/index.mjs +18 -25
  227. package/page-header/index.mjs +27 -33
  228. package/page-index/index.mjs +121 -100
  229. package/page-index-top/index.mjs +79 -79
  230. package/page-skeleton/index.mjs +48 -45
  231. package/page-skeleton-new/index.mjs +79 -50
  232. package/pageable-table/index.mjs +2 -522
  233. package/pageable-view/index.mjs +279 -275
  234. package/photo-swipe/index.d.ts +4 -0
  235. package/photo-swipe/index.mjs +33 -36
  236. package/picker-table-view/index.mjs +224 -126
  237. package/present-view/index.mjs +266 -200
  238. package/queue/index.mjs +45 -53
  239. package/record-video/index.mjs +2 -134
  240. package/resize-observer/index.mjs +43 -46
  241. package/search/index.mjs +116 -109
  242. package/sign/index.mjs +103 -110
  243. package/sign-panel/index.mjs +182 -141
  244. package/skeleton/index.mjs +51 -54
  245. package/skeleton-panel/index.mjs +33 -38
  246. package/split-pane/index.mjs +3 -197
  247. package/stateful/index.mjs +69 -73
  248. package/static-pageable-table/index.mjs +72 -66
  249. package/sub-table/index.mjs +508 -219
  250. package/sub-table-plus/index.mjs +592 -19
  251. package/swiper/index.mjs +128 -121
  252. package/tab/index.mjs +117 -119
  253. package/tab-item/index.mjs +48 -56
  254. package/table-column/index.mjs +2 -5
  255. package/table-view/index.mjs +3 -334
  256. package/tabs-view/index.mjs +109 -106
  257. package/tag-render/index.mjs +79 -69
  258. package/text-ellipsis/index.mjs +94 -78
  259. package/toolbar/index.mjs +2 -255
  260. package/toolbar-button/index.mjs +145 -121
  261. package/verify/index.mjs +58 -64
  262. package/vue-cron/index.mjs +2 -1188
  263. package/vue-qr-code/index.mjs +30 -54
  264. package/vue-quill-editor/index.mjs +123 -99
  265. package/vue-tags-input/index.mjs +348 -431
  266. package/vue-tree-select/index.mjs +2 -2627
  267. package/vue-video-player/index.mjs +135 -136
  268. package/watermark/index.mjs +46 -74
  269. package/web-types.json +197 -975
  270. package/x-input-tag/index.mjs +144 -109
  271. package/chunks/ElementTaskConfig.AvBOzAni.mjs +0 -325
  272. package/chunks/FormItem.Bhsy_O2B.mjs +0 -372
  273. package/chunks/FyForm.DriwCJ7b.mjs +0 -765
  274. package/chunks/MonacoEditor.D31t4FTy.mjs +0 -327
  275. package/chunks/SignalAndMessage.BpjOoKhK.mjs +0 -92
  276. package/chunks/SubTablePlus.BH0IIv3X.mjs +0 -270
  277. package/chunks/TableColumn.BzivvXMF.mjs +0 -337
  278. package/chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs +0 -10
  279. package/chunks/confirmable-mixin.BFZb6pcK.mjs +0 -86
  280. package/chunks/dataformat.DJoNBlmI.mjs +0 -154
  281. package/chunks/dic.BinnDitI.mjs +0 -128
  282. package/chunks/dictionary.DqiP9x2m.mjs +0 -25
  283. package/chunks/event.DSlcqYHL.mjs +0 -236
  284. package/chunks/form-input.BtS_J5a2.mjs +0 -31
  285. package/chunks/form-pick.BFTIVn_i.mjs +0 -11
  286. package/chunks/form-validate.CVarNHKX.mjs +0 -12
  287. package/chunks/helper.BiMLcEEk.mjs +0 -41
  288. package/chunks/index.BmYCjxZQ.mjs +0 -47
  289. package/chunks/index.CIfe3UB3.mjs +0 -16
  290. package/chunks/index.Cn7aq-Et.mjs +0 -184
  291. package/chunks/init.xOlFpTyZ.mjs +0 -122
  292. package/chunks/packages.ByyangTp.mjs +0 -58
  293. package/chunks/permission.CO31YIkD.mjs +0 -16
  294. package/chunks/slot.DXIbhGat.mjs +0 -27
  295. package/chunks/tab-mixin.BNK6dxLN.mjs +0 -81
  296. package/chunks/util.DI42t5GU.mjs +0 -241
  297. package/color-picker/index.mjs +0 -157
  298. package/egd-collapse/index.mjs +0 -62
  299. package/egd-collapse-item/index.mjs +0 -72
  300. package/form-input-number/index.mjs +0 -70
  301. package/form-input-number/style.css +0 -1
  302. package/input-number/index.mjs +0 -233
  303. package/input-number/style.css +0 -1
  304. package/keep-view-alive/index.mjs +0 -117
  305. package/search-popover/index.mjs +0 -118
  306. package/search-popover/style.css +0 -1
  307. /package/{base.css → utils/style.css} +0 -0
@@ -1,485 +1,2 @@
1
- import r from "element-ui/lib/button";
2
- import y from "element-ui/lib/input";
3
- import x from "element-ui/lib/popconfirm";
4
- import w from "element-ui/lib/tree";
5
- import { findTreeChildren as N, delay as C, isUndefined as d, isNotEmpty as g, fastClone as v, isPlainObject as l, isFunction as u, computePosition as $, isVerticalScrollbarVisible as b, scrollbarWidth as _, hasOwn as c } from "@web-utils/core";
6
- import { removeResizeListener as p, addResizeListener as f } from "@web-utils/integrations/resize";
7
- import { cloneDeep as m } from "@web-utils/integrations/lodash";
8
- import { c as k, d as B } from "../chunks/index.Cn7aq-Et.mjs";
9
- import T from "vue";
10
- import { n as K } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
11
- function h(t, e) {
12
- for (const i in e)
13
- T.set(t, i, e[i]);
14
- return t;
15
- }
16
- const M = {
17
- name: "EditableTree",
18
- props: {
19
- label: {
20
- type: String,
21
- default: "书签"
22
- },
23
- addRootNodeLabel: {
24
- type: String
25
- },
26
- defaultExpandedKeys: {
27
- type: Array,
28
- default: () => []
29
- },
30
- newNodeBuilder: {
31
- type: Function,
32
- default: (t, e) => ({
33
- name: t,
34
- parentId: e.id
35
- })
36
- },
37
- contextMenu: Boolean,
38
- lazy: {
39
- type: Boolean,
40
- default: !0
41
- },
42
- expandFirstNode: {
43
- type: Boolean,
44
- default: !0
45
- },
46
- readonly: Boolean,
47
- saveApi: {
48
- type: Function
49
- },
50
- updateApi: {
51
- type: Function
52
- },
53
- deleteApi: {
54
- type: Function
55
- },
56
- fetchApi: {
57
- type: Function
58
- },
59
- customRootNode: {
60
- type: {
61
- type: Object,
62
- default: void 0
63
- }
64
- },
65
- rootNode: {
66
- type: Object
67
- },
68
- contextMenuIcon: Boolean,
69
- contextMenuInline: Boolean,
70
- treeProps: {
71
- type: Object,
72
- default: () => ({
73
- children: "children",
74
- label: "name",
75
- isLeaf: (t) => c(t, "hasChildren") ? !t.hasChildren : c(t, "hasChild") ? !t.hasChild : c(t, "children") && t.children ? t.children.length === 0 : !0
76
- })
77
- },
78
- menuLabel: {
79
- type: Object,
80
- default: () => ({
81
- appendPeer: "添加同级节点",
82
- appendChild: "添加",
83
- removeNode: "删除",
84
- editNode: "修改"
85
- })
86
- },
87
- icon: {
88
- type: [Function, Boolean],
89
- default: () => "el-icon-collection-tag"
90
- },
91
- confirmButton: {
92
- type: Boolean,
93
- default: !0
94
- },
95
- addRootNodeButtonStyle: {
96
- type: String,
97
- default: "top"
98
- },
99
- reserveExpandKey: Boolean,
100
- nodeKey: {
101
- type: String,
102
- default: "id"
103
- }
104
- },
105
- data() {
106
- return {
107
- loading: !1,
108
- showMenu: !1,
109
- empty: !0,
110
- expandedKeys: this.lazy ? [] : this.defaultExpandedKeys,
111
- treeData: [],
112
- curNode: {},
113
- curData: {},
114
- position: {},
115
- text: "",
116
- right: 4,
117
- treeKey: Date.now()
118
- };
119
- },
120
- computed: {
121
- defaultOptions() {
122
- return {
123
- confirmButtonText: "确定",
124
- cancelButtonText: "取消",
125
- closeOnClickModal: !1,
126
- modal: !0,
127
- inputErrorMessage: `${this.label}名不能为空!`,
128
- inputPlaceholder: `请输入${this.label}名...`,
129
- inputValidator: (t) => t != null && t.trim().length > 0
130
- };
131
- },
132
- innerTreeData() {
133
- var t;
134
- return (t = this.$attrs.data) != null && t.length ? this.$attrs.data : this.treeData;
135
- }
136
- },
137
- watch: {
138
- defaultExpandedKeys: {
139
- immediate: !0,
140
- handler(t) {
141
- this.expandedKeys = [...t];
142
- }
143
- }
144
- },
145
- created() {
146
- this.tryFetch();
147
- },
148
- mounted() {
149
- f(this.$refs.tree.$el, this.resize), f(this.$refs.treeWrapper, this.resize);
150
- },
151
- beforeDestroy() {
152
- p(this.$refs.tree.$el, this.resize), p(this.$refs.treeWrapper, this.resize);
153
- },
154
- methods: {
155
- filterTreeProperties: B,
156
- filterTreeEvents: k,
157
- addExpandKey(t) {
158
- this.reserveExpandKey && this.expandedKeys.push(t[this.nodeKey]);
159
- },
160
- removeExpandKey(t) {
161
- this.reserveExpandKey && (this.expandedKeys = this.expandedKeys.filter((e) => e !== t[this.nodeKey]));
162
- },
163
- resize() {
164
- b(this.$refs.treeWrapper) ? this.right = 4 + _ : this.right = 4;
165
- },
166
- async showContextMenu(t, e, i) {
167
- e.contextmenu === !1 || e.id === -1 || e.id === 0 || e.edit === !0 || this.contextMenu && (this.curNode = i, this.curData = e, this.showMenu = !0, this.$refs.tree.setCurrentKey(e.id), await this.$nextTick(), this.position = $(t, this.$refs.contextMenu), window.addEventListener("click", this.hideContextMenu));
168
- },
169
- hideContextMenu() {
170
- this.showMenu = !1, window.removeEventListener("click", this.hideContextMenu);
171
- },
172
- async tryFetch() {
173
- var t;
174
- if (this.lazy === !1 && this.fetchApi) {
175
- const e = await this.fetchApi(((t = this.rootNode) == null ? void 0 : t.id) ?? -1, {});
176
- if (l(e.data) && (e.data = [e.data]), e.data = e.data || [], this.empty = e.data.length === 0, l(this.customRootNode)) {
177
- const i = m(this.customRootNode);
178
- i[this.treeProps.children || "children"] = e.data, this.treeData = [i];
179
- } else if (u(this.customRootNode)) {
180
- const i = this.customRootNode(e.data);
181
- i[this.treeProps.children || "children"] = e.data, this.treeData = l(i) ? [i] : i;
182
- } else
183
- this.treeData = e.data;
184
- }
185
- },
186
- async loadNode(t, e) {
187
- var i, s, n;
188
- if (t.level === 0) {
189
- const o = await this.fetchApi(((i = this.rootNode) == null ? void 0 : i.id) ?? -1, t);
190
- if (this.empty = o.data.length === 0, l(this.customRootNode)) {
191
- const a = m(this.customRootNode);
192
- a[this.treeProps.children || "children"] = o.data, e([a]);
193
- } else if (u(this.customRootNode)) {
194
- const a = this.customRootNode(o.data);
195
- a[this.treeProps.children || "children"] = o.data, this.treeData = l(a) ? [a] : a;
196
- } else
197
- e(o.data);
198
- await this.$nextTick(), this.$emit("root-node-loaded", o.data), this.defaultExpandedKeys ? this.expandedKeys = [(s = o == null ? void 0 : o.data[0]) == null ? void 0 : s.id, ...this.defaultExpandedKeys] : this.expandFirstNode && (this.expandedKeys = [(n = o == null ? void 0 : o.data[0]) == null ? void 0 : n.id]);
199
- } else {
200
- if (t.leaf || t.data.isTempNode)
201
- return e([]);
202
- const o = await this.fetchApi(t.data.id, t);
203
- e(o.data), await this.$nextTick(), this.$emit("node-loaded", o.data);
204
- }
205
- },
206
- clear() {
207
- this.cancelEdit(), this.removeNewNode();
208
- },
209
- clearChecked() {
210
- this.$refs.tree.setCheckedKeys([]);
211
- },
212
- removeNewNode() {
213
- this.newChild && this.newChild.id === -1 && (console.log(this.newChild), this.$refs.tree.remove(this.newChild), this.$emit("remove-new-node"));
214
- },
215
- cancelEdit() {
216
- this.editData && (d(this.editData.edit) ? this.$set(this.editData, "edit", !0) : this.editData.edit = !1);
217
- },
218
- async editNode(t, e) {
219
- !this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.editData = e, this.text = e[this.treeProps.label], d(e.edit) ? this.$set(e, "edit", !0) : e.edit = !0, await this.$nextTick(), this.$refs.labelTxt.focus()) : await this.$prompt(`请输入新的${this.label}名:`, {
220
- ...this.defaultOptions,
221
- inputValue: e[this.treeProps.label],
222
- beforeClose: async (i, s, n) => {
223
- if (i === "confirm") {
224
- try {
225
- s.confirmButtonLoading = !0, s.confirmButtonText = "处理中...", this.text = s.inputValue, await this.onConfirm(this.curNode, this.curData), n();
226
- } catch {
227
- s.confirmButtonText = "确定";
228
- }
229
- s.confirmButtonLoading = !1;
230
- } else
231
- n();
232
- }
233
- }).catch((i) => i);
234
- },
235
- async appendRootNode() {
236
- this.text = "", !this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.createNewChild(void 0), this.$refs.tree.root.insertChild({ data: this.newChild }, void 0, !0), await this.scrollIntoView(!0)) : await this.$prompt(`请输入${this.label}名:`, {
237
- ...this.defaultOptions,
238
- beforeClose: async (t, e, i) => {
239
- if (t === "confirm") {
240
- try {
241
- this.createNewChild(-1), e.confirmButtonLoading = !0, e.confirmButtonText = "处理中...";
242
- const s = await this.saveApi(this.newNodeBuilder(e.inputValue, { id: -1 }));
243
- this.newChild[this.treeProps.label] = e.inputValue, this.newChild.edit = !1, h(this.newChild, s.data), this.$refs.tree.root.insertChild({ data: this.newChild }, void 0, !0), await this.locateView(), i();
244
- } catch {
245
- e.confirmButtonText = "确定";
246
- }
247
- e.confirmButtonLoading = !1;
248
- } else
249
- i();
250
- }
251
- }).catch((t) => t);
252
- },
253
- appendChildNode(t) {
254
- this.text = "";
255
- const e = t.expanded;
256
- t.expand(async () => {
257
- !this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.createNewChild(t.data.id), this.$refs.tree.append(this.newChild, t), await this.scrollIntoView(e)) : await this.$prompt(`请输入${this.label}名:`, {
258
- ...this.defaultOptions,
259
- beforeClose: async (i, s, n) => {
260
- if (i === "confirm") {
261
- try {
262
- this.createNewChild(t.data.id), s.confirmButtonLoading = !0, s.confirmButtonText = "处理中...";
263
- const o = await this.saveApi(this.newNodeBuilder(s.inputValue, t.data));
264
- this.newChild[this.treeProps.label] = s.inputValue, this.newChild.edit = !1, h(this.newChild, o.data), this.$refs.tree.append(this.newChild, t), await this.locateView(), n();
265
- } catch {
266
- s.confirmButtonText = "确定";
267
- }
268
- s.confirmButtonLoading = !1;
269
- } else
270
- n();
271
- }
272
- }).catch((i) => i);
273
- });
274
- },
275
- appendChildNodeWithData(t, e, i) {
276
- this.text = "";
277
- const s = t.expanded;
278
- t.expand(async () => {
279
- this.clear(), this.newChild = {
280
- id: -1,
281
- parentId: e,
282
- [this.treeProps.label]: i,
283
- edit: !1,
284
- isTempNode: !0,
285
- hasChildren: !1
286
- }, this.$refs.tree.append(this.newChild, t), await this.scrollIntoView(s);
287
- });
288
- },
289
- appendPeerNode(t) {
290
- t.parent && t.parent.level !== 0 ? this.appendChildNode(t.parent) : this.appendRootNode();
291
- },
292
- async addRootNode(t) {
293
- this.$refs.tree.remove(t), await this.$nextTick(), this.$refs.tree.root.insertChild({ data: t }, void 0, !0);
294
- },
295
- async addChildNode(t) {
296
- this.curNode && this.curNode.level !== 0 ? this.curNode.expand(async () => {
297
- this.$refs.tree.remove(t), await this.$nextTick(), this.$refs.tree.append(t, this.curNode);
298
- }) : await this.addRootNode(t);
299
- },
300
- async addPeerNode(t) {
301
- this.curNode && this.curNode.parent && this.curNode.parent.level !== 0 ? this.curNode.parent.expand(async () => {
302
- this.$refs.tree.remove(t), await this.$nextTick(), this.$refs.tree.append(t, this.curNode.parent);
303
- }) : await this.addRootNode(t);
304
- },
305
- updateNode(t) {
306
- const e = this.$refs.tree.getNode(t);
307
- e && (e.data = t);
308
- },
309
- setCurrentKey(t) {
310
- var e;
311
- (e = this.$refs.tree) == null || e.setCurrentKey(t);
312
- },
313
- createNewChild(t) {
314
- this.newChild = {
315
- id: -1,
316
- parentId: t,
317
- [this.treeProps.label]: "",
318
- edit: !0,
319
- isTempNode: !0,
320
- hasChildren: !1
321
- }, this.$emit("create-new-node", this.newChild);
322
- },
323
- async removeNodeModal(t) {
324
- await this.$confirm(
325
- `你确定要删除${this.label}[<span class="break-word" style="color: orange">${t.data[this.treeProps.label]}</span>]吗?`,
326
- "系统提示",
327
- {
328
- type: "warning",
329
- modal: !0,
330
- dangerouslyUseHTMLString: !0,
331
- iconClass: "el-icon-question",
332
- closeOnClickModal: !1,
333
- confirmButtonClass: "el-button--danger",
334
- cancelButtonClass: "el-button--primary is-plain",
335
- beforeClose: async (e, i, s) => {
336
- if (e === "confirm") {
337
- try {
338
- i.confirmButtonLoading = !0, i.confirmButtonText = "删除...";
339
- const n = t.parent, o = await this.deleteApi(t.data.id);
340
- o.code === 0 ? (this.$message.success("删除成功!"), this.$refs.tree.remove(t), this.$emit("node-deleted", n, t.data), s()) : this.$message.error(o.message);
341
- } catch {
342
- }
343
- i.confirmButtonText = "确定", i.confirmButtonLoading = !1;
344
- } else
345
- s();
346
- }
347
- }
348
- ).catch((e) => e);
349
- },
350
- async removeNode(t) {
351
- try {
352
- const e = t.parent;
353
- if (this.deleteApi) {
354
- const i = await this.deleteApi(t.data.id);
355
- i.code === 0 ? (this.$message.success("删除成功!"), this.$refs.tree.remove(t), this.$emit("node-deleted", e, t.data)) : this.$message.error(i.message);
356
- } else
357
- this.$refs.tree.remove(t);
358
- } catch {
359
- }
360
- },
361
- async onConfirm(t, e) {
362
- if (e[this.treeProps.label] === this.text || !g(this.text)) {
363
- this.clear();
364
- return;
365
- }
366
- d(e.loading) ? this.$set(e, "loading", !0) : e.loading = !0;
367
- try {
368
- if (this.loading = !0, e.id === -1) {
369
- const i = await this.saveApi(this.newNodeBuilder(this.text, t.parent.data || { id: -1 })), s = v(e);
370
- h(e, { ...i.data, isTempNode: !1 }), this.$emit("node-added", e, s, t), this.registerNode(t);
371
- } else
372
- await this.updateApi({ ...e, [this.treeProps.label]: this.text });
373
- e[this.treeProps.label] = this.text, e.edit = !1, this.$emit("node-updated", e, t), this.text = "";
374
- } catch {
375
- }
376
- e.loading = !1, this.loading = !1;
377
- },
378
- onCancel(t, e) {
379
- e.id === -1 ? this.$refs.tree.remove(t) : e.edit = !1, this.text = "";
380
- },
381
- nodeClick(t, e, i) {
382
- this.hideContextMenu(), (d(t.loading) || !t.loading) && (this.curNode = e, this.curData = t, this.$emit("on-node-click", t, e, i));
383
- },
384
- getCurrentNode() {
385
- return this.$refs.tree.getCurrentNode();
386
- },
387
- async locateView() {
388
- await this.$nextTick();
389
- const t = this.$el.querySelector(`[data-id="${this.newChild.id}"]`);
390
- t && t.scrollIntoView();
391
- },
392
- async scrollIntoView(t) {
393
- var e, i;
394
- await this.$nextTick(), t || await C(300), (i = (e = this.$refs) == null ? void 0 : e.labelTxt) == null || i.focus();
395
- },
396
- inputKeyup(t, e, i) {
397
- t.keyCode === 13 && this.onConfirm(e, i), t.keyCode === 27 && this.clear();
398
- },
399
- inputBlur(t, e, i) {
400
- this.confirmButton || this.onConfirm(e, i);
401
- },
402
- getCheckedKeys() {
403
- return this.$refs.tree.getCheckedKeys();
404
- },
405
- setCheckedKeys(t) {
406
- this.$refs.tree.setCheckedKeys(t);
407
- },
408
- getCheckedNodes() {
409
- return this.$refs.tree.getCheckedNodes();
410
- },
411
- setCheckedNodes(t) {
412
- this.$refs.tree.setCheckedNodes(t);
413
- },
414
- getNode(t) {
415
- return this.$refs.tree.getNode(t);
416
- },
417
- getRootNode() {
418
- return this.$refs.tree.root;
419
- },
420
- findTreeNode(t) {
421
- return N(this.$refs.tree.root.childNodes, (e) => e.data === t || e.data.id === t, "childNodes");
422
- },
423
- registerNode(t) {
424
- t.store.registerNode(t), delete t.store.nodesMap[-1];
425
- },
426
- async reloadTree() {
427
- this.lazy ? this.treeKey = Date.now() : await this.tryFetch();
428
- }
429
- }
430
- };
431
- var P = function() {
432
- var e = this, i = e._self._c;
433
- return i("div", { staticClass: "editable-tree" }, [!e.readonly && e.addRootNodeButtonStyle === "top-right" ? i(r, { staticStyle: { position: "absolute", top: "4px", "z-index": "1" }, style: { right: `${e.right}px` }, attrs: { type: "primary", size: "mini", icon: "el-icon-plus", circle: "", plain: "" }, on: { click: function(s) {
434
- return s.stopPropagation(), e.$emit("add-root-node");
435
- } } }) : e._e(), i("div", { ref: "treeWrapper", staticClass: "et-tree-wrapper" }, [!e.readonly && e.addRootNodeButtonStyle === "top" ? i("div", { staticStyle: { "padding-left": "24px" } }, [i(r, { attrs: { disabled: e.loading, size: "mini", type: "text" }, on: { click: e.appendRootNode } }, [i("i", { staticClass: "el-icon-lx-add" }), e._v(" " + e._s(e.addRootNodeLabel ? e.addRootNodeLabel : `添加${e.label}`) + " ")])], 1) : e._e(), i(w, e._g(e._b({ key: e.treeKey, ref: "tree", staticClass: "flex-item", attrs: { "default-expanded-keys": e.expandedKeys, "expand-on-click-node": !1, "highlight-current": "", load: e.loadNode, data: e.innerTreeData, props: e.treeProps, lazy: e.lazy, "node-key": e.nodeKey }, on: { "node-click": e.nodeClick, "node-contextmenu": e.showContextMenu, "node-expand": e.addExpandKey, "node-collapse": e.removeExpandKey }, scopedSlots: e._u([{ key: "default", fn: function({ node: s, data: n }) {
436
- return [e._t("default", function() {
437
- return [n.edit ? [i("span", { staticClass: "custom-tree-node flex-row flex-item oh", attrs: { "data-id": n.id } }, [e.icon ? i("i", { staticClass: "node-icon shrink-0", class: n.loading ? "el-icon-loading" : "el-icon-edit-outline" }) : e._e(), i(y, { ref: "labelTxt", staticClass: "node-input flex-item", attrs: { size: "mini", placeholder: e.defaultOptions.inputPlaceholder }, on: { blur: (o) => e.inputBlur(o, s, n) }, nativeOn: { keyup: function(o) {
438
- return ((a) => e.inputKeyup(a, s, n)).apply(null, arguments);
439
- }, click: function(o) {
440
- o.stopPropagation();
441
- } }, model: { value: e.text, callback: function(o) {
442
- e.text = o;
443
- }, expression: "text" } }), e.confirmButton ? [i(r, { directives: [{ name: "show", rawName: "v-show", value: !n.loading, expression: "!data.loading" }], staticClass: "shrink-0", attrs: { size: "mini", type: "text" }, on: { click: function(o) {
444
- return o.stopPropagation(), e.onConfirm(s, n);
445
- } } }, [e._v("确定")]), i(r, { directives: [{ name: "show", rawName: "v-show", value: !n.loading, expression: "!data.loading" }], staticClass: "shrink-0", attrs: { size: "mini", type: "text" }, on: { click: function(o) {
446
- return o.stopPropagation(), e.onCancel(s, n);
447
- } } }, [e._v("取消")])] : e._e()], 2)] : [i("span", { staticClass: "custom-tree-node", attrs: { "data-id": n.id } }, [i("span", { staticClass: "node-label flex-row flex-item oh ellipsis-1" }, [e.icon ? i("i", { staticClass: "node-icon", class: n.loading ? "el-icon-loading" : e.icon(n, s) }) : e._e(), i("span", { staticClass: "flex-item-relative", staticStyle: { height: "21px" } }, [i("span", { staticClass: "ellipsis-1 absolute-box et-tree-label", attrs: { title: s.label } }, [e._t("label", function() {
448
- return [e._v(e._s(s.label))];
449
- }, { data: n, node: s })], 2)]), e._t("label-suffix", null, { node: s, data: n })], 2), !e.contextMenu && !e.readonly ? i("span", { directives: [{ name: "show", rawName: "v-show", value: !n.loading && !e.loading, expression: "!data.loading && !loading" }], staticClass: "handle-actions" }, [i(r, { attrs: { size: "mini", type: "text" }, on: { click: function(o) {
450
- return o.stopPropagation(), e.appendChildNode(s, n);
451
- } } }, [e._v("添加")]), i(r, { attrs: { size: "mini", type: "text" }, on: { click: function(o) {
452
- return o.stopPropagation(), e.editNode(s, n);
453
- } } }, [e._v("修改")]), i(x, { staticClass: "pop-confirm", attrs: { "icon-color": "red", title: "你确定要删除吗?" }, on: { confirm: function(o) {
454
- return e.removeNode(s, n);
455
- } }, scopedSlots: e._u([{ key: "reference", fn: function() {
456
- return [i(r, { directives: [{ name: "show", rawName: "v-show", value: s.isLeaf, expression: "node.isLeaf" }], staticStyle: { "margin-left": "4px" }, attrs: { size: "mini", type: "text" }, on: { click: function(o) {
457
- o.stopPropagation();
458
- } } }, [e._v("删除")])];
459
- }, proxy: !0 }], null, !0) })], 1) : e._e(), e.contextMenuIcon && e.contextMenu && !e.readonly ? i("span", { directives: [{ name: "show", rawName: "v-show", value: !n.loading && !e.loading, expression: "!data.loading && !loading" }], staticClass: "handle-actions", staticStyle: { display: "inline-block" } }, [i(r, { staticStyle: { padding: "6px 10px 0" }, attrs: { size: "mini", type: "text" }, on: { click: function(o) {
460
- return o.stopPropagation(), e.showContextMenu(o, n, s);
461
- } } }, [e._v(". . .")])], 1) : e._e()])]];
462
- }, { node: s, data: n })];
463
- } }], null, !0) }, "ElTree", e.filterTreeProperties(e.$attrs), !1), e.filterTreeEvents(e.$listeners))), e.contextMenu && !e.readonly ? i("div", { directives: [{ name: "show", rawName: "v-show", value: e.showMenu, expression: "showMenu" }], ref: "contextMenu", staticClass: "menu", style: e.position }, [i("ul", { staticClass: "menu-list" }, [e._t("context-menu", function() {
464
- return [i("li", { directives: [{ name: "show", rawName: "v-show", value: e.curData.id > -1, expression: "curData.id > -1" }], staticClass: "menu-item", on: { click: function(s) {
465
- return e.appendPeerNode(e.curNode, e.curData);
466
- } } }, [i("i", { staticClass: "menu-item-icon el-icon-lx-add", staticStyle: { color: "#228b22" } }), e._v(e._s(e.menuLabel.appendPeer) + " ")]), i("li", { staticClass: "menu-item", on: { click: function(s) {
467
- return e.appendChildNode(e.curNode, e.curData);
468
- } } }, [i("i", { staticClass: "menu-item-icon el-icon-lx-add", staticStyle: { color: "#228b22" } }), e._v(e._s(e.menuLabel.appendChild) + " ")]), i("li", { directives: [{ name: "show", rawName: "v-show", value: e.curData.id > -1, expression: "curData.id > -1" }], staticClass: "menu-item", on: { click: function(s) {
469
- return e.editNode(e.curNode, e.curData);
470
- } } }, [i("i", { staticClass: "menu-item-icon el-icon-edit-outline", staticStyle: { color: "#ffa500" } }), e._v(e._s(e.menuLabel.editNode) + " ")]), i("li", { directives: [{ name: "show", rawName: "v-show", value: e.curNode.isLeaf, expression: "curNode.isLeaf" }], staticClass: "menu-item", on: { click: function(s) {
471
- return e.removeNodeModal(e.curNode, e.curData);
472
- } } }, [i("i", { staticClass: "menu-item-icon el-icon-delete", staticStyle: { color: "#f00" } }), e._v(e._s(e.menuLabel.removeNode) + " ")])];
473
- }, { curNode: e.curNode, curData: e.curData })], 2)]) : e._e()], 1)], 1);
474
- }, D = [], L = /* @__PURE__ */ K(
475
- M,
476
- P,
477
- D,
478
- !1,
479
- null,
480
- null
481
- );
482
- const j = L.exports;
483
- export {
484
- j as default
485
- };
1
+ import { t as e } from "../chunks/EditableTree.C_IJBL5b.mjs";
2
+ export { e as default };