@web-utils/component 5.0.0-beta02 → 5.0.0-beta04

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 (385) hide show
  1. package/chunks/DialogForm.BzmXN481.mjs +37816 -0
  2. package/chunks/ElementDialog.BrqPs1yL.mjs +198 -0
  3. package/chunks/FormTemp.DWB4CV8h.mjs +251 -0
  4. package/chunks/FyButton.DGd1yE_h.mjs +27 -0
  5. package/chunks/{FyCurd.me083T8V.mjs → FyCurd.DmIW6Tjw.mjs} +500 -496
  6. package/chunks/{FyForm.vVp8aVtj.mjs → FyForm.Dh77gj0Z.mjs} +158 -156
  7. package/chunks/{FyUEditor.BymtA5SJ.mjs → FyUEditor.BMGigcYw.mjs} +7 -7
  8. package/chunks/{FyUpload.CA7Gfa6Q.mjs → FyUpload.Y_mVdD0K.mjs} +77 -77
  9. package/chunks/{MonacoEditor.B7BUQwb7.mjs → MonacoEditor.DQ1vPh6D.mjs} +8 -8
  10. package/chunks/dataformat.BpAzVPYN.mjs +165 -0
  11. package/chunks/{dic.C0abEij9.mjs → dic.N2PNjL8o.mjs} +1 -1
  12. package/chunks/{event.Dv4XTu8B.mjs → event.BevSLXu4.mjs} +10 -14
  13. package/chunks/{util.g-WQEec9.mjs → util.Cdt7t08t.mjs} +35 -50
  14. package/dialog/index.d.ts +14 -0
  15. package/dialog/props.d.ts +101 -0
  16. package/dialog-form/index.mjs +2 -145
  17. package/element-dialog/index.mjs +1 -1
  18. package/element-dialog/style.css +1 -1
  19. package/fy-array/index.mjs +7 -7
  20. package/fy-button/index.mjs +2 -0
  21. package/fy-button/style.css +1 -0
  22. package/fy-cascader/index.mjs +2 -2
  23. package/fy-checkbox/index.mjs +2 -2
  24. package/fy-curd/index.mjs +1 -1
  25. package/fy-curd/style.css +1 -1
  26. package/fy-date/index.mjs +2 -2
  27. package/fy-date/style.css +1 -1
  28. package/fy-dynamic/index.mjs +17 -21
  29. package/fy-empty/index.mjs +4 -4
  30. package/fy-form/index.mjs +1 -1
  31. package/fy-form/style.css +1 -1
  32. package/fy-input/index.mjs +3 -3
  33. package/fy-input-color/index.mjs +2 -3
  34. package/fy-input-map/index.mjs +36 -34
  35. package/fy-input-number/index.mjs +2 -2
  36. package/fy-input-table/index.mjs +40 -38
  37. package/fy-input-tree/index.mjs +19 -19
  38. package/fy-input-tree/style.css +1 -1
  39. package/fy-radio/index.mjs +3 -3
  40. package/fy-rate/index.mjs +3 -3
  41. package/fy-select/index.mjs +31 -31
  42. package/fy-slider/index.mjs +5 -5
  43. package/fy-switch/index.mjs +3 -3
  44. package/fy-tabs/index.mjs +1 -1
  45. package/fy-time/index.mjs +7 -7
  46. package/fy-title/index.mjs +2 -2
  47. package/fy-tree/index.mjs +76 -74
  48. package/fy-u-editor/index.mjs +1 -1
  49. package/fy-upload/index.mjs +1 -1
  50. package/icon-temp/index.mjs +1 -1
  51. package/index.d.ts +2 -142
  52. package/index.mjs +31 -179
  53. package/monaco-editor/index.mjs +1 -1
  54. package/package.json +11 -13
  55. package/web-types.json +2461 -20206
  56. package/address-input/index.mjs +0 -76
  57. package/address-input/style.css +0 -1
  58. package/affix/index.mjs +0 -72
  59. package/affix/style.css +0 -1
  60. package/aside-menu/index.mjs +0 -20
  61. package/aside-menu/style.css +0 -1
  62. package/avatar/index.mjs +0 -94
  63. package/avatar/style.css +0 -1
  64. package/awesome-button/index.mjs +0 -55
  65. package/capsule-tab/index.mjs +0 -27
  66. package/capsule-tab/style.css +0 -1
  67. package/card/index.mjs +0 -86
  68. package/card/style.css +0 -1
  69. package/carousel/index.mjs +0 -46
  70. package/carousel/style.css +0 -1
  71. package/chat/index.mjs +0 -441
  72. package/chat/style.css +0 -1
  73. package/chunk-file-uploader/index.mjs +0 -2
  74. package/chunk-file-uploader/style.css +0 -1
  75. package/chunks/ChunkFileUploader.C3EA0e5t.mjs +0 -114
  76. package/chunks/EditableTree.D0ByhRTi.mjs +0 -648
  77. package/chunks/ElementBaseInfo.B3pY8TkD.mjs +0 -209
  78. package/chunks/ElementDialog.DNsDHdQS.mjs +0 -251
  79. package/chunks/ElementForm.D_lXbe--.mjs +0 -627
  80. package/chunks/ElementListeners.Cufwd4bp.mjs +0 -656
  81. package/chunks/ElementMultiInstance.BhY8NY2z.mjs +0 -290
  82. package/chunks/ElementOtherConfig.DX1ZJ9w2.mjs +0 -51
  83. package/chunks/ElementProperties.BRafADXp.mjs +0 -196
  84. package/chunks/ElementTaskConfig.B6pqRir_.mjs +0 -446
  85. package/chunks/FlowCondition.Dvwji23j.mjs +0 -194
  86. package/chunks/FlowDesigner.LL-vXDIE.mjs +0 -5100
  87. package/chunks/FormBlock.Co7l6USP.mjs +0 -117
  88. package/chunks/FormCascader.DMY3uNc8.mjs +0 -1227
  89. package/chunks/FormInputTime.BC4FfWwY.mjs +0 -1774
  90. package/chunks/FormItem.BSXI2cZU.mjs +0 -89
  91. package/chunks/FormItemGroup.D2Htta7J.mjs +0 -149
  92. package/chunks/FormSelect.CY0K-izg.mjs +0 -1473
  93. package/chunks/FormSwitch.DLqFXaFF.mjs +0 -297
  94. package/chunks/FormTemp.PJFfNRls.mjs +0 -139
  95. package/chunks/FyFormDesign.BCxVyiWY.mjs +0 -5600
  96. package/chunks/ImagePreview.ByEWJYdu.mjs +0 -639
  97. package/chunks/Keyboard.4hi7CjGc.mjs +0 -379
  98. package/chunks/PageableTable.Ba3XSbZ5.mjs +0 -660
  99. package/chunks/RecordVideo.VRFTaHSp.mjs +0 -116
  100. package/chunks/SignalAndMessage.DYhKWs3X.mjs +0 -198
  101. package/chunks/SplitPane.Bwe5Rc0J.mjs +0 -219
  102. package/chunks/TableColumn.72HOXQkb.mjs +0 -186
  103. package/chunks/TableView.BxfsOAxU.mjs +0 -484
  104. package/chunks/Toolbar.BVziVmyT.mjs +0 -219
  105. package/chunks/UserTaskListeners.CkeyTpnn.mjs +0 -599
  106. package/chunks/VueCron.DEvY5-i7.mjs +0 -1823
  107. package/chunks/VueTreeSelect.C6Ycu28Z.mjs +0 -1873
  108. package/chunks/checkbox.C_9WZ8gc.mjs +0 -437
  109. package/chunks/confirmable-mixin.zegaXQTl.mjs +0 -1762
  110. package/chunks/core.DXaMPWGV.mjs +0 -51
  111. package/chunks/dataformat.CteBVoOe.mjs +0 -144
  112. package/chunks/dictionary.BRhZD-WH.mjs +0 -19
  113. package/chunks/dictionary.CNNpjPL2.mjs +0 -87
  114. package/chunks/event.B4iwtUNO.mjs +0 -4
  115. package/chunks/focus-trap.FbvlqAGe.mjs +0 -211
  116. package/chunks/form-input.BUGZmAI1.mjs +0 -34
  117. package/chunks/form-item.Ca8U2bIR.mjs +0 -712
  118. package/chunks/form-pick.DT5kumy4.mjs +0 -7
  119. package/chunks/form-validate.CUvMwtPN.mjs +0 -11
  120. package/chunks/icon.CxCY22-F.mjs +0 -26
  121. package/chunks/icon.ym7735_x.mjs +0 -251
  122. package/chunks/init.6jGmuY99.mjs +0 -115
  123. package/chunks/input.C2GWsuXE.mjs +0 -547
  124. package/chunks/install.yLcn5MLL.mjs +0 -84
  125. package/chunks/message.C4NdvfbE.mjs +0 -400
  126. package/chunks/photo-swipe.BxnG4lip.mjs +0 -55
  127. package/chunks/radio.CeLeSOEo.mjs +0 -273
  128. package/chunks/scroll.DWjS-gnW.mjs +0 -28
  129. package/chunks/scrollbar.CAmrlKi9.mjs +0 -345
  130. package/chunks/slot.DT5QwXL-.mjs +0 -25
  131. package/chunks/style.BmlGmjpO.mjs +0 -325
  132. package/chunks/sub-table-plus-props.CRX7ERxJ.mjs +0 -28
  133. package/chunks/tab-mixin.7zuMMM1E.mjs +0 -70
  134. package/chunks/tag.ZhEIVRpP.mjs +0 -141
  135. package/chunks/tooltip.DNiltmX1.mjs +0 -1939
  136. package/chunks/typescript.CLl-2siQ.mjs +0 -18
  137. package/chunks/use-aria.BW7nWOl1.mjs +0 -17
  138. package/chunks/use-composition.mUaomyno.mjs +0 -47
  139. package/chunks/use-deprecated.BfDSbZS9.mjs +0 -12
  140. package/chunks/use-empty-values.D8KYIiKR.mjs +0 -81
  141. package/chunks/use-form-item.BlWa7ZKe.mjs +0 -56
  142. package/chunks/use-global-config.DRovgom9.mjs +0 -57
  143. package/chunks/use-locale.Be9HCpTQ.mjs +0 -188
  144. package/chunks/util.Ce4MHRmD.mjs +0 -103
  145. package/chunks/utilSelf.BttmSVX6.mjs +0 -46
  146. package/chunks/utils.BGJfM4oG.mjs +0 -60
  147. package/chunks/utils.CSPl1l4f.mjs +0 -14
  148. package/chunks/validator.DuBSEj8O.mjs +0 -5
  149. package/chunks/vnode.C3PXzhmg.mjs +0 -14
  150. package/code-mirror-editor/index.mjs +0 -99
  151. package/code-mirror-editor/style.css +0 -1
  152. package/comment/index.mjs +0 -62
  153. package/comment/style.css +0 -1
  154. package/configComponents.d.ts +0 -29
  155. package/configComponents.mjs +0 -42
  156. package/confirm-button/index.mjs +0 -35
  157. package/confirmable/index.mjs +0 -8
  158. package/context-menu/index.mjs +0 -195
  159. package/context-menu/style.css +0 -1
  160. package/count-up/index.mjs +0 -99
  161. package/custom-scrollbar/index.mjs +0 -93
  162. package/data-box/index.mjs +0 -64
  163. package/data-box/style.css +0 -1
  164. package/data-card/index.mjs +0 -60
  165. package/data-card/style.css +0 -1
  166. package/data-card-text/index.mjs +0 -64
  167. package/data-card-text/style.css +0 -1
  168. package/data-display/index.mjs +0 -71
  169. package/data-display/style.css +0 -1
  170. package/data-icons/index.mjs +0 -70
  171. package/data-icons/style.css +0 -1
  172. package/data-imgtext/index.mjs +0 -67
  173. package/data-imgtext/style.css +0 -1
  174. package/data-operatext/index.mjs +0 -51
  175. package/data-operatext/style.css +0 -1
  176. package/data-panel/index.mjs +0 -57
  177. package/data-panel/style.css +0 -1
  178. package/data-pay/index.mjs +0 -105
  179. package/data-pay/style.css +0 -1
  180. package/data-price/index.mjs +0 -48
  181. package/data-price/style.css +0 -1
  182. package/data-progress/index.mjs +0 -67
  183. package/data-progress/style.css +0 -1
  184. package/data-rotate/index.mjs +0 -61
  185. package/data-rotate/style.css +0 -1
  186. package/data-table-picker/index.mjs +0 -120
  187. package/data-tabs/index.mjs +0 -67
  188. package/data-tabs/style.css +0 -1
  189. package/dynamic-table/index.mjs +0 -166
  190. package/dynamic-table/style.css +0 -1
  191. package/e-charts/index.mjs +0 -176
  192. package/e-charts/style.css +0 -1
  193. package/easy-popup/index.mjs +0 -92
  194. package/easy-popup/style.css +0 -1
  195. package/editable-progress/index.mjs +0 -113
  196. package/editable-progress/style.css +0 -1
  197. package/editable-tree/index.mjs +0 -2
  198. package/editable-tree/style.css +0 -1
  199. package/element-listeners/style.css +0 -1
  200. package/element-multi-instance/style.css +0 -1
  201. package/ellipsis/index.mjs +0 -124
  202. package/ellipsis/style.css +0 -1
  203. package/empty-view/index.mjs +0 -48
  204. package/empty-view/style.css +0 -1
  205. package/error-view/index.mjs +0 -39
  206. package/error-view/style.css +0 -1
  207. package/flex-column/index.mjs +0 -35
  208. package/flex-item/index.mjs +0 -61
  209. package/flex-row/index.mjs +0 -34
  210. package/flex-scroller/index.mjs +0 -29
  211. package/flex-scroller/style.css +0 -1
  212. package/flow/index.mjs +0 -240
  213. package/flow/style.css +0 -1
  214. package/flow-designer/index.mjs +0 -2
  215. package/flow-designer/style.css +0 -1
  216. package/flow-node/index.mjs +0 -56
  217. package/flow-viewer/index.mjs +0 -160
  218. package/flow-viewer/style.css +0 -1
  219. package/form-block/index.mjs +0 -2
  220. package/form-block/style.css +0 -1
  221. package/form-button/index.mjs +0 -36
  222. package/form-card/index.mjs +0 -14
  223. package/form-cascader/index.mjs +0 -2
  224. package/form-checkbox/index.mjs +0 -90
  225. package/form-checkbox-group/index.mjs +0 -162
  226. package/form-checkbox-group/style.css +0 -1
  227. package/form-date-picker/index.mjs +0 -156
  228. package/form-holder/index.mjs +0 -134
  229. package/form-holder/style.css +0 -1
  230. package/form-input/index.mjs +0 -114
  231. package/form-input-cron-expression/index.mjs +0 -98
  232. package/form-input-cron-expression/style.css +0 -1
  233. package/form-input-email/index.mjs +0 -66
  234. package/form-input-id-card/index.mjs +0 -74
  235. package/form-input-phone-number/index.mjs +0 -73
  236. package/form-input-tag/index.mjs +0 -89
  237. package/form-input-time/index.mjs +0 -2
  238. package/form-item/index.mjs +0 -2
  239. package/form-item/style.css +0 -1
  240. package/form-item-config-provider/index.mjs +0 -47
  241. package/form-item-group/index.mjs +0 -2
  242. package/form-item-group/style.css +0 -1
  243. package/form-radio-group/index.mjs +0 -162
  244. package/form-radio-group/style.css +0 -1
  245. package/form-select/index.mjs +0 -2
  246. package/form-select/style.css +0 -1
  247. package/form-switch/index.mjs +0 -2
  248. package/form-table/index.mjs +0 -132
  249. package/form-table-plus/index.mjs +0 -165
  250. package/form-textarea/index.mjs +0 -91
  251. package/form-tree-select/index.mjs +0 -90
  252. package/form-tree-select/style.css +0 -1
  253. package/form-tree-select-multiple/index.mjs +0 -93
  254. package/form-view/index.mjs +0 -280
  255. package/form-view/style.css +0 -1
  256. package/fy-article/index.mjs +0 -73
  257. package/fy-article/style.css +0 -1
  258. package/fy-code/index.mjs +0 -48
  259. package/fy-draggable/index.mjs +0 -323
  260. package/fy-draggable/style.css +0 -1
  261. package/fy-form-design/index.mjs +0 -2
  262. package/fy-form-design/style.css +0 -1
  263. package/fy-input-icon/index.mjs +0 -129
  264. package/fy-input-icon/style.css +0 -1
  265. package/fy-progress/index.mjs +0 -36
  266. package/guide-steps/index.mjs +0 -73
  267. package/guide-steps/style.css +0 -1
  268. package/helper-function.d.ts +0 -6
  269. package/helper-function.mjs +0 -49
  270. package/highlight-j-s/index.mjs +0 -51
  271. package/highlight-j-s/style.css +0 -1
  272. package/icon-card/index.mjs +0 -34
  273. package/icon-card/style.css +0 -1
  274. package/iframe-window/index.mjs +0 -39
  275. package/iframe-window/style.css +0 -1
  276. package/image-cropper/index.mjs +0 -171
  277. package/image-cropper/style.css +0 -1
  278. package/image-preview/index.mjs +0 -2
  279. package/image-preview/style.css +0 -1
  280. package/image-viewer/index.mjs +0 -70
  281. package/image-viewer/style.css +0 -1
  282. package/input-number-range/index.mjs +0 -78
  283. package/input-number-range/style.css +0 -1
  284. package/j-s-x-component/index.mjs +0 -14
  285. package/keyboard/index.mjs +0 -2
  286. package/keyboard/style.css +0 -1
  287. package/license/index.mjs +0 -106
  288. package/loading-view/index.mjs +0 -39
  289. package/loading-view/style.css +0 -1
  290. package/login/index.mjs +0 -252
  291. package/login/style.css +0 -1
  292. package/name-avatar/index.mjs +0 -61
  293. package/name-avatar/style.css +0 -1
  294. package/nav-bar/index.mjs +0 -34
  295. package/nav-bar/style.css +0 -1
  296. package/not-implement/index.mjs +0 -10
  297. package/not-implement/style.css +0 -1
  298. package/notice/index.mjs +0 -100
  299. package/notice/style.css +0 -1
  300. package/page/index.mjs +0 -19
  301. package/page/style.css +0 -1
  302. package/page-header/index.mjs +0 -27
  303. package/page-header/style.css +0 -1
  304. package/page-index/index.mjs +0 -121
  305. package/page-index/style.css +0 -1
  306. package/page-index-top/index.mjs +0 -80
  307. package/page-skeleton/index.mjs +0 -49
  308. package/page-skeleton/style.css +0 -1
  309. package/page-skeleton-new/index.mjs +0 -79
  310. package/page-skeleton-new/style.css +0 -1
  311. package/pageable-table/index.mjs +0 -2
  312. package/pageable-table/style.css +0 -1
  313. package/pageable-view/index.mjs +0 -280
  314. package/pageable-view/style.css +0 -1
  315. package/photo-swipe/index.d.ts +0 -8
  316. package/photo-swipe/index.mjs +0 -33
  317. package/picker-table-view/index.mjs +0 -225
  318. package/present-view/index.mjs +0 -271
  319. package/present-view/style.css +0 -1
  320. package/queue/index.mjs +0 -46
  321. package/queue/style.css +0 -1
  322. package/record-video/index.mjs +0 -2
  323. package/record-video/style.css +0 -1
  324. package/resize-observer/index.mjs +0 -45
  325. package/resize-observer/style.css +0 -1
  326. package/search/index.mjs +0 -116
  327. package/search/style.css +0 -1
  328. package/sign/index.mjs +0 -104
  329. package/sign/style.css +0 -1
  330. package/sign-panel/index.mjs +0 -183
  331. package/sign-panel/style.css +0 -1
  332. package/skeleton/index.mjs +0 -51
  333. package/skeleton/style.css +0 -1
  334. package/skeleton-panel/index.mjs +0 -34
  335. package/skeleton-panel/style.css +0 -1
  336. package/split-pane/index.mjs +0 -3
  337. package/split-pane/style.css +0 -1
  338. package/stateful/index.mjs +0 -71
  339. package/stateful/style.css +0 -1
  340. package/static-pageable-table/index.mjs +0 -72
  341. package/static-pageable-table/style.css +0 -1
  342. package/sub-table/index.mjs +0 -508
  343. package/sub-table/style.css +0 -1
  344. package/sub-table-plus/index.mjs +0 -593
  345. package/sub-table-plus/style.css +0 -1
  346. package/swiper/index.mjs +0 -128
  347. package/swiper/style.css +0 -1
  348. package/tab/index.mjs +0 -117
  349. package/tab/style.css +0 -1
  350. package/tab-item/index.mjs +0 -49
  351. package/table-column/index.mjs +0 -2
  352. package/table-column/style.css +0 -1
  353. package/table-view/index.mjs +0 -3
  354. package/table-view/style.css +0 -1
  355. package/tabs-view/index.mjs +0 -109
  356. package/tabs-view/style.css +0 -1
  357. package/tag-render/index.mjs +0 -80
  358. package/tag-render/style.css +0 -1
  359. package/text-ellipsis/index.mjs +0 -95
  360. package/text-ellipsis/style.css +0 -1
  361. package/toolbar/index.mjs +0 -2
  362. package/toolbar/style.css +0 -1
  363. package/toolbar-button/index.mjs +0 -143
  364. package/utils/style.css +0 -1
  365. package/verify/index.mjs +0 -58
  366. package/verify/style.css +0 -1
  367. package/video/index.d.ts +0 -10
  368. package/vue-cron/index.mjs +0 -2
  369. package/vue-cron/style.css +0 -1
  370. package/vue-qr-code/index.mjs +0 -32
  371. package/vue-quill-editor/index.mjs +0 -127
  372. package/vue-quill-editor/style.css +0 -1
  373. package/vue-tags-input/index.mjs +0 -348
  374. package/vue-tags-input/style.css +0 -1
  375. package/vue-tree-select/index.mjs +0 -2
  376. package/vue-tree-select/style.css +0 -1
  377. package/vue-video-player/index.mjs +0 -136
  378. package/vue-video-player/style.css +0 -1
  379. package/watermark/index.mjs +0 -47
  380. package/watermark/style.css +0 -1
  381. package/x-input-tag/index.mjs +0 -145
  382. package/x-input-tag/style.css +0 -1
  383. /package/chunks/{_plugin-vue_export-helper.7vrlOII_.mjs → _plugin-vue_export-helper.CTBRVsXt.mjs} +0 -0
  384. /package/chunks/{packages.BLDb9e6G.mjs → packages.W76nKiMk.mjs} +0 -0
  385. /package/chunks/{permission.C-IUDxQQ.mjs → permission.ZYdXiCsn.mjs} +0 -0
@@ -1,1873 +0,0 @@
1
- import { t as e } from "./_plugin-vue_export-helper.7vrlOII_.mjs";
2
- import { createApp as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, isVNode as o, mergeProps as s, openBlock as c, resolveComponent as l } from "vue";
3
- import { isPromise as u } from "@web-utils/core";
4
- import { debounce as d, identity as f, last as p, noop as m, once as h } from "lodash-es";
5
- //#region src/components/tree-select/utils/warning.js
6
- var g = process.env.NODE_ENV === "production" ? m : function(e, t) {
7
- if (!e()) {
8
- let e = ["[Vue-TreeSelect Warning]"].concat(t());
9
- console.error(...e);
10
- }
11
- };
12
- //#endregion
13
- //#region src/components/tree-select/utils/onLeftClick.js
14
- function _(e) {
15
- return function(t, ...n) {
16
- t.type === "mousedown" && t.button === 0 && e.call(this, t, ...n);
17
- };
18
- }
19
- //#endregion
20
- //#region src/components/tree-select/utils/scrollIntoView.js
21
- function v(e, t) {
22
- let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.offsetHeight / 3;
23
- r.bottom + i > n.bottom ? e.scrollTop = Math.min(t.offsetTop + t.clientHeight - e.offsetHeight + i, e.scrollHeight) : r.top - i < n.top && (e.scrollTop = Math.max(t.offsetTop - i, 0));
24
- }
25
- //#endregion
26
- //#region src/components/tree-select/utils/removeFromArray.js
27
- function y(e, t) {
28
- let n = e.indexOf(t);
29
- n !== -1 && e.splice(n, 1);
30
- }
31
- //#endregion
32
- //#region src/components/tree-select/utils/watchSize.js
33
- var b, x = [], ee = 100;
34
- function te() {
35
- b = setInterval(() => {
36
- x.forEach(S);
37
- }, ee);
38
- }
39
- function ne() {
40
- clearInterval(b), b = null;
41
- }
42
- function S(e) {
43
- let { $el: t, listener: n, lastWidth: r, lastHeight: i } = e, a = t.offsetWidth, o = t.offsetHeight;
44
- (r !== a || i !== o) && (e.lastWidth = a, e.lastHeight = o, n({
45
- width: a,
46
- height: o
47
- }));
48
- }
49
- function re(e, t) {
50
- let n = {
51
- $el: e,
52
- listener: t,
53
- lastWidth: null,
54
- lastHeight: null
55
- };
56
- return x.push(n), S(n), te(), () => {
57
- y(x, n), x.length || ne();
58
- };
59
- }
60
- function ie(e, t) {
61
- let n = document.createElement("_"), r = n.appendChild(document.createElement("_")), i = n.appendChild(document.createElement("_")), a = r.appendChild(document.createElement("_")), o, s;
62
- return r.style.cssText = n.style.cssText = "height:100%;left:0;opacity:0;overflow:hidden;pointer-events:none;position:absolute;top:0;transition:0s;width:100%;z-index:-1", a.style.cssText = i.style.cssText = "display:block;height:100%;transition:0s;width:100%", a.style.width = a.style.height = "200%", e.appendChild(n), c(), u;
63
- function c() {
64
- l();
65
- let a = e.offsetWidth, u = e.offsetHeight;
66
- (a !== o || u !== s) && (o = a, s = u, i.style.width = `${a * 2}px`, i.style.height = `${u * 2}px`, n.scrollLeft = n.scrollWidth, n.scrollTop = n.scrollHeight, r.scrollLeft = r.scrollWidth, r.scrollTop = r.scrollHeight, t({
67
- width: a,
68
- height: u
69
- })), r.addEventListener("scroll", c), n.addEventListener("scroll", c);
70
- }
71
- function l() {
72
- r.removeEventListener("scroll", c), n.removeEventListener("scroll", c);
73
- }
74
- function u() {
75
- l(), e.removeChild(n);
76
- }
77
- }
78
- function C(e, t) {
79
- let n = document.documentMode === 9, r = !0, i = (n ? re : ie)(e, (...e) => r || t(...e));
80
- return r = !1, i;
81
- }
82
- //#endregion
83
- //#region src/components/tree-select/utils/setupResizeAndScrollEventListeners.js
84
- function ae(e) {
85
- let t = [], n = e.parentNode;
86
- for (; n && n.nodeName !== "BODY" && n.nodeType === document.ELEMENT_NODE;) oe(n) && t.push(n), n = n.parentNode;
87
- return t.push(window), t;
88
- }
89
- function oe(e) {
90
- let { overflow: t, overflowX: n, overflowY: r } = getComputedStyle(e);
91
- return /(auto|scroll|overlay)/.test(t + r + n);
92
- }
93
- function w(e, t) {
94
- let n = ae(e);
95
- return window.addEventListener("resize", t, { passive: !0 }), n.forEach((e) => {
96
- e.addEventListener("scroll", t, { passive: !0 });
97
- }), function() {
98
- window.removeEventListener("resize", t, { passive: !0 }), n.forEach((e) => {
99
- e.removeEventListener("scroll", t, { passive: !0 });
100
- });
101
- };
102
- }
103
- //#endregion
104
- //#region src/components/tree-select/utils/isNaN.js
105
- function T(e) {
106
- return Number.isNaN(e);
107
- }
108
- //#endregion
109
- //#region src/components/tree-select/utils/createMap.js
110
- var E = () => Object.create(null);
111
- //#endregion
112
- //#region src/components/tree-select/utils/deepExtend.js
113
- function D(e) {
114
- return typeof e != "object" || !e ? !1 : Object.getPrototypeOf(e) === Object.prototype;
115
- }
116
- function se(e, t, n) {
117
- D(n) ? (e[t] || (e[t] = {}), O(e[t], n)) : e[t] = n;
118
- }
119
- function O(e, t) {
120
- if (D(t)) {
121
- let n = Object.keys(t);
122
- for (let r = 0, i = n.length; r < i; r++) se(e, n[r], t[n[r]]);
123
- }
124
- return e;
125
- }
126
- //#endregion
127
- //#region src/components/tree-select/utils/includes.js
128
- function k(e, t) {
129
- return e.indexOf(t) !== -1;
130
- }
131
- //#endregion
132
- //#region src/components/tree-select/utils/find.js
133
- function A(e, t, n) {
134
- for (let r = 0, i = e.length; r < i; r++) if (t.call(n, e[r], r, e)) return e[r];
135
- }
136
- //#endregion
137
- //#region src/components/tree-select/utils/quickDiff.js
138
- function j(e, t) {
139
- if (e.length !== t.length) return !0;
140
- for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !0;
141
- return !1;
142
- }
143
- //#endregion
144
- //#region src/components/tree-select/utils/index.js
145
- function ce(e, t) {
146
- let n = t.length, r = e.length;
147
- if (r > n) return !1;
148
- if (r === n) return e === t;
149
- outer: for (let i = 0, a = 0; i < r; i++) {
150
- let r = e.charCodeAt(i);
151
- for (; a < n;) if (t.charCodeAt(a++) === r) continue outer;
152
- return !1;
153
- }
154
- return !0;
155
- }
156
- //#endregion
157
- //#region src/components/tree-select/constants.js
158
- var M = "ALL_CHILDREN", N = "ALL_DESCENDANTS", P = "LEAF_CHILDREN", F = "LEAF_DESCENDANTS", le = "LOAD_ROOT_OPTIONS", ue = "LOAD_CHILDREN_OPTIONS", de = "ASYNC_SEARCH", I = "BRANCH_PRIORITY", fe = "LEAF_PRIORITY", pe = "ALL_WITH_INDETERMINATE", L = "ORDER_SELECTED", me = "LEVEL", he = "INDEX", R = {
159
- BACKSPACE: 8,
160
- ENTER: 13,
161
- ESCAPE: 27,
162
- END: 35,
163
- HOME: 36,
164
- ARROW_LEFT: 37,
165
- ARROW_UP: 38,
166
- ARROW_RIGHT: 39,
167
- ARROW_DOWN: 40,
168
- DELETE: 46
169
- }, ge = process.env.NODE_ENV === "testing" ? 10 : 200;
170
- //#endregion
171
- //#region src/components/tree-select/mixins/tree-select-mixin.js
172
- function z(e, t) {
173
- let n = 0;
174
- do {
175
- if (e.level < n) return -1;
176
- if (t.level < n) return 1;
177
- if (e.index[n] !== t.index[n]) return e.index[n] - t.index[n];
178
- n++;
179
- } while (!0);
180
- }
181
- function _e(e, t) {
182
- return e.level === t.level ? z(e, t) : e.level - t.level;
183
- }
184
- function B() {
185
- return {
186
- isLoaded: !1,
187
- isLoading: !1,
188
- loadingError: ""
189
- };
190
- }
191
- function ve(e) {
192
- // istanbul ignore next
193
- return typeof e == "string" ? e : typeof e == "number" && !T(e) ? `${e}` : "";
194
- }
195
- function V(e, t, n) {
196
- return e ? ce(t, n) : k(n, t);
197
- }
198
- function H(e) {
199
- return e.message || String(e);
200
- }
201
- var ye = 0, be = {
202
- provide() {
203
- return { instance: this };
204
- },
205
- props: {
206
- allowClearingDisabled: {
207
- type: Boolean,
208
- default: !1
209
- },
210
- allowSelectingDisabledDescendants: {
211
- type: Boolean,
212
- default: !1
213
- },
214
- alwaysOpen: {
215
- type: Boolean,
216
- default: !1
217
- },
218
- appendToBody: {
219
- type: Boolean,
220
- default: !1
221
- },
222
- async: {
223
- type: Boolean,
224
- default: !1
225
- },
226
- autoFocus: {
227
- type: Boolean,
228
- default: !1
229
- },
230
- autoLoadRootOptions: {
231
- type: Boolean,
232
- default: !0
233
- },
234
- autoDeselectAncestors: {
235
- type: Boolean,
236
- default: !1
237
- },
238
- autoDeselectDescendants: {
239
- type: Boolean,
240
- default: !1
241
- },
242
- autoSelectAncestors: {
243
- type: Boolean,
244
- default: !1
245
- },
246
- autoSelectDescendants: {
247
- type: Boolean,
248
- default: !1
249
- },
250
- backspaceRemoves: {
251
- type: Boolean,
252
- default: !0
253
- },
254
- beforeClearAll: {
255
- type: Function,
256
- default: () => !0
257
- },
258
- branchNodesFirst: {
259
- type: Boolean,
260
- default: !1
261
- },
262
- cacheOptions: {
263
- type: Boolean,
264
- default: !0
265
- },
266
- clearable: {
267
- type: Boolean,
268
- default: !0
269
- },
270
- clearAllText: {
271
- type: String,
272
- default: "Clear all"
273
- },
274
- clearOnSelect: {
275
- type: Boolean,
276
- default: !1
277
- },
278
- clearValueText: {
279
- type: String,
280
- default: "Clear value"
281
- },
282
- closeOnSelect: {
283
- type: Boolean,
284
- default: !0
285
- },
286
- defaultExpandLevel: {
287
- type: Number,
288
- default: 0
289
- },
290
- defaultOptions: { default: !1 },
291
- deleteRemoves: {
292
- type: Boolean,
293
- default: !0
294
- },
295
- delimiter: {
296
- type: String,
297
- default: ","
298
- },
299
- flattenSearchResults: {
300
- type: Boolean,
301
- default: !1
302
- },
303
- disableBranchNodes: {
304
- type: Boolean,
305
- default: !1
306
- },
307
- disabled: {
308
- type: Boolean,
309
- default: !1
310
- },
311
- disableFuzzyMatching: {
312
- type: Boolean,
313
- default: !1
314
- },
315
- flat: {
316
- type: Boolean,
317
- default: !1
318
- },
319
- instanceId: {
320
- default: () => `${ye++}$$`,
321
- type: [String, Number]
322
- },
323
- joinValues: {
324
- type: Boolean,
325
- default: !1
326
- },
327
- limit: {
328
- type: Number,
329
- default: Infinity
330
- },
331
- limitText: {
332
- type: Function,
333
- default: function(e) {
334
- return `and ${e} more`;
335
- }
336
- },
337
- loadingText: {
338
- type: String,
339
- default: "Loading..."
340
- },
341
- loadOptions: { type: Function },
342
- matchKeys: {
343
- type: Array,
344
- default: () => ["label"]
345
- },
346
- maxHeight: {
347
- type: Number,
348
- default: 300
349
- },
350
- multiple: {
351
- type: Boolean,
352
- default: !1
353
- },
354
- name: { type: String },
355
- noChildrenText: {
356
- type: String,
357
- default: "No sub-options."
358
- },
359
- noOptionsText: {
360
- type: String,
361
- default: "No options available."
362
- },
363
- noResultsText: {
364
- type: String,
365
- default: "No results found..."
366
- },
367
- normalizer: {
368
- type: Function,
369
- default: f
370
- },
371
- openDirection: {
372
- type: String,
373
- default: "auto",
374
- validator(e) {
375
- return k([
376
- "auto",
377
- "top",
378
- "bottom",
379
- "above",
380
- "below"
381
- ], e);
382
- }
383
- },
384
- openOnClick: {
385
- type: Boolean,
386
- default: !0
387
- },
388
- openOnFocus: {
389
- type: Boolean,
390
- default: !1
391
- },
392
- options: { type: Array },
393
- placeholder: {
394
- type: String,
395
- default: "Select..."
396
- },
397
- required: {
398
- type: Boolean,
399
- default: !1
400
- },
401
- retryText: {
402
- type: String,
403
- default: "Retry?"
404
- },
405
- retryTitle: {
406
- type: String,
407
- default: "Click to retry"
408
- },
409
- searchable: {
410
- type: Boolean,
411
- default: !0
412
- },
413
- searchNested: {
414
- type: Boolean,
415
- default: !1
416
- },
417
- searchPromptText: {
418
- type: String,
419
- default: "Type to search..."
420
- },
421
- showCount: {
422
- type: Boolean,
423
- default: !1
424
- },
425
- showCountOf: {
426
- type: String,
427
- default: M,
428
- validator(e) {
429
- return k([
430
- M,
431
- N,
432
- P,
433
- F
434
- ], e);
435
- }
436
- },
437
- showCountOnSearch: null,
438
- sortValueBy: {
439
- type: String,
440
- default: L,
441
- validator(e) {
442
- return k([
443
- L,
444
- me,
445
- he
446
- ], e);
447
- }
448
- },
449
- tabIndex: {
450
- type: Number,
451
- default: 0
452
- },
453
- value: null,
454
- valueConsistsOf: {
455
- type: String,
456
- default: I,
457
- validator(e) {
458
- return k([
459
- "ALL",
460
- I,
461
- fe,
462
- pe
463
- ], e);
464
- }
465
- },
466
- valueFormat: {
467
- type: String,
468
- default: "id"
469
- },
470
- zIndex: {
471
- type: [Number, String],
472
- default: 999
473
- }
474
- },
475
- data() {
476
- return {
477
- trigger: {
478
- isFocused: !1,
479
- searchQuery: ""
480
- },
481
- menu: {
482
- isOpen: !1,
483
- current: null,
484
- lastScrollPosition: 0,
485
- placement: "bottom"
486
- },
487
- forest: {
488
- normalizedOptions: [],
489
- nodeMap: E(),
490
- checkedStateMap: E(),
491
- selectedNodeIds: this.extractCheckedNodeIdsFromValue(),
492
- selectedNodeMap: E()
493
- },
494
- rootOptionsStates: B(),
495
- localSearch: {
496
- active: !1,
497
- noResults: !0,
498
- countMap: E()
499
- },
500
- remoteSearch: E()
501
- };
502
- },
503
- computed: {
504
- selectedNodes() {
505
- return this.forest.selectedNodeIds.map(this.getNode);
506
- },
507
- internalValue() {
508
- let e;
509
- // istanbul ignore else
510
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === "ALL") e = this.forest.selectedNodeIds.slice();
511
- else if (this.valueConsistsOf === "BRANCH_PRIORITY") e = this.forest.selectedNodeIds.filter((e) => {
512
- let t = this.getNode(e);
513
- return t.isRootNode ? !0 : !this.isSelected(t.parentNode);
514
- });
515
- else if (this.valueConsistsOf === "LEAF_PRIORITY") e = this.forest.selectedNodeIds.filter((e) => {
516
- let t = this.getNode(e);
517
- return t.isLeaf ? !0 : t.children.length === 0;
518
- });
519
- else if (this.valueConsistsOf === "ALL_WITH_INDETERMINATE") {
520
- let t = [];
521
- e = this.forest.selectedNodeIds.slice(), this.selectedNodes.forEach((n) => {
522
- n.ancestors.forEach((n) => {
523
- k(t, n.id) || k(e, n.id) || t.push(n.id);
524
- });
525
- }), e.push(...t);
526
- }
527
- return this.sortValueBy === "LEVEL" ? e.sort((e, t) => _e(this.getNode(e), this.getNode(t))) : this.sortValueBy === "INDEX" && e.sort((e, t) => z(this.getNode(e), this.getNode(t))), e;
528
- },
529
- hasValue() {
530
- return this.internalValue.length > 0;
531
- },
532
- single() {
533
- return !this.multiple;
534
- },
535
- visibleOptionIds() {
536
- let e = [];
537
- return this.traverseAllNodesByIndex((t) => {
538
- if ((!this.localSearch.active || this.shouldOptionBeIncludedInSearchResult(t)) && e.push(t.id), t.isBranch && !this.shouldExpand(t)) return !1;
539
- }), e;
540
- },
541
- hasVisibleOptions() {
542
- return this.visibleOptionIds.length !== 0;
543
- },
544
- showCountOnSearchComputed() {
545
- return typeof this.showCountOnSearch == "boolean" ? this.showCountOnSearch : this.showCount;
546
- },
547
- hasBranchNodes() {
548
- return this.forest.normalizedOptions.some((e) => e.isBranch);
549
- },
550
- shouldFlattenOptions() {
551
- return this.localSearch.active && this.flattenSearchResults;
552
- }
553
- },
554
- watch: {
555
- alwaysOpen(e) {
556
- e ? this.openMenu() : this.closeMenu();
557
- },
558
- branchNodesFirst() {
559
- this.initialize();
560
- },
561
- disabled(e) {
562
- e && this.menu.isOpen ? this.closeMenu() : !e && !this.menu.isOpen && this.alwaysOpen && this.openMenu();
563
- },
564
- flat() {
565
- this.initialize();
566
- },
567
- internalValue(e, t) {
568
- j(e, t) && this.$emit("input", this.getValue(), this.getInstanceId());
569
- },
570
- matchKeys() {
571
- this.initialize();
572
- },
573
- multiple(e) {
574
- // istanbul ignore else
575
- e && this.buildForestState();
576
- },
577
- options: {
578
- handler() {
579
- this.async || (this.initialize(), this.rootOptionsStates.isLoaded = Array.isArray(this.options));
580
- },
581
- deep: !0,
582
- immediate: !0
583
- },
584
- "trigger.searchQuery"() {
585
- this.async ? this.handleRemoteSearch() : this.handleLocalSearch(), this.$emit("search-change", this.trigger.searchQuery, this.getInstanceId());
586
- },
587
- value() {
588
- let e = this.extractCheckedNodeIdsFromValue();
589
- j(e, this.internalValue) && this.fixSelectedNodeIds(e);
590
- }
591
- },
592
- methods: {
593
- verifyProps() {
594
- g(() => this.async ? this.searchable : !0, () => "For async search mode, the value of \"searchable\" prop must be true."), this.options == null && !this.loadOptions && g(() => !1, () => "Are you meant to dynamically load options? You need to use \"loadOptions\" prop."), this.flat && g(() => this.multiple, () => "You are using flat mode. But you forgot to add \"multiple=true\"?"), this.flat || [
595
- "autoSelectAncestors",
596
- "autoSelectDescendants",
597
- "autoDeselectAncestors",
598
- "autoDeselectDescendants"
599
- ].forEach((e) => {
600
- g(() => !this[e], () => `"${e}" only applies to flat mode.`);
601
- });
602
- },
603
- resetFlags() {
604
- this._blurOnSelect = !1;
605
- },
606
- initialize() {
607
- let e = this.async ? this.getRemoteSearchEntry().options : this.options;
608
- if (Array.isArray(e)) {
609
- let t = this.forest.nodeMap;
610
- this.forest.nodeMap = E(), this.keepDataOfSelectedNodes(t), this.forest.normalizedOptions = this.normalize(null, e, t), this.fixSelectedNodeIds(this.internalValue);
611
- } else this.forest.normalizedOptions = [];
612
- },
613
- getInstanceId() {
614
- return this.instanceId == null ? this.id : this.instanceId;
615
- },
616
- getValue() {
617
- if (this.valueFormat === "id") return this.multiple ? this.internalValue.slice() : this.internalValue[0];
618
- let e = this.internalValue.map((e) => this.getNode(e).raw);
619
- return this.multiple ? e : e[0];
620
- },
621
- getNode(e) {
622
- return g(() => e != null, () => `Invalid node id: ${e}`), e == null ? null : e in this.forest.nodeMap ? this.forest.nodeMap[e] : this.createFallbackNode(e);
623
- },
624
- createFallbackNode(e) {
625
- let t = this.extractNodeFromValue(e), n = {
626
- id: e,
627
- label: this.enhancedNormalizer(t).label || `${e} (unknown)`,
628
- ancestors: [],
629
- parentNode: null,
630
- isFallbackNode: !0,
631
- isRootNode: !0,
632
- isLeaf: !0,
633
- isBranch: !1,
634
- isDisabled: !1,
635
- isNew: !1,
636
- index: [-1],
637
- level: 0,
638
- raw: t
639
- };
640
- return this.forest.nodeMap[e] = n, this.forest.nodeMap[e];
641
- },
642
- extractCheckedNodeIdsFromValue() {
643
- return this.value == null ? [] : this.valueFormat === "id" ? this.multiple ? this.value.slice() : [this.value] : (this.multiple ? this.value : [this.value]).map((e) => this.enhancedNormalizer(e)).map((e) => e.id);
644
- },
645
- extractNodeFromValue(e) {
646
- let t = { id: e };
647
- return this.valueFormat === "id" ? t : A(this.multiple ? Array.isArray(this.value) ? this.value : [] : this.value ? [this.value] : [], (t) => t && this.enhancedNormalizer(t).id === e) || t;
648
- },
649
- fixSelectedNodeIds(e) {
650
- let t = [];
651
- // istanbul ignore else
652
- if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === "ALL") t = e;
653
- else if (this.valueConsistsOf === "BRANCH_PRIORITY") e.forEach((e) => {
654
- t.push(e);
655
- let n = this.getNode(e);
656
- n.isBranch && this.traverseDescendantsBFS(n, (e) => {
657
- t.push(e.id);
658
- });
659
- });
660
- else if (this.valueConsistsOf === "LEAF_PRIORITY") {
661
- let n = E(), r = e.slice();
662
- for (; r.length;) {
663
- let e = r.shift(), i = this.getNode(e);
664
- t.push(e), !i.isRootNode && (i.parentNode.id in n || (n[i.parentNode.id] = i.parentNode.children.length), --n[i.parentNode.id] === 0 && r.push(i.parentNode.id));
665
- }
666
- } else if (this.valueConsistsOf === "ALL_WITH_INDETERMINATE") {
667
- let n = E(), r = e.filter((e) => {
668
- let t = this.getNode(e);
669
- return t.isLeaf || t.children.length === 0;
670
- });
671
- for (; r.length;) {
672
- let e = r.shift(), i = this.getNode(e);
673
- t.push(e), !i.isRootNode && (i.parentNode.id in n || (n[i.parentNode.id] = i.parentNode.children.length), --n[i.parentNode.id] === 0 && r.push(i.parentNode.id));
674
- }
675
- }
676
- j(this.forest.selectedNodeIds, t) && (this.forest.selectedNodeIds = t), this.buildForestState();
677
- },
678
- keepDataOfSelectedNodes(e) {
679
- this.forest.selectedNodeIds.forEach((t) => {
680
- if (!e[t]) return;
681
- let n = {
682
- ...e[t],
683
- isFallbackNode: !0
684
- };
685
- this.forest.nodeMap[t] = n;
686
- });
687
- },
688
- isSelected(e) {
689
- return this.forest.selectedNodeMap[e.id] === !0;
690
- },
691
- traverseDescendantsBFS(e, t) {
692
- // istanbul ignore if
693
- if (!e.isBranch) return;
694
- let n = e.children.slice();
695
- for (; n.length;) {
696
- let e = n[0];
697
- e.isBranch && n.push(...e.children), t(e), n.shift();
698
- }
699
- },
700
- traverseDescendantsDFS(e, t) {
701
- e.isBranch && e.children.forEach((e) => {
702
- this.traverseDescendantsDFS(e, t), t(e);
703
- });
704
- },
705
- traverseAllNodesDFS(e) {
706
- this.forest.normalizedOptions.forEach((t) => {
707
- this.traverseDescendantsDFS(t, e), e(t);
708
- });
709
- },
710
- traverseAllNodesByIndex(e) {
711
- let t = (n) => {
712
- n.children.forEach((n) => {
713
- e(n) !== !1 && n.isBranch && t(n);
714
- });
715
- };
716
- t({ children: this.forest.normalizedOptions });
717
- },
718
- toggleClickOutsideEvent(e) {
719
- e ? document.addEventListener("mousedown", this.handleClickOutside, !1) : document.removeEventListener("mousedown", this.handleClickOutside, !1);
720
- },
721
- getValueContainer() {
722
- return this.$refs.control.$refs["value-container"];
723
- },
724
- getInput() {
725
- return this.getValueContainer().$refs.input;
726
- },
727
- focusInput() {
728
- this.getInput().focus();
729
- },
730
- blurInput() {
731
- this.getInput().blur();
732
- },
733
- handleMouseDown: _(function(e) {
734
- e.preventDefault(), e.stopPropagation(), !this.disabled && (this.getValueContainer().$el.contains(e.target) && !this.menu.isOpen && (this.openOnClick || this.trigger.isFocused) && this.openMenu(), this._blurOnSelect ? this.blurInput() : this.focusInput(), this.resetFlags());
735
- }),
736
- handleClickOutside(e) {
737
- // istanbul ignore else
738
- this.$refs.wrapper && !this.$refs.wrapper.contains(e.target) && (this.blurInput(), this.closeMenu());
739
- },
740
- handleLocalSearch() {
741
- let { searchQuery: e } = this.trigger, t = () => this.resetHighlightedOptionWhenNecessary(!0);
742
- if (!e) return this.localSearch.active = !1, t();
743
- this.localSearch.active = !0, this.localSearch.noResults = !0, this.traverseAllNodesDFS((e) => {
744
- e.isBranch && (e.isExpandedOnSearch = !1, e.showAllChildrenOnSearch = !1, e.isMatched = !1, e.hasMatchedDescendants = !1, this.localSearch.countMap[e.id] = {
745
- [M]: 0,
746
- [N]: 0,
747
- [P]: 0,
748
- [F]: 0
749
- });
750
- });
751
- let n = e.trim().toLocaleLowerCase(), r = n.replace(/\s+/g, " ").split(" ");
752
- this.traverseAllNodesDFS((e) => {
753
- this.searchNested && r.length > 1 ? e.isMatched = r.every((t) => V(!1, t, e.nestedSearchLabel)) : e.isMatched = this.matchKeys.some((t) => V(!this.disableFuzzyMatching, n, e.lowerCased[t])), e.isMatched && (this.localSearch.noResults = !1, e.ancestors.forEach((e) => this.localSearch.countMap[e.id][N]++), e.isLeaf && e.ancestors.forEach((e) => this.localSearch.countMap[e.id][F]++), e.parentNode !== null && (this.localSearch.countMap[e.parentNode.id][M] += 1, e.isLeaf && (this.localSearch.countMap[e.parentNode.id][P] += 1))), (e.isMatched || e.isBranch && e.isExpandedOnSearch) && e.parentNode !== null && (e.parentNode.isExpandedOnSearch = !0, e.parentNode.hasMatchedDescendants = !0);
754
- }), t();
755
- },
756
- handleRemoteSearch() {
757
- let { searchQuery: e } = this.trigger, t = this.getRemoteSearchEntry(), n = () => {
758
- this.initialize(), this.resetHighlightedOptionWhenNecessary(!0);
759
- };
760
- if ((e === "" || this.cacheOptions) && t.isLoaded) return n();
761
- this.callLoadOptionsProp({
762
- action: de,
763
- args: { searchQuery: e },
764
- isPending() {
765
- return t.isLoading;
766
- },
767
- start: () => {
768
- t.isLoading = !0, t.isLoaded = !1, t.loadingError = "";
769
- },
770
- succeed: (r) => {
771
- t.isLoaded = !0, t.options = r, this.trigger.searchQuery === e && n();
772
- },
773
- fail: (e) => {
774
- t.loadingError = H(e);
775
- },
776
- end: () => {
777
- t.isLoading = !1;
778
- }
779
- });
780
- },
781
- getRemoteSearchEntry() {
782
- let { searchQuery: e } = this.trigger, t = this.remoteSearch[e] || {
783
- ...B(),
784
- options: []
785
- };
786
- if (this.$watch(() => t.options, () => {
787
- this.trigger.searchQuery === e && this.initialize();
788
- }, { deep: !0 }), e === "") {
789
- if (Array.isArray(this.defaultOptions)) return t.options = this.defaultOptions, t.isLoaded = !0, t;
790
- if (this.defaultOptions !== !0) return t.isLoaded = !0, t;
791
- }
792
- return this.remoteSearch[e] || (this.remoteSearch[e] = t), t;
793
- },
794
- shouldExpand(e) {
795
- return this.localSearch.active ? e.isExpandedOnSearch : e.isExpanded;
796
- },
797
- shouldOptionBeIncludedInSearchResult(e) {
798
- return !!(e.isMatched || e.isBranch && e.hasMatchedDescendants && !this.flattenSearchResults || !e.isRootNode && e.parentNode.showAllChildrenOnSearch);
799
- },
800
- shouldShowOptionInMenu(e) {
801
- return !(this.localSearch.active && !this.shouldOptionBeIncludedInSearchResult(e));
802
- },
803
- getControl() {
804
- return this.$refs.control.$el;
805
- },
806
- getMenu() {
807
- let e = (this.appendToBody ? this.$refs.portal.portalTarget : this).$refs.menu.$refs.menu;
808
- return e && e.nodeName !== "#comment" ? e : null;
809
- },
810
- setCurrentHighlightedOption(e, t = !0) {
811
- let n = this.menu.current;
812
- if (n != null && n in this.forest.nodeMap && (this.forest.nodeMap[n].isHighlighted = !1), this.menu.current = e.id, e.isHighlighted = !0, this.menu.isOpen && t) {
813
- let t = () => {
814
- let t = this.getMenu(), n = t.querySelector(`.vue-treeselect__option[data-id="${e.id}"]`);
815
- n && v(t, n);
816
- };
817
- this.getMenu() ? t() : this.$nextTick(t);
818
- }
819
- },
820
- resetHighlightedOptionWhenNecessary(e = !1) {
821
- let { current: t } = this.menu;
822
- (e || t == null || !(t in this.forest.nodeMap) || !this.shouldShowOptionInMenu(this.getNode(t))) && this.highlightFirstOption();
823
- },
824
- highlightFirstOption() {
825
- if (!this.hasVisibleOptions) return;
826
- let e = this.visibleOptionIds[0];
827
- this.setCurrentHighlightedOption(this.getNode(e));
828
- },
829
- highlightPrevOption() {
830
- if (!this.hasVisibleOptions) return;
831
- let e = this.visibleOptionIds.indexOf(this.menu.current) - 1;
832
- if (e === -1) return this.highlightLastOption();
833
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
834
- },
835
- highlightNextOption() {
836
- if (!this.hasVisibleOptions) return;
837
- let e = this.visibleOptionIds.indexOf(this.menu.current) + 1;
838
- if (e === this.visibleOptionIds.length) return this.highlightFirstOption();
839
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
840
- },
841
- highlightLastOption() {
842
- if (!this.hasVisibleOptions) return;
843
- let e = p(this.visibleOptionIds);
844
- this.setCurrentHighlightedOption(this.getNode(e));
845
- },
846
- resetSearchQuery() {
847
- this.trigger.searchQuery = "";
848
- },
849
- closeMenu() {
850
- !this.menu.isOpen || !this.disabled && this.alwaysOpen || (this.saveMenuScrollPosition(), this.menu.isOpen = !1, this.toggleClickOutsideEvent(!1), this.resetSearchQuery(), this.$emit("close", this.getValue(), this.getInstanceId()));
851
- },
852
- openMenu() {
853
- this.disabled || this.menu.isOpen || (this.menu.isOpen = !0, this.$nextTick(this.resetHighlightedOptionWhenNecessary), this.$nextTick(this.restoreMenuScrollPosition), !this.options && !this.async && this.loadRootOptions(), this.toggleClickOutsideEvent(!0), this.$emit("open", this.getInstanceId()));
854
- },
855
- toggleMenu() {
856
- this.menu.isOpen ? this.closeMenu() : this.openMenu();
857
- },
858
- toggleExpanded(e) {
859
- let t;
860
- this.localSearch.active ? (t = e.isExpandedOnSearch = !e.isExpandedOnSearch, t && (e.showAllChildrenOnSearch = !0)) : t = e.isExpanded = !e.isExpanded, t && !e.childrenStates.isLoaded && this.loadChildrenOptions(e);
861
- },
862
- buildForestState() {
863
- let e = E();
864
- this.forest.selectedNodeIds.forEach((t) => {
865
- e[t] = !0;
866
- }), this.forest.selectedNodeMap = e;
867
- let t = E();
868
- this.multiple && (this.traverseAllNodesByIndex((e) => {
869
- t[e.id] = 0;
870
- }), this.selectedNodes.forEach((e) => {
871
- t[e.id] = 2, !this.flat && !this.disableBranchNodes && e.ancestors.forEach((e) => {
872
- this.isSelected(e) || (t[e.id] = 1);
873
- });
874
- })), this.forest.checkedStateMap = t;
875
- },
876
- enhancedNormalizer(e) {
877
- return {
878
- ...e,
879
- ...this.normalizer(e, this.getInstanceId())
880
- };
881
- },
882
- normalize(e, t, n) {
883
- let r = t.map((e) => [this.enhancedNormalizer(e), e]).map(([t, r], i) => {
884
- this.checkDuplication(t), this.verifyNodeShape(t);
885
- let { id: a, label: o, children: s, isDefaultExpanded: c } = t, l = e === null, u = l ? 0 : e.level + 1, d = Array.isArray(s) || s === null, f = !d, p = !!t.isDisabled || !this.flat && !l && e.isDisabled, m = !!t.isNew, h = this.matchKeys.reduce((e, n) => ({
886
- ...e,
887
- [n]: ve(t[n]).toLocaleLowerCase()
888
- }), {}), _ = l ? h.label : `${e.nestedSearchLabel} ${h.label}`;
889
- this.forest.nodeMap[a] = E;
890
- let v = this.forest.nodeMap[a];
891
- if (v.id = a, v.label = o, v.level = u, v.ancestors = l ? [] : [e].concat(e.ancestors), v.index = (l ? [] : e.index).concat(i), v.parentNode = e, v.lowerCased = h, v.nestedSearchLabel = _, v.isDisabled = p, v.isNew = m, v.isMatched = !1, v.isHighlighted = !1, v.isBranch = d, v.isLeaf = f, v.isRootNode = l, v.raw = r, d) {
892
- let e = Array.isArray(s);
893
- v.childrenStates = {
894
- ...B(),
895
- isLoaded: e
896
- }, v.isExpanded = typeof c == "boolean" ? c : u < this.defaultExpandLevel, v.hasMatchedDescendants = !1, v.hasDisabledDescendants = !1, v.isExpandedOnSearch = !1, v.showAllChildrenOnSearch = !1, v.count = {
897
- [M]: 0,
898
- [N]: 0,
899
- [P]: 0,
900
- [F]: 0
901
- }, v.children = e ? this.normalize(v, s, n) : [], c === !0 && v.ancestors.forEach((e) => {
902
- e.isExpanded = !0;
903
- }), !e && typeof this.loadOptions != "function" ? g(() => !1, () => "Unloaded branch node detected. \"loadOptions\" prop is required to load its children.") : !e && v.isExpanded && this.loadChildrenOptions(v);
904
- }
905
- if (v.ancestors.forEach((e) => e.count[N]++), f && v.ancestors.forEach((e) => e.count[F]++), l || (e.count[M] += 1, f && (e.count[P] += 1), p && (e.hasDisabledDescendants = !0)), n && n[a]) {
906
- let e = n[a];
907
- v.isMatched = e.isMatched, v.showAllChildrenOnSearch = e.showAllChildrenOnSearch, v.isHighlighted = e.isHighlighted, e.isBranch && v.isBranch && (v.isExpanded = e.isExpanded, v.isExpandedOnSearch = e.isExpandedOnSearch, e.childrenStates.isLoaded && !v.childrenStates.isLoaded ? v.isExpanded = !1 : v.childrenStates = { ...e.childrenStates });
908
- }
909
- return v;
910
- });
911
- if (this.branchNodesFirst) {
912
- let e = r.filter((e) => e.isBranch), t = r.filter((e) => e.isLeaf);
913
- r = e.concat(t);
914
- }
915
- return r;
916
- },
917
- loadRootOptions() {
918
- this.callLoadOptionsProp({
919
- action: le,
920
- isPending: () => this.rootOptionsStates.isLoading,
921
- start: () => {
922
- this.rootOptionsStates.isLoading = !0, this.rootOptionsStates.loadingError = "";
923
- },
924
- succeed: () => {
925
- this.rootOptionsStates.isLoaded = !0, this.$nextTick(() => {
926
- this.resetHighlightedOptionWhenNecessary(!0);
927
- });
928
- },
929
- fail: (e) => {
930
- this.rootOptionsStates.loadingError = H(e);
931
- },
932
- end: () => {
933
- this.rootOptionsStates.isLoading = !1;
934
- }
935
- });
936
- },
937
- loadChildrenOptions(e) {
938
- let { id: t, raw: n } = e;
939
- this.callLoadOptionsProp({
940
- action: ue,
941
- args: { parentNode: n },
942
- isPending: () => this.getNode(t).childrenStates.isLoading,
943
- start: () => {
944
- this.getNode(t).childrenStates.isLoading = !0, this.getNode(t).childrenStates.loadingError = "";
945
- },
946
- succeed: () => {
947
- this.getNode(t).childrenStates.isLoaded = !0;
948
- },
949
- fail: (e) => {
950
- this.getNode(t).childrenStates.loadingError = H(e);
951
- },
952
- end: () => {
953
- this.getNode(t).childrenStates.isLoading = !1;
954
- }
955
- });
956
- },
957
- callLoadOptionsProp({ action: e, args: t, isPending: n, start: r, succeed: i, fail: a, end: o }) {
958
- if (!this.loadOptions || n()) return;
959
- r();
960
- let s = h((e, t) => {
961
- e ? a(e) : i(t), o();
962
- }), c = this.loadOptions({
963
- id: this.getInstanceId(),
964
- instanceId: this.getInstanceId(),
965
- action: e,
966
- ...t,
967
- callback: s
968
- });
969
- u(c) && c.then(() => {
970
- s();
971
- }, (e) => {
972
- s(e);
973
- }).catch((e) => {
974
- // istanbul ignore next
975
- console.error(e);
976
- });
977
- },
978
- checkDuplication(e) {
979
- g(() => !(e.id in this.forest.nodeMap && !this.forest.nodeMap[e.id].isFallbackNode), () => `Detected duplicate presence of node id ${JSON.stringify(e.id)}. Their labels are "${this.forest.nodeMap[e.id].label}" and "${e.label}" respectively.`);
980
- },
981
- verifyNodeShape(e) {
982
- g(() => !(e.children === void 0 && e.isBranch === !0), () => "Are you meant to declare an unloaded branch node? `isBranch: true` is no longer supported, please use `children: null` instead.");
983
- },
984
- select(e) {
985
- if (this.disabled || e.isDisabled) return;
986
- this.single && this.clear();
987
- let t = this.multiple && !this.flat ? this.forest.checkedStateMap[e.id] === 0 : !this.isSelected(e);
988
- t ? this._selectNode(e) : this._deselectNode(e), this.buildForestState(), t ? this.$emit("select", e.raw, this.getInstanceId()) : this.$emit("deselect", e.raw, this.getInstanceId()), this.localSearch.active && t && (this.single || this.clearOnSelect) && this.resetSearchQuery(), this.single && this.closeOnSelect && (this.closeMenu(), this.searchable && (this._blurOnSelect = !0));
989
- },
990
- clear() {
991
- this.hasValue && (this.single || this.allowClearingDisabled ? this.forest.selectedNodeIds = [] : this.forest.selectedNodeIds = this.forest.selectedNodeIds.filter((e) => this.getNode(e).isDisabled), this.buildForestState());
992
- },
993
- _selectNode(e) {
994
- if (this.single || this.disableBranchNodes) return this.addValue(e);
995
- if (this.flat) {
996
- this.addValue(e), this.autoSelectAncestors ? e.ancestors.forEach((e) => {
997
- !this.isSelected(e) && !e.isDisabled && this.addValue(e);
998
- }) : this.autoSelectDescendants && this.traverseDescendantsBFS(e, (e) => {
999
- !this.isSelected(e) && !e.isDisabled && this.addValue(e);
1000
- });
1001
- return;
1002
- }
1003
- let t = e.isLeaf || !e.hasDisabledDescendants || this.allowSelectingDisabledDescendants;
1004
- if (t && this.addValue(e), e.isBranch && this.traverseDescendantsBFS(e, (e) => {
1005
- (!e.isDisabled || this.allowSelectingDisabledDescendants) && this.addValue(e);
1006
- }), t) {
1007
- let t = e;
1008
- for (; (t = t.parentNode) !== null && t.children.every(this.isSelected);) this.addValue(t);
1009
- }
1010
- },
1011
- _deselectNode(e) {
1012
- if (this.disableBranchNodes) return this.removeValue(e);
1013
- if (this.flat) {
1014
- this.removeValue(e), this.autoDeselectAncestors ? e.ancestors.forEach((e) => {
1015
- this.isSelected(e) && !e.isDisabled && this.removeValue(e);
1016
- }) : this.autoDeselectDescendants && this.traverseDescendantsBFS(e, (e) => {
1017
- this.isSelected(e) && !e.isDisabled && this.removeValue(e);
1018
- });
1019
- return;
1020
- }
1021
- let t = !1;
1022
- if (e.isBranch && this.traverseDescendantsDFS(e, (e) => {
1023
- (!e.isDisabled || this.allowSelectingDisabledDescendants) && (this.removeValue(e), t = !0);
1024
- }), e.isLeaf || t || e.children.length === 0) {
1025
- this.removeValue(e);
1026
- let t = e;
1027
- for (; (t = t.parentNode) !== null && this.isSelected(t);) this.removeValue(t);
1028
- }
1029
- },
1030
- addValue(e) {
1031
- this.forest.selectedNodeIds.push(e.id), this.forest.selectedNodeMap[e.id] = !0;
1032
- },
1033
- removeValue(e) {
1034
- y(this.forest.selectedNodeIds, e.id), delete this.forest.selectedNodeMap[e.id];
1035
- },
1036
- removeLastValue() {
1037
- if (!this.hasValue) return;
1038
- if (this.single) return this.clear();
1039
- let e = p(this.internalValue), t = this.getNode(e);
1040
- this.select(t);
1041
- },
1042
- saveMenuScrollPosition() {
1043
- let e = this.getMenu();
1044
- // istanbul ignore else
1045
- e && (this.menu.lastScrollPosition = e.scrollTop);
1046
- },
1047
- restoreMenuScrollPosition() {
1048
- let e = this.getMenu();
1049
- // istanbul ignore else
1050
- e && (e.scrollTop = this.menu.lastScrollPosition);
1051
- }
1052
- },
1053
- created() {
1054
- this.verifyProps(), this.resetFlags();
1055
- },
1056
- mounted() {
1057
- this.autoFocus && this.focusInput(), !this.options && !this.async && this.autoLoadRootOptions && this.loadRootOptions(), this.alwaysOpen && this.openMenu(), this.async && this.defaultOptions && this.handleRemoteSearch();
1058
- },
1059
- destroyed() {
1060
- // istanbul ignore next
1061
- this.toggleClickOutsideEvent(!1);
1062
- }
1063
- };
1064
- //#endregion
1065
- //#region src/components/tree-select/components/VueTreeSelectHiddenFields.vue?vue&type=script&lang.jsx
1066
- function xe(e) {
1067
- // istanbul ignore next
1068
- return typeof e == "string" ? e : e != null && !T(e) ? JSON.stringify(e) : "";
1069
- }
1070
- //#endregion
1071
- //#region src/components/tree-select/components/VueTreeSelectHiddenFields.vue
1072
- var Se = {
1073
- name: "VueTreeSelectHiddenFields",
1074
- inject: ["instance"],
1075
- render() {
1076
- if (!this.instance.name || this.instance.disabled || !this.instance.hasValue) return null;
1077
- let e = this.instance.internalValue.map(xe);
1078
- return this.instance.multiple && this.instance.joinValues && (e = [e.join(this.instance.delimiter)]), e.map((e, t) => a("input", {
1079
- type: "hidden",
1080
- name: this.instance.name,
1081
- value: e,
1082
- key: `hidden-field-${t}`
1083
- }, null));
1084
- }
1085
- }, Ce = [
1086
- R.ENTER,
1087
- R.END,
1088
- R.HOME,
1089
- R.ARROW_LEFT,
1090
- R.ARROW_UP,
1091
- R.ARROW_RIGHT,
1092
- R.ARROW_DOWN
1093
- ], U = {
1094
- name: "VueTreeSelectInput",
1095
- inject: ["instance"],
1096
- data: () => ({
1097
- inputWidth: 5,
1098
- value: ""
1099
- }),
1100
- computed: {
1101
- needAutoSize() {
1102
- let { instance: e } = this;
1103
- return e.searchable && !e.disabled && e.multiple;
1104
- },
1105
- inputStyle() {
1106
- return { width: this.needAutoSize ? `${this.inputWidth}px` : null };
1107
- }
1108
- },
1109
- watch: {
1110
- "instance.trigger.searchQuery"(e) {
1111
- this.value = e;
1112
- },
1113
- value() {
1114
- // istanbul ignore else
1115
- this.needAutoSize && this.$nextTick(this.updateInputWidth);
1116
- }
1117
- },
1118
- created() {
1119
- this.debouncedCallback = d(this.updateSearchQuery, ge, {
1120
- leading: !0,
1121
- trailing: !0
1122
- });
1123
- },
1124
- methods: {
1125
- clear() {
1126
- this.onInput({ target: { value: "" } });
1127
- },
1128
- focus() {
1129
- let { instance: e } = this;
1130
- if (!e.disabled) {
1131
- var t;
1132
- (t = this.$refs.input) == null || t.focus();
1133
- }
1134
- },
1135
- blur() {
1136
- var e;
1137
- (e = this.$refs.input) == null || e.blur();
1138
- },
1139
- onFocus() {
1140
- let { instance: e } = this;
1141
- // istanbul ignore else
1142
- e.trigger.isFocused = !0, e.openOnFocus && e.openMenu();
1143
- },
1144
- onBlur() {
1145
- let { instance: e } = this, t = e.getMenu();
1146
- // istanbul ignore next
1147
- if (t && document.activeElement === t) return this.focus();
1148
- e.trigger.isFocused = !1, e.closeMenu();
1149
- },
1150
- onInput(e) {
1151
- let { value: t } = e.target;
1152
- this.value = t, t ? this.debouncedCallback() : (this.debouncedCallback.cancel(), this.updateSearchQuery());
1153
- },
1154
- onKeyDown(e) {
1155
- let { instance: t } = this, n = "which" in e ? e.which : e.keyCode;
1156
- if (!(e.ctrlKey || e.shiftKey || e.altKey || e.metaKey)) {
1157
- if (!t.menu.isOpen && k(Ce, n)) return e.preventDefault(), t.openMenu();
1158
- switch (n) {
1159
- case R.BACKSPACE:
1160
- t.backspaceRemoves && !this.value.length && t.removeLastValue();
1161
- break;
1162
- case R.ENTER: {
1163
- if (e.preventDefault(), t.menu.current === null) return;
1164
- let n = t.getNode(t.menu.current);
1165
- if (n.isBranch && t.disableBranchNodes) return;
1166
- t.select(n);
1167
- break;
1168
- }
1169
- case R.ESCAPE:
1170
- this.value.length ? this.clear() : t.menu.isOpen && t.closeMenu();
1171
- break;
1172
- case R.END:
1173
- e.preventDefault(), t.highlightLastOption();
1174
- break;
1175
- case R.HOME:
1176
- e.preventDefault(), t.highlightFirstOption();
1177
- break;
1178
- case R.ARROW_LEFT: {
1179
- let n = t.getNode(t.menu.current);
1180
- n.isBranch && t.shouldExpand(n) ? (e.preventDefault(), t.toggleExpanded(n)) : !n.isRootNode && (n.isLeaf || n.isBranch && !t.shouldExpand(n)) && (e.preventDefault(), t.setCurrentHighlightedOption(n.parentNode));
1181
- break;
1182
- }
1183
- case R.ARROW_UP:
1184
- e.preventDefault(), t.highlightPrevOption();
1185
- break;
1186
- case R.ARROW_RIGHT: {
1187
- let n = t.getNode(t.menu.current);
1188
- n.isBranch && !t.shouldExpand(n) && (e.preventDefault(), t.toggleExpanded(n));
1189
- break;
1190
- }
1191
- case R.ARROW_DOWN:
1192
- e.preventDefault(), t.highlightNextOption();
1193
- break;
1194
- case R.DELETE:
1195
- t.deleteRemoves && !this.value.length && t.removeLastValue();
1196
- break;
1197
- default:
1198
- // istanbul ignore else
1199
- t.openMenu();
1200
- }
1201
- }
1202
- },
1203
- onMouseDown(e) {
1204
- // istanbul ignore next
1205
- this.value.length && e.stopPropagation();
1206
- },
1207
- renderInputContainer() {
1208
- let { instance: e } = this, t = {}, n = [];
1209
- return e.searchable && !e.disabled && (n.push(this.renderInput()), this.needAutoSize && n.push(this.renderSizer())), e.searchable || O(t, {
1210
- on: {
1211
- focus: this.onFocus,
1212
- blur: this.onBlur,
1213
- keydown: this.onKeyDown
1214
- },
1215
- ref: "input"
1216
- }), !e.searchable && !e.disabled && O(t, { attrs: { tabIndex: e.tabIndex } }), a("div", s({ class: "vue-treeselect__input-container" }, t), [n]);
1217
- },
1218
- renderInput() {
1219
- let { instance: e } = this;
1220
- return a("input", {
1221
- ref: "input",
1222
- class: "vue-treeselect__input",
1223
- type: "text",
1224
- autocomplete: "off",
1225
- tabIndex: e.tabIndex,
1226
- required: e.required && !e.hasValue,
1227
- value: this.value,
1228
- style: this.inputStyle,
1229
- onFocus: this.onFocus,
1230
- onInput: this.onInput,
1231
- onBlur: this.onBlur,
1232
- onKeydown: this.onKeyDown,
1233
- onMousedown: this.onMouseDown
1234
- }, null);
1235
- },
1236
- renderSizer() {
1237
- return a("div", {
1238
- ref: "sizer",
1239
- class: "vue-treeselect__sizer"
1240
- }, [this.value]);
1241
- },
1242
- updateInputWidth() {
1243
- this.inputWidth = Math.max(5, this.$refs.sizer.scrollWidth + 15);
1244
- },
1245
- updateSearchQuery() {
1246
- let { instance: e } = this;
1247
- e.trigger.searchQuery = this.value;
1248
- }
1249
- },
1250
- render() {
1251
- return this.renderInputContainer();
1252
- }
1253
- }, W = {
1254
- name: "VueTreeSelectPlaceholder",
1255
- inject: ["instance"],
1256
- render() {
1257
- let { instance: e } = this;
1258
- return a("div", { class: {
1259
- "vue-treeselect__placeholder": !0,
1260
- "vue-treeselect-helper-zoom-effect-off": !0,
1261
- "vue-treeselect-helper-hide": e.hasValue || e.trigger.searchQuery
1262
- } }, [e.placeholder]);
1263
- }
1264
- }, we = {
1265
- name: "VueTreeSelectSingleValue",
1266
- inject: ["instance"],
1267
- methods: { renderSingleValueLabel() {
1268
- let { instance: e } = this, t = e.selectedNodes[0], n = e.$slots["value-label"];
1269
- return n ? n({ node: t }) : t.label;
1270
- } },
1271
- render() {
1272
- let { instance: e, $parent: { renderValueContainer: t } } = this;
1273
- return t([
1274
- e.hasValue && !e.trigger.searchQuery && a("div", { class: "vue-treeselect__single-value" }, [this.renderSingleValueLabel()]),
1275
- a(W, null, null),
1276
- a(U, { ref: "input" }, null)
1277
- ]);
1278
- }
1279
- }, Te = { name: "VueTreeSelectDelete" }, Ee = {
1280
- xmlns: "http://www.w3.org/2000/svg",
1281
- viewBox: "0 0 348.333 348.333"
1282
- };
1283
- function De(e, t, i, a, o, s) {
1284
- return c(), n("svg", Ee, [...t[0] || (t[0] = [r("path", { d: "M336.559 68.611L231.016 174.165l105.543 105.549c15.699 15.705 15.699 41.145 0 56.85-7.844 7.844-18.128 11.769-28.407 11.769-10.296 0-20.581-3.919-28.419-11.769L174.167 231.003 68.609 336.563c-7.843 7.844-18.128 11.769-28.416 11.769-10.285 0-20.563-3.919-28.413-11.769-15.699-15.698-15.699-41.139 0-56.85l105.54-105.549L11.774 68.611c-15.699-15.699-15.699-41.145 0-56.844 15.696-15.687 41.127-15.687 56.829 0l105.563 105.554L279.721 11.767c15.705-15.687 41.139-15.687 56.832 0 15.705 15.699 15.705 41.145.006 56.844z" }, null, -1)])]);
1285
- }
1286
- var G = /* @__PURE__ */ e(Te, [["render", De]]), Oe = {
1287
- name: "VueTreeSelectMultiValueItem",
1288
- inject: ["instance"],
1289
- props: { node: {
1290
- type: Object,
1291
- required: !0
1292
- } },
1293
- methods: { handleMouseDown: _(function() {
1294
- let { instance: e, node: t } = this;
1295
- e.select(t);
1296
- }) },
1297
- render() {
1298
- let { instance: e, node: t } = this, n = {
1299
- "vue-treeselect__multi-value-item": !0,
1300
- "vue-treeselect__multi-value-item-disabled": t.isDisabled,
1301
- "vue-treeselect__multi-value-item-new": t.isNew
1302
- }, r = e.$slots["value-label"], i = r ? r({ node: t }) : t.label;
1303
- return a("div", { class: "vue-treeselect__multi-value-item-container" }, [a("div", {
1304
- class: n,
1305
- onMousedown: this.handleMouseDown
1306
- }, [a("span", { class: "vue-treeselect__multi-value-label" }, [i]), a("span", { class: "vue-treeselect__icon vue-treeselect__value-remove" }, [a(G, null, null)])])]);
1307
- }
1308
- }, ke = {
1309
- name: "VueTreeSelectMultiValue",
1310
- inject: ["instance"],
1311
- methods: {
1312
- renderMultiValueItems() {
1313
- let { instance: e } = this;
1314
- return e.internalValue.slice(0, e.limit).map(e.getNode).map((e) => a(Oe, {
1315
- key: `multi-value-item-${e.id}`,
1316
- node: e
1317
- }, null));
1318
- },
1319
- renderExceedLimitTip() {
1320
- let { instance: e } = this, t = e.internalValue.length - e.limit;
1321
- return t <= 0 ? null : a("div", {
1322
- class: "vue-treeselect__limit-tip vue-treeselect-helper-zoom-effect-off",
1323
- key: "exceed-limit-tip"
1324
- }, [a("span", { class: "vue-treeselect__limit-tip-text" }, [e.limitText(t)])]);
1325
- }
1326
- },
1327
- render() {
1328
- let { renderValueContainer: e } = this.$parent;
1329
- return e(a(l("transition-group"), s({ class: "vue-treeselect__multi-value" }, { props: {
1330
- tag: "div",
1331
- name: "vue-treeselect__multi-value-item--transition",
1332
- appear: !0
1333
- } }), { default: () => [
1334
- this.renderMultiValueItems(),
1335
- this.renderExceedLimitTip(),
1336
- a(W, { key: "placeholder" }, null),
1337
- a(U, {
1338
- ref: "input",
1339
- key: "input"
1340
- }, null)
1341
- ] }));
1342
- }
1343
- }, Ae = { name: "VueTreeSelectArrow" }, je = {
1344
- xmlns: "http://www.w3.org/2000/svg",
1345
- viewBox: "0 0 292.362 292.362"
1346
- };
1347
- function Me(e, t, i, a, o, s) {
1348
- return c(), n("svg", je, [...t[0] || (t[0] = [r("path", { d: "M286.935 69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952 0-9.233 1.807-12.85 5.424C1.807 72.998 0 77.279 0 82.228c0 4.948 1.807 9.229 5.424 12.847l127.907 127.907c3.621 3.617 7.902 5.428 12.85 5.428s9.233-1.811 12.847-5.428L286.935 95.074c3.613-3.617 5.427-7.898 5.427-12.847 0-4.948-1.814-9.229-5.427-12.85z" }, null, -1)])]);
1349
- }
1350
- var K = /* @__PURE__ */ e(Ae, [["render", Me]]), Ne = {
1351
- name: "VueTreeSelectControl",
1352
- inject: ["instance"],
1353
- computed: {
1354
- shouldShowX() {
1355
- let { instance: e } = this;
1356
- return e.clearable && !e.disabled && e.hasValue && (this.hasUndisabledValue || e.allowClearingDisabled);
1357
- },
1358
- shouldShowArrow() {
1359
- let { instance: e } = this;
1360
- return e.alwaysOpen ? !e.menu.isOpen : !0;
1361
- },
1362
- hasUndisabledValue() {
1363
- let { instance: e } = this;
1364
- return e.hasValue && e.internalValue.some((t) => !e.getNode(t).isDisabled);
1365
- }
1366
- },
1367
- methods: {
1368
- renderX() {
1369
- let { instance: e } = this, t = e.multiple ? e.clearAllText : e.clearValueText;
1370
- return this.shouldShowX ? a("div", {
1371
- class: "vue-treeselect__x-container",
1372
- title: t,
1373
- onMousedown: this.handleMouseDownOnX
1374
- }, [a(G, { class: "vue-treeselect__x" }, null)]) : null;
1375
- },
1376
- renderArrow() {
1377
- let { instance: e } = this, t = {
1378
- "vue-treeselect__control-arrow": !0,
1379
- "vue-treeselect__control-arrow--rotated": e.menu.isOpen
1380
- };
1381
- return this.shouldShowArrow ? a("div", {
1382
- class: "vue-treeselect__control-arrow-container",
1383
- onMousedown: this.handleMouseDownOnArrow
1384
- }, [a(K, { class: t }, null)]) : null;
1385
- },
1386
- handleMouseDownOnX: _(function(e) {
1387
- e.stopPropagation(), e.preventDefault();
1388
- let { instance: t } = this, n = t.beforeClearAll(), r = (e) => {
1389
- e && t.clear();
1390
- };
1391
- u(n) ? n.then(r) : setTimeout(() => r(n), 0);
1392
- }),
1393
- handleMouseDownOnArrow: _(function(e) {
1394
- e.preventDefault(), e.stopPropagation();
1395
- let { instance: t } = this;
1396
- t.focusInput(), t.toggleMenu();
1397
- }),
1398
- renderValueContainer(e) {
1399
- return a("div", { class: "vue-treeselect__value-container" }, [e]);
1400
- }
1401
- },
1402
- render() {
1403
- let { instance: e } = this, t = e.single ? we : ke;
1404
- return a("div", {
1405
- class: "vue-treeselect__control",
1406
- onMousedown: e.handleMouseDown
1407
- }, [
1408
- a(t, { ref: "value-container" }, null),
1409
- this.renderX(),
1410
- this.renderArrow()
1411
- ]);
1412
- }
1413
- }, q = {
1414
- name: "VueTreeSelectTip",
1415
- functional: !0,
1416
- props: {
1417
- type: {
1418
- type: String,
1419
- required: !0
1420
- },
1421
- icon: {
1422
- type: String,
1423
- required: !0
1424
- }
1425
- },
1426
- render(e, t) {
1427
- let { props: n, children: r } = t;
1428
- return a("div", { class: `vue-treeselect__tip vue-treeselect__${n.type}-tip` }, [a("div", { class: "vue-treeselect__icon-container" }, [a("span", { class: `vue-treeselect__icon-${n.icon}` }, null)]), a("span", { class: `vue-treeselect__tip-text vue-treeselect__${n.type}-tip-text` }, [r])]);
1429
- }
1430
- };
1431
- //#endregion
1432
- //#region src/components/tree-select/components/VueTreeSelectOption.vue?vue&type=script&lang.jsx
1433
- function Pe(e) {
1434
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !o(e);
1435
- }
1436
- var J, Y, X, Z = {
1437
- name: "VueTreeSelectOption",
1438
- inject: ["instance"],
1439
- props: { node: {
1440
- type: Object,
1441
- required: !0
1442
- } },
1443
- computed: {
1444
- shouldExpand() {
1445
- let { instance: e, node: t } = this;
1446
- return t.isBranch && e.shouldExpand(t);
1447
- },
1448
- shouldShow() {
1449
- let { instance: e, node: t } = this;
1450
- return e.shouldShowOptionInMenu(t);
1451
- }
1452
- },
1453
- methods: {
1454
- renderOption() {
1455
- let { instance: e, node: t } = this;
1456
- return a("div", {
1457
- class: {
1458
- "vue-treeselect__option": !0,
1459
- "vue-treeselect__option--disabled": t.isDisabled,
1460
- "vue-treeselect__option--selected": e.isSelected(t),
1461
- "vue-treeselect__option--highlight": t.isHighlighted,
1462
- "vue-treeselect__option--matched": e.localSearch.active && t.isMatched,
1463
- "vue-treeselect__option--hide": !this.shouldShow
1464
- },
1465
- onMouseenter: this.handleMouseEnterOption,
1466
- "data-id": t.id
1467
- }, [this.renderArrow(), this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]), this.renderLabel()])]);
1468
- },
1469
- renderSubOptionsList() {
1470
- return this.shouldExpand ? a("div", { class: "vue-treeselect__list" }, [
1471
- this.renderSubOptions(),
1472
- this.renderNoChildrenTip(),
1473
- this.renderLoadingChildrenTip(),
1474
- this.renderLoadingChildrenErrorTip()
1475
- ]) : null;
1476
- },
1477
- renderArrow() {
1478
- let { instance: e, node: t } = this;
1479
- if (e.shouldFlattenOptions && this.shouldShow) return null;
1480
- if (t.isBranch) {
1481
- let e = { props: {
1482
- name: "vue-treeselect__option-arrow--prepare",
1483
- appear: !0
1484
- } }, t = {
1485
- "vue-treeselect__option-arrow": !0,
1486
- "vue-treeselect__option-arrow--rotated": this.shouldExpand
1487
- };
1488
- return a("div", {
1489
- class: "vue-treeselect__option-arrow-container",
1490
- onMousedown: this.handleMouseDownOnArrow
1491
- }, [a(l("transition"), e, { default: () => [a(K, { class: t }, null)] })]);
1492
- }
1493
- return e.hasBranchNodes ? (J || (J = a("div", { class: "vue-treeselect__option-arrow-placeholder" }, [i("\xA0")])), J) : null;
1494
- },
1495
- renderLabelContainer(e) {
1496
- return a("div", {
1497
- class: "vue-treeselect__label-container",
1498
- onMousedown: this.handleMouseDownOnLabelContainer
1499
- }, [e]);
1500
- },
1501
- renderCheckboxContainer(e) {
1502
- let { instance: t, node: n } = this;
1503
- return t.single || t.disableBranchNodes && n.isBranch ? null : a("div", { class: "vue-treeselect__checkbox-container" }, [e]);
1504
- },
1505
- renderCheckbox() {
1506
- let { instance: e, node: t } = this, n = e.forest.checkedStateMap[t.id], r = {
1507
- "vue-treeselect__checkbox": !0,
1508
- "vue-treeselect__checkbox--checked": n === 2,
1509
- "vue-treeselect__checkbox--indeterminate": n === 1,
1510
- "vue-treeselect__checkbox--unchecked": n === 0,
1511
- "vue-treeselect__checkbox--disabled": t.isDisabled
1512
- };
1513
- return Y || (Y = a("span", { class: "vue-treeselect__check-mark" }, null)), X || (X = a("span", { class: "vue-treeselect__minus-mark" }, null)), a("span", { class: r }, [Y, X]);
1514
- },
1515
- renderLabel() {
1516
- let { instance: e, node: t } = this, n = t.isBranch && (e.localSearch.active ? e.showCountOnSearchComputed : e.showCount), r = n ? e.localSearch.active ? e.localSearch.countMap[t.id][e.showCountOf] : t.count[e.showCountOf] : NaN, o = "vue-treeselect__label", s = "vue-treeselect__count", c = e.$slots["option-label"];
1517
- return c ? c({
1518
- node: t,
1519
- shouldShowCount: n,
1520
- count: r,
1521
- labelClassName: o,
1522
- countClassName: s
1523
- }) : a("label", { class: o }, [t.label, n && a("span", { class: s }, [
1524
- i("("),
1525
- r,
1526
- i(")")
1527
- ])]);
1528
- },
1529
- renderSubOptions() {
1530
- let { node: e } = this;
1531
- return e.childrenStates.isLoaded ? e.children.map((e) => a(Z, {
1532
- node: e,
1533
- key: e.id
1534
- }, null)) : null;
1535
- },
1536
- renderNoChildrenTip() {
1537
- let { instance: e, node: t } = this;
1538
- return !t.childrenStates.isLoaded || t.children.length ? null : a(q, {
1539
- type: "no-children",
1540
- icon: "warning"
1541
- }, { default: () => [e.noChildrenText] });
1542
- },
1543
- renderLoadingChildrenTip() {
1544
- let { instance: e, node: t } = this;
1545
- return t.childrenStates.isLoading ? a(q, {
1546
- type: "loading",
1547
- icon: "loader"
1548
- }, { default: () => [e.loadingText] }) : null;
1549
- },
1550
- renderLoadingChildrenErrorTip() {
1551
- let { instance: e, node: t } = this;
1552
- return t.childrenStates.loadingError ? a(q, {
1553
- type: "error",
1554
- icon: "error"
1555
- }, { default: () => [t.childrenStates.loadingError, a("a", {
1556
- class: "vue-treeselect__retry",
1557
- title: e.retryTitle,
1558
- onMousedown: this.handleMouseDownOnRetry
1559
- }, [e.retryText])] }) : null;
1560
- },
1561
- handleMouseEnterOption(e) {
1562
- let { instance: t, node: n } = this;
1563
- e.target === e.currentTarget && t.setCurrentHighlightedOption(n, !1);
1564
- },
1565
- handleMouseDownOnArrow: _(function() {
1566
- let { instance: e, node: t } = this;
1567
- e.toggleExpanded(t);
1568
- }),
1569
- handleMouseDownOnLabelContainer: _(function() {
1570
- let { instance: e, node: t } = this;
1571
- t.isBranch && e.disableBranchNodes ? e.toggleExpanded(t) : e.select(t);
1572
- }),
1573
- handleMouseDownOnRetry: _(function() {
1574
- let { instance: e, node: t } = this;
1575
- e.loadChildrenOptions(t);
1576
- })
1577
- },
1578
- render() {
1579
- let e, { node: t } = this, n = this.instance.shouldFlattenOptions ? 0 : t.level;
1580
- return a("div", { class: {
1581
- "vue-treeselect__list-item": !0,
1582
- [`vue-treeselect__indent-level-${n}`]: !0
1583
- } }, [this.renderOption(), t.isBranch && a(l("transition"), { props: { name: "vue-treeselect__list--transition" } }, Pe(e = this.renderSubOptionsList()) ? e : { default: () => [e] })]);
1584
- }
1585
- }, Fe = Z;
1586
- //#endregion
1587
- //#region src/components/tree-select/components/VueTreeSelectMenu.vue?vue&type=script&lang.jsx
1588
- function Ie(e) {
1589
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !o(e);
1590
- }
1591
- var Le = {
1592
- top: "top",
1593
- bottom: "bottom",
1594
- above: "top",
1595
- below: "bottom"
1596
- }, Q = {
1597
- name: "VueTreeSelectMenu",
1598
- inject: ["instance"],
1599
- computed: {
1600
- menuStyle() {
1601
- let { instance: e } = this;
1602
- return { maxHeight: `${e.maxHeight}px` };
1603
- },
1604
- menuContainerStyle() {
1605
- let { instance: e } = this;
1606
- return { zIndex: e != null && e.appendToBody ? null : e == null ? void 0 : e.zIndex };
1607
- }
1608
- },
1609
- watch: { "instance.menu.isOpen"(e) {
1610
- e ? this.$nextTick(this.onMenuOpen) : this.onMenuClose();
1611
- } },
1612
- created() {
1613
- this.menuSizeWatcher = null, this.menuResizeAndScrollEventListeners = null;
1614
- },
1615
- mounted() {
1616
- let { instance: e } = this;
1617
- e != null && e.menu.isOpen && this.$nextTick(this.onMenuOpen);
1618
- },
1619
- unmounted() {
1620
- this.onMenuClose();
1621
- },
1622
- methods: {
1623
- renderMenu() {
1624
- var e;
1625
- let { instance: t } = this;
1626
- return !(t == null || (e = t.menu) == null) && e.isOpen ? a("div", {
1627
- ref: "menu",
1628
- class: "vue-treeselect__menu",
1629
- onMousedown: t.handleMouseDown,
1630
- style: this.menuStyle
1631
- }, [
1632
- this.renderBeforeList(),
1633
- t.async ? this.renderAsyncSearchMenuInner() : t.localSearch.active ? this.renderLocalSearchMenuInner() : this.renderNormalMenuInner(),
1634
- this.renderAfterList()
1635
- ]) : null;
1636
- },
1637
- renderBeforeList() {
1638
- let { instance: e } = this, t = e.$slots["before-list"];
1639
- return t ? t() : null;
1640
- },
1641
- renderAfterList() {
1642
- let { instance: e } = this, t = e.$slots["after-list"];
1643
- return t ? t() : null;
1644
- },
1645
- renderNormalMenuInner() {
1646
- let { instance: e } = this;
1647
- return e.rootOptionsStates.isLoading ? this.renderLoadingOptionsTip() : e.rootOptionsStates.loadingError ? this.renderLoadingRootOptionsErrorTip() : e.rootOptionsStates.isLoaded && e.forest.normalizedOptions.length === 0 ? this.renderNoAvailableOptionsTip() : this.renderOptionList();
1648
- },
1649
- renderLocalSearchMenuInner() {
1650
- let { instance: e } = this;
1651
- return e.rootOptionsStates.isLoading ? this.renderLoadingOptionsTip() : e.rootOptionsStates.loadingError ? this.renderLoadingRootOptionsErrorTip() : e.rootOptionsStates.isLoaded && e.forest.normalizedOptions.length === 0 ? this.renderNoAvailableOptionsTip() : e.localSearch.noResults ? this.renderNoResultsTip() : this.renderOptionList();
1652
- },
1653
- renderAsyncSearchMenuInner() {
1654
- let { instance: e } = this, t = e.getRemoteSearchEntry(), n = e.trigger.searchQuery === "" && !e.defaultOptions, r = n ? !1 : t.isLoaded && t.options.length === 0;
1655
- return n ? this.renderSearchPromptTip() : t.isLoading ? this.renderLoadingOptionsTip() : t.loadingError ? this.renderAsyncSearchLoadingErrorTip() : r ? this.renderNoResultsTip() : this.renderOptionList();
1656
- },
1657
- renderOptionList() {
1658
- let { instance: e } = this;
1659
- return a("div", { class: "vue-treeselect__list" }, [e.forest.normalizedOptions.map((e) => a(Fe, {
1660
- node: e,
1661
- key: e.id
1662
- }, null))]);
1663
- },
1664
- renderSearchPromptTip() {
1665
- let { instance: e } = this;
1666
- return a(q, {
1667
- type: "search-prompt",
1668
- icon: "warning"
1669
- }, { default: () => [e.searchPromptText] });
1670
- },
1671
- renderLoadingOptionsTip() {
1672
- let { instance: e } = this;
1673
- return a(q, {
1674
- type: "loading",
1675
- icon: "loader"
1676
- }, { default: () => [e.loadingText] });
1677
- },
1678
- renderLoadingRootOptionsErrorTip() {
1679
- let { instance: e } = this;
1680
- return a(q, {
1681
- type: "error",
1682
- icon: "error"
1683
- }, { default: () => [e.rootOptionsStates.loadingError, a("a", {
1684
- class: "vue-treeselect__retry",
1685
- onClick: e.loadRootOptions,
1686
- title: e.retryTitle
1687
- }, [e.retryText])] });
1688
- },
1689
- renderAsyncSearchLoadingErrorTip() {
1690
- let { instance: e } = this, t = e.getRemoteSearchEntry();
1691
- return a(q, {
1692
- type: "error",
1693
- icon: "error"
1694
- }, { default: () => [t.loadingError, a("a", {
1695
- class: "vue-treeselect__retry",
1696
- onClick: e.handleRemoteSearch,
1697
- title: e.retryTitle
1698
- }, [e.retryText])] });
1699
- },
1700
- renderNoAvailableOptionsTip() {
1701
- let { instance: e } = this;
1702
- return a(q, {
1703
- type: "no-options",
1704
- icon: "warning"
1705
- }, { default: () => [e.noOptionsText] });
1706
- },
1707
- renderNoResultsTip() {
1708
- let { instance: e } = this;
1709
- return a(q, {
1710
- type: "no-results",
1711
- icon: "warning"
1712
- }, { default: () => [e.noResultsText] });
1713
- },
1714
- onMenuOpen() {
1715
- this.adjustMenuOpenDirection(), this.setupMenuSizeWatcher(), this.setupMenuResizeAndScrollEventListeners();
1716
- },
1717
- onMenuClose() {
1718
- this.removeMenuSizeWatcher(), this.removeMenuResizeAndScrollEventListeners();
1719
- },
1720
- adjustMenuOpenDirection() {
1721
- var e;
1722
- let { instance: t } = this;
1723
- if (!(!(t == null || (e = t.menu) == null) && e.isOpen)) return;
1724
- let n = t == null ? void 0 : t.getMenu(), r = t == null ? void 0 : t.getControl(), i = n.getBoundingClientRect(), a = r.getBoundingClientRect(), o = i.height, s = window.innerHeight, c = a.top, l = window.innerHeight - a.bottom, u = a.top >= 0 && a.top <= s || a.top < 0 && a.bottom > 0, d = l > o + 40, f = c > o + 40;
1725
- u ? t.openDirection === "auto" ? d || !f ? t.menu.placement = "bottom" : t.menu.placement = "top" : t.menu.placement = Le[t.openDirection] : t.closeMenu();
1726
- },
1727
- setupMenuSizeWatcher() {
1728
- let { instance: e } = this, t = e.getMenu();
1729
- this.menuSizeWatcher || (this.menuSizeWatcher = { remove: C(t, this.adjustMenuOpenDirection) });
1730
- },
1731
- setupMenuResizeAndScrollEventListeners() {
1732
- let { instance: e } = this, t = e.getControl();
1733
- this.menuResizeAndScrollEventListeners || (this.menuResizeAndScrollEventListeners = { remove: w(t, this.adjustMenuOpenDirection) });
1734
- },
1735
- removeMenuSizeWatcher() {
1736
- this.menuSizeWatcher && (this.menuSizeWatcher.remove(), this.menuSizeWatcher = null);
1737
- },
1738
- removeMenuResizeAndScrollEventListeners() {
1739
- this.menuResizeAndScrollEventListeners && (this.menuResizeAndScrollEventListeners.remove(), this.menuResizeAndScrollEventListeners = null);
1740
- }
1741
- },
1742
- render() {
1743
- let e;
1744
- return a("div", {
1745
- ref: "menu-container",
1746
- class: "vue-treeselect__menu-container",
1747
- style: this.menuContainerStyle
1748
- }, [a(l("transition"), { name: "vue-treeselect__menu--transition" }, Ie(e = this.renderMenu()) ? e : { default: () => [e] })]);
1749
- }
1750
- }, Re = {
1751
- name: "VueTreeSelectPortalTarget",
1752
- inject: ["instance"],
1753
- watch: {
1754
- "instance.menu.isOpen"(e) {
1755
- e ? this.setupHandlers() : this.removeHandlers();
1756
- },
1757
- "instance.menu.placement"() {
1758
- this.updateMenuContainerOffset();
1759
- }
1760
- },
1761
- created() {
1762
- this.controlResizeAndScrollEventListeners = null, this.controlSizeWatcher = null;
1763
- },
1764
- mounted() {
1765
- var e;
1766
- let { instance: t } = this;
1767
- !(t == null || (e = t.menu) == null) && e.isOpen && this.setupHandlers();
1768
- },
1769
- methods: {
1770
- setupHandlers() {
1771
- this.updateWidth(), this.updateMenuContainerOffset(), this.setupControlResizeAndScrollEventListeners(), this.setupControlSizeWatcher();
1772
- },
1773
- removeHandlers() {
1774
- this.removeControlResizeAndScrollEventListeners(), this.removeControlSizeWatcher();
1775
- },
1776
- setupControlResizeAndScrollEventListeners() {
1777
- let { instance: e } = this, t = e.getControl();
1778
- this.controlResizeAndScrollEventListeners || (this.controlResizeAndScrollEventListeners = { remove: w(t, this.updateMenuContainerOffset) });
1779
- },
1780
- setupControlSizeWatcher() {
1781
- let { instance: e } = this, t = e.getControl();
1782
- this.controlSizeWatcher || (this.controlSizeWatcher = { remove: C(t, () => {
1783
- this.updateWidth(), this.updateMenuContainerOffset();
1784
- }) });
1785
- },
1786
- removeControlResizeAndScrollEventListeners() {
1787
- this.controlResizeAndScrollEventListeners && (this.controlResizeAndScrollEventListeners.remove(), this.controlResizeAndScrollEventListeners = null);
1788
- },
1789
- removeControlSizeWatcher() {
1790
- this.controlSizeWatcher && (this.controlSizeWatcher.remove(), this.controlSizeWatcher = null);
1791
- },
1792
- updateWidth() {
1793
- let { instance: e } = this, t = this.$el, n = e.getControl().getBoundingClientRect();
1794
- t.style.width = `${n.width}px`;
1795
- },
1796
- updateMenuContainerOffset() {
1797
- let { instance: e } = this, t = e.getControl(), n = this.$el, r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = e.menu.placement === "bottom" ? r.height : 0, o = `${Math.round(r.left - i.left)}px`, s = `${Math.round(r.top - i.top + a)}px`, c = this.$refs.menu.$refs["menu-container"].style, l = A([
1798
- "transform",
1799
- "webkitTransform",
1800
- "MozTransform",
1801
- "msTransform"
1802
- ], (e) => e in document.body.style);
1803
- c[l] = `translate(${o}, ${s})`;
1804
- }
1805
- },
1806
- render() {
1807
- let { instance: e } = this;
1808
- return a("div", {
1809
- class: ["vue-treeselect__portal-target", e == null ? void 0 : e.wrapperClass],
1810
- style: { zIndex: e == null ? void 0 : e.zIndex },
1811
- "data-instance-id": e == null ? void 0 : e.getInstanceId()
1812
- }, [a(Q, { ref: "menu" }, null)]);
1813
- },
1814
- destroyed() {
1815
- this.removeHandlers();
1816
- }
1817
- }, $, ze = {
1818
- name: "VueTreeSelectMenuPortal",
1819
- created() {
1820
- this.portalTarget = null;
1821
- },
1822
- mounted() {
1823
- this.setup();
1824
- },
1825
- unmounted() {
1826
- this.teardown();
1827
- },
1828
- methods: {
1829
- setup() {
1830
- let e = document.createElement("div");
1831
- document.body.appendChild(e), this.portalTarget = t(Re), this.portalTarget.mount(e), this.portalTarget.onUnmount(() => {
1832
- document.body.removeChild(e);
1833
- });
1834
- },
1835
- teardown() {
1836
- document.body.removeChild(this.portalTarget.$el), this.portalTarget.$el.innerHTML = "", this.portalTarget.$destroy(), this.portalTarget = null;
1837
- }
1838
- },
1839
- render() {
1840
- return $ || ($ = a("div", { class: "vue-treeselect__menu-placeholder" }, null)), $;
1841
- }
1842
- }, Be = {
1843
- name: "VueTreeSelect",
1844
- mixins: [be],
1845
- computed: { wrapperClass() {
1846
- return {
1847
- "vue-treeselect": !0,
1848
- "vue-treeselect--single": this.single,
1849
- "vue-treeselect--multi": this.multiple,
1850
- "vue-treeselect--searchable": this.searchable,
1851
- "vue-treeselect--disabled": this.disabled,
1852
- "vue-treeselect--focused": this.trigger.isFocused,
1853
- "vue-treeselect--has-value": this.hasValue,
1854
- "vue-treeselect--open": this.menu.isOpen,
1855
- "vue-treeselect--open-above": this.menu.placement === "top",
1856
- "vue-treeselect--open-below": this.menu.placement === "bottom",
1857
- "vue-treeselect--branch-nodes-disabled": this.disableBranchNodes,
1858
- "vue-treeselect--append-to-body": this.appendToBody
1859
- };
1860
- } },
1861
- render() {
1862
- return a("div", {
1863
- ref: "wrapper",
1864
- class: this.wrapperClass
1865
- }, [
1866
- a(Se, null, null),
1867
- a(Ne, { ref: "control" }, null),
1868
- this.appendToBody ? a(ze, { ref: "portal" }, null) : a(Q, { ref: "menu" }, null)
1869
- ]);
1870
- }
1871
- };
1872
- //#endregion
1873
- export { Be as t };