@web-utils/form-ui 1.0.0-beta8 → 1.0.0-beta80
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.
- package/address-input/index.d.ts +52 -0
- package/address-input/index.mjs +2 -0
- package/address-input/style.css +1 -0
- package/affix/index.d.ts +30 -0
- package/affix/index.mjs +48 -0
- package/affix/style.css +1 -0
- package/api/index.d.ts +66 -0
- package/api/index.mjs +42 -0
- package/awesome-button/index.d.ts +60 -0
- package/awesome-button/index.mjs +49 -0
- package/base.css +1 -1
- package/capsule-tab/index.d.ts +30 -0
- package/capsule-tab/index.mjs +2 -0
- package/capsule-tab/style.css +1 -0
- package/card/index.d.ts +41 -0
- package/card/index.mjs +90 -0
- package/card/style.css +1 -0
- package/chunks/22GsbC-1.mjs +32 -0
- package/chunks/6dNVtIN32.mjs +89 -0
- package/chunks/6eDDQWcr.mjs +69 -0
- package/chunks/B1MSrc6f.mjs +8 -0
- package/chunks/B1luuf_A2.mjs +111 -0
- package/chunks/B4GsYMXo.mjs +39 -0
- package/chunks/B5c0s3IR.mjs +449 -0
- package/chunks/BAG_R87k2.mjs +60 -0
- package/chunks/BEghYt1s2.mjs +31 -0
- package/chunks/BM5LdxU72.mjs +95 -0
- package/chunks/BQytQPLa.mjs +780 -0
- package/chunks/BVUClQOx.mjs +26 -0
- package/chunks/BWTQ3qdg.mjs +68 -0
- package/chunks/BhHMGhJ8.mjs +109 -0
- package/chunks/Bo8lYN4n2.mjs +27 -0
- package/chunks/Bs926z902.mjs +200 -0
- package/chunks/BsqIRxSS.mjs +67 -0
- package/chunks/Bu1M7um22.mjs +87 -0
- package/chunks/Bvn6wnku.mjs +99 -0
- package/chunks/BwL9Xz1F.mjs +46 -0
- package/chunks/C-iN5MJZ.mjs +57 -0
- package/chunks/C-zPVdz-.mjs +198 -0
- package/chunks/C8h_P_kl2.mjs +206 -0
- package/chunks/CGmbnjKL.mjs +26 -0
- package/chunks/CHmZyvFr.mjs +63 -0
- package/chunks/CLn5E7NV.mjs +17 -0
- package/chunks/COA3tHyu2.mjs +34 -0
- package/chunks/CTYReSXN.mjs +37 -0
- package/chunks/CUaecRXx.mjs +4794 -0
- package/chunks/C_QfuxeQ.mjs +98 -0
- package/chunks/Cb7kjZa-.mjs +661 -0
- package/chunks/ChP-pNSi2.mjs +145 -0
- package/chunks/CiMBKxeJ.mjs +61 -0
- package/chunks/CkLpOk7H.mjs +155 -0
- package/chunks/ClVh1Lek.mjs +130 -0
- package/chunks/Co0M4G3P.mjs +30 -0
- package/chunks/Ctx93AFS.mjs +54 -0
- package/chunks/D6mInNk02.mjs +419 -0
- package/chunks/DCqyZyF6.mjs +52 -0
- package/chunks/DH-B0Lkz2.mjs +34 -0
- package/chunks/DQMWqQFe2.mjs +42 -0
- package/chunks/D_q3C3v4.mjs +595 -0
- package/chunks/DbcxJ45j.mjs +298 -0
- package/chunks/DcgE9SF_2.mjs +29 -0
- package/chunks/DdACGFy3.mjs +90 -0
- package/chunks/DgH_4qOn2.mjs +210 -0
- package/chunks/Dkw6LNCq2.mjs +379 -0
- package/chunks/Dodxnwze.mjs +60 -0
- package/chunks/DokYQ49m.mjs +29 -0
- package/chunks/DxeRdYI82.mjs +108 -0
- package/chunks/Dz_TTgwF2.mjs +515 -0
- package/chunks/FZqu01np2.mjs +1354 -0
- package/chunks/KOJEsarR2.mjs +217 -0
- package/chunks/PEU1JRcN2.mjs +64 -0
- package/chunks/SInS7QSL.mjs +17 -0
- package/chunks/V-Js6hNd.mjs +179 -0
- package/chunks/X-ckP2Hj.mjs +40 -0
- package/chunks/Zdhb_SRi2.mjs +63 -0
- package/chunks/eX0Esdvw2.mjs +25 -0
- package/chunks/hBvPGqka.mjs +26 -0
- package/chunks/mnqSaATq.mjs +184 -0
- package/chunks/mqi8hesW2.mjs +613 -0
- package/chunks/oXiNltCq.mjs +30 -0
- package/chunks/sTTHpRrx.mjs +50 -0
- package/chunks/shY1VkIE2.mjs +29 -0
- package/chunks/tSaeUhnr.mjs +58 -0
- package/chunks/tVHVSu5h.mjs +1798 -0
- package/chunks/tfaGdZX2.mjs +647 -0
- package/chunks/tqW2DSco.mjs +199 -0
- package/chunks/tzjUpVIj.mjs +37 -0
- package/code-mirror-editor/index.d.ts +50 -0
- package/code-mirror-editor/index.mjs +99 -0
- package/code-mirror-editor/style.css +1 -0
- package/confirm-button/index.d.ts +122 -0
- package/confirm-button/index.mjs +35 -0
- package/confirmable/index.d.ts +93 -0
- package/confirmable/index.mjs +8 -0
- package/constants/index.d.ts +73 -0
- package/constants/index.mjs +4 -0
- package/context-menu/index.d.ts +183 -0
- package/context-menu/index.mjs +196 -0
- package/context-menu/style.css +1 -0
- package/count-up/index.d.ts +70 -0
- package/count-up/index.mjs +94 -0
- package/custom-scrollbar/index.d.ts +49 -0
- package/custom-scrollbar/index.mjs +93 -0
- package/data-box/index.d.ts +30 -0
- package/data-box/index.mjs +2 -0
- package/data-box/style.css +1 -0
- package/data-card/index.d.ts +20 -0
- package/data-card/index.mjs +64 -0
- package/data-card/style.css +1 -0
- package/data-card-text/index.d.ts +21 -0
- package/data-card-text/index.mjs +68 -0
- package/data-card-text/style.css +1 -0
- package/data-display/index.d.ts +20 -0
- package/data-display/index.mjs +74 -0
- package/data-display/style.css +1 -0
- package/data-icons/index.d.ts +21 -0
- package/data-icons/index.mjs +75 -0
- package/data-icons/style.css +1 -0
- package/data-imgtext/index.d.ts +18 -0
- package/data-imgtext/index.mjs +72 -0
- package/data-imgtext/style.css +1 -0
- package/data-operatext/index.d.ts +17 -0
- package/data-operatext/index.mjs +55 -0
- package/data-operatext/style.css +1 -0
- package/data-panel/index.d.ts +19 -0
- package/data-panel/index.mjs +62 -0
- package/data-panel/style.css +1 -0
- package/data-pay/index.d.ts +19 -0
- package/data-pay/index.mjs +111 -0
- package/data-pay/style.css +1 -0
- package/data-price/index.d.ts +17 -0
- package/data-price/index.mjs +52 -0
- package/data-price/style.css +1 -0
- package/data-progress/index.d.ts +19 -0
- package/data-progress/index.mjs +73 -0
- package/data-progress/style.css +1 -0
- package/data-rotate/index.d.ts +21 -0
- package/data-rotate/index.mjs +2 -0
- package/data-rotate/style.css +1 -0
- package/data-table-picker/index.d.ts +61 -0
- package/data-table-picker/index.mjs +120 -0
- package/data-tabs/index.d.ts +21 -0
- package/data-tabs/index.mjs +2 -0
- package/data-tabs/style.css +1 -0
- package/dict-render/index.d.ts +28 -0
- package/dict-render/index.mjs +2 -0
- package/e-charts/index.d.ts +79 -0
- package/e-charts/index.mjs +179 -0
- package/e-charts/style.css +1 -0
- package/easy-popup/index.d.ts +114 -0
- package/easy-popup/index.mjs +92 -0
- package/easy-popup/style.css +1 -0
- package/editable-progress/index.d.ts +68 -0
- package/editable-progress/index.mjs +121 -0
- package/editable-progress/style.css +1 -0
- package/editable-tree/index.d.ts +281 -0
- package/editable-tree/index.mjs +596 -0
- package/editable-tree/style.css +1 -0
- package/element-dialog/index.d.ts +341 -18
- package/element-dialog/index.mjs +2 -91
- package/element-dialog/style.css +1 -1
- package/element-listeners/style.css +1 -0
- package/element-multi-instance/style.css +1 -0
- package/element-resize-observer/index.d.ts +8 -0
- package/element-resize-observer/index.mjs +40 -0
- package/element-resize-observer/style.css +1 -0
- package/empty-view/index.d.ts +2 -2
- package/empty-view/index.mjs +1 -1
- package/error-view/index.d.ts +25 -0
- package/error-view/index.mjs +37 -0
- package/error-view/style.css +1 -0
- package/flex-box/index.d.ts +44 -0
- package/flex-box/index.mjs +2 -0
- package/flex-column/index.d.ts +41 -0
- package/flex-column/index.mjs +2 -0
- package/flex-item/index.d.ts +77 -0
- package/flex-item/index.mjs +2 -0
- package/flex-row/index.d.ts +41 -0
- package/flex-row/index.mjs +2 -0
- package/flex-scroll-area/index.d.ts +1 -1
- package/flex-scroll-area/index.mjs +1 -1
- package/flex-scroller/index.d.ts +26 -0
- package/flex-scroller/index.mjs +29 -0
- package/flex-scroller/style.css +1 -0
- package/flow-designer/index.d.ts +286 -0
- package/flow-designer/index.mjs +2 -0
- package/flow-designer/style.css +1 -0
- package/flow-viewer/index.d.ts +62 -0
- package/flow-viewer/index.mjs +159 -0
- package/flow-viewer/style.css +1 -0
- package/form-advice/index.mjs +13 -12
- package/form-button/index.d.ts +123 -0
- package/form-button/index.mjs +36 -0
- package/form-card/index.d.ts +14 -0
- package/form-card/index.mjs +18 -0
- package/form-cascader/index.d.ts +478 -0
- package/form-cascader/index.mjs +2 -0
- package/form-checkbox/index.d.ts +237 -30
- package/form-checkbox/index.mjs +1 -1
- package/form-checkbox-group/index.d.ts +373 -0
- package/form-checkbox-group/index.mjs +2 -0
- package/form-checkbox-group/style.css +1 -0
- package/form-date-picker/index.d.ts +375 -29
- package/form-date-picker/index.mjs +1 -1
- package/form-holder/index.d.ts +89 -22
- package/form-holder/index.mjs +1 -1
- package/form-holder/style.css +1 -1
- package/form-image/index.d.ts +137 -23
- package/form-image/index.mjs +1 -1
- package/form-input/index.d.ts +282 -50
- package/form-input/index.mjs +1 -1
- package/form-input-cron-expression/index.d.ts +223 -0
- package/form-input-cron-expression/index.mjs +2 -0
- package/form-input-cron-expression/style.css +1 -0
- package/form-input-email/index.d.ts +296 -25
- package/form-input-email/index.mjs +1 -1
- package/form-input-id-card/index.d.ts +296 -25
- package/form-input-id-card/index.mjs +1 -1
- package/form-input-number/index.d.ts +237 -29
- package/form-input-number/index.mjs +1 -1
- package/form-input-phone-number/index.d.ts +296 -25
- package/form-input-phone-number/index.mjs +1 -1
- package/form-input-tag/index.d.ts +269 -1
- package/form-input-tag/index.mjs +1 -3
- package/form-input-time/index.d.ts +440 -1
- package/form-input-time/index.mjs +1 -3
- package/form-item-config-provider/index.d.ts +23 -3
- package/form-item-config-provider/index.mjs +7 -7
- package/form-item-group/index.d.ts +91 -17
- package/form-item-group/index.mjs +2 -78
- package/form-item-group/style.css +1 -1
- package/form-item-x/index.d.ts +133 -18
- package/form-item-x/index.mjs +1 -1
- package/form-item-x/style.css +1 -0
- package/form-radio-group/index.d.ts +295 -28
- package/form-radio-group/index.mjs +1 -1
- package/form-rate/index.d.ts +244 -24
- package/form-rate/index.mjs +1 -1
- package/form-red-table/index.mjs +27 -26
- package/form-row/index.d.ts +2 -2
- package/form-row/index.mjs +1 -1
- package/form-select/index.d.ts +527 -28
- package/form-select/index.mjs +1 -1
- package/form-slider/index.d.ts +273 -26
- package/form-slider/index.mjs +1 -1
- package/form-switch/index.d.ts +264 -26
- package/form-switch/index.mjs +1 -1
- package/form-table/index.d.ts +287 -0
- package/form-table/index.mjs +2 -0
- package/form-table-plus/index.d.ts +266 -0
- package/form-table-plus/index.mjs +2 -0
- package/form-text/index.d.ts +157 -23
- package/form-text/index.mjs +1 -1
- package/form-textarea/index.d.ts +351 -0
- package/form-textarea/index.mjs +2 -0
- package/form-time-select/index.d.ts +325 -0
- package/form-time-select/index.mjs +2 -0
- package/form-tree-select/index.d.ts +715 -0
- package/form-tree-select/index.mjs +2 -0
- package/form-tree-select/style.css +1 -0
- package/form-tree-select-multiple/index.d.ts +717 -0
- package/form-tree-select-multiple/index.mjs +2 -0
- package/form-view/index.d.ts +225 -1
- package/form-view/index.mjs +280 -6
- package/form-view/style.css +1 -0
- package/guide-steps/index.d.ts +31 -0
- package/guide-steps/index.mjs +77 -0
- package/guide-steps/style.css +1 -0
- package/helper/dictionary.d.ts +29 -0
- package/helper/dictionary.mjs +97 -0
- package/helper/form-item.d.ts +17 -0
- package/helper/form-item.mjs +27 -0
- package/helper/input.d.ts +49 -0
- package/helper/input.mjs +2 -0
- package/helper/sub-table-plus.d.ts +98 -0
- package/helper/sub-table-plus.mjs +4 -0
- package/highlight-j-s/index.d.ts +18 -0
- package/highlight-j-s/index.mjs +51 -0
- package/highlight-j-s/style.css +1 -0
- package/hook/useDictionary.d.ts +60 -0
- package/hook/useDictionary.mjs +15 -0
- package/hook/useVisibilityChange.d.ts +4 -0
- package/hook/useVisibilityChange.mjs +14 -0
- package/iframe-window/index.d.ts +9 -0
- package/iframe-window/index.mjs +37 -0
- package/iframe-window/style.css +1 -0
- package/image-cropper/index.d.ts +365 -0
- package/image-cropper/index.mjs +156 -0
- package/image-cropper/style.css +1 -0
- package/image-preview/index.d.ts +61 -0
- package/image-preview/index.mjs +201 -0
- package/image-preview/style.css +1 -0
- package/image-viewer/index.d.ts +25 -0
- package/image-viewer/index.mjs +70 -0
- package/image-viewer/style.css +1 -0
- package/index.css +2 -0
- package/index.d.ts +120 -36
- package/index.mjs +122 -62
- package/input-number-range/index.d.ts +41 -0
- package/input-number-range/index.mjs +77 -0
- package/input-number-range/style.css +1 -0
- package/keyboard/index.d.ts +64 -0
- package/keyboard/index.mjs +2 -0
- package/keyboard/style.css +1 -0
- package/loading-view/index.d.ts +65 -0
- package/loading-view/index.mjs +39 -0
- package/loading-view/style.css +1 -0
- package/name-avatar/index.d.ts +62 -0
- package/name-avatar/index.mjs +61 -0
- package/name-avatar/style.css +1 -0
- package/nav-bar/index.d.ts +21 -0
- package/nav-bar/index.mjs +37 -0
- package/nav-bar/style.css +1 -0
- package/package.json +29 -7
- package/page/index.d.ts +21 -0
- package/page/index.mjs +17 -0
- package/page/style.css +1 -0
- package/page-header/index.d.ts +27 -0
- package/page-header/index.mjs +25 -0
- package/page-header/style.css +1 -0
- package/page-index/index.d.ts +82 -0
- package/page-index/index.mjs +124 -0
- package/page-index/style.css +1 -0
- package/page-index-top/index.d.ts +38 -0
- package/page-index-top/index.mjs +87 -0
- package/page-skeleton/index.d.ts +30 -0
- package/page-skeleton/index.mjs +44 -0
- package/page-skeleton/style.css +1 -0
- package/page-skeleton-new/index.d.ts +34 -0
- package/page-skeleton-new/index.mjs +80 -0
- package/page-skeleton-new/style.css +1 -0
- package/pageable-table/index.d.ts +400 -0
- package/pageable-table/index.mjs +2 -0
- package/pageable-table/style.css +1 -0
- package/photo-swipe/index.d.ts +18 -0
- package/photo-swipe/index.mjs +2 -0
- package/props/cascader.d.ts +326 -0
- package/props/cascader.mjs +145 -0
- package/props/checkbox-group.d.ts +213 -0
- package/props/checkbox-group.mjs +83 -0
- package/props/checkbox.d.ts +205 -0
- package/props/checkbox.mjs +74 -0
- package/props/col.d.ts +74 -0
- package/props/col.mjs +32 -0
- package/props/common.d.ts +114 -0
- package/props/common.mjs +18 -0
- package/props/date.d.ts +336 -0
- package/props/date.mjs +158 -0
- package/props/form-item.d.ts +144 -0
- package/props/form-item.mjs +73 -0
- package/props/form.d.ts +157 -0
- package/props/form.mjs +89 -0
- package/props/image.d.ts +102 -0
- package/props/image.mjs +10 -0
- package/props/input-cron.d.ts +102 -0
- package/props/input-cron.mjs +16 -0
- package/props/input-number.d.ts +216 -0
- package/props/input-number.mjs +72 -0
- package/props/input-tag.d.ts +123 -0
- package/props/input-tag.mjs +33 -0
- package/props/input.d.ts +299 -0
- package/props/input.mjs +97 -0
- package/props/radio-group.d.ts +205 -0
- package/props/radio-group.mjs +84 -0
- package/props/rate.d.ts +211 -0
- package/props/rate.mjs +66 -0
- package/props/select.d.ts +450 -0
- package/props/select.mjs +218 -0
- package/props/slide.d.ts +235 -0
- package/props/slide.mjs +72 -0
- package/props/switch.d.ts +229 -0
- package/props/switch.mjs +80 -0
- package/props/text.d.ts +127 -0
- package/props/text.mjs +22 -0
- package/props/textarea.d.ts +266 -0
- package/props/textarea.mjs +82 -0
- package/props/time-select.d.ts +216 -0
- package/props/time-select.mjs +67 -0
- package/props/time.d.ts +304 -0
- package/props/time.mjs +138 -0
- package/props/tree-select-multiple.d.ts +324 -0
- package/props/tree-select-multiple.mjs +16 -0
- package/props/tree-select.d.ts +326 -0
- package/props/tree-select.mjs +25 -0
- package/props/tree.d.ts +76 -0
- package/props/tree.mjs +75 -0
- package/props/vue-tree-select.d.ts +458 -0
- package/props/vue-tree-select.mjs +213 -0
- package/resolver/components.d.ts +2 -0
- package/resolver/components.mjs +4 -0
- package/resolver/index.mjs +29 -0
- package/sign-panel/index.d.ts +85 -0
- package/sign-panel/index.mjs +183 -0
- package/sign-panel/style.css +1 -0
- package/skeleton-panel/index.d.ts +27 -0
- package/skeleton-panel/index.mjs +38 -0
- package/skeleton-panel/style.css +1 -0
- package/split-pane/index.d.ts +106 -0
- package/split-pane/index.mjs +2 -0
- package/split-pane/style.css +1 -0
- package/stateful/index.d.ts +92 -0
- package/stateful/index.mjs +67 -0
- package/stateful/style.css +1 -0
- package/sub-table/index.d.ts +109 -0
- package/sub-table/index.mjs +2 -0
- package/sub-table/style.css +1 -0
- package/sub-table-plus/index.d.ts +109 -0
- package/sub-table-plus/index.mjs +2 -0
- package/sub-table-plus/style.css +1 -0
- package/swiper/index.d.ts +27 -0
- package/swiper/index.mjs +126 -0
- package/swiper/style.css +1 -0
- package/table-column/index.d.ts +163 -0
- package/table-column/index.mjs +2 -0
- package/table-column/style.css +1 -0
- package/table-column-def/index.d.ts +97 -0
- package/table-column-def/index.mjs +11 -0
- package/table-view/index.d.ts +345 -1
- package/table-view/index.mjs +472 -6
- package/table-view/style.css +1 -0
- package/tag-render/index.d.ts +48 -0
- package/tag-render/index.mjs +86 -0
- package/tag-render/style.css +1 -0
- package/text-ellipsis/index.d.ts +111 -0
- package/text-ellipsis/index.mjs +124 -0
- package/text-ellipsis/style.css +1 -0
- package/toolbar/index.d.ts +128 -1
- package/toolbar/index.mjs +1 -8
- package/toolbar/style.css +1 -0
- package/toolbar-button/index.d.ts +188 -1
- package/toolbar-button/index.mjs +1 -8
- package/toolbar-button/style.css +1 -0
- package/vue-cron/index.d.ts +191 -0
- package/vue-cron/index.mjs +2 -0
- package/vue-cron/style.css +1 -0
- package/vue-qr-code/index.d.ts +47 -0
- package/vue-qr-code/index.mjs +32 -0
- package/vue-tags-input/index.d.ts +373 -0
- package/vue-tags-input/index.mjs +350 -0
- package/vue-tags-input/style.css +1 -0
- package/vue-tree-select/index.d.ts +1489 -0
- package/vue-tree-select/index.mjs +2 -0
- package/vue-tree-select/style.css +1 -0
- package/vue-video-player/index.d.ts +117 -0
- package/vue-video-player/index.mjs +136 -0
- package/vue-video-player/style.css +1 -0
- package/watermark/index.d.ts +97 -0
- package/watermark/index.mjs +2 -0
- package/watermark/style.css +1 -0
- package/web-types.json +1 -1
- package/x-input-tag/index.d.ts +2 -0
- package/x-input-tag/index.mjs +232 -0
- package/x-input-tag/style.css +1 -0
- package/year-calendar/index.d.ts +99 -0
- package/year-calendar/index.mjs +2 -0
- package/year-calendar/style.css +1 -0
- package/chunks/1glrRdhD.mjs +0 -23
- package/chunks/6Ukll2os.mjs +0 -149
- package/chunks/78hGOZc9.mjs +0 -43
- package/chunks/BID1Rr2O.mjs +0 -32
- package/chunks/BMkPC2kt.mjs +0 -28
- package/chunks/BPJNSq9M.mjs +0 -4
- package/chunks/BaExlbMY.mjs +0 -32
- package/chunks/BeIZhqg_.mjs +0 -167
- package/chunks/BmQGmui_.mjs +0 -54
- package/chunks/BnycM8aG.mjs +0 -74
- package/chunks/BooKKkk0.mjs +0 -36
- package/chunks/Bpox2cVQ.mjs +0 -92
- package/chunks/Bs_IYr3X.mjs +0 -94
- package/chunks/BuZDN2DV.mjs +0 -28
- package/chunks/C4JpDEWP.mjs +0 -35
- package/chunks/DAjuA2O6.mjs +0 -28
- package/chunks/Dywq0t6V.mjs +0 -47
- package/chunks/GlsJxLiF.mjs +0 -35
- package/chunks/pFgf4c4i.mjs +0 -47
- package/chunks/zb_1Xy1W.mjs +0 -74
- package/constants.d.ts +0 -7
- package/constants.mjs +0 -4
- package/form-check-box-group/index.d.ts +0 -119
- package/form-check-box-group/index.mjs +0 -2
- package/input/style.css +0 -1
- package/json-editor/index.d.ts +0 -32
- package/json-editor/index.mjs +0 -2
- package/json-editor/style.css +0 -1
- package/resolver.mjs +0 -81
- /package/{resolver.d.ts → resolver/index.d.ts} +0 -0
|
@@ -0,0 +1,1354 @@
|
|
|
1
|
+
import { allProps as e } from "../props/vue-tree-select.mjs";
|
|
2
|
+
import { Fragment as t, Teleport as n, Transition as r, TransitionGroup as i, computed as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, inject as u, isVNode as d, mergeProps as f, nextTick as p, onBeforeUnmount as m, onMounted as h, onUnmounted as g, openBlock as _, ref as v, useTemplateRef as y, watch as b } from "vue";
|
|
3
|
+
import { isPromise as x } from "@web-utils/core";
|
|
4
|
+
import { debounce as S, last as C, noop as w, once as T } from "lodash-es";
|
|
5
|
+
//#region src/components/tree-select/utils/index.ts
|
|
6
|
+
var E = w, D = (e) => function(t, ...n) {
|
|
7
|
+
t.type === "mousedown" && t.button === 0 && e.call(this, t, ...n);
|
|
8
|
+
}, O = (e, t) => {
|
|
9
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.offsetHeight / 3;
|
|
10
|
+
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));
|
|
11
|
+
};
|
|
12
|
+
function k(e) {
|
|
13
|
+
let t = [], n = e.parentNode;
|
|
14
|
+
for (; n && n.nodeName !== "BODY" && n.nodeType === document.ELEMENT_NODE;) A(n) && t.push(n), n = n.parentNode;
|
|
15
|
+
return t.push(window), t;
|
|
16
|
+
}
|
|
17
|
+
function A(e) {
|
|
18
|
+
if (!e) return !1;
|
|
19
|
+
let { overflow: t, overflowX: n, overflowY: r } = getComputedStyle(e);
|
|
20
|
+
return /(auto|scroll|overlay)/.test(t + r + n);
|
|
21
|
+
}
|
|
22
|
+
function j(e, t) {
|
|
23
|
+
let n = k(e);
|
|
24
|
+
return window.addEventListener("resize", t, { passive: !0 }), n.forEach((e) => {
|
|
25
|
+
e.addEventListener("scroll", t, { passive: !0 });
|
|
26
|
+
}), function() {
|
|
27
|
+
window.removeEventListener("resize", t), n.forEach((e) => {
|
|
28
|
+
e.removeEventListener("scroll", t);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var M = (e) => Number.isNaN(e), N = () => ({});
|
|
33
|
+
function P(e) {
|
|
34
|
+
return typeof e != "object" || !e ? !1 : Object.getPrototypeOf(e) === Object.prototype;
|
|
35
|
+
}
|
|
36
|
+
function ee(e, t, n) {
|
|
37
|
+
P(n) ? (e[t] || (e[t] = {}), F(e[t], n)) : e[t] = n;
|
|
38
|
+
}
|
|
39
|
+
function F(e, t) {
|
|
40
|
+
if (P(t)) {
|
|
41
|
+
let n = Object.keys(t);
|
|
42
|
+
for (let r = 0, i = n.length; r < i; r++) ee(e, n[r], t[n[r]]);
|
|
43
|
+
}
|
|
44
|
+
return e;
|
|
45
|
+
}
|
|
46
|
+
function I(e, t, n) {
|
|
47
|
+
for (let r = 0, i = e.length; r < i; r++) if (t.call(n, e[r], r, e)) return e[r];
|
|
48
|
+
}
|
|
49
|
+
function te(e, t) {
|
|
50
|
+
let n = e.indexOf(t);
|
|
51
|
+
n !== -1 && e.splice(n, 1);
|
|
52
|
+
}
|
|
53
|
+
function L(e, t) {
|
|
54
|
+
return e.indexOf(t) !== -1;
|
|
55
|
+
}
|
|
56
|
+
function R(e, t) {
|
|
57
|
+
if (e.length !== t.length) return !0;
|
|
58
|
+
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !0;
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
function ne(e, t) {
|
|
62
|
+
let n = t.length, r = e.length;
|
|
63
|
+
if (r > n) return !1;
|
|
64
|
+
if (r === n) return e === t;
|
|
65
|
+
outer: for (let i = 0, a = 0; i < r; i++) {
|
|
66
|
+
let r = e.charCodeAt(i);
|
|
67
|
+
for (; a < n;) if (t.charCodeAt(a++) === r) continue outer;
|
|
68
|
+
return !1;
|
|
69
|
+
}
|
|
70
|
+
return !0;
|
|
71
|
+
}
|
|
72
|
+
var z, B = [], re = 100;
|
|
73
|
+
function ie() {
|
|
74
|
+
z = window.setInterval(() => {
|
|
75
|
+
B.forEach(oe);
|
|
76
|
+
}, re);
|
|
77
|
+
}
|
|
78
|
+
function ae() {
|
|
79
|
+
z && clearInterval(z), z = null;
|
|
80
|
+
}
|
|
81
|
+
function oe(e) {
|
|
82
|
+
let { $el: t, listener: n, lastWidth: r, lastHeight: i } = e, a = t.offsetWidth, o = t.offsetHeight;
|
|
83
|
+
(r !== a || i !== o) && (e.lastWidth = a, e.lastHeight = o, n({
|
|
84
|
+
width: a,
|
|
85
|
+
height: o
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
function se(e, t) {
|
|
89
|
+
let n = {
|
|
90
|
+
$el: e,
|
|
91
|
+
listener: t,
|
|
92
|
+
lastWidth: null,
|
|
93
|
+
lastHeight: null
|
|
94
|
+
};
|
|
95
|
+
return B.push(n), oe(n), ie(), () => {
|
|
96
|
+
te(B, n), B.length || ae();
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function ce(e, t) {
|
|
100
|
+
let n = document.createElement("_"), r = n.appendChild(document.createElement("_")), i = n.appendChild(document.createElement("_")), a = r.appendChild(document.createElement("_")), o, s;
|
|
101
|
+
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;
|
|
102
|
+
function c() {
|
|
103
|
+
l();
|
|
104
|
+
let a = e.offsetWidth, u = e.offsetHeight;
|
|
105
|
+
(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({
|
|
106
|
+
width: a,
|
|
107
|
+
height: u
|
|
108
|
+
})), r.addEventListener("scroll", c), n.addEventListener("scroll", c);
|
|
109
|
+
}
|
|
110
|
+
function l() {
|
|
111
|
+
r.removeEventListener("scroll", c), n.removeEventListener("scroll", c);
|
|
112
|
+
}
|
|
113
|
+
function u() {
|
|
114
|
+
l(), e.removeChild(n);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function le(e, t) {
|
|
118
|
+
let n = document.documentMode === 9, r = !0, i = (n ? se : ce)(e, (...e) => r || t(...e));
|
|
119
|
+
return r = !1, i;
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/components/tree-select/constants.ts
|
|
123
|
+
var V = "ALL_CHILDREN", H = "ALL_DESCENDANTS", U = "LEAF_CHILDREN", W = "LEAF_DESCENDANTS", ue = "LOAD_ROOT_OPTIONS", de = "LOAD_CHILDREN_OPTIONS", fe = "ASYNC_SEARCH", G = {
|
|
124
|
+
BACKSPACE: 8,
|
|
125
|
+
ENTER: 13,
|
|
126
|
+
ESCAPE: 27,
|
|
127
|
+
END: 35,
|
|
128
|
+
HOME: 36,
|
|
129
|
+
ARROW_LEFT: 37,
|
|
130
|
+
ARROW_UP: 38,
|
|
131
|
+
ARROW_RIGHT: 39,
|
|
132
|
+
ARROW_DOWN: 40,
|
|
133
|
+
DELETE: 46
|
|
134
|
+
}, K = Symbol("vueTreeSelect");
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/components/tree-select/components/VueTreeSelectHiddenFields.vue?vue&type=script&lang.jsx
|
|
137
|
+
function pe(e) {
|
|
138
|
+
// istanbul ignore next
|
|
139
|
+
return typeof e == "string" ? e :
|
|
140
|
+
// istanbul ignore else
|
|
141
|
+
e != null && !M(e) ? JSON.stringify(e) : "";
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/components/tree-select/components/VueTreeSelectHiddenFields.vue
|
|
145
|
+
var me = {
|
|
146
|
+
name: "VueTreeSelectHiddenFields",
|
|
147
|
+
setup() {
|
|
148
|
+
let e = u(K);
|
|
149
|
+
return () => {
|
|
150
|
+
if (!e.name || e.disabled || !e.hasValue) return null;
|
|
151
|
+
let t = e.internalValue.map(pe);
|
|
152
|
+
return e.multiple && e.joinValues && (t = [t.join(e.delimiter)]), t.map((t, n) => l("input", {
|
|
153
|
+
type: "hidden",
|
|
154
|
+
name: e.name,
|
|
155
|
+
value: t,
|
|
156
|
+
key: `hidden-field-${n}`
|
|
157
|
+
}, null));
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}, he = [
|
|
161
|
+
G.ENTER,
|
|
162
|
+
G.END,
|
|
163
|
+
G.HOME,
|
|
164
|
+
G.ARROW_LEFT,
|
|
165
|
+
G.ARROW_UP,
|
|
166
|
+
G.ARROW_RIGHT,
|
|
167
|
+
G.ARROW_DOWN
|
|
168
|
+
], ge = {
|
|
169
|
+
name: "VueTreeSelectInput",
|
|
170
|
+
setup(e, { expose: t }) {
|
|
171
|
+
let n = u(K), r = v(""), i = v(5), o = y("sizer"), s = y("input"), c = () => {
|
|
172
|
+
n.trigger.searchQuery = r.value;
|
|
173
|
+
}, d = S(c, 200, {
|
|
174
|
+
leading: !0,
|
|
175
|
+
trailing: !0
|
|
176
|
+
}), m = a(() => n.searchable && !n.disabled && n.multiple), h = a(() => ({ width: m.value ? `${i.value}px` : null })), g = () => {
|
|
177
|
+
if (!n.disabled) {
|
|
178
|
+
var e;
|
|
179
|
+
(e = s.value) == null || e.focus();
|
|
180
|
+
}
|
|
181
|
+
}, _ = () => {
|
|
182
|
+
var e;
|
|
183
|
+
(e = s.value) == null || e.blur();
|
|
184
|
+
}, x = () => {
|
|
185
|
+
// istanbul ignore else
|
|
186
|
+
n.trigger.isFocused = !0, n.openOnFocus && n.openMenu();
|
|
187
|
+
}, C = () => {
|
|
188
|
+
let e = n.getMenu();
|
|
189
|
+
// istanbul ignore next
|
|
190
|
+
if (e && document.activeElement === e) return g();
|
|
191
|
+
n.trigger.isFocused = !1, n.closeMenu();
|
|
192
|
+
}, w = (e) => {
|
|
193
|
+
let { value: t } = e.target;
|
|
194
|
+
r.value = t, t ? d() : (d.cancel(), c());
|
|
195
|
+
}, T = () => {
|
|
196
|
+
w({ target: { value: "" } });
|
|
197
|
+
}, E = (e) => {
|
|
198
|
+
let t = "which" in e ? e.which : /* istanbul ignore next */ e.keyCode;
|
|
199
|
+
if (!(e.ctrlKey || e.shiftKey || e.altKey || e.metaKey)) {
|
|
200
|
+
if (!n.menu.isOpen && L(he, t)) return e.preventDefault(), n.openMenu();
|
|
201
|
+
switch (t) {
|
|
202
|
+
case G.BACKSPACE:
|
|
203
|
+
n.backspaceRemoves && !r.value.length && n.removeLastValue();
|
|
204
|
+
break;
|
|
205
|
+
case G.ENTER: {
|
|
206
|
+
if (e.preventDefault(), n.menu.current === null) return;
|
|
207
|
+
let t = n.getNode(n.menu.current);
|
|
208
|
+
if (t.isBranch && n.disableBranchNodes) return;
|
|
209
|
+
n.select(t);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
case G.ESCAPE:
|
|
213
|
+
r.value.length ? T() : n.menu.isOpen && n.closeMenu();
|
|
214
|
+
break;
|
|
215
|
+
case G.END:
|
|
216
|
+
e.preventDefault(), n.highlightLastOption();
|
|
217
|
+
break;
|
|
218
|
+
case G.HOME:
|
|
219
|
+
e.preventDefault(), n.highlightFirstOption();
|
|
220
|
+
break;
|
|
221
|
+
case G.ARROW_LEFT: {
|
|
222
|
+
let t = n.getNode(n.menu.current);
|
|
223
|
+
t.isBranch && n.shouldExpand(t) ? (e.preventDefault(), n.toggleExpanded(t)) : !t.isRootNode && (t.isLeaf || t.isBranch && !n.shouldExpand(t)) && (e.preventDefault(), n.setCurrentHighlightedOption(t.parentNode));
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
case G.ARROW_UP:
|
|
227
|
+
e.preventDefault(), n.highlightPrevOption();
|
|
228
|
+
break;
|
|
229
|
+
case G.ARROW_RIGHT: {
|
|
230
|
+
let t = n.getNode(n.menu.current);
|
|
231
|
+
t.isBranch && !n.shouldExpand(t) && (e.preventDefault(), n.toggleExpanded(t));
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
case G.ARROW_DOWN:
|
|
235
|
+
e.preventDefault(), n.highlightNextOption();
|
|
236
|
+
break;
|
|
237
|
+
case G.DELETE:
|
|
238
|
+
n.deleteRemoves && !r.value.length && n.removeLastValue();
|
|
239
|
+
break;
|
|
240
|
+
default:
|
|
241
|
+
// istanbul ignore else
|
|
242
|
+
n.openMenu();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}, D = (e) => {
|
|
246
|
+
// istanbul ignore next
|
|
247
|
+
r.value.length && e.stopPropagation();
|
|
248
|
+
}, O = () => l("input", {
|
|
249
|
+
ref: "input",
|
|
250
|
+
class: "vue-treeselect__input",
|
|
251
|
+
type: "text",
|
|
252
|
+
autocomplete: "off",
|
|
253
|
+
tabIndex: n.tabIndex,
|
|
254
|
+
required: n.required && !n.hasValue,
|
|
255
|
+
value: r.value,
|
|
256
|
+
style: h.value,
|
|
257
|
+
onFocus: x,
|
|
258
|
+
onInput: w,
|
|
259
|
+
onBlur: C,
|
|
260
|
+
onKeydown: E,
|
|
261
|
+
onMousedown: D
|
|
262
|
+
}, null), k = () => l("div", {
|
|
263
|
+
ref: "sizer",
|
|
264
|
+
class: "vue-treeselect__sizer"
|
|
265
|
+
}, [r.value]), A = () => {
|
|
266
|
+
var e;
|
|
267
|
+
i.value = Math.max(5, ((e = o.value) == null ? void 0 : e.scrollWidth) + 15);
|
|
268
|
+
};
|
|
269
|
+
return b(() => n.trigger.searchQuery, (e) => {
|
|
270
|
+
r.value = e;
|
|
271
|
+
}), b(r, () => {
|
|
272
|
+
// istanbul ignore else
|
|
273
|
+
m.value && p(A);
|
|
274
|
+
}), t({
|
|
275
|
+
blur: _,
|
|
276
|
+
focus: g
|
|
277
|
+
}), () => {
|
|
278
|
+
let e = {}, t = [];
|
|
279
|
+
return n.searchable && !n.disabled && (t.push(O()), m.value && t.push(k())), n.searchable || F(e, {
|
|
280
|
+
on: {
|
|
281
|
+
focus: x,
|
|
282
|
+
blur: C,
|
|
283
|
+
keydown: E
|
|
284
|
+
},
|
|
285
|
+
ref: "input"
|
|
286
|
+
}), !n.searchable && !n.disabled && F(e, { attrs: { tabIndex: n.tabIndex } }), l("div", f({ class: "vue-treeselect__input-container" }, e), [t]);
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}, _e = {
|
|
290
|
+
name: "VueTreeSelectPlaceholder",
|
|
291
|
+
setup() {
|
|
292
|
+
let e = u(K);
|
|
293
|
+
return () => l("div", { class: {
|
|
294
|
+
"vue-treeselect__placeholder": !0,
|
|
295
|
+
"vue-treeselect-helper-zoom-effect-off": !0,
|
|
296
|
+
"vue-treeselect-helper-hide": e.hasValue || e.trigger.searchQuery
|
|
297
|
+
} }, [e.placeholder]);
|
|
298
|
+
}
|
|
299
|
+
}, ve = {
|
|
300
|
+
name: "VueTreeSelectSingleValue",
|
|
301
|
+
setup(e, { expose: n }) {
|
|
302
|
+
let r = u(K);
|
|
303
|
+
return n({ input: y("input") }), () => {
|
|
304
|
+
let e = r.selectedNodes[0];
|
|
305
|
+
return l(t, null, [
|
|
306
|
+
r.hasValue && !r.trigger.searchQuery ? l("div", { class: "vue-treeselect__single-value" }, [r.$slots["value-label"] ? r.$slots["value-label"]({ node: e }) : e.label]) : null,
|
|
307
|
+
l(_e, null, null),
|
|
308
|
+
l(ge, { ref: "input" }, null)
|
|
309
|
+
]);
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
}, ye = {
|
|
313
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
314
|
+
viewBox: "0 0 348.333 348.333"
|
|
315
|
+
}, be = /* @__PURE__ */ Object.assign({ name: "VueTreeSelectDelete" }, {
|
|
316
|
+
__name: "VueTreeSelectDelete",
|
|
317
|
+
setup(e) {
|
|
318
|
+
return (e, t) => (_(), o("svg", ye, [...t[0] || (t[0] = [s("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)])]));
|
|
319
|
+
}
|
|
320
|
+
}), xe = {
|
|
321
|
+
name: "VueTreeSelectMultiValueItem",
|
|
322
|
+
props: { node: {
|
|
323
|
+
type: Object,
|
|
324
|
+
required: !0
|
|
325
|
+
} },
|
|
326
|
+
setup(e) {
|
|
327
|
+
let t = u(K), n = D(() => {
|
|
328
|
+
t.select(e.node);
|
|
329
|
+
});
|
|
330
|
+
return () => l("div", { class: "vue-treeselect__multi-value-item-container" }, [l("div", {
|
|
331
|
+
class: {
|
|
332
|
+
"vue-treeselect__multi-value-item": !0,
|
|
333
|
+
"vue-treeselect__multi-value-item-disabled": e.node.isDisabled,
|
|
334
|
+
"vue-treeselect__multi-value-item-new": e.node.isNew
|
|
335
|
+
},
|
|
336
|
+
onMousedown: n
|
|
337
|
+
}, [l("span", { class: "vue-treeselect__multi-value-label" }, [t.$slots["value-label"] ? t.$slots["value-label"]({ node: e.node }) : e.node.label]), l("span", { class: "vue-treeselect__icon vue-treeselect__value-remove" }, [l(be, null, null)])])]);
|
|
338
|
+
}
|
|
339
|
+
}, Se = {
|
|
340
|
+
name: "VueTreeSelectMultiValue",
|
|
341
|
+
setup(e, { expose: t }) {
|
|
342
|
+
let n = u(K), r = { props: {
|
|
343
|
+
tag: "div",
|
|
344
|
+
name: "vue-treeselect__multi-value-item--transition",
|
|
345
|
+
appear: !0
|
|
346
|
+
} }, a = () => n.internalValue.slice(0, n.limit).map(n.getNode).map((e) => l(xe, {
|
|
347
|
+
key: `multi-value-item-${e.id}`,
|
|
348
|
+
node: e
|
|
349
|
+
}, null)), o = () => {
|
|
350
|
+
let e = n.internalValue.length - n.limit;
|
|
351
|
+
return e <= 0 ? null : l("div", {
|
|
352
|
+
class: "vue-treeselect__limit-tip vue-treeselect-helper-zoom-effect-off",
|
|
353
|
+
key: "exceed-limit-tip"
|
|
354
|
+
}, [l("span", { class: "vue-treeselect__limit-tip-text" }, [n.limitText(e)])]);
|
|
355
|
+
};
|
|
356
|
+
return t({ input: y("input") }), () => l(i, f({ class: "vue-treeselect__multi-value" }, r), { default: () => [
|
|
357
|
+
a(),
|
|
358
|
+
o(),
|
|
359
|
+
l(_e, { key: "placeholder" }, null),
|
|
360
|
+
l(ge, {
|
|
361
|
+
ref: "input",
|
|
362
|
+
key: "input"
|
|
363
|
+
}, null)
|
|
364
|
+
] });
|
|
365
|
+
}
|
|
366
|
+
}, Ce = {
|
|
367
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
368
|
+
viewBox: "0 0 292.362 292.362"
|
|
369
|
+
}, we = /* @__PURE__ */ Object.assign({ name: "VueTreeSelectArrow" }, {
|
|
370
|
+
__name: "VueTreeSelectArrow",
|
|
371
|
+
setup(e) {
|
|
372
|
+
return (e, t) => (_(), o("svg", Ce, [...t[0] || (t[0] = [s("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)])]));
|
|
373
|
+
}
|
|
374
|
+
}), Te = {
|
|
375
|
+
name: "VueTreeSelectControl",
|
|
376
|
+
setup(e, { expose: t }) {
|
|
377
|
+
let n = u(K), r = a(() => n.hasValue && n.internalValue.some((e) => !n.getNode(e).isDisabled)), i = a(() => n.clearable && !n.disabled && n.hasValue && (r.value || n.allowClearingDisabled)), o = a(() => n.alwaysOpen ? !n.menu.isOpen : !0), s = D((e) => {
|
|
378
|
+
e.preventDefault(), e.stopPropagation(), n.focusInput(), n.toggleMenu();
|
|
379
|
+
}), c = () => {
|
|
380
|
+
let e = n.multiple ? n.clearAllText : n.clearValueText;
|
|
381
|
+
return i.value ? l("div", {
|
|
382
|
+
class: "vue-treeselect__x-container",
|
|
383
|
+
title: e,
|
|
384
|
+
onMousedown: f
|
|
385
|
+
}, [l(be, { class: "vue-treeselect__x" }, null)]) : null;
|
|
386
|
+
}, d = () => {
|
|
387
|
+
let e = {
|
|
388
|
+
"vue-treeselect__control-arrow": !0,
|
|
389
|
+
"vue-treeselect__control-arrow--rotated": n.menu.isOpen
|
|
390
|
+
};
|
|
391
|
+
return o.value ? l("div", {
|
|
392
|
+
class: "vue-treeselect__control-arrow-container",
|
|
393
|
+
onMousedown: s
|
|
394
|
+
}, [l(we, { class: e }, null)]) : null;
|
|
395
|
+
}, f = D((e) => {
|
|
396
|
+
e.stopPropagation(), e.preventDefault();
|
|
397
|
+
let t = n.beforeClearAll(), r = (e) => {
|
|
398
|
+
e && n.clear();
|
|
399
|
+
};
|
|
400
|
+
x(t) ? t.then(r) : setTimeout(() => r(t), 0);
|
|
401
|
+
});
|
|
402
|
+
return t({
|
|
403
|
+
container: y("container"),
|
|
404
|
+
valueContainer: y("value-container")
|
|
405
|
+
}), () => {
|
|
406
|
+
let e = n.single ? ve : Se;
|
|
407
|
+
return l("div", {
|
|
408
|
+
class: "vue-treeselect__control",
|
|
409
|
+
onMousedown: n.handleMouseDown
|
|
410
|
+
}, [
|
|
411
|
+
l("div", {
|
|
412
|
+
class: "vue-treeselect__value-container",
|
|
413
|
+
ref: "container"
|
|
414
|
+
}, [l(e, { ref: "value-container" }, null)]),
|
|
415
|
+
c(),
|
|
416
|
+
d()
|
|
417
|
+
]);
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/components/tree-select/components/VueTreeSelectTip.jsx
|
|
423
|
+
function q(e, { slots: t }) {
|
|
424
|
+
var n;
|
|
425
|
+
return l("div", { class: `vue-treeselect__tip vue-treeselect__${e.type}-tip` }, [l("div", { class: "vue-treeselect__icon-container" }, [l("span", { class: `vue-treeselect__icon-${e.icon}` }, null)]), l("span", { class: `vue-treeselect__tip-text vue-treeselect__${e.type}-tip-text` }, [(n = t.default) == null ? void 0 : n.call(t)])]);
|
|
426
|
+
}
|
|
427
|
+
q.props = {
|
|
428
|
+
type: {
|
|
429
|
+
type: String,
|
|
430
|
+
required: !0
|
|
431
|
+
},
|
|
432
|
+
icon: {
|
|
433
|
+
type: String,
|
|
434
|
+
required: !0
|
|
435
|
+
}
|
|
436
|
+
}, q.inheritAttrs = !1;
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/components/tree-select/components/VueTreeSelectOption.vue?vue&type=script&lang.jsx
|
|
439
|
+
function Ee(e) {
|
|
440
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
|
|
441
|
+
}
|
|
442
|
+
var J, Y, X, De = {
|
|
443
|
+
name: "VueTreeSelectOption",
|
|
444
|
+
props: { node: {
|
|
445
|
+
type: Object,
|
|
446
|
+
required: !0
|
|
447
|
+
} },
|
|
448
|
+
setup(e) {
|
|
449
|
+
let t = u(K), n = a(() => e.node.isBranch && t.shouldExpand(e.node)), i = a(() => t.shouldShowOptionInMenu(e.node)), o = () => l("div", {
|
|
450
|
+
class: {
|
|
451
|
+
"vue-treeselect__option": !0,
|
|
452
|
+
"vue-treeselect__option--disabled": e.node.isDisabled,
|
|
453
|
+
"vue-treeselect__option--selected": t.isSelected(e.node),
|
|
454
|
+
"vue-treeselect__option--highlight": e.node.isHighlighted,
|
|
455
|
+
"vue-treeselect__option--matched": t.localSearch.active && e.node.isMatched,
|
|
456
|
+
"vue-treeselect__option--hide": !i.value
|
|
457
|
+
},
|
|
458
|
+
onMouseenter: b,
|
|
459
|
+
"data-id": e.node.id
|
|
460
|
+
}, [d(), f([p([m()]), h()])]), s = () => n.value ? l("div", { class: "vue-treeselect__list" }, [
|
|
461
|
+
g(),
|
|
462
|
+
_(),
|
|
463
|
+
v(),
|
|
464
|
+
y()
|
|
465
|
+
]) : null, d = () => {
|
|
466
|
+
if (t.shouldFlattenOptions && i.value) return null;
|
|
467
|
+
if (e.node.isBranch) {
|
|
468
|
+
let e = { props: {
|
|
469
|
+
name: "vue-treeselect__option-arrow--prepare",
|
|
470
|
+
appear: !0
|
|
471
|
+
} }, t = {
|
|
472
|
+
"vue-treeselect__option-arrow": !0,
|
|
473
|
+
"vue-treeselect__option-arrow--rotated": n.value
|
|
474
|
+
};
|
|
475
|
+
return l("div", {
|
|
476
|
+
class: "vue-treeselect__option-arrow-container",
|
|
477
|
+
onMousedown: x
|
|
478
|
+
}, [l(r, e, { default: () => [l(we, { class: t }, null)] })]);
|
|
479
|
+
}
|
|
480
|
+
return t.hasBranchNodes ? (J || (J = l("div", { class: "vue-treeselect__option-arrow-placeholder" }, [c("\xA0")])), J) : null;
|
|
481
|
+
}, f = (e) => l("div", {
|
|
482
|
+
class: "vue-treeselect__label-container",
|
|
483
|
+
onMousedown: S
|
|
484
|
+
}, [e]), p = (n) => t.single || t.disableBranchNodes && e.node.isBranch ? null : l("div", { class: "vue-treeselect__checkbox-container" }, [n]), m = () => {
|
|
485
|
+
let n = t.forest.checkedStateMap[e.node.id], r = {
|
|
486
|
+
"vue-treeselect__checkbox": !0,
|
|
487
|
+
"vue-treeselect__checkbox--checked": n === 2,
|
|
488
|
+
"vue-treeselect__checkbox--indeterminate": n === 1,
|
|
489
|
+
"vue-treeselect__checkbox--unchecked": n === 0,
|
|
490
|
+
"vue-treeselect__checkbox--disabled": e.node.isDisabled
|
|
491
|
+
};
|
|
492
|
+
return Y || (Y = l("span", { class: "vue-treeselect__check-mark" }, null)), X || (X = l("span", { class: "vue-treeselect__minus-mark" }, null)), l("span", { class: r }, [Y, X]);
|
|
493
|
+
}, h = () => {
|
|
494
|
+
let n = e.node.isBranch && (t.localSearch.active ? t.showCountOnSearchComputed : t.showCount), r = n ? t.localSearch.active ? t.localSearch.countMap[e.node.id][t.showCountOf] : e.node.count[t.showCountOf] : NaN, i = "vue-treeselect__label", a = "vue-treeselect__count", o = t.$slots["option-label"];
|
|
495
|
+
return o ? o({
|
|
496
|
+
node: e.node,
|
|
497
|
+
shouldShowCount: n,
|
|
498
|
+
count: r,
|
|
499
|
+
labelClassName: i,
|
|
500
|
+
countClassName: a
|
|
501
|
+
}) : l("label", { class: i }, [e.node.label, n && l("span", { class: a }, [
|
|
502
|
+
c("("),
|
|
503
|
+
r,
|
|
504
|
+
c(")")
|
|
505
|
+
])]);
|
|
506
|
+
}, g = () => e.node.childrenStates.isLoaded ? e.node.children.map((e) => l(De, {
|
|
507
|
+
node: e,
|
|
508
|
+
key: e.id
|
|
509
|
+
}, null)) : null, _ = () => !e.node.childrenStates.isLoaded || e.node.children.length ? null : l(q, {
|
|
510
|
+
type: "no-children",
|
|
511
|
+
icon: "warning"
|
|
512
|
+
}, { default: () => [t.noChildrenText] }), v = () => e.node.childrenStates.isLoading ? l(q, {
|
|
513
|
+
type: "loading",
|
|
514
|
+
icon: "loader"
|
|
515
|
+
}, { default: () => [t.loadingText] }) : null, y = () => e.node.childrenStates.loadingError ? l(q, {
|
|
516
|
+
type: "error",
|
|
517
|
+
icon: "error"
|
|
518
|
+
}, { default: () => [e.node.childrenStates.loadingError, l("a", {
|
|
519
|
+
class: "vue-treeselect__retry",
|
|
520
|
+
title: t.retryTitle,
|
|
521
|
+
onMousedown: C
|
|
522
|
+
}, [t.retryText])] }) : null, b = (n) => {
|
|
523
|
+
n.target === n.currentTarget && t.setCurrentHighlightedOption(e.node, !1);
|
|
524
|
+
}, x = D(() => {
|
|
525
|
+
t.toggleExpanded(e.node);
|
|
526
|
+
}), S = D(() => {
|
|
527
|
+
e.node.isBranch && t.disableBranchNodes ? t.toggleExpanded(e.node) : t.select(e.node);
|
|
528
|
+
}), C = D(() => {
|
|
529
|
+
t.loadChildrenOptions(e.node);
|
|
530
|
+
});
|
|
531
|
+
return () => {
|
|
532
|
+
let n;
|
|
533
|
+
return l("div", { class: {
|
|
534
|
+
"vue-treeselect__list-item": !0,
|
|
535
|
+
[`vue-treeselect__indent-level-${t.shouldFlattenOptions ? 0 : e.node.level}`]: !0
|
|
536
|
+
} }, [o(), e.node.isBranch && l(r, { name: "vue-treeselect__list--transition" }, Ee(n = s()) ? n : { default: () => [n] })]);
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/components/tree-select/components/VueTreeSelectMenu.vue?vue&type=script&lang.jsx
|
|
542
|
+
function Oe(e) {
|
|
543
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
|
|
544
|
+
}
|
|
545
|
+
var ke = {
|
|
546
|
+
top: "top",
|
|
547
|
+
bottom: "bottom",
|
|
548
|
+
above: "top",
|
|
549
|
+
below: "bottom"
|
|
550
|
+
}, Ae = {
|
|
551
|
+
name: "VueTreeSelectMenu",
|
|
552
|
+
setup() {
|
|
553
|
+
let e = u(K), t = null, n = null, i = a(() => ({ maxHeight: `${e.maxHeight}px` })), o = a(() => ({ zIndex: e.appendToBody ? null : e.zIndex })), s = () => e.menu.isOpen ? l("div", {
|
|
554
|
+
ref: "menu",
|
|
555
|
+
class: "vue-treeselect__menu",
|
|
556
|
+
onMousedown: e.handleMouseDown,
|
|
557
|
+
style: i.value
|
|
558
|
+
}, [
|
|
559
|
+
c(),
|
|
560
|
+
e.async ? _() : e.localSearch.active ? m() : f(),
|
|
561
|
+
d()
|
|
562
|
+
]) : null, c = () => {
|
|
563
|
+
let t = e.$slots["before-list"];
|
|
564
|
+
return t ? t() : null;
|
|
565
|
+
}, d = () => {
|
|
566
|
+
let t = e.$slots["after-list"];
|
|
567
|
+
return t ? t() : null;
|
|
568
|
+
}, f = () => e.rootOptionsStates.isLoading ? x() : e.rootOptionsStates.loadingError ? S() : e.rootOptionsStates.isLoaded && e.forest.normalizedOptions.length === 0 ? w() : v(), m = () => e.rootOptionsStates.isLoading ? x() : e.rootOptionsStates.loadingError ? S() : e.rootOptionsStates.isLoaded && e.forest.normalizedOptions.length === 0 ? w() : e.localSearch.noResults ? T() : v(), _ = () => {
|
|
569
|
+
let t = e.getRemoteSearchEntry(), n = e.trigger.searchQuery === "" && !e.defaultOptions, r = n ? !1 : t.isLoaded && t.options.length === 0;
|
|
570
|
+
return n ? y() : t.isLoading ? x() : t.loadingError ? C() : r ? T() : v();
|
|
571
|
+
}, v = () => l("div", { class: "vue-treeselect__list" }, [e.forest.normalizedOptions.map((e) => l(De, {
|
|
572
|
+
node: e,
|
|
573
|
+
key: e.id
|
|
574
|
+
}, null))]), y = () => l(q, {
|
|
575
|
+
type: "search-prompt",
|
|
576
|
+
icon: "warning"
|
|
577
|
+
}, { default: () => [e.searchPromptText] }), x = () => l(q, {
|
|
578
|
+
type: "loading",
|
|
579
|
+
icon: "loader"
|
|
580
|
+
}, { default: () => [e.loadingText] }), S = () => l(q, {
|
|
581
|
+
type: "error",
|
|
582
|
+
icon: "error"
|
|
583
|
+
}, { default: () => [e.rootOptionsStates.loadingError, l("a", {
|
|
584
|
+
class: "vue-treeselect__retry",
|
|
585
|
+
onClick: e.loadRootOptions,
|
|
586
|
+
title: e.retryTitle
|
|
587
|
+
}, [e.retryText])] }), C = () => {
|
|
588
|
+
let t = e.getRemoteSearchEntry();
|
|
589
|
+
return l(q, {
|
|
590
|
+
type: "error",
|
|
591
|
+
icon: "error"
|
|
592
|
+
}, { default: () => [t.loadingError, l("a", {
|
|
593
|
+
class: "vue-treeselect__retry",
|
|
594
|
+
onClick: e.handleRemoteSearch,
|
|
595
|
+
title: e.retryTitle
|
|
596
|
+
}, [e.retryText])] });
|
|
597
|
+
}, w = () => l(q, {
|
|
598
|
+
type: "no-options",
|
|
599
|
+
icon: "warning"
|
|
600
|
+
}, { default: () => [e.noOptionsText] }), T = () => l(q, {
|
|
601
|
+
type: "no-results",
|
|
602
|
+
icon: "warning"
|
|
603
|
+
}, { default: () => [e.noResultsText] }), E = () => {
|
|
604
|
+
O(), k(), A();
|
|
605
|
+
}, D = () => {
|
|
606
|
+
M(), N();
|
|
607
|
+
}, O = () => {
|
|
608
|
+
if (!e.menu.isOpen) return;
|
|
609
|
+
let t = e.getMenu(), n = e.getControl(), r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = r.height, o = window.innerHeight, s = i.top, c = window.innerHeight - i.bottom, l = i.top >= 0 && i.top <= o || i.top < 0 && i.bottom > 0, u = c > a + 40, d = s > a + 40;
|
|
610
|
+
l ? e.openDirection === "auto" ? u || !d ? e.menu.placement = "bottom" : e.menu.placement = "top" : e.menu.placement = ke[e.openDirection] : e.closeMenu();
|
|
611
|
+
}, k = () => {
|
|
612
|
+
let n = e.getMenu();
|
|
613
|
+
t || (t = { remove: le(n, O) });
|
|
614
|
+
}, A = () => {
|
|
615
|
+
let t = e.getControl();
|
|
616
|
+
n || (n = { remove: j(t, O) });
|
|
617
|
+
}, M = () => {
|
|
618
|
+
t && (t.remove(), t = null);
|
|
619
|
+
}, N = () => {
|
|
620
|
+
n && (n.remove(), n = null);
|
|
621
|
+
};
|
|
622
|
+
return b(() => e.menu.isOpen, (e) => {
|
|
623
|
+
e ? p(E) : D();
|
|
624
|
+
}), h(() => {
|
|
625
|
+
e.menu.isOpen && p(E);
|
|
626
|
+
}), g(() => {
|
|
627
|
+
D();
|
|
628
|
+
}), () => {
|
|
629
|
+
let e;
|
|
630
|
+
return l("div", {
|
|
631
|
+
ref: "menu-container",
|
|
632
|
+
class: "vue-treeselect__menu-container",
|
|
633
|
+
style: o.value
|
|
634
|
+
}, [l(r, { name: "vue-treeselect__menu--transition" }, Oe(e = s()) ? e : { default: () => [e] })]);
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
}, je = {
|
|
638
|
+
name: "VueTreeSelectPortalTarget",
|
|
639
|
+
setup() {
|
|
640
|
+
let e = u(K), t = y("el"), n = y("menu"), r = null, i = null, a = () => {
|
|
641
|
+
let r = e.getControl().getBoundingClientRect(), i = t.value.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 = n.value.$refs["menu-container"].style, l = I([
|
|
642
|
+
"transform",
|
|
643
|
+
"webkitTransform",
|
|
644
|
+
"MozTransform",
|
|
645
|
+
"msTransform"
|
|
646
|
+
], (e) => e in document.body.style);
|
|
647
|
+
c[l] = `translate(${o}, ${s})`;
|
|
648
|
+
}, o = () => {
|
|
649
|
+
let t = e.getControl();
|
|
650
|
+
r || (r = { remove: j(t, a) });
|
|
651
|
+
}, s = () => {
|
|
652
|
+
let n = e.getControl().getBoundingClientRect();
|
|
653
|
+
t.value.style.width = `${n.width}px`;
|
|
654
|
+
}, c = () => {
|
|
655
|
+
let t = e.getControl();
|
|
656
|
+
i || (i = { remove: le(t, () => {
|
|
657
|
+
s(), a();
|
|
658
|
+
}) });
|
|
659
|
+
}, d = () => {
|
|
660
|
+
r && (r.remove(), r = null);
|
|
661
|
+
}, f = () => {
|
|
662
|
+
i && (i.remove(), i = null);
|
|
663
|
+
}, p = () => {
|
|
664
|
+
d(), f();
|
|
665
|
+
}, g = () => {
|
|
666
|
+
s(), a(), o(), c();
|
|
667
|
+
};
|
|
668
|
+
return b(() => e.menu.isOpen, (e) => {
|
|
669
|
+
e ? g() : p();
|
|
670
|
+
}), b(() => e.menu.placement, () => {
|
|
671
|
+
a();
|
|
672
|
+
}), h(() => {
|
|
673
|
+
e.menu.isOpen && g();
|
|
674
|
+
}), m(() => {
|
|
675
|
+
p();
|
|
676
|
+
}), () => l("div", {
|
|
677
|
+
ref: "el",
|
|
678
|
+
class: ["vue-treeselect__portal-target", e.wrapperClass],
|
|
679
|
+
style: { zIndex: e.zIndex },
|
|
680
|
+
"data-instance-id": e.getInstanceId()
|
|
681
|
+
}, [l(Ae, { ref: "menu" }, null)]);
|
|
682
|
+
}
|
|
683
|
+
}, Me = {
|
|
684
|
+
name: "VueTreeSelectMenuPortal",
|
|
685
|
+
setup(e, { expose: t }) {
|
|
686
|
+
return t({ portalTarget: y("portalTarget") }), () => l(n, { to: "body" }, { default: () => [l(je, { ref: "portalTarget" }, null)] });
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region src/components/tree-select/VueTreeSelect.vue?vue&type=script&lang.jsx
|
|
691
|
+
function Z(e, t) {
|
|
692
|
+
let n = 0;
|
|
693
|
+
do {
|
|
694
|
+
if (e.level < n) return -1;
|
|
695
|
+
if (t.level < n) return 1;
|
|
696
|
+
if (e.index[n] !== t.index[n]) return e.index[n] - t.index[n];
|
|
697
|
+
n++;
|
|
698
|
+
} while (!0);
|
|
699
|
+
}
|
|
700
|
+
function Ne(e, t) {
|
|
701
|
+
return e.level === t.level ? Z(e, t) : e.level - t.level;
|
|
702
|
+
}
|
|
703
|
+
function Q() {
|
|
704
|
+
return {
|
|
705
|
+
isLoaded: !1,
|
|
706
|
+
isLoading: !1,
|
|
707
|
+
loadingError: ""
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
function Pe(e) {
|
|
711
|
+
// istanbul ignore next
|
|
712
|
+
return typeof e == "string" ? e : typeof e == "number" && !M(e) ? `${e}` : "";
|
|
713
|
+
}
|
|
714
|
+
function Fe(e, t, n) {
|
|
715
|
+
return e ? ne(t, n) : L(n, t);
|
|
716
|
+
}
|
|
717
|
+
function $(e) {
|
|
718
|
+
return e.message || String(e);
|
|
719
|
+
}
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/components/tree-select/VueTreeSelect.vue
|
|
722
|
+
var Ie = {
|
|
723
|
+
name: "VueTreeSelect",
|
|
724
|
+
provide() {
|
|
725
|
+
return { [K]: this };
|
|
726
|
+
},
|
|
727
|
+
props: { ...e },
|
|
728
|
+
emits: [
|
|
729
|
+
"update:modelValue",
|
|
730
|
+
"search-change",
|
|
731
|
+
"close",
|
|
732
|
+
"open",
|
|
733
|
+
"deselect",
|
|
734
|
+
"select"
|
|
735
|
+
],
|
|
736
|
+
data() {
|
|
737
|
+
return {
|
|
738
|
+
trigger: {
|
|
739
|
+
isFocused: !1,
|
|
740
|
+
searchQuery: ""
|
|
741
|
+
},
|
|
742
|
+
menu: {
|
|
743
|
+
isOpen: !1,
|
|
744
|
+
current: null,
|
|
745
|
+
lastScrollPosition: 0,
|
|
746
|
+
placement: "bottom"
|
|
747
|
+
},
|
|
748
|
+
forest: {
|
|
749
|
+
normalizedOptions: [],
|
|
750
|
+
nodeMap: N(),
|
|
751
|
+
checkedStateMap: N(),
|
|
752
|
+
selectedNodeIds: this.extractCheckedNodeIdsFromValue(),
|
|
753
|
+
selectedNodeMap: N()
|
|
754
|
+
},
|
|
755
|
+
rootOptionsStates: Q(),
|
|
756
|
+
localSearch: {
|
|
757
|
+
active: !1,
|
|
758
|
+
noResults: !0,
|
|
759
|
+
countMap: N()
|
|
760
|
+
},
|
|
761
|
+
remoteSearch: N()
|
|
762
|
+
};
|
|
763
|
+
},
|
|
764
|
+
computed: {
|
|
765
|
+
selectedNodes() {
|
|
766
|
+
return this.forest.selectedNodeIds.map(this.getNode);
|
|
767
|
+
},
|
|
768
|
+
internalValue() {
|
|
769
|
+
let e;
|
|
770
|
+
// istanbul ignore else
|
|
771
|
+
if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === "ALL") e = this.forest.selectedNodeIds.slice();
|
|
772
|
+
else if (this.valueConsistsOf === "BRANCH_PRIORITY") e = this.forest.selectedNodeIds.filter((e) => {
|
|
773
|
+
let t = this.getNode(e);
|
|
774
|
+
return t.isRootNode ? !0 : !this.isSelected(t.parentNode);
|
|
775
|
+
});
|
|
776
|
+
else if (this.valueConsistsOf === "LEAF_PRIORITY") e = this.forest.selectedNodeIds.filter((e) => {
|
|
777
|
+
let t = this.getNode(e);
|
|
778
|
+
return t.isLeaf ? !0 : t.children.length === 0;
|
|
779
|
+
});
|
|
780
|
+
else if (this.valueConsistsOf === "ALL_WITH_INDETERMINATE") {
|
|
781
|
+
let t = [];
|
|
782
|
+
e = this.forest.selectedNodeIds.slice(), this.selectedNodes.forEach((n) => {
|
|
783
|
+
n.ancestors.forEach((n) => {
|
|
784
|
+
L(t, n.id) || L(e, n.id) || t.push(n.id);
|
|
785
|
+
});
|
|
786
|
+
}), e.push(...t);
|
|
787
|
+
}
|
|
788
|
+
return this.sortValueBy === "LEVEL" ? e.sort((e, t) => Ne(this.getNode(e), this.getNode(t))) : this.sortValueBy === "INDEX" && e.sort((e, t) => Z(this.getNode(e), this.getNode(t))), e;
|
|
789
|
+
},
|
|
790
|
+
hasValue() {
|
|
791
|
+
return this.internalValue.length > 0;
|
|
792
|
+
},
|
|
793
|
+
single() {
|
|
794
|
+
return !this.multiple;
|
|
795
|
+
},
|
|
796
|
+
visibleOptionIds() {
|
|
797
|
+
let e = [];
|
|
798
|
+
return this.traverseAllNodesByIndex((t) => {
|
|
799
|
+
if ((!this.localSearch.active || this.shouldOptionBeIncludedInSearchResult(t)) && e.push(t.id), t.isBranch && !this.shouldExpand(t)) return !1;
|
|
800
|
+
}), e;
|
|
801
|
+
},
|
|
802
|
+
hasVisibleOptions() {
|
|
803
|
+
return this.visibleOptionIds.length !== 0;
|
|
804
|
+
},
|
|
805
|
+
showCountOnSearchComputed() {
|
|
806
|
+
return typeof this.showCountOnSearch == "boolean" ? this.showCountOnSearch : this.showCount;
|
|
807
|
+
},
|
|
808
|
+
hasBranchNodes() {
|
|
809
|
+
return this.forest.normalizedOptions.some((e) => e.isBranch);
|
|
810
|
+
},
|
|
811
|
+
shouldFlattenOptions() {
|
|
812
|
+
return this.localSearch.active && this.flattenSearchResults;
|
|
813
|
+
},
|
|
814
|
+
wrapperClass() {
|
|
815
|
+
return {
|
|
816
|
+
"vue-treeselect": !0,
|
|
817
|
+
"vue-treeselect--single": this.single,
|
|
818
|
+
"vue-treeselect--multi": this.multiple,
|
|
819
|
+
"vue-treeselect--searchable": this.searchable,
|
|
820
|
+
"vue-treeselect--disabled": this.disabled,
|
|
821
|
+
"vue-treeselect--focused": this.trigger.isFocused,
|
|
822
|
+
"vue-treeselect--has-value": this.hasValue,
|
|
823
|
+
"vue-treeselect--open": this.menu.isOpen,
|
|
824
|
+
"vue-treeselect--open-above": this.menu.placement === "top",
|
|
825
|
+
"vue-treeselect--open-below": this.menu.placement === "bottom",
|
|
826
|
+
"vue-treeselect--branch-nodes-disabled": this.disableBranchNodes,
|
|
827
|
+
"vue-treeselect--append-to-body": this.appendToBody
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
watch: {
|
|
832
|
+
alwaysOpen(e) {
|
|
833
|
+
e ? this.openMenu() : this.closeMenu();
|
|
834
|
+
},
|
|
835
|
+
branchNodesFirst() {
|
|
836
|
+
this.initialize();
|
|
837
|
+
},
|
|
838
|
+
disabled(e) {
|
|
839
|
+
e && this.menu.isOpen ? this.closeMenu() : !e && !this.menu.isOpen && this.alwaysOpen && this.openMenu();
|
|
840
|
+
},
|
|
841
|
+
flat() {
|
|
842
|
+
this.initialize();
|
|
843
|
+
},
|
|
844
|
+
internalValue(e, t) {
|
|
845
|
+
R(e, t) && this.$emit("update:modelValue", this.getValue(), this.getInstanceId());
|
|
846
|
+
},
|
|
847
|
+
matchKeys() {
|
|
848
|
+
this.initialize();
|
|
849
|
+
},
|
|
850
|
+
multiple(e) {
|
|
851
|
+
// istanbul ignore else
|
|
852
|
+
e && this.buildForestState();
|
|
853
|
+
},
|
|
854
|
+
options: {
|
|
855
|
+
handler() {
|
|
856
|
+
this.async || (this.initialize(), this.rootOptionsStates.isLoaded = Array.isArray(this.options));
|
|
857
|
+
},
|
|
858
|
+
deep: !0,
|
|
859
|
+
immediate: !0
|
|
860
|
+
},
|
|
861
|
+
"trigger.searchQuery"() {
|
|
862
|
+
this.async ? this.handleRemoteSearch() : this.handleLocalSearch(), this.$emit("search-change", this.trigger.searchQuery, this.getInstanceId());
|
|
863
|
+
},
|
|
864
|
+
value() {
|
|
865
|
+
let e = this.extractCheckedNodeIdsFromValue();
|
|
866
|
+
R(e, this.internalValue) && this.fixSelectedNodeIds(e);
|
|
867
|
+
}
|
|
868
|
+
},
|
|
869
|
+
created() {
|
|
870
|
+
this.verifyProps(), this.resetFlags();
|
|
871
|
+
},
|
|
872
|
+
mounted() {
|
|
873
|
+
this.autoFocus && this.focusInput(), !this.options && !this.async && this.autoLoadRootOptions && this.loadRootOptions(), this.alwaysOpen && this.openMenu(), this.async && this.defaultOptions && this.handleRemoteSearch();
|
|
874
|
+
},
|
|
875
|
+
beforeUnmount() {
|
|
876
|
+
// istanbul ignore next
|
|
877
|
+
this.toggleClickOutsideEvent(!1);
|
|
878
|
+
},
|
|
879
|
+
methods: {
|
|
880
|
+
verifyProps() {
|
|
881
|
+
E(() => this.async ? this.searchable : !0, () => "For async search mode, the value of \"searchable\" prop must be true."), this.options == null && !this.loadOptions && E(() => !1, () => "Are you meant to dynamically load options? You need to use \"loadOptions\" prop."), this.flat && E(() => this.multiple, () => "You are using flat mode. But you forgot to add \"multiple=true\"?"), this.flat || [
|
|
882
|
+
"autoSelectAncestors",
|
|
883
|
+
"autoSelectDescendants",
|
|
884
|
+
"autoDeselectAncestors",
|
|
885
|
+
"autoDeselectDescendants"
|
|
886
|
+
].forEach((e) => {
|
|
887
|
+
E(() => !this[e], () => `"${e}" only applies to flat mode.`);
|
|
888
|
+
});
|
|
889
|
+
},
|
|
890
|
+
resetFlags() {
|
|
891
|
+
this._blurOnSelect = !1;
|
|
892
|
+
},
|
|
893
|
+
initialize() {
|
|
894
|
+
let e = this.async ? this.getRemoteSearchEntry().options : this.options;
|
|
895
|
+
if (Array.isArray(e)) {
|
|
896
|
+
let t = this.forest.nodeMap;
|
|
897
|
+
this.forest.nodeMap = N(), this.keepDataOfSelectedNodes(t), this.forest.normalizedOptions = this.normalize(null, e, t), this.fixSelectedNodeIds(this.internalValue);
|
|
898
|
+
} else this.forest.normalizedOptions = [];
|
|
899
|
+
},
|
|
900
|
+
getInstanceId() {
|
|
901
|
+
return this.instanceId == null ? this.id : this.instanceId;
|
|
902
|
+
},
|
|
903
|
+
getValue() {
|
|
904
|
+
if (this.valueFormat === "id") return this.multiple ? this.internalValue.slice() : this.internalValue[0];
|
|
905
|
+
let e = this.internalValue.map((e) => this.getNode(e).raw);
|
|
906
|
+
return this.multiple ? e : e[0];
|
|
907
|
+
},
|
|
908
|
+
getNode(e) {
|
|
909
|
+
return E(() => e != null, () => `Invalid node id: ${e}`), e == null ? null : e in this.forest.nodeMap ? this.forest.nodeMap[e] : this.createFallbackNode(e);
|
|
910
|
+
},
|
|
911
|
+
createFallbackNode(e) {
|
|
912
|
+
let t = this.extractNodeFromValue(e), n = {
|
|
913
|
+
id: e,
|
|
914
|
+
label: this.enhancedNormalizer(t).label || `${e} (unknown)`,
|
|
915
|
+
ancestors: [],
|
|
916
|
+
parentNode: null,
|
|
917
|
+
isFallbackNode: !0,
|
|
918
|
+
isRootNode: !0,
|
|
919
|
+
isLeaf: !0,
|
|
920
|
+
isBranch: !1,
|
|
921
|
+
isDisabled: !1,
|
|
922
|
+
isNew: !1,
|
|
923
|
+
index: [-1],
|
|
924
|
+
level: 0,
|
|
925
|
+
raw: t
|
|
926
|
+
};
|
|
927
|
+
return this.forest.nodeMap[e] = n;
|
|
928
|
+
},
|
|
929
|
+
extractCheckedNodeIdsFromValue() {
|
|
930
|
+
return this.modelValue == null ? [] : this.valueFormat === "id" ? this.multiple ? this.modelValue.slice() : [this.modelValue] : (this.multiple ? this.modelValue : [this.modelValue]).map((e) => this.enhancedNormalizer(e)).map((e) => e.id);
|
|
931
|
+
},
|
|
932
|
+
extractNodeFromValue(e) {
|
|
933
|
+
let t = { id: e };
|
|
934
|
+
return this.valueFormat === "id" ? t : I(this.multiple ? Array.isArray(this.modelValue) ? this.modelValue : [] : this.modelValue ? [this.modelValue] : [], (t) => t && this.enhancedNormalizer(t).id === e) || t;
|
|
935
|
+
},
|
|
936
|
+
fixSelectedNodeIds(e) {
|
|
937
|
+
let t = [];
|
|
938
|
+
// istanbul ignore else
|
|
939
|
+
if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === "ALL") t = e;
|
|
940
|
+
else if (this.valueConsistsOf === "BRANCH_PRIORITY") e.forEach((e) => {
|
|
941
|
+
t.push(e);
|
|
942
|
+
let n = this.getNode(e);
|
|
943
|
+
n.isBranch && this.traverseDescendantsBFS(n, (e) => {
|
|
944
|
+
t.push(e.id);
|
|
945
|
+
});
|
|
946
|
+
});
|
|
947
|
+
else if (this.valueConsistsOf === "LEAF_PRIORITY") {
|
|
948
|
+
let n = N(), r = e.slice();
|
|
949
|
+
for (; r.length;) {
|
|
950
|
+
let e = r.shift(), i = this.getNode(e);
|
|
951
|
+
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));
|
|
952
|
+
}
|
|
953
|
+
} else if (this.valueConsistsOf === "ALL_WITH_INDETERMINATE") {
|
|
954
|
+
let n = N(), r = e.filter((e) => {
|
|
955
|
+
let t = this.getNode(e);
|
|
956
|
+
return t.isLeaf || t.children.length === 0;
|
|
957
|
+
});
|
|
958
|
+
for (; r.length;) {
|
|
959
|
+
let e = r.shift(), i = this.getNode(e);
|
|
960
|
+
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));
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
R(this.forest.selectedNodeIds, t) && (this.forest.selectedNodeIds = t), this.buildForestState();
|
|
964
|
+
},
|
|
965
|
+
keepDataOfSelectedNodes(e) {
|
|
966
|
+
this.forest.selectedNodeIds.forEach((t) => {
|
|
967
|
+
if (!e[t]) return;
|
|
968
|
+
let n = {
|
|
969
|
+
...e[t],
|
|
970
|
+
isFallbackNode: !0
|
|
971
|
+
};
|
|
972
|
+
this.forest.nodeMap[t] = n;
|
|
973
|
+
});
|
|
974
|
+
},
|
|
975
|
+
isSelected(e) {
|
|
976
|
+
return this.forest.selectedNodeMap[e.id] === !0;
|
|
977
|
+
},
|
|
978
|
+
traverseDescendantsBFS(e, t) {
|
|
979
|
+
// istanbul ignore if
|
|
980
|
+
if (!e.isBranch) return;
|
|
981
|
+
let n = e.children.slice();
|
|
982
|
+
for (; n.length;) {
|
|
983
|
+
let e = n[0];
|
|
984
|
+
e.isBranch && n.push(...e.children), t(e), n.shift();
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
traverseDescendantsDFS(e, t) {
|
|
988
|
+
e.isBranch && e.children.forEach((e) => {
|
|
989
|
+
this.traverseDescendantsDFS(e, t), t(e);
|
|
990
|
+
});
|
|
991
|
+
},
|
|
992
|
+
traverseAllNodesDFS(e) {
|
|
993
|
+
this.forest.normalizedOptions.forEach((t) => {
|
|
994
|
+
this.traverseDescendantsDFS(t, e), e(t);
|
|
995
|
+
});
|
|
996
|
+
},
|
|
997
|
+
traverseAllNodesByIndex(e) {
|
|
998
|
+
let t = (n) => {
|
|
999
|
+
n.children.forEach((n) => {
|
|
1000
|
+
e(n) !== !1 && n.isBranch && t(n);
|
|
1001
|
+
});
|
|
1002
|
+
};
|
|
1003
|
+
t({ children: this.forest.normalizedOptions });
|
|
1004
|
+
},
|
|
1005
|
+
toggleClickOutsideEvent(e) {
|
|
1006
|
+
e ? document.addEventListener("mousedown", this.handleClickOutside, !1) : document.removeEventListener("mousedown", this.handleClickOutside, !1);
|
|
1007
|
+
},
|
|
1008
|
+
getContainer() {
|
|
1009
|
+
return this.$refs.control.container;
|
|
1010
|
+
},
|
|
1011
|
+
getInput() {
|
|
1012
|
+
return this.$refs.control.valueContainer.input;
|
|
1013
|
+
},
|
|
1014
|
+
focusInput() {
|
|
1015
|
+
this.getInput().focus();
|
|
1016
|
+
},
|
|
1017
|
+
blurInput() {
|
|
1018
|
+
this.getInput().blur();
|
|
1019
|
+
},
|
|
1020
|
+
handleMouseDown: D(function(e) {
|
|
1021
|
+
e.preventDefault(), e.stopPropagation(), !this.disabled && (this.getContainer().contains(e.target) && !this.menu.isOpen && (this.openOnClick || this.trigger.isFocused) && this.openMenu(), this._blurOnSelect ? this.blurInput() : this.focusInput(), this.resetFlags());
|
|
1022
|
+
}),
|
|
1023
|
+
handleClickOutside(e) {
|
|
1024
|
+
// istanbul ignore else
|
|
1025
|
+
this.$refs.wrapper && !this.$refs.wrapper.contains(e.target) && (this.blurInput(), this.closeMenu());
|
|
1026
|
+
},
|
|
1027
|
+
handleLocalSearch() {
|
|
1028
|
+
let { searchQuery: e } = this.trigger, t = () => this.resetHighlightedOptionWhenNecessary(!0);
|
|
1029
|
+
if (!e) return this.localSearch.active = !1, t();
|
|
1030
|
+
this.localSearch.active = !0, this.localSearch.noResults = !0, this.traverseAllNodesDFS((e) => {
|
|
1031
|
+
e.isBranch && (e.isExpandedOnSearch = !1, e.showAllChildrenOnSearch = !1, e.isMatched = !1, e.hasMatchedDescendants = !1, this.localSearch.countMap[e.id] = {
|
|
1032
|
+
[V]: 0,
|
|
1033
|
+
[H]: 0,
|
|
1034
|
+
[U]: 0,
|
|
1035
|
+
[W]: 0
|
|
1036
|
+
});
|
|
1037
|
+
});
|
|
1038
|
+
let n = e.trim().toLocaleLowerCase(), r = n.replace(/\s+/g, " ").split(" ");
|
|
1039
|
+
this.traverseAllNodesDFS((e) => {
|
|
1040
|
+
this.searchNested && r.length > 1 ? e.isMatched = r.every((t) => Fe(!1, t, e.nestedSearchLabel)) : e.isMatched = this.matchKeys.some((t) => Fe(!this.disableFuzzyMatching, n, e.lowerCased[t])), e.isMatched && (this.localSearch.noResults = !1, e.ancestors.forEach((e) => this.localSearch.countMap[e.id][H]++), e.isLeaf && e.ancestors.forEach((e) => this.localSearch.countMap[e.id][W]++), e.parentNode !== null && (this.localSearch.countMap[e.parentNode.id][V] += 1, e.isLeaf && (this.localSearch.countMap[e.parentNode.id][U] += 1))), (e.isMatched || e.isBranch && e.isExpandedOnSearch) && e.parentNode !== null && (e.parentNode.isExpandedOnSearch = !0, e.parentNode.hasMatchedDescendants = !0);
|
|
1041
|
+
}), t();
|
|
1042
|
+
},
|
|
1043
|
+
handleRemoteSearch() {
|
|
1044
|
+
let { searchQuery: e } = this.trigger, t = this.getRemoteSearchEntry(), n = () => {
|
|
1045
|
+
this.initialize(), this.resetHighlightedOptionWhenNecessary(!0);
|
|
1046
|
+
};
|
|
1047
|
+
if ((e === "" || this.cacheOptions) && t.isLoaded) return n();
|
|
1048
|
+
this.callLoadOptionsProp({
|
|
1049
|
+
action: fe,
|
|
1050
|
+
args: { searchQuery: e },
|
|
1051
|
+
isPending() {
|
|
1052
|
+
return t.isLoading;
|
|
1053
|
+
},
|
|
1054
|
+
start: () => {
|
|
1055
|
+
t.isLoading = !0, t.isLoaded = !1, t.loadingError = "";
|
|
1056
|
+
},
|
|
1057
|
+
succeed: (r) => {
|
|
1058
|
+
t.isLoaded = !0, t.options = r, this.trigger.searchQuery === e && n();
|
|
1059
|
+
},
|
|
1060
|
+
fail: (e) => {
|
|
1061
|
+
t.loadingError = $(e);
|
|
1062
|
+
},
|
|
1063
|
+
end: () => {
|
|
1064
|
+
t.isLoading = !1;
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
},
|
|
1068
|
+
getRemoteSearchEntry() {
|
|
1069
|
+
let { searchQuery: e } = this.trigger, t = this.remoteSearch[e] || {
|
|
1070
|
+
...Q(),
|
|
1071
|
+
options: []
|
|
1072
|
+
};
|
|
1073
|
+
if (this.$watch(() => t.options, () => {
|
|
1074
|
+
this.trigger.searchQuery === e && this.initialize();
|
|
1075
|
+
}, { deep: !0 }), e === "") {
|
|
1076
|
+
if (Array.isArray(this.defaultOptions)) return t.options = this.defaultOptions, t.isLoaded = !0, t;
|
|
1077
|
+
if (this.defaultOptions !== !0) return t.isLoaded = !0, t;
|
|
1078
|
+
}
|
|
1079
|
+
return this.remoteSearch[e] || (this.remoteSearch[e] = t), t;
|
|
1080
|
+
},
|
|
1081
|
+
shouldExpand(e) {
|
|
1082
|
+
return this.localSearch.active ? e.isExpandedOnSearch : e.isExpanded;
|
|
1083
|
+
},
|
|
1084
|
+
shouldOptionBeIncludedInSearchResult(e) {
|
|
1085
|
+
return !!(e.isMatched || e.isBranch && e.hasMatchedDescendants && !this.flattenSearchResults || !e.isRootNode && e.parentNode.showAllChildrenOnSearch);
|
|
1086
|
+
},
|
|
1087
|
+
shouldShowOptionInMenu(e) {
|
|
1088
|
+
return !(this.localSearch.active && !this.shouldOptionBeIncludedInSearchResult(e));
|
|
1089
|
+
},
|
|
1090
|
+
getControl() {
|
|
1091
|
+
return this.$refs.control.$el;
|
|
1092
|
+
},
|
|
1093
|
+
getMenu() {
|
|
1094
|
+
let e = (this.appendToBody ? this.$refs.portal.portalTarget : this).$refs.menu.$refs.menu;
|
|
1095
|
+
return e && e.nodeName !== "#comment" ? e : null;
|
|
1096
|
+
},
|
|
1097
|
+
setCurrentHighlightedOption(e, t = !0) {
|
|
1098
|
+
let n = this.menu.current;
|
|
1099
|
+
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) {
|
|
1100
|
+
let t = () => {
|
|
1101
|
+
let t = this.getMenu(), n = t.querySelector(`.vue-treeselect__option[data-id="${e.id}"]`);
|
|
1102
|
+
n && O(t, n);
|
|
1103
|
+
};
|
|
1104
|
+
this.getMenu() ? t() :
|
|
1105
|
+
// istanbul ignore next
|
|
1106
|
+
this.$nextTick(t);
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
resetHighlightedOptionWhenNecessary(e = !1) {
|
|
1110
|
+
let { current: t } = this.menu;
|
|
1111
|
+
(e || t == null || !(t in this.forest.nodeMap) || !this.shouldShowOptionInMenu(this.getNode(t))) && this.highlightFirstOption();
|
|
1112
|
+
},
|
|
1113
|
+
highlightFirstOption() {
|
|
1114
|
+
if (!this.hasVisibleOptions) return;
|
|
1115
|
+
let e = this.visibleOptionIds[0];
|
|
1116
|
+
this.setCurrentHighlightedOption(this.getNode(e));
|
|
1117
|
+
},
|
|
1118
|
+
highlightPrevOption() {
|
|
1119
|
+
if (!this.hasVisibleOptions) return;
|
|
1120
|
+
let e = this.visibleOptionIds.indexOf(this.menu.current) - 1;
|
|
1121
|
+
if (e === -1) return this.highlightLastOption();
|
|
1122
|
+
this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
|
|
1123
|
+
},
|
|
1124
|
+
highlightNextOption() {
|
|
1125
|
+
if (!this.hasVisibleOptions) return;
|
|
1126
|
+
let e = this.visibleOptionIds.indexOf(this.menu.current) + 1;
|
|
1127
|
+
if (e === this.visibleOptionIds.length) return this.highlightFirstOption();
|
|
1128
|
+
this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
|
|
1129
|
+
},
|
|
1130
|
+
highlightLastOption() {
|
|
1131
|
+
if (!this.hasVisibleOptions) return;
|
|
1132
|
+
let e = C(this.visibleOptionIds);
|
|
1133
|
+
this.setCurrentHighlightedOption(this.getNode(e));
|
|
1134
|
+
},
|
|
1135
|
+
resetSearchQuery() {
|
|
1136
|
+
this.trigger.searchQuery = "";
|
|
1137
|
+
},
|
|
1138
|
+
closeMenu() {
|
|
1139
|
+
!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()));
|
|
1140
|
+
},
|
|
1141
|
+
openMenu() {
|
|
1142
|
+
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()));
|
|
1143
|
+
},
|
|
1144
|
+
toggleMenu() {
|
|
1145
|
+
this.menu.isOpen ? this.closeMenu() : this.openMenu();
|
|
1146
|
+
},
|
|
1147
|
+
toggleExpanded(e) {
|
|
1148
|
+
let t;
|
|
1149
|
+
this.localSearch.active ? (t = e.isExpandedOnSearch = !e.isExpandedOnSearch, t && (e.showAllChildrenOnSearch = !0)) : t = e.isExpanded = !e.isExpanded, t && !e.childrenStates.isLoaded && this.loadChildrenOptions(e);
|
|
1150
|
+
},
|
|
1151
|
+
buildForestState() {
|
|
1152
|
+
let e = N();
|
|
1153
|
+
this.forest.selectedNodeIds.forEach((t) => {
|
|
1154
|
+
e[t] = !0;
|
|
1155
|
+
}), this.forest.selectedNodeMap = e;
|
|
1156
|
+
let t = N();
|
|
1157
|
+
this.multiple && (this.traverseAllNodesByIndex((e) => {
|
|
1158
|
+
t[e.id] = 0;
|
|
1159
|
+
}), this.selectedNodes.forEach((e) => {
|
|
1160
|
+
t[e.id] = 2, !this.flat && !this.disableBranchNodes && e.ancestors.forEach((e) => {
|
|
1161
|
+
this.isSelected(e) || (t[e.id] = 1);
|
|
1162
|
+
});
|
|
1163
|
+
})), this.forest.checkedStateMap = t;
|
|
1164
|
+
},
|
|
1165
|
+
enhancedNormalizer(e) {
|
|
1166
|
+
return {
|
|
1167
|
+
...e,
|
|
1168
|
+
...this.normalizer(e, this.getInstanceId())
|
|
1169
|
+
};
|
|
1170
|
+
},
|
|
1171
|
+
normalize(e, t, n) {
|
|
1172
|
+
let r = t.map((e) => [this.enhancedNormalizer(e), e]).map(([t, r], i) => {
|
|
1173
|
+
this.checkDuplication(t), this.verifyNodeShape(t);
|
|
1174
|
+
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) => ({
|
|
1175
|
+
...e,
|
|
1176
|
+
[n]: Pe(t[n]).toLocaleLowerCase()
|
|
1177
|
+
}), {}), g = l ? h.label : `${e.nestedSearchLabel} ${h.label}`;
|
|
1178
|
+
this.forest.nodeMap[a] = N();
|
|
1179
|
+
let _ = this.forest.nodeMap[a];
|
|
1180
|
+
if (_.id = a, _.label = o, _.level = u, _.ancestors = l ? [] : [e].concat(e.ancestors), _.index = (l ? [] : e.index).concat(i), _.parentNode = e, _.lowerCased = h, _.nestedSearchLabel = g, _.isDisabled = p, _.isNew = m, _.isMatched = !1, _.isHighlighted = !1, _.isBranch = d, _.isLeaf = f, _.isRootNode = l, _.raw = r, d) {
|
|
1181
|
+
let e = Array.isArray(s);
|
|
1182
|
+
_.childrenStates = {
|
|
1183
|
+
...Q(),
|
|
1184
|
+
isLoaded: e
|
|
1185
|
+
}, _.isExpanded = typeof c == "boolean" ? c : u < this.defaultExpandLevel, _.hasMatchedDescendants = !1, _.hasDisabledDescendants = !1, _.isExpandedOnSearch = !1, _.showAllChildrenOnSearch = !1, _.count = {
|
|
1186
|
+
[V]: 0,
|
|
1187
|
+
[H]: 0,
|
|
1188
|
+
[U]: 0,
|
|
1189
|
+
[W]: 0
|
|
1190
|
+
}, _.children = e ? this.normalize(_, s, n) : [], c === !0 && _.ancestors.forEach((e) => {
|
|
1191
|
+
e.isExpanded = !0;
|
|
1192
|
+
}), !e && typeof this.loadOptions != "function" ? E(() => !1, () => "Unloaded branch node detected. \"loadOptions\" prop is required to load its children.") : !e && _.isExpanded && this.loadChildrenOptions(_);
|
|
1193
|
+
}
|
|
1194
|
+
if (_.ancestors.forEach((e) => e.count[H]++), f && _.ancestors.forEach((e) => e.count[W]++), l || (e.count[V] += 1, f && (e.count[U] += 1), p && (e.hasDisabledDescendants = !0)), n && n[a]) {
|
|
1195
|
+
let e = n[a];
|
|
1196
|
+
_.isMatched = e.isMatched, _.showAllChildrenOnSearch = e.showAllChildrenOnSearch, _.isHighlighted = e.isHighlighted, e.isBranch && _.isBranch && (_.isExpanded = e.isExpanded, _.isExpandedOnSearch = e.isExpandedOnSearch, e.childrenStates.isLoaded && !_.childrenStates.isLoaded ? _.isExpanded = !1 : _.childrenStates = { ...e.childrenStates });
|
|
1197
|
+
}
|
|
1198
|
+
return _;
|
|
1199
|
+
});
|
|
1200
|
+
if (this.branchNodesFirst) {
|
|
1201
|
+
let e = r.filter((e) => e.isBranch), t = r.filter((e) => e.isLeaf);
|
|
1202
|
+
r = e.concat(t);
|
|
1203
|
+
}
|
|
1204
|
+
return r;
|
|
1205
|
+
},
|
|
1206
|
+
loadRootOptions() {
|
|
1207
|
+
this.callLoadOptionsProp({
|
|
1208
|
+
action: ue,
|
|
1209
|
+
isPending: () => this.rootOptionsStates.isLoading,
|
|
1210
|
+
start: () => {
|
|
1211
|
+
this.rootOptionsStates.isLoading = !0, this.rootOptionsStates.loadingError = "";
|
|
1212
|
+
},
|
|
1213
|
+
succeed: () => {
|
|
1214
|
+
this.rootOptionsStates.isLoaded = !0, this.$nextTick(() => {
|
|
1215
|
+
this.resetHighlightedOptionWhenNecessary(!0);
|
|
1216
|
+
});
|
|
1217
|
+
},
|
|
1218
|
+
fail: (e) => {
|
|
1219
|
+
this.rootOptionsStates.loadingError = $(e);
|
|
1220
|
+
},
|
|
1221
|
+
end: () => {
|
|
1222
|
+
this.rootOptionsStates.isLoading = !1;
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
},
|
|
1226
|
+
loadChildrenOptions(e) {
|
|
1227
|
+
let { id: t, raw: n } = e;
|
|
1228
|
+
this.callLoadOptionsProp({
|
|
1229
|
+
action: de,
|
|
1230
|
+
args: { parentNode: n },
|
|
1231
|
+
isPending: () => this.getNode(t).childrenStates.isLoading,
|
|
1232
|
+
start: () => {
|
|
1233
|
+
this.getNode(t).childrenStates.isLoading = !0, this.getNode(t).childrenStates.loadingError = "";
|
|
1234
|
+
},
|
|
1235
|
+
succeed: () => {
|
|
1236
|
+
this.getNode(t).childrenStates.isLoaded = !0;
|
|
1237
|
+
},
|
|
1238
|
+
fail: (e) => {
|
|
1239
|
+
this.getNode(t).childrenStates.loadingError = $(e);
|
|
1240
|
+
},
|
|
1241
|
+
end: () => {
|
|
1242
|
+
this.getNode(t).childrenStates.isLoading = !1;
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
},
|
|
1246
|
+
callLoadOptionsProp({ action: e, args: t, isPending: n, start: r, succeed: i, fail: a, end: o }) {
|
|
1247
|
+
if (!this.loadOptions || n()) return;
|
|
1248
|
+
r();
|
|
1249
|
+
let s = T((e, t) => {
|
|
1250
|
+
e ? a(e) : i(t), o();
|
|
1251
|
+
}), c = this.loadOptions({
|
|
1252
|
+
id: this.getInstanceId(),
|
|
1253
|
+
instanceId: this.getInstanceId(),
|
|
1254
|
+
action: e,
|
|
1255
|
+
...t,
|
|
1256
|
+
callback: s
|
|
1257
|
+
});
|
|
1258
|
+
x(c) && c.then(() => {
|
|
1259
|
+
s();
|
|
1260
|
+
}, (e) => {
|
|
1261
|
+
s(e);
|
|
1262
|
+
}).catch((e) => {
|
|
1263
|
+
// istanbul ignore next
|
|
1264
|
+
console.error(e);
|
|
1265
|
+
});
|
|
1266
|
+
},
|
|
1267
|
+
checkDuplication(e) {
|
|
1268
|
+
E(() => !(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.`);
|
|
1269
|
+
},
|
|
1270
|
+
verifyNodeShape(e) {
|
|
1271
|
+
E(() => !(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.");
|
|
1272
|
+
},
|
|
1273
|
+
select(e) {
|
|
1274
|
+
if (this.disabled || e.isDisabled) return;
|
|
1275
|
+
this.single && this.clear();
|
|
1276
|
+
let t = this.multiple && !this.flat ? this.forest.checkedStateMap[e.id] === 0 : !this.isSelected(e);
|
|
1277
|
+
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));
|
|
1278
|
+
},
|
|
1279
|
+
clear() {
|
|
1280
|
+
this.hasValue && (this.single || this.allowClearingDisabled ? this.forest.selectedNodeIds = [] : this.forest.selectedNodeIds = this.forest.selectedNodeIds.filter((e) => this.getNode(e).isDisabled), this.buildForestState());
|
|
1281
|
+
},
|
|
1282
|
+
_selectNode(e) {
|
|
1283
|
+
if (this.single || this.disableBranchNodes) return this.addValue(e);
|
|
1284
|
+
if (this.flat) {
|
|
1285
|
+
this.addValue(e), this.autoSelectAncestors ? e.ancestors.forEach((e) => {
|
|
1286
|
+
!this.isSelected(e) && !e.isDisabled && this.addValue(e);
|
|
1287
|
+
}) : this.autoSelectDescendants && this.traverseDescendantsBFS(e, (e) => {
|
|
1288
|
+
!this.isSelected(e) && !e.isDisabled && this.addValue(e);
|
|
1289
|
+
});
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
let t = e.isLeaf || !e.hasDisabledDescendants || this.allowSelectingDisabledDescendants;
|
|
1293
|
+
if (t && this.addValue(e), e.isBranch && this.traverseDescendantsBFS(e, (e) => {
|
|
1294
|
+
(!e.isDisabled || this.allowSelectingDisabledDescendants) && this.addValue(e);
|
|
1295
|
+
}), t) {
|
|
1296
|
+
let t = e;
|
|
1297
|
+
for (; (t = t.parentNode) !== null && t.children.every(this.isSelected);) this.addValue(t);
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
_deselectNode(e) {
|
|
1301
|
+
if (this.disableBranchNodes) return this.removeValue(e);
|
|
1302
|
+
if (this.flat) {
|
|
1303
|
+
this.removeValue(e), this.autoDeselectAncestors ? e.ancestors.forEach((e) => {
|
|
1304
|
+
this.isSelected(e) && !e.isDisabled && this.removeValue(e);
|
|
1305
|
+
}) : this.autoDeselectDescendants && this.traverseDescendantsBFS(e, (e) => {
|
|
1306
|
+
this.isSelected(e) && !e.isDisabled && this.removeValue(e);
|
|
1307
|
+
});
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
let t = !1;
|
|
1311
|
+
if (e.isBranch && this.traverseDescendantsDFS(e, (e) => {
|
|
1312
|
+
(!e.isDisabled || this.allowSelectingDisabledDescendants) && (this.removeValue(e), t = !0);
|
|
1313
|
+
}), e.isLeaf || t || e.children.length === 0) {
|
|
1314
|
+
this.removeValue(e);
|
|
1315
|
+
let t = e;
|
|
1316
|
+
for (; (t = t.parentNode) !== null && this.isSelected(t);) this.removeValue(t);
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
addValue(e) {
|
|
1320
|
+
this.forest.selectedNodeIds.push(e.id), this.forest.selectedNodeMap[e.id] = !0;
|
|
1321
|
+
},
|
|
1322
|
+
removeValue(e) {
|
|
1323
|
+
te(this.forest.selectedNodeIds, e.id), delete this.forest.selectedNodeMap[e.id];
|
|
1324
|
+
},
|
|
1325
|
+
removeLastValue() {
|
|
1326
|
+
if (!this.hasValue) return;
|
|
1327
|
+
if (this.single) return this.clear();
|
|
1328
|
+
let e = C(this.internalValue), t = this.getNode(e);
|
|
1329
|
+
this.select(t);
|
|
1330
|
+
},
|
|
1331
|
+
saveMenuScrollPosition() {
|
|
1332
|
+
let e = this.getMenu();
|
|
1333
|
+
// istanbul ignore else
|
|
1334
|
+
e && (this.menu.lastScrollPosition = e.scrollTop);
|
|
1335
|
+
},
|
|
1336
|
+
restoreMenuScrollPosition() {
|
|
1337
|
+
let e = this.getMenu();
|
|
1338
|
+
// istanbul ignore else
|
|
1339
|
+
e && (e.scrollTop = this.menu.lastScrollPosition);
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
render() {
|
|
1343
|
+
return l("div", {
|
|
1344
|
+
ref: "wrapper",
|
|
1345
|
+
class: this.wrapperClass
|
|
1346
|
+
}, [
|
|
1347
|
+
l(me, null, null),
|
|
1348
|
+
l(Te, { ref: "control" }, null),
|
|
1349
|
+
this.appendToBody ? l(Me, { ref: "portal" }, null) : l(Ae, { ref: "menu" }, null)
|
|
1350
|
+
]);
|
|
1351
|
+
}
|
|
1352
|
+
};
|
|
1353
|
+
//#endregion
|
|
1354
|
+
export { Ie as t };
|