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