@web-utils/component 2.0.14 → 2.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 (384) hide show
  1. package/{dist/components/address-input/index.js → address-input/index.mjs} +9 -9
  2. package/affix/index.mjs +102 -0
  3. package/affix/style.css +1 -0
  4. package/aside-menu/index.mjs +58 -0
  5. package/avatar/index.mjs +106 -0
  6. package/avatar/style.css +1 -0
  7. package/awesome-button/index.mjs +112 -0
  8. package/base.css +1 -0
  9. package/{dist/components/capsule-tab/index.js → capsule-tab/index.mjs} +10 -10
  10. package/{dist/components/capsule-tab → capsule-tab}/style.css +1 -1
  11. package/card/index.mjs +126 -0
  12. package/card/style.css +1 -0
  13. package/carousel/index.mjs +70 -0
  14. package/carousel/style.css +1 -0
  15. package/chat/index.mjs +576 -0
  16. package/chat/style.css +1 -0
  17. package/{dist/components/chunk-file-uploader/index.js → chunk-file-uploader/index.mjs} +8 -6
  18. package/chunks/FormTemp.FX8xmbVB.mjs +165 -0
  19. package/chunks/confirmable-mixin.rTUMhoRH.mjs +106 -0
  20. package/chunks/dataformat.X_61lMA7.mjs +158 -0
  21. package/chunks/dic.6tk91Dmq.mjs +130 -0
  22. package/chunks/event.NHA7rYFE.mjs +236 -0
  23. package/{dist/chunks/76680a03.js → chunks/form-input-mixin.IKogWBfn.mjs} +2 -2
  24. package/{dist/chunks/b4acd3a6.js → chunks/form-item-mixin.BilKDUlK.mjs} +28 -14
  25. package/{dist/chunks/f71045fc.js → chunks/index.LGsb2aDq.mjs} +7 -6
  26. package/chunks/init.Ac4dKUJB.mjs +122 -0
  27. package/chunks/json-beautifier.fUZFSW5j.mjs +126 -0
  28. package/chunks/packages.v6r2Hr7E.mjs +58 -0
  29. package/chunks/permission.E9kZbW48.mjs +16 -0
  30. package/chunks/slot.j1uMmBnG.mjs +27 -0
  31. package/{dist/chunks/8c0142e0.js → chunks/tab-mixin.tM9jcRT8.mjs} +1 -1
  32. package/chunks/util.C2Bhx22L.mjs +259 -0
  33. package/{dist/chunks/5d4282fb.js → chunks/vueComponentNormalizer.JwmUNtgn.mjs} +3 -1
  34. package/{dist/components/code-mirror-editor/index.js → code-mirror-editor/index.mjs} +41 -38
  35. package/code-mirror-editor/style.css +1 -0
  36. package/{dist/components/color-picker/index.js → color-picker/index.mjs} +41 -23
  37. package/comment/index.mjs +90 -0
  38. package/comment/style.css +1 -0
  39. package/{dist/components/confirm-button/index.js → confirm-button/index.mjs} +2 -2
  40. package/{dist/components/confirmable/index.js → confirmable/index.mjs} +2 -2
  41. package/{dist/components/context-menu/index.js → context-menu/index.mjs} +27 -15
  42. package/context-menu/style.css +1 -0
  43. package/count-up/index.mjs +131 -0
  44. package/custom-scrollbar/index.mjs +116 -0
  45. package/data-box/index.mjs +97 -0
  46. package/data-box/style.css +1 -0
  47. package/data-card/index.mjs +98 -0
  48. package/data-card/style.css +1 -0
  49. package/data-cardtext/index.mjs +82 -0
  50. package/data-cardtext/style.css +1 -0
  51. package/data-display/index.mjs +97 -0
  52. package/data-display/style.css +1 -0
  53. package/data-icons/index.mjs +104 -0
  54. package/data-icons/style.css +1 -0
  55. package/data-imgtext/index.mjs +106 -0
  56. package/data-imgtext/style.css +1 -0
  57. package/data-operatext/index.mjs +99 -0
  58. package/data-operatext/style.css +1 -0
  59. package/data-panel/index.mjs +93 -0
  60. package/data-panel/style.css +1 -0
  61. package/data-pay/index.mjs +152 -0
  62. package/data-pay/style.css +1 -0
  63. package/data-price/index.mjs +84 -0
  64. package/data-price/style.css +1 -0
  65. package/data-progress/index.mjs +97 -0
  66. package/data-progress/style.css +1 -0
  67. package/data-rotate/index.mjs +96 -0
  68. package/data-rotate/style.css +1 -0
  69. package/{dist/components/data-table-picker/index.js → data-table-picker/index.mjs} +22 -22
  70. package/data-tabs/index.mjs +94 -0
  71. package/data-tabs/style.css +1 -0
  72. package/dialog-form/index.mjs +148 -0
  73. package/dialog-form/style.css +1 -0
  74. package/{dist/components/dynamic-table/index.js → dynamic-table/index.mjs} +11 -11
  75. package/dynamic-table/style.css +1 -0
  76. package/{dist/components/e-charts/index.js → e-charts/index.mjs} +33 -46
  77. package/easy-popup/index.mjs +136 -0
  78. package/easy-popup/style.css +1 -0
  79. package/{dist/components/editable-progress/index.js → editable-progress/index.mjs} +1 -1
  80. package/editable-progress/style.css +1 -0
  81. package/editable-tree/index.mjs +844 -0
  82. package/editable-tree/style.css +1 -0
  83. package/{dist/components/egd-collapse/index.js → egd-collapse/index.mjs} +1 -1
  84. package/{dist/components/egd-collapse-item/index.js → egd-collapse-item/index.mjs} +14 -12
  85. package/{dist/components/element-dialog/index.js → element-dialog/index.mjs} +88 -35
  86. package/element-dialog/style.css +1 -0
  87. package/{dist/components/empty-view/index.js → empty-view/index.mjs} +9 -9
  88. package/empty-view/style.css +1 -0
  89. package/{dist/components/error-view/index.js → error-view/index.mjs} +13 -13
  90. package/error-view/style.css +1 -0
  91. package/flex-column/index.mjs +62 -0
  92. package/flex-item/index.mjs +81 -0
  93. package/flex-row/index.mjs +62 -0
  94. package/{dist/components/flex-scroller/index.js → flex-scroller/index.mjs} +5 -5
  95. package/flex-scroller/style.css +1 -0
  96. package/flow/index.mjs +277 -0
  97. package/flow/style.css +1 -0
  98. package/flow-designer/index.mjs +10184 -0
  99. package/flow-designer/style.css +1 -0
  100. package/flow-node/index.mjs +102 -0
  101. package/flow-viewer/index.mjs +209 -0
  102. package/flow-viewer/style.css +1 -0
  103. package/form-block/index.mjs +156 -0
  104. package/form-block/style.css +1 -0
  105. package/form-button/index.mjs +58 -0
  106. package/{dist/components/form-cascader/index.js → form-cascader/index.mjs} +41 -29
  107. package/{dist/components/form-checkbox-group/index.js → form-checkbox-group/index.mjs} +47 -36
  108. package/form-checkbox-group/style.css +1 -0
  109. package/{dist/components/form-date-picker/index.js → form-date-picker/index.mjs} +45 -36
  110. package/form-holder/index.mjs +129 -0
  111. package/{dist/components/form-input/index.js → form-input/index.mjs} +34 -23
  112. package/{dist/components/form-input-email/index.js → form-input-email/index.mjs} +36 -25
  113. package/{dist/components/form-input-id-card/index.js → form-input-id-card/index.mjs} +35 -24
  114. package/{dist/components/form-input-number/index.js → form-input-number/index.mjs} +40 -29
  115. package/{dist/components/form-input-phone-number/index.js → form-input-phone-number/index.mjs} +37 -26
  116. package/form-input-tag/index.mjs +108 -0
  117. package/{dist/components/form-input-time/index.js → form-input-time/index.mjs} +40 -29
  118. package/form-item/index.mjs +147 -0
  119. package/{dist/components/form-item → form-item}/style.css +1 -1
  120. package/{dist/components/form-item-config-provider/index.js → form-item-config-provider/index.mjs} +1 -1
  121. package/{dist/components/form-item-group/index.js → form-item-group/index.mjs} +4 -4
  122. package/form-item-group/style.css +1 -0
  123. package/{dist/components/form-radio-group/index.js → form-radio-group/index.mjs} +51 -40
  124. package/form-radio-group/style.css +1 -0
  125. package/{dist/components/form-select/index.js → form-select/index.mjs} +40 -29
  126. package/{dist/components/form-switch/index.js → form-switch/index.mjs} +35 -24
  127. package/form-textarea/index.mjs +113 -0
  128. package/{dist/components/form-view/index.js → form-view/index.mjs} +72 -44
  129. package/form-view/style.css +1 -0
  130. package/fy-array/index.mjs +158 -0
  131. package/fy-array/style.css +1 -0
  132. package/fy-article/index.mjs +93 -0
  133. package/fy-article/style.css +1 -0
  134. package/fy-cascader/index.mjs +132 -0
  135. package/fy-checkbox/index.mjs +117 -0
  136. package/fy-checkbox/style.css +1 -0
  137. package/fy-code/index.mjs +66 -0
  138. package/fy-curd/index.mjs +3119 -0
  139. package/fy-curd/style.css +1 -0
  140. package/fy-date/index.mjs +84 -0
  141. package/fy-date/style.css +1 -0
  142. package/fy-draggable/index.mjs +382 -0
  143. package/fy-draggable/style.css +1 -0
  144. package/fy-dynamic/index.mjs +337 -0
  145. package/fy-dynamic/style.css +1 -0
  146. package/fy-empty/index.mjs +59 -0
  147. package/fy-empty/style.css +1 -0
  148. package/fy-form/index.mjs +993 -0
  149. package/fy-form/style.css +1 -0
  150. package/fy-form-design/index.mjs +7483 -0
  151. package/fy-form-design/style.css +1 -0
  152. package/fy-input/index.mjs +171 -0
  153. package/fy-input-color/index.mjs +101 -0
  154. package/fy-input-icon/index.mjs +169 -0
  155. package/fy-input-icon/style.css +1 -0
  156. package/fy-input-map/index.mjs +279 -0
  157. package/fy-input-map/style.css +1 -0
  158. package/fy-input-number/index.mjs +87 -0
  159. package/fy-input-table/index.mjs +172 -0
  160. package/fy-input-table/style.css +1 -0
  161. package/fy-input-tree/index.mjs +267 -0
  162. package/fy-input-tree/style.css +1 -0
  163. package/fy-progress/index.mjs +60 -0
  164. package/fy-radio/index.mjs +70 -0
  165. package/fy-radio/style.css +1 -0
  166. package/fy-rate/index.mjs +106 -0
  167. package/fy-rate/style.css +1 -0
  168. package/fy-select/index.mjs +225 -0
  169. package/fy-select/style.css +1 -0
  170. package/fy-slider/index.mjs +79 -0
  171. package/fy-switch/index.mjs +74 -0
  172. package/fy-tabs/index.mjs +92 -0
  173. package/fy-time/index.mjs +95 -0
  174. package/fy-title/index.mjs +40 -0
  175. package/fy-title/style.css +1 -0
  176. package/fy-tree/index.mjs +433 -0
  177. package/fy-tree/style.css +1 -0
  178. package/fy-u-editor/index.mjs +398 -0
  179. package/fy-u-editor/style.css +1 -0
  180. package/fy-upload/index.mjs +592 -0
  181. package/fy-upload/style.css +1 -0
  182. package/{dist/components/guide-steps/index.js → guide-steps/index.mjs} +12 -12
  183. package/{dist/components/guide-steps → guide-steps}/style.css +1 -1
  184. package/highlight-j-s/index.mjs +76 -0
  185. package/highlight-j-s/style.css +1 -0
  186. package/{dist/components/icon-card/index.js → icon-card/index.mjs} +9 -9
  187. package/{dist/components/icon-card → icon-card}/style.css +1 -1
  188. package/icon-temp/index.mjs +50 -0
  189. package/icon-temp/style.css +1 -0
  190. package/{dist/components/iframe-window/index.js → iframe-window/index.mjs} +5 -5
  191. package/iframe-window/style.css +1 -0
  192. package/image-cropper/index.mjs +249 -0
  193. package/image-cropper/style.css +1 -0
  194. package/image-preview/index.mjs +260 -0
  195. package/image-preview/style.css +1 -0
  196. package/{dist/components/image-viewer/index.js → image-viewer/index.mjs} +5 -5
  197. package/image-viewer/style.css +1 -0
  198. package/index.mjs +627 -0
  199. package/{dist/components/input-number/index.js → input-number/index.mjs} +2 -2
  200. package/{dist/components/input-number-range/index.js → input-number-range/index.mjs} +7 -7
  201. package/input-number-range/style.css +1 -0
  202. package/{dist/components/keep-view-alive/index.js → keep-view-alive/index.mjs} +6 -2
  203. package/keyboard/index.mjs +384 -0
  204. package/keyboard/style.css +1 -0
  205. package/license/index.mjs +134 -0
  206. package/{dist/components/loading-view/index.js → loading-view/index.mjs} +5 -5
  207. package/loading-view/style.css +1 -0
  208. package/login/index.mjs +250 -0
  209. package/login/style.css +1 -0
  210. package/monaco-editor/index.mjs +197 -0
  211. package/name-avatar/index.mjs +66 -0
  212. package/name-avatar/style.css +1 -0
  213. package/{dist/components/nav-bar/index.js → nav-bar/index.mjs} +8 -8
  214. package/nav-bar/style.css +1 -0
  215. package/not-implement/index.mjs +35 -0
  216. package/not-implement/style.css +1 -0
  217. package/notice/index.mjs +143 -0
  218. package/notice/style.css +1 -0
  219. package/package.json +41 -148
  220. package/{dist/components/page/index.js → page/index.mjs} +8 -8
  221. package/{dist/components/page-header/index.js → page-header/index.mjs} +6 -6
  222. package/{dist/components/page-index/index.js → page-index/index.mjs} +58 -34
  223. package/page-index/style.css +1 -0
  224. package/page-index-top/index.mjs +141 -0
  225. package/page-skeleton/index.mjs +67 -0
  226. package/page-skeleton/style.css +1 -0
  227. package/{dist/components/page-skeleton-new/index.js → page-skeleton-new/index.mjs} +3 -3
  228. package/page-skeleton-new/style.css +1 -0
  229. package/{dist/components/pageable-table/index.js → pageable-table/index.mjs} +149 -100
  230. package/pageable-table/style.css +1 -0
  231. package/{dist/components/pageable-view/index.js → pageable-view/index.mjs} +118 -68
  232. package/pageable-view/style.css +1 -0
  233. package/photo-swipe/index.mjs +129 -0
  234. package/present-view/index.mjs +365 -0
  235. package/present-view/style.css +1 -0
  236. package/queue/index.mjs +71 -0
  237. package/queue/style.css +1 -0
  238. package/record-video/index.mjs +173 -0
  239. package/record-video/style.css +1 -0
  240. package/{dist/components/resize-observer/index.js → resize-observer/index.mjs} +6 -6
  241. package/resize-observer/style.css +1 -0
  242. package/search/index.mjs +143 -0
  243. package/search/style.css +1 -0
  244. package/{dist/components/search-popover/index.js → search-popover/index.mjs} +64 -43
  245. package/search-popover/style.css +1 -0
  246. package/sign/index.mjs +132 -0
  247. package/sign/style.css +1 -0
  248. package/{dist/components/sign-panel/index.js → sign-panel/index.mjs} +18 -5
  249. package/sign-panel/style.css +1 -0
  250. package/skeleton/index.mjs +82 -0
  251. package/skeleton/style.css +1 -0
  252. package/{dist/components/split-pane/index.js → split-pane/index.mjs} +125 -28
  253. package/split-pane/style.css +1 -0
  254. package/{dist/components/stateful/index.js → stateful/index.mjs} +12 -12
  255. package/{dist/components/stateful → stateful}/style.css +1 -1
  256. package/{dist/components/static-pageable-table/index.js → static-pageable-table/index.mjs} +10 -10
  257. package/static-pageable-table/style.css +1 -0
  258. package/{dist/components/swiper/index.js → swiper/index.mjs} +49 -24
  259. package/swiper/style.css +1 -0
  260. package/{dist/components/tab/index.js → tab/index.mjs} +4 -2
  261. package/tab/style.css +1 -0
  262. package/{dist/components/tab-item/index.js → tab-item/index.mjs} +3 -3
  263. package/{dist/components/table-column/index.js → table-column/index.mjs} +35 -22
  264. package/{dist/components/table-view/index.js → table-view/index.mjs} +91 -64
  265. package/table-view/style.css +1 -0
  266. package/{dist/components/tag-render/index.js → tag-render/index.mjs} +45 -26
  267. package/tag-render/style.css +1 -0
  268. package/text-ellipsis/index.mjs +108 -0
  269. package/text-ellipsis/style.css +1 -0
  270. package/{dist/components/tinymce-wrapper/index.js → tinymce-editor/index.mjs} +446 -71
  271. package/tinymce-editor/style.css +1 -0
  272. package/{dist/components/toolbar/index.js → toolbar/index.mjs} +21 -21
  273. package/toolbar/style.css +1 -0
  274. package/toolbar-button/index.mjs +108 -0
  275. package/toolbar-button/style.css +1 -0
  276. package/verify/index.mjs +80 -0
  277. package/verify/style.css +1 -0
  278. package/vue-cron/index.mjs +1410 -0
  279. package/vue-cron/style.css +1 -0
  280. package/vue-qr-code/index.mjs +83 -0
  281. package/vue-quill-editor/index.mjs +117 -0
  282. package/vue-quill-editor/style.css +1 -0
  283. package/{dist/components/vue-tags-input/index.js → vue-tags-input/index.mjs} +115 -1
  284. package/vue-tags-input/style.css +1 -0
  285. package/vue-tree-select/index.mjs +2881 -0
  286. package/vue-tree-select/style.css +1 -0
  287. package/vue-video-player/index.mjs +192 -0
  288. package/vue-video-player/style.css +1 -0
  289. package/watermark/index.mjs +95 -0
  290. package/watermark/style.css +1 -0
  291. package/web-types.json +14033 -2752
  292. package/x-input-tag/index.mjs +203 -0
  293. package/x-input-tag/style.css +1 -0
  294. package/README.md +0 -27
  295. package/dist/chunks/3a79781b.js +0 -75
  296. package/dist/chunks/5a78e0db.js +0 -16
  297. package/dist/chunks/97652d86.js +0 -26
  298. package/dist/components/aside-menu/index.js +0 -58
  299. package/dist/components/awesome-button/index.js +0 -82
  300. package/dist/components/base.css +0 -1
  301. package/dist/components/chunk-file-uploader-button/index.js +0 -60
  302. package/dist/components/chunk-file-uploader-button/style.css +0 -1
  303. package/dist/components/chunk-file-uploader-drop/index.js +0 -65
  304. package/dist/components/chunk-file-uploader-drop/style.css +0 -1
  305. package/dist/components/chunk-file-uploader-file/index.js +0 -311
  306. package/dist/components/chunk-file-uploader-file/style.css +0 -1
  307. package/dist/components/chunk-file-uploader-files/index.js +0 -49
  308. package/dist/components/chunk-file-uploader-files/style.css +0 -1
  309. package/dist/components/chunk-file-uploader-list/index.js +0 -50
  310. package/dist/components/chunk-file-uploader-list/style.css +0 -1
  311. package/dist/components/chunk-file-uploader-un-support/index.js +0 -51
  312. package/dist/components/chunk-file-uploader-un-support/style.css +0 -1
  313. package/dist/components/code-mirror-editor/style.css +0 -1
  314. package/dist/components/context-menu/style.css +0 -1
  315. package/dist/components/custom-scrollbar/index.js +0 -149
  316. package/dist/components/dynamic-table/style.css +0 -1
  317. package/dist/components/editable-progress/style.css +0 -1
  318. package/dist/components/editable-tree/index.js +0 -789
  319. package/dist/components/editable-tree/style.css +0 -1
  320. package/dist/components/element-dialog/style.css +0 -1
  321. package/dist/components/empty-view/style.css +0 -1
  322. package/dist/components/error-view/style.css +0 -1
  323. package/dist/components/flex-column/index.js +0 -50
  324. package/dist/components/flex-item/index.js +0 -66
  325. package/dist/components/flex-row/index.js +0 -50
  326. package/dist/components/flex-scroller/style.css +0 -1
  327. package/dist/components/form-button/index.js +0 -80
  328. package/dist/components/form-checkbox-group/style.css +0 -1
  329. package/dist/components/form-holder/index.js +0 -90
  330. package/dist/components/form-item/index.js +0 -119
  331. package/dist/components/form-item-group/style.css +0 -1
  332. package/dist/components/form-radio-group/style.css +0 -1
  333. package/dist/components/form-textarea/index.js +0 -102
  334. package/dist/components/form-view/style.css +0 -1
  335. package/dist/components/iframe-window/style.css +0 -1
  336. package/dist/components/image-viewer/style.css +0 -1
  337. package/dist/components/input-number-range/style.css +0 -1
  338. package/dist/components/loading-view/style.css +0 -1
  339. package/dist/components/nav-bar/style.css +0 -1
  340. package/dist/components/not-implement/index.js +0 -35
  341. package/dist/components/not-implement/style.css +0 -1
  342. package/dist/components/page-index/style.css +0 -1
  343. package/dist/components/page-index-top/index.js +0 -119
  344. package/dist/components/page-skeleton/index.js +0 -56
  345. package/dist/components/page-skeleton/style.css +0 -1
  346. package/dist/components/page-skeleton-new/style.css +0 -1
  347. package/dist/components/pageable-table/style.css +0 -1
  348. package/dist/components/pageable-view/style.css +0 -1
  349. package/dist/components/photo-swipe/index.js +0 -187
  350. package/dist/components/photo-swipe/style.css +0 -1
  351. package/dist/components/resize-observer/style.css +0 -1
  352. package/dist/components/search-popover/style.css +0 -1
  353. package/dist/components/sign-panel/style.css +0 -1
  354. package/dist/components/split-pane/style.css +0 -1
  355. package/dist/components/static-pageable-table/style.css +0 -1
  356. package/dist/components/swiper/style.css +0 -1
  357. package/dist/components/tab/style.css +0 -1
  358. package/dist/components/table-view/style.css +0 -1
  359. package/dist/components/tag-render/style.css +0 -1
  360. package/dist/components/tinymce-editor/index.js +0 -173
  361. package/dist/components/tinymce-editor/style.css +0 -1
  362. package/dist/components/tinymce-wrapper/style.css +0 -1
  363. package/dist/components/toolbar/style.css +0 -1
  364. package/dist/components/toolbar-button/index.js +0 -90
  365. package/dist/components/toolbar-button/style.css +0 -1
  366. package/dist/components/trigger/index.js +0 -71
  367. package/dist/components/vue-tags-input/style.css +0 -1
  368. package/dist/components/watermark/index.js +0 -63
  369. package/dist/components/watermark/style.css +0 -1
  370. package/dist/components/x-dialog/index.js +0 -173
  371. package/dist/components/x-dialog/style.css +0 -1
  372. package/dist/index.css +0 -2060
  373. package/dist/index.es.js +0 -13236
  374. /package/{dist/components/address-input → address-input}/style.css +0 -0
  375. /package/{dist/components/aside-menu → aside-menu}/style.css +0 -0
  376. /package/{dist/components/chunk-file-uploader → chunk-file-uploader}/style.css +0 -0
  377. /package/{dist/chunks/61ad06b2.js → chunks/form-pick-mixin.y-qhZJi6.mjs} +0 -0
  378. /package/{dist/chunks/41a066be.js → chunks/input-number-mixin.GE2zr_3s.mjs} +0 -0
  379. /package/{dist/components/e-charts → e-charts}/style.css +0 -0
  380. /package/{dist/components/form-input-number → form-input-number}/style.css +0 -0
  381. /package/{dist/components/input-number → input-number}/style.css +0 -0
  382. /package/{dist/components/j-s-x-component/index.js → j-s-x-component/index.mjs} +0 -0
  383. /package/{dist/components/page → page}/style.css +0 -0
  384. /package/{dist/components/page-header → page-header}/style.css +0 -0
@@ -1,789 +0,0 @@
1
- import { hasOwn as d, addResizeListener as h, removeResizeListener as u, isVerticalScrollbarVisible as x, scrollbarWidth as w, computePosition as N, isPlainObject as r, cloneDeep as p, isFunction as f, isUndefined as l, isNotEmpty as C, fastClone as v, delay as g, findTreeChildren as $ } from "@web-utils/core";
2
- import { a as b, b as _, c } from "../../chunks/f71045fc.js";
3
- import { n as k } from "../../chunks/5d4282fb.js";
4
- var B = function() {
5
- var e = this, t = e.$createElement, i = e._self._c || t;
6
- return i("div", {
7
- staticClass: "editable-tree"
8
- }, [!e.readonly && e.addRootNodeButtonStyle === "top-right" ? i("ElButton", {
9
- staticStyle: {
10
- position: "absolute",
11
- top: "4px",
12
- "z-index": "1"
13
- },
14
- style: {
15
- right: `${e.right}px`
16
- },
17
- attrs: {
18
- type: "primary",
19
- size: "mini",
20
- icon: "el-icon-plus",
21
- circle: "",
22
- plain: ""
23
- },
24
- on: {
25
- click: function(a) {
26
- return a.stopPropagation(), e.$emit("add-root-node");
27
- }
28
- }
29
- }) : e._e(), i("div", {
30
- ref: "treeWrapper",
31
- staticClass: "et-tree-wrapper"
32
- }, [!e.readonly && e.addRootNodeButtonStyle === "top" ? i("div", {
33
- staticStyle: {
34
- "padding-left": "24px"
35
- }
36
- }, [i("ElButton", {
37
- attrs: {
38
- disabled: e.loading,
39
- size: "mini",
40
- type: "text"
41
- },
42
- on: {
43
- click: e.appendRootNode
44
- }
45
- }, [i("i", {
46
- staticClass: "el-icon-lx-add"
47
- }), e._v(" " + e._s(e.addRootNodeLabel ? e.addRootNodeLabel : `添加${e.label}`) + " ")])], 1) : e._e(), i("ElTree", e._g(e._b({
48
- key: e.treeKey,
49
- ref: "tree",
50
- staticClass: "flex-item",
51
- attrs: {
52
- "default-expanded-keys": e.expandedKeys,
53
- "expand-on-click-node": !1,
54
- "highlight-current": "",
55
- load: e.loadNode,
56
- data: e.innerTreeData,
57
- props: e.treeProps,
58
- lazy: e.lazy,
59
- "node-key": e.nodeKey
60
- },
61
- on: {
62
- "node-click": e.nodeClick,
63
- "node-contextmenu": e.showContextMenu,
64
- "node-expand": e.addExpandKey,
65
- "node-collapse": e.removeExpandKey
66
- },
67
- scopedSlots: e._u([{
68
- key: "default",
69
- fn: function(a) {
70
- var o = a.node, s = a.data;
71
- return [e._t("default", function() {
72
- return [s.edit ? [i("span", {
73
- staticClass: "custom-tree-node flex-row flex-item oh",
74
- attrs: {
75
- "data-id": s.id
76
- }
77
- }, [e.icon ? i("i", {
78
- staticClass: "node-icon shrink-0",
79
- class: s.loading ? "el-icon-loading" : "el-icon-edit-outline"
80
- }) : e._e(), i("ElInput", {
81
- ref: "labelTxt",
82
- staticClass: "node-input flex-item",
83
- attrs: {
84
- size: "mini",
85
- placeholder: e.defaultOptions.inputPlaceholder
86
- },
87
- on: {
88
- blur: function(n) {
89
- return e.inputBlur(n, o, s);
90
- }
91
- },
92
- nativeOn: {
93
- keyup: function(n) {
94
- return function(y) {
95
- return e.inputKeyup(y, o, s);
96
- }.apply(null, arguments);
97
- },
98
- click: function(n) {
99
- n.stopPropagation();
100
- }
101
- },
102
- model: {
103
- value: e.text,
104
- callback: function(n) {
105
- e.text = n;
106
- },
107
- expression: "text"
108
- }
109
- }), e.confirmButton ? [i("ElButton", {
110
- directives: [{
111
- name: "show",
112
- rawName: "v-show",
113
- value: !s.loading,
114
- expression: "!data.loading"
115
- }],
116
- staticClass: "shrink-0",
117
- attrs: {
118
- size: "mini",
119
- type: "text"
120
- },
121
- on: {
122
- click: function(n) {
123
- return n.stopPropagation(), e.onConfirm(o, s);
124
- }
125
- }
126
- }, [e._v("确定")]), i("ElButton", {
127
- directives: [{
128
- name: "show",
129
- rawName: "v-show",
130
- value: !s.loading,
131
- expression: "!data.loading"
132
- }],
133
- staticClass: "shrink-0",
134
- attrs: {
135
- size: "mini",
136
- type: "text"
137
- },
138
- on: {
139
- click: function(n) {
140
- return n.stopPropagation(), e.onCancel(o, s);
141
- }
142
- }
143
- }, [e._v("取消")])] : e._e()], 2)] : [i("span", {
144
- staticClass: "custom-tree-node",
145
- attrs: {
146
- "data-id": s.id
147
- }
148
- }, [i("span", {
149
- staticClass: "node-label flex-row flex-item oh ellipsis-1"
150
- }, [e.icon ? i("i", {
151
- staticClass: "node-icon",
152
- class: s.loading ? "el-icon-loading" : e.icon(s, o)
153
- }) : e._e(), i("span", {
154
- staticClass: "flex-item-relative",
155
- staticStyle: {
156
- height: "21px"
157
- }
158
- }, [i("span", {
159
- staticClass: "ellipsis-1 absolute-box et-tree-label",
160
- attrs: {
161
- title: o.label
162
- }
163
- }, [e._t("label", function() {
164
- return [e._v(e._s(o.label))];
165
- }, {
166
- data: s,
167
- node: o
168
- })], 2)]), e._t("label-suffix", null, {
169
- node: o,
170
- data: s
171
- })], 2), !e.contextMenu && !e.readonly ? i("span", {
172
- directives: [{
173
- name: "show",
174
- rawName: "v-show",
175
- value: !s.loading && !e.loading,
176
- expression: "!data.loading && !loading"
177
- }],
178
- staticClass: "handle-actions"
179
- }, [i("ElButton", {
180
- attrs: {
181
- size: "mini",
182
- type: "text"
183
- },
184
- on: {
185
- click: function(n) {
186
- return n.stopPropagation(), e.appendChildNode(o, s);
187
- }
188
- }
189
- }, [e._v("添加")]), i("ElButton", {
190
- attrs: {
191
- size: "mini",
192
- type: "text"
193
- },
194
- on: {
195
- click: function(n) {
196
- return n.stopPropagation(), e.editNode(o, s);
197
- }
198
- }
199
- }, [e._v("修改")]), i("ElPopconfirm", {
200
- staticClass: "pop-confirm",
201
- attrs: {
202
- "icon-color": "red",
203
- title: "你确定要删除吗?"
204
- },
205
- on: {
206
- confirm: function(n) {
207
- return e.removeNode(o, s);
208
- }
209
- },
210
- scopedSlots: e._u([{
211
- key: "reference",
212
- fn: function() {
213
- return [i("ElButton", {
214
- directives: [{
215
- name: "show",
216
- rawName: "v-show",
217
- value: o.isLeaf,
218
- expression: "node.isLeaf"
219
- }],
220
- staticStyle: {
221
- "margin-left": "4px"
222
- },
223
- attrs: {
224
- size: "mini",
225
- type: "text"
226
- },
227
- on: {
228
- click: function(n) {
229
- n.stopPropagation();
230
- }
231
- }
232
- }, [e._v("删除")])];
233
- },
234
- proxy: !0
235
- }], null, !0)
236
- })], 1) : e._e(), e.contextMenuIcon && e.contextMenu && !e.readonly ? i("span", {
237
- directives: [{
238
- name: "show",
239
- rawName: "v-show",
240
- value: !s.loading && !e.loading,
241
- expression: "!data.loading && !loading"
242
- }],
243
- staticClass: "handle-actions",
244
- staticStyle: {
245
- display: "inline-block"
246
- }
247
- }, [i("ElButton", {
248
- staticStyle: {
249
- padding: "6px 10px 0"
250
- },
251
- attrs: {
252
- size: "mini",
253
- type: "text"
254
- },
255
- on: {
256
- click: function(n) {
257
- return n.stopPropagation(), e.showContextMenu(n, s, o);
258
- }
259
- }
260
- }, [e._v(". . .")])], 1) : e._e()])]];
261
- }, {
262
- node: o,
263
- data: s
264
- })];
265
- }
266
- }], null, !0)
267
- }, "ElTree", e.filterTreeProperties(e.$attrs), !1), e.filterTreeEvents(e.$listeners))), e.contextMenu && !e.readonly ? i("div", {
268
- directives: [{
269
- name: "show",
270
- rawName: "v-show",
271
- value: e.showMenu,
272
- expression: "showMenu"
273
- }],
274
- ref: "contextMenu",
275
- staticClass: "menu",
276
- style: e.position
277
- }, [i("ul", {
278
- staticClass: "menu-list"
279
- }, [e._t("context-menu", function() {
280
- return [i("li", {
281
- directives: [{
282
- name: "show",
283
- rawName: "v-show",
284
- value: e.curData.id > -1,
285
- expression: "curData.id > -1"
286
- }],
287
- staticClass: "menu-item",
288
- on: {
289
- click: function(a) {
290
- return e.appendPeerNode(e.curNode, e.curData);
291
- }
292
- }
293
- }, [i("i", {
294
- staticClass: "menu-item-icon el-icon-lx-add",
295
- staticStyle: {
296
- color: "#228b22"
297
- }
298
- }), e._v(e._s(e.menuLabel.appendPeer) + " ")]), i("li", {
299
- staticClass: "menu-item",
300
- on: {
301
- click: function(a) {
302
- return e.appendChildNode(e.curNode, e.curData);
303
- }
304
- }
305
- }, [i("i", {
306
- staticClass: "menu-item-icon el-icon-lx-add",
307
- staticStyle: {
308
- color: "#228b22"
309
- }
310
- }), e._v(e._s(e.menuLabel.appendChild) + " ")]), i("li", {
311
- directives: [{
312
- name: "show",
313
- rawName: "v-show",
314
- value: e.curData.id > -1,
315
- expression: "curData.id > -1"
316
- }],
317
- staticClass: "menu-item",
318
- on: {
319
- click: function(a) {
320
- return e.editNode(e.curNode, e.curData);
321
- }
322
- }
323
- }, [i("i", {
324
- staticClass: "menu-item-icon el-icon-edit-outline",
325
- staticStyle: {
326
- color: "#ffa500"
327
- }
328
- }), e._v(e._s(e.menuLabel.editNode) + " ")]), i("li", {
329
- directives: [{
330
- name: "show",
331
- rawName: "v-show",
332
- value: e.curNode.isLeaf,
333
- expression: "curNode.isLeaf"
334
- }],
335
- staticClass: "menu-item",
336
- on: {
337
- click: function(a) {
338
- return e.removeNodeModal(e.curNode, e.curData);
339
- }
340
- }
341
- }, [i("i", {
342
- staticClass: "menu-item-icon el-icon-delete",
343
- staticStyle: {
344
- color: "#f00"
345
- }
346
- }), e._v(e._s(e.menuLabel.removeNode) + " ")])];
347
- }, {
348
- curNode: e.curNode,
349
- curData: e.curData
350
- })], 2)]) : e._e()], 1)], 1);
351
- }, T = [];
352
- const M = {
353
- name: "EditableTree",
354
- props: {
355
- label: {
356
- type: String,
357
- default: "书签"
358
- },
359
- addRootNodeLabel: {
360
- type: String
361
- },
362
- defaultExpandedKeys: {
363
- type: Array,
364
- default: () => []
365
- },
366
- newNodeBuilder: {
367
- type: Function,
368
- default: (e, t) => ({
369
- name: e,
370
- parentId: t.id
371
- })
372
- },
373
- contextMenu: Boolean,
374
- lazy: {
375
- type: Boolean,
376
- default: !0
377
- },
378
- expandFirstNode: {
379
- type: Boolean,
380
- default: !0
381
- },
382
- readonly: Boolean,
383
- saveApi: {
384
- type: Function
385
- },
386
- updateApi: {
387
- type: Function
388
- },
389
- deleteApi: {
390
- type: Function
391
- },
392
- fetchApi: {
393
- type: Function
394
- },
395
- customRootNode: {
396
- type: {
397
- type: Object,
398
- default: void 0
399
- }
400
- },
401
- rootNode: {
402
- type: Object
403
- },
404
- contextMenuIcon: Boolean,
405
- contextMenuInline: Boolean,
406
- treeProps: {
407
- type: Object,
408
- default: () => ({
409
- children: "children",
410
- label: "name",
411
- isLeaf: (e) => d(e, "hasChildren") ? !e.hasChildren : d(e, "hasChild") ? !e.hasChild : d(e, "children") && e.children ? e.children.length === 0 : !0
412
- })
413
- },
414
- menuLabel: {
415
- type: Object,
416
- default: () => ({
417
- appendPeer: "添加同级节点",
418
- appendChild: "添加",
419
- removeNode: "删除",
420
- editNode: "修改"
421
- })
422
- },
423
- icon: {
424
- type: [Function, Boolean],
425
- default: () => "el-icon-collection-tag"
426
- },
427
- confirmButton: {
428
- type: Boolean,
429
- default: !0
430
- },
431
- addRootNodeButtonStyle: {
432
- type: String,
433
- default: "top"
434
- },
435
- reserveExpandKey: Boolean,
436
- nodeKey: {
437
- type: String,
438
- default: "id"
439
- }
440
- },
441
- data() {
442
- return {
443
- loading: !1,
444
- showMenu: !1,
445
- empty: !0,
446
- expandedKeys: this.lazy ? [] : this.defaultExpandedKeys,
447
- treeData: [],
448
- curNode: {},
449
- curData: {},
450
- position: {},
451
- text: "",
452
- right: 4,
453
- treeKey: Date.now()
454
- };
455
- },
456
- computed: {
457
- defaultOptions() {
458
- return {
459
- confirmButtonText: "确定",
460
- cancelButtonText: "取消",
461
- closeOnClickModal: !1,
462
- modal: !0,
463
- inputErrorMessage: `${this.label}名不能为空!`,
464
- inputPlaceholder: `请输入${this.label}名...`,
465
- inputValidator: (e) => e != null && e.trim().length > 0
466
- };
467
- },
468
- innerTreeData() {
469
- var e;
470
- return (e = this.$attrs.data) != null && e.length ? this.$attrs.data : this.treeData;
471
- }
472
- },
473
- watch: {
474
- defaultExpandedKeys: {
475
- immediate: !0,
476
- handler(e) {
477
- this.expandedKeys = [...e];
478
- }
479
- }
480
- },
481
- created() {
482
- this.tryFetch();
483
- },
484
- mounted() {
485
- h(this.$refs.tree.$el, this.resize), h(this.$refs.treeWrapper, this.resize);
486
- },
487
- beforeDestroy() {
488
- u(this.$refs.tree.$el, this.resize), u(this.$refs.treeWrapper, this.resize);
489
- },
490
- methods: {
491
- filterTreeProperties: b,
492
- filterTreeEvents: _,
493
- addExpandKey(e) {
494
- this.reserveExpandKey && this.expandedKeys.push(e[this.nodeKey]);
495
- },
496
- removeExpandKey(e) {
497
- this.reserveExpandKey && (this.expandedKeys = this.expandedKeys.filter((t) => t !== e[this.nodeKey]));
498
- },
499
- resize() {
500
- x(this.$refs.treeWrapper) ? this.right = 4 + w : this.right = 4;
501
- },
502
- async showContextMenu(e, t, i) {
503
- t.contextmenu === !1 || t.id === -1 || t.id === 0 || t.edit === !0 || this.contextMenu && (this.curNode = i, this.curData = t, this.showMenu = !0, this.$refs.tree.setCurrentKey(t.id), await this.$nextTick(), this.position = N(e, this.$refs.contextMenu), window.addEventListener("click", this.hideContextMenu));
504
- },
505
- hideContextMenu() {
506
- this.showMenu = !1, window.removeEventListener("click", this.hideContextMenu);
507
- },
508
- async tryFetch() {
509
- var e;
510
- if (this.lazy === !1 && this.fetchApi) {
511
- const t = await this.fetchApi(((e = this.rootNode) == null ? void 0 : e.id) ?? -1, {});
512
- if (r(t.data) && (t.data = [t.data]), t.data = t.data || [], this.empty = t.data.length === 0, r(this.customRootNode)) {
513
- const i = p(this.customRootNode);
514
- i[this.treeProps.children || "children"] = t.data, this.treeData = [i];
515
- } else if (f(this.customRootNode)) {
516
- const i = this.customRootNode(t.data);
517
- i[this.treeProps.children || "children"] = t.data, this.treeData = r(i) ? [i] : i;
518
- } else
519
- this.treeData = t.data;
520
- }
521
- },
522
- async loadNode(e, t) {
523
- var i, a, o;
524
- if (e.level === 0) {
525
- const s = await this.fetchApi(((i = this.rootNode) == null ? void 0 : i.id) ?? -1, e);
526
- if (this.empty = s.data.length === 0, r(this.customRootNode)) {
527
- const n = p(this.customRootNode);
528
- n[this.treeProps.children || "children"] = s.data, t([n]);
529
- } else if (f(this.customRootNode)) {
530
- const n = this.customRootNode(s.data);
531
- n[this.treeProps.children || "children"] = s.data, this.treeData = r(n) ? [n] : n;
532
- } else
533
- t(s.data);
534
- await this.$nextTick(), this.$emit("root-node-loaded", s.data), this.defaultExpandedKeys ? this.expandedKeys = [(a = s == null ? void 0 : s.data[0]) == null ? void 0 : a.id, ...this.defaultExpandedKeys] : this.expandFirstNode && (this.expandedKeys = [(o = s == null ? void 0 : s.data[0]) == null ? void 0 : o.id]);
535
- } else {
536
- if (e.leaf || e.data.isTempNode)
537
- return t([]);
538
- const s = await this.fetchApi(e.data.id, e);
539
- t(s.data), await this.$nextTick(), this.$emit("node-loaded", s.data);
540
- }
541
- },
542
- clear() {
543
- this.cancelEdit(), this.removeNewNode();
544
- },
545
- clearChecked() {
546
- this.$refs.tree.setCheckedKeys([]);
547
- },
548
- removeNewNode() {
549
- this.newChild && this.newChild.id === -1 && (console.log(this.newChild), this.$refs.tree.remove(this.newChild), this.$emit("remove-new-node"));
550
- },
551
- cancelEdit() {
552
- this.editData && (l(this.editData.edit) ? this.$set(this.editData, "edit", !0) : this.editData.edit = !1);
553
- },
554
- async editNode(e, t) {
555
- !this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.editData = t, this.text = t[this.treeProps.label], l(t.edit) ? this.$set(t, "edit", !0) : t.edit = !0, await this.$nextTick(), this.$refs.labelTxt.focus()) : await this.$prompt(`请输入新的${this.label}名:`, {
556
- ...this.defaultOptions,
557
- inputValue: t[this.treeProps.label],
558
- beforeClose: async (i, a, o) => {
559
- if (i === "confirm") {
560
- try {
561
- a.confirmButtonLoading = !0, a.confirmButtonText = "处理中...", this.text = a.inputValue, await this.onConfirm(this.curNode, this.curData), o();
562
- } catch {
563
- a.confirmButtonText = "确定";
564
- }
565
- a.confirmButtonLoading = !1;
566
- } else
567
- o();
568
- }
569
- }).catch((i) => i);
570
- },
571
- async appendRootNode() {
572
- 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}名:`, {
573
- ...this.defaultOptions,
574
- beforeClose: async (e, t, i) => {
575
- if (e === "confirm") {
576
- try {
577
- this.createNewChild(-1), t.confirmButtonLoading = !0, t.confirmButtonText = "处理中...";
578
- const a = await this.saveApi(this.newNodeBuilder(t.inputValue, { id: -1 }));
579
- this.newChild[this.treeProps.label] = t.inputValue, this.newChild.edit = !1, c(this.newChild, a.data), this.$refs.tree.root.insertChild({ data: this.newChild }, void 0, !0), await this.locateView(), i();
580
- } catch {
581
- t.confirmButtonText = "确定";
582
- }
583
- t.confirmButtonLoading = !1;
584
- } else
585
- i();
586
- }
587
- }).catch((e) => e);
588
- },
589
- appendChildNode(e) {
590
- this.text = "";
591
- const t = e.expanded;
592
- e.expand(async () => {
593
- !this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.createNewChild(e.data.id), this.$refs.tree.append(this.newChild, e), await this.scrollIntoView(t)) : await this.$prompt(`请输入${this.label}名:`, {
594
- ...this.defaultOptions,
595
- beforeClose: async (i, a, o) => {
596
- if (i === "confirm") {
597
- try {
598
- this.createNewChild(e.data.id), a.confirmButtonLoading = !0, a.confirmButtonText = "处理中...";
599
- const s = await this.saveApi(this.newNodeBuilder(a.inputValue, e.data));
600
- this.newChild[this.treeProps.label] = a.inputValue, this.newChild.edit = !1, c(this.newChild, s.data), this.$refs.tree.append(this.newChild, e), await this.locateView(), o();
601
- } catch {
602
- a.confirmButtonText = "确定";
603
- }
604
- a.confirmButtonLoading = !1;
605
- } else
606
- o();
607
- }
608
- }).catch((i) => i);
609
- });
610
- },
611
- appendChildNodeWithData(e, t, i) {
612
- this.text = "";
613
- const a = e.expanded;
614
- e.expand(async () => {
615
- this.clear(), this.newChild = {
616
- id: -1,
617
- parentId: t,
618
- [this.treeProps.label]: i,
619
- edit: !1,
620
- isTempNode: !0,
621
- hasChildren: !1
622
- }, this.$refs.tree.append(this.newChild, e), await this.scrollIntoView(a);
623
- });
624
- },
625
- appendPeerNode(e) {
626
- e.parent && e.parent.level !== 0 ? this.appendChildNode(e.parent) : this.appendRootNode();
627
- },
628
- async addRootNode(e) {
629
- this.$refs.tree.remove(e), await this.$nextTick(), this.$refs.tree.root.insertChild({ data: e }, void 0, !0);
630
- },
631
- async addChildNode(e) {
632
- this.curNode && this.curNode.level !== 0 ? this.curNode.expand(async () => {
633
- this.$refs.tree.remove(e), await this.$nextTick(), this.$refs.tree.append(e, this.curNode);
634
- }) : await this.addRootNode(e);
635
- },
636
- async addPeerNode(e) {
637
- this.curNode && this.curNode.parent && this.curNode.parent.level !== 0 ? this.curNode.parent.expand(async () => {
638
- this.$refs.tree.remove(e), await this.$nextTick(), this.$refs.tree.append(e, this.curNode.parent);
639
- }) : await this.addRootNode(e);
640
- },
641
- updateNode(e) {
642
- const t = this.$refs.tree.getNode(e);
643
- t && (t.data = e);
644
- },
645
- setCurrentKey(e) {
646
- this.$refs.tree && this.$refs.tree.setCurrentKey(e);
647
- },
648
- createNewChild(e) {
649
- this.newChild = {
650
- id: -1,
651
- parentId: e,
652
- [this.treeProps.label]: "",
653
- edit: !0,
654
- isTempNode: !0,
655
- hasChildren: !1
656
- }, this.$emit("create-new-node", this.newChild);
657
- },
658
- async removeNodeModal(e) {
659
- await this.$confirm(
660
- `你确定要删除${this.label}[<span class="break-word" style="color: orange">${e.data[this.treeProps.label]}</span>]吗?`,
661
- "系统提示",
662
- {
663
- type: "warning",
664
- modal: !0,
665
- dangerouslyUseHTMLString: !0,
666
- iconClass: "el-icon-question",
667
- closeOnClickModal: !1,
668
- confirmButtonClass: "el-button--danger",
669
- cancelButtonClass: "el-button--primary is-plain",
670
- beforeClose: async (t, i, a) => {
671
- if (t === "confirm") {
672
- try {
673
- i.confirmButtonLoading = !0, i.confirmButtonText = "删除...";
674
- const o = e.parent, s = await this.deleteApi(e.data.id);
675
- s.code === 0 ? (this.$message.success("删除成功!"), this.$refs.tree.remove(e), this.$emit("node-deleted", o, e.data), a()) : this.$message.error(s.message);
676
- } catch {
677
- }
678
- i.confirmButtonText = "确定", i.confirmButtonLoading = !1;
679
- } else
680
- a();
681
- }
682
- }
683
- ).catch((t) => t);
684
- },
685
- async removeNode(e) {
686
- try {
687
- const t = e.parent;
688
- if (this.deleteApi) {
689
- const i = await this.deleteApi(e.data.id);
690
- i.code === 0 ? (this.$message.success("删除成功!"), this.$refs.tree.remove(e), this.$emit("node-deleted", t, e.data)) : this.$message.error(i.message);
691
- } else
692
- this.$refs.tree.remove(e);
693
- } catch {
694
- }
695
- },
696
- async onConfirm(e, t) {
697
- if (t[this.treeProps.label] === this.text || !C(this.text)) {
698
- this.clear();
699
- return;
700
- }
701
- l(t.loading) ? this.$set(t, "loading", !0) : t.loading = !0;
702
- try {
703
- if (this.loading = !0, t.id === -1) {
704
- const i = await this.saveApi(this.newNodeBuilder(this.text, e.parent.data || { id: -1 })), a = v(t);
705
- c(t, { ...i.data, isTempNode: !1 }), this.$emit("node-added", t, a, e), this.registerNode(e);
706
- } else
707
- await this.updateApi({ ...t, [this.treeProps.label]: this.text });
708
- t[this.treeProps.label] = this.text, t.edit = !1, this.$emit("node-updated", t, e), this.text = "";
709
- } catch {
710
- }
711
- t.loading = !1, this.loading = !1;
712
- },
713
- onCancel(e, t) {
714
- t.id === -1 ? this.$refs.tree.remove(e) : t.edit = !1, this.text = "";
715
- },
716
- nodeClick(e, t, i) {
717
- this.hideContextMenu(), (l(e.loading) || !e.loading) && (this.curNode = t, this.curData = e, this.$emit("on-node-click", e, t, i));
718
- },
719
- getCurrentNode() {
720
- return this.$refs.tree.getCurrentNode();
721
- },
722
- async locateView() {
723
- await this.$nextTick();
724
- const e = this.$el.querySelector(`[data-id="${this.newChild.id}"]`);
725
- e && e.scrollIntoView();
726
- },
727
- async scrollIntoView(e) {
728
- var t, i;
729
- await this.$nextTick(), e || await g(300), (i = (t = this.$refs) == null ? void 0 : t.labelTxt) == null || i.focus();
730
- },
731
- inputKeyup(e, t, i) {
732
- e.keyCode === 13 && this.onConfirm(t, i), e.keyCode === 27 && this.clear();
733
- },
734
- inputBlur(e, t, i) {
735
- this.confirmButton || this.onConfirm(t, i);
736
- },
737
- getCheckedKeys() {
738
- return this.$refs.tree.getCheckedKeys();
739
- },
740
- setCheckedKeys(e) {
741
- this.$refs.tree.setCheckedKeys(e);
742
- },
743
- getCheckedNodes() {
744
- return this.$refs.tree.getCheckedNodes();
745
- },
746
- setCheckedNodes(e) {
747
- this.$refs.tree.setCheckedNodes(e);
748
- },
749
- getNode(e) {
750
- return this.$refs.tree.getNode(e);
751
- },
752
- getRootNode() {
753
- return this.$refs.tree.root;
754
- },
755
- findTreeNode(e) {
756
- return $(
757
- this.$refs.tree.root.childNodes,
758
- (t) => t.data === e || t.data.id === e,
759
- "childNodes"
760
- );
761
- },
762
- registerNode(e) {
763
- e.store.registerNode(e), delete e.store.nodesMap[-1];
764
- },
765
- async reloadTree() {
766
- this.lazy ? this.treeKey = Date.now() : await this.tryFetch();
767
- }
768
- }
769
- }, m = {};
770
- var K = /* @__PURE__ */ k(
771
- M,
772
- B,
773
- T,
774
- !1,
775
- P,
776
- null,
777
- null,
778
- null
779
- );
780
- function P(e) {
781
- for (let t in m)
782
- this[t] = m[t];
783
- }
784
- const R = /* @__PURE__ */ function() {
785
- return K.exports;
786
- }();
787
- export {
788
- R as default
789
- };