@web-utils/component 5.0.0-beta03 → 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 (390) 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.DqJuCLNW.mjs → FyCurd.DmIW6Tjw.mjs} +490 -483
  6. package/chunks/{FyForm.CgyGhetD.mjs → FyForm.Dh77gj0Z.mjs} +149 -149
  7. package/chunks/{FyUEditor.uvZS8UgS.mjs → FyUEditor.BMGigcYw.mjs} +7 -7
  8. package/chunks/{FyUpload.DoBEuYcC.mjs → FyUpload.Y_mVdD0K.mjs} +77 -77
  9. package/chunks/{MonacoEditor.Bq9d6JSz.mjs → MonacoEditor.DQ1vPh6D.mjs} +8 -8
  10. package/chunks/dataformat.BpAzVPYN.mjs +165 -0
  11. package/chunks/{dic.NZCGhtA7.mjs → dic.N2PNjL8o.mjs} +1 -1
  12. package/chunks/{event.CmOTnori.mjs → event.BevSLXu4.mjs} +8 -9
  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 +15 -15
  29. package/fy-empty/index.mjs +4 -4
  30. package/fy-form/index.mjs +1 -1
  31. package/fy-input/index.mjs +3 -3
  32. package/fy-input-color/index.mjs +2 -2
  33. package/fy-input-map/index.mjs +36 -34
  34. package/fy-input-number/index.mjs +2 -2
  35. package/fy-input-table/index.mjs +40 -38
  36. package/fy-input-tree/index.mjs +17 -17
  37. package/fy-radio/index.mjs +2 -2
  38. package/fy-rate/index.mjs +2 -2
  39. package/fy-select/index.mjs +29 -29
  40. package/fy-slider/index.mjs +5 -5
  41. package/fy-switch/index.mjs +2 -2
  42. package/fy-tabs/index.mjs +1 -1
  43. package/fy-time/index.mjs +7 -7
  44. package/fy-title/index.mjs +2 -2
  45. package/fy-tree/index.mjs +76 -74
  46. package/fy-u-editor/index.mjs +1 -1
  47. package/fy-upload/index.mjs +1 -1
  48. package/icon-temp/index.mjs +1 -1
  49. package/index.d.ts +2 -141
  50. package/index.mjs +31 -178
  51. package/monaco-editor/index.mjs +1 -1
  52. package/package.json +4 -4
  53. package/web-types.json +2431 -20044
  54. package/address-input/index.mjs +0 -76
  55. package/address-input/style.css +0 -1
  56. package/affix/index.mjs +0 -72
  57. package/affix/style.css +0 -1
  58. package/aside-menu/index.mjs +0 -20
  59. package/aside-menu/style.css +0 -1
  60. package/avatar/index.mjs +0 -94
  61. package/avatar/style.css +0 -1
  62. package/awesome-button/index.mjs +0 -49
  63. package/base.css +0 -1
  64. package/capsule-tab/index.mjs +0 -27
  65. package/capsule-tab/style.css +0 -1
  66. package/card/index.mjs +0 -86
  67. package/card/style.css +0 -1
  68. package/carousel/index.mjs +0 -46
  69. package/carousel/style.css +0 -1
  70. package/chat/index.mjs +0 -432
  71. package/chat/style.css +0 -1
  72. package/chunk-file-uploader/index.mjs +0 -2
  73. package/chunk-file-uploader/style.css +0 -1
  74. package/chunks/ChunkFileUploader.C3EA0e5t.mjs +0 -114
  75. package/chunks/EditableTree.CV8b95tW.mjs +0 -639
  76. package/chunks/ElementBaseInfo.lW0iwU10.mjs +0 -208
  77. package/chunks/ElementDialog.DWhAJsUn.mjs +0 -520
  78. package/chunks/ElementForm.C7yebHWH.mjs +0 -600
  79. package/chunks/ElementListeners.B_SjC8dp.mjs +0 -635
  80. package/chunks/ElementMultiInstance.Xw27Z5mm.mjs +0 -289
  81. package/chunks/ElementOtherConfig.DnNmAhKn.mjs +0 -50
  82. package/chunks/ElementProperties.DKr9JE_O.mjs +0 -187
  83. package/chunks/ElementTaskConfig.CPjsXlpS.mjs +0 -442
  84. package/chunks/FlowCondition.BA7GF34X.mjs +0 -193
  85. package/chunks/FlowDesigner.DH1ypcUw.mjs +0 -5100
  86. package/chunks/FormBlock.D6kZl7sm.mjs +0 -117
  87. package/chunks/FormCascader.BXL8lKww.mjs +0 -1229
  88. package/chunks/FormInputTime.DzTPiDNh.mjs +0 -1775
  89. package/chunks/FormItem.B8iPLduv.mjs +0 -89
  90. package/chunks/FormItemGroup.CCGqEapT.mjs +0 -154
  91. package/chunks/FormSelect.t0jbTL_K.mjs +0 -1475
  92. package/chunks/FormSwitch.uoFQ-xp_.mjs +0 -298
  93. package/chunks/FormTemp.CeHtEZQe.mjs +0 -144
  94. package/chunks/FyFormDesign.DIIK7mXK.mjs +0 -5521
  95. package/chunks/ImagePreview.DDFrZgo5.mjs +0 -649
  96. package/chunks/Keyboard.DBspwbYo.mjs +0 -379
  97. package/chunks/PageableTable.DR-REJN5.mjs +0 -659
  98. package/chunks/RecordVideo.CKTY-gk9.mjs +0 -116
  99. package/chunks/SignalAndMessage.CL2u19it.mjs +0 -189
  100. package/chunks/SplitPane.DNNid7WB.mjs +0 -219
  101. package/chunks/TableColumn.Cq9Bvevm.mjs +0 -186
  102. package/chunks/TableView.DMWMaGLA.mjs +0 -477
  103. package/chunks/Toolbar.DytZ6fO0.mjs +0 -219
  104. package/chunks/ToolbarButton.AlTszc53.mjs +0 -107
  105. package/chunks/UserTaskListeners.Qfm8hKWP.mjs +0 -581
  106. package/chunks/VueCron.BmPnLuu3.mjs +0 -1787
  107. package/chunks/VueTreeSelect.GHx4Z2lG.mjs +0 -1877
  108. package/chunks/button.gVyl7Y__.mjs +0 -927
  109. package/chunks/checkbox.AmhCpaBZ.mjs +0 -438
  110. package/chunks/chunk.A6TnG60p.mjs +0 -13
  111. package/chunks/confirmable-mixin.BZtxXY0h.mjs +0 -273
  112. package/chunks/constants.Dw7hXt67.mjs +0 -4
  113. package/chunks/core.Blrh_Fjl.mjs +0 -51
  114. package/chunks/dataformat.F7GtAoiN.mjs +0 -144
  115. package/chunks/dictionary.BqVLM7Lf.mjs +0 -87
  116. package/chunks/dictionary.DXYdZefs.mjs +0 -19
  117. package/chunks/event.ZRs4J5TN.mjs +0 -4
  118. package/chunks/focus-trap.CuUc8N2C.mjs +0 -211
  119. package/chunks/form-input.DdSb45Tz.mjs +0 -34
  120. package/chunks/form-item.fYYCXvCs.mjs +0 -716
  121. package/chunks/form-pick.BEC7lrNH.mjs +0 -7
  122. package/chunks/form-validate.JFOV_f-C.mjs +0 -11
  123. package/chunks/icon.AJYLfX1m.mjs +0 -26
  124. package/chunks/icon.niAg1zTC.mjs +0 -251
  125. package/chunks/init.CtUEiRbU.mjs +0 -115
  126. package/chunks/input.B_wW4aF-.mjs +0 -548
  127. package/chunks/install.BJl2MN77.mjs +0 -73
  128. package/chunks/message-box.wGWcYSSd.mjs +0 -463
  129. package/chunks/message.DnTACuzV.mjs +0 -401
  130. package/chunks/overlay.Rhu_rfhx.mjs +0 -122
  131. package/chunks/photo-swipe.BvBJGc5x.mjs +0 -55
  132. package/chunks/radio.BMkZBhl5.mjs +0 -274
  133. package/chunks/scroll.BJIpzi2Q.mjs +0 -28
  134. package/chunks/scrollbar.CvxOszy3.mjs +0 -345
  135. package/chunks/slot.CZCo32Cw.mjs +0 -25
  136. package/chunks/style.CraPDfJA.mjs +0 -325
  137. package/chunks/sub-table-plus-props.DvS8aKT4.mjs +0 -28
  138. package/chunks/tab-mixin.C9DSz8xu.mjs +0 -70
  139. package/chunks/tag.B6yUaGj-.mjs +0 -141
  140. package/chunks/teleport.87mkIv8m.mjs +0 -22
  141. package/chunks/tooltip.Dzjs7LZ8.mjs +0 -1926
  142. package/chunks/typescript.D0a40c7B.mjs +0 -4
  143. package/chunks/use-aria.B9uqqWAE.mjs +0 -17
  144. package/chunks/use-composition.BMPJBvYs.mjs +0 -47
  145. package/chunks/use-deprecated.vx6LTDA_.mjs +0 -12
  146. package/chunks/use-empty-values.CxYKjLV9.mjs +0 -81
  147. package/chunks/use-form-item.DMDTkMq9.mjs +0 -48
  148. package/chunks/use-global-config.Dkt91Ob3.mjs +0 -57
  149. package/chunks/use-id.CyzdvfQn.mjs +0 -15
  150. package/chunks/use-locale.CBoQRFjH.mjs +0 -188
  151. package/chunks/use-size.CoorvF12.mjs +0 -18
  152. package/chunks/util.fjuzrmWz.mjs +0 -103
  153. package/chunks/utilSelf.Bv7FtUNb.mjs +0 -46
  154. package/chunks/utils.C37EhJ-u.mjs +0 -60
  155. package/chunks/utils.C8RvIGLM.mjs +0 -14
  156. package/chunks/validator.Drv0r2Nb.mjs +0 -5
  157. package/chunks/vnode.raM3wMJz.mjs +0 -14
  158. package/code-mirror-editor/index.mjs +0 -99
  159. package/code-mirror-editor/style.css +0 -1
  160. package/comment/index.mjs +0 -62
  161. package/comment/style.css +0 -1
  162. package/configComponents.d.ts +0 -29
  163. package/configComponents.mjs +0 -42
  164. package/confirm-button/index.mjs +0 -35
  165. package/confirmable/index.mjs +0 -8
  166. package/context-menu/index.mjs +0 -196
  167. package/context-menu/style.css +0 -1
  168. package/count-up/index.mjs +0 -99
  169. package/custom-scrollbar/index.mjs +0 -93
  170. package/data-box/index.mjs +0 -64
  171. package/data-box/style.css +0 -1
  172. package/data-card/index.mjs +0 -60
  173. package/data-card/style.css +0 -1
  174. package/data-card-text/index.mjs +0 -64
  175. package/data-card-text/style.css +0 -1
  176. package/data-display/index.mjs +0 -71
  177. package/data-display/style.css +0 -1
  178. package/data-icons/index.mjs +0 -70
  179. package/data-icons/style.css +0 -1
  180. package/data-imgtext/index.mjs +0 -67
  181. package/data-imgtext/style.css +0 -1
  182. package/data-operatext/index.mjs +0 -51
  183. package/data-operatext/style.css +0 -1
  184. package/data-panel/index.mjs +0 -57
  185. package/data-panel/style.css +0 -1
  186. package/data-pay/index.mjs +0 -105
  187. package/data-pay/style.css +0 -1
  188. package/data-price/index.mjs +0 -48
  189. package/data-price/style.css +0 -1
  190. package/data-progress/index.mjs +0 -67
  191. package/data-progress/style.css +0 -1
  192. package/data-rotate/index.mjs +0 -61
  193. package/data-rotate/style.css +0 -1
  194. package/data-table-picker/index.mjs +0 -116
  195. package/data-tabs/index.mjs +0 -67
  196. package/data-tabs/style.css +0 -1
  197. package/dynamic-table/index.mjs +0 -165
  198. package/dynamic-table/style.css +0 -1
  199. package/e-charts/index.mjs +0 -176
  200. package/e-charts/style.css +0 -1
  201. package/easy-popup/index.mjs +0 -92
  202. package/easy-popup/style.css +0 -1
  203. package/editable-progress/index.mjs +0 -113
  204. package/editable-progress/style.css +0 -1
  205. package/editable-tree/index.mjs +0 -2
  206. package/editable-tree/style.css +0 -1
  207. package/element-listeners/style.css +0 -1
  208. package/element-multi-instance/style.css +0 -1
  209. package/ellipsis/index.mjs +0 -124
  210. package/ellipsis/style.css +0 -1
  211. package/empty-view/index.mjs +0 -46
  212. package/empty-view/style.css +0 -1
  213. package/error-view/index.mjs +0 -37
  214. package/error-view/style.css +0 -1
  215. package/flex-column/index.mjs +0 -35
  216. package/flex-item/index.mjs +0 -61
  217. package/flex-row/index.mjs +0 -34
  218. package/flex-scroller/index.mjs +0 -29
  219. package/flex-scroller/style.css +0 -1
  220. package/flow/index.mjs +0 -240
  221. package/flow/style.css +0 -1
  222. package/flow-designer/index.mjs +0 -2
  223. package/flow-designer/style.css +0 -1
  224. package/flow-node/index.mjs +0 -56
  225. package/flow-viewer/index.mjs +0 -160
  226. package/flow-viewer/style.css +0 -1
  227. package/form-block/index.mjs +0 -2
  228. package/form-block/style.css +0 -1
  229. package/form-button/index.mjs +0 -36
  230. package/form-card/index.mjs +0 -14
  231. package/form-cascader/index.mjs +0 -2
  232. package/form-checkbox/index.mjs +0 -90
  233. package/form-checkbox-group/index.mjs +0 -162
  234. package/form-checkbox-group/style.css +0 -1
  235. package/form-date-picker/index.mjs +0 -156
  236. package/form-holder/index.mjs +0 -134
  237. package/form-holder/style.css +0 -1
  238. package/form-input/index.mjs +0 -114
  239. package/form-input-cron-expression/index.mjs +0 -98
  240. package/form-input-cron-expression/style.css +0 -1
  241. package/form-input-email/index.mjs +0 -66
  242. package/form-input-id-card/index.mjs +0 -74
  243. package/form-input-phone-number/index.mjs +0 -73
  244. package/form-input-tag/index.mjs +0 -89
  245. package/form-input-time/index.mjs +0 -2
  246. package/form-item/index.mjs +0 -2
  247. package/form-item/style.css +0 -1
  248. package/form-item-config-provider/index.mjs +0 -47
  249. package/form-item-group/index.mjs +0 -2
  250. package/form-item-group/style.css +0 -1
  251. package/form-radio-group/index.mjs +0 -162
  252. package/form-radio-group/style.css +0 -1
  253. package/form-select/index.mjs +0 -2
  254. package/form-select/style.css +0 -1
  255. package/form-switch/index.mjs +0 -2
  256. package/form-table/index.mjs +0 -132
  257. package/form-table-plus/index.mjs +0 -165
  258. package/form-textarea/index.mjs +0 -91
  259. package/form-tree-select/index.mjs +0 -90
  260. package/form-tree-select/style.css +0 -1
  261. package/form-tree-select-multiple/index.mjs +0 -93
  262. package/form-view/index.mjs +0 -280
  263. package/form-view/style.css +0 -1
  264. package/fy-article/index.mjs +0 -73
  265. package/fy-article/style.css +0 -1
  266. package/fy-code/index.mjs +0 -48
  267. package/fy-draggable/index.mjs +0 -323
  268. package/fy-draggable/style.css +0 -1
  269. package/fy-form-design/index.mjs +0 -2
  270. package/fy-form-design/style.css +0 -1
  271. package/fy-input-icon/index.mjs +0 -134
  272. package/fy-input-icon/style.css +0 -1
  273. package/fy-progress/index.mjs +0 -36
  274. package/guide-steps/index.mjs +0 -73
  275. package/guide-steps/style.css +0 -1
  276. package/helper-function.d.ts +0 -5
  277. package/helper-function.mjs +0 -58
  278. package/highlight-j-s/index.mjs +0 -51
  279. package/highlight-j-s/style.css +0 -1
  280. package/icon-card/index.mjs +0 -34
  281. package/icon-card/style.css +0 -1
  282. package/iframe-window/index.mjs +0 -40
  283. package/iframe-window/style.css +0 -1
  284. package/image-cropper/index.mjs +0 -152
  285. package/image-cropper/style.css +0 -1
  286. package/image-preview/index.mjs +0 -2
  287. package/image-preview/style.css +0 -1
  288. package/image-viewer/index.mjs +0 -70
  289. package/image-viewer/style.css +0 -1
  290. package/input-number-range/index.mjs +0 -76
  291. package/input-number-range/style.css +0 -1
  292. package/j-s-x-component/index.mjs +0 -14
  293. package/keyboard/index.mjs +0 -2
  294. package/keyboard/style.css +0 -1
  295. package/license/index.mjs +0 -106
  296. package/loading-view/index.mjs +0 -39
  297. package/loading-view/style.css +0 -1
  298. package/name-avatar/index.mjs +0 -61
  299. package/name-avatar/style.css +0 -1
  300. package/nav-bar/index.mjs +0 -34
  301. package/nav-bar/style.css +0 -1
  302. package/not-implement/index.mjs +0 -10
  303. package/not-implement/style.css +0 -1
  304. package/notice/index.mjs +0 -97
  305. package/notice/style.css +0 -1
  306. package/page/index.mjs +0 -19
  307. package/page/style.css +0 -1
  308. package/page-header/index.mjs +0 -27
  309. package/page-header/style.css +0 -1
  310. package/page-index/index.mjs +0 -121
  311. package/page-index/style.css +0 -1
  312. package/page-index-top/index.mjs +0 -80
  313. package/page-skeleton/index.mjs +0 -49
  314. package/page-skeleton/style.css +0 -1
  315. package/page-skeleton-new/index.mjs +0 -79
  316. package/page-skeleton-new/style.css +0 -1
  317. package/pageable-table/index.mjs +0 -2
  318. package/pageable-table/style.css +0 -1
  319. package/pageable-view/index.mjs +0 -280
  320. package/pageable-view/style.css +0 -1
  321. package/photo-swipe/index.d.ts +0 -8
  322. package/photo-swipe/index.mjs +0 -33
  323. package/picker-table-view/index.mjs +0 -221
  324. package/present-view/index.mjs +0 -271
  325. package/present-view/style.css +0 -1
  326. package/queue/index.mjs +0 -46
  327. package/queue/style.css +0 -1
  328. package/record-video/index.mjs +0 -2
  329. package/record-video/style.css +0 -1
  330. package/resize-observer/index.mjs +0 -45
  331. package/resize-observer/style.css +0 -1
  332. package/search/index.mjs +0 -116
  333. package/search/style.css +0 -1
  334. package/sign/index.mjs +0 -104
  335. package/sign/style.css +0 -1
  336. package/sign-panel/index.mjs +0 -183
  337. package/sign-panel/style.css +0 -1
  338. package/skeleton/index.mjs +0 -51
  339. package/skeleton/style.css +0 -1
  340. package/skeleton-panel/index.mjs +0 -34
  341. package/skeleton-panel/style.css +0 -1
  342. package/split-pane/index.mjs +0 -3
  343. package/split-pane/style.css +0 -1
  344. package/stateful/index.mjs +0 -71
  345. package/stateful/style.css +0 -1
  346. package/static-pageable-table/index.mjs +0 -69
  347. package/static-pageable-table/style.css +0 -1
  348. package/sub-table/index.mjs +0 -505
  349. package/sub-table/style.css +0 -1
  350. package/sub-table-plus/index.mjs +0 -590
  351. package/sub-table-plus/style.css +0 -1
  352. package/swiper/index.mjs +0 -128
  353. package/swiper/style.css +0 -1
  354. package/tab/index.mjs +0 -117
  355. package/tab/style.css +0 -1
  356. package/tab-item/index.mjs +0 -49
  357. package/table-column/index.mjs +0 -2
  358. package/table-column/style.css +0 -1
  359. package/table-view/index.mjs +0 -3
  360. package/table-view/style.css +0 -1
  361. package/tabs-view/index.mjs +0 -109
  362. package/tabs-view/style.css +0 -1
  363. package/tag-render/index.mjs +0 -84
  364. package/tag-render/style.css +0 -1
  365. package/text-ellipsis/index.mjs +0 -95
  366. package/text-ellipsis/style.css +0 -1
  367. package/toolbar/index.mjs +0 -2
  368. package/toolbar/style.css +0 -1
  369. package/toolbar-button/index.mjs +0 -2
  370. package/verify/index.mjs +0 -58
  371. package/verify/style.css +0 -1
  372. package/video/index.d.ts +0 -10
  373. package/vue-cron/index.mjs +0 -2
  374. package/vue-cron/style.css +0 -1
  375. package/vue-qr-code/index.mjs +0 -32
  376. package/vue-quill-editor/index.mjs +0 -127
  377. package/vue-quill-editor/style.css +0 -1
  378. package/vue-tags-input/index.mjs +0 -348
  379. package/vue-tags-input/style.css +0 -1
  380. package/vue-tree-select/index.mjs +0 -2
  381. package/vue-tree-select/style.css +0 -1
  382. package/vue-video-player/index.mjs +0 -136
  383. package/vue-video-player/style.css +0 -1
  384. package/watermark/index.mjs +0 -47
  385. package/watermark/style.css +0 -1
  386. package/x-input-tag/index.mjs +0 -142
  387. package/x-input-tag/style.css +0 -1
  388. /package/chunks/{_plugin-vue_export-helper.7vrlOII_.mjs → _plugin-vue_export-helper.CTBRVsXt.mjs} +0 -0
  389. /package/chunks/{packages.CONbEH13.mjs → packages.W76nKiMk.mjs} +0 -0
  390. /package/chunks/{permission.8WDtOmzA.mjs → permission.ZYdXiCsn.mjs} +0 -0
@@ -1,1877 +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 : /* istanbul ignore next */ 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() :
818
- // istanbul ignore next
819
- this.$nextTick(t);
820
- }
821
- },
822
- resetHighlightedOptionWhenNecessary(e = !1) {
823
- let { current: t } = this.menu;
824
- (e || t == null || !(t in this.forest.nodeMap) || !this.shouldShowOptionInMenu(this.getNode(t))) && this.highlightFirstOption();
825
- },
826
- highlightFirstOption() {
827
- if (!this.hasVisibleOptions) return;
828
- let e = this.visibleOptionIds[0];
829
- this.setCurrentHighlightedOption(this.getNode(e));
830
- },
831
- highlightPrevOption() {
832
- if (!this.hasVisibleOptions) return;
833
- let e = this.visibleOptionIds.indexOf(this.menu.current) - 1;
834
- if (e === -1) return this.highlightLastOption();
835
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
836
- },
837
- highlightNextOption() {
838
- if (!this.hasVisibleOptions) return;
839
- let e = this.visibleOptionIds.indexOf(this.menu.current) + 1;
840
- if (e === this.visibleOptionIds.length) return this.highlightFirstOption();
841
- this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
842
- },
843
- highlightLastOption() {
844
- if (!this.hasVisibleOptions) return;
845
- let e = p(this.visibleOptionIds);
846
- this.setCurrentHighlightedOption(this.getNode(e));
847
- },
848
- resetSearchQuery() {
849
- this.trigger.searchQuery = "";
850
- },
851
- closeMenu() {
852
- !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()));
853
- },
854
- openMenu() {
855
- 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()));
856
- },
857
- toggleMenu() {
858
- this.menu.isOpen ? this.closeMenu() : this.openMenu();
859
- },
860
- toggleExpanded(e) {
861
- let t;
862
- this.localSearch.active ? (t = e.isExpandedOnSearch = !e.isExpandedOnSearch, t && (e.showAllChildrenOnSearch = !0)) : t = e.isExpanded = !e.isExpanded, t && !e.childrenStates.isLoaded && this.loadChildrenOptions(e);
863
- },
864
- buildForestState() {
865
- let e = E();
866
- this.forest.selectedNodeIds.forEach((t) => {
867
- e[t] = !0;
868
- }), this.forest.selectedNodeMap = e;
869
- let t = E();
870
- this.multiple && (this.traverseAllNodesByIndex((e) => {
871
- t[e.id] = 0;
872
- }), this.selectedNodes.forEach((e) => {
873
- t[e.id] = 2, !this.flat && !this.disableBranchNodes && e.ancestors.forEach((e) => {
874
- this.isSelected(e) || (t[e.id] = 1);
875
- });
876
- })), this.forest.checkedStateMap = t;
877
- },
878
- enhancedNormalizer(e) {
879
- return {
880
- ...e,
881
- ...this.normalizer(e, this.getInstanceId())
882
- };
883
- },
884
- normalize(e, t, n) {
885
- let r = t.map((e) => [this.enhancedNormalizer(e), e]).map(([t, r], i) => {
886
- this.checkDuplication(t), this.verifyNodeShape(t);
887
- 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) => ({
888
- ...e,
889
- [n]: ve(t[n]).toLocaleLowerCase()
890
- }), {}), _ = l ? h.label : `${e.nestedSearchLabel} ${h.label}`;
891
- this.forest.nodeMap[a] = E;
892
- let v = this.forest.nodeMap[a];
893
- 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) {
894
- let e = Array.isArray(s);
895
- v.childrenStates = {
896
- ...B(),
897
- isLoaded: e
898
- }, v.isExpanded = typeof c == "boolean" ? c : u < this.defaultExpandLevel, v.hasMatchedDescendants = !1, v.hasDisabledDescendants = !1, v.isExpandedOnSearch = !1, v.showAllChildrenOnSearch = !1, v.count = {
899
- [M]: 0,
900
- [N]: 0,
901
- [P]: 0,
902
- [F]: 0
903
- }, v.children = e ? this.normalize(v, s, n) : [], c === !0 && v.ancestors.forEach((e) => {
904
- e.isExpanded = !0;
905
- }), !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);
906
- }
907
- 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]) {
908
- let e = n[a];
909
- 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 });
910
- }
911
- return v;
912
- });
913
- if (this.branchNodesFirst) {
914
- let e = r.filter((e) => e.isBranch), t = r.filter((e) => e.isLeaf);
915
- r = e.concat(t);
916
- }
917
- return r;
918
- },
919
- loadRootOptions() {
920
- this.callLoadOptionsProp({
921
- action: le,
922
- isPending: () => this.rootOptionsStates.isLoading,
923
- start: () => {
924
- this.rootOptionsStates.isLoading = !0, this.rootOptionsStates.loadingError = "";
925
- },
926
- succeed: () => {
927
- this.rootOptionsStates.isLoaded = !0, this.$nextTick(() => {
928
- this.resetHighlightedOptionWhenNecessary(!0);
929
- });
930
- },
931
- fail: (e) => {
932
- this.rootOptionsStates.loadingError = H(e);
933
- },
934
- end: () => {
935
- this.rootOptionsStates.isLoading = !1;
936
- }
937
- });
938
- },
939
- loadChildrenOptions(e) {
940
- let { id: t, raw: n } = e;
941
- this.callLoadOptionsProp({
942
- action: ue,
943
- args: { parentNode: n },
944
- isPending: () => this.getNode(t).childrenStates.isLoading,
945
- start: () => {
946
- this.getNode(t).childrenStates.isLoading = !0, this.getNode(t).childrenStates.loadingError = "";
947
- },
948
- succeed: () => {
949
- this.getNode(t).childrenStates.isLoaded = !0;
950
- },
951
- fail: (e) => {
952
- this.getNode(t).childrenStates.loadingError = H(e);
953
- },
954
- end: () => {
955
- this.getNode(t).childrenStates.isLoading = !1;
956
- }
957
- });
958
- },
959
- callLoadOptionsProp({ action: e, args: t, isPending: n, start: r, succeed: i, fail: a, end: o }) {
960
- if (!this.loadOptions || n()) return;
961
- r();
962
- let s = h((e, t) => {
963
- e ? a(e) : i(t), o();
964
- }), c = this.loadOptions({
965
- id: this.getInstanceId(),
966
- instanceId: this.getInstanceId(),
967
- action: e,
968
- ...t,
969
- callback: s
970
- });
971
- u(c) && c.then(() => {
972
- s();
973
- }, (e) => {
974
- s(e);
975
- }).catch((e) => {
976
- // istanbul ignore next
977
- console.error(e);
978
- });
979
- },
980
- checkDuplication(e) {
981
- 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.`);
982
- },
983
- verifyNodeShape(e) {
984
- 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.");
985
- },
986
- select(e) {
987
- if (this.disabled || e.isDisabled) return;
988
- this.single && this.clear();
989
- let t = this.multiple && !this.flat ? this.forest.checkedStateMap[e.id] === 0 : !this.isSelected(e);
990
- 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));
991
- },
992
- clear() {
993
- this.hasValue && (this.single || this.allowClearingDisabled ? this.forest.selectedNodeIds = [] : this.forest.selectedNodeIds = this.forest.selectedNodeIds.filter((e) => this.getNode(e).isDisabled), this.buildForestState());
994
- },
995
- _selectNode(e) {
996
- if (this.single || this.disableBranchNodes) return this.addValue(e);
997
- if (this.flat) {
998
- this.addValue(e), this.autoSelectAncestors ? e.ancestors.forEach((e) => {
999
- !this.isSelected(e) && !e.isDisabled && this.addValue(e);
1000
- }) : this.autoSelectDescendants && this.traverseDescendantsBFS(e, (e) => {
1001
- !this.isSelected(e) && !e.isDisabled && this.addValue(e);
1002
- });
1003
- return;
1004
- }
1005
- let t = e.isLeaf || !e.hasDisabledDescendants || this.allowSelectingDisabledDescendants;
1006
- if (t && this.addValue(e), e.isBranch && this.traverseDescendantsBFS(e, (e) => {
1007
- (!e.isDisabled || this.allowSelectingDisabledDescendants) && this.addValue(e);
1008
- }), t) {
1009
- let t = e;
1010
- for (; (t = t.parentNode) !== null && t.children.every(this.isSelected);) this.addValue(t);
1011
- }
1012
- },
1013
- _deselectNode(e) {
1014
- if (this.disableBranchNodes) return this.removeValue(e);
1015
- if (this.flat) {
1016
- this.removeValue(e), this.autoDeselectAncestors ? e.ancestors.forEach((e) => {
1017
- this.isSelected(e) && !e.isDisabled && this.removeValue(e);
1018
- }) : this.autoDeselectDescendants && this.traverseDescendantsBFS(e, (e) => {
1019
- this.isSelected(e) && !e.isDisabled && this.removeValue(e);
1020
- });
1021
- return;
1022
- }
1023
- let t = !1;
1024
- if (e.isBranch && this.traverseDescendantsDFS(e, (e) => {
1025
- (!e.isDisabled || this.allowSelectingDisabledDescendants) && (this.removeValue(e), t = !0);
1026
- }), e.isLeaf || t || e.children.length === 0) {
1027
- this.removeValue(e);
1028
- let t = e;
1029
- for (; (t = t.parentNode) !== null && this.isSelected(t);) this.removeValue(t);
1030
- }
1031
- },
1032
- addValue(e) {
1033
- this.forest.selectedNodeIds.push(e.id), this.forest.selectedNodeMap[e.id] = !0;
1034
- },
1035
- removeValue(e) {
1036
- y(this.forest.selectedNodeIds, e.id), delete this.forest.selectedNodeMap[e.id];
1037
- },
1038
- removeLastValue() {
1039
- if (!this.hasValue) return;
1040
- if (this.single) return this.clear();
1041
- let e = p(this.internalValue), t = this.getNode(e);
1042
- this.select(t);
1043
- },
1044
- saveMenuScrollPosition() {
1045
- let e = this.getMenu();
1046
- // istanbul ignore else
1047
- e && (this.menu.lastScrollPosition = e.scrollTop);
1048
- },
1049
- restoreMenuScrollPosition() {
1050
- let e = this.getMenu();
1051
- // istanbul ignore else
1052
- e && (e.scrollTop = this.menu.lastScrollPosition);
1053
- }
1054
- },
1055
- created() {
1056
- this.verifyProps(), this.resetFlags();
1057
- },
1058
- mounted() {
1059
- this.autoFocus && this.focusInput(), !this.options && !this.async && this.autoLoadRootOptions && this.loadRootOptions(), this.alwaysOpen && this.openMenu(), this.async && this.defaultOptions && this.handleRemoteSearch();
1060
- },
1061
- destroyed() {
1062
- // istanbul ignore next
1063
- this.toggleClickOutsideEvent(!1);
1064
- }
1065
- };
1066
- //#endregion
1067
- //#region src/components/tree-select/components/VueTreeSelectHiddenFields.vue?vue&type=script&lang.jsx
1068
- function xe(e) {
1069
- // istanbul ignore next
1070
- return typeof e == "string" ? e :
1071
- // istanbul ignore else
1072
- e != null && !T(e) ? JSON.stringify(e) : "";
1073
- }
1074
- //#endregion
1075
- //#region src/components/tree-select/components/VueTreeSelectHiddenFields.vue
1076
- var Se = {
1077
- name: "VueTreeSelectHiddenFields",
1078
- inject: ["instance"],
1079
- render() {
1080
- if (!this.instance.name || this.instance.disabled || !this.instance.hasValue) return null;
1081
- let e = this.instance.internalValue.map(xe);
1082
- return this.instance.multiple && this.instance.joinValues && (e = [e.join(this.instance.delimiter)]), e.map((e, t) => a("input", {
1083
- type: "hidden",
1084
- name: this.instance.name,
1085
- value: e,
1086
- key: `hidden-field-${t}`
1087
- }, null));
1088
- }
1089
- }, Ce = [
1090
- R.ENTER,
1091
- R.END,
1092
- R.HOME,
1093
- R.ARROW_LEFT,
1094
- R.ARROW_UP,
1095
- R.ARROW_RIGHT,
1096
- R.ARROW_DOWN
1097
- ], U = {
1098
- name: "VueTreeSelectInput",
1099
- inject: ["instance"],
1100
- data: () => ({
1101
- inputWidth: 5,
1102
- value: ""
1103
- }),
1104
- computed: {
1105
- needAutoSize() {
1106
- let { instance: e } = this;
1107
- return e.searchable && !e.disabled && e.multiple;
1108
- },
1109
- inputStyle() {
1110
- return { width: this.needAutoSize ? `${this.inputWidth}px` : null };
1111
- }
1112
- },
1113
- watch: {
1114
- "instance.trigger.searchQuery"(e) {
1115
- this.value = e;
1116
- },
1117
- value() {
1118
- // istanbul ignore else
1119
- this.needAutoSize && this.$nextTick(this.updateInputWidth);
1120
- }
1121
- },
1122
- created() {
1123
- this.debouncedCallback = d(this.updateSearchQuery, ge, {
1124
- leading: !0,
1125
- trailing: !0
1126
- });
1127
- },
1128
- methods: {
1129
- clear() {
1130
- this.onInput({ target: { value: "" } });
1131
- },
1132
- focus() {
1133
- let { instance: e } = this;
1134
- if (!e.disabled) {
1135
- var t;
1136
- (t = this.$refs.input) == null || t.focus();
1137
- }
1138
- },
1139
- blur() {
1140
- var e;
1141
- (e = this.$refs.input) == null || e.blur();
1142
- },
1143
- onFocus() {
1144
- let { instance: e } = this;
1145
- // istanbul ignore else
1146
- e.trigger.isFocused = !0, e.openOnFocus && e.openMenu();
1147
- },
1148
- onBlur() {
1149
- let { instance: e } = this, t = e.getMenu();
1150
- // istanbul ignore next
1151
- if (t && document.activeElement === t) return this.focus();
1152
- e.trigger.isFocused = !1, e.closeMenu();
1153
- },
1154
- onInput(e) {
1155
- let { value: t } = e.target;
1156
- this.value = t, t ? this.debouncedCallback() : (this.debouncedCallback.cancel(), this.updateSearchQuery());
1157
- },
1158
- onKeyDown(e) {
1159
- let { instance: t } = this, n = "which" in e ? e.which : /* istanbul ignore next */ e.keyCode;
1160
- if (!(e.ctrlKey || e.shiftKey || e.altKey || e.metaKey)) {
1161
- if (!t.menu.isOpen && k(Ce, n)) return e.preventDefault(), t.openMenu();
1162
- switch (n) {
1163
- case R.BACKSPACE:
1164
- t.backspaceRemoves && !this.value.length && t.removeLastValue();
1165
- break;
1166
- case R.ENTER: {
1167
- if (e.preventDefault(), t.menu.current === null) return;
1168
- let n = t.getNode(t.menu.current);
1169
- if (n.isBranch && t.disableBranchNodes) return;
1170
- t.select(n);
1171
- break;
1172
- }
1173
- case R.ESCAPE:
1174
- this.value.length ? this.clear() : t.menu.isOpen && t.closeMenu();
1175
- break;
1176
- case R.END:
1177
- e.preventDefault(), t.highlightLastOption();
1178
- break;
1179
- case R.HOME:
1180
- e.preventDefault(), t.highlightFirstOption();
1181
- break;
1182
- case R.ARROW_LEFT: {
1183
- let n = t.getNode(t.menu.current);
1184
- 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));
1185
- break;
1186
- }
1187
- case R.ARROW_UP:
1188
- e.preventDefault(), t.highlightPrevOption();
1189
- break;
1190
- case R.ARROW_RIGHT: {
1191
- let n = t.getNode(t.menu.current);
1192
- n.isBranch && !t.shouldExpand(n) && (e.preventDefault(), t.toggleExpanded(n));
1193
- break;
1194
- }
1195
- case R.ARROW_DOWN:
1196
- e.preventDefault(), t.highlightNextOption();
1197
- break;
1198
- case R.DELETE:
1199
- t.deleteRemoves && !this.value.length && t.removeLastValue();
1200
- break;
1201
- default:
1202
- // istanbul ignore else
1203
- t.openMenu();
1204
- }
1205
- }
1206
- },
1207
- onMouseDown(e) {
1208
- // istanbul ignore next
1209
- this.value.length && e.stopPropagation();
1210
- },
1211
- renderInputContainer() {
1212
- let { instance: e } = this, t = {}, n = [];
1213
- return e.searchable && !e.disabled && (n.push(this.renderInput()), this.needAutoSize && n.push(this.renderSizer())), e.searchable || O(t, {
1214
- on: {
1215
- focus: this.onFocus,
1216
- blur: this.onBlur,
1217
- keydown: this.onKeyDown
1218
- },
1219
- ref: "input"
1220
- }), !e.searchable && !e.disabled && O(t, { attrs: { tabIndex: e.tabIndex } }), a("div", s({ class: "vue-treeselect__input-container" }, t), [n]);
1221
- },
1222
- renderInput() {
1223
- let { instance: e } = this;
1224
- return a("input", {
1225
- ref: "input",
1226
- class: "vue-treeselect__input",
1227
- type: "text",
1228
- autocomplete: "off",
1229
- tabIndex: e.tabIndex,
1230
- required: e.required && !e.hasValue,
1231
- value: this.value,
1232
- style: this.inputStyle,
1233
- onFocus: this.onFocus,
1234
- onInput: this.onInput,
1235
- onBlur: this.onBlur,
1236
- onKeydown: this.onKeyDown,
1237
- onMousedown: this.onMouseDown
1238
- }, null);
1239
- },
1240
- renderSizer() {
1241
- return a("div", {
1242
- ref: "sizer",
1243
- class: "vue-treeselect__sizer"
1244
- }, [this.value]);
1245
- },
1246
- updateInputWidth() {
1247
- this.inputWidth = Math.max(5, this.$refs.sizer.scrollWidth + 15);
1248
- },
1249
- updateSearchQuery() {
1250
- let { instance: e } = this;
1251
- e.trigger.searchQuery = this.value;
1252
- }
1253
- },
1254
- render() {
1255
- return this.renderInputContainer();
1256
- }
1257
- }, W = {
1258
- name: "VueTreeSelectPlaceholder",
1259
- inject: ["instance"],
1260
- render() {
1261
- let { instance: e } = this;
1262
- return a("div", { class: {
1263
- "vue-treeselect__placeholder": !0,
1264
- "vue-treeselect-helper-zoom-effect-off": !0,
1265
- "vue-treeselect-helper-hide": e.hasValue || e.trigger.searchQuery
1266
- } }, [e.placeholder]);
1267
- }
1268
- }, we = {
1269
- name: "VueTreeSelectSingleValue",
1270
- inject: ["instance"],
1271
- methods: { renderSingleValueLabel() {
1272
- let { instance: e } = this, t = e.selectedNodes[0], n = e.$slots["value-label"];
1273
- return n ? n({ node: t }) : t.label;
1274
- } },
1275
- render() {
1276
- let { instance: e, $parent: { renderValueContainer: t } } = this;
1277
- return t([
1278
- e.hasValue && !e.trigger.searchQuery && a("div", { class: "vue-treeselect__single-value" }, [this.renderSingleValueLabel()]),
1279
- a(W, null, null),
1280
- a(U, { ref: "input" }, null)
1281
- ]);
1282
- }
1283
- }, Te = { name: "VueTreeSelectDelete" }, Ee = {
1284
- xmlns: "http://www.w3.org/2000/svg",
1285
- viewBox: "0 0 348.333 348.333"
1286
- };
1287
- function De(e, t, i, a, o, s) {
1288
- 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)])]);
1289
- }
1290
- var G = /* @__PURE__ */ e(Te, [["render", De]]), Oe = {
1291
- name: "VueTreeSelectMultiValueItem",
1292
- inject: ["instance"],
1293
- props: { node: {
1294
- type: Object,
1295
- required: !0
1296
- } },
1297
- methods: { handleMouseDown: _(function() {
1298
- let { instance: e, node: t } = this;
1299
- e.select(t);
1300
- }) },
1301
- render() {
1302
- let { instance: e, node: t } = this, n = {
1303
- "vue-treeselect__multi-value-item": !0,
1304
- "vue-treeselect__multi-value-item-disabled": t.isDisabled,
1305
- "vue-treeselect__multi-value-item-new": t.isNew
1306
- }, r = e.$slots["value-label"], i = r ? r({ node: t }) : t.label;
1307
- return a("div", { class: "vue-treeselect__multi-value-item-container" }, [a("div", {
1308
- class: n,
1309
- onMousedown: this.handleMouseDown
1310
- }, [a("span", { class: "vue-treeselect__multi-value-label" }, [i]), a("span", { class: "vue-treeselect__icon vue-treeselect__value-remove" }, [a(G, null, null)])])]);
1311
- }
1312
- }, ke = {
1313
- name: "VueTreeSelectMultiValue",
1314
- inject: ["instance"],
1315
- methods: {
1316
- renderMultiValueItems() {
1317
- let { instance: e } = this;
1318
- return e.internalValue.slice(0, e.limit).map(e.getNode).map((e) => a(Oe, {
1319
- key: `multi-value-item-${e.id}`,
1320
- node: e
1321
- }, null));
1322
- },
1323
- renderExceedLimitTip() {
1324
- let { instance: e } = this, t = e.internalValue.length - e.limit;
1325
- return t <= 0 ? null : a("div", {
1326
- class: "vue-treeselect__limit-tip vue-treeselect-helper-zoom-effect-off",
1327
- key: "exceed-limit-tip"
1328
- }, [a("span", { class: "vue-treeselect__limit-tip-text" }, [e.limitText(t)])]);
1329
- }
1330
- },
1331
- render() {
1332
- let { renderValueContainer: e } = this.$parent;
1333
- return e(a(l("transition-group"), s({ class: "vue-treeselect__multi-value" }, { props: {
1334
- tag: "div",
1335
- name: "vue-treeselect__multi-value-item--transition",
1336
- appear: !0
1337
- } }), { default: () => [
1338
- this.renderMultiValueItems(),
1339
- this.renderExceedLimitTip(),
1340
- a(W, { key: "placeholder" }, null),
1341
- a(U, {
1342
- ref: "input",
1343
- key: "input"
1344
- }, null)
1345
- ] }));
1346
- }
1347
- }, Ae = { name: "VueTreeSelectArrow" }, je = {
1348
- xmlns: "http://www.w3.org/2000/svg",
1349
- viewBox: "0 0 292.362 292.362"
1350
- };
1351
- function Me(e, t, i, a, o, s) {
1352
- 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)])]);
1353
- }
1354
- var K = /* @__PURE__ */ e(Ae, [["render", Me]]), Ne = {
1355
- name: "VueTreeSelectControl",
1356
- inject: ["instance"],
1357
- computed: {
1358
- shouldShowX() {
1359
- let { instance: e } = this;
1360
- return e.clearable && !e.disabled && e.hasValue && (this.hasUndisabledValue || e.allowClearingDisabled);
1361
- },
1362
- shouldShowArrow() {
1363
- let { instance: e } = this;
1364
- return e.alwaysOpen ? !e.menu.isOpen : !0;
1365
- },
1366
- hasUndisabledValue() {
1367
- let { instance: e } = this;
1368
- return e.hasValue && e.internalValue.some((t) => !e.getNode(t).isDisabled);
1369
- }
1370
- },
1371
- methods: {
1372
- renderX() {
1373
- let { instance: e } = this, t = e.multiple ? e.clearAllText : e.clearValueText;
1374
- return this.shouldShowX ? a("div", {
1375
- class: "vue-treeselect__x-container",
1376
- title: t,
1377
- onMousedown: this.handleMouseDownOnX
1378
- }, [a(G, { class: "vue-treeselect__x" }, null)]) : null;
1379
- },
1380
- renderArrow() {
1381
- let { instance: e } = this, t = {
1382
- "vue-treeselect__control-arrow": !0,
1383
- "vue-treeselect__control-arrow--rotated": e.menu.isOpen
1384
- };
1385
- return this.shouldShowArrow ? a("div", {
1386
- class: "vue-treeselect__control-arrow-container",
1387
- onMousedown: this.handleMouseDownOnArrow
1388
- }, [a(K, { class: t }, null)]) : null;
1389
- },
1390
- handleMouseDownOnX: _(function(e) {
1391
- e.stopPropagation(), e.preventDefault();
1392
- let { instance: t } = this, n = t.beforeClearAll(), r = (e) => {
1393
- e && t.clear();
1394
- };
1395
- u(n) ? n.then(r) : setTimeout(() => r(n), 0);
1396
- }),
1397
- handleMouseDownOnArrow: _(function(e) {
1398
- e.preventDefault(), e.stopPropagation();
1399
- let { instance: t } = this;
1400
- t.focusInput(), t.toggleMenu();
1401
- }),
1402
- renderValueContainer(e) {
1403
- return a("div", { class: "vue-treeselect__value-container" }, [e]);
1404
- }
1405
- },
1406
- render() {
1407
- let { instance: e } = this, t = e.single ? we : ke;
1408
- return a("div", {
1409
- class: "vue-treeselect__control",
1410
- onMousedown: e.handleMouseDown
1411
- }, [
1412
- a(t, { ref: "value-container" }, null),
1413
- this.renderX(),
1414
- this.renderArrow()
1415
- ]);
1416
- }
1417
- }, q = {
1418
- name: "VueTreeSelectTip",
1419
- functional: !0,
1420
- props: {
1421
- type: {
1422
- type: String,
1423
- required: !0
1424
- },
1425
- icon: {
1426
- type: String,
1427
- required: !0
1428
- }
1429
- },
1430
- render(e, t) {
1431
- let { props: n, children: r } = t;
1432
- 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])]);
1433
- }
1434
- };
1435
- //#endregion
1436
- //#region src/components/tree-select/components/VueTreeSelectOption.vue?vue&type=script&lang.jsx
1437
- function Pe(e) {
1438
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !o(e);
1439
- }
1440
- var J, Y, X, Z = {
1441
- name: "VueTreeSelectOption",
1442
- inject: ["instance"],
1443
- props: { node: {
1444
- type: Object,
1445
- required: !0
1446
- } },
1447
- computed: {
1448
- shouldExpand() {
1449
- let { instance: e, node: t } = this;
1450
- return t.isBranch && e.shouldExpand(t);
1451
- },
1452
- shouldShow() {
1453
- let { instance: e, node: t } = this;
1454
- return e.shouldShowOptionInMenu(t);
1455
- }
1456
- },
1457
- methods: {
1458
- renderOption() {
1459
- let { instance: e, node: t } = this;
1460
- return a("div", {
1461
- class: {
1462
- "vue-treeselect__option": !0,
1463
- "vue-treeselect__option--disabled": t.isDisabled,
1464
- "vue-treeselect__option--selected": e.isSelected(t),
1465
- "vue-treeselect__option--highlight": t.isHighlighted,
1466
- "vue-treeselect__option--matched": e.localSearch.active && t.isMatched,
1467
- "vue-treeselect__option--hide": !this.shouldShow
1468
- },
1469
- onMouseenter: this.handleMouseEnterOption,
1470
- "data-id": t.id
1471
- }, [this.renderArrow(), this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]), this.renderLabel()])]);
1472
- },
1473
- renderSubOptionsList() {
1474
- return this.shouldExpand ? a("div", { class: "vue-treeselect__list" }, [
1475
- this.renderSubOptions(),
1476
- this.renderNoChildrenTip(),
1477
- this.renderLoadingChildrenTip(),
1478
- this.renderLoadingChildrenErrorTip()
1479
- ]) : null;
1480
- },
1481
- renderArrow() {
1482
- let { instance: e, node: t } = this;
1483
- if (e.shouldFlattenOptions && this.shouldShow) return null;
1484
- if (t.isBranch) {
1485
- let e = { props: {
1486
- name: "vue-treeselect__option-arrow--prepare",
1487
- appear: !0
1488
- } }, t = {
1489
- "vue-treeselect__option-arrow": !0,
1490
- "vue-treeselect__option-arrow--rotated": this.shouldExpand
1491
- };
1492
- return a("div", {
1493
- class: "vue-treeselect__option-arrow-container",
1494
- onMousedown: this.handleMouseDownOnArrow
1495
- }, [a(l("transition"), e, { default: () => [a(K, { class: t }, null)] })]);
1496
- }
1497
- return e.hasBranchNodes ? (J || (J = a("div", { class: "vue-treeselect__option-arrow-placeholder" }, [i("\xA0")])), J) : null;
1498
- },
1499
- renderLabelContainer(e) {
1500
- return a("div", {
1501
- class: "vue-treeselect__label-container",
1502
- onMousedown: this.handleMouseDownOnLabelContainer
1503
- }, [e]);
1504
- },
1505
- renderCheckboxContainer(e) {
1506
- let { instance: t, node: n } = this;
1507
- return t.single || t.disableBranchNodes && n.isBranch ? null : a("div", { class: "vue-treeselect__checkbox-container" }, [e]);
1508
- },
1509
- renderCheckbox() {
1510
- let { instance: e, node: t } = this, n = e.forest.checkedStateMap[t.id], r = {
1511
- "vue-treeselect__checkbox": !0,
1512
- "vue-treeselect__checkbox--checked": n === 2,
1513
- "vue-treeselect__checkbox--indeterminate": n === 1,
1514
- "vue-treeselect__checkbox--unchecked": n === 0,
1515
- "vue-treeselect__checkbox--disabled": t.isDisabled
1516
- };
1517
- 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]);
1518
- },
1519
- renderLabel() {
1520
- 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"];
1521
- return c ? c({
1522
- node: t,
1523
- shouldShowCount: n,
1524
- count: r,
1525
- labelClassName: o,
1526
- countClassName: s
1527
- }) : a("label", { class: o }, [t.label, n && a("span", { class: s }, [
1528
- i("("),
1529
- r,
1530
- i(")")
1531
- ])]);
1532
- },
1533
- renderSubOptions() {
1534
- let { node: e } = this;
1535
- return e.childrenStates.isLoaded ? e.children.map((e) => a(Z, {
1536
- node: e,
1537
- key: e.id
1538
- }, null)) : null;
1539
- },
1540
- renderNoChildrenTip() {
1541
- let { instance: e, node: t } = this;
1542
- return !t.childrenStates.isLoaded || t.children.length ? null : a(q, {
1543
- type: "no-children",
1544
- icon: "warning"
1545
- }, { default: () => [e.noChildrenText] });
1546
- },
1547
- renderLoadingChildrenTip() {
1548
- let { instance: e, node: t } = this;
1549
- return t.childrenStates.isLoading ? a(q, {
1550
- type: "loading",
1551
- icon: "loader"
1552
- }, { default: () => [e.loadingText] }) : null;
1553
- },
1554
- renderLoadingChildrenErrorTip() {
1555
- let { instance: e, node: t } = this;
1556
- return t.childrenStates.loadingError ? a(q, {
1557
- type: "error",
1558
- icon: "error"
1559
- }, { default: () => [t.childrenStates.loadingError, a("a", {
1560
- class: "vue-treeselect__retry",
1561
- title: e.retryTitle,
1562
- onMousedown: this.handleMouseDownOnRetry
1563
- }, [e.retryText])] }) : null;
1564
- },
1565
- handleMouseEnterOption(e) {
1566
- let { instance: t, node: n } = this;
1567
- e.target === e.currentTarget && t.setCurrentHighlightedOption(n, !1);
1568
- },
1569
- handleMouseDownOnArrow: _(function() {
1570
- let { instance: e, node: t } = this;
1571
- e.toggleExpanded(t);
1572
- }),
1573
- handleMouseDownOnLabelContainer: _(function() {
1574
- let { instance: e, node: t } = this;
1575
- t.isBranch && e.disableBranchNodes ? e.toggleExpanded(t) : e.select(t);
1576
- }),
1577
- handleMouseDownOnRetry: _(function() {
1578
- let { instance: e, node: t } = this;
1579
- e.loadChildrenOptions(t);
1580
- })
1581
- },
1582
- render() {
1583
- let e, { node: t } = this;
1584
- return a("div", { class: {
1585
- "vue-treeselect__list-item": !0,
1586
- [`vue-treeselect__indent-level-${this.instance.shouldFlattenOptions ? 0 : t.level}`]: !0
1587
- } }, [this.renderOption(), t.isBranch && a(l("transition"), { props: { name: "vue-treeselect__list--transition" } }, Pe(e = this.renderSubOptionsList()) ? e : { default: () => [e] })]);
1588
- }
1589
- }, Fe = Z;
1590
- //#endregion
1591
- //#region src/components/tree-select/components/VueTreeSelectMenu.vue?vue&type=script&lang.jsx
1592
- function Ie(e) {
1593
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !o(e);
1594
- }
1595
- var Le = {
1596
- top: "top",
1597
- bottom: "bottom",
1598
- above: "top",
1599
- below: "bottom"
1600
- }, Q = {
1601
- name: "VueTreeSelectMenu",
1602
- inject: ["instance"],
1603
- computed: {
1604
- menuStyle() {
1605
- let { instance: e } = this;
1606
- return { maxHeight: `${e.maxHeight}px` };
1607
- },
1608
- menuContainerStyle() {
1609
- let { instance: e } = this;
1610
- return { zIndex: e != null && e.appendToBody ? null : e == null ? void 0 : e.zIndex };
1611
- }
1612
- },
1613
- watch: { "instance.menu.isOpen"(e) {
1614
- e ? this.$nextTick(this.onMenuOpen) : this.onMenuClose();
1615
- } },
1616
- created() {
1617
- this.menuSizeWatcher = null, this.menuResizeAndScrollEventListeners = null;
1618
- },
1619
- mounted() {
1620
- let { instance: e } = this;
1621
- e != null && e.menu.isOpen && this.$nextTick(this.onMenuOpen);
1622
- },
1623
- unmounted() {
1624
- this.onMenuClose();
1625
- },
1626
- methods: {
1627
- renderMenu() {
1628
- var e;
1629
- let { instance: t } = this;
1630
- return !(t == null || (e = t.menu) == null) && e.isOpen ? a("div", {
1631
- ref: "menu",
1632
- class: "vue-treeselect__menu",
1633
- onMousedown: t.handleMouseDown,
1634
- style: this.menuStyle
1635
- }, [
1636
- this.renderBeforeList(),
1637
- t.async ? this.renderAsyncSearchMenuInner() : t.localSearch.active ? this.renderLocalSearchMenuInner() : this.renderNormalMenuInner(),
1638
- this.renderAfterList()
1639
- ]) : null;
1640
- },
1641
- renderBeforeList() {
1642
- let { instance: e } = this, t = e.$slots["before-list"];
1643
- return t ? t() : null;
1644
- },
1645
- renderAfterList() {
1646
- let { instance: e } = this, t = e.$slots["after-list"];
1647
- return t ? t() : null;
1648
- },
1649
- renderNormalMenuInner() {
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() : this.renderOptionList();
1652
- },
1653
- renderLocalSearchMenuInner() {
1654
- let { instance: e } = this;
1655
- 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();
1656
- },
1657
- renderAsyncSearchMenuInner() {
1658
- let { instance: e } = this, t = e.getRemoteSearchEntry(), n = e.trigger.searchQuery === "" && !e.defaultOptions, r = n ? !1 : t.isLoaded && t.options.length === 0;
1659
- return n ? this.renderSearchPromptTip() : t.isLoading ? this.renderLoadingOptionsTip() : t.loadingError ? this.renderAsyncSearchLoadingErrorTip() : r ? this.renderNoResultsTip() : this.renderOptionList();
1660
- },
1661
- renderOptionList() {
1662
- let { instance: e } = this;
1663
- return a("div", { class: "vue-treeselect__list" }, [e.forest.normalizedOptions.map((e) => a(Fe, {
1664
- node: e,
1665
- key: e.id
1666
- }, null))]);
1667
- },
1668
- renderSearchPromptTip() {
1669
- let { instance: e } = this;
1670
- return a(q, {
1671
- type: "search-prompt",
1672
- icon: "warning"
1673
- }, { default: () => [e.searchPromptText] });
1674
- },
1675
- renderLoadingOptionsTip() {
1676
- let { instance: e } = this;
1677
- return a(q, {
1678
- type: "loading",
1679
- icon: "loader"
1680
- }, { default: () => [e.loadingText] });
1681
- },
1682
- renderLoadingRootOptionsErrorTip() {
1683
- let { instance: e } = this;
1684
- return a(q, {
1685
- type: "error",
1686
- icon: "error"
1687
- }, { default: () => [e.rootOptionsStates.loadingError, a("a", {
1688
- class: "vue-treeselect__retry",
1689
- onClick: e.loadRootOptions,
1690
- title: e.retryTitle
1691
- }, [e.retryText])] });
1692
- },
1693
- renderAsyncSearchLoadingErrorTip() {
1694
- let { instance: e } = this, t = e.getRemoteSearchEntry();
1695
- return a(q, {
1696
- type: "error",
1697
- icon: "error"
1698
- }, { default: () => [t.loadingError, a("a", {
1699
- class: "vue-treeselect__retry",
1700
- onClick: e.handleRemoteSearch,
1701
- title: e.retryTitle
1702
- }, [e.retryText])] });
1703
- },
1704
- renderNoAvailableOptionsTip() {
1705
- let { instance: e } = this;
1706
- return a(q, {
1707
- type: "no-options",
1708
- icon: "warning"
1709
- }, { default: () => [e.noOptionsText] });
1710
- },
1711
- renderNoResultsTip() {
1712
- let { instance: e } = this;
1713
- return a(q, {
1714
- type: "no-results",
1715
- icon: "warning"
1716
- }, { default: () => [e.noResultsText] });
1717
- },
1718
- onMenuOpen() {
1719
- this.adjustMenuOpenDirection(), this.setupMenuSizeWatcher(), this.setupMenuResizeAndScrollEventListeners();
1720
- },
1721
- onMenuClose() {
1722
- this.removeMenuSizeWatcher(), this.removeMenuResizeAndScrollEventListeners();
1723
- },
1724
- adjustMenuOpenDirection() {
1725
- var e;
1726
- let { instance: t } = this;
1727
- if (!(!(t == null || (e = t.menu) == null) && e.isOpen)) return;
1728
- 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;
1729
- u ? t.openDirection === "auto" ? d || !f ? t.menu.placement = "bottom" : t.menu.placement = "top" : t.menu.placement = Le[t.openDirection] : t.closeMenu();
1730
- },
1731
- setupMenuSizeWatcher() {
1732
- let { instance: e } = this, t = e.getMenu();
1733
- this.menuSizeWatcher || (this.menuSizeWatcher = { remove: C(t, this.adjustMenuOpenDirection) });
1734
- },
1735
- setupMenuResizeAndScrollEventListeners() {
1736
- let { instance: e } = this, t = e.getControl();
1737
- this.menuResizeAndScrollEventListeners || (this.menuResizeAndScrollEventListeners = { remove: w(t, this.adjustMenuOpenDirection) });
1738
- },
1739
- removeMenuSizeWatcher() {
1740
- this.menuSizeWatcher && (this.menuSizeWatcher.remove(), this.menuSizeWatcher = null);
1741
- },
1742
- removeMenuResizeAndScrollEventListeners() {
1743
- this.menuResizeAndScrollEventListeners && (this.menuResizeAndScrollEventListeners.remove(), this.menuResizeAndScrollEventListeners = null);
1744
- }
1745
- },
1746
- render() {
1747
- let e;
1748
- return a("div", {
1749
- ref: "menu-container",
1750
- class: "vue-treeselect__menu-container",
1751
- style: this.menuContainerStyle
1752
- }, [a(l("transition"), { name: "vue-treeselect__menu--transition" }, Ie(e = this.renderMenu()) ? e : { default: () => [e] })]);
1753
- }
1754
- }, Re = {
1755
- name: "VueTreeSelectPortalTarget",
1756
- inject: ["instance"],
1757
- watch: {
1758
- "instance.menu.isOpen"(e) {
1759
- e ? this.setupHandlers() : this.removeHandlers();
1760
- },
1761
- "instance.menu.placement"() {
1762
- this.updateMenuContainerOffset();
1763
- }
1764
- },
1765
- created() {
1766
- this.controlResizeAndScrollEventListeners = null, this.controlSizeWatcher = null;
1767
- },
1768
- mounted() {
1769
- var e;
1770
- let { instance: t } = this;
1771
- !(t == null || (e = t.menu) == null) && e.isOpen && this.setupHandlers();
1772
- },
1773
- methods: {
1774
- setupHandlers() {
1775
- this.updateWidth(), this.updateMenuContainerOffset(), this.setupControlResizeAndScrollEventListeners(), this.setupControlSizeWatcher();
1776
- },
1777
- removeHandlers() {
1778
- this.removeControlResizeAndScrollEventListeners(), this.removeControlSizeWatcher();
1779
- },
1780
- setupControlResizeAndScrollEventListeners() {
1781
- let { instance: e } = this, t = e.getControl();
1782
- this.controlResizeAndScrollEventListeners || (this.controlResizeAndScrollEventListeners = { remove: w(t, this.updateMenuContainerOffset) });
1783
- },
1784
- setupControlSizeWatcher() {
1785
- let { instance: e } = this, t = e.getControl();
1786
- this.controlSizeWatcher || (this.controlSizeWatcher = { remove: C(t, () => {
1787
- this.updateWidth(), this.updateMenuContainerOffset();
1788
- }) });
1789
- },
1790
- removeControlResizeAndScrollEventListeners() {
1791
- this.controlResizeAndScrollEventListeners && (this.controlResizeAndScrollEventListeners.remove(), this.controlResizeAndScrollEventListeners = null);
1792
- },
1793
- removeControlSizeWatcher() {
1794
- this.controlSizeWatcher && (this.controlSizeWatcher.remove(), this.controlSizeWatcher = null);
1795
- },
1796
- updateWidth() {
1797
- let { instance: e } = this, t = this.$el, n = e.getControl().getBoundingClientRect();
1798
- t.style.width = `${n.width}px`;
1799
- },
1800
- updateMenuContainerOffset() {
1801
- 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([
1802
- "transform",
1803
- "webkitTransform",
1804
- "MozTransform",
1805
- "msTransform"
1806
- ], (e) => e in document.body.style);
1807
- c[l] = `translate(${o}, ${s})`;
1808
- }
1809
- },
1810
- render() {
1811
- let { instance: e } = this;
1812
- return a("div", {
1813
- class: ["vue-treeselect__portal-target", e == null ? void 0 : e.wrapperClass],
1814
- style: { zIndex: e == null ? void 0 : e.zIndex },
1815
- "data-instance-id": e == null ? void 0 : e.getInstanceId()
1816
- }, [a(Q, { ref: "menu" }, null)]);
1817
- },
1818
- destroyed() {
1819
- this.removeHandlers();
1820
- }
1821
- }, $, ze = {
1822
- name: "VueTreeSelectMenuPortal",
1823
- created() {
1824
- this.portalTarget = null;
1825
- },
1826
- mounted() {
1827
- this.setup();
1828
- },
1829
- unmounted() {
1830
- this.teardown();
1831
- },
1832
- methods: {
1833
- setup() {
1834
- let e = document.createElement("div");
1835
- document.body.appendChild(e), this.portalTarget = t(Re), this.portalTarget.mount(e), this.portalTarget.onUnmount(() => {
1836
- document.body.removeChild(e);
1837
- });
1838
- },
1839
- teardown() {
1840
- document.body.removeChild(this.portalTarget.$el), this.portalTarget.$el.innerHTML = "", this.portalTarget.$destroy(), this.portalTarget = null;
1841
- }
1842
- },
1843
- render() {
1844
- return $ || ($ = a("div", { class: "vue-treeselect__menu-placeholder" }, null)), $;
1845
- }
1846
- }, Be = {
1847
- name: "VueTreeSelect",
1848
- mixins: [be],
1849
- computed: { wrapperClass() {
1850
- return {
1851
- "vue-treeselect": !0,
1852
- "vue-treeselect--single": this.single,
1853
- "vue-treeselect--multi": this.multiple,
1854
- "vue-treeselect--searchable": this.searchable,
1855
- "vue-treeselect--disabled": this.disabled,
1856
- "vue-treeselect--focused": this.trigger.isFocused,
1857
- "vue-treeselect--has-value": this.hasValue,
1858
- "vue-treeselect--open": this.menu.isOpen,
1859
- "vue-treeselect--open-above": this.menu.placement === "top",
1860
- "vue-treeselect--open-below": this.menu.placement === "bottom",
1861
- "vue-treeselect--branch-nodes-disabled": this.disableBranchNodes,
1862
- "vue-treeselect--append-to-body": this.appendToBody
1863
- };
1864
- } },
1865
- render() {
1866
- return a("div", {
1867
- ref: "wrapper",
1868
- class: this.wrapperClass
1869
- }, [
1870
- a(Se, null, null),
1871
- a(Ne, { ref: "control" }, null),
1872
- this.appendToBody ? a(ze, { ref: "portal" }, null) : a(Q, { ref: "menu" }, null)
1873
- ]);
1874
- }
1875
- };
1876
- //#endregion
1877
- export { Be as t };