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