@ironsource/shared-ui 2.2.0-rc.42 → 2.2.0-rc.48
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/ChipDropdownTrigger.vue_vue_type_style_index_0_scoped_5a645cc9_lang.css +1 -0
- package/DataGridMenu.vue_vue_type_style_index_0_scoped_b7e65177_lang.css +1 -0
- package/DateRangeV4.vue_vue_type_style_index_0_scoped_bb44cdf8_lang.css +1 -0
- package/DropdownV4.vue_vue_type_style_index_0_scoped_f44f2402_lang.css +1 -0
- package/FieldLabel.vue_vue_type_style_index_0_scoped_960ea8b1_lang.css +1 -0
- package/HelpText.vue_vue_type_style_index_0_scoped_b5caf7cd_lang.css +1 -0
- package/IconButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_2a5345ef_lang.css +1 -0
- package/InlineCopy.vue_vue_type_style_index_0_scoped_8cb01c9d_lang.css +1 -0
- package/Link.vue_vue_type_style_index_0_scoped_c4345b08_lang.css +1 -0
- package/OptionV4.vue_vue_type_style_index_0_scoped_d48a9318_lang.css +1 -0
- package/SearchV4.vue_vue_type_style_index_0_scoped_e1a33934_lang.css +1 -0
- package/TabsV4.vue_vue_type_style_index_0_scoped_9747c9da_lang.css +1 -0
- package/TextField.vue_vue_type_style_index_0_scoped_f4275491_lang.css +1 -0
- package/ToggleV4.vue_vue_type_style_index_0_scoped_fbbae882_lang.css +1 -0
- package/TooltipV4.vue_vue_type_style_index_0_scoped_22e25f74_lang.css +1 -0
- package/components/autocomplete/index.d.ts +16 -16
- package/components/columnPicker/ColumnPicker.vue.d.ts +1 -1
- package/components/columnPicker/index.d.ts +20 -20
- package/components/dateRange/v4/DateRangeV4.vue.js +2 -2
- package/components/dateRange/v4/DateRangeV4.vue2.js +28 -27
- package/components/dropdown/common/Dropdown.common.js +351 -274
- package/components/dropdown/v3/Dropdown.vue.d.ts +5 -5
- package/components/dropdown/v3/index.d.ts +77 -77
- package/components/dropdown/v4/ChipDropdownTrigger.vue.js +3 -3
- package/components/dropdown/v4/ChipDropdownTrigger.vue2.js +38 -32
- package/components/dropdown/v4/ConditionalDropdown.vue.d.ts +1 -1
- package/components/dropdown/v4/DropdownV4.vue.d.ts +50 -41
- package/components/dropdown/v4/DropdownV4.vue.js +2 -2
- package/components/dropdown/v4/DropdownV4.vue2.js +237 -216
- package/components/dropdown/v4/IconButtonDropdownTrigger.vue.d.ts +5 -0
- package/components/dropdown/v4/IconButtonDropdownTrigger.vue.js +3 -3
- package/components/dropdown/v4/IconButtonDropdownTrigger.vue2.js +12 -9
- package/components/dropdown/v4/OptionV4.vue.js +3 -3
- package/components/dropdown/v4/OptionV4.vue2.js +12 -12
- package/components/dropdown/v4/TreeDropdown.vue.d.ts +1 -1
- package/components/dropdown/v4/index.d.ts +2377 -2349
- package/components/helpText/HelpText.vue.js +3 -3
- package/components/helpText/HelpText.vue2.js +11 -10
- package/components/includeExclude/IncludeExclude.vue.d.ts +2 -2
- package/components/includeExclude/IncludeExcludeDragDrop.vue.d.ts +2 -2
- package/components/includeExclude/index.d.ts +54 -54
- package/components/inlineCopy/InlineCopy.vue.d.ts +5 -0
- package/components/inlineCopy/InlineCopy.vue.js +3 -3
- package/components/inlineCopy/InlineCopy.vue2.js +54 -53
- package/components/inlineCopy/index.d.ts +9 -0
- package/components/input/v4/TextField.vue.d.ts +5 -0
- package/components/input/v4/TextField.vue.js +2 -2
- package/components/input/v4/TextField.vue2.js +22 -19
- package/components/input/v4/index.d.ts +20 -1
- package/components/link/Link.vue.js +5 -5
- package/components/link/Link.vue2.js +30 -21
- package/components/search/v4/SearchV4.vue.d.ts +5 -0
- package/components/search/v4/SearchV4.vue.js +5 -5
- package/components/search/v4/SearchV4.vue2.js +23 -18
- package/components/search/v4/index.d.ts +9 -0
- package/components/shared/FieldLabel.vue.js +3 -3
- package/components/shared/FieldLabel.vue2.js +9 -8
- package/components/table/v4/DataGridMenu.vue.d.ts +5 -0
- package/components/table/v4/DataGridMenu.vue.js +5 -5
- package/components/table/v4/DataGridMenu.vue2.js +28 -22
- package/components/table/v4/index.d.ts +9 -0
- package/components/tabs/v4/TabsV4.vue.d.ts +5 -0
- package/components/tabs/v4/TabsV4.vue.js +3 -3
- package/components/tabs/v4/TabsV4.vue2.js +74 -43
- package/components/tabs/v4/index.d.ts +20 -1
- package/components/toggle/v4/ToggleV4.vue.d.ts +5 -0
- package/components/toggle/v4/ToggleV4.vue.js +3 -3
- package/components/toggle/v4/ToggleV4.vue2.js +50 -41
- package/components/toggle/v4/index.d.ts +20 -1
- package/components/tooltip/v4/TooltipV4.vue.d.ts +14 -1
- package/components/tooltip/v4/TooltipV4.vue.js +2 -2
- package/components/tooltip/v4/TooltipV4.vue2.js +85 -63
- package/components/tooltip/v4/index.d.ts +51 -4
- package/index.d.ts +2996 -2678
- package/index.js +1 -1
- package/package.json +5 -1
- package/ChipDropdownTrigger.vue_vue_type_style_index_0_scoped_38354f10_lang.css +0 -1
- package/DataGridMenu.vue_vue_type_style_index_0_scoped_ddfaf207_lang.css +0 -1
- package/DateRangeV4.vue_vue_type_style_index_0_scoped_f8826716_lang.css +0 -1
- package/DropdownV4.vue_vue_type_style_index_0_scoped_526bf0a1_lang.css +0 -1
- package/FieldLabel.vue_vue_type_style_index_0_scoped_921d4087_lang.css +0 -1
- package/HelpText.vue_vue_type_style_index_0_scoped_641c2356_lang.css +0 -1
- package/IconButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_99e51ecc_lang.css +0 -1
- package/InlineCopy.vue_vue_type_style_index_0_scoped_9fa1921a_lang.css +0 -1
- package/Link.vue_vue_type_style_index_0_scoped_fe0e7f6f_lang.css +0 -1
- package/OptionV4.vue_vue_type_style_index_0_scoped_771e1980_lang.css +0 -1
- package/SearchV4.vue_vue_type_style_index_0_scoped_d6c42f4b_lang.css +0 -1
- package/TabsV4.vue_vue_type_style_index_0_scoped_f9433b11_lang.css +0 -1
- package/TextField.vue_vue_type_style_index_0_scoped_28fab783_lang.css +0 -1
- package/ToggleV4.vue_vue_type_style_index_0_scoped_a4aa32fb_lang.css +0 -1
- package/TooltipV4.vue_vue_type_style_index_0_scoped_a8aebfee_lang.css +0 -1
|
@@ -1,399 +1,476 @@
|
|
|
1
|
-
import { useToggle as
|
|
2
|
-
import { inject as
|
|
3
|
-
import { isObjectInArray as
|
|
4
|
-
import { objectsEqual as
|
|
5
|
-
import { useClamp as
|
|
6
|
-
import { Mode as
|
|
7
|
-
import { pxToRem as
|
|
8
|
-
import { useEditableContext as
|
|
9
|
-
import { useGroupedOptions as
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
sortOutGroups:
|
|
13
|
-
flattenAndMarkGroupOptions:
|
|
14
|
-
isGroup:
|
|
15
|
-
selectAllWithGroups:
|
|
16
|
-
isIndeterminateGrouped:
|
|
17
|
-
allSelectedGrouped:
|
|
18
|
-
areAllPreviousSelected:
|
|
19
|
-
groupedChildOptionsLength:
|
|
20
|
-
} =
|
|
21
|
-
(
|
|
22
|
-
) > -1 :
|
|
23
|
-
let
|
|
24
|
-
((
|
|
25
|
-
|
|
26
|
-
})(
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
),
|
|
1
|
+
import { useToggle as je } from "../../../composables/useToggle.js";
|
|
2
|
+
import { inject as ze, ref as s, computed as c, watch as A, useSlots as We, toRaw as T, nextTick as R, provide as Fe, onMounted as Je } from "vue";
|
|
3
|
+
import { isObjectInArray as se } from "../../../utils/array.js";
|
|
4
|
+
import { objectsEqual as Qe } from "../../../utils/object.js";
|
|
5
|
+
import { useClamp as Ye, useVirtualList as Ze, onClickOutside as de, useInfiniteScroll as pe } from "@vueuse/core";
|
|
6
|
+
import { Mode as N, Type as q, DropdownContext as et } from "./DropdownContext.js";
|
|
7
|
+
import { pxToRem as tt } from "../../../utils/style.js";
|
|
8
|
+
import { useEditableContext as lt } from "../../table-cells/common/EditableContext.js";
|
|
9
|
+
import { useGroupedOptions as at } from "./useGroupedOptions.js";
|
|
10
|
+
const vt = (t, v, g) => {
|
|
11
|
+
const X = ze("isTreeDropdown", !1), {
|
|
12
|
+
sortOutGroups: $,
|
|
13
|
+
flattenAndMarkGroupOptions: k,
|
|
14
|
+
isGroup: j,
|
|
15
|
+
selectAllWithGroups: fe,
|
|
16
|
+
isIndeterminateGrouped: ve,
|
|
17
|
+
allSelectedGrouped: z,
|
|
18
|
+
areAllPreviousSelected: ge,
|
|
19
|
+
groupedChildOptionsLength: ye
|
|
20
|
+
} = at(t), W = (e, l) => t.multi && Array.isArray(e) ? t.comparingKey ? e?.findIndex(
|
|
21
|
+
(a) => a[t.comparingKey] === l[t.comparingKey]
|
|
22
|
+
) > -1 : se(e, l) : t.comparingKey ? e?.[t.comparingKey] === l[t.comparingKey] : e === l;
|
|
23
|
+
let F;
|
|
24
|
+
((e) => {
|
|
25
|
+
e[e.None = 0] = "None", e[e.Next = 1] = "Next", e[e.Previous = -1] = "Previous", e[e.NextPage = 10] = "NextPage", e[e.PrevPage = -10] = "PrevPage";
|
|
26
|
+
})(F || (F = {}));
|
|
27
|
+
const n = s(
|
|
28
|
+
t.selected
|
|
29
|
+
), _ = lt(), r = c({
|
|
30
30
|
get() {
|
|
31
|
-
return
|
|
31
|
+
return _?.value?.value ?? n.value;
|
|
32
32
|
},
|
|
33
|
-
set(
|
|
34
|
-
|
|
33
|
+
set(e) {
|
|
34
|
+
_.onChange?.(e), _.onClose?.(), v("update:selected", e);
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
|
|
38
|
-
() =>
|
|
37
|
+
A(
|
|
38
|
+
() => t.selected,
|
|
39
39
|
() => {
|
|
40
|
-
|
|
40
|
+
n.value = t.selected, y.value = t.selected;
|
|
41
41
|
}
|
|
42
42
|
);
|
|
43
|
-
const
|
|
44
|
-
disabled:
|
|
45
|
-
initialValue:
|
|
43
|
+
const he = We(), x = s(null), S = s(null), D = s(null), V = s(null), J = s(null), I = s(null), be = s(), Q = s(null), Y = s(null), Z = s(null), me = 8, Oe = c(() => I.value ? I.value.getBoundingClientRect().height + me + t.distance : 0), C = s(!1), O = s([]), P = s(-1), b = s(""), y = s(t.selected || []), p = () => I.value?.focus(), [h, Se, Ae] = je({
|
|
44
|
+
disabled: t.disabled,
|
|
45
|
+
initialValue: t.defaultOpen
|
|
46
46
|
});
|
|
47
|
-
|
|
48
|
-
() =>
|
|
49
|
-
(
|
|
50
|
-
|
|
47
|
+
A(
|
|
48
|
+
() => t.disabled,
|
|
49
|
+
(e) => {
|
|
50
|
+
e !== void 0 && Ae(e);
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
},
|
|
53
|
+
const ee = (e) => {
|
|
54
|
+
Te.value = Se(e);
|
|
55
|
+
}, Te = c({
|
|
56
56
|
get() {
|
|
57
|
-
return
|
|
57
|
+
return t.isOpen;
|
|
58
58
|
},
|
|
59
|
-
set(
|
|
60
|
-
|
|
59
|
+
set(e) {
|
|
60
|
+
v("update:isOpen", e);
|
|
61
61
|
}
|
|
62
|
-
}),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
}), xe = c(() => o.value.length - 1), te = c(
|
|
63
|
+
() => g.VERSION === 4 && t.showSelectAll !== !1 && t.multi && !b.value && !t.loading && !!t.options.length && !(t.minSelections || t.maxSelections)
|
|
64
|
+
), Ie = c(() => te.value ? -1 : 0), d = Ye(0, Ie, xe), le = c(() => r.value ? t.displayValue(r.value) : ""), Pe = (e) => {
|
|
65
|
+
if (!e.value.length && !t.multiOptionsPlaceholderPrefix && !t.multiOptionsPlaceholderSuffix)
|
|
66
|
+
return t.placeholder;
|
|
67
|
+
const l = !t.multiOptionsPlaceholderPrefix && !t.multiOptionsPlaceholderSuffix ? `${e.value.length} selected` : `${t.multiOptionsPlaceholderPrefix ?? ""}${e.value.length ?? "0"}${t.multiOptionsPlaceholderSuffix ?? ""}`;
|
|
68
|
+
return e.value.length == 1 && t.displayValue ? t.displayValue(e.value[0]) : l;
|
|
69
|
+
}, Ke = c(() => {
|
|
70
|
+
if (!t.multi)
|
|
71
|
+
return r.value ? t.displayValue(r.value) : t.placeholder;
|
|
72
|
+
if (Array.isArray(n.value))
|
|
73
|
+
return Pe(n);
|
|
74
|
+
}), G = c(() => {
|
|
75
|
+
if (Array.isArray(n.value))
|
|
76
|
+
return t.groupedOptions ? z(o, n) : n.value.length === o.value.length;
|
|
77
|
+
}), we = c(() => !t.multi || !Array.isArray(n.value) ? !1 : t.groupedOptions ? ve(
|
|
76
78
|
o,
|
|
77
|
-
|
|
78
|
-
) :
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
n
|
|
80
|
+
) : n.value.length > 0 && n.value.length < o.value.length), L = (e) => {
|
|
81
|
+
b.value = e;
|
|
82
|
+
}, K = c(() => t.groupedOptions ? k(t.options) : t.options), Ne = c(() => {
|
|
83
|
+
if (t.groupedOptions && !t.resortGroupedOptions || ge(
|
|
84
|
+
K,
|
|
85
|
+
y
|
|
84
86
|
))
|
|
85
|
-
return
|
|
86
|
-
const
|
|
87
|
+
return K.value;
|
|
88
|
+
const e = {
|
|
87
89
|
selected: [],
|
|
88
90
|
notSelected: []
|
|
89
91
|
};
|
|
90
|
-
|
|
91
|
-
const u = (
|
|
92
|
-
(
|
|
93
|
-
) > -1 :
|
|
94
|
-
|
|
92
|
+
T(K).value.forEach((a) => {
|
|
93
|
+
const u = (t.comparingKey ? y.value.findIndex(
|
|
94
|
+
(w) => w[t.comparingKey] === a[t.comparingKey]
|
|
95
|
+
) > -1 : y.value.includes(a)) ? "selected" : "notSelected";
|
|
96
|
+
e[u].push(a);
|
|
95
97
|
});
|
|
96
|
-
const
|
|
97
|
-
return [].concat(
|
|
98
|
+
const l = t.groupedOptions ? $(e.notSelected) : e.notSelected;
|
|
99
|
+
return [].concat(e.selected, l);
|
|
98
100
|
}), o = c(() => {
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
-
return
|
|
101
|
+
const e = Array.isArray(y.value) && t.multi && g.VERSION === 4 && !X ? Ne.value : K.value;
|
|
102
|
+
if (t.onSearch) {
|
|
103
|
+
const l = e.filter((a) => t.groupedOptions && j(a) ? a : t.onSearch(a, b.value));
|
|
104
|
+
return t.groupedOptions ? $(l) : l;
|
|
103
105
|
} else
|
|
104
|
-
return
|
|
105
|
-
}),
|
|
106
|
-
() =>
|
|
106
|
+
return e;
|
|
107
|
+
}), De = c(() => O.value[0]?.hasSubtitle), ae = c(() => f.mode === N.Multi), ne = c(
|
|
108
|
+
() => De.value ? g.MULTILINE_LIST_HEIGHT : g.LIST_HEIGHT
|
|
107
109
|
), {
|
|
108
|
-
list:
|
|
109
|
-
containerProps:
|
|
110
|
-
wrapperProps:
|
|
111
|
-
scrollTo:
|
|
112
|
-
} =
|
|
113
|
-
itemHeight:
|
|
114
|
-
overscan:
|
|
110
|
+
list: U,
|
|
111
|
+
containerProps: E,
|
|
112
|
+
wrapperProps: Ce,
|
|
113
|
+
scrollTo: B
|
|
114
|
+
} = Ze(o, {
|
|
115
|
+
itemHeight: ne.value,
|
|
116
|
+
overscan: t.disableVirtualScroll ? 1 / 0 : 2
|
|
115
117
|
});
|
|
116
|
-
|
|
117
|
-
() =>
|
|
118
|
-
(
|
|
119
|
-
|
|
118
|
+
A(
|
|
119
|
+
() => t.isOpen,
|
|
120
|
+
(e) => {
|
|
121
|
+
ee(e);
|
|
120
122
|
}
|
|
121
|
-
),
|
|
122
|
-
await
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
123
|
+
), A([P], async () => {
|
|
124
|
+
await R();
|
|
125
|
+
});
|
|
126
|
+
const M = (e) => {
|
|
127
|
+
e == null || e < 0 || E.ref?.value && B(e);
|
|
128
|
+
};
|
|
129
|
+
A(
|
|
130
|
+
[h, d, P],
|
|
131
|
+
async ([e, l], [a, i]) => {
|
|
132
|
+
h.value && (await R(), P.value !== -1 && e !== a && setTimeout(() => {
|
|
133
|
+
if (!(t.multi && g.VERSION === 4))
|
|
134
|
+
if (M(P.value), t.groupedOptions) {
|
|
135
|
+
const u = K.value.findIndex(
|
|
136
|
+
(w) => w === r.value
|
|
131
137
|
);
|
|
132
|
-
|
|
138
|
+
M(u);
|
|
133
139
|
} else
|
|
134
|
-
|
|
135
|
-
}),
|
|
136
|
-
|
|
140
|
+
M(P.value);
|
|
141
|
+
}), d.value && (l !== i || e !== a) && setTimeout(() => {
|
|
142
|
+
M(d.value);
|
|
137
143
|
}));
|
|
138
144
|
}
|
|
139
|
-
), b
|
|
140
|
-
|
|
145
|
+
), A(b, () => {
|
|
146
|
+
v("onsearch", b.value), B(0);
|
|
141
147
|
});
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
const m = (e, l = !1) => {
|
|
149
|
+
t.disabled || (ee(e), R(() => {
|
|
150
|
+
h.value && v("opened"), h.value || v("closed"), x.value && l && x.value.focus();
|
|
145
151
|
}));
|
|
146
152
|
};
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
|
|
153
|
+
A(h, (e) => {
|
|
154
|
+
if (e) {
|
|
155
|
+
b.value = "";
|
|
156
|
+
const l = o.value.findIndex(
|
|
157
|
+
(a) => W(T(r.value), a)
|
|
158
|
+
);
|
|
159
|
+
d.value = l > -1 ? l : 0, ae.value && Array.isArray(r.value) && (y.value = T(r.value).slice());
|
|
150
160
|
return;
|
|
151
161
|
}
|
|
152
|
-
|
|
162
|
+
p();
|
|
153
163
|
});
|
|
154
|
-
const
|
|
155
|
-
if (
|
|
156
|
-
|
|
164
|
+
const Ee = () => {
|
|
165
|
+
if (G.value) {
|
|
166
|
+
n.value = [];
|
|
157
167
|
return;
|
|
158
168
|
}
|
|
159
|
-
if (Array.isArray(
|
|
160
|
-
if (
|
|
161
|
-
|
|
169
|
+
if (Array.isArray(n.value)) {
|
|
170
|
+
if (t.groupedOptions)
|
|
171
|
+
fe(o, n);
|
|
162
172
|
else {
|
|
163
|
-
if (
|
|
164
|
-
|
|
173
|
+
if (n.value.length === o.value.length) {
|
|
174
|
+
n.value = [];
|
|
165
175
|
return;
|
|
166
176
|
}
|
|
167
|
-
|
|
177
|
+
n.value = o.value;
|
|
168
178
|
}
|
|
169
|
-
|
|
179
|
+
v("selectAll");
|
|
170
180
|
}
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
}, Me = (
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
if (
|
|
181
|
+
}, ie = () => {
|
|
182
|
+
Ee(), g.VERSION !== 4 && (r.value = n.value);
|
|
183
|
+
}, Me = (e = !0) => {
|
|
184
|
+
n.value = [], e ? (r.value = [], y.value = [], v("clear")) : t.dynamicFilterMode || v("clear");
|
|
185
|
+
}, H = (e, l) => {
|
|
186
|
+
if (e = T(e), g.VERSION === 4 ? e[t.disabledOptionKey] : O.value[l]?.disabled)
|
|
177
187
|
return;
|
|
178
|
-
if (
|
|
179
|
-
|
|
188
|
+
if (P.value = l, !t.multi) {
|
|
189
|
+
t.keepOpen || m(!1), f.goToOption(
|
|
180
190
|
0
|
|
181
191
|
/* None */
|
|
182
|
-
),
|
|
192
|
+
), r.value = e, L(""), p(), f.type === q.Search && S.value && (S.value.value = t.displayValue(e)), re();
|
|
183
193
|
return;
|
|
184
194
|
}
|
|
185
|
-
if (!Array.isArray(
|
|
195
|
+
if (!Array.isArray(n.value))
|
|
186
196
|
return;
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
(u) => u[
|
|
197
|
+
S.value?.focus();
|
|
198
|
+
const i = T(n.value);
|
|
199
|
+
if (se(i, e) || t.comparingKey && i.findIndex(
|
|
200
|
+
(u) => u[t.comparingKey] === e[t.comparingKey]
|
|
191
201
|
) > -1) {
|
|
192
|
-
|
|
202
|
+
n.value = i.filter((u) => t.comparingKey ? u[t.comparingKey] !== e[t.comparingKey] : !Qe(u, e));
|
|
193
203
|
return;
|
|
194
204
|
} else {
|
|
195
|
-
|
|
205
|
+
n.value = [...i, e];
|
|
196
206
|
return;
|
|
197
207
|
}
|
|
198
|
-
},
|
|
199
|
-
activeIndex:
|
|
200
|
-
options:
|
|
201
|
-
selectedOption:
|
|
202
|
-
labelRef:
|
|
203
|
-
activeOption:
|
|
204
|
-
listRef:
|
|
205
|
-
clearable:
|
|
206
|
-
type:
|
|
207
|
-
mode:
|
|
208
|
-
query:
|
|
209
|
-
selectedValue:
|
|
210
|
-
toggle:
|
|
211
|
-
disabled:
|
|
212
|
-
open:
|
|
213
|
-
mandatory:
|
|
214
|
-
size:
|
|
215
|
-
placeholder:
|
|
216
|
-
select:
|
|
208
|
+
}, Re = (e) => O.value[e]?.disabled, f = {
|
|
209
|
+
activeIndex: d,
|
|
210
|
+
options: O,
|
|
211
|
+
selectedOption: r,
|
|
212
|
+
labelRef: J,
|
|
213
|
+
activeOption: V,
|
|
214
|
+
listRef: x,
|
|
215
|
+
clearable: t.clearable,
|
|
216
|
+
type: he.input ? q.Search : q.Dropdown,
|
|
217
|
+
mode: t.multi ? N.Multi : N.Single,
|
|
218
|
+
query: b,
|
|
219
|
+
selectedValue: le,
|
|
220
|
+
toggle: m,
|
|
221
|
+
disabled: t.disabled,
|
|
222
|
+
open: h,
|
|
223
|
+
mandatory: t.mandatory,
|
|
224
|
+
size: t.size,
|
|
225
|
+
placeholder: t.placeholder,
|
|
226
|
+
select: H,
|
|
217
227
|
clearSelection: () => {
|
|
218
|
-
|
|
228
|
+
L(""), r.value = f.mode === N.Single ? null : [], y.value = f.mode === N.Single ? null : [], S.value && (S.value.value = "");
|
|
219
229
|
},
|
|
220
|
-
search:
|
|
221
|
-
goToOption: async (
|
|
222
|
-
if (!
|
|
230
|
+
search: L,
|
|
231
|
+
goToOption: async (e) => {
|
|
232
|
+
if (!h.value)
|
|
223
233
|
return;
|
|
224
|
-
let
|
|
225
|
-
const
|
|
234
|
+
let l = d.value + e;
|
|
235
|
+
const a = O.value.filter(
|
|
226
236
|
(u) => u.disabled
|
|
227
|
-
).length,
|
|
228
|
-
for (
|
|
229
|
-
if (!
|
|
230
|
-
|
|
237
|
+
).length, i = o.value.length - a;
|
|
238
|
+
for (l > i && (l = i + 1); ; ) {
|
|
239
|
+
if (!O.value[l]?.disabled) {
|
|
240
|
+
V.value = o.value[l], d.value = l;
|
|
231
241
|
return;
|
|
232
242
|
}
|
|
233
|
-
if ((
|
|
234
|
-
|
|
243
|
+
if ((e === 1 || e === 10) && (l = l + 1), (e === -1 || e === -10) && (l = l + -1), !!Re(d.value)) {
|
|
244
|
+
V.value = o.value[l], d.value = l;
|
|
235
245
|
return;
|
|
236
246
|
}
|
|
237
247
|
}
|
|
238
248
|
},
|
|
239
|
-
registerInput: (
|
|
240
|
-
|
|
249
|
+
registerInput: (e) => {
|
|
250
|
+
S.value = e.value;
|
|
241
251
|
},
|
|
242
|
-
registerOption: (
|
|
243
|
-
|
|
252
|
+
registerOption: (e, l, a) => {
|
|
253
|
+
O.value = [...O.value, { id: e, disabled: l, hasSubtitle: a }];
|
|
244
254
|
},
|
|
245
|
-
unRegisterOption(
|
|
246
|
-
|
|
255
|
+
unRegisterOption(e) {
|
|
256
|
+
O.value = O.value.filter((l) => l.id !== e);
|
|
247
257
|
}
|
|
248
258
|
};
|
|
249
|
-
|
|
250
|
-
|
|
259
|
+
Fe(et, f), de(
|
|
260
|
+
x,
|
|
251
261
|
() => {
|
|
252
|
-
|
|
262
|
+
h.value && ce();
|
|
253
263
|
},
|
|
254
264
|
{
|
|
255
265
|
ignore: [
|
|
256
|
-
|
|
257
|
-
J,
|
|
266
|
+
I,
|
|
258
267
|
Q,
|
|
259
268
|
Y,
|
|
260
|
-
|
|
261
|
-
|
|
269
|
+
Z,
|
|
270
|
+
S,
|
|
271
|
+
E.ref
|
|
262
272
|
]
|
|
263
273
|
}
|
|
264
274
|
);
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
},
|
|
268
|
-
|
|
275
|
+
const ke = () => {
|
|
276
|
+
S.value && (S.value.value = f.query.value = "");
|
|
277
|
+
}, ue = () => {
|
|
278
|
+
t.multi && !X && (t.groupedOptions ? C.value = z(
|
|
269
279
|
o,
|
|
270
|
-
|
|
271
|
-
) : C.value =
|
|
280
|
+
n
|
|
281
|
+
) : C.value = t.options.length === t.selected.length);
|
|
272
282
|
};
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
})),
|
|
277
|
-
}),
|
|
278
|
-
|
|
283
|
+
Je(async () => {
|
|
284
|
+
t.autoFocus && (await R(), setTimeout(() => {
|
|
285
|
+
D.value.focus();
|
|
286
|
+
})), f.goToOption(0), ue();
|
|
287
|
+
}), A([() => t.options, () => t.selected], () => {
|
|
288
|
+
ue();
|
|
279
289
|
});
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
},
|
|
285
|
-
if (!
|
|
286
|
-
switch (
|
|
290
|
+
const re = () => {
|
|
291
|
+
t.multi && (r.value = n.value, Array.isArray(r.value) && (y.value = T(r.value).slice(), C.value = t.groupedOptions ? ye(t.options) === r.value.length : t.options.length === r.value.length)), v("apply", r.value), v("allSelectedChanged", G.value), m(!1), ke();
|
|
292
|
+
}, ce = () => {
|
|
293
|
+
ae.value && Array.isArray(y.value) && (r.value = T(y.value).slice()), b.value = "", m(!1);
|
|
294
|
+
}, _e = (e) => {
|
|
295
|
+
if (!t.disableKeyboardEvents)
|
|
296
|
+
switch (e.key) {
|
|
287
297
|
case "Space":
|
|
288
298
|
case "Enter":
|
|
289
299
|
case "ArrowUp":
|
|
290
300
|
case "ArrowDown":
|
|
291
|
-
|
|
301
|
+
m(!0), e.preventDefault();
|
|
292
302
|
}
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
|
|
303
|
+
}, Ve = (e) => {
|
|
304
|
+
const l = e.target;
|
|
305
|
+
if (!l)
|
|
306
|
+
return !1;
|
|
307
|
+
const a = l.tagName;
|
|
308
|
+
return a === "INPUT" || a === "TEXTAREA" || l.isContentEditable ? !0 : !(!(a === "BUTTON" || a === "A" || l.getAttribute?.("role") === "button") || I.value?.contains?.(l));
|
|
309
|
+
}, Ge = (e) => {
|
|
310
|
+
const l = e.target;
|
|
311
|
+
if (!l)
|
|
312
|
+
return !1;
|
|
313
|
+
const a = l.tagName;
|
|
314
|
+
return !(!(a === "BUTTON" || a === "A" || l.getAttribute?.("role") === "button") || I.value?.contains?.(l));
|
|
315
|
+
}, oe = () => {
|
|
316
|
+
if (d.value === -1 && te.value) {
|
|
317
|
+
ie();
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const e = o.value[d.value];
|
|
321
|
+
e !== void 0 && (Ue(e) || (H(e, d.value), f.mode === N.Single && !t.keepOpen && m(!1)));
|
|
322
|
+
}, Le = c(() => {
|
|
323
|
+
if (!t.comparingKey || !(t.minSelections || t.maxSelections))
|
|
324
|
+
return [];
|
|
325
|
+
const e = T(r.value);
|
|
326
|
+
if (!Array.isArray(e))
|
|
327
|
+
return [];
|
|
328
|
+
if (e.length <= t.minSelections)
|
|
329
|
+
return e.map((l) => l[t.comparingKey]);
|
|
330
|
+
if (t.maxSelections && e.length >= t.maxSelections) {
|
|
331
|
+
const l = t.groupedOptions ? k(t.options) : t.options, a = e.map((i) => i[t.comparingKey]);
|
|
332
|
+
return l.filter((i) => i && !a.includes(i[t.comparingKey])).map((i) => i[t.comparingKey]);
|
|
333
|
+
}
|
|
334
|
+
return [];
|
|
335
|
+
}), Ue = (e) => e ? e[t.disabledOptionKey] ? !0 : !!t.comparingKey && Le.value.includes(e[t.comparingKey]) : !1, Be = () => {
|
|
336
|
+
const e = [];
|
|
337
|
+
return D.value && e.push(D.value), x.value && e.push(
|
|
338
|
+
...Array.from(
|
|
339
|
+
x.value.querySelectorAll(
|
|
340
|
+
'a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
341
|
+
)
|
|
342
|
+
)
|
|
343
|
+
), e.filter((l) => l === D.value || l.offsetParent !== null);
|
|
344
|
+
}, He = (e) => {
|
|
345
|
+
if (!t.disableKeyboardEvents)
|
|
346
|
+
switch (e.key) {
|
|
347
|
+
case "Tab": {
|
|
348
|
+
if (!h.value)
|
|
349
|
+
break;
|
|
350
|
+
const l = Be();
|
|
351
|
+
if (l.length <= 1) {
|
|
352
|
+
m(!1);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
e.preventDefault();
|
|
356
|
+
const a = document.activeElement, i = l.indexOf(a), u = e.shiftKey ? -1 : 1;
|
|
357
|
+
l[((i === -1 ? 0 : i) + u + l.length) % l.length]?.focus();
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
296
360
|
case "ArrowUp": {
|
|
297
|
-
|
|
361
|
+
f.goToOption(
|
|
298
362
|
-1
|
|
299
363
|
/* Previous */
|
|
300
|
-
),
|
|
364
|
+
), e.preventDefault(), e.stopPropagation();
|
|
301
365
|
break;
|
|
302
366
|
}
|
|
303
367
|
case "ArrowDown": {
|
|
304
|
-
|
|
368
|
+
f.goToOption(
|
|
305
369
|
1
|
|
306
370
|
/* Next */
|
|
307
|
-
),
|
|
371
|
+
), e.preventDefault(), e.stopPropagation();
|
|
308
372
|
break;
|
|
309
373
|
}
|
|
310
374
|
case "Escape": {
|
|
311
|
-
|
|
375
|
+
m(!1), e.preventDefault();
|
|
312
376
|
break;
|
|
313
377
|
}
|
|
314
378
|
case "PageUp": {
|
|
315
|
-
|
|
379
|
+
f.goToOption(
|
|
316
380
|
10
|
|
317
381
|
/* NextPage */
|
|
318
|
-
),
|
|
382
|
+
), e.preventDefault();
|
|
319
383
|
break;
|
|
320
384
|
}
|
|
321
385
|
case "PageDown": {
|
|
322
|
-
|
|
386
|
+
f.goToOption(
|
|
323
387
|
-10
|
|
324
388
|
/* PrevPage */
|
|
325
|
-
),
|
|
389
|
+
), e.preventDefault();
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
case " ":
|
|
393
|
+
case "Spacebar": {
|
|
394
|
+
if (Ve(e) || g.VERSION !== 4)
|
|
395
|
+
break;
|
|
396
|
+
if (e.preventDefault(), !h.value) {
|
|
397
|
+
m(!0);
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
oe();
|
|
326
401
|
break;
|
|
327
402
|
}
|
|
328
403
|
case "Enter": {
|
|
329
|
-
if (
|
|
330
|
-
|
|
404
|
+
if (Ge(e))
|
|
405
|
+
break;
|
|
406
|
+
if (!h.value) {
|
|
407
|
+
m(!0);
|
|
331
408
|
return;
|
|
332
409
|
}
|
|
333
|
-
|
|
410
|
+
e.preventDefault(), oe();
|
|
334
411
|
break;
|
|
335
412
|
}
|
|
336
413
|
}
|
|
337
|
-
},
|
|
338
|
-
if (
|
|
414
|
+
}, qe = c(() => {
|
|
415
|
+
if (t.loading)
|
|
339
416
|
return 8.5;
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
return
|
|
343
|
-
}, 0),
|
|
344
|
-
let u =
|
|
345
|
-
return
|
|
346
|
-
u *
|
|
417
|
+
const e = t.loadMoreLoading && g.MAX_NUMBER_OF_OPTIONS || t.customNumberOfDisplayedOptions || U.value.reduce((w, Xe) => {
|
|
418
|
+
const $e = t.overrideOptionCountCalculation ? t.overrideOptionCountCalculation(Xe.data) : 1;
|
|
419
|
+
return w + $e;
|
|
420
|
+
}, 0), l = t.multi && t.showSelectAll && !b.value ? 1 : 0, a = e > g.MAX_NUMBER_OF_OPTIONS, i = e + l;
|
|
421
|
+
let u = a ? g.MAX_NUMBER_OF_OPTIONS + 0.1 : i;
|
|
422
|
+
return t.loadMoreLoading && t.multi && (U.value.length ? u = u + 0.1 : u = u - 0.9), t.noResultsText && u === 0 && (u = u + 1), t.withConditions && b.value && (u = u + 1), tt(
|
|
423
|
+
u * ne.value + g.PADDING_PX
|
|
347
424
|
);
|
|
348
425
|
});
|
|
349
|
-
return
|
|
350
|
-
|
|
426
|
+
return pe(
|
|
427
|
+
E.ref,
|
|
351
428
|
() => {
|
|
352
|
-
!
|
|
429
|
+
!t.loadMoreLoading && t.infiniteLoading && v("loadMore");
|
|
353
430
|
},
|
|
354
|
-
{ distance:
|
|
355
|
-
),
|
|
356
|
-
|
|
431
|
+
{ distance: t.infiniteScrollThreshold }
|
|
432
|
+
), A(n, () => {
|
|
433
|
+
v("unsavedSelectionUpdate", n.value);
|
|
357
434
|
}), {
|
|
358
|
-
onKeydown:
|
|
359
|
-
location:
|
|
360
|
-
open:
|
|
361
|
-
toggleMenu:
|
|
362
|
-
onButtonKeydown:
|
|
363
|
-
displayedValue:
|
|
364
|
-
labelRef:
|
|
365
|
-
query:
|
|
366
|
-
containerProps:
|
|
367
|
-
calculateTableHeight:
|
|
368
|
-
wrapperProps:
|
|
435
|
+
onKeydown: He,
|
|
436
|
+
location: Oe,
|
|
437
|
+
open: h,
|
|
438
|
+
toggleMenu: m,
|
|
439
|
+
onButtonKeydown: _e,
|
|
440
|
+
displayedValue: Ke,
|
|
441
|
+
labelRef: J,
|
|
442
|
+
query: b,
|
|
443
|
+
containerProps: E,
|
|
444
|
+
calculateTableHeight: qe,
|
|
445
|
+
wrapperProps: Ce,
|
|
369
446
|
filteredOptions: o,
|
|
370
|
-
allSelected:
|
|
447
|
+
allSelected: G,
|
|
371
448
|
allSelectedApplied: C,
|
|
372
|
-
isIndeterminate:
|
|
373
|
-
onSelectAll:
|
|
374
|
-
virtualOptions:
|
|
375
|
-
isSelected:
|
|
376
|
-
selectedOption:
|
|
377
|
-
selectedOptionPrevious:
|
|
378
|
-
selectedValue:
|
|
379
|
-
onSelect:
|
|
380
|
-
activeIndex:
|
|
381
|
-
onCancel:
|
|
382
|
-
onApply:
|
|
383
|
-
scrollTo:
|
|
384
|
-
onClickOutside:
|
|
385
|
-
listRef:
|
|
386
|
-
buttonRef:
|
|
387
|
-
apply:
|
|
388
|
-
cancel:
|
|
389
|
-
el:
|
|
390
|
-
triggerRef:
|
|
391
|
-
clearAll:
|
|
449
|
+
isIndeterminate: we,
|
|
450
|
+
onSelectAll: ie,
|
|
451
|
+
virtualOptions: U,
|
|
452
|
+
isSelected: W,
|
|
453
|
+
selectedOption: r,
|
|
454
|
+
selectedOptionPrevious: y,
|
|
455
|
+
selectedValue: le,
|
|
456
|
+
onSelect: H,
|
|
457
|
+
activeIndex: d,
|
|
458
|
+
onCancel: ce,
|
|
459
|
+
onApply: re,
|
|
460
|
+
scrollTo: B,
|
|
461
|
+
onClickOutside: de,
|
|
462
|
+
listRef: x,
|
|
463
|
+
buttonRef: I,
|
|
464
|
+
apply: Q,
|
|
465
|
+
cancel: Y,
|
|
466
|
+
el: D,
|
|
467
|
+
triggerRef: be,
|
|
468
|
+
clearAll: Z,
|
|
392
469
|
onClearAllSelections: Me,
|
|
393
|
-
isGroup:
|
|
394
|
-
flattenAndMarkGroupOptions:
|
|
470
|
+
isGroup: j,
|
|
471
|
+
flattenAndMarkGroupOptions: k
|
|
395
472
|
};
|
|
396
473
|
};
|
|
397
474
|
export {
|
|
398
|
-
|
|
475
|
+
vt as dropdownCommon
|
|
399
476
|
};
|