@ironsource/shared-ui 2.1.7-test.8 → 2.1.7-test.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 (41) hide show
  1. package/DataGrid.vue_vue_type_style_index_0_scoped_706b324e_lang.css +1 -0
  2. package/DataGridRowsCounter.vue_vue_type_style_index_0_scoped_0ce71f73_lang.css +1 -0
  3. package/DefaultDropdownTrigger.vue_vue_type_style_index_0_scoped_98819e5a_lang.css +1 -0
  4. package/DropdownV4.vue_vue_type_style_index_0_scoped_00ccab6b_lang.css +1 -0
  5. package/OptionV4.vue_vue_type_style_index_0_scoped_77509f61_lang.css +1 -0
  6. package/README.md +1 -1
  7. package/TreeDropdown.vue_vue_type_style_index_0_scoped_5efe563d_lang.css +1 -0
  8. package/components/dropdown/common/Dropdown.common.js +89 -89
  9. package/components/dropdown/v4/DefaultDropdownTrigger.vue.d.ts +1 -0
  10. package/components/dropdown/v4/DefaultDropdownTrigger.vue.js +2 -2
  11. package/components/dropdown/v4/DefaultDropdownTrigger.vue2.js +32 -29
  12. package/components/dropdown/v4/DropdownV4.vue.d.ts +29 -0
  13. package/components/dropdown/v4/DropdownV4.vue.js +4 -4
  14. package/components/dropdown/v4/DropdownV4.vue2.js +186 -158
  15. package/components/dropdown/v4/OptionV4.vue.d.ts +26 -2
  16. package/components/dropdown/v4/OptionV4.vue.js +2 -2
  17. package/components/dropdown/v4/OptionV4.vue2.js +94 -71
  18. package/components/dropdown/v4/TreeDropdown.vue.d.ts +21 -16
  19. package/components/dropdown/v4/TreeDropdown.vue.js +4 -4
  20. package/components/dropdown/v4/TreeDropdown.vue2.js +162 -74
  21. package/components/dropdown/v4/index.d.ts +451 -82
  22. package/components/table/common/Table.common.js +68 -71
  23. package/components/table/v4/DataGrid.vue.d.ts +4 -10
  24. package/components/table/v4/DataGrid.vue.js +4 -4
  25. package/components/table/v4/DataGrid.vue2.js +146 -140
  26. package/components/table/v4/DataGridRowsCounter.vue.js +2 -2
  27. package/components/table/v4/DataGridRowsCounter.vue2.js +13 -14
  28. package/components/table/v4/MultipleDataGrid.vue.d.ts +2 -2
  29. package/components/table/v4/index.d.ts +7 -41
  30. package/components/table/v4/storyUtils.d.ts +0 -8
  31. package/index.d.ts +1203 -533
  32. package/mocks/options.d.ts +12 -0
  33. package/package.json +1 -1
  34. package/DataGrid.vue_vue_type_style_index_0_scoped_467ea11a_lang.css +0 -1
  35. package/DataGridRowsCounter.vue_vue_type_style_index_0_scoped_ef699ec5_lang.css +0 -1
  36. package/DefaultDropdownTrigger.vue_vue_type_style_index_0_scoped_0345d6b1_lang.css +0 -1
  37. package/DropdownV4.vue_vue_type_style_index_0_scoped_938772ee_lang.css +0 -1
  38. package/OptionV4.vue_vue_type_style_index_0_scoped_b6a06f00_lang.css +0 -1
  39. package/TreeDropdown.vue_vue_type_style_index_0_scoped_142eab98_lang.css +0 -1
  40. package/utils/formatNumbers.d.ts +0 -4
  41. package/utils/formatNumbers.js +0 -11
@@ -1,27 +1,28 @@
1
- import "../../../OptionV4.vue_vue_type_style_index_0_scoped_b6a06f00_lang.css"; import { defineComponent as B, ref as z, computed as V, openBlock as n, createBlock as y, unref as i, withCtx as d, createElementVNode as l, normalizeClass as T, createCommentVNode as o, createElementBlock as a, renderSlot as r, createVNode as s, toDisplayString as v, createTextVNode as h, withModifiers as L } from "vue";
1
+ import "../../../OptionV4.vue_vue_type_style_index_0_scoped_77509f61_lang.css"; import { defineComponent as V, ref as x, watch as M, openBlock as i, createBlock as g, unref as o, withCtx as u, createElementVNode as s, normalizeClass as m, createCommentVNode as n, createElementBlock as l, renderSlot as f, createVNode as c, toDisplayString as k, createTextVNode as b, withModifiers as K } from "vue";
2
2
  import "../../typography/Heading.vue.js";
3
- import N from "../../typography/Text.vue.js";
4
- import O from "../../checkbox/v4/CheckboxV4.vue.js";
5
- import g from "../../icon/v4/IconV4.vue.js";
3
+ import S from "../../typography/Text.vue.js";
4
+ import L from "../../checkbox/v4/CheckboxV4.vue.js";
5
+ import y from "../../icon/v4/IconV4.vue.js";
6
6
  import "../../icon/v4/IconFlag.vue.js";
7
- import { NOOP as P } from "@vue/shared";
8
- import { optionCommon as S } from "../common/Option.common.js";
9
- import x from "../../typography/v4/Typography.vue.js";
10
- import E from "../../tooltip/v4/TooltipV4.vue.js";
11
- import { isElementTruncated as j } from "../../../utils/text.js";
12
- const M = {
7
+ import { NOOP as N } from "@vue/shared";
8
+ import { optionCommon as j } from "../common/Option.common.js";
9
+ import w from "../../typography/v4/Typography.vue.js";
10
+ import R from "../../tooltip/v4/TooltipV4.vue.js";
11
+ import { isElementTruncated as A } from "../../../utils/text.js";
12
+ import { promiseTimeout as D } from "@vueuse/core";
13
+ const q = {
13
14
  key: 1,
14
15
  class: "image"
15
- }, R = ["src"], A = {
16
+ }, F = ["src"], G = {
16
17
  key: 2,
17
18
  class: "start-icon"
18
- }, D = { class: "main-text" }, q = {
19
+ }, H = { class: "main-text" }, J = {
19
20
  key: 0,
20
21
  class: "caption-text"
21
- }, F = {
22
+ }, Q = {
22
23
  key: 3,
23
24
  class: "end-icon"
24
- }, G = { key: 0 }, ie = /* @__PURE__ */ B({
25
+ }, U = ["onClick"], W = { key: 0 }, ce = /* @__PURE__ */ V({
25
26
  __name: "OptionV4",
26
27
  props: {
27
28
  option: { default: null },
@@ -38,122 +39,144 @@ const M = {
38
39
  endIconKey: { default: null },
39
40
  endIconType: { default: "regular" },
40
41
  toolTipPlacement: { default: "right" },
42
+ treeMainOption: { type: Boolean, default: !1 },
43
+ treeMainOptionExpanded: { type: Boolean, default: !1 },
44
+ stopOptionClickEventPropagation: { type: Boolean, default: !1 },
41
45
  optionTwoLinesVariant: { default: void 0 },
42
- optionTwoLinesKey: { default: void 0 }
46
+ optionTwoLinesKey: { default: void 0 },
47
+ treeChildShown: { type: Boolean, default: !1 }
43
48
  },
44
- setup(e) {
45
- const k = e, { selected: u, isMulti: m, id: p, onClick: I, api: b } = S(k), f = z(null), C = V(
46
- () => f.value && j(f.value)
47
- ), $ = (t) => t && typeof t == "object" && "optionTooltipText" in t ? t.optionTooltipText : C.value ? t[k.nameKey] : "", w = (t) => t && typeof t == "object" && "optionTooltipTestId" in t ? t.optionTooltipTestId : null;
48
- return (t, c) => (n(), y(i(E), {
49
- text: $(e.option),
50
- "test-id": w(e.option),
49
+ emits: ["toggleTreeCollapse"],
50
+ setup(e, { emit: I }) {
51
+ const a = e, { selected: p, isMulti: T, id: B, onClick: O, api: v } = j(a), $ = (t) => {
52
+ a.stopOptionClickEventPropagation && t.stopPropagation(), a.disabled ? N() : O(t);
53
+ }, d = x(null), h = x(!1);
54
+ M([() => a.treeChildShown, d], async () => {
55
+ await D(100), h.value = d.value && A(d.value);
56
+ });
57
+ const z = (t) => t && typeof t == "object" && "optionTooltipText" in t ? t.optionTooltipText : h.value ? t[a.nameKey] : "", E = (t) => t && typeof t == "object" && "optionTooltipTestId" in t ? t.optionTooltipTestId : null, P = () => {
58
+ I("toggleTreeCollapse", a.option);
59
+ };
60
+ return (t, r) => (i(), g(o(R), {
61
+ text: z(e.option),
62
+ "test-id": E(e.option),
51
63
  placement: e.toolTipPlacement,
52
64
  class: "tooltip-option"
53
65
  }, {
54
- default: d(() => [
55
- l("div", {
66
+ default: u(() => [
67
+ s("div", {
56
68
  ref: "el",
57
- class: T(["item-container", {
69
+ class: m(["item-container", {
58
70
  "item-container--disabled": e.disabled,
59
71
  "item-container--active": e.nameKey ? !1 : e.active,
60
- "item-container--selected": i(u),
61
- "item-container--multi": i(m)
72
+ "item-container--selected": o(p),
73
+ "item-container--multi": o(T)
62
74
  }])
63
75
  }, [
64
- l("div", {
65
- class: T(["item", {
66
- "item--multi": i(m),
76
+ s("div", {
77
+ class: m(["item", {
78
+ "item--multi": o(T),
67
79
  "item--with-icon": t.$slots["icon-start"] || t.$slots.image
68
80
  }])
69
81
  }, [
70
- i(m) ? (n(), y(i(O), {
82
+ o(T) ? (i(), g(o(L), {
71
83
  key: 0,
72
- id: i(p).toString(),
84
+ id: o(B).toString(),
73
85
  tabindex: "-1",
74
86
  class: "checkbox",
75
- "is-checked": i(u),
87
+ "is-checked": o(p),
76
88
  "is-indeterminate": e.isIndeterminate,
77
- onClick: c[0] || (c[0] = (K) => e.disabled ? i(P)() : i(I)(K))
78
- }, null, 8, ["id", "is-checked", "is-indeterminate"])) : o("", !0),
79
- t.$slots.image || e.imageKey ? (n(), a("div", M, [
80
- r(t.$slots, "image", {}, () => [
81
- e.imageKey ? (n(), a("img", {
89
+ onClick: r[0] || (r[0] = (C) => $(C))
90
+ }, null, 8, ["id", "is-checked", "is-indeterminate"])) : n("", !0),
91
+ t.$slots.image || e.imageKey ? (i(), l("div", q, [
92
+ f(t.$slots, "image", {}, () => [
93
+ e.imageKey ? (i(), l("img", {
82
94
  key: 0,
83
95
  src: e.option[e.imageKey]
84
- }, null, 8, R)) : o("", !0)
96
+ }, null, 8, F)) : n("", !0)
85
97
  ], !0)
86
- ])) : o("", !0),
87
- t.$slots["icon-start"] || e.iconKey ? (n(), a("div", A, [
88
- r(t.$slots, "icon-start", {}, () => [
89
- s(i(g), {
98
+ ])) : n("", !0),
99
+ t.$slots["icon-start"] || e.iconKey ? (i(), l("div", G, [
100
+ f(t.$slots, "icon-start", {}, () => [
101
+ c(o(y), {
90
102
  type: e.iconType,
91
103
  name: e.option[e.iconKey],
92
104
  size: e.iconType === "regular" ? "20px" : "16px"
93
105
  }, null, 8, ["type", "name", "size"])
94
106
  ], !0)
95
- ])) : o("", !0),
96
- l("div", {
107
+ ])) : n("", !0),
108
+ s("div", {
97
109
  ref_key: "textContainerRef",
98
- ref: f,
110
+ ref: d,
99
111
  class: "text-container"
100
112
  }, [
101
- s(i(x), {
113
+ c(o(w), {
102
114
  class: "option-text",
103
115
  variant: "body2"
104
116
  }, {
105
- default: d(() => [
106
- r(t.$slots, "default", {}, () => [
107
- l("div", {
108
- class: T(`option-content-${e.optionTwoLinesVariant || "horizontal"}`)
117
+ default: u(() => [
118
+ f(t.$slots, "default", {}, () => [
119
+ s("div", {
120
+ class: m(`option-content-${e.optionTwoLinesVariant || "horizontal"}`)
109
121
  }, [
110
- l("div", D, v(e.option[e.nameKey]), 1),
111
- e.optionTwoLinesKey ? (n(), a("div", q, [
112
- s(i(x), { variant: "caption" }, {
113
- default: d(() => [
114
- h(v(e.option[e.optionTwoLinesKey]), 1)
122
+ s("div", H, k(e.option[e.nameKey]), 1),
123
+ e.optionTwoLinesKey ? (i(), l("div", J, [
124
+ c(o(w), { variant: "caption" }, {
125
+ default: u(() => [
126
+ b(k(e.option[e.optionTwoLinesKey]), 1)
115
127
  ]),
116
128
  _: 1
117
129
  })
118
- ])) : o("", !0)
130
+ ])) : n("", !0)
119
131
  ], 2)
120
132
  ], !0)
121
133
  ]),
122
134
  _: 3
123
135
  }),
124
- e.subtitle ? (n(), y(i(N), {
136
+ e.subtitle ? (i(), g(o(S), {
125
137
  key: 0,
126
138
  class: "subtitle",
127
139
  size: "xs"
128
140
  }, {
129
- default: d(() => [
130
- h(v(e.subtitle), 1)
141
+ default: u(() => [
142
+ b(k(e.subtitle), 1)
131
143
  ]),
132
144
  _: 1
133
- })) : o("", !0)
145
+ })) : n("", !0)
134
146
  ], 512),
135
- t.$slots["icon-end"] || e.endIconKey && e.option[e.endIconKey] ? (n(), a("div", F, [
136
- r(t.$slots, "icon-end", {}, () => [
137
- s(i(g), {
147
+ t.$slots["icon-end"] || e.endIconKey && e.option[e.endIconKey] ? (i(), l("div", Q, [
148
+ f(t.$slots, "icon-end", {}, () => [
149
+ c(o(y), {
138
150
  type: e.endIconType,
139
151
  name: e.option[e.endIconKey],
140
152
  size: e.endIconType === "regular" || e.endIconType === "ab-test" ? "20px" : "16px"
141
153
  }, null, 8, ["type", "name", "size"])
142
154
  ], !0)
143
- ])) : o("", !0)
155
+ ])) : n("", !0),
156
+ e.treeMainOption ? (i(), l("div", {
157
+ key: 4,
158
+ class: "tree-main-arrow-wrapper",
159
+ onClick: K(P, ["stop"])
160
+ }, [
161
+ c(o(y), {
162
+ name: "caret-down",
163
+ size: "16px",
164
+ class: m(`app-trigger--icon ${e.treeMainOptionExpanded && "expanded"}`)
165
+ }, null, 8, ["class"])
166
+ ], 8, U)) : n("", !0)
144
167
  ], 2),
145
- i(b).clearable && i(u) ? (n(), a("div", G, [
146
- l("button", {
168
+ o(v).clearable && o(p) ? (i(), l("div", W, [
169
+ s("button", {
147
170
  class: "clear-button",
148
- onClick: c[1] || (c[1] = L((K) => i(b).clearSelection(), ["prevent", "stop"]))
171
+ onClick: r[1] || (r[1] = K((C) => o(v).clearSelection(), ["prevent", "stop"]))
149
172
  }, [
150
- s(i(g), {
173
+ c(o(y), {
151
174
  name: "close",
152
175
  width: "8",
153
176
  height: "8"
154
177
  })
155
178
  ])
156
- ])) : o("", !0)
179
+ ])) : n("", !0)
157
180
  ], 2)
158
181
  ]),
159
182
  _: 3
@@ -161,5 +184,5 @@ const M = {
161
184
  }
162
185
  });
163
186
  export {
164
- ie as default
187
+ ce as default
165
188
  };
@@ -1,23 +1,23 @@
1
- import { IconTypes } from '@is-ssp/icon/v4/Icon.types';
2
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
2
  options: unknown[];
4
3
  selected?: unknown[];
5
4
  isOpen?: boolean;
6
5
  placeholder?: string;
7
6
  inlineSearchPlaceholder?: string;
8
- size?: 'small' | 'medium' | 'large';
7
+ size?: "small" | "medium" | "large";
9
8
  disabled?: boolean;
10
9
  testId?: string;
11
10
  displayValue: (option: unknown) => string;
12
11
  optionNameKey?: string;
13
12
  optionIconKey?: string;
14
13
  optionImageKey?: string;
15
- optionIconType?: IconTypes;
14
+ optionIconType?: "fill" | "bold" | "regular" | "branded" | "ad-unit" | "ab-test" | "ad-networks" | "ad-networks/flat" | "content-rate";
16
15
  optionEndIconKey?: string;
17
- optionEndIconType?: IconTypes;
16
+ optionEndIconType?: "fill" | "bold" | "regular" | "branded" | "ad-unit" | "ab-test" | "ad-networks" | "ad-networks/flat" | "content-rate";
18
17
  valueToCopy?: string;
19
18
  disabledOptionKey?: string;
20
- optionChildrenKey?: string;
19
+ optionChildrenKey: string;
20
+ optionUniqueIdKey: string;
21
21
  }>, {
22
22
  selected: any;
23
23
  placeholder: string;
@@ -33,7 +33,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
33
33
  optionEndIconType: any;
34
34
  valueToCopy: any;
35
35
  disabledOptionKey: string;
36
- optionChildrenKey: string;
37
36
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
38
37
  "update:selected": (value: unknown) => void;
39
38
  "update:isOpen": (value: unknown) => void;
@@ -43,19 +42,20 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
43
42
  isOpen?: boolean;
44
43
  placeholder?: string;
45
44
  inlineSearchPlaceholder?: string;
46
- size?: 'small' | 'medium' | 'large';
45
+ size?: "small" | "medium" | "large";
47
46
  disabled?: boolean;
48
47
  testId?: string;
49
48
  displayValue: (option: unknown) => string;
50
49
  optionNameKey?: string;
51
50
  optionIconKey?: string;
52
51
  optionImageKey?: string;
53
- optionIconType?: IconTypes;
52
+ optionIconType?: "fill" | "bold" | "regular" | "branded" | "ad-unit" | "ab-test" | "ad-networks" | "ad-networks/flat" | "content-rate";
54
53
  optionEndIconKey?: string;
55
- optionEndIconType?: IconTypes;
54
+ optionEndIconType?: "fill" | "bold" | "regular" | "branded" | "ad-unit" | "ab-test" | "ad-networks" | "ad-networks/flat" | "content-rate";
56
55
  valueToCopy?: string;
57
56
  disabledOptionKey?: string;
58
- optionChildrenKey?: string;
57
+ optionChildrenKey: string;
58
+ optionUniqueIdKey: string;
59
59
  }>, {
60
60
  selected: any;
61
61
  placeholder: string;
@@ -71,13 +71,12 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
71
71
  optionEndIconType: any;
72
72
  valueToCopy: any;
73
73
  disabledOptionKey: string;
74
- optionChildrenKey: string;
75
74
  }>>> & {
76
75
  "onUpdate:selected"?: (value: unknown) => any;
77
76
  "onUpdate:isOpen"?: (value: unknown) => any;
78
77
  }, {
79
78
  disabled: boolean;
80
- size: 'small' | 'medium' | 'large';
79
+ size: "small" | "medium" | "large";
81
80
  testId: string;
82
81
  selected: unknown[];
83
82
  placeholder: string;
@@ -85,12 +84,13 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
85
84
  optionNameKey: string;
86
85
  optionIconKey: string;
87
86
  optionImageKey: string;
88
- optionIconType: IconTypes;
87
+ optionIconType: "fill" | "bold" | "regular" | "branded" | "ad-unit" | "ab-test" | "ad-networks" | "ad-networks/flat" | "content-rate";
89
88
  optionEndIconKey: string;
90
- optionEndIconType: IconTypes;
89
+ optionEndIconType: "fill" | "bold" | "regular" | "branded" | "ad-unit" | "ab-test" | "ad-networks" | "ad-networks/flat" | "content-rate";
91
90
  valueToCopy: string;
92
91
  disabledOptionKey: string;
93
- optionChildrenKey: string;
92
+ }>, {
93
+ "trigger-end-icon"?(_: {}): any;
94
94
  }>;
95
95
  export default _default;
96
96
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -110,3 +110,8 @@ type __VLS_WithDefaults<P, D> = {
110
110
  type __VLS_Prettify<T> = {
111
111
  [K in keyof T]: T[K];
112
112
  } & {};
113
+ type __VLS_WithTemplateSlots<T, S> = T & {
114
+ new (): {
115
+ $slots: S;
116
+ };
117
+ };
@@ -1,7 +1,7 @@
1
- import o from "./TreeDropdown.vue2.js";
2
- /* empty css */import e from "../../../_virtual/_plugin-vue_export-helper.js";
3
- // import "../../../TreeDropdown.vue_vue_type_style_index_0_scoped_142eab98_lang.css"; //*');
4
- const s = /* @__PURE__ */ e(o, [["__scopeId", "data-v-142eab98"]]);
1
+ import e from "./TreeDropdown.vue2.js";
2
+ /* empty css */import o from "../../../_virtual/_plugin-vue_export-helper.js";
3
+ // import "../../../TreeDropdown.vue_vue_type_style_index_0_scoped_5efe563d_lang.css"; //*');
4
+ const s = /* @__PURE__ */ o(e, [["__scopeId", "data-v-5efe563d"]]);
5
5
  export {
6
6
  s as default
7
7
  };
@@ -1,18 +1,19 @@
1
- import "../../../TreeDropdown.vue_vue_type_style_index_0_scoped_142eab98_lang.css"; import { defineComponent as w, ref as S, watch as T, openBlock as u, createBlock as f, unref as o, withCtx as E, createVNode as N, withModifiers as k, createElementBlock as h, Fragment as B, renderList as x, createCommentVNode as z } from "vue";
2
- import V from "./DropdownV4.vue.js";
3
- import "./DefaultDropdownTrigger.vue.js";
1
+ import "../../../TreeDropdown.vue_vue_type_style_index_0_scoped_5efe563d_lang.css"; import { defineComponent as $, provide as j, ref as r, onMounted as F, watch as C, openBlock as v, createBlock as T, unref as a, withCtx as m, createVNode as k, normalizeProps as R, guardReactiveProps as G, renderSlot as H, withModifiers as U, createElementBlock as q, withDirectives as J, createElementVNode as Q, Fragment as W, renderList as X, vShow as Y, createCommentVNode as Z } from "vue";
2
+ import _ from "./DropdownV4.vue.js";
3
+ import ee from "./DefaultDropdownTrigger.vue.js";
4
4
  import "./IconButtonDropdownTrigger.vue.js";
5
5
  import "./ChipDropdownTrigger.vue.js";
6
6
  import "./AppDropdownTrigger.vue.js";
7
7
  import "./ButtonDropdownTrigger.vue.js";
8
8
  import "./ButtonFilterDropdownTrigger.vue.js";
9
9
  import "./TreeDropdown.vue.js";
10
- import v from "./OptionV4.vue.js";
11
- import { useChildOptions as D } from "../composables/useChildOptions.js";
12
- const P = {
10
+ import N from "./OptionV4.vue.js";
11
+ import { useChildOptions as ne } from "../composables/useChildOptions.js";
12
+ import le from "../../search/v4/SearchV4.vue.js";
13
+ const oe = {
13
14
  key: 0,
14
15
  class: "child-options"
15
- }, Q = /* @__PURE__ */ w({
16
+ }, ve = /* @__PURE__ */ $({
16
17
  __name: "TreeDropdown",
17
18
  props: {
18
19
  options: null,
@@ -32,91 +33,178 @@ const P = {
32
33
  optionEndIconType: { default: null },
33
34
  valueToCopy: { default: null },
34
35
  disabledOptionKey: { default: "disabled" },
35
- optionChildrenKey: { default: "" }
36
+ optionChildrenKey: null,
37
+ optionUniqueIdKey: null
36
38
  },
37
39
  emits: ["update:selected", "update:isOpen"],
38
- setup(e, { emit: y }) {
39
- const a = e, l = S(a.selected);
40
- T(
41
- () => a.selected,
40
+ setup(o, { emit: I }) {
41
+ const l = o;
42
+ j("isTreeDropdown", !0);
43
+ const f = r([]), h = r([]), w = r({}), O = r(!1), i = r(l.selected), u = r("");
44
+ F(() => {
45
+ O.value || (l.options.forEach((n) => {
46
+ n[l.optionChildrenKey] && n[l.optionChildrenKey].length && (w.value[n[l.optionUniqueIdKey]] = [
47
+ ...n[l.optionChildrenKey]
48
+ ]);
49
+ }), f.value = [...l.options], h.value = [...l.options], O.value = !0);
50
+ }), C(
51
+ () => l.selected,
42
52
  () => {
43
- l.value = [...a.selected];
53
+ i.value = [...l.selected];
44
54
  }
45
55
  );
46
- const { hasChildren: c, getChildren: d, allChildrenSelected: r, someChildrenSelected: K } = D(l, a.optionChildrenKey), p = (n) => {
47
- if (c(n)) {
48
- r(n) ? l.value = l.value.filter(
49
- (i) => !d(n).includes(i)
50
- ) : l.value = [
51
- ...l.value.filter((i) => !d(n).includes(i)),
52
- ...d(n)
56
+ const { hasChildren: p, getChildren: y, allChildrenSelected: K, someChildrenSelected: V } = ne(i, l.optionChildrenKey), S = (n) => {
57
+ if (p(n)) {
58
+ K(n) ? i.value = i.value.filter(
59
+ (t) => !y(n).includes(t)
60
+ ) : i.value = [
61
+ ...i.value.filter((t) => !y(n).includes(t)),
62
+ ...y(n)
53
63
  ];
54
64
  return;
55
65
  }
56
- l.value.includes(n) ? l.value = l.value.filter(
57
- (i) => i !== n
58
- ) : l.value = [...l.value, n];
59
- }, m = (n) => l.value.includes(n), C = (n) => 1 + (c(n) ? d(n).length : 0), I = () => {
60
- y("update:selected", l.value);
61
- }, g = () => {
62
- l.value = [];
66
+ i.value.includes(n) ? i.value = i.value.filter(
67
+ (t) => t !== n
68
+ ) : i.value = [...i.value, n];
69
+ }, b = (n) => i.value.includes(n), z = (n) => 1 + (p(n) ? y(n).length : 0), D = () => {
70
+ I("update:selected", i.value);
71
+ }, x = () => {
72
+ i.value = [];
73
+ }, B = () => {
74
+ const n = /* @__PURE__ */ new Set([]);
75
+ h.value.forEach((e) => {
76
+ if (l.selected?.includes(e))
77
+ n.add(e);
78
+ else if (e[l.optionChildrenKey] && e[l.optionChildrenKey].length) {
79
+ for (const s of e[l.optionChildrenKey])
80
+ if (l.selected?.includes(s)) {
81
+ n.add(e);
82
+ break;
83
+ }
84
+ }
85
+ });
86
+ const t = Array.from(n);
87
+ return h.value.forEach((e) => {
88
+ !l.selected.includes(e) && !n.has(e) && t.push(e);
89
+ }), t;
63
90
  };
64
- return (n, i) => (u(), f(o(V), {
91
+ C(
92
+ () => l.isOpen,
93
+ () => {
94
+ l.isOpen ? f.value = B() : (i.value = [...l.selected], u.value = "");
95
+ }
96
+ );
97
+ const d = r({}), M = (n) => {
98
+ d.value[n[l.optionUniqueIdKey]] ? delete d.value[n[l.optionUniqueIdKey]] : d.value[n[l.optionUniqueIdKey]] = 1;
99
+ };
100
+ function P(n, t) {
101
+ const e = n.toLowerCase(), s = [];
102
+ return t.value.forEach((c) => {
103
+ const g = c[l.optionNameKey].toLowerCase().includes(e), E = w.value[c[l.optionUniqueIdKey]]?.filter(
104
+ (L) => L[l.optionNameKey].toLowerCase().includes(e)
105
+ ) || [];
106
+ (g || E.length > 0) && (c[l.optionChildrenKey] = E, s.push(c));
107
+ }), s;
108
+ }
109
+ const A = (n) => {
110
+ const t = P(n, h);
111
+ n && (Object.keys(d.value).forEach((e) => {
112
+ delete d.value[e];
113
+ }), t.forEach((e) => {
114
+ Array.isArray(e[l.optionChildrenKey]) && e[l.optionChildrenKey].length && (d.value[e[l.optionUniqueIdKey]] = 1);
115
+ })), f.value = t;
116
+ };
117
+ return C(
118
+ () => u.value,
119
+ () => {
120
+ A(u.value);
121
+ }
122
+ ), (n, t) => (v(), T(a(_), {
65
123
  multi: "",
66
124
  class: "tree-dropdown",
67
125
  "show-select-all": !1,
68
- "is-open": e.isOpen,
69
- options: e.options,
70
- selected: e.selected,
71
- "display-value": e.displayValue,
72
- placeholder: e.placeholder,
73
- "inline-search-placeholder": e.inlineSearchPlaceholder,
74
- "option-name-key": e.optionNameKey,
75
- size: e.size,
76
- "test-id": e.testId,
77
- disabled: e.disabled,
126
+ "is-open": o.isOpen,
127
+ options: f.value,
128
+ selected: o.selected,
129
+ "display-value": o.displayValue,
130
+ placeholder: o.placeholder,
131
+ "inline-search": "",
132
+ "inline-search-placeholder": o.inlineSearchPlaceholder,
133
+ "option-name-key": o.optionNameKey,
134
+ size: o.size,
135
+ "test-id": o.testId,
136
+ disabled: o.disabled,
78
137
  "disable-virtual-scroll": "",
79
- "override-option-count-calculation": C,
138
+ "override-option-count-calculation": z,
80
139
  "trigger-show-all-selected-text": !1,
81
- "onUpdate:selected": i[0] || (i[0] = (t) => y("update:selected", t)),
82
- "onUpdate:isOpen": i[1] || (i[1] = (t) => y("update:isOpen", t)),
83
- onApply: I,
84
- onClear: g
140
+ "predefined-trigger": "default",
141
+ "onUpdate:isOpen": t[1] || (t[1] = (e) => I("update:isOpen", e)),
142
+ onApply: D,
143
+ onClear: x
85
144
  }, {
86
- default: E(({ option: t, index: b }) => [
87
- N(o(v), {
88
- option: t,
89
- "selected-prop": o(c)(t) ? o(r)(t) : m(t),
90
- "is-indeterminate": !o(r)(t) && o(K)(t),
91
- disabled: t[e.disabledOptionKey],
92
- "name-key": e.optionNameKey,
93
- "image-key": e.optionImageKey,
94
- "icon-key": e.optionIconKey,
95
- "icon-type": e.optionIconType,
96
- "end-icon-key": e.optionEndIconKey,
97
- "end-icon-type": e.optionEndIconType,
98
- onClick: k(() => p(t), ["stop"])
99
- }, null, 8, ["option", "selected-prop", "is-indeterminate", "disabled", "name-key", "image-key", "icon-key", "icon-type", "end-icon-key", "end-icon-type", "onClick"]),
100
- o(c)(t) ? (u(), h("div", P, [
101
- (u(!0), h(B, null, x(o(d)(t), (s, O) => (u(), f(o(v), {
102
- key: `${b}-${O}`,
103
- option: s,
104
- "selected-prop": m(s),
105
- disabled: s[e.disabledOptionKey],
106
- "name-key": e.optionNameKey,
107
- "image-key": e.optionImageKey,
108
- "icon-key": e.optionIconKey,
109
- "icon-type": e.optionIconType,
110
- "end-icon-key": e.optionEndIconKey,
111
- "end-icon-type": e.optionEndIconType,
112
- onClick: k(() => p(s), ["stop"])
113
- }, null, 8, ["option", "selected-prop", "disabled", "name-key", "image-key", "icon-key", "icon-type", "end-icon-key", "end-icon-type", "onClick"]))), 128))
114
- ])) : z("", !0)
145
+ "dropdown-trigger": m(({ defaultTriggerProps: e }) => [
146
+ k(a(ee), R(G(e)), {
147
+ "end-icon": m(() => [
148
+ H(n.$slots, "trigger-end-icon", {}, void 0, !0)
149
+ ]),
150
+ _: 2
151
+ }, 1040)
152
+ ]),
153
+ "inline-search": m(() => [
154
+ k(a(le), {
155
+ modelValue: u.value,
156
+ "onUpdate:modelValue": t[0] || (t[0] = (e) => u.value = e),
157
+ placeholder: o.inlineSearchPlaceholder,
158
+ variant: "transparent",
159
+ size: "md",
160
+ "auto-focus": "",
161
+ "test-id": o.testId
162
+ }, null, 8, ["modelValue", "placeholder", "test-id"])
163
+ ]),
164
+ default: m(({ option: e, index: s }) => [
165
+ k(a(N), {
166
+ option: e,
167
+ "selected-prop": a(p)(e) ? a(K)(e) : b(e),
168
+ "is-indeterminate": !a(K)(e) && a(V)(e),
169
+ disabled: e[o.disabledOptionKey],
170
+ "name-key": o.optionNameKey,
171
+ "image-key": o.optionImageKey,
172
+ "icon-key": o.optionIconKey,
173
+ "icon-type": o.optionIconType,
174
+ "end-icon-key": o.optionEndIconKey,
175
+ "end-icon-type": o.optionEndIconType,
176
+ "tree-main-option": a(p)(e),
177
+ "tree-main-option-expanded": d.value[e[o.optionUniqueIdKey]],
178
+ "stop-option-click-event-propagation": "",
179
+ onClick: U(() => S(e), ["stop"]),
180
+ onToggleTreeCollapse: M
181
+ }, null, 8, ["option", "selected-prop", "is-indeterminate", "disabled", "name-key", "image-key", "icon-key", "icon-type", "end-icon-key", "end-icon-type", "tree-main-option", "tree-main-option-expanded", "onClick"]),
182
+ a(p)(e) ? (v(), q("div", oe, [
183
+ J(Q("div", null, [
184
+ (v(!0), q(W, null, X(a(y)(e), (c, g) => (v(), T(a(N), {
185
+ key: `${s}-${g}`,
186
+ option: c,
187
+ "selected-prop": b(c),
188
+ disabled: c[o.disabledOptionKey],
189
+ "name-key": o.optionNameKey,
190
+ "image-key": o.optionImageKey,
191
+ "icon-key": o.optionIconKey,
192
+ "icon-type": o.optionIconType,
193
+ "end-icon-key": o.optionEndIconKey,
194
+ "end-icon-type": o.optionEndIconType,
195
+ "tree-child-shown": d.value[e[o.optionUniqueIdKey]],
196
+ "stop-option-click-event-propagation": "",
197
+ onClick: U(() => S(c), ["stop"])
198
+ }, null, 8, ["option", "selected-prop", "disabled", "name-key", "image-key", "icon-key", "icon-type", "end-icon-key", "end-icon-type", "tree-child-shown", "onClick"]))), 128))
199
+ ], 512), [
200
+ [Y, d.value[e[o.optionUniqueIdKey]]]
201
+ ])
202
+ ])) : Z("", !0)
115
203
  ]),
116
- _: 1
204
+ _: 3
117
205
  }, 8, ["is-open", "options", "selected", "display-value", "placeholder", "inline-search-placeholder", "option-name-key", "size", "test-id", "disabled"]));
118
206
  }
119
207
  });
120
208
  export {
121
- Q as default
209
+ ve as default
122
210
  };