@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
|
@@ -1,2627 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { isPromise as se } from "@web-utils/core";
|
|
4
|
-
import { n as m } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
|
|
5
|
-
import { _ as R } from "../chunks/helper.BiMLcEEk.mjs";
|
|
6
|
-
const _ = process.env.NODE_ENV === "production" ? (
|
|
7
|
-
/* istanbul ignore next */
|
|
8
|
-
be
|
|
9
|
-
) : function(t, s) {
|
|
10
|
-
if (!t()) {
|
|
11
|
-
const n = ["[Vue-TreeSelect Warning]"].concat(s());
|
|
12
|
-
console.error(...n);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
function N(e) {
|
|
16
|
-
return function(s, ...n) {
|
|
17
|
-
s.type === "mousedown" && s.button === 0 && e.call(this, s, ...n);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function Ce(e, t) {
|
|
21
|
-
const s = e.getBoundingClientRect(), n = t.getBoundingClientRect(), i = t.offsetHeight / 3;
|
|
22
|
-
n.bottom + i > s.bottom ? e.scrollTop = Math.min(t.offsetTop + t.clientHeight - e.offsetHeight + i, e.scrollHeight) : n.top - i < s.top && (e.scrollTop = Math.max(t.offsetTop - i, 0));
|
|
23
|
-
}
|
|
24
|
-
function ne(e, t) {
|
|
25
|
-
const s = e.indexOf(t);
|
|
26
|
-
s !== -1 && e.splice(s, 1);
|
|
27
|
-
}
|
|
28
|
-
let Q;
|
|
29
|
-
const D = [], Le = 100;
|
|
30
|
-
function Te() {
|
|
31
|
-
Q = setInterval(() => {
|
|
32
|
-
D.forEach(ie);
|
|
33
|
-
}, Le);
|
|
34
|
-
}
|
|
35
|
-
function Me() {
|
|
36
|
-
clearInterval(Q), Q = null;
|
|
37
|
-
}
|
|
38
|
-
function ie(e) {
|
|
39
|
-
const { $el: t, listener: s, lastWidth: n, lastHeight: i } = e, o = t.offsetWidth, l = t.offsetHeight;
|
|
40
|
-
(n !== o || i !== l) && (e.lastWidth = o, e.lastHeight = l, s({ width: o, height: l }));
|
|
41
|
-
}
|
|
42
|
-
function De(e, t) {
|
|
43
|
-
const s = {
|
|
44
|
-
$el: e,
|
|
45
|
-
listener: t,
|
|
46
|
-
lastWidth: null,
|
|
47
|
-
lastHeight: null
|
|
48
|
-
}, n = () => {
|
|
49
|
-
ne(D, s), D.length || Me();
|
|
50
|
-
};
|
|
51
|
-
return D.push(s), ie(s), Te(), n;
|
|
52
|
-
}
|
|
53
|
-
function Re(e, t) {
|
|
54
|
-
const s = document.createElement("_"), n = s.appendChild(document.createElement("_")), i = s.appendChild(document.createElement("_")), o = n.appendChild(document.createElement("_"));
|
|
55
|
-
let l, u;
|
|
56
|
-
return n.style.cssText = s.style.cssText = "height:100%;left:0;opacity:0;overflow:hidden;pointer-events:none;position:absolute;top:0;transition:0s;width:100%;z-index:-1", o.style.cssText = i.style.cssText = "display:block;height:100%;transition:0s;width:100%", o.style.width = o.style.height = "200%", e.appendChild(s), f(), g;
|
|
57
|
-
function f() {
|
|
58
|
-
h();
|
|
59
|
-
const p = e.offsetWidth, y = e.offsetHeight;
|
|
60
|
-
(p !== l || y !== u) && (l = p, u = y, i.style.width = `${p * 2}px`, i.style.height = `${y * 2}px`, s.scrollLeft = s.scrollWidth, s.scrollTop = s.scrollHeight, n.scrollLeft = n.scrollWidth, n.scrollTop = n.scrollHeight, t({ width: p, height: y })), n.addEventListener("scroll", f), s.addEventListener("scroll", f);
|
|
61
|
-
}
|
|
62
|
-
function h() {
|
|
63
|
-
n.removeEventListener("scroll", f), s.removeEventListener("scroll", f);
|
|
64
|
-
}
|
|
65
|
-
function g() {
|
|
66
|
-
h(), e.removeChild(s);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function re(e, t) {
|
|
70
|
-
const s = document.documentMode === 9;
|
|
71
|
-
let n = !0;
|
|
72
|
-
const l = (s ? De : Re)(e, (...u) => n || t(...u));
|
|
73
|
-
return n = !1, l;
|
|
74
|
-
}
|
|
75
|
-
function xe(e) {
|
|
76
|
-
const t = [];
|
|
77
|
-
let s = e.parentNode;
|
|
78
|
-
for (; s && s.nodeName !== "BODY" && s.nodeType === document.ELEMENT_NODE; )
|
|
79
|
-
$e(s) && t.push(s), s = s.parentNode;
|
|
80
|
-
return t.push(window), t;
|
|
81
|
-
}
|
|
82
|
-
function $e(e) {
|
|
83
|
-
const { overflow: t, overflowX: s, overflowY: n } = getComputedStyle(e);
|
|
84
|
-
return /(auto|scroll|overlay)/.test(t + n + s);
|
|
85
|
-
}
|
|
86
|
-
function oe(e, t) {
|
|
87
|
-
const s = xe(e);
|
|
88
|
-
return window.addEventListener("resize", t, { passive: !0 }), s.forEach((n) => {
|
|
89
|
-
n.addEventListener("scroll", t, { passive: !0 });
|
|
90
|
-
}), function() {
|
|
91
|
-
window.removeEventListener("resize", t, { passive: !0 }), s.forEach((i) => {
|
|
92
|
-
i.removeEventListener("scroll", t, { passive: !0 });
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function le(e) {
|
|
97
|
-
return Number.isNaN(e);
|
|
98
|
-
}
|
|
99
|
-
const S = () => /* @__PURE__ */ Object.create(null);
|
|
100
|
-
function ae(e) {
|
|
101
|
-
return e == null || typeof e != "object" ? !1 : Object.getPrototypeOf(e) === Object.prototype;
|
|
102
|
-
}
|
|
103
|
-
function Ie(e, t, s) {
|
|
104
|
-
ae(s) ? (e[t] || (e[t] = {}), K(e[t], s)) : e[t] = s;
|
|
105
|
-
}
|
|
106
|
-
function K(e, t) {
|
|
107
|
-
if (ae(t)) {
|
|
108
|
-
const s = Object.keys(t);
|
|
109
|
-
for (let n = 0, i = s.length; n < i; n++)
|
|
110
|
-
Ie(e, s[n], t[s[n]]);
|
|
111
|
-
}
|
|
112
|
-
return e;
|
|
113
|
-
}
|
|
114
|
-
function O(e, t) {
|
|
115
|
-
return e.indexOf(t) !== -1;
|
|
116
|
-
}
|
|
117
|
-
function ce(e, t, s) {
|
|
118
|
-
for (let n = 0, i = e.length; n < i; n++)
|
|
119
|
-
if (t.call(s, e[n], n, e)) return e[n];
|
|
120
|
-
}
|
|
121
|
-
function A(e, t) {
|
|
122
|
-
if (e.length !== t.length) return !0;
|
|
123
|
-
for (let s = 0; s < e.length; s++)
|
|
124
|
-
if (e[s] !== t[s]) return !0;
|
|
125
|
-
return !1;
|
|
126
|
-
}
|
|
127
|
-
function Ae(e, t) {
|
|
128
|
-
const s = t.length, n = e.length;
|
|
129
|
-
if (n > s)
|
|
130
|
-
return !1;
|
|
131
|
-
if (n === s)
|
|
132
|
-
return e === t;
|
|
133
|
-
e: for (let i = 0, o = 0; i < n; i++) {
|
|
134
|
-
const l = e.charCodeAt(i);
|
|
135
|
-
for (; o < s; )
|
|
136
|
-
if (t.charCodeAt(o++) === l)
|
|
137
|
-
continue e;
|
|
138
|
-
return !1;
|
|
139
|
-
}
|
|
140
|
-
return !0;
|
|
141
|
-
}
|
|
142
|
-
const b = null, q = 0, ue = 1, he = 2, E = "ALL_CHILDREN", w = "ALL_DESCENDANTS", C = "LEAF_CHILDREN", L = "LEAF_DESCENDANTS", Ve = "LOAD_ROOT_OPTIONS", Be = "LOAD_CHILDREN_OPTIONS", ze = "ASYNC_SEARCH", V = "ALL", M = "BRANCH_PRIORITY", B = "LEAF_PRIORITY", z = "ALL_WITH_INDETERMINATE", X = "ORDER_SELECTED", G = "LEVEL", J = "INDEX", d = {
|
|
143
|
-
BACKSPACE: 8,
|
|
144
|
-
ENTER: 13,
|
|
145
|
-
ESCAPE: 27,
|
|
146
|
-
END: 35,
|
|
147
|
-
HOME: 36,
|
|
148
|
-
ARROW_LEFT: 37,
|
|
149
|
-
ARROW_UP: 38,
|
|
150
|
-
ARROW_RIGHT: 39,
|
|
151
|
-
ARROW_DOWN: 40,
|
|
152
|
-
DELETE: 46
|
|
153
|
-
}, Fe = process.env.NODE_ENV === "testing" ? (
|
|
154
|
-
/* to speed up unit testing */
|
|
155
|
-
10
|
|
156
|
-
) : (
|
|
157
|
-
/* istanbul ignore next */
|
|
158
|
-
200
|
|
159
|
-
), Z = 5, ee = 40;
|
|
160
|
-
function de(e, t) {
|
|
161
|
-
let s = 0;
|
|
162
|
-
do {
|
|
163
|
-
if (e.level < s) return -1;
|
|
164
|
-
if (t.level < s) return 1;
|
|
165
|
-
if (e.index[s] !== t.index[s]) return e.index[s] - t.index[s];
|
|
166
|
-
s++;
|
|
167
|
-
} while (!0);
|
|
168
|
-
}
|
|
169
|
-
function ke(e, t) {
|
|
170
|
-
return e.level === t.level ? de(e, t) : e.level - t.level;
|
|
171
|
-
}
|
|
172
|
-
function F() {
|
|
173
|
-
return {
|
|
174
|
-
isLoaded: !1,
|
|
175
|
-
isLoading: !1,
|
|
176
|
-
loadingError: ""
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function He(e) {
|
|
180
|
-
return typeof e == "string" ? e : typeof e == "number" && !le(e) ? `${e}` : "";
|
|
181
|
-
}
|
|
182
|
-
function te(e, t, s) {
|
|
183
|
-
return e ? Ae(t, s) : O(s, t);
|
|
184
|
-
}
|
|
185
|
-
function k(e) {
|
|
186
|
-
return e.message || /* istanbul ignore next */
|
|
187
|
-
String(e);
|
|
188
|
-
}
|
|
189
|
-
let Pe = 0;
|
|
190
|
-
const We = {
|
|
191
|
-
provide() {
|
|
192
|
-
return {
|
|
193
|
-
// Enable access to the instance of root component of vue-treeselect
|
|
194
|
-
// across hierarchy.
|
|
195
|
-
instance: this
|
|
196
|
-
};
|
|
197
|
-
},
|
|
198
|
-
props: {
|
|
199
|
-
/**
|
|
200
|
-
* Whether to allow resetting value even if there are disabled selected nodes.
|
|
201
|
-
*/
|
|
202
|
-
allowClearingDisabled: {
|
|
203
|
-
type: Boolean,
|
|
204
|
-
default: !1
|
|
205
|
-
},
|
|
206
|
-
/**
|
|
207
|
-
* When an ancestor node is selected/deselected, whether its disabled descendants should be selected/deselected.
|
|
208
|
-
* You may want to use this in conjunction with `allowClearingDisabled` prop.
|
|
209
|
-
*/
|
|
210
|
-
allowSelectingDisabledDescendants: {
|
|
211
|
-
type: Boolean,
|
|
212
|
-
default: !1
|
|
213
|
-
},
|
|
214
|
-
/**
|
|
215
|
-
* Whether the menu should be always open.
|
|
216
|
-
*/
|
|
217
|
-
alwaysOpen: {
|
|
218
|
-
type: Boolean,
|
|
219
|
-
default: !1
|
|
220
|
-
},
|
|
221
|
-
/**
|
|
222
|
-
* Append the menu to <body />?
|
|
223
|
-
*/
|
|
224
|
-
appendToBody: {
|
|
225
|
-
type: Boolean,
|
|
226
|
-
default: !1
|
|
227
|
-
},
|
|
228
|
-
/**
|
|
229
|
-
* Whether to enable async search mode.
|
|
230
|
-
*/
|
|
231
|
-
async: {
|
|
232
|
-
type: Boolean,
|
|
233
|
-
default: !1
|
|
234
|
-
},
|
|
235
|
-
/**
|
|
236
|
-
* Automatically focus the component on mount?
|
|
237
|
-
*/
|
|
238
|
-
autoFocus: {
|
|
239
|
-
type: Boolean,
|
|
240
|
-
default: !1
|
|
241
|
-
},
|
|
242
|
-
/**
|
|
243
|
-
* Automatically load root options on mount. When set to `false`, root options will be loaded when the menu is opened.
|
|
244
|
-
*/
|
|
245
|
-
autoLoadRootOptions: {
|
|
246
|
-
type: Boolean,
|
|
247
|
-
default: !0
|
|
248
|
-
},
|
|
249
|
-
/**
|
|
250
|
-
* When user deselects a node, automatically deselect its ancestors. Applies to flat mode only.
|
|
251
|
-
*/
|
|
252
|
-
autoDeselectAncestors: {
|
|
253
|
-
type: Boolean,
|
|
254
|
-
default: !1
|
|
255
|
-
},
|
|
256
|
-
/**
|
|
257
|
-
* When user deselects a node, automatically deselect its descendants. Applies to flat mode only.
|
|
258
|
-
*/
|
|
259
|
-
autoDeselectDescendants: {
|
|
260
|
-
type: Boolean,
|
|
261
|
-
default: !1
|
|
262
|
-
},
|
|
263
|
-
/**
|
|
264
|
-
* When user selects a node, automatically select its ancestors. Applies to flat mode only.
|
|
265
|
-
*/
|
|
266
|
-
autoSelectAncestors: {
|
|
267
|
-
type: Boolean,
|
|
268
|
-
default: !1
|
|
269
|
-
},
|
|
270
|
-
/**
|
|
271
|
-
* When user selects a node, automatically select its descendants. Applies to flat mode only.
|
|
272
|
-
*/
|
|
273
|
-
autoSelectDescendants: {
|
|
274
|
-
type: Boolean,
|
|
275
|
-
default: !1
|
|
276
|
-
},
|
|
277
|
-
/**
|
|
278
|
-
* Whether pressing backspace key removes the last item if there is no text input.
|
|
279
|
-
*/
|
|
280
|
-
backspaceRemoves: {
|
|
281
|
-
type: Boolean,
|
|
282
|
-
default: !0
|
|
283
|
-
},
|
|
284
|
-
/**
|
|
285
|
-
* Function that processes before clearing all input fields.
|
|
286
|
-
* Return `false` to prevent value from being cleared.
|
|
287
|
-
* @type {function(): (boolean|Promise<boolean>)}
|
|
288
|
-
*/
|
|
289
|
-
beforeClearAll: {
|
|
290
|
-
type: Function,
|
|
291
|
-
default: () => !0
|
|
292
|
-
},
|
|
293
|
-
/**
|
|
294
|
-
* Show branch nodes before leaf nodes?
|
|
295
|
-
*/
|
|
296
|
-
branchNodesFirst: {
|
|
297
|
-
type: Boolean,
|
|
298
|
-
default: !1
|
|
299
|
-
},
|
|
300
|
-
/**
|
|
301
|
-
* Should cache results of every search request?
|
|
302
|
-
*/
|
|
303
|
-
cacheOptions: {
|
|
304
|
-
type: Boolean,
|
|
305
|
-
default: !0
|
|
306
|
-
},
|
|
307
|
-
/**
|
|
308
|
-
* Show an "×" button that resets value?
|
|
309
|
-
*/
|
|
310
|
-
clearable: {
|
|
311
|
-
type: Boolean,
|
|
312
|
-
default: !0
|
|
313
|
-
},
|
|
314
|
-
/**
|
|
315
|
-
* Title for the "×" button when `multiple: true`.
|
|
316
|
-
*/
|
|
317
|
-
clearAllText: {
|
|
318
|
-
type: String,
|
|
319
|
-
default: "Clear all"
|
|
320
|
-
},
|
|
321
|
-
/**
|
|
322
|
-
* Whether to clear the search input after selecting.
|
|
323
|
-
* Use only when `multiple` is `true`.
|
|
324
|
-
* For single-select mode, it **always** clears the input after selecting an option regardless of the prop value.
|
|
325
|
-
*/
|
|
326
|
-
clearOnSelect: {
|
|
327
|
-
type: Boolean,
|
|
328
|
-
default: !1
|
|
329
|
-
},
|
|
330
|
-
/**
|
|
331
|
-
* Title for the "×" button.
|
|
332
|
-
*/
|
|
333
|
-
clearValueText: {
|
|
334
|
-
type: String,
|
|
335
|
-
default: "Clear value"
|
|
336
|
-
},
|
|
337
|
-
/**
|
|
338
|
-
* Whether to close the menu after selecting an option?
|
|
339
|
-
* Use only when `multiple` is `true`.
|
|
340
|
-
*/
|
|
341
|
-
closeOnSelect: {
|
|
342
|
-
type: Boolean,
|
|
343
|
-
default: !0
|
|
344
|
-
},
|
|
345
|
-
/**
|
|
346
|
-
* How many levels of branch nodes should be automatically expanded when loaded.
|
|
347
|
-
* Set `Infinity` to make all branch nodes expanded by default.
|
|
348
|
-
*/
|
|
349
|
-
defaultExpandLevel: {
|
|
350
|
-
type: Number,
|
|
351
|
-
default: 0
|
|
352
|
-
},
|
|
353
|
-
/**
|
|
354
|
-
* The default set of options to show before the user starts searching. Used for async search mode.
|
|
355
|
-
* When set to `true`, the results for search query as a empty string will be autoloaded.
|
|
356
|
-
* @type {boolean|node[]}
|
|
357
|
-
*/
|
|
358
|
-
defaultOptions: {
|
|
359
|
-
default: !1
|
|
360
|
-
},
|
|
361
|
-
/**
|
|
362
|
-
* Whether pressing delete key removes the last item if there is no text input.
|
|
363
|
-
*/
|
|
364
|
-
deleteRemoves: {
|
|
365
|
-
type: Boolean,
|
|
366
|
-
default: !0
|
|
367
|
-
},
|
|
368
|
-
/**
|
|
369
|
-
* Delimiter to use to join multiple values for the hidden field value.
|
|
370
|
-
*/
|
|
371
|
-
delimiter: {
|
|
372
|
-
type: String,
|
|
373
|
-
default: ","
|
|
374
|
-
},
|
|
375
|
-
/**
|
|
376
|
-
* Only show the nodes that match the search value directly, excluding its ancestors.
|
|
377
|
-
*
|
|
378
|
-
* @type {Object}
|
|
379
|
-
*/
|
|
380
|
-
flattenSearchResults: {
|
|
381
|
-
type: Boolean,
|
|
382
|
-
default: !1
|
|
383
|
-
},
|
|
384
|
-
/**
|
|
385
|
-
* Prevent branch nodes from being selected?
|
|
386
|
-
*/
|
|
387
|
-
disableBranchNodes: {
|
|
388
|
-
type: Boolean,
|
|
389
|
-
default: !1
|
|
390
|
-
},
|
|
391
|
-
/**
|
|
392
|
-
* Disable the control?
|
|
393
|
-
*/
|
|
394
|
-
disabled: {
|
|
395
|
-
type: Boolean,
|
|
396
|
-
default: !1
|
|
397
|
-
},
|
|
398
|
-
/**
|
|
399
|
-
* Disable the fuzzy matching functionality?
|
|
400
|
-
*/
|
|
401
|
-
disableFuzzyMatching: {
|
|
402
|
-
type: Boolean,
|
|
403
|
-
default: !1
|
|
404
|
-
},
|
|
405
|
-
/**
|
|
406
|
-
* Whether to enable flat mode or not. Non-flat mode (default) means:
|
|
407
|
-
* - Whenever a branch node gets checked, all its children will be checked too
|
|
408
|
-
* - Whenever a branch node has all children checked, the branch node itself will be checked too
|
|
409
|
-
* Set `true` to disable this mechanism
|
|
410
|
-
*/
|
|
411
|
-
flat: {
|
|
412
|
-
type: Boolean,
|
|
413
|
-
default: !1
|
|
414
|
-
},
|
|
415
|
-
/**
|
|
416
|
-
* Will be passed with all events as the last param.
|
|
417
|
-
* Useful for identifying events origin.
|
|
418
|
-
*/
|
|
419
|
-
instanceId: {
|
|
420
|
-
// Add two trailing "$" to distinguish from explictly specified ids.
|
|
421
|
-
default: () => `${Pe++}$$`,
|
|
422
|
-
type: [String, Number]
|
|
423
|
-
},
|
|
424
|
-
/**
|
|
425
|
-
* Joins multiple values into a single form field with the `delimiter` (legacy mode).
|
|
426
|
-
*/
|
|
427
|
-
joinValues: {
|
|
428
|
-
type: Boolean,
|
|
429
|
-
default: !1
|
|
430
|
-
},
|
|
431
|
-
/**
|
|
432
|
-
* Limit the display of selected options.
|
|
433
|
-
* The rest will be hidden within the limitText string.
|
|
434
|
-
*/
|
|
435
|
-
limit: {
|
|
436
|
-
type: Number,
|
|
437
|
-
default: 1 / 0
|
|
438
|
-
},
|
|
439
|
-
/**
|
|
440
|
-
* Function that processes the message shown when selected elements pass the defined limit.
|
|
441
|
-
* @type {function(number): string}
|
|
442
|
-
*/
|
|
443
|
-
limitText: {
|
|
444
|
-
type: Function,
|
|
445
|
-
default: function(t) {
|
|
446
|
-
return `and ${t} more`;
|
|
447
|
-
}
|
|
448
|
-
},
|
|
449
|
-
/**
|
|
450
|
-
* Text displayed when loading options.
|
|
451
|
-
*/
|
|
452
|
-
loadingText: {
|
|
453
|
-
type: String,
|
|
454
|
-
default: "Loading..."
|
|
455
|
-
},
|
|
456
|
-
/**
|
|
457
|
-
* Used for dynamically loading options.
|
|
458
|
-
* @type {function({action: string, callback: (function((Error|string)=): void), parentNode: node=, instanceId}): void}
|
|
459
|
-
*/
|
|
460
|
-
loadOptions: {
|
|
461
|
-
type: Function
|
|
462
|
-
},
|
|
463
|
-
/**
|
|
464
|
-
* Which node properties to filter on.
|
|
465
|
-
*/
|
|
466
|
-
matchKeys: {
|
|
467
|
-
type: Array,
|
|
468
|
-
default: () => ["label"]
|
|
469
|
-
},
|
|
470
|
-
/**
|
|
471
|
-
* Sets `maxHeight` style value of the menu.
|
|
472
|
-
*/
|
|
473
|
-
maxHeight: {
|
|
474
|
-
type: Number,
|
|
475
|
-
default: 300
|
|
476
|
-
},
|
|
477
|
-
/**
|
|
478
|
-
* Set `true` to allow selecting multiple options (a.k.a., multi-select mode).
|
|
479
|
-
*/
|
|
480
|
-
multiple: {
|
|
481
|
-
type: Boolean,
|
|
482
|
-
default: !1
|
|
483
|
-
},
|
|
484
|
-
/**
|
|
485
|
-
* Generates a hidden <input /> tag with this field name for html forms.
|
|
486
|
-
*/
|
|
487
|
-
name: {
|
|
488
|
-
type: String
|
|
489
|
-
},
|
|
490
|
-
/**
|
|
491
|
-
* Text displayed when a branch node has no children.
|
|
492
|
-
*/
|
|
493
|
-
noChildrenText: {
|
|
494
|
-
type: String,
|
|
495
|
-
default: "No sub-options."
|
|
496
|
-
},
|
|
497
|
-
/**
|
|
498
|
-
* Text displayed when there are no available options.
|
|
499
|
-
*/
|
|
500
|
-
noOptionsText: {
|
|
501
|
-
type: String,
|
|
502
|
-
default: "No options available."
|
|
503
|
-
},
|
|
504
|
-
/**
|
|
505
|
-
* Text displayed when there are no matching search results.
|
|
506
|
-
*/
|
|
507
|
-
noResultsText: {
|
|
508
|
-
type: String,
|
|
509
|
-
default: "No results found..."
|
|
510
|
-
},
|
|
511
|
-
/**
|
|
512
|
-
* Used for normalizing source data.
|
|
513
|
-
* @type {function(node, instanceId): node}
|
|
514
|
-
*/
|
|
515
|
-
normalizer: {
|
|
516
|
-
type: Function,
|
|
517
|
-
default: Ne
|
|
518
|
-
},
|
|
519
|
-
/**
|
|
520
|
-
* By default (`auto`), the menu will open below the control. If there is not
|
|
521
|
-
* enough space, vue-treeselect will automatically flip the menu.
|
|
522
|
-
* You can use one of other four options to force the menu to be always opened
|
|
523
|
-
* to specified direction.
|
|
524
|
-
* Acceptable values:
|
|
525
|
-
* - `"auto"`
|
|
526
|
-
* - `"below"`
|
|
527
|
-
* - `"bottom"`
|
|
528
|
-
* - `"above"`
|
|
529
|
-
* - `"top"`
|
|
530
|
-
*/
|
|
531
|
-
openDirection: {
|
|
532
|
-
type: String,
|
|
533
|
-
default: "auto",
|
|
534
|
-
validator(e) {
|
|
535
|
-
return O(["auto", "top", "bottom", "above", "below"], e);
|
|
536
|
-
}
|
|
537
|
-
},
|
|
538
|
-
/**
|
|
539
|
-
* Whether to automatically open the menu when the control is clicked.
|
|
540
|
-
*/
|
|
541
|
-
openOnClick: {
|
|
542
|
-
type: Boolean,
|
|
543
|
-
default: !0
|
|
544
|
-
},
|
|
545
|
-
/**
|
|
546
|
-
* Whether to automatically open the menu when the control is focused.
|
|
547
|
-
*/
|
|
548
|
-
openOnFocus: {
|
|
549
|
-
type: Boolean,
|
|
550
|
-
default: !1
|
|
551
|
-
},
|
|
552
|
-
/**
|
|
553
|
-
* Array of available options.
|
|
554
|
-
* @type {node[]}
|
|
555
|
-
*/
|
|
556
|
-
options: {
|
|
557
|
-
type: Array
|
|
558
|
-
},
|
|
559
|
-
/**
|
|
560
|
-
* Field placeholder, displayed when there's no value.
|
|
561
|
-
*/
|
|
562
|
-
placeholder: {
|
|
563
|
-
type: String,
|
|
564
|
-
default: "Select..."
|
|
565
|
-
},
|
|
566
|
-
/**
|
|
567
|
-
* Applies HTML5 required attribute when needed.
|
|
568
|
-
*/
|
|
569
|
-
required: {
|
|
570
|
-
type: Boolean,
|
|
571
|
-
default: !1
|
|
572
|
-
},
|
|
573
|
-
/**
|
|
574
|
-
* Text displayed asking user whether to retry loading children options.
|
|
575
|
-
*/
|
|
576
|
-
retryText: {
|
|
577
|
-
type: String,
|
|
578
|
-
default: "Retry?"
|
|
579
|
-
},
|
|
580
|
-
/**
|
|
581
|
-
* Title for the retry button.
|
|
582
|
-
*/
|
|
583
|
-
retryTitle: {
|
|
584
|
-
type: String,
|
|
585
|
-
default: "Click to retry"
|
|
586
|
-
},
|
|
587
|
-
/**
|
|
588
|
-
* Enable searching feature?
|
|
589
|
-
*/
|
|
590
|
-
searchable: {
|
|
591
|
-
type: Boolean,
|
|
592
|
-
default: !0
|
|
593
|
-
},
|
|
594
|
-
/**
|
|
595
|
-
* Search in ancestor nodes too.
|
|
596
|
-
*/
|
|
597
|
-
searchNested: {
|
|
598
|
-
type: Boolean,
|
|
599
|
-
default: !1
|
|
600
|
-
},
|
|
601
|
-
/**
|
|
602
|
-
* Text tip to prompt for async search.
|
|
603
|
-
*/
|
|
604
|
-
searchPromptText: {
|
|
605
|
-
type: String,
|
|
606
|
-
default: "Type to search..."
|
|
607
|
-
},
|
|
608
|
-
/**
|
|
609
|
-
* Whether to show a children count next to the label of each branch node.
|
|
610
|
-
*/
|
|
611
|
-
showCount: {
|
|
612
|
-
type: Boolean,
|
|
613
|
-
default: !1
|
|
614
|
-
},
|
|
615
|
-
/**
|
|
616
|
-
* Used in conjunction with `showCount` to specify which type of count number should be displayed.
|
|
617
|
-
* Acceptable values:
|
|
618
|
-
* - "ALL_CHILDREN"
|
|
619
|
-
* - "ALL_DESCENDANTS"
|
|
620
|
-
* - "LEAF_CHILDREN"
|
|
621
|
-
* - "LEAF_DESCENDANTS"
|
|
622
|
-
*/
|
|
623
|
-
showCountOf: {
|
|
624
|
-
type: String,
|
|
625
|
-
default: E,
|
|
626
|
-
validator(e) {
|
|
627
|
-
return O([E, w, C, L], e);
|
|
628
|
-
}
|
|
629
|
-
},
|
|
630
|
-
/**
|
|
631
|
-
* Whether to show children count when searching.
|
|
632
|
-
* Fallbacks to the value of `showCount` when not specified.
|
|
633
|
-
* @type {boolean}
|
|
634
|
-
*/
|
|
635
|
-
showCountOnSearch: null,
|
|
636
|
-
/**
|
|
637
|
-
* In which order the selected options should be displayed in trigger & sorted in `value` array.
|
|
638
|
-
* Used for multi-select mode only.
|
|
639
|
-
* Acceptable values:
|
|
640
|
-
* - "ORDER_SELECTED"
|
|
641
|
-
* - "LEVEL"
|
|
642
|
-
* - "INDEX"
|
|
643
|
-
*/
|
|
644
|
-
sortValueBy: {
|
|
645
|
-
type: String,
|
|
646
|
-
default: X,
|
|
647
|
-
validator(e) {
|
|
648
|
-
return O([X, G, J], e);
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
/**
|
|
652
|
-
* Tab index of the control.
|
|
653
|
-
*/
|
|
654
|
-
tabIndex: {
|
|
655
|
-
type: Number,
|
|
656
|
-
default: 0
|
|
657
|
-
},
|
|
658
|
-
/**
|
|
659
|
-
* The value of the control.
|
|
660
|
-
* Should be `id` or `node` object for single-select mode, or an array of `id` or `node` object for multi-select mode.
|
|
661
|
-
* Its format depends on the `valueFormat` prop.
|
|
662
|
-
* For most cases, just use `v-model` instead.
|
|
663
|
-
* @type {?Array}
|
|
664
|
-
*/
|
|
665
|
-
value: null,
|
|
666
|
-
/**
|
|
667
|
-
* Which kind of nodes should be included in the `value` array in multi-select mode.
|
|
668
|
-
* Acceptable values:
|
|
669
|
-
* - "ALL" - Any node that is checked will be included in the `value` array
|
|
670
|
-
* - "BRANCH_PRIORITY" (default) - If a branch node is checked, all its descendants will be excluded in the `value` array
|
|
671
|
-
* - "LEAF_PRIORITY" - If a branch node is checked, this node itself and its branch descendants will be excluded from the `value` array but its leaf descendants will be included
|
|
672
|
-
* - "ALL_WITH_INDETERMINATE" - Any node that is checked will be included in the `value` array, plus indeterminate nodes
|
|
673
|
-
*/
|
|
674
|
-
valueConsistsOf: {
|
|
675
|
-
type: String,
|
|
676
|
-
default: M,
|
|
677
|
-
validator(e) {
|
|
678
|
-
return O([V, M, B, z], e);
|
|
679
|
-
}
|
|
680
|
-
},
|
|
681
|
-
/**
|
|
682
|
-
* Format of `value` prop.
|
|
683
|
-
* Note that, when set to `"object"`, only `id` & `label` properties are required in each `node` object in `value` prop.
|
|
684
|
-
* Acceptable values:
|
|
685
|
-
* - "id"
|
|
686
|
-
* - "object"
|
|
687
|
-
*/
|
|
688
|
-
valueFormat: {
|
|
689
|
-
type: String,
|
|
690
|
-
default: "id"
|
|
691
|
-
},
|
|
692
|
-
/**
|
|
693
|
-
* z-index of the menu.
|
|
694
|
-
*/
|
|
695
|
-
zIndex: {
|
|
696
|
-
type: [Number, String],
|
|
697
|
-
default: 999
|
|
698
|
-
}
|
|
699
|
-
},
|
|
700
|
-
data() {
|
|
701
|
-
return {
|
|
702
|
-
trigger: {
|
|
703
|
-
// Is the control focused?
|
|
704
|
-
isFocused: !1,
|
|
705
|
-
// User entered search query - value of the input.
|
|
706
|
-
searchQuery: ""
|
|
707
|
-
},
|
|
708
|
-
menu: {
|
|
709
|
-
// Is the menu opened?
|
|
710
|
-
isOpen: !1,
|
|
711
|
-
// Id of current highlighted option.
|
|
712
|
-
current: null,
|
|
713
|
-
// The scroll position before last menu closing.
|
|
714
|
-
lastScrollPosition: 0,
|
|
715
|
-
// Which direction to open the menu.
|
|
716
|
-
placement: "bottom"
|
|
717
|
-
},
|
|
718
|
-
forest: {
|
|
719
|
-
// Normalized options.
|
|
720
|
-
normalizedOptions: [],
|
|
721
|
-
// <id, node> map for quick look-up.
|
|
722
|
-
nodeMap: S(),
|
|
723
|
-
// <id, checkedState> map, used for multi-select mode.
|
|
724
|
-
checkedStateMap: S(),
|
|
725
|
-
// Id list of all selected options.
|
|
726
|
-
selectedNodeIds: this.extractCheckedNodeIdsFromValue(),
|
|
727
|
-
// <id, true> map for fast checking:
|
|
728
|
-
// if (forest.selectedNodeIds.indexOf(id) !== -1) forest.selectedNodeMap[id] === true
|
|
729
|
-
selectedNodeMap: S()
|
|
730
|
-
},
|
|
731
|
-
// States of root options.
|
|
732
|
-
rootOptionsStates: F(),
|
|
733
|
-
localSearch: {
|
|
734
|
-
// Has user entered any query to search local options?
|
|
735
|
-
active: !1,
|
|
736
|
-
// Has any options matched the search query?
|
|
737
|
-
noResults: !0,
|
|
738
|
-
// <id, countObject> map for counting matched children/descendants.
|
|
739
|
-
countMap: S()
|
|
740
|
-
},
|
|
741
|
-
// <searchQuery, remoteSearchEntry> map.
|
|
742
|
-
remoteSearch: S()
|
|
743
|
-
};
|
|
744
|
-
},
|
|
745
|
-
computed: {
|
|
746
|
-
/**
|
|
747
|
-
* Normalized nodes that have been selected.
|
|
748
|
-
* @type {node[]}
|
|
749
|
-
*/
|
|
750
|
-
selectedNodes() {
|
|
751
|
-
return this.forest.selectedNodeIds.map(this.getNode);
|
|
752
|
-
},
|
|
753
|
-
/**
|
|
754
|
-
* Id list of selected nodes with `sortValueBy` prop applied.
|
|
755
|
-
* @type {nodeId[]}
|
|
756
|
-
*/
|
|
757
|
-
internalValue() {
|
|
758
|
-
let e;
|
|
759
|
-
if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === V)
|
|
760
|
-
e = this.forest.selectedNodeIds.slice();
|
|
761
|
-
else if (this.valueConsistsOf === M)
|
|
762
|
-
e = this.forest.selectedNodeIds.filter((t) => {
|
|
763
|
-
const s = this.getNode(t);
|
|
764
|
-
return s.isRootNode ? !0 : !this.isSelected(s.parentNode);
|
|
765
|
-
});
|
|
766
|
-
else if (this.valueConsistsOf === B)
|
|
767
|
-
e = this.forest.selectedNodeIds.filter((t) => {
|
|
768
|
-
const s = this.getNode(t);
|
|
769
|
-
return s.isLeaf ? !0 : s.children.length === 0;
|
|
770
|
-
});
|
|
771
|
-
else if (this.valueConsistsOf === z) {
|
|
772
|
-
const t = [];
|
|
773
|
-
e = this.forest.selectedNodeIds.slice(), this.selectedNodes.forEach((s) => {
|
|
774
|
-
s.ancestors.forEach((n) => {
|
|
775
|
-
O(t, n.id) || O(e, n.id) || t.push(n.id);
|
|
776
|
-
});
|
|
777
|
-
}), e.push(...t);
|
|
778
|
-
}
|
|
779
|
-
return this.sortValueBy === G ? e.sort((t, s) => ke(this.getNode(t), this.getNode(s))) : this.sortValueBy === J && e.sort((t, s) => de(this.getNode(t), this.getNode(s))), e;
|
|
780
|
-
},
|
|
781
|
-
/**
|
|
782
|
-
* Has any option been selected?
|
|
783
|
-
* @type {boolean}
|
|
784
|
-
*/
|
|
785
|
-
hasValue() {
|
|
786
|
-
return this.internalValue.length > 0;
|
|
787
|
-
},
|
|
788
|
-
/**
|
|
789
|
-
* Single-select mode?
|
|
790
|
-
* @type {boolean}
|
|
791
|
-
*/
|
|
792
|
-
single() {
|
|
793
|
-
return !this.multiple;
|
|
794
|
-
},
|
|
795
|
-
/**
|
|
796
|
-
* Id list of nodes displayed in the menu. Nodes that are considered NOT visible:
|
|
797
|
-
* - descendants of a collapsed branch node
|
|
798
|
-
* - in local search mode, nodes that are not matched, unless
|
|
799
|
-
* - it's a branch node and has matched descendants
|
|
800
|
-
* - it's a leaf node and its parent node is explicitly set to show all children
|
|
801
|
-
* @type {id[]}
|
|
802
|
-
*/
|
|
803
|
-
visibleOptionIds() {
|
|
804
|
-
const e = [];
|
|
805
|
-
return this.traverseAllNodesByIndex((t) => {
|
|
806
|
-
if ((!this.localSearch.active || this.shouldOptionBeIncludedInSearchResult(t)) && e.push(t.id), t.isBranch && !this.shouldExpand(t))
|
|
807
|
-
return !1;
|
|
808
|
-
}), e;
|
|
809
|
-
},
|
|
810
|
-
/**
|
|
811
|
-
* Has any option should be displayed in the menu?
|
|
812
|
-
* @type {boolean}
|
|
813
|
-
*/
|
|
814
|
-
hasVisibleOptions() {
|
|
815
|
-
return this.visibleOptionIds.length !== 0;
|
|
816
|
-
},
|
|
817
|
-
/**
|
|
818
|
-
* Should show children count when searching?
|
|
819
|
-
* @type {boolean}
|
|
820
|
-
*/
|
|
821
|
-
showCountOnSearchComputed() {
|
|
822
|
-
return typeof this.showCountOnSearch == "boolean" ? this.showCountOnSearch : this.showCount;
|
|
823
|
-
},
|
|
824
|
-
/**
|
|
825
|
-
* Is there any branch node?
|
|
826
|
-
* @type {boolean}
|
|
827
|
-
*/
|
|
828
|
-
hasBranchNodes() {
|
|
829
|
-
return this.forest.normalizedOptions.some((e) => e.isBranch);
|
|
830
|
-
},
|
|
831
|
-
shouldFlattenOptions() {
|
|
832
|
-
return this.localSearch.active && this.flattenSearchResults;
|
|
833
|
-
}
|
|
834
|
-
},
|
|
835
|
-
watch: {
|
|
836
|
-
alwaysOpen(e) {
|
|
837
|
-
e ? this.openMenu() : this.closeMenu();
|
|
838
|
-
},
|
|
839
|
-
branchNodesFirst() {
|
|
840
|
-
this.initialize();
|
|
841
|
-
},
|
|
842
|
-
disabled(e) {
|
|
843
|
-
e && this.menu.isOpen ? this.closeMenu() : !e && !this.menu.isOpen && this.alwaysOpen && this.openMenu();
|
|
844
|
-
},
|
|
845
|
-
flat() {
|
|
846
|
-
this.initialize();
|
|
847
|
-
},
|
|
848
|
-
internalValue(e, t) {
|
|
849
|
-
A(e, t) && this.$emit("input", this.getValue(), this.getInstanceId());
|
|
850
|
-
},
|
|
851
|
-
matchKeys() {
|
|
852
|
-
this.initialize();
|
|
853
|
-
},
|
|
854
|
-
multiple(e) {
|
|
855
|
-
e && this.buildForestState();
|
|
856
|
-
},
|
|
857
|
-
options: {
|
|
858
|
-
handler() {
|
|
859
|
-
this.async || (this.initialize(), this.rootOptionsStates.isLoaded = Array.isArray(this.options));
|
|
860
|
-
},
|
|
861
|
-
deep: !0,
|
|
862
|
-
immediate: !0
|
|
863
|
-
},
|
|
864
|
-
"trigger.searchQuery"() {
|
|
865
|
-
this.async ? this.handleRemoteSearch() : this.handleLocalSearch(), this.$emit("search-change", this.trigger.searchQuery, this.getInstanceId());
|
|
866
|
-
},
|
|
867
|
-
value() {
|
|
868
|
-
const e = this.extractCheckedNodeIdsFromValue();
|
|
869
|
-
A(e, this.internalValue) && this.fixSelectedNodeIds(e);
|
|
870
|
-
}
|
|
871
|
-
},
|
|
872
|
-
methods: {
|
|
873
|
-
verifyProps() {
|
|
874
|
-
_(
|
|
875
|
-
() => this.async ? this.searchable : !0,
|
|
876
|
-
() => 'For async search mode, the value of "searchable" prop must be true.'
|
|
877
|
-
), this.options == null && !this.loadOptions && _(
|
|
878
|
-
() => !1,
|
|
879
|
-
() => 'Are you meant to dynamically load options? You need to use "loadOptions" prop.'
|
|
880
|
-
), this.flat && _(
|
|
881
|
-
() => this.multiple,
|
|
882
|
-
() => 'You are using flat mode. But you forgot to add "multiple=true"?'
|
|
883
|
-
), this.flat || ["autoSelectAncestors", "autoSelectDescendants", "autoDeselectAncestors", "autoDeselectDescendants"].forEach((t) => {
|
|
884
|
-
_(
|
|
885
|
-
() => !this[t],
|
|
886
|
-
() => `"${t}" only applies to flat mode.`
|
|
887
|
-
);
|
|
888
|
-
});
|
|
889
|
-
},
|
|
890
|
-
resetFlags() {
|
|
891
|
-
this._blurOnSelect = !1;
|
|
892
|
-
},
|
|
893
|
-
initialize() {
|
|
894
|
-
const e = this.async ? this.getRemoteSearchEntry().options : this.options;
|
|
895
|
-
if (Array.isArray(e)) {
|
|
896
|
-
const t = this.forest.nodeMap;
|
|
897
|
-
this.forest.nodeMap = S(), this.keepDataOfSelectedNodes(t), this.forest.normalizedOptions = this.normalize(b, e, t), this.fixSelectedNodeIds(this.internalValue);
|
|
898
|
-
} else
|
|
899
|
-
this.forest.normalizedOptions = [];
|
|
900
|
-
},
|
|
901
|
-
getInstanceId() {
|
|
902
|
-
return this.instanceId == null ? this.id : this.instanceId;
|
|
903
|
-
},
|
|
904
|
-
getValue() {
|
|
905
|
-
if (this.valueFormat === "id")
|
|
906
|
-
return this.multiple ? this.internalValue.slice() : this.internalValue[0];
|
|
907
|
-
const e = this.internalValue.map((t) => this.getNode(t).raw);
|
|
908
|
-
return this.multiple ? e : e[0];
|
|
909
|
-
},
|
|
910
|
-
getNode(e) {
|
|
911
|
-
return _(
|
|
912
|
-
() => e != null,
|
|
913
|
-
() => `Invalid node id: ${e}`
|
|
914
|
-
), e == null ? null : e in this.forest.nodeMap ? this.forest.nodeMap[e] : this.createFallbackNode(e);
|
|
915
|
-
},
|
|
916
|
-
createFallbackNode(e) {
|
|
917
|
-
const t = this.extractNodeFromValue(e), s = this.enhancedNormalizer(t).label || `${e} (unknown)`, n = {
|
|
918
|
-
id: e,
|
|
919
|
-
label: s,
|
|
920
|
-
ancestors: [],
|
|
921
|
-
parentNode: b,
|
|
922
|
-
isFallbackNode: !0,
|
|
923
|
-
isRootNode: !0,
|
|
924
|
-
isLeaf: !0,
|
|
925
|
-
isBranch: !1,
|
|
926
|
-
isDisabled: !1,
|
|
927
|
-
isNew: !1,
|
|
928
|
-
index: [-1],
|
|
929
|
-
level: 0,
|
|
930
|
-
raw: t
|
|
931
|
-
};
|
|
932
|
-
return this.$set(this.forest.nodeMap, e, n);
|
|
933
|
-
},
|
|
934
|
-
extractCheckedNodeIdsFromValue() {
|
|
935
|
-
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);
|
|
936
|
-
},
|
|
937
|
-
extractNodeFromValue(e) {
|
|
938
|
-
const t = { id: e };
|
|
939
|
-
if (this.valueFormat === "id")
|
|
940
|
-
return t;
|
|
941
|
-
const s = this.multiple ? Array.isArray(this.value) ? this.value : [] : this.value ? [this.value] : [];
|
|
942
|
-
return ce(s, (i) => i && this.enhancedNormalizer(i).id === e) || t;
|
|
943
|
-
},
|
|
944
|
-
fixSelectedNodeIds(e) {
|
|
945
|
-
let t = [];
|
|
946
|
-
if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === V)
|
|
947
|
-
t = e;
|
|
948
|
-
else if (this.valueConsistsOf === M)
|
|
949
|
-
e.forEach((n) => {
|
|
950
|
-
t.push(n);
|
|
951
|
-
const i = this.getNode(n);
|
|
952
|
-
i.isBranch && this.traverseDescendantsBFS(i, (o) => {
|
|
953
|
-
t.push(o.id);
|
|
954
|
-
});
|
|
955
|
-
});
|
|
956
|
-
else if (this.valueConsistsOf === B) {
|
|
957
|
-
const n = S(), i = e.slice();
|
|
958
|
-
for (; i.length; ) {
|
|
959
|
-
const o = i.shift(), l = this.getNode(o);
|
|
960
|
-
t.push(o), !l.isRootNode && (l.parentNode.id in n || (n[l.parentNode.id] = l.parentNode.children.length), --n[l.parentNode.id] === 0 && i.push(l.parentNode.id));
|
|
961
|
-
}
|
|
962
|
-
} else if (this.valueConsistsOf === z) {
|
|
963
|
-
const n = S(), i = e.filter((o) => {
|
|
964
|
-
const l = this.getNode(o);
|
|
965
|
-
return l.isLeaf || l.children.length === 0;
|
|
966
|
-
});
|
|
967
|
-
for (; i.length; ) {
|
|
968
|
-
const o = i.shift(), l = this.getNode(o);
|
|
969
|
-
t.push(o), !l.isRootNode && (l.parentNode.id in n || (n[l.parentNode.id] = l.parentNode.children.length), --n[l.parentNode.id] === 0 && i.push(l.parentNode.id));
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
A(this.forest.selectedNodeIds, t) && (this.forest.selectedNodeIds = t), this.buildForestState();
|
|
973
|
-
},
|
|
974
|
-
keepDataOfSelectedNodes(e) {
|
|
975
|
-
this.forest.selectedNodeIds.forEach((t) => {
|
|
976
|
-
if (!e[t]) return;
|
|
977
|
-
const s = {
|
|
978
|
-
...e[t],
|
|
979
|
-
isFallbackNode: !0
|
|
980
|
-
};
|
|
981
|
-
this.$set(this.forest.nodeMap, t, s);
|
|
982
|
-
});
|
|
983
|
-
},
|
|
984
|
-
isSelected(e) {
|
|
985
|
-
return this.forest.selectedNodeMap[e.id] === !0;
|
|
986
|
-
},
|
|
987
|
-
traverseDescendantsBFS(e, t) {
|
|
988
|
-
if (!e.isBranch) return;
|
|
989
|
-
const s = e.children.slice();
|
|
990
|
-
for (; s.length; ) {
|
|
991
|
-
const n = s[0];
|
|
992
|
-
n.isBranch && s.push(...n.children), t(n), s.shift();
|
|
993
|
-
}
|
|
994
|
-
},
|
|
995
|
-
traverseDescendantsDFS(e, t) {
|
|
996
|
-
e.isBranch && e.children.forEach((s) => {
|
|
997
|
-
this.traverseDescendantsDFS(s, t), t(s);
|
|
998
|
-
});
|
|
999
|
-
},
|
|
1000
|
-
traverseAllNodesDFS(e) {
|
|
1001
|
-
this.forest.normalizedOptions.forEach((t) => {
|
|
1002
|
-
this.traverseDescendantsDFS(t, e), e(t);
|
|
1003
|
-
});
|
|
1004
|
-
},
|
|
1005
|
-
traverseAllNodesByIndex(e) {
|
|
1006
|
-
const t = (s) => {
|
|
1007
|
-
s.children.forEach((n) => {
|
|
1008
|
-
e(n) !== !1 && n.isBranch && t(n);
|
|
1009
|
-
});
|
|
1010
|
-
};
|
|
1011
|
-
t({ children: this.forest.normalizedOptions });
|
|
1012
|
-
},
|
|
1013
|
-
toggleClickOutsideEvent(e) {
|
|
1014
|
-
e ? document.addEventListener("mousedown", this.handleClickOutside, !1) : document.removeEventListener("mousedown", this.handleClickOutside, !1);
|
|
1015
|
-
},
|
|
1016
|
-
getValueContainer() {
|
|
1017
|
-
return this.$refs.control.$refs["value-container"];
|
|
1018
|
-
},
|
|
1019
|
-
getInput() {
|
|
1020
|
-
return this.getValueContainer().$refs.input;
|
|
1021
|
-
},
|
|
1022
|
-
focusInput() {
|
|
1023
|
-
this.getInput().focus();
|
|
1024
|
-
},
|
|
1025
|
-
blurInput() {
|
|
1026
|
-
this.getInput().blur();
|
|
1027
|
-
},
|
|
1028
|
-
handleMouseDown: N(function(t) {
|
|
1029
|
-
if (t.preventDefault(), t.stopPropagation(), this.disabled) return;
|
|
1030
|
-
this.getValueContainer().$el.contains(t.target) && !this.menu.isOpen && (this.openOnClick || this.trigger.isFocused) && this.openMenu(), this._blurOnSelect ? this.blurInput() : this.focusInput(), this.resetFlags();
|
|
1031
|
-
}),
|
|
1032
|
-
handleClickOutside(e) {
|
|
1033
|
-
this.$refs.wrapper && !this.$refs.wrapper.contains(e.target) && (this.blurInput(), this.closeMenu());
|
|
1034
|
-
},
|
|
1035
|
-
handleLocalSearch() {
|
|
1036
|
-
const { searchQuery: e } = this.trigger, t = () => this.resetHighlightedOptionWhenNecessary(!0);
|
|
1037
|
-
if (!e)
|
|
1038
|
-
return this.localSearch.active = !1, t();
|
|
1039
|
-
this.localSearch.active = !0, this.localSearch.noResults = !0, this.traverseAllNodesDFS((i) => {
|
|
1040
|
-
i.isBranch && (i.isExpandedOnSearch = !1, i.showAllChildrenOnSearch = !1, i.isMatched = !1, i.hasMatchedDescendants = !1, this.$set(this.localSearch.countMap, i.id, {
|
|
1041
|
-
[E]: 0,
|
|
1042
|
-
[w]: 0,
|
|
1043
|
-
[C]: 0,
|
|
1044
|
-
[L]: 0
|
|
1045
|
-
}));
|
|
1046
|
-
});
|
|
1047
|
-
const s = e.trim().toLocaleLowerCase(), n = s.replace(/\s+/g, " ").split(" ");
|
|
1048
|
-
this.traverseAllNodesDFS((i) => {
|
|
1049
|
-
this.searchNested && n.length > 1 ? i.isMatched = n.every((o) => te(!1, o, i.nestedSearchLabel)) : i.isMatched = this.matchKeys.some((o) => te(!this.disableFuzzyMatching, s, i.lowerCased[o])), i.isMatched && (this.localSearch.noResults = !1, i.ancestors.forEach((o) => this.localSearch.countMap[o.id][w]++), i.isLeaf && i.ancestors.forEach((o) => this.localSearch.countMap[o.id][L]++), i.parentNode !== b && (this.localSearch.countMap[i.parentNode.id][E] += 1, i.isLeaf && (this.localSearch.countMap[i.parentNode.id][C] += 1))), (i.isMatched || i.isBranch && i.isExpandedOnSearch) && i.parentNode !== b && (i.parentNode.isExpandedOnSearch = !0, i.parentNode.hasMatchedDescendants = !0);
|
|
1050
|
-
}), t();
|
|
1051
|
-
},
|
|
1052
|
-
handleRemoteSearch() {
|
|
1053
|
-
const { searchQuery: e } = this.trigger, t = this.getRemoteSearchEntry(), s = () => {
|
|
1054
|
-
this.initialize(), this.resetHighlightedOptionWhenNecessary(!0);
|
|
1055
|
-
};
|
|
1056
|
-
if ((e === "" || this.cacheOptions) && t.isLoaded)
|
|
1057
|
-
return s();
|
|
1058
|
-
this.callLoadOptionsProp({
|
|
1059
|
-
action: ze,
|
|
1060
|
-
args: { searchQuery: e },
|
|
1061
|
-
isPending() {
|
|
1062
|
-
return t.isLoading;
|
|
1063
|
-
},
|
|
1064
|
-
start: () => {
|
|
1065
|
-
t.isLoading = !0, t.isLoaded = !1, t.loadingError = "";
|
|
1066
|
-
},
|
|
1067
|
-
succeed: (n) => {
|
|
1068
|
-
t.isLoaded = !0, t.options = n, this.trigger.searchQuery === e && s();
|
|
1069
|
-
},
|
|
1070
|
-
fail: (n) => {
|
|
1071
|
-
t.loadingError = k(n);
|
|
1072
|
-
},
|
|
1073
|
-
end: () => {
|
|
1074
|
-
t.isLoading = !1;
|
|
1075
|
-
}
|
|
1076
|
-
});
|
|
1077
|
-
},
|
|
1078
|
-
getRemoteSearchEntry() {
|
|
1079
|
-
const { searchQuery: e } = this.trigger, t = this.remoteSearch[e] || {
|
|
1080
|
-
...F(),
|
|
1081
|
-
options: []
|
|
1082
|
-
};
|
|
1083
|
-
if (this.$watch(
|
|
1084
|
-
() => t.options,
|
|
1085
|
-
() => {
|
|
1086
|
-
this.trigger.searchQuery === e && this.initialize();
|
|
1087
|
-
},
|
|
1088
|
-
{ deep: !0 }
|
|
1089
|
-
), e === "") {
|
|
1090
|
-
if (Array.isArray(this.defaultOptions))
|
|
1091
|
-
return t.options = this.defaultOptions, t.isLoaded = !0, t;
|
|
1092
|
-
if (this.defaultOptions !== !0)
|
|
1093
|
-
return t.isLoaded = !0, t;
|
|
1094
|
-
}
|
|
1095
|
-
return this.remoteSearch[e] || this.$set(this.remoteSearch, e, t), t;
|
|
1096
|
-
},
|
|
1097
|
-
shouldExpand(e) {
|
|
1098
|
-
return this.localSearch.active ? e.isExpandedOnSearch : e.isExpanded;
|
|
1099
|
-
},
|
|
1100
|
-
shouldOptionBeIncludedInSearchResult(e) {
|
|
1101
|
-
return !!(e.isMatched || e.isBranch && e.hasMatchedDescendants && !this.flattenSearchResults || !e.isRootNode && e.parentNode.showAllChildrenOnSearch);
|
|
1102
|
-
},
|
|
1103
|
-
shouldShowOptionInMenu(e) {
|
|
1104
|
-
return !(this.localSearch.active && !this.shouldOptionBeIncludedInSearchResult(e));
|
|
1105
|
-
},
|
|
1106
|
-
getControl() {
|
|
1107
|
-
return this.$refs.control.$el;
|
|
1108
|
-
},
|
|
1109
|
-
getMenu() {
|
|
1110
|
-
const t = (this.appendToBody ? this.$refs.portal.portalTarget : this).$refs.menu.$refs.menu;
|
|
1111
|
-
return t && t.nodeName !== "#comment" ? t : null;
|
|
1112
|
-
},
|
|
1113
|
-
setCurrentHighlightedOption(e, t = !0) {
|
|
1114
|
-
const s = this.menu.current;
|
|
1115
|
-
if (s != null && s in this.forest.nodeMap && (this.forest.nodeMap[s].isHighlighted = !1), this.menu.current = e.id, e.isHighlighted = !0, this.menu.isOpen && t) {
|
|
1116
|
-
const n = () => {
|
|
1117
|
-
const i = this.getMenu(), o = i.querySelector(`.vue-treeselect__option[data-id="${e.id}"]`);
|
|
1118
|
-
o && Ce(i, o);
|
|
1119
|
-
};
|
|
1120
|
-
this.getMenu() ? n() : this.$nextTick(n);
|
|
1121
|
-
}
|
|
1122
|
-
},
|
|
1123
|
-
resetHighlightedOptionWhenNecessary(e = !1) {
|
|
1124
|
-
const { current: t } = this.menu;
|
|
1125
|
-
(e || t == null || !(t in this.forest.nodeMap) || !this.shouldShowOptionInMenu(this.getNode(t))) && this.highlightFirstOption();
|
|
1126
|
-
},
|
|
1127
|
-
highlightFirstOption() {
|
|
1128
|
-
if (!this.hasVisibleOptions) return;
|
|
1129
|
-
const e = this.visibleOptionIds[0];
|
|
1130
|
-
this.setCurrentHighlightedOption(this.getNode(e));
|
|
1131
|
-
},
|
|
1132
|
-
highlightPrevOption() {
|
|
1133
|
-
if (!this.hasVisibleOptions) return;
|
|
1134
|
-
const e = this.visibleOptionIds.indexOf(this.menu.current) - 1;
|
|
1135
|
-
if (e === -1) return this.highlightLastOption();
|
|
1136
|
-
this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
|
|
1137
|
-
},
|
|
1138
|
-
highlightNextOption() {
|
|
1139
|
-
if (!this.hasVisibleOptions) return;
|
|
1140
|
-
const e = this.visibleOptionIds.indexOf(this.menu.current) + 1;
|
|
1141
|
-
if (e === this.visibleOptionIds.length) return this.highlightFirstOption();
|
|
1142
|
-
this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
|
|
1143
|
-
},
|
|
1144
|
-
highlightLastOption() {
|
|
1145
|
-
if (!this.hasVisibleOptions) return;
|
|
1146
|
-
const e = Y(this.visibleOptionIds);
|
|
1147
|
-
this.setCurrentHighlightedOption(this.getNode(e));
|
|
1148
|
-
},
|
|
1149
|
-
resetSearchQuery() {
|
|
1150
|
-
this.trigger.searchQuery = "";
|
|
1151
|
-
},
|
|
1152
|
-
closeMenu() {
|
|
1153
|
-
!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()));
|
|
1154
|
-
},
|
|
1155
|
-
openMenu() {
|
|
1156
|
-
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()));
|
|
1157
|
-
},
|
|
1158
|
-
toggleMenu() {
|
|
1159
|
-
this.menu.isOpen ? this.closeMenu() : this.openMenu();
|
|
1160
|
-
},
|
|
1161
|
-
toggleExpanded(e) {
|
|
1162
|
-
let t;
|
|
1163
|
-
this.localSearch.active ? (t = e.isExpandedOnSearch = !e.isExpandedOnSearch, t && (e.showAllChildrenOnSearch = !0)) : t = e.isExpanded = !e.isExpanded, t && !e.childrenStates.isLoaded && this.loadChildrenOptions(e);
|
|
1164
|
-
},
|
|
1165
|
-
buildForestState() {
|
|
1166
|
-
const e = S();
|
|
1167
|
-
this.forest.selectedNodeIds.forEach((s) => {
|
|
1168
|
-
e[s] = !0;
|
|
1169
|
-
}), this.forest.selectedNodeMap = e;
|
|
1170
|
-
const t = S();
|
|
1171
|
-
this.multiple && (this.traverseAllNodesByIndex((s) => {
|
|
1172
|
-
t[s.id] = q;
|
|
1173
|
-
}), this.selectedNodes.forEach((s) => {
|
|
1174
|
-
t[s.id] = he, !this.flat && !this.disableBranchNodes && s.ancestors.forEach((n) => {
|
|
1175
|
-
this.isSelected(n) || (t[n.id] = ue);
|
|
1176
|
-
});
|
|
1177
|
-
})), this.forest.checkedStateMap = t;
|
|
1178
|
-
},
|
|
1179
|
-
enhancedNormalizer(e) {
|
|
1180
|
-
return {
|
|
1181
|
-
...e,
|
|
1182
|
-
...this.normalizer(e, this.getInstanceId())
|
|
1183
|
-
};
|
|
1184
|
-
},
|
|
1185
|
-
normalize(e, t, s) {
|
|
1186
|
-
let n = t.map((i) => [this.enhancedNormalizer(i), i]).map(([i, o], l) => {
|
|
1187
|
-
this.checkDuplication(i), this.verifyNodeShape(i);
|
|
1188
|
-
const { id: u, label: f, children: h, isDefaultExpanded: g } = i, p = e === b, y = p ? 0 : e.level + 1, x = Array.isArray(h) || h === null, $ = !x, U = !!i.isDisabled || !this.flat && !p && e.isDisabled, _e = !!i.isNew, I = this.matchKeys.reduce(
|
|
1189
|
-
(c, T) => ({
|
|
1190
|
-
...c,
|
|
1191
|
-
[T]: He(i[T]).toLocaleLowerCase()
|
|
1192
|
-
}),
|
|
1193
|
-
{}
|
|
1194
|
-
), Oe = p ? I.label : `${e.nestedSearchLabel} ${I.label}`, a = this.$set(this.forest.nodeMap, u, S());
|
|
1195
|
-
if (this.$set(a, "id", u), this.$set(a, "label", f), this.$set(a, "level", y), this.$set(a, "ancestors", p ? [] : [e].concat(e.ancestors)), this.$set(a, "index", (p ? [] : e.index).concat(l)), this.$set(a, "parentNode", e), this.$set(a, "lowerCased", I), this.$set(a, "nestedSearchLabel", Oe), this.$set(a, "isDisabled", U), this.$set(a, "isNew", _e), this.$set(a, "isMatched", !1), this.$set(a, "isHighlighted", !1), this.$set(a, "isBranch", x), this.$set(a, "isLeaf", $), this.$set(a, "isRootNode", p), this.$set(a, "raw", o), x) {
|
|
1196
|
-
const c = Array.isArray(h);
|
|
1197
|
-
this.$set(a, "childrenStates", {
|
|
1198
|
-
...F(),
|
|
1199
|
-
isLoaded: c
|
|
1200
|
-
}), this.$set(a, "isExpanded", typeof g == "boolean" ? g : y < this.defaultExpandLevel), this.$set(a, "hasMatchedDescendants", !1), this.$set(a, "hasDisabledDescendants", !1), this.$set(a, "isExpandedOnSearch", !1), this.$set(a, "showAllChildrenOnSearch", !1), this.$set(a, "count", {
|
|
1201
|
-
[E]: 0,
|
|
1202
|
-
[w]: 0,
|
|
1203
|
-
[C]: 0,
|
|
1204
|
-
[L]: 0
|
|
1205
|
-
}), this.$set(a, "children", c ? this.normalize(a, h, s) : []), g === !0 && a.ancestors.forEach((T) => {
|
|
1206
|
-
T.isExpanded = !0;
|
|
1207
|
-
}), !c && typeof this.loadOptions != "function" ? _(
|
|
1208
|
-
() => !1,
|
|
1209
|
-
() => 'Unloaded branch node detected. "loadOptions" prop is required to load its children.'
|
|
1210
|
-
) : !c && a.isExpanded && this.loadChildrenOptions(a);
|
|
1211
|
-
}
|
|
1212
|
-
if (a.ancestors.forEach((c) => c.count[w]++), $ && a.ancestors.forEach((c) => c.count[L]++), p || (e.count[E] += 1, $ && (e.count[C] += 1), U && (e.hasDisabledDescendants = !0)), s && s[u]) {
|
|
1213
|
-
const c = s[u];
|
|
1214
|
-
a.isMatched = c.isMatched, a.showAllChildrenOnSearch = c.showAllChildrenOnSearch, a.isHighlighted = c.isHighlighted, c.isBranch && a.isBranch && (a.isExpanded = c.isExpanded, a.isExpandedOnSearch = c.isExpandedOnSearch, c.childrenStates.isLoaded && !a.childrenStates.isLoaded ? a.isExpanded = !1 : a.childrenStates = { ...c.childrenStates });
|
|
1215
|
-
}
|
|
1216
|
-
return a;
|
|
1217
|
-
});
|
|
1218
|
-
if (this.branchNodesFirst) {
|
|
1219
|
-
const i = n.filter((l) => l.isBranch), o = n.filter((l) => l.isLeaf);
|
|
1220
|
-
n = i.concat(o);
|
|
1221
|
-
}
|
|
1222
|
-
return n;
|
|
1223
|
-
},
|
|
1224
|
-
loadRootOptions() {
|
|
1225
|
-
this.callLoadOptionsProp({
|
|
1226
|
-
action: Ve,
|
|
1227
|
-
isPending: () => this.rootOptionsStates.isLoading,
|
|
1228
|
-
start: () => {
|
|
1229
|
-
this.rootOptionsStates.isLoading = !0, this.rootOptionsStates.loadingError = "";
|
|
1230
|
-
},
|
|
1231
|
-
succeed: () => {
|
|
1232
|
-
this.rootOptionsStates.isLoaded = !0, this.$nextTick(() => {
|
|
1233
|
-
this.resetHighlightedOptionWhenNecessary(!0);
|
|
1234
|
-
});
|
|
1235
|
-
},
|
|
1236
|
-
fail: (e) => {
|
|
1237
|
-
this.rootOptionsStates.loadingError = k(e);
|
|
1238
|
-
},
|
|
1239
|
-
end: () => {
|
|
1240
|
-
this.rootOptionsStates.isLoading = !1;
|
|
1241
|
-
}
|
|
1242
|
-
});
|
|
1243
|
-
},
|
|
1244
|
-
loadChildrenOptions(e) {
|
|
1245
|
-
const { id: t, raw: s } = e;
|
|
1246
|
-
this.callLoadOptionsProp({
|
|
1247
|
-
action: Be,
|
|
1248
|
-
args: {
|
|
1249
|
-
// We always pass the raw node instead of the normalized node to any
|
|
1250
|
-
// callback provided by the user of this component.
|
|
1251
|
-
// Because the shape of the raw node is more likely to be closing to
|
|
1252
|
-
// what the back-end API service of the application needs.
|
|
1253
|
-
parentNode: s
|
|
1254
|
-
},
|
|
1255
|
-
isPending: () => this.getNode(t).childrenStates.isLoading,
|
|
1256
|
-
start: () => {
|
|
1257
|
-
this.getNode(t).childrenStates.isLoading = !0, this.getNode(t).childrenStates.loadingError = "";
|
|
1258
|
-
},
|
|
1259
|
-
succeed: () => {
|
|
1260
|
-
this.getNode(t).childrenStates.isLoaded = !0;
|
|
1261
|
-
},
|
|
1262
|
-
fail: (n) => {
|
|
1263
|
-
this.getNode(t).childrenStates.loadingError = k(n);
|
|
1264
|
-
},
|
|
1265
|
-
end: () => {
|
|
1266
|
-
this.getNode(t).childrenStates.isLoading = !1;
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
},
|
|
1270
|
-
callLoadOptionsProp({ action: e, args: t, isPending: s, start: n, succeed: i, fail: o, end: l }) {
|
|
1271
|
-
if (!this.loadOptions || s())
|
|
1272
|
-
return;
|
|
1273
|
-
n();
|
|
1274
|
-
const u = Ee((h, g) => {
|
|
1275
|
-
h ? o(h) : i(g), l();
|
|
1276
|
-
}), f = this.loadOptions({
|
|
1277
|
-
id: this.getInstanceId(),
|
|
1278
|
-
instanceId: this.getInstanceId(),
|
|
1279
|
-
action: e,
|
|
1280
|
-
...t,
|
|
1281
|
-
callback: u
|
|
1282
|
-
});
|
|
1283
|
-
se(f) && f.then(
|
|
1284
|
-
() => {
|
|
1285
|
-
u();
|
|
1286
|
-
},
|
|
1287
|
-
(h) => {
|
|
1288
|
-
u(h);
|
|
1289
|
-
}
|
|
1290
|
-
).catch((h) => {
|
|
1291
|
-
console.error(h);
|
|
1292
|
-
});
|
|
1293
|
-
},
|
|
1294
|
-
checkDuplication(e) {
|
|
1295
|
-
_(
|
|
1296
|
-
() => !(e.id in this.forest.nodeMap && !this.forest.nodeMap[e.id].isFallbackNode),
|
|
1297
|
-
() => `Detected duplicate presence of node id ${JSON.stringify(e.id)}. Their labels are "${this.forest.nodeMap[e.id].label}" and "${e.label}" respectively.`
|
|
1298
|
-
);
|
|
1299
|
-
},
|
|
1300
|
-
verifyNodeShape(e) {
|
|
1301
|
-
_(
|
|
1302
|
-
() => !(e.children === void 0 && e.isBranch === !0),
|
|
1303
|
-
() => "Are you meant to declare an unloaded branch node? `isBranch: true` is no longer supported, please use `children: null` instead."
|
|
1304
|
-
);
|
|
1305
|
-
},
|
|
1306
|
-
select(e) {
|
|
1307
|
-
if (this.disabled || e.isDisabled)
|
|
1308
|
-
return;
|
|
1309
|
-
this.single && this.clear();
|
|
1310
|
-
const t = this.multiple && !this.flat ? this.forest.checkedStateMap[e.id] === q : !this.isSelected(e);
|
|
1311
|
-
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));
|
|
1312
|
-
},
|
|
1313
|
-
clear() {
|
|
1314
|
-
this.hasValue && (this.single || this.allowClearingDisabled ? this.forest.selectedNodeIds = [] : this.forest.selectedNodeIds = this.forest.selectedNodeIds.filter((e) => this.getNode(e).isDisabled), this.buildForestState());
|
|
1315
|
-
},
|
|
1316
|
-
// This is meant to be called only by `select()`.
|
|
1317
|
-
_selectNode(e) {
|
|
1318
|
-
if (this.single || this.disableBranchNodes)
|
|
1319
|
-
return this.addValue(e);
|
|
1320
|
-
if (this.flat) {
|
|
1321
|
-
this.addValue(e), this.autoSelectAncestors ? e.ancestors.forEach((s) => {
|
|
1322
|
-
!this.isSelected(s) && !s.isDisabled && this.addValue(s);
|
|
1323
|
-
}) : this.autoSelectDescendants && this.traverseDescendantsBFS(e, (s) => {
|
|
1324
|
-
!this.isSelected(s) && !s.isDisabled && this.addValue(s);
|
|
1325
|
-
});
|
|
1326
|
-
return;
|
|
1327
|
-
}
|
|
1328
|
-
const t = e.isLeaf || /* node.isBranch && */
|
|
1329
|
-
!e.hasDisabledDescendants || /* node.isBranch && */
|
|
1330
|
-
this.allowSelectingDisabledDescendants;
|
|
1331
|
-
if (t && this.addValue(e), e.isBranch && this.traverseDescendantsBFS(e, (s) => {
|
|
1332
|
-
(!s.isDisabled || this.allowSelectingDisabledDescendants) && this.addValue(s);
|
|
1333
|
-
}), t) {
|
|
1334
|
-
let s = e;
|
|
1335
|
-
for (; (s = s.parentNode) !== b && s.children.every(this.isSelected); )
|
|
1336
|
-
this.addValue(s);
|
|
1337
|
-
}
|
|
1338
|
-
},
|
|
1339
|
-
// This is meant to be called only by `select()`.
|
|
1340
|
-
_deselectNode(e) {
|
|
1341
|
-
if (this.disableBranchNodes)
|
|
1342
|
-
return this.removeValue(e);
|
|
1343
|
-
if (this.flat) {
|
|
1344
|
-
this.removeValue(e), this.autoDeselectAncestors ? e.ancestors.forEach((s) => {
|
|
1345
|
-
this.isSelected(s) && !s.isDisabled && this.removeValue(s);
|
|
1346
|
-
}) : this.autoDeselectDescendants && this.traverseDescendantsBFS(e, (s) => {
|
|
1347
|
-
this.isSelected(s) && !s.isDisabled && this.removeValue(s);
|
|
1348
|
-
});
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
let t = !1;
|
|
1352
|
-
if (e.isBranch && this.traverseDescendantsDFS(e, (s) => {
|
|
1353
|
-
(!s.isDisabled || this.allowSelectingDisabledDescendants) && (this.removeValue(s), t = !0);
|
|
1354
|
-
}), e.isLeaf || /* node.isBranch && */
|
|
1355
|
-
t || /* node.isBranch && */
|
|
1356
|
-
e.children.length === 0) {
|
|
1357
|
-
this.removeValue(e);
|
|
1358
|
-
let s = e;
|
|
1359
|
-
for (; (s = s.parentNode) !== b && this.isSelected(s); )
|
|
1360
|
-
this.removeValue(s);
|
|
1361
|
-
}
|
|
1362
|
-
},
|
|
1363
|
-
addValue(e) {
|
|
1364
|
-
this.forest.selectedNodeIds.push(e.id), this.forest.selectedNodeMap[e.id] = !0;
|
|
1365
|
-
},
|
|
1366
|
-
removeValue(e) {
|
|
1367
|
-
ne(this.forest.selectedNodeIds, e.id), delete this.forest.selectedNodeMap[e.id];
|
|
1368
|
-
},
|
|
1369
|
-
removeLastValue() {
|
|
1370
|
-
if (!this.hasValue) return;
|
|
1371
|
-
if (this.single) return this.clear();
|
|
1372
|
-
const e = Y(this.internalValue), t = this.getNode(e);
|
|
1373
|
-
this.select(t);
|
|
1374
|
-
},
|
|
1375
|
-
saveMenuScrollPosition() {
|
|
1376
|
-
const e = this.getMenu();
|
|
1377
|
-
e && (this.menu.lastScrollPosition = e.scrollTop);
|
|
1378
|
-
},
|
|
1379
|
-
restoreMenuScrollPosition() {
|
|
1380
|
-
const e = this.getMenu();
|
|
1381
|
-
e && (e.scrollTop = this.menu.lastScrollPosition);
|
|
1382
|
-
}
|
|
1383
|
-
},
|
|
1384
|
-
created() {
|
|
1385
|
-
this.verifyProps(), this.resetFlags();
|
|
1386
|
-
},
|
|
1387
|
-
mounted() {
|
|
1388
|
-
this.autoFocus && this.focusInput(), !this.options && !this.async && this.autoLoadRootOptions && this.loadRootOptions(), this.alwaysOpen && this.openMenu(), this.async && this.defaultOptions && this.handleRemoteSearch();
|
|
1389
|
-
},
|
|
1390
|
-
destroyed() {
|
|
1391
|
-
this.toggleClickOutsideEvent(!1);
|
|
1392
|
-
}
|
|
1393
|
-
};
|
|
1394
|
-
function je(e) {
|
|
1395
|
-
return typeof e == "string" ? e : e != null && !le(e) ? JSON.stringify(e) : "";
|
|
1396
|
-
}
|
|
1397
|
-
const Qe = {
|
|
1398
|
-
name: "VueTreeSelectHiddenFields",
|
|
1399
|
-
functional: !0,
|
|
1400
|
-
inject: ["instance"],
|
|
1401
|
-
render(e, t) {
|
|
1402
|
-
const {
|
|
1403
|
-
instance: s
|
|
1404
|
-
} = t.injections;
|
|
1405
|
-
if (!s.name || s.disabled || !s.hasValue) return null;
|
|
1406
|
-
let n = s.internalValue.map(je);
|
|
1407
|
-
return s.multiple && s.joinValues && (n = [n.join(s.delimiter)]), n.map((i, o) => r("input", {
|
|
1408
|
-
attrs: {
|
|
1409
|
-
type: "hidden",
|
|
1410
|
-
name: s.name
|
|
1411
|
-
},
|
|
1412
|
-
domProps: {
|
|
1413
|
-
value: i
|
|
1414
|
-
},
|
|
1415
|
-
key: `hidden-field-${o}`
|
|
1416
|
-
}));
|
|
1417
|
-
}
|
|
1418
|
-
}, Ke = null, qe = null;
|
|
1419
|
-
var Ue = /* @__PURE__ */ m(
|
|
1420
|
-
Qe,
|
|
1421
|
-
Ke,
|
|
1422
|
-
qe,
|
|
1423
|
-
!1,
|
|
1424
|
-
null,
|
|
1425
|
-
null
|
|
1426
|
-
);
|
|
1427
|
-
const Ye = Ue.exports, Xe = [d.ENTER, d.END, d.HOME, d.ARROW_LEFT, d.ARROW_UP, d.ARROW_RIGHT, d.ARROW_DOWN], Ge = {
|
|
1428
|
-
name: "VueTreeSelectInput",
|
|
1429
|
-
inject: ["instance"],
|
|
1430
|
-
data: () => ({
|
|
1431
|
-
inputWidth: Z,
|
|
1432
|
-
value: ""
|
|
1433
|
-
}),
|
|
1434
|
-
computed: {
|
|
1435
|
-
needAutoSize() {
|
|
1436
|
-
const {
|
|
1437
|
-
instance: e
|
|
1438
|
-
} = this;
|
|
1439
|
-
return e.searchable && !e.disabled && e.multiple;
|
|
1440
|
-
},
|
|
1441
|
-
inputStyle() {
|
|
1442
|
-
return {
|
|
1443
|
-
width: this.needAutoSize ? `${this.inputWidth}px` : null
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
},
|
|
1447
|
-
watch: {
|
|
1448
|
-
"instance.trigger.searchQuery"(e) {
|
|
1449
|
-
this.value = e;
|
|
1450
|
-
},
|
|
1451
|
-
value() {
|
|
1452
|
-
this.needAutoSize && this.$nextTick(this.updateInputWidth);
|
|
1453
|
-
}
|
|
1454
|
-
},
|
|
1455
|
-
created() {
|
|
1456
|
-
this.debouncedCallback = we(this.updateSearchQuery, Fe, {
|
|
1457
|
-
leading: !0,
|
|
1458
|
-
trailing: !0
|
|
1459
|
-
});
|
|
1460
|
-
},
|
|
1461
|
-
methods: {
|
|
1462
|
-
clear() {
|
|
1463
|
-
this.onInput({
|
|
1464
|
-
target: {
|
|
1465
|
-
value: ""
|
|
1466
|
-
}
|
|
1467
|
-
});
|
|
1468
|
-
},
|
|
1469
|
-
focus() {
|
|
1470
|
-
var t;
|
|
1471
|
-
const {
|
|
1472
|
-
instance: e
|
|
1473
|
-
} = this;
|
|
1474
|
-
e.disabled || (t = this.$refs.input) == null || t.focus();
|
|
1475
|
-
},
|
|
1476
|
-
blur() {
|
|
1477
|
-
var e;
|
|
1478
|
-
(e = this.$refs.input) == null || e.blur();
|
|
1479
|
-
},
|
|
1480
|
-
onFocus() {
|
|
1481
|
-
const {
|
|
1482
|
-
instance: e
|
|
1483
|
-
} = this;
|
|
1484
|
-
e.trigger.isFocused = !0, e.openOnFocus && e.openMenu();
|
|
1485
|
-
},
|
|
1486
|
-
onBlur() {
|
|
1487
|
-
const {
|
|
1488
|
-
instance: e
|
|
1489
|
-
} = this, t = e.getMenu();
|
|
1490
|
-
if (t && document.activeElement === t)
|
|
1491
|
-
return this.focus();
|
|
1492
|
-
e.trigger.isFocused = !1, e.closeMenu();
|
|
1493
|
-
},
|
|
1494
|
-
onInput(e) {
|
|
1495
|
-
const {
|
|
1496
|
-
value: t
|
|
1497
|
-
} = e.target;
|
|
1498
|
-
this.value = t, t ? this.debouncedCallback() : (this.debouncedCallback.cancel(), this.updateSearchQuery());
|
|
1499
|
-
},
|
|
1500
|
-
// 用 keyUp 事件存在一个问题,删除输入框最后一个字符也会导致取消选中最后一项
|
|
1501
|
-
onKeyDown(e) {
|
|
1502
|
-
const {
|
|
1503
|
-
instance: t
|
|
1504
|
-
} = this, s = "which" in e ? e.which : (
|
|
1505
|
-
/* istanbul ignore next */
|
|
1506
|
-
e.keyCode
|
|
1507
|
-
);
|
|
1508
|
-
if (!(e.ctrlKey || e.shiftKey || e.altKey || e.metaKey)) {
|
|
1509
|
-
if (!t.menu.isOpen && O(Xe, s))
|
|
1510
|
-
return e.preventDefault(), t.openMenu();
|
|
1511
|
-
switch (s) {
|
|
1512
|
-
case d.BACKSPACE: {
|
|
1513
|
-
t.backspaceRemoves && !this.value.length && t.removeLastValue();
|
|
1514
|
-
break;
|
|
1515
|
-
}
|
|
1516
|
-
case d.ENTER: {
|
|
1517
|
-
if (e.preventDefault(), t.menu.current === null) return;
|
|
1518
|
-
const n = t.getNode(t.menu.current);
|
|
1519
|
-
if (n.isBranch && t.disableBranchNodes) return;
|
|
1520
|
-
t.select(n);
|
|
1521
|
-
break;
|
|
1522
|
-
}
|
|
1523
|
-
case d.ESCAPE: {
|
|
1524
|
-
this.value.length ? this.clear() : t.menu.isOpen && t.closeMenu();
|
|
1525
|
-
break;
|
|
1526
|
-
}
|
|
1527
|
-
case d.END: {
|
|
1528
|
-
e.preventDefault(), t.highlightLastOption();
|
|
1529
|
-
break;
|
|
1530
|
-
}
|
|
1531
|
-
case d.HOME: {
|
|
1532
|
-
e.preventDefault(), t.highlightFirstOption();
|
|
1533
|
-
break;
|
|
1534
|
-
}
|
|
1535
|
-
case d.ARROW_LEFT: {
|
|
1536
|
-
const n = t.getNode(t.menu.current);
|
|
1537
|
-
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));
|
|
1538
|
-
break;
|
|
1539
|
-
}
|
|
1540
|
-
case d.ARROW_UP: {
|
|
1541
|
-
e.preventDefault(), t.highlightPrevOption();
|
|
1542
|
-
break;
|
|
1543
|
-
}
|
|
1544
|
-
case d.ARROW_RIGHT: {
|
|
1545
|
-
const n = t.getNode(t.menu.current);
|
|
1546
|
-
n.isBranch && !t.shouldExpand(n) && (e.preventDefault(), t.toggleExpanded(n));
|
|
1547
|
-
break;
|
|
1548
|
-
}
|
|
1549
|
-
case d.ARROW_DOWN: {
|
|
1550
|
-
e.preventDefault(), t.highlightNextOption();
|
|
1551
|
-
break;
|
|
1552
|
-
}
|
|
1553
|
-
case d.DELETE: {
|
|
1554
|
-
t.deleteRemoves && !this.value.length && t.removeLastValue();
|
|
1555
|
-
break;
|
|
1556
|
-
}
|
|
1557
|
-
default:
|
|
1558
|
-
t.openMenu();
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
},
|
|
1562
|
-
onMouseDown(e) {
|
|
1563
|
-
this.value.length && e.stopPropagation();
|
|
1564
|
-
},
|
|
1565
|
-
renderInputContainer() {
|
|
1566
|
-
const {
|
|
1567
|
-
instance: e
|
|
1568
|
-
} = this, t = {}, s = [];
|
|
1569
|
-
return e.searchable && !e.disabled && (s.push(this.renderInput()), this.needAutoSize && s.push(this.renderSizer())), e.searchable || K(t, {
|
|
1570
|
-
on: {
|
|
1571
|
-
focus: this.onFocus,
|
|
1572
|
-
blur: this.onBlur,
|
|
1573
|
-
keydown: this.onKeyDown
|
|
1574
|
-
},
|
|
1575
|
-
ref: "input"
|
|
1576
|
-
}), !e.searchable && !e.disabled && K(t, {
|
|
1577
|
-
attrs: {
|
|
1578
|
-
tabIndex: e.tabIndex
|
|
1579
|
-
}
|
|
1580
|
-
}), r("div", R([{
|
|
1581
|
-
class: "vue-treeselect__input-container"
|
|
1582
|
-
}, t]), [s]);
|
|
1583
|
-
},
|
|
1584
|
-
renderInput() {
|
|
1585
|
-
const {
|
|
1586
|
-
instance: e
|
|
1587
|
-
} = this;
|
|
1588
|
-
return r("input", {
|
|
1589
|
-
ref: "input",
|
|
1590
|
-
class: "vue-treeselect__input",
|
|
1591
|
-
attrs: {
|
|
1592
|
-
type: "text",
|
|
1593
|
-
autocomplete: "off",
|
|
1594
|
-
tabIndex: e.tabIndex,
|
|
1595
|
-
required: e.required && !e.hasValue
|
|
1596
|
-
},
|
|
1597
|
-
domProps: {
|
|
1598
|
-
value: this.value
|
|
1599
|
-
},
|
|
1600
|
-
style: this.inputStyle,
|
|
1601
|
-
on: {
|
|
1602
|
-
focus: this.onFocus,
|
|
1603
|
-
input: this.onInput,
|
|
1604
|
-
blur: this.onBlur,
|
|
1605
|
-
keydown: this.onKeyDown,
|
|
1606
|
-
mousedown: this.onMouseDown
|
|
1607
|
-
}
|
|
1608
|
-
});
|
|
1609
|
-
},
|
|
1610
|
-
renderSizer() {
|
|
1611
|
-
return r("div", {
|
|
1612
|
-
ref: "sizer",
|
|
1613
|
-
class: "vue-treeselect__sizer"
|
|
1614
|
-
}, [this.value]);
|
|
1615
|
-
},
|
|
1616
|
-
updateInputWidth() {
|
|
1617
|
-
this.inputWidth = Math.max(Z, this.$refs.sizer.scrollWidth + 15);
|
|
1618
|
-
},
|
|
1619
|
-
updateSearchQuery() {
|
|
1620
|
-
const {
|
|
1621
|
-
instance: e
|
|
1622
|
-
} = this;
|
|
1623
|
-
e.trigger.searchQuery = this.value;
|
|
1624
|
-
}
|
|
1625
|
-
},
|
|
1626
|
-
render() {
|
|
1627
|
-
return this.renderInputContainer();
|
|
1628
|
-
}
|
|
1629
|
-
}, Je = null, Ze = null;
|
|
1630
|
-
var et = /* @__PURE__ */ m(
|
|
1631
|
-
Ge,
|
|
1632
|
-
Je,
|
|
1633
|
-
Ze,
|
|
1634
|
-
!1,
|
|
1635
|
-
null,
|
|
1636
|
-
null
|
|
1637
|
-
);
|
|
1638
|
-
const pe = et.exports, tt = {
|
|
1639
|
-
name: "VueTreeSelectPlaceholder",
|
|
1640
|
-
inject: ["instance"],
|
|
1641
|
-
render() {
|
|
1642
|
-
const {
|
|
1643
|
-
instance: e
|
|
1644
|
-
} = this, t = {
|
|
1645
|
-
"vue-treeselect__placeholder": !0,
|
|
1646
|
-
"vue-treeselect-helper-zoom-effect-off": !0,
|
|
1647
|
-
"vue-treeselect-helper-hide": e.hasValue || e.trigger.searchQuery
|
|
1648
|
-
};
|
|
1649
|
-
return r("div", {
|
|
1650
|
-
class: t
|
|
1651
|
-
}, [e.placeholder]);
|
|
1652
|
-
}
|
|
1653
|
-
}, st = null, nt = null;
|
|
1654
|
-
var it = /* @__PURE__ */ m(
|
|
1655
|
-
tt,
|
|
1656
|
-
st,
|
|
1657
|
-
nt,
|
|
1658
|
-
!1,
|
|
1659
|
-
null,
|
|
1660
|
-
null
|
|
1661
|
-
);
|
|
1662
|
-
const fe = it.exports, rt = {
|
|
1663
|
-
name: "VueTreeSelectSingleValue",
|
|
1664
|
-
inject: ["instance"],
|
|
1665
|
-
methods: {
|
|
1666
|
-
renderSingleValueLabel() {
|
|
1667
|
-
const {
|
|
1668
|
-
instance: e
|
|
1669
|
-
} = this, t = e.selectedNodes[0], s = e.$scopedSlots["value-label"];
|
|
1670
|
-
return s ? s({
|
|
1671
|
-
node: t
|
|
1672
|
-
}) : t.label;
|
|
1673
|
-
}
|
|
1674
|
-
},
|
|
1675
|
-
render() {
|
|
1676
|
-
const {
|
|
1677
|
-
instance: e,
|
|
1678
|
-
$parent: {
|
|
1679
|
-
renderValueContainer: t
|
|
1680
|
-
}
|
|
1681
|
-
} = this, s = e.hasValue && !e.trigger.searchQuery;
|
|
1682
|
-
return t([s && r("div", {
|
|
1683
|
-
class: "vue-treeselect__single-value"
|
|
1684
|
-
}, [this.renderSingleValueLabel()]), r(fe), r(pe, {
|
|
1685
|
-
ref: "input"
|
|
1686
|
-
})]);
|
|
1687
|
-
}
|
|
1688
|
-
}, ot = null, lt = null;
|
|
1689
|
-
var at = /* @__PURE__ */ m(
|
|
1690
|
-
rt,
|
|
1691
|
-
ot,
|
|
1692
|
-
lt,
|
|
1693
|
-
!1,
|
|
1694
|
-
null,
|
|
1695
|
-
null
|
|
1696
|
-
);
|
|
1697
|
-
const ct = at.exports, ut = {
|
|
1698
|
-
name: "VueTreeSelectDelete"
|
|
1699
|
-
};
|
|
1700
|
-
var ht = function() {
|
|
1701
|
-
var t = this, s = t._self._c;
|
|
1702
|
-
return s("svg", { attrs: { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 348.333 348.333" } }, [s("path", { attrs: { 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" } })]);
|
|
1703
|
-
}, dt = [], pt = /* @__PURE__ */ m(
|
|
1704
|
-
ut,
|
|
1705
|
-
ht,
|
|
1706
|
-
dt,
|
|
1707
|
-
!1,
|
|
1708
|
-
null,
|
|
1709
|
-
null
|
|
1710
|
-
);
|
|
1711
|
-
const me = pt.exports, ft = {
|
|
1712
|
-
name: "VueTreeSelectMultiValueItem",
|
|
1713
|
-
inject: ["instance"],
|
|
1714
|
-
props: {
|
|
1715
|
-
node: {
|
|
1716
|
-
type: Object,
|
|
1717
|
-
required: !0
|
|
1718
|
-
}
|
|
1719
|
-
},
|
|
1720
|
-
methods: {
|
|
1721
|
-
handleMouseDown: N(function() {
|
|
1722
|
-
const {
|
|
1723
|
-
instance: t,
|
|
1724
|
-
node: s
|
|
1725
|
-
} = this;
|
|
1726
|
-
t.select(s);
|
|
1727
|
-
})
|
|
1728
|
-
},
|
|
1729
|
-
render() {
|
|
1730
|
-
const {
|
|
1731
|
-
instance: e,
|
|
1732
|
-
node: t
|
|
1733
|
-
} = this, s = {
|
|
1734
|
-
"vue-treeselect__multi-value-item": !0,
|
|
1735
|
-
"vue-treeselect__multi-value-item-disabled": t.isDisabled,
|
|
1736
|
-
"vue-treeselect__multi-value-item-new": t.isNew
|
|
1737
|
-
}, n = e.$scopedSlots["value-label"], i = n ? n({
|
|
1738
|
-
node: t
|
|
1739
|
-
}) : t.label;
|
|
1740
|
-
return r("div", {
|
|
1741
|
-
class: "vue-treeselect__multi-value-item-container"
|
|
1742
|
-
}, [r("div", {
|
|
1743
|
-
class: s,
|
|
1744
|
-
on: {
|
|
1745
|
-
mousedown: this.handleMouseDown
|
|
1746
|
-
}
|
|
1747
|
-
}, [r("span", {
|
|
1748
|
-
class: "vue-treeselect__multi-value-label"
|
|
1749
|
-
}, [i]), r("span", {
|
|
1750
|
-
class: "vue-treeselect__icon vue-treeselect__value-remove"
|
|
1751
|
-
}, [r(me)])])]);
|
|
1752
|
-
}
|
|
1753
|
-
}, mt = null, gt = null;
|
|
1754
|
-
var St = /* @__PURE__ */ m(
|
|
1755
|
-
ft,
|
|
1756
|
-
mt,
|
|
1757
|
-
gt,
|
|
1758
|
-
!1,
|
|
1759
|
-
null,
|
|
1760
|
-
null
|
|
1761
|
-
);
|
|
1762
|
-
const vt = St.exports, _t = {
|
|
1763
|
-
name: "VueTreeSelectMultiValue",
|
|
1764
|
-
inject: ["instance"],
|
|
1765
|
-
methods: {
|
|
1766
|
-
renderMultiValueItems() {
|
|
1767
|
-
const {
|
|
1768
|
-
instance: e
|
|
1769
|
-
} = this;
|
|
1770
|
-
return e.internalValue.slice(0, e.limit).map(e.getNode).map((t) => r(vt, {
|
|
1771
|
-
key: `multi-value-item-${t.id}`,
|
|
1772
|
-
attrs: {
|
|
1773
|
-
node: t
|
|
1774
|
-
}
|
|
1775
|
-
}));
|
|
1776
|
-
},
|
|
1777
|
-
renderExceedLimitTip() {
|
|
1778
|
-
const {
|
|
1779
|
-
instance: e
|
|
1780
|
-
} = this, t = e.internalValue.length - e.limit;
|
|
1781
|
-
return t <= 0 ? null : r("div", {
|
|
1782
|
-
class: "vue-treeselect__limit-tip vue-treeselect-helper-zoom-effect-off",
|
|
1783
|
-
key: "exceed-limit-tip"
|
|
1784
|
-
}, [r("span", {
|
|
1785
|
-
class: "vue-treeselect__limit-tip-text"
|
|
1786
|
-
}, [e.limitText(t)])]);
|
|
1787
|
-
}
|
|
1788
|
-
},
|
|
1789
|
-
render() {
|
|
1790
|
-
const {
|
|
1791
|
-
renderValueContainer: e
|
|
1792
|
-
} = this.$parent;
|
|
1793
|
-
return e(r("transition-group", R([{
|
|
1794
|
-
class: "vue-treeselect__multi-value"
|
|
1795
|
-
}, {
|
|
1796
|
-
props: {
|
|
1797
|
-
tag: "div",
|
|
1798
|
-
name: "vue-treeselect__multi-value-item--transition",
|
|
1799
|
-
appear: !0
|
|
1800
|
-
}
|
|
1801
|
-
}]), [this.renderMultiValueItems(), this.renderExceedLimitTip(), r(fe, {
|
|
1802
|
-
key: "placeholder"
|
|
1803
|
-
}), r(pe, {
|
|
1804
|
-
ref: "input",
|
|
1805
|
-
key: "input"
|
|
1806
|
-
})]));
|
|
1807
|
-
}
|
|
1808
|
-
}, Ot = null, yt = null;
|
|
1809
|
-
var bt = /* @__PURE__ */ m(
|
|
1810
|
-
_t,
|
|
1811
|
-
Ot,
|
|
1812
|
-
yt,
|
|
1813
|
-
!1,
|
|
1814
|
-
null,
|
|
1815
|
-
null
|
|
1816
|
-
);
|
|
1817
|
-
const Nt = bt.exports, Et = {
|
|
1818
|
-
name: "VueTreeSelectArrow"
|
|
1819
|
-
};
|
|
1820
|
-
var wt = function() {
|
|
1821
|
-
var t = this, s = t._self._c;
|
|
1822
|
-
return s("svg", { attrs: { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 292.362 292.362" } }, [s("path", { attrs: { 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" } })]);
|
|
1823
|
-
}, Ct = [], Lt = /* @__PURE__ */ m(
|
|
1824
|
-
Et,
|
|
1825
|
-
wt,
|
|
1826
|
-
Ct,
|
|
1827
|
-
!1,
|
|
1828
|
-
null,
|
|
1829
|
-
null
|
|
1830
|
-
);
|
|
1831
|
-
const ge = Lt.exports, Tt = {
|
|
1832
|
-
name: "VueTreeSelectControl",
|
|
1833
|
-
inject: ["instance"],
|
|
1834
|
-
computed: {
|
|
1835
|
-
/**
|
|
1836
|
-
* Should show the "×" button that resets value?
|
|
1837
|
-
* @return {boolean}
|
|
1838
|
-
*/
|
|
1839
|
-
shouldShowX() {
|
|
1840
|
-
const {
|
|
1841
|
-
instance: e
|
|
1842
|
-
} = this;
|
|
1843
|
-
return e.clearable && !e.disabled && e.hasValue && (this.hasUndisabledValue || e.allowClearingDisabled);
|
|
1844
|
-
},
|
|
1845
|
-
/**
|
|
1846
|
-
* Should show the arrow button that toggles menu?
|
|
1847
|
-
* @return {boolean}
|
|
1848
|
-
*/
|
|
1849
|
-
shouldShowArrow() {
|
|
1850
|
-
const {
|
|
1851
|
-
instance: e
|
|
1852
|
-
} = this;
|
|
1853
|
-
return e.alwaysOpen ? !e.menu.isOpen : !0;
|
|
1854
|
-
},
|
|
1855
|
-
/**
|
|
1856
|
-
* Has any undisabled option been selected?
|
|
1857
|
-
* @type {boolean}
|
|
1858
|
-
*/
|
|
1859
|
-
hasUndisabledValue() {
|
|
1860
|
-
const {
|
|
1861
|
-
instance: e
|
|
1862
|
-
} = this;
|
|
1863
|
-
return e.hasValue && e.internalValue.some((t) => !e.getNode(t).isDisabled);
|
|
1864
|
-
}
|
|
1865
|
-
},
|
|
1866
|
-
methods: {
|
|
1867
|
-
renderX() {
|
|
1868
|
-
const {
|
|
1869
|
-
instance: e
|
|
1870
|
-
} = this, t = e.multiple ? e.clearAllText : e.clearValueText;
|
|
1871
|
-
return this.shouldShowX ? r("div", {
|
|
1872
|
-
class: "vue-treeselect__x-container",
|
|
1873
|
-
attrs: {
|
|
1874
|
-
title: t
|
|
1875
|
-
},
|
|
1876
|
-
on: {
|
|
1877
|
-
mousedown: this.handleMouseDownOnX
|
|
1878
|
-
}
|
|
1879
|
-
}, [r(me, {
|
|
1880
|
-
class: "vue-treeselect__x"
|
|
1881
|
-
})]) : null;
|
|
1882
|
-
},
|
|
1883
|
-
renderArrow() {
|
|
1884
|
-
const {
|
|
1885
|
-
instance: e
|
|
1886
|
-
} = this, t = {
|
|
1887
|
-
"vue-treeselect__control-arrow": !0,
|
|
1888
|
-
"vue-treeselect__control-arrow--rotated": e.menu.isOpen
|
|
1889
|
-
};
|
|
1890
|
-
return this.shouldShowArrow ? r("div", {
|
|
1891
|
-
class: "vue-treeselect__control-arrow-container",
|
|
1892
|
-
on: {
|
|
1893
|
-
mousedown: this.handleMouseDownOnArrow
|
|
1894
|
-
}
|
|
1895
|
-
}, [r(ge, {
|
|
1896
|
-
class: t
|
|
1897
|
-
})]) : null;
|
|
1898
|
-
},
|
|
1899
|
-
handleMouseDownOnX: N(function(t) {
|
|
1900
|
-
t.stopPropagation(), t.preventDefault();
|
|
1901
|
-
const {
|
|
1902
|
-
instance: s
|
|
1903
|
-
} = this, n = s.beforeClearAll(), i = (o) => {
|
|
1904
|
-
o && s.clear();
|
|
1905
|
-
};
|
|
1906
|
-
se(n) ? n.then(i) : setTimeout(() => i(n), 0);
|
|
1907
|
-
}),
|
|
1908
|
-
handleMouseDownOnArrow: N(function(t) {
|
|
1909
|
-
t.preventDefault(), t.stopPropagation();
|
|
1910
|
-
const {
|
|
1911
|
-
instance: s
|
|
1912
|
-
} = this;
|
|
1913
|
-
s.focusInput(), s.toggleMenu();
|
|
1914
|
-
}),
|
|
1915
|
-
// This is meant to be called by child `<Value />` component.
|
|
1916
|
-
renderValueContainer(e) {
|
|
1917
|
-
return r("div", {
|
|
1918
|
-
class: "vue-treeselect__value-container"
|
|
1919
|
-
}, [e]);
|
|
1920
|
-
}
|
|
1921
|
-
},
|
|
1922
|
-
render() {
|
|
1923
|
-
const {
|
|
1924
|
-
instance: e
|
|
1925
|
-
} = this, t = e.single ? ct : Nt;
|
|
1926
|
-
return r("div", {
|
|
1927
|
-
class: "vue-treeselect__control",
|
|
1928
|
-
on: {
|
|
1929
|
-
mousedown: e.handleMouseDown
|
|
1930
|
-
}
|
|
1931
|
-
}, [r(t, {
|
|
1932
|
-
ref: "value-container"
|
|
1933
|
-
}), this.renderX(), this.renderArrow()]);
|
|
1934
|
-
}
|
|
1935
|
-
}, Mt = null, Dt = null;
|
|
1936
|
-
var Rt = /* @__PURE__ */ m(
|
|
1937
|
-
Tt,
|
|
1938
|
-
Mt,
|
|
1939
|
-
Dt,
|
|
1940
|
-
!1,
|
|
1941
|
-
null,
|
|
1942
|
-
null
|
|
1943
|
-
);
|
|
1944
|
-
const xt = Rt.exports, $t = {
|
|
1945
|
-
name: "VueTreeSelectTip",
|
|
1946
|
-
functional: !0,
|
|
1947
|
-
props: {
|
|
1948
|
-
type: {
|
|
1949
|
-
type: String,
|
|
1950
|
-
required: !0
|
|
1951
|
-
},
|
|
1952
|
-
icon: {
|
|
1953
|
-
type: String,
|
|
1954
|
-
required: !0
|
|
1955
|
-
}
|
|
1956
|
-
},
|
|
1957
|
-
render(e, t) {
|
|
1958
|
-
const {
|
|
1959
|
-
props: s,
|
|
1960
|
-
children: n
|
|
1961
|
-
} = t;
|
|
1962
|
-
return r("div", {
|
|
1963
|
-
class: `vue-treeselect__tip vue-treeselect__${s.type}-tip`
|
|
1964
|
-
}, [r("div", {
|
|
1965
|
-
class: "vue-treeselect__icon-container"
|
|
1966
|
-
}, [r("span", {
|
|
1967
|
-
class: `vue-treeselect__icon-${s.icon}`
|
|
1968
|
-
})]), r("span", {
|
|
1969
|
-
class: `vue-treeselect__tip-text vue-treeselect__${s.type}-tip-text`
|
|
1970
|
-
}, [n])]);
|
|
1971
|
-
}
|
|
1972
|
-
}, It = null, At = null;
|
|
1973
|
-
var Vt = /* @__PURE__ */ m(
|
|
1974
|
-
$t,
|
|
1975
|
-
It,
|
|
1976
|
-
At,
|
|
1977
|
-
!1,
|
|
1978
|
-
null,
|
|
1979
|
-
null
|
|
1980
|
-
);
|
|
1981
|
-
const v = Vt.exports;
|
|
1982
|
-
let H, P, W;
|
|
1983
|
-
const Se = {
|
|
1984
|
-
name: "VueTreeSelectOption",
|
|
1985
|
-
inject: ["instance"],
|
|
1986
|
-
props: {
|
|
1987
|
-
node: {
|
|
1988
|
-
type: Object,
|
|
1989
|
-
required: !0
|
|
1990
|
-
}
|
|
1991
|
-
},
|
|
1992
|
-
computed: {
|
|
1993
|
-
shouldExpand() {
|
|
1994
|
-
const {
|
|
1995
|
-
instance: e,
|
|
1996
|
-
node: t
|
|
1997
|
-
} = this;
|
|
1998
|
-
return t.isBranch && e.shouldExpand(t);
|
|
1999
|
-
},
|
|
2000
|
-
shouldShow() {
|
|
2001
|
-
const {
|
|
2002
|
-
instance: e,
|
|
2003
|
-
node: t
|
|
2004
|
-
} = this;
|
|
2005
|
-
return e.shouldShowOptionInMenu(t);
|
|
2006
|
-
}
|
|
2007
|
-
},
|
|
2008
|
-
methods: {
|
|
2009
|
-
renderOption() {
|
|
2010
|
-
const {
|
|
2011
|
-
instance: e,
|
|
2012
|
-
node: t
|
|
2013
|
-
} = this, s = {
|
|
2014
|
-
"vue-treeselect__option": !0,
|
|
2015
|
-
"vue-treeselect__option--disabled": t.isDisabled,
|
|
2016
|
-
"vue-treeselect__option--selected": e.isSelected(t),
|
|
2017
|
-
"vue-treeselect__option--highlight": t.isHighlighted,
|
|
2018
|
-
"vue-treeselect__option--matched": e.localSearch.active && t.isMatched,
|
|
2019
|
-
"vue-treeselect__option--hide": !this.shouldShow
|
|
2020
|
-
};
|
|
2021
|
-
return r("div", {
|
|
2022
|
-
class: s,
|
|
2023
|
-
on: {
|
|
2024
|
-
mouseenter: this.handleMouseEnterOption
|
|
2025
|
-
},
|
|
2026
|
-
attrs: {
|
|
2027
|
-
"data-id": t.id
|
|
2028
|
-
}
|
|
2029
|
-
}, [this.renderArrow(), this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]), this.renderLabel()])]);
|
|
2030
|
-
},
|
|
2031
|
-
renderSubOptionsList() {
|
|
2032
|
-
return this.shouldExpand ? r("div", {
|
|
2033
|
-
class: "vue-treeselect__list"
|
|
2034
|
-
}, [this.renderSubOptions(), this.renderNoChildrenTip(), this.renderLoadingChildrenTip(), this.renderLoadingChildrenErrorTip()]) : null;
|
|
2035
|
-
},
|
|
2036
|
-
renderArrow() {
|
|
2037
|
-
const {
|
|
2038
|
-
instance: e,
|
|
2039
|
-
node: t
|
|
2040
|
-
} = this;
|
|
2041
|
-
if (e.shouldFlattenOptions && this.shouldShow) return null;
|
|
2042
|
-
if (t.isBranch) {
|
|
2043
|
-
const s = {
|
|
2044
|
-
props: {
|
|
2045
|
-
name: "vue-treeselect__option-arrow--prepare",
|
|
2046
|
-
appear: !0
|
|
2047
|
-
}
|
|
2048
|
-
}, n = {
|
|
2049
|
-
"vue-treeselect__option-arrow": !0,
|
|
2050
|
-
"vue-treeselect__option-arrow--rotated": this.shouldExpand
|
|
2051
|
-
};
|
|
2052
|
-
return r("div", {
|
|
2053
|
-
class: "vue-treeselect__option-arrow-container",
|
|
2054
|
-
on: {
|
|
2055
|
-
mousedown: this.handleMouseDownOnArrow
|
|
2056
|
-
}
|
|
2057
|
-
}, [r("transition", R([{}, s]), [r(ge, {
|
|
2058
|
-
class: n
|
|
2059
|
-
})])]);
|
|
2060
|
-
}
|
|
2061
|
-
return (
|
|
2062
|
-
/* node.isLeaf && */
|
|
2063
|
-
e.hasBranchNodes ? (H || (H = r("div", {
|
|
2064
|
-
class: "vue-treeselect__option-arrow-placeholder"
|
|
2065
|
-
}, [" "])), H) : null
|
|
2066
|
-
);
|
|
2067
|
-
},
|
|
2068
|
-
renderLabelContainer(e) {
|
|
2069
|
-
return r("div", {
|
|
2070
|
-
class: "vue-treeselect__label-container",
|
|
2071
|
-
on: {
|
|
2072
|
-
mousedown: this.handleMouseDownOnLabelContainer
|
|
2073
|
-
}
|
|
2074
|
-
}, [e]);
|
|
2075
|
-
},
|
|
2076
|
-
renderCheckboxContainer(e) {
|
|
2077
|
-
const {
|
|
2078
|
-
instance: t,
|
|
2079
|
-
node: s
|
|
2080
|
-
} = this;
|
|
2081
|
-
return t.single || t.disableBranchNodes && s.isBranch ? null : r("div", {
|
|
2082
|
-
class: "vue-treeselect__checkbox-container"
|
|
2083
|
-
}, [e]);
|
|
2084
|
-
},
|
|
2085
|
-
renderCheckbox() {
|
|
2086
|
-
const {
|
|
2087
|
-
instance: e,
|
|
2088
|
-
node: t
|
|
2089
|
-
} = this, s = e.forest.checkedStateMap[t.id], n = {
|
|
2090
|
-
"vue-treeselect__checkbox": !0,
|
|
2091
|
-
"vue-treeselect__checkbox--checked": s === he,
|
|
2092
|
-
"vue-treeselect__checkbox--indeterminate": s === ue,
|
|
2093
|
-
"vue-treeselect__checkbox--unchecked": s === q,
|
|
2094
|
-
"vue-treeselect__checkbox--disabled": t.isDisabled
|
|
2095
|
-
};
|
|
2096
|
-
return P || (P = r("span", {
|
|
2097
|
-
class: "vue-treeselect__check-mark"
|
|
2098
|
-
})), W || (W = r("span", {
|
|
2099
|
-
class: "vue-treeselect__minus-mark"
|
|
2100
|
-
})), r("span", {
|
|
2101
|
-
class: n
|
|
2102
|
-
}, [P, W]);
|
|
2103
|
-
},
|
|
2104
|
-
renderLabel() {
|
|
2105
|
-
const {
|
|
2106
|
-
instance: e,
|
|
2107
|
-
node: t
|
|
2108
|
-
} = this, s = t.isBranch && (e.localSearch.active ? e.showCountOnSearchComputed : e.showCount), n = s ? e.localSearch.active ? e.localSearch.countMap[t.id][e.showCountOf] : t.count[e.showCountOf] : NaN, i = "vue-treeselect__label", o = "vue-treeselect__count", l = e.$scopedSlots["option-label"];
|
|
2109
|
-
return l ? l({
|
|
2110
|
-
node: t,
|
|
2111
|
-
shouldShowCount: s,
|
|
2112
|
-
count: n,
|
|
2113
|
-
labelClassName: i,
|
|
2114
|
-
countClassName: o
|
|
2115
|
-
}) : r("label", {
|
|
2116
|
-
class: i
|
|
2117
|
-
}, [t.label, s && r("span", {
|
|
2118
|
-
class: o
|
|
2119
|
-
}, ["(", n, ")"])]);
|
|
2120
|
-
},
|
|
2121
|
-
renderSubOptions() {
|
|
2122
|
-
const {
|
|
2123
|
-
node: e
|
|
2124
|
-
} = this;
|
|
2125
|
-
return e.childrenStates.isLoaded ? e.children.map((t) => r(Se, {
|
|
2126
|
-
attrs: {
|
|
2127
|
-
node: t
|
|
2128
|
-
},
|
|
2129
|
-
key: t.id
|
|
2130
|
-
})) : null;
|
|
2131
|
-
},
|
|
2132
|
-
renderNoChildrenTip() {
|
|
2133
|
-
const {
|
|
2134
|
-
instance: e,
|
|
2135
|
-
node: t
|
|
2136
|
-
} = this;
|
|
2137
|
-
return !t.childrenStates.isLoaded || t.children.length ? null : r(v, {
|
|
2138
|
-
attrs: {
|
|
2139
|
-
type: "no-children",
|
|
2140
|
-
icon: "warning"
|
|
2141
|
-
}
|
|
2142
|
-
}, [e.noChildrenText]);
|
|
2143
|
-
},
|
|
2144
|
-
renderLoadingChildrenTip() {
|
|
2145
|
-
const {
|
|
2146
|
-
instance: e,
|
|
2147
|
-
node: t
|
|
2148
|
-
} = this;
|
|
2149
|
-
return t.childrenStates.isLoading ? r(v, {
|
|
2150
|
-
attrs: {
|
|
2151
|
-
type: "loading",
|
|
2152
|
-
icon: "loader"
|
|
2153
|
-
}
|
|
2154
|
-
}, [e.loadingText]) : null;
|
|
2155
|
-
},
|
|
2156
|
-
renderLoadingChildrenErrorTip() {
|
|
2157
|
-
const {
|
|
2158
|
-
instance: e,
|
|
2159
|
-
node: t
|
|
2160
|
-
} = this;
|
|
2161
|
-
return t.childrenStates.loadingError ? r(v, {
|
|
2162
|
-
attrs: {
|
|
2163
|
-
type: "error",
|
|
2164
|
-
icon: "error"
|
|
2165
|
-
}
|
|
2166
|
-
}, [t.childrenStates.loadingError, r("a", {
|
|
2167
|
-
class: "vue-treeselect__retry",
|
|
2168
|
-
attrs: {
|
|
2169
|
-
title: e.retryTitle
|
|
2170
|
-
},
|
|
2171
|
-
on: {
|
|
2172
|
-
mousedown: this.handleMouseDownOnRetry
|
|
2173
|
-
}
|
|
2174
|
-
}, [e.retryText])]) : null;
|
|
2175
|
-
},
|
|
2176
|
-
handleMouseEnterOption(e) {
|
|
2177
|
-
const {
|
|
2178
|
-
instance: t,
|
|
2179
|
-
node: s
|
|
2180
|
-
} = this;
|
|
2181
|
-
e.target === e.currentTarget && t.setCurrentHighlightedOption(s, !1);
|
|
2182
|
-
},
|
|
2183
|
-
handleMouseDownOnArrow: N(function() {
|
|
2184
|
-
const {
|
|
2185
|
-
instance: t,
|
|
2186
|
-
node: s
|
|
2187
|
-
} = this;
|
|
2188
|
-
t.toggleExpanded(s);
|
|
2189
|
-
}),
|
|
2190
|
-
handleMouseDownOnLabelContainer: N(function() {
|
|
2191
|
-
const {
|
|
2192
|
-
instance: t,
|
|
2193
|
-
node: s
|
|
2194
|
-
} = this;
|
|
2195
|
-
s.isBranch && t.disableBranchNodes ? t.toggleExpanded(s) : t.select(s);
|
|
2196
|
-
}),
|
|
2197
|
-
handleMouseDownOnRetry: N(function() {
|
|
2198
|
-
const {
|
|
2199
|
-
instance: t,
|
|
2200
|
-
node: s
|
|
2201
|
-
} = this;
|
|
2202
|
-
t.loadChildrenOptions(s);
|
|
2203
|
-
})
|
|
2204
|
-
},
|
|
2205
|
-
render() {
|
|
2206
|
-
const {
|
|
2207
|
-
node: e
|
|
2208
|
-
} = this, s = {
|
|
2209
|
-
"vue-treeselect__list-item": !0,
|
|
2210
|
-
[`vue-treeselect__indent-level-${this.instance.shouldFlattenOptions ? 0 : e.level}`]: !0
|
|
2211
|
-
}, n = {
|
|
2212
|
-
props: {
|
|
2213
|
-
name: "vue-treeselect__list--transition"
|
|
2214
|
-
}
|
|
2215
|
-
};
|
|
2216
|
-
return r("div", {
|
|
2217
|
-
class: s
|
|
2218
|
-
}, [this.renderOption(), e.isBranch && r("transition", R([{}, n]), [this.renderSubOptionsList()])]);
|
|
2219
|
-
}
|
|
2220
|
-
}, Bt = null, zt = null;
|
|
2221
|
-
var Ft = /* @__PURE__ */ m(
|
|
2222
|
-
Se,
|
|
2223
|
-
Bt,
|
|
2224
|
-
zt,
|
|
2225
|
-
!1,
|
|
2226
|
-
null,
|
|
2227
|
-
null
|
|
2228
|
-
);
|
|
2229
|
-
const kt = Ft.exports, Ht = {
|
|
2230
|
-
top: "top",
|
|
2231
|
-
bottom: "bottom",
|
|
2232
|
-
above: "top",
|
|
2233
|
-
below: "bottom"
|
|
2234
|
-
}, Pt = {
|
|
2235
|
-
name: "VueTreeSelectMenu",
|
|
2236
|
-
inject: ["instance"],
|
|
2237
|
-
computed: {
|
|
2238
|
-
menuStyle() {
|
|
2239
|
-
const {
|
|
2240
|
-
instance: e
|
|
2241
|
-
} = this;
|
|
2242
|
-
return {
|
|
2243
|
-
maxHeight: `${e.maxHeight}px`
|
|
2244
|
-
};
|
|
2245
|
-
},
|
|
2246
|
-
menuContainerStyle() {
|
|
2247
|
-
const {
|
|
2248
|
-
instance: e
|
|
2249
|
-
} = this;
|
|
2250
|
-
return {
|
|
2251
|
-
zIndex: e.appendToBody ? null : e.zIndex
|
|
2252
|
-
};
|
|
2253
|
-
}
|
|
2254
|
-
},
|
|
2255
|
-
watch: {
|
|
2256
|
-
"instance.menu.isOpen"(e) {
|
|
2257
|
-
e ? this.$nextTick(this.onMenuOpen) : this.onMenuClose();
|
|
2258
|
-
}
|
|
2259
|
-
},
|
|
2260
|
-
created() {
|
|
2261
|
-
this.menuSizeWatcher = null, this.menuResizeAndScrollEventListeners = null;
|
|
2262
|
-
},
|
|
2263
|
-
mounted() {
|
|
2264
|
-
const {
|
|
2265
|
-
instance: e
|
|
2266
|
-
} = this;
|
|
2267
|
-
e.menu.isOpen && this.$nextTick(this.onMenuOpen);
|
|
2268
|
-
},
|
|
2269
|
-
destroyed() {
|
|
2270
|
-
this.onMenuClose();
|
|
2271
|
-
},
|
|
2272
|
-
methods: {
|
|
2273
|
-
renderMenu() {
|
|
2274
|
-
const {
|
|
2275
|
-
instance: e
|
|
2276
|
-
} = this;
|
|
2277
|
-
return e.menu.isOpen ? r("div", {
|
|
2278
|
-
ref: "menu",
|
|
2279
|
-
class: "vue-treeselect__menu",
|
|
2280
|
-
on: {
|
|
2281
|
-
mousedown: e.handleMouseDown
|
|
2282
|
-
},
|
|
2283
|
-
style: this.menuStyle
|
|
2284
|
-
}, [this.renderBeforeList(), e.async ? this.renderAsyncSearchMenuInner() : e.localSearch.active ? this.renderLocalSearchMenuInner() : this.renderNormalMenuInner(), this.renderAfterList()]) : null;
|
|
2285
|
-
},
|
|
2286
|
-
renderBeforeList() {
|
|
2287
|
-
const {
|
|
2288
|
-
instance: e
|
|
2289
|
-
} = this, t = e.$scopedSlots["before-list"];
|
|
2290
|
-
return t ? t() : null;
|
|
2291
|
-
},
|
|
2292
|
-
renderAfterList() {
|
|
2293
|
-
const {
|
|
2294
|
-
instance: e
|
|
2295
|
-
} = this, t = e.$scopedSlots["after-list"];
|
|
2296
|
-
return t ? t() : null;
|
|
2297
|
-
},
|
|
2298
|
-
renderNormalMenuInner() {
|
|
2299
|
-
const {
|
|
2300
|
-
instance: e
|
|
2301
|
-
} = this;
|
|
2302
|
-
return e.rootOptionsStates.isLoading ? this.renderLoadingOptionsTip() : e.rootOptionsStates.loadingError ? this.renderLoadingRootOptionsErrorTip() : e.rootOptionsStates.isLoaded && e.forest.normalizedOptions.length === 0 ? this.renderNoAvailableOptionsTip() : this.renderOptionList();
|
|
2303
|
-
},
|
|
2304
|
-
renderLocalSearchMenuInner() {
|
|
2305
|
-
const {
|
|
2306
|
-
instance: e
|
|
2307
|
-
} = this;
|
|
2308
|
-
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();
|
|
2309
|
-
},
|
|
2310
|
-
renderAsyncSearchMenuInner() {
|
|
2311
|
-
const {
|
|
2312
|
-
instance: e
|
|
2313
|
-
} = this, t = e.getRemoteSearchEntry(), s = e.trigger.searchQuery === "" && !e.defaultOptions, n = s ? !1 : t.isLoaded && t.options.length === 0;
|
|
2314
|
-
return s ? this.renderSearchPromptTip() : t.isLoading ? this.renderLoadingOptionsTip() : t.loadingError ? this.renderAsyncSearchLoadingErrorTip() : n ? this.renderNoResultsTip() : this.renderOptionList();
|
|
2315
|
-
},
|
|
2316
|
-
renderOptionList() {
|
|
2317
|
-
const {
|
|
2318
|
-
instance: e
|
|
2319
|
-
} = this;
|
|
2320
|
-
return r("div", {
|
|
2321
|
-
class: "vue-treeselect__list"
|
|
2322
|
-
}, [e.forest.normalizedOptions.map((t) => r(kt, {
|
|
2323
|
-
attrs: {
|
|
2324
|
-
node: t
|
|
2325
|
-
},
|
|
2326
|
-
key: t.id
|
|
2327
|
-
}))]);
|
|
2328
|
-
},
|
|
2329
|
-
renderSearchPromptTip() {
|
|
2330
|
-
const {
|
|
2331
|
-
instance: e
|
|
2332
|
-
} = this;
|
|
2333
|
-
return r(v, {
|
|
2334
|
-
attrs: {
|
|
2335
|
-
type: "search-prompt",
|
|
2336
|
-
icon: "warning"
|
|
2337
|
-
}
|
|
2338
|
-
}, [e.searchPromptText]);
|
|
2339
|
-
},
|
|
2340
|
-
renderLoadingOptionsTip() {
|
|
2341
|
-
const {
|
|
2342
|
-
instance: e
|
|
2343
|
-
} = this;
|
|
2344
|
-
return r(v, {
|
|
2345
|
-
attrs: {
|
|
2346
|
-
type: "loading",
|
|
2347
|
-
icon: "loader"
|
|
2348
|
-
}
|
|
2349
|
-
}, [e.loadingText]);
|
|
2350
|
-
},
|
|
2351
|
-
renderLoadingRootOptionsErrorTip() {
|
|
2352
|
-
const {
|
|
2353
|
-
instance: e
|
|
2354
|
-
} = this;
|
|
2355
|
-
return r(v, {
|
|
2356
|
-
attrs: {
|
|
2357
|
-
type: "error",
|
|
2358
|
-
icon: "error"
|
|
2359
|
-
}
|
|
2360
|
-
}, [e.rootOptionsStates.loadingError, r("a", {
|
|
2361
|
-
class: "vue-treeselect__retry",
|
|
2362
|
-
on: {
|
|
2363
|
-
click: e.loadRootOptions
|
|
2364
|
-
},
|
|
2365
|
-
attrs: {
|
|
2366
|
-
title: e.retryTitle
|
|
2367
|
-
}
|
|
2368
|
-
}, [e.retryText])]);
|
|
2369
|
-
},
|
|
2370
|
-
renderAsyncSearchLoadingErrorTip() {
|
|
2371
|
-
const {
|
|
2372
|
-
instance: e
|
|
2373
|
-
} = this, t = e.getRemoteSearchEntry();
|
|
2374
|
-
return r(v, {
|
|
2375
|
-
attrs: {
|
|
2376
|
-
type: "error",
|
|
2377
|
-
icon: "error"
|
|
2378
|
-
}
|
|
2379
|
-
}, [t.loadingError, r("a", {
|
|
2380
|
-
class: "vue-treeselect__retry",
|
|
2381
|
-
on: {
|
|
2382
|
-
click: e.handleRemoteSearch
|
|
2383
|
-
},
|
|
2384
|
-
attrs: {
|
|
2385
|
-
title: e.retryTitle
|
|
2386
|
-
}
|
|
2387
|
-
}, [e.retryText])]);
|
|
2388
|
-
},
|
|
2389
|
-
renderNoAvailableOptionsTip() {
|
|
2390
|
-
const {
|
|
2391
|
-
instance: e
|
|
2392
|
-
} = this;
|
|
2393
|
-
return r(v, {
|
|
2394
|
-
attrs: {
|
|
2395
|
-
type: "no-options",
|
|
2396
|
-
icon: "warning"
|
|
2397
|
-
}
|
|
2398
|
-
}, [e.noOptionsText]);
|
|
2399
|
-
},
|
|
2400
|
-
renderNoResultsTip() {
|
|
2401
|
-
const {
|
|
2402
|
-
instance: e
|
|
2403
|
-
} = this;
|
|
2404
|
-
return r(v, {
|
|
2405
|
-
attrs: {
|
|
2406
|
-
type: "no-results",
|
|
2407
|
-
icon: "warning"
|
|
2408
|
-
}
|
|
2409
|
-
}, [e.noResultsText]);
|
|
2410
|
-
},
|
|
2411
|
-
onMenuOpen() {
|
|
2412
|
-
this.adjustMenuOpenDirection(), this.setupMenuSizeWatcher(), this.setupMenuResizeAndScrollEventListeners();
|
|
2413
|
-
},
|
|
2414
|
-
onMenuClose() {
|
|
2415
|
-
this.removeMenuSizeWatcher(), this.removeMenuResizeAndScrollEventListeners();
|
|
2416
|
-
},
|
|
2417
|
-
adjustMenuOpenDirection() {
|
|
2418
|
-
const {
|
|
2419
|
-
instance: e
|
|
2420
|
-
} = this;
|
|
2421
|
-
if (!e.menu.isOpen) return;
|
|
2422
|
-
const t = e.getMenu(), s = e.getControl(), n = t.getBoundingClientRect(), i = s.getBoundingClientRect(), o = n.height, l = window.innerHeight, u = i.top, f = window.innerHeight - i.bottom, h = i.top >= 0 && i.top <= l || i.top < 0 && i.bottom > 0, g = f > o + ee, p = u > o + ee;
|
|
2423
|
-
h ? e.openDirection !== "auto" ? e.menu.placement = Ht[e.openDirection] : g || !p ? e.menu.placement = "bottom" : e.menu.placement = "top" : e.closeMenu();
|
|
2424
|
-
},
|
|
2425
|
-
setupMenuSizeWatcher() {
|
|
2426
|
-
const {
|
|
2427
|
-
instance: e
|
|
2428
|
-
} = this, t = e.getMenu();
|
|
2429
|
-
this.menuSizeWatcher || (this.menuSizeWatcher = {
|
|
2430
|
-
remove: re(t, this.adjustMenuOpenDirection)
|
|
2431
|
-
});
|
|
2432
|
-
},
|
|
2433
|
-
setupMenuResizeAndScrollEventListeners() {
|
|
2434
|
-
const {
|
|
2435
|
-
instance: e
|
|
2436
|
-
} = this, t = e.getControl();
|
|
2437
|
-
this.menuResizeAndScrollEventListeners || (this.menuResizeAndScrollEventListeners = {
|
|
2438
|
-
remove: oe(t, this.adjustMenuOpenDirection)
|
|
2439
|
-
});
|
|
2440
|
-
},
|
|
2441
|
-
removeMenuSizeWatcher() {
|
|
2442
|
-
this.menuSizeWatcher && (this.menuSizeWatcher.remove(), this.menuSizeWatcher = null);
|
|
2443
|
-
},
|
|
2444
|
-
removeMenuResizeAndScrollEventListeners() {
|
|
2445
|
-
this.menuResizeAndScrollEventListeners && (this.menuResizeAndScrollEventListeners.remove(), this.menuResizeAndScrollEventListeners = null);
|
|
2446
|
-
}
|
|
2447
|
-
},
|
|
2448
|
-
render() {
|
|
2449
|
-
return r("div", {
|
|
2450
|
-
ref: "menu-container",
|
|
2451
|
-
class: "vue-treeselect__menu-container",
|
|
2452
|
-
style: this.menuContainerStyle
|
|
2453
|
-
}, [r("transition", {
|
|
2454
|
-
attrs: {
|
|
2455
|
-
name: "vue-treeselect__menu--transition"
|
|
2456
|
-
}
|
|
2457
|
-
}, [this.renderMenu()])]);
|
|
2458
|
-
}
|
|
2459
|
-
}, Wt = null, jt = null;
|
|
2460
|
-
var Qt = /* @__PURE__ */ m(
|
|
2461
|
-
Pt,
|
|
2462
|
-
Wt,
|
|
2463
|
-
jt,
|
|
2464
|
-
!1,
|
|
2465
|
-
null,
|
|
2466
|
-
null
|
|
2467
|
-
);
|
|
2468
|
-
const ve = Qt.exports, Kt = {
|
|
2469
|
-
name: "VueTreeSelectPortalTarget",
|
|
2470
|
-
inject: ["instance"],
|
|
2471
|
-
watch: {
|
|
2472
|
-
"instance.menu.isOpen"(e) {
|
|
2473
|
-
e ? this.setupHandlers() : this.removeHandlers();
|
|
2474
|
-
},
|
|
2475
|
-
"instance.menu.placement"() {
|
|
2476
|
-
this.updateMenuContainerOffset();
|
|
2477
|
-
}
|
|
2478
|
-
},
|
|
2479
|
-
created() {
|
|
2480
|
-
this.controlResizeAndScrollEventListeners = null, this.controlSizeWatcher = null;
|
|
2481
|
-
},
|
|
2482
|
-
mounted() {
|
|
2483
|
-
const {
|
|
2484
|
-
instance: e
|
|
2485
|
-
} = this;
|
|
2486
|
-
e.menu.isOpen && this.setupHandlers();
|
|
2487
|
-
},
|
|
2488
|
-
methods: {
|
|
2489
|
-
setupHandlers() {
|
|
2490
|
-
this.updateWidth(), this.updateMenuContainerOffset(), this.setupControlResizeAndScrollEventListeners(), this.setupControlSizeWatcher();
|
|
2491
|
-
},
|
|
2492
|
-
removeHandlers() {
|
|
2493
|
-
this.removeControlResizeAndScrollEventListeners(), this.removeControlSizeWatcher();
|
|
2494
|
-
},
|
|
2495
|
-
setupControlResizeAndScrollEventListeners() {
|
|
2496
|
-
const {
|
|
2497
|
-
instance: e
|
|
2498
|
-
} = this, t = e.getControl();
|
|
2499
|
-
this.controlResizeAndScrollEventListeners || (this.controlResizeAndScrollEventListeners = {
|
|
2500
|
-
remove: oe(t, this.updateMenuContainerOffset)
|
|
2501
|
-
});
|
|
2502
|
-
},
|
|
2503
|
-
setupControlSizeWatcher() {
|
|
2504
|
-
const {
|
|
2505
|
-
instance: e
|
|
2506
|
-
} = this, t = e.getControl();
|
|
2507
|
-
this.controlSizeWatcher || (this.controlSizeWatcher = {
|
|
2508
|
-
remove: re(t, () => {
|
|
2509
|
-
this.updateWidth(), this.updateMenuContainerOffset();
|
|
2510
|
-
})
|
|
2511
|
-
});
|
|
2512
|
-
},
|
|
2513
|
-
removeControlResizeAndScrollEventListeners() {
|
|
2514
|
-
this.controlResizeAndScrollEventListeners && (this.controlResizeAndScrollEventListeners.remove(), this.controlResizeAndScrollEventListeners = null);
|
|
2515
|
-
},
|
|
2516
|
-
removeControlSizeWatcher() {
|
|
2517
|
-
this.controlSizeWatcher && (this.controlSizeWatcher.remove(), this.controlSizeWatcher = null);
|
|
2518
|
-
},
|
|
2519
|
-
updateWidth() {
|
|
2520
|
-
const {
|
|
2521
|
-
instance: e
|
|
2522
|
-
} = this, t = this.$el, n = e.getControl().getBoundingClientRect();
|
|
2523
|
-
t.style.width = `${n.width}px`;
|
|
2524
|
-
},
|
|
2525
|
-
updateMenuContainerOffset() {
|
|
2526
|
-
const {
|
|
2527
|
-
instance: e
|
|
2528
|
-
} = this, t = e.getControl(), s = this.$el, n = t.getBoundingClientRect(), i = s.getBoundingClientRect(), o = e.menu.placement === "bottom" ? n.height : 0, l = `${Math.round(n.left - i.left)}px`, u = `${Math.round(n.top - i.top + o)}px`, f = this.$refs.menu.$refs["menu-container"].style, g = ce(["transform", "webkitTransform", "MozTransform", "msTransform"], (p) => p in document.body.style);
|
|
2529
|
-
f[g] = `translate(${l}, ${u})`;
|
|
2530
|
-
}
|
|
2531
|
-
},
|
|
2532
|
-
render() {
|
|
2533
|
-
const {
|
|
2534
|
-
instance: e
|
|
2535
|
-
} = this, t = ["vue-treeselect__portal-target", e.wrapperClass], s = {
|
|
2536
|
-
zIndex: e.zIndex
|
|
2537
|
-
};
|
|
2538
|
-
return r("div", {
|
|
2539
|
-
class: t,
|
|
2540
|
-
style: s,
|
|
2541
|
-
attrs: {
|
|
2542
|
-
"data-instance-id": e.getInstanceId()
|
|
2543
|
-
}
|
|
2544
|
-
}, [r(ve, {
|
|
2545
|
-
ref: "menu"
|
|
2546
|
-
})]);
|
|
2547
|
-
},
|
|
2548
|
-
destroyed() {
|
|
2549
|
-
this.removeHandlers();
|
|
2550
|
-
}
|
|
2551
|
-
};
|
|
2552
|
-
let j;
|
|
2553
|
-
const qt = {
|
|
2554
|
-
name: "VueTreeSelectMenuPortal",
|
|
2555
|
-
created() {
|
|
2556
|
-
this.portalTarget = null;
|
|
2557
|
-
},
|
|
2558
|
-
mounted() {
|
|
2559
|
-
this.setup();
|
|
2560
|
-
},
|
|
2561
|
-
destroyed() {
|
|
2562
|
-
this.teardown();
|
|
2563
|
-
},
|
|
2564
|
-
methods: {
|
|
2565
|
-
setup() {
|
|
2566
|
-
const e = document.createElement("div");
|
|
2567
|
-
document.body.appendChild(e), this.portalTarget = new ye({
|
|
2568
|
-
el: e,
|
|
2569
|
-
parent: this,
|
|
2570
|
-
...Kt
|
|
2571
|
-
});
|
|
2572
|
-
},
|
|
2573
|
-
teardown() {
|
|
2574
|
-
document.body.removeChild(this.portalTarget.$el), this.portalTarget.$el.innerHTML = "", this.portalTarget.$destroy(), this.portalTarget = null;
|
|
2575
|
-
}
|
|
2576
|
-
},
|
|
2577
|
-
render() {
|
|
2578
|
-
return j || (j = r("div", {
|
|
2579
|
-
class: "vue-treeselect__menu-placeholder"
|
|
2580
|
-
})), j;
|
|
2581
|
-
}
|
|
2582
|
-
}, Ut = null, Yt = null;
|
|
2583
|
-
var Xt = /* @__PURE__ */ m(
|
|
2584
|
-
qt,
|
|
2585
|
-
Ut,
|
|
2586
|
-
Yt,
|
|
2587
|
-
!1,
|
|
2588
|
-
null,
|
|
2589
|
-
null
|
|
2590
|
-
);
|
|
2591
|
-
const Gt = Xt.exports, ns = {
|
|
2592
|
-
name: "VueTreeSelect",
|
|
2593
|
-
mixins: [We],
|
|
2594
|
-
computed: {
|
|
2595
|
-
wrapperClass() {
|
|
2596
|
-
return {
|
|
2597
|
-
"vue-treeselect": !0,
|
|
2598
|
-
"vue-treeselect--single": this.single,
|
|
2599
|
-
"vue-treeselect--multi": this.multiple,
|
|
2600
|
-
"vue-treeselect--searchable": this.searchable,
|
|
2601
|
-
"vue-treeselect--disabled": this.disabled,
|
|
2602
|
-
"vue-treeselect--focused": this.trigger.isFocused,
|
|
2603
|
-
"vue-treeselect--has-value": this.hasValue,
|
|
2604
|
-
"vue-treeselect--open": this.menu.isOpen,
|
|
2605
|
-
"vue-treeselect--open-above": this.menu.placement === "top",
|
|
2606
|
-
"vue-treeselect--open-below": this.menu.placement === "bottom",
|
|
2607
|
-
"vue-treeselect--branch-nodes-disabled": this.disableBranchNodes,
|
|
2608
|
-
"vue-treeselect--append-to-body": this.appendToBody
|
|
2609
|
-
};
|
|
2610
|
-
}
|
|
2611
|
-
},
|
|
2612
|
-
render() {
|
|
2613
|
-
return r("div", {
|
|
2614
|
-
ref: "wrapper",
|
|
2615
|
-
class: this.wrapperClass
|
|
2616
|
-
}, [r(Ye), r(xt, {
|
|
2617
|
-
ref: "control"
|
|
2618
|
-
}), this.appendToBody ? r(Gt, {
|
|
2619
|
-
ref: "portal"
|
|
2620
|
-
}) : r(ve, {
|
|
2621
|
-
ref: "menu"
|
|
2622
|
-
})]);
|
|
2623
|
-
}
|
|
2624
|
-
};
|
|
2625
|
-
export {
|
|
2626
|
-
ns as default
|
|
2627
|
-
};
|
|
1
|
+
import { t as e } from "../chunks/VueTreeSelect.9Ywl-I8e.mjs";
|
|
2
|
+
export { e as default };
|