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