@ironsource/shared-ui 2.1.8-test.1 → 2.1.9
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/Chart.vue_vue_type_style_index_0_scoped_ea1e5c3e_lang.css +1 -0
- package/ChartHeader.vue_vue_type_style_index_0_scoped_4c37736e_lang.css +1 -0
- package/ChartLegend.vue_vue_type_style_index_0_scoped_c0f71a49_lang.css +1 -0
- package/DropdownV4.vue_vue_type_style_index_0_scoped_62a620ee_lang.css +1 -0
- package/GroupOption.vue_vue_type_style_index_0_scoped_5f372a81_lang.css +1 -0
- package/components/chart/Chart.vue.d.ts +5 -0
- package/components/chart/Chart.vue.js +4 -4
- package/components/chart/Chart.vue2.js +51 -49
- package/components/chart/ChartHeader.vue.d.ts +5 -0
- package/components/chart/ChartHeader.vue.js +2 -2
- package/components/chart/ChartHeader.vue2.js +35 -22
- package/components/chart/ChartLegend.vue.js +3 -3
- package/components/chart/ChartLegend.vue2.js +35 -28
- package/components/chart/index.d.ts +20 -1
- package/components/dropdown/common/Dropdown.common.d.ts +1 -0
- package/components/dropdown/common/Dropdown.common.js +207 -178
- package/components/dropdown/common/consts.d.ts +1 -0
- package/components/dropdown/common/consts.js +4 -0
- package/components/dropdown/common/useGroupedOptions.d.ts +10 -0
- package/components/dropdown/common/useGroupedOptions.js +57 -0
- package/components/dropdown/v4/DropdownV4.vue.d.ts +6 -0
- package/components/dropdown/v4/DropdownV4.vue.js +4 -4
- package/components/dropdown/v4/DropdownV4.vue2.js +136 -125
- package/components/dropdown/v4/GroupOption.vue.d.ts +9 -0
- package/components/dropdown/v4/GroupOption.vue.js +7 -0
- package/components/dropdown/v4/GroupOption.vue2.js +29 -0
- package/components/dropdown/v4/dropdownStoryArgs.d.ts +8 -0
- package/components/dropdown/v4/index.d.ts +21 -1
- package/index.d.ts +42 -3
- package/index.js +111 -116
- package/mocks/apps.d.ts +7 -0
- package/package.json +1 -1
- package/utils/formatNumbers.js +7 -15
- package/Chart.vue_vue_type_style_index_0_scoped_df85e0af_lang.css +0 -1
- package/ChartHeader.vue_vue_type_style_index_0_scoped_2e3de9c5_lang.css +0 -1
- package/ChartLegend.vue_vue_type_style_index_0_scoped_efc608f9_lang.css +0 -1
- package/DropdownV4.vue_vue_type_style_index_0_scoped_00ccab6b_lang.css +0 -1
|
@@ -1,339 +1,368 @@
|
|
|
1
|
-
import { useToggle as
|
|
2
|
-
import { inject as
|
|
3
|
-
import { isObjectInArray as
|
|
4
|
-
import { objectsEqual as
|
|
5
|
-
import { useClamp as
|
|
6
|
-
import { Mode as T, Type as V, DropdownContext as
|
|
7
|
-
import { pxToRem as
|
|
8
|
-
import { useEditableContext as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { useToggle as ke } from "../../../composables/useToggle.js";
|
|
2
|
+
import { inject as Ve, ref as n, computed as i, watch as m, useSlots as _e, toRaw as P, nextTick as N, provide as Ge, onMounted as He } from "vue";
|
|
3
|
+
import { isObjectInArray as Z } from "../../../utils/array.js";
|
|
4
|
+
import { objectsEqual as Be } from "../../../utils/object.js";
|
|
5
|
+
import { useClamp as Le, useVirtualList as Ue, onClickOutside as F } from "@vueuse/core";
|
|
6
|
+
import { Mode as T, Type as V, DropdownContext as qe } from "./DropdownContext.js";
|
|
7
|
+
import { pxToRem as Ke } from "../../../utils/style.js";
|
|
8
|
+
import { useEditableContext as $e } from "../../table-cells/common/EditableContext.js";
|
|
9
|
+
import { useGroupedOptions as je } from "./useGroupedOptions.js";
|
|
10
|
+
const el = (l, A, b) => {
|
|
11
|
+
const ee = Ve("isTreeDropdown", !1), {
|
|
12
|
+
sortOutGroups: _,
|
|
13
|
+
flattenAndMarkGroupOptions: le,
|
|
14
|
+
isGroup: G,
|
|
15
|
+
selectAllWithGroups: te,
|
|
16
|
+
isIndeterminateGrouped: ae,
|
|
17
|
+
allSelectedGrouped: ue,
|
|
18
|
+
areAllPreviousSelected: ne
|
|
19
|
+
} = je(l), ie = (e, t) => l.multi ? Z(e, t) : P(e) === t;
|
|
20
|
+
let H;
|
|
12
21
|
((e) => {
|
|
13
22
|
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";
|
|
14
|
-
})(
|
|
23
|
+
})(H || (H = {}));
|
|
15
24
|
const a = n(
|
|
16
25
|
l.selected
|
|
17
|
-
),
|
|
26
|
+
), R = $e(), u = i({
|
|
18
27
|
get() {
|
|
19
|
-
return
|
|
28
|
+
return R?.value?.value ?? a.value;
|
|
20
29
|
},
|
|
21
30
|
set(e) {
|
|
22
|
-
|
|
31
|
+
R.onChange?.(e), R.onClose?.(), A("update:selected", e);
|
|
23
32
|
}
|
|
24
33
|
});
|
|
25
|
-
|
|
34
|
+
m(
|
|
26
35
|
() => l.selected,
|
|
27
36
|
() => {
|
|
28
|
-
a.value = l.selected,
|
|
37
|
+
a.value = l.selected, c.value = l.selected;
|
|
29
38
|
}
|
|
30
39
|
);
|
|
31
|
-
const
|
|
40
|
+
const re = _e(), w = n(null), h = n(null), B = n(null), E = n(null), L = n(null), I = n(null), oe = n(), U = n(null), q = n(null), K = n(null), se = 8, ce = i(() => I.value ? I.value.getBoundingClientRect().height + se + l.distance : 0), d = n([]), x = n(-1), y = n(""), c = n(l.selected || []), $ = () => I.value?.focus(), [f, ve, de] = ke({
|
|
32
41
|
disabled: l.disabled,
|
|
33
42
|
initialValue: l.defaultOpen
|
|
34
43
|
});
|
|
35
|
-
|
|
44
|
+
m(
|
|
36
45
|
() => l.disabled,
|
|
37
46
|
(e) => {
|
|
38
|
-
e !== void 0 &&
|
|
47
|
+
e !== void 0 && de(e);
|
|
39
48
|
}
|
|
40
49
|
);
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
},
|
|
50
|
+
const j = (e) => {
|
|
51
|
+
fe.value = ve(e);
|
|
52
|
+
}, fe = i({
|
|
44
53
|
get() {
|
|
45
54
|
return l.isOpen;
|
|
46
55
|
},
|
|
47
56
|
set(e) {
|
|
48
|
-
|
|
57
|
+
A("update:isOpen", e);
|
|
49
58
|
}
|
|
50
|
-
}),
|
|
59
|
+
}), ge = i(() => r.value.length - 1), v = Le(0, 0, ge), X = i(() => u.value ? l.displayValue(u.value) : ""), he = (e) => {
|
|
51
60
|
if (!e.value.length && !l.multiOptionsPlaceholderPrefix && !l.multiOptionsPlaceholderSuffix)
|
|
52
61
|
return l.placeholder;
|
|
53
62
|
const t = !l.multiOptionsPlaceholderPrefix && !l.multiOptionsPlaceholderSuffix ? `${e.value.length} selected` : `${l.multiOptionsPlaceholderPrefix ?? ""}${e.value.length ?? "0"}${l.multiOptionsPlaceholderSuffix ?? ""}`;
|
|
54
63
|
return e.value.length == 1 && l.displayValue ? l.displayValue(e.value[0]) : t;
|
|
55
|
-
},
|
|
64
|
+
}, ye = i(() => {
|
|
56
65
|
if (!l.multi)
|
|
57
66
|
return u.value ? l.displayValue(u.value) : l.placeholder;
|
|
58
67
|
if (Array.isArray(a.value))
|
|
59
|
-
return
|
|
60
|
-
}),
|
|
68
|
+
return he(a);
|
|
69
|
+
}), p = i(() => {
|
|
61
70
|
if (Array.isArray(a.value))
|
|
62
|
-
return a.value.length ===
|
|
63
|
-
}),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
return l.groupedOptions ? ue(r, a) : a.value.length === r.value.length;
|
|
72
|
+
}), Oe = i(() => !l.multi || !Array.isArray(a.value) ? !1 : l.groupedOptions ? ae(
|
|
73
|
+
r,
|
|
74
|
+
a
|
|
75
|
+
) : a.value.length > 0 && a.value.length < r.value.length), M = (e) => {
|
|
76
|
+
y.value = e;
|
|
77
|
+
}, D = i(() => l.groupedOptions ? le(l.options) : l.options), Se = i(() => {
|
|
78
|
+
if (ne(
|
|
79
|
+
D,
|
|
80
|
+
c
|
|
81
|
+
))
|
|
82
|
+
return D.value;
|
|
83
|
+
const e = {
|
|
67
84
|
selected: [],
|
|
68
85
|
notSelected: []
|
|
69
86
|
};
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
()
|
|
87
|
+
P(D).value.forEach((s) => {
|
|
88
|
+
const g = c.value.includes(s) ? "selected" : "notSelected";
|
|
89
|
+
e[g].push(s);
|
|
90
|
+
});
|
|
91
|
+
const t = l.groupedOptions ? _(e.notSelected) : e.notSelected;
|
|
92
|
+
return [].concat(e.selected, t);
|
|
93
|
+
}), r = i(() => {
|
|
94
|
+
const e = Array.isArray(c.value) && l.multi && b.VERSION === 4 && !ee ? Se.value : D.value;
|
|
95
|
+
if (l.onSearch) {
|
|
96
|
+
const t = e.filter((s) => l.groupedOptions && G(s) ? s : l.onSearch(s, y.value));
|
|
97
|
+
return l.groupedOptions ? _(t) : t;
|
|
98
|
+
} else
|
|
99
|
+
return e;
|
|
100
|
+
}), Ae = i(() => d.value[0]?.hasSubtitle), z = i(() => o.mode === T.Multi), W = i(
|
|
101
|
+
() => Ae.value ? b.MULTILINE_LIST_HEIGHT : b.LIST_HEIGHT
|
|
79
102
|
), {
|
|
80
|
-
list:
|
|
81
|
-
containerProps:
|
|
82
|
-
wrapperProps:
|
|
83
|
-
scrollTo:
|
|
84
|
-
} =
|
|
85
|
-
itemHeight:
|
|
103
|
+
list: J,
|
|
104
|
+
containerProps: Q,
|
|
105
|
+
wrapperProps: be,
|
|
106
|
+
scrollTo: C
|
|
107
|
+
} = Ue(r, {
|
|
108
|
+
itemHeight: W.value,
|
|
86
109
|
overscan: l.disableVirtualScroll ? 1 / 0 : 2
|
|
87
110
|
});
|
|
88
|
-
|
|
111
|
+
m(
|
|
89
112
|
() => l.isOpen,
|
|
90
113
|
(e) => {
|
|
91
|
-
|
|
114
|
+
j(e);
|
|
92
115
|
}
|
|
93
|
-
),
|
|
94
|
-
await
|
|
95
|
-
}),
|
|
96
|
-
[
|
|
116
|
+
), m([x], async () => {
|
|
117
|
+
await N();
|
|
118
|
+
}), m(
|
|
119
|
+
[f, v, x],
|
|
97
120
|
async ([e], [t]) => {
|
|
98
|
-
|
|
99
|
-
l.multi &&
|
|
100
|
-
}),
|
|
101
|
-
|
|
121
|
+
f.value && (await N(), x.value !== -1 && e !== t && setTimeout(() => {
|
|
122
|
+
l.multi && b.VERSION === 4 || C(x.value);
|
|
123
|
+
}), v.value && setTimeout(() => {
|
|
124
|
+
C(v.value);
|
|
102
125
|
}));
|
|
103
126
|
}
|
|
104
|
-
),
|
|
105
|
-
|
|
127
|
+
), m(y, () => {
|
|
128
|
+
A("onsearch", y.value), C(0);
|
|
106
129
|
});
|
|
107
|
-
const
|
|
108
|
-
l.disabled || (
|
|
109
|
-
|
|
130
|
+
const O = (e, t = !1) => {
|
|
131
|
+
l.disabled || (j(e), N(() => {
|
|
132
|
+
f.value && A("opened"), f.value || A("closed"), w.value && t && w.value.focus();
|
|
110
133
|
}));
|
|
111
134
|
};
|
|
112
|
-
|
|
135
|
+
m(f, (e) => {
|
|
113
136
|
if (e) {
|
|
114
|
-
|
|
137
|
+
y.value = "", z.value && Array.isArray(u.value) && (c.value = P(u.value).slice());
|
|
115
138
|
return;
|
|
116
139
|
}
|
|
117
|
-
|
|
140
|
+
$();
|
|
118
141
|
});
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
142
|
+
const me = () => {
|
|
143
|
+
if (p.value) {
|
|
121
144
|
a.value = [];
|
|
122
145
|
return;
|
|
123
146
|
}
|
|
124
147
|
if (Array.isArray(a.value)) {
|
|
125
|
-
if (
|
|
126
|
-
a
|
|
127
|
-
|
|
148
|
+
if (l.groupedOptions)
|
|
149
|
+
te(r, a);
|
|
150
|
+
else {
|
|
151
|
+
if (a.value.length === r.value.length) {
|
|
152
|
+
a.value = [];
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
a.value = r.value;
|
|
128
156
|
}
|
|
129
|
-
|
|
157
|
+
A("selectAll");
|
|
130
158
|
}
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
a.value = [], e && (u.value = [],
|
|
135
|
-
},
|
|
136
|
-
if (e =
|
|
159
|
+
}, Pe = () => {
|
|
160
|
+
me(), b.VERSION !== 4 && (u.value = a.value);
|
|
161
|
+
}, Te = (e = !0) => {
|
|
162
|
+
a.value = [], e && (u.value = [], c.value = []), A("clear");
|
|
163
|
+
}, k = (e, t) => {
|
|
164
|
+
if (e = P(e), d.value[t]?.disabled)
|
|
137
165
|
return;
|
|
138
|
-
if (x.value = t,
|
|
139
|
-
l.keepOpen ||
|
|
166
|
+
if (x.value = t, o.mode !== T.Multi) {
|
|
167
|
+
l.keepOpen || O(!1), o.goToOption(
|
|
140
168
|
0
|
|
141
169
|
/* None */
|
|
142
|
-
), u.value = e,
|
|
170
|
+
), u.value = e, M(""), $(), o.type === V.Search && h.value && (h.value.value = l.displayValue(e));
|
|
143
171
|
return;
|
|
144
172
|
}
|
|
145
173
|
if (!Array.isArray(a.value))
|
|
146
174
|
return;
|
|
147
|
-
|
|
148
|
-
const S =
|
|
149
|
-
if (
|
|
175
|
+
h.value?.focus();
|
|
176
|
+
const S = P(a.value);
|
|
177
|
+
if (Z(S, e)) {
|
|
150
178
|
a.value = S.filter(
|
|
151
|
-
(
|
|
179
|
+
(g) => !Be(g, e)
|
|
152
180
|
);
|
|
153
181
|
return;
|
|
154
182
|
} else {
|
|
155
183
|
a.value = [...S, e];
|
|
156
184
|
return;
|
|
157
185
|
}
|
|
158
|
-
},
|
|
159
|
-
activeIndex:
|
|
160
|
-
options:
|
|
186
|
+
}, we = (e) => d.value[e]?.disabled, o = {
|
|
187
|
+
activeIndex: v,
|
|
188
|
+
options: d,
|
|
161
189
|
selectedOption: u,
|
|
162
|
-
labelRef:
|
|
163
|
-
activeOption:
|
|
190
|
+
labelRef: L,
|
|
191
|
+
activeOption: E,
|
|
164
192
|
listRef: w,
|
|
165
193
|
clearable: l.clearable,
|
|
166
|
-
type:
|
|
194
|
+
type: re.input ? V.Search : V.Dropdown,
|
|
167
195
|
mode: l.multi ? T.Multi : T.Single,
|
|
168
|
-
query:
|
|
169
|
-
selectedValue:
|
|
170
|
-
toggle:
|
|
196
|
+
query: y,
|
|
197
|
+
selectedValue: X,
|
|
198
|
+
toggle: O,
|
|
171
199
|
disabled: l.disabled,
|
|
172
|
-
open:
|
|
200
|
+
open: f,
|
|
173
201
|
mandatory: l.mandatory,
|
|
174
202
|
size: l.size,
|
|
175
203
|
placeholder: l.placeholder,
|
|
176
|
-
select:
|
|
204
|
+
select: k,
|
|
177
205
|
clearSelection: () => {
|
|
178
|
-
|
|
206
|
+
M(""), u.value = o.mode === T.Single ? null : [], c.value = o.mode === T.Single ? null : [], h.value && (h.value.value = "");
|
|
179
207
|
},
|
|
180
|
-
search:
|
|
208
|
+
search: M,
|
|
181
209
|
goToOption: async (e) => {
|
|
182
|
-
if (!
|
|
210
|
+
if (!f.value)
|
|
183
211
|
return;
|
|
184
|
-
let t =
|
|
185
|
-
const
|
|
186
|
-
(
|
|
187
|
-
).length, S =
|
|
212
|
+
let t = v.value + e;
|
|
213
|
+
const s = d.value.filter(
|
|
214
|
+
(g) => g.disabled
|
|
215
|
+
).length, S = r.value.length - s;
|
|
188
216
|
for (t > S && (t = S + 1); ; ) {
|
|
189
|
-
if (!
|
|
190
|
-
|
|
217
|
+
if (!d.value[t]?.disabled) {
|
|
218
|
+
E.value = r.value[t], v.value = t;
|
|
191
219
|
return;
|
|
192
220
|
}
|
|
193
|
-
if ((e === 1 || e === 10) && (t = t + 1), (e === -1 || e === -10) && (t = t + -1), !!
|
|
194
|
-
|
|
221
|
+
if ((e === 1 || e === 10) && (t = t + 1), (e === -1 || e === -10) && (t = t + -1), !!we(v.value)) {
|
|
222
|
+
E.value = r.value[t], v.value = t;
|
|
195
223
|
return;
|
|
196
224
|
}
|
|
197
225
|
}
|
|
198
226
|
},
|
|
199
227
|
registerInput: (e) => {
|
|
200
|
-
|
|
228
|
+
h.value = e.value;
|
|
201
229
|
},
|
|
202
|
-
registerOption: (e, t,
|
|
203
|
-
|
|
230
|
+
registerOption: (e, t, s) => {
|
|
231
|
+
d.value = [...d.value, { id: e, disabled: t, hasSubtitle: s }];
|
|
204
232
|
},
|
|
205
233
|
unRegisterOption(e) {
|
|
206
|
-
|
|
234
|
+
d.value = d.value.filter((t) => t.id !== e);
|
|
207
235
|
}
|
|
208
236
|
};
|
|
209
|
-
|
|
237
|
+
Ge(qe, o), F(
|
|
210
238
|
w,
|
|
211
239
|
() => {
|
|
212
|
-
|
|
240
|
+
f.value && Y();
|
|
213
241
|
},
|
|
214
242
|
{
|
|
215
243
|
ignore: [
|
|
216
244
|
I,
|
|
217
|
-
B,
|
|
218
|
-
L,
|
|
219
245
|
U,
|
|
220
|
-
|
|
221
|
-
|
|
246
|
+
q,
|
|
247
|
+
K,
|
|
248
|
+
h,
|
|
249
|
+
Q.ref
|
|
222
250
|
]
|
|
223
251
|
}
|
|
224
252
|
);
|
|
225
|
-
const
|
|
226
|
-
|
|
253
|
+
const Ie = () => {
|
|
254
|
+
h.value && (h.value.value = o.query.value = "");
|
|
227
255
|
};
|
|
228
|
-
|
|
229
|
-
l.autoFocus && (await
|
|
230
|
-
|
|
231
|
-
})),
|
|
256
|
+
He(async () => {
|
|
257
|
+
l.autoFocus && (await N(), setTimeout(() => {
|
|
258
|
+
B.value.focus();
|
|
259
|
+
})), o.goToOption(0);
|
|
232
260
|
});
|
|
233
|
-
const
|
|
234
|
-
u.value = a.value, Array.isArray(u.value) && (
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
},
|
|
261
|
+
const xe = () => {
|
|
262
|
+
u.value = a.value, Array.isArray(u.value) && (c.value = P(u.value).slice()), A("apply", u.value), O(!1), Ie();
|
|
263
|
+
}, Y = () => {
|
|
264
|
+
z.value && Array.isArray(c.value) && (u.value = P(c.value).slice()), y.value = "", O(!1);
|
|
265
|
+
}, De = (e) => {
|
|
238
266
|
if (!l.disableKeyboardEvents)
|
|
239
267
|
switch (e.key) {
|
|
240
268
|
case "Space":
|
|
241
269
|
case "Enter":
|
|
242
270
|
case "ArrowUp":
|
|
243
271
|
case "ArrowDown":
|
|
244
|
-
|
|
272
|
+
O(!0), e.preventDefault();
|
|
245
273
|
}
|
|
246
|
-
},
|
|
274
|
+
}, Ce = (e) => {
|
|
247
275
|
if (!l.disableKeyboardEvents)
|
|
248
276
|
switch (e.key) {
|
|
249
277
|
case "ArrowUp": {
|
|
250
|
-
|
|
278
|
+
o.goToOption(
|
|
251
279
|
-1
|
|
252
280
|
/* Previous */
|
|
253
281
|
), e.preventDefault(), e.stopPropagation();
|
|
254
282
|
break;
|
|
255
283
|
}
|
|
256
284
|
case "ArrowDown": {
|
|
257
|
-
|
|
285
|
+
o.goToOption(
|
|
258
286
|
1
|
|
259
287
|
/* Next */
|
|
260
288
|
), e.preventDefault(), e.stopPropagation();
|
|
261
289
|
break;
|
|
262
290
|
}
|
|
263
291
|
case "Escape": {
|
|
264
|
-
|
|
292
|
+
O(!1), e.preventDefault();
|
|
265
293
|
break;
|
|
266
294
|
}
|
|
267
295
|
case "PageUp": {
|
|
268
|
-
|
|
296
|
+
o.goToOption(
|
|
269
297
|
10
|
|
270
298
|
/* NextPage */
|
|
271
299
|
), e.preventDefault();
|
|
272
300
|
break;
|
|
273
301
|
}
|
|
274
302
|
case "PageDown": {
|
|
275
|
-
|
|
303
|
+
o.goToOption(
|
|
276
304
|
-10
|
|
277
305
|
/* PrevPage */
|
|
278
306
|
), e.preventDefault();
|
|
279
307
|
break;
|
|
280
308
|
}
|
|
281
309
|
case "Enter": {
|
|
282
|
-
if (!
|
|
283
|
-
|
|
310
|
+
if (!f.value) {
|
|
311
|
+
O(!0);
|
|
284
312
|
return;
|
|
285
313
|
}
|
|
286
|
-
|
|
314
|
+
k(r.value[v.value], v.value), o.mode === T.Single && !l.keepOpen && O(!1), e.preventDefault();
|
|
287
315
|
break;
|
|
288
316
|
}
|
|
289
317
|
}
|
|
290
|
-
},
|
|
291
|
-
const e =
|
|
292
|
-
const
|
|
293
|
-
return
|
|
294
|
-
}, 0), t = l.multi && l.showSelectAll ? 1 : 0,
|
|
295
|
-
let
|
|
296
|
-
return l.noResultsText &&
|
|
297
|
-
|
|
318
|
+
}, Ne = i(() => {
|
|
319
|
+
const e = J.value.reduce((Re, Ee) => {
|
|
320
|
+
const Me = l.overrideOptionCountCalculation ? l.overrideOptionCountCalculation(Ee.data) : 1;
|
|
321
|
+
return Re + Me;
|
|
322
|
+
}, 0), t = l.multi && l.showSelectAll && !y.value ? 1 : 0, s = e > b.MAX_NUMBER_OF_OPTIONS, S = e + t;
|
|
323
|
+
let g = s ? b.MAX_NUMBER_OF_OPTIONS + 0.1 : S;
|
|
324
|
+
return l.noResultsText && g === 0 && (g = g + 1), Ke(
|
|
325
|
+
g * W.value + b.PADDING_PX
|
|
298
326
|
);
|
|
299
327
|
});
|
|
300
328
|
return {
|
|
301
|
-
onKeydown:
|
|
302
|
-
location:
|
|
303
|
-
open:
|
|
304
|
-
toggleMenu:
|
|
305
|
-
onButtonKeydown:
|
|
306
|
-
displayedValue:
|
|
307
|
-
labelRef:
|
|
308
|
-
query:
|
|
309
|
-
containerProps:
|
|
310
|
-
calculateTableHeight:
|
|
311
|
-
wrapperProps:
|
|
312
|
-
filteredOptions:
|
|
313
|
-
allSelected:
|
|
314
|
-
isIndeterminate:
|
|
315
|
-
onSelectAll:
|
|
316
|
-
virtualOptions:
|
|
317
|
-
isSelected:
|
|
329
|
+
onKeydown: Ce,
|
|
330
|
+
location: ce,
|
|
331
|
+
open: f,
|
|
332
|
+
toggleMenu: O,
|
|
333
|
+
onButtonKeydown: De,
|
|
334
|
+
displayedValue: ye,
|
|
335
|
+
labelRef: L,
|
|
336
|
+
query: y,
|
|
337
|
+
containerProps: Q,
|
|
338
|
+
calculateTableHeight: Ne,
|
|
339
|
+
wrapperProps: be,
|
|
340
|
+
filteredOptions: r,
|
|
341
|
+
allSelected: p,
|
|
342
|
+
isIndeterminate: Oe,
|
|
343
|
+
onSelectAll: Pe,
|
|
344
|
+
virtualOptions: J,
|
|
345
|
+
isSelected: ie,
|
|
318
346
|
selectedOption: u,
|
|
319
|
-
selectedOptionPrevious:
|
|
320
|
-
selectedValue:
|
|
321
|
-
onSelect:
|
|
322
|
-
activeIndex:
|
|
323
|
-
onCancel:
|
|
324
|
-
onApply:
|
|
325
|
-
scrollTo:
|
|
326
|
-
onClickOutside:
|
|
347
|
+
selectedOptionPrevious: c,
|
|
348
|
+
selectedValue: X,
|
|
349
|
+
onSelect: k,
|
|
350
|
+
activeIndex: v,
|
|
351
|
+
onCancel: Y,
|
|
352
|
+
onApply: xe,
|
|
353
|
+
scrollTo: C,
|
|
354
|
+
onClickOutside: F,
|
|
327
355
|
listRef: w,
|
|
328
356
|
buttonRef: I,
|
|
329
|
-
apply:
|
|
330
|
-
cancel:
|
|
331
|
-
el:
|
|
332
|
-
triggerRef:
|
|
333
|
-
clearAll:
|
|
334
|
-
onClearAllSelections:
|
|
357
|
+
apply: U,
|
|
358
|
+
cancel: q,
|
|
359
|
+
el: B,
|
|
360
|
+
triggerRef: oe,
|
|
361
|
+
clearAll: K,
|
|
362
|
+
onClearAllSelections: Te,
|
|
363
|
+
isGroup: G
|
|
335
364
|
};
|
|
336
365
|
};
|
|
337
366
|
export {
|
|
338
|
-
|
|
367
|
+
el as dropdownCommon
|
|
339
368
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GROUP_OPTION_FLAG = "__IS_GROUP";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export declare const useGroupedOptions: (props: any) => {
|
|
3
|
+
isGroup: (option: any) => boolean;
|
|
4
|
+
sortOutGroups: (options: any) => any;
|
|
5
|
+
flattenAndMarkGroupOptions: (options: any) => any;
|
|
6
|
+
selectAllWithGroups: (filteredOptions: Ref<unknown[]>, selectedOptionRef: Ref<unknown[]>) => void;
|
|
7
|
+
isIndeterminateGrouped: (filteredOptions: any, selectedOptionRef: Ref<unknown[]>) => boolean;
|
|
8
|
+
allSelectedGrouped: (filteredOptions: any, selectedOptionRef: Ref<unknown[]>) => boolean;
|
|
9
|
+
areAllPreviousSelected: (flatOptions: Ref<unknown[]>, selectedOptionPrevious: Ref<unknown[]>) => boolean;
|
|
10
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { GROUP_OPTION_FLAG as i } from "./consts.js";
|
|
2
|
+
const O = (r) => {
|
|
3
|
+
const u = (e) => e && !!e[i], p = (e) => e.reduce((t, n) => {
|
|
4
|
+
const { options: o = [], ...l } = n, g = {
|
|
5
|
+
...l,
|
|
6
|
+
[i]: !0
|
|
7
|
+
};
|
|
8
|
+
return [...t, g, ...o];
|
|
9
|
+
}, []), c = (e) => {
|
|
10
|
+
const t = r.groupedOptions ? [] : e;
|
|
11
|
+
if (r.groupedOptions)
|
|
12
|
+
for (let n = 0; n < e.length; n++) {
|
|
13
|
+
const o = e[n];
|
|
14
|
+
if (u(o)) {
|
|
15
|
+
const l = e[n + 1];
|
|
16
|
+
if (u(l) || !l)
|
|
17
|
+
continue;
|
|
18
|
+
t.push(o);
|
|
19
|
+
} else
|
|
20
|
+
t.push(o);
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
}, h = (e, t) => {
|
|
24
|
+
const n = r.options.length;
|
|
25
|
+
if (t.value.length === e.value.length - n) {
|
|
26
|
+
t.value = [];
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
t.value = e.value.filter(
|
|
30
|
+
(o) => !u(o)
|
|
31
|
+
);
|
|
32
|
+
}, s = (e) => e.value.reduce(
|
|
33
|
+
(t, n) => t + (u(n) ? 0 : 1),
|
|
34
|
+
0
|
|
35
|
+
);
|
|
36
|
+
return {
|
|
37
|
+
isGroup: u,
|
|
38
|
+
sortOutGroups: c,
|
|
39
|
+
flattenAndMarkGroupOptions: p,
|
|
40
|
+
selectAllWithGroups: h,
|
|
41
|
+
isIndeterminateGrouped: (e, t) => {
|
|
42
|
+
const n = s(e);
|
|
43
|
+
return t.value.length > 0 && t.value.length < n;
|
|
44
|
+
},
|
|
45
|
+
allSelectedGrouped: (e, t) => {
|
|
46
|
+
const n = s(e);
|
|
47
|
+
return t.value.length === n;
|
|
48
|
+
},
|
|
49
|
+
areAllPreviousSelected: (e, t) => {
|
|
50
|
+
const n = r.options.length;
|
|
51
|
+
return e.value.length - n === t.value.length;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
O as useGroupedOptions
|
|
57
|
+
};
|