@shtabapp/ui-kit 1.45.0 → 1.47.0
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/CHANGELOG.md +13 -0
- package/dist/{SChartBurnup-DhuCNXhU.cjs → SChartBurnup-BhCS06uF.cjs} +1 -1
- package/dist/SChartBurnup-CG239MJx.js +251 -0
- package/dist/SChartHorizontalBar-DnKbf_9E.cjs +1 -0
- package/dist/SChartHorizontalBar-DqTZ4H-9.js +175 -0
- package/dist/SChartLegend-DGtjd6zV.cjs +1 -0
- package/dist/SChartLegend-oZoF8XK7.js +42 -0
- package/dist/SChartLine-CEnRbnVo.cjs +1 -0
- package/dist/SChartLine-CQhbtAjJ.js +129 -0
- package/dist/SChartMultiLine-B6GldTYv.cjs +1 -0
- package/dist/SChartMultiLine-CPEglksk.js +198 -0
- package/dist/SChartPie-CQyENNM6.cjs +1 -0
- package/dist/SChartPie-DXHCXNEs.js +168 -0
- package/dist/{SChartProgress-Zdphet8I.js → SChartProgress-BwDuidgB.js} +54 -50
- package/dist/{SChartProgress-QsGTZ8kT.cjs → SChartProgress-CMcM6yvT.cjs} +1 -1
- package/dist/SChartSkeletonHost-BlIYGj-7.cjs +1 -0
- package/dist/{SChartSkeletonHost-CecfQ3Ye.js → SChartSkeletonHost-DSFyP_DN.js} +150 -89
- package/dist/SChartStackedArea-BR7W44h6.js +254 -0
- package/dist/SChartStackedArea-DHSamqau.cjs +1 -0
- package/dist/SChartStackedBar-B3HcO4UQ.cjs +1 -0
- package/dist/SChartStackedBar-BbYna5KB.js +245 -0
- package/dist/{SColorPicker-ksmNupJa.js → SColorPicker-BqsD-5xA.js} +1 -1
- package/dist/{SColorPicker-BIrkgFys.cjs → SColorPicker-CeKB3QS1.cjs} +1 -1
- package/dist/SList-DAzztC-7.js +514 -0
- package/dist/SList-S18K8mlH.cjs +1 -0
- package/dist/{SSelect-DS2EGmjV.js → SSelect-Bntb-dgY.js} +1 -1
- package/dist/{SSelect-CkV6gq4S.cjs → SSelect-DcTEwHx6.cjs} +1 -1
- package/dist/components/SChartBurnup/SChartBurnup.vue.d.ts +4 -1
- package/dist/components/SChartBurnup/SChartBurnup.vue.d.ts.map +1 -1
- package/dist/components/SChartHorizontalBar/SChartHorizontalBar.vue.d.ts +9 -2
- package/dist/components/SChartHorizontalBar/SChartHorizontalBar.vue.d.ts.map +1 -1
- package/dist/components/SChartHorizontalBar/utils/buildSChartHorizontalBarConfig.d.ts +1 -0
- package/dist/components/SChartHorizontalBar/utils/buildSChartHorizontalBarConfig.d.ts.map +1 -1
- package/dist/components/SChartLegend/SChartLegend.types.d.ts +2 -0
- package/dist/components/SChartLegend/SChartLegend.types.d.ts.map +1 -1
- package/dist/components/SChartLegend/SChartLegend.vue.d.ts +5 -1
- package/dist/components/SChartLegend/SChartLegend.vue.d.ts.map +1 -1
- package/dist/components/SChartLine/SChartLine.vue.d.ts +4 -1
- package/dist/components/SChartLine/SChartLine.vue.d.ts.map +1 -1
- package/dist/components/SChartMultiLine/SChartMultiLine.vue.d.ts +9 -2
- package/dist/components/SChartMultiLine/SChartMultiLine.vue.d.ts.map +1 -1
- package/dist/components/SChartMultiLine/utils/buildMultiLineChartConfig.d.ts +2 -1
- package/dist/components/SChartMultiLine/utils/buildMultiLineChartConfig.d.ts.map +1 -1
- package/dist/components/SChartPie/SChartPie.vue.d.ts +9 -2
- package/dist/components/SChartPie/SChartPie.vue.d.ts.map +1 -1
- package/dist/components/SChartPie/utils/buildPieChartConfig.d.ts +2 -1
- package/dist/components/SChartPie/utils/buildPieChartConfig.d.ts.map +1 -1
- package/dist/components/SChartProgress/SChartProgress.vue.d.ts +4 -1
- package/dist/components/SChartProgress/SChartProgress.vue.d.ts.map +1 -1
- package/dist/components/SChartSegmentedBar/SChartSegmentedBar.vue.d.ts +9 -2
- package/dist/components/SChartSegmentedBar/SChartSegmentedBar.vue.d.ts.map +1 -1
- package/dist/components/SChartSegmentedBar/utils/buildSegmentedBarChartConfig.d.ts +2 -1
- package/dist/components/SChartSegmentedBar/utils/buildSegmentedBarChartConfig.d.ts.map +1 -1
- package/dist/components/SChartStackedArea/SChartStackedArea.vue.d.ts +9 -2
- package/dist/components/SChartStackedArea/SChartStackedArea.vue.d.ts.map +1 -1
- package/dist/components/SChartStackedArea/utils/buildStackedAreaChartConfig.d.ts +2 -1
- package/dist/components/SChartStackedArea/utils/buildStackedAreaChartConfig.d.ts.map +1 -1
- package/dist/components/SChartStackedBar/SChartStackedBar.vue.d.ts +9 -2
- package/dist/components/SChartStackedBar/SChartStackedBar.vue.d.ts.map +1 -1
- package/dist/components/SChartStackedBar/utils/buildStackedBarChartConfig.d.ts +2 -1
- package/dist/components/SChartStackedBar/utils/buildStackedBarChartConfig.d.ts.map +1 -1
- package/dist/components/SList/SList.types.d.ts +11 -0
- package/dist/components/SList/SList.types.d.ts.map +1 -1
- package/dist/components/SList/SList.vue.d.ts +11 -3
- package/dist/components/SList/SList.vue.d.ts.map +1 -1
- package/dist/composables/useChartInteractivity.d.ts +14 -0
- package/dist/composables/useChartInteractivity.d.ts.map +1 -0
- package/dist/composables/useFlatTreeList.d.ts +4 -1
- package/dist/composables/useFlatTreeList.d.ts.map +1 -1
- package/dist/composables/useHasListener.d.ts +2 -0
- package/dist/composables/useHasListener.d.ts.map +1 -0
- package/dist/{createChartCrosshairPlugin-HfMMUP5O.cjs → createChartCrosshairPlugin-DdLyEWI0.cjs} +1 -1
- package/dist/{createChartCrosshairPlugin-BC0IDCn3.js → createChartCrosshairPlugin-q3U4ePnf.js} +2 -2
- package/dist/entries/chart-burnup.cjs +1 -1
- package/dist/entries/chart-burnup.js +1 -1
- package/dist/entries/chart-horizontal-bar.cjs +1 -1
- package/dist/entries/chart-horizontal-bar.js +1 -1
- package/dist/entries/chart-line.cjs +1 -1
- package/dist/entries/chart-line.js +1 -1
- package/dist/entries/chart-multi-line.cjs +1 -1
- package/dist/entries/chart-multi-line.js +1 -1
- package/dist/entries/chart-pie.cjs +1 -1
- package/dist/entries/chart-pie.js +1 -1
- package/dist/entries/chart-progress.cjs +1 -1
- package/dist/entries/chart-progress.js +1 -1
- package/dist/entries/chart-stacked-area.cjs +1 -1
- package/dist/entries/chart-stacked-area.js +1 -1
- package/dist/entries/chart-stacked-bar.cjs +1 -1
- package/dist/entries/chart-stacked-bar.js +1 -1
- package/dist/entries/color-picker.cjs +1 -1
- package/dist/entries/color-picker.js +1 -1
- package/dist/entries/list.cjs +1 -1
- package/dist/entries/list.js +1 -1
- package/dist/entries/select.cjs +1 -1
- package/dist/entries/select.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +184 -140
- package/dist/resolveSeriesPaletteColor-YACKW1NO.cjs +1 -0
- package/dist/{resolveSeriesPaletteColor-m8HQ9qwV.js → resolveSeriesPaletteColor-fuhGbjFO.js} +1 -1
- package/dist/{resolveStackedChartContext-DdraOueU.js → resolveStackedChartContext-BiIGZ2or.js} +5 -5
- package/dist/{resolveStackedChartContext-BywAnZUu.cjs → resolveStackedChartContext-Bp75eU_I.cjs} +1 -1
- package/dist/useHasListener-BPgtbbo6.cjs +1 -0
- package/dist/useHasListener-RSjlUyqH.js +8 -0
- package/dist/utils/chart/core/chartCssVariables.d.ts +2 -0
- package/dist/utils/chart/core/chartCssVariables.d.ts.map +1 -1
- package/dist/utils/chart/core/chartInteractivity.d.ts +41 -0
- package/dist/utils/chart/core/chartInteractivity.d.ts.map +1 -0
- package/dist/utils/chart/horizontalBar/buildHorizontalBarChartConfig.d.ts +2 -1
- package/dist/utils/chart/horizontalBar/buildHorizontalBarChartConfig.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/SChartBurnup-DYBnJMnm.js +0 -247
- package/dist/SChartHorizontalBar-DMBzyz9x.cjs +0 -1
- package/dist/SChartHorizontalBar-bm3Jexa3.js +0 -156
- package/dist/SChartLegend-Chr0IZWN.js +0 -30
- package/dist/SChartLegend-DXFXKXCm.cjs +0 -1
- package/dist/SChartLine-CiREb4H_.js +0 -125
- package/dist/SChartLine-P57XRR2o.cjs +0 -1
- package/dist/SChartMultiLine-3cdB0U12.js +0 -166
- package/dist/SChartMultiLine-BW1kITlR.cjs +0 -1
- package/dist/SChartPie-55wx2zRi.cjs +0 -1
- package/dist/SChartPie-Dc_gjzIl.js +0 -143
- package/dist/SChartSkeletonHost-CfM0zolj.cjs +0 -1
- package/dist/SChartStackedArea-BaJ963lU.cjs +0 -1
- package/dist/SChartStackedArea-cjN9gECV.js +0 -219
- package/dist/SChartStackedBar-0jGICBA0.js +0 -217
- package/dist/SChartStackedBar-j9WyOnsL.cjs +0 -1
- package/dist/SList-BtfUntkw.js +0 -437
- package/dist/SList-fZQdPkFG.cjs +0 -1
- package/dist/resolveSeriesPaletteColor-BcFyrhh0.cjs +0 -1
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { n as e, o as t, r as n, t as r } from "./useSelectionGroup-cKj38lEN.js";
|
|
2
|
+
import { r as i, t as a } from "./SListItem-BRXZEePg.js";
|
|
3
|
+
import { Fragment as o, computed as s, createBlock as c, createElementBlock as l, createElementVNode as u, createSlots as d, createVNode as f, defineComponent as p, mergeModels as m, mergeProps as h, nextTick as ee, normalizeClass as g, normalizeStyle as _, openBlock as v, provide as te, renderList as ne, renderSlot as y, toValue as b, unref as x, useId as re, useModel as S, useSlots as ie, useTemplateRef as ae, withCtx as C } from "vue";
|
|
4
|
+
import { ESIconName as w, SSpinner as oe, useUiKitI18n as se } from "@shtabapp/ui-kit-primitives";
|
|
5
|
+
import { useInfiniteScroll as T } from "@vueuse/core";
|
|
6
|
+
import { useVirtualizer as ce } from "@tanstack/vue-virtual";
|
|
7
|
+
//#region src/composables/useFlatTreeList.ts
|
|
8
|
+
var E = (e, t) => {
|
|
9
|
+
if (typeof t == "function") return t(e);
|
|
10
|
+
let n = e[t];
|
|
11
|
+
return typeof n == "string" ? n : typeof n == "number" ? String(n) : "";
|
|
12
|
+
}, D = (e, t) => {
|
|
13
|
+
let n = e[t];
|
|
14
|
+
return Array.isArray(n) ? n.filter((e) => typeof e == "object" && !!e) : [];
|
|
15
|
+
}, O = (e, t) => {
|
|
16
|
+
if (!t) return !1;
|
|
17
|
+
let n = e[t];
|
|
18
|
+
return typeof n == "boolean" ? n : !1;
|
|
19
|
+
}, le = "__s-ui-load-more:", k = (e) => `${le}${e}`, A = (e, t, n, r) => {
|
|
20
|
+
D(e, n).forEach((e) => {
|
|
21
|
+
let i = E(e, t);
|
|
22
|
+
i && r.add(i), A(e, t, n, r);
|
|
23
|
+
});
|
|
24
|
+
}, j = (e, t, n, r) => {
|
|
25
|
+
for (let i of e) {
|
|
26
|
+
if (E(i, n) === t) return i;
|
|
27
|
+
let e = j(D(i, r), t, n, r);
|
|
28
|
+
if (e) return e;
|
|
29
|
+
}
|
|
30
|
+
}, M = (e, t, n, r, i, a, o, s) => {
|
|
31
|
+
e.forEach((e) => {
|
|
32
|
+
let c = E(e, t);
|
|
33
|
+
if (!c) return;
|
|
34
|
+
let l = D(e, n), u = l.length > 0, d = r.includes(c);
|
|
35
|
+
o.push({
|
|
36
|
+
key: c,
|
|
37
|
+
item: e,
|
|
38
|
+
depth: i,
|
|
39
|
+
flatIndex: o.length,
|
|
40
|
+
hasChildren: u,
|
|
41
|
+
expanded: d,
|
|
42
|
+
parentKey: a
|
|
43
|
+
}), u && d && M(l, t, n, r, i + 1, c, o, s), u && d && O(e, s) && o.push({
|
|
44
|
+
key: k(c),
|
|
45
|
+
item: e,
|
|
46
|
+
depth: i + 1,
|
|
47
|
+
flatIndex: o.length,
|
|
48
|
+
hasChildren: !1,
|
|
49
|
+
expanded: !1,
|
|
50
|
+
parentKey: c,
|
|
51
|
+
loadMoreForKey: c
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}, N = ({ items: e, childrenKey: t, itemKey: n, expanded: r, hasMoreChildrenKey: i }) => ({
|
|
55
|
+
flatRows: s(() => {
|
|
56
|
+
let a = [], o = b(e), s = b(t), c = b(n), l = b(i);
|
|
57
|
+
return M(o, c, s, r.value, 0, void 0, a, l), a;
|
|
58
|
+
}),
|
|
59
|
+
toggleExpanded: (i) => {
|
|
60
|
+
let a = b(e), o = b(t), s = b(n), c = new Set(r.value);
|
|
61
|
+
if (c.has(i)) {
|
|
62
|
+
c.delete(i);
|
|
63
|
+
let e = j(a, i, s, o);
|
|
64
|
+
if (e) {
|
|
65
|
+
let t = /* @__PURE__ */ new Set();
|
|
66
|
+
A(e, s, o, t), t.forEach((e) => {
|
|
67
|
+
c.delete(e);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
} else c.add(i);
|
|
71
|
+
r.value = [...c];
|
|
72
|
+
},
|
|
73
|
+
isExpanded: (e) => r.value.includes(e)
|
|
74
|
+
}), ue = (e, t) => T(e, () => {
|
|
75
|
+
t.onEndReached();
|
|
76
|
+
}, {
|
|
77
|
+
distance: b(t.distance),
|
|
78
|
+
canLoadMore: () => t.canLoadMore === void 0 ? !0 : b(t.canLoadMore),
|
|
79
|
+
direction: "bottom"
|
|
80
|
+
}), P = /* @__PURE__ */ function(e) {
|
|
81
|
+
return e.NONE = "none", e.TWO_X_SMALL = "2x-small", e.X_SMALL = "x-small", e.SMALL = "small", e.MEDIUM = "medium", e.X_MEDIUM = "x-medium", e.LARGE = "large", e.X_LARGE = "x-large", e.TWO_X_LARGE = "2x-large", e;
|
|
82
|
+
}({}), F = P.TWO_X_SMALL, de = {
|
|
83
|
+
[P.NONE]: "var(--s-ui-space-gap-none)",
|
|
84
|
+
[P.TWO_X_SMALL]: "var(--s-ui-space-gap-2x-small)",
|
|
85
|
+
[P.X_SMALL]: "var(--s-ui-space-gap-x-small)",
|
|
86
|
+
[P.SMALL]: "var(--s-ui-space-gap-small)",
|
|
87
|
+
[P.MEDIUM]: "var(--s-ui-space-gap-medium)",
|
|
88
|
+
[P.X_MEDIUM]: "var(--s-ui-space-gap-x-medium)",
|
|
89
|
+
[P.LARGE]: "var(--s-ui-space-gap-large)",
|
|
90
|
+
[P.X_LARGE]: "var(--s-ui-space-gap-x-large)",
|
|
91
|
+
[P.TWO_X_LARGE]: "var(--s-ui-space-gap-2x-large)"
|
|
92
|
+
}, fe = {
|
|
93
|
+
[P.NONE]: 0,
|
|
94
|
+
[P.TWO_X_SMALL]: 2,
|
|
95
|
+
[P.X_SMALL]: 4,
|
|
96
|
+
[P.SMALL]: 8,
|
|
97
|
+
[P.MEDIUM]: 12,
|
|
98
|
+
[P.X_MEDIUM]: 16,
|
|
99
|
+
[P.LARGE]: 20,
|
|
100
|
+
[P.X_LARGE]: 24,
|
|
101
|
+
[P.TWO_X_LARGE]: 32
|
|
102
|
+
}, pe = (e, t) => `s-ui-list-option-${e}-${t}`, I = (e, t) => {
|
|
103
|
+
let n = e[t];
|
|
104
|
+
if (typeof n == "string") return n;
|
|
105
|
+
}, L = (e, t) => {
|
|
106
|
+
let n = e[t];
|
|
107
|
+
return typeof n == "boolean" ? n : !1;
|
|
108
|
+
}, R = (e) => e in w, z = (e, t) => {
|
|
109
|
+
let n = e[t];
|
|
110
|
+
if (typeof n == "string" && n.length > 0 && R(n)) return n;
|
|
111
|
+
}, B = (e, t) => typeof t == "string" && t ? t : Array.isArray(t) && t[0] ? t[0] : e, me = (e) => e.some((e) => e.hasChildren || e.parentKey), V = (e, t, n) => {
|
|
112
|
+
if (!e.hasChildren) return null;
|
|
113
|
+
if (!e.expanded) return {
|
|
114
|
+
type: "expand",
|
|
115
|
+
rowKey: t
|
|
116
|
+
};
|
|
117
|
+
let r = n.find((e) => e.parentKey === t);
|
|
118
|
+
return r ? {
|
|
119
|
+
type: "select",
|
|
120
|
+
rowKey: r.key
|
|
121
|
+
} : null;
|
|
122
|
+
}, H = (e, t) => e.hasChildren && e.expanded ? {
|
|
123
|
+
type: "collapse",
|
|
124
|
+
rowKey: t
|
|
125
|
+
} : e.parentKey ? {
|
|
126
|
+
type: "select",
|
|
127
|
+
rowKey: e.parentKey
|
|
128
|
+
} : null, he = (e, t, n) => {
|
|
129
|
+
let r = n.find((e) => e.key === t);
|
|
130
|
+
return r ? e === "ArrowRight" ? V(r, t, n) : H(r, t) : null;
|
|
131
|
+
}, U = (e, t, n, r) => {
|
|
132
|
+
for (let i = t; i >= 0 && i < e.length; i += n) {
|
|
133
|
+
let t = e[i];
|
|
134
|
+
if (t && t.depth <= r) return t.key;
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}, ge = (e, t, n) => {
|
|
138
|
+
let r = n.findIndex((e) => e.key === t);
|
|
139
|
+
if (r === -1) return null;
|
|
140
|
+
let i = n[r];
|
|
141
|
+
if (!i) return null;
|
|
142
|
+
let a = e === "ArrowDown" ? 1 : -1;
|
|
143
|
+
return U(n, r + a, a, i.depth);
|
|
144
|
+
}, _e = ["role", "aria-multiselectable"], ve = [
|
|
145
|
+
"aria-multiselectable",
|
|
146
|
+
"aria-activedescendant",
|
|
147
|
+
"tabindex"
|
|
148
|
+
], ye = ["data-index"], be = {
|
|
149
|
+
key: 2,
|
|
150
|
+
class: "s-ui-list__static"
|
|
151
|
+
}, W = /* @__PURE__ */ p({
|
|
152
|
+
__name: "SList",
|
|
153
|
+
props: /*@__PURE__*/ m({
|
|
154
|
+
items: {},
|
|
155
|
+
itemKey: {
|
|
156
|
+
type: [String, Function],
|
|
157
|
+
default: "id"
|
|
158
|
+
},
|
|
159
|
+
childrenKey: { default: "children" },
|
|
160
|
+
titleKey: { default: "title" },
|
|
161
|
+
subtitleKey: { default: "subtitle" },
|
|
162
|
+
iconLeftKey: { default: "iconLeft" },
|
|
163
|
+
disabledKey: { default: "disabled" },
|
|
164
|
+
itemProps: { type: Function },
|
|
165
|
+
selectionMode: { default: () => e.NONE },
|
|
166
|
+
mandatory: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
default: !1
|
|
169
|
+
},
|
|
170
|
+
virtual: { type: Boolean },
|
|
171
|
+
gap: { default: () => F },
|
|
172
|
+
estimateItemSize: { default: 36 },
|
|
173
|
+
overscan: { default: 5 },
|
|
174
|
+
endReachedDistance: { default: 0 },
|
|
175
|
+
canLoadMore: { type: Function },
|
|
176
|
+
height: { default: 320 },
|
|
177
|
+
maxHeight: {},
|
|
178
|
+
revealRight: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
default: !1
|
|
181
|
+
},
|
|
182
|
+
expandOnClick: {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
default: !1
|
|
185
|
+
},
|
|
186
|
+
hasMoreChildrenKey: {},
|
|
187
|
+
loadingMoreChildrenKeys: { default: () => [] }
|
|
188
|
+
}, {
|
|
189
|
+
modelValue: {},
|
|
190
|
+
modelModifiers: {},
|
|
191
|
+
selected: {},
|
|
192
|
+
selectedModifiers: {},
|
|
193
|
+
expanded: { default: () => [] },
|
|
194
|
+
expandedModifiers: {}
|
|
195
|
+
}),
|
|
196
|
+
emits: /*@__PURE__*/ m(["endReached", "loadMoreChildren"], [
|
|
197
|
+
"update:modelValue",
|
|
198
|
+
"update:selected",
|
|
199
|
+
"update:expanded"
|
|
200
|
+
]),
|
|
201
|
+
setup(p, { expose: m, emit: b }) {
|
|
202
|
+
let w = S(p, "modelValue"), T = S(p, "selected"), E = S(p, "expanded"), D = b, O = ie(), le = re(), k = ae("scrollElementRef"), A = ae("listRootElementRef"), j = s(() => fe[p.gap]), M = s(() => p.items !== void 0), P = s(() => M.value ? p.virtual === void 0 ? !0 : p.virtual : !1), { flatRows: F, toggleExpanded: R } = N({
|
|
203
|
+
items: () => p.items ?? [],
|
|
204
|
+
childrenKey: () => p.childrenKey,
|
|
205
|
+
itemKey: () => p.itemKey,
|
|
206
|
+
expanded: E,
|
|
207
|
+
hasMoreChildrenKey: () => p.hasMoreChildrenKey
|
|
208
|
+
}), { t: V } = se(), H = s(() => new Set(p.loadingMoreChildrenKeys)), U = s(() => V("list.loadMore")), W = (e) => e.loadMoreForKey ? H.value.has(e.loadMoreForKey) : !1, xe = (e, t) => {
|
|
209
|
+
H.value.has(e) || D("loadMoreChildren", {
|
|
210
|
+
key: e,
|
|
211
|
+
item: t
|
|
212
|
+
});
|
|
213
|
+
}, G = (e) => {
|
|
214
|
+
e.loadMoreForKey && xe(e.loadMoreForKey, e.item);
|
|
215
|
+
}, Se = (e) => ({
|
|
216
|
+
parentKey: e.loadMoreForKey ?? "",
|
|
217
|
+
parentItem: e.item,
|
|
218
|
+
depth: e.depth,
|
|
219
|
+
loading: W(e),
|
|
220
|
+
loadMore: () => {
|
|
221
|
+
G(e);
|
|
222
|
+
}
|
|
223
|
+
}), K = ce(s(() => ({
|
|
224
|
+
count: F.value.length,
|
|
225
|
+
getScrollElement: () => k.value,
|
|
226
|
+
estimateSize: () => p.estimateItemSize,
|
|
227
|
+
gap: j.value,
|
|
228
|
+
overscan: p.overscan
|
|
229
|
+
}))), Ce = s(() => {
|
|
230
|
+
if (M.value) return F.value.map((e) => e.key);
|
|
231
|
+
}), we = s(() => {
|
|
232
|
+
let e = /* @__PURE__ */ new Set();
|
|
233
|
+
for (let t of F.value) !t.loadMoreForKey && L(t.item, p.disabledKey) && e.add(t.key);
|
|
234
|
+
return e;
|
|
235
|
+
}), Te = async (e) => {
|
|
236
|
+
if (!P.value) return;
|
|
237
|
+
let t = F.value.findIndex((t) => t.key === e);
|
|
238
|
+
t !== -1 && (K.value.scrollToIndex(t, { align: "auto" }), await new Promise((e) => {
|
|
239
|
+
requestAnimationFrame(() => {
|
|
240
|
+
e();
|
|
241
|
+
});
|
|
242
|
+
}), await ee());
|
|
243
|
+
}, q = (e) => pe(le, e), J = t({
|
|
244
|
+
modelValue: () => T.value,
|
|
245
|
+
onUpdateModelValue: (e) => {
|
|
246
|
+
T.value = e;
|
|
247
|
+
},
|
|
248
|
+
mode: () => p.selectionMode,
|
|
249
|
+
mandatory: () => p.mandatory,
|
|
250
|
+
orientation: () => n.VERTICAL,
|
|
251
|
+
enableTabNavigation: !0,
|
|
252
|
+
focusMode: () => P.value ? r.ACTIVE_DESCENDANT : r.DOM,
|
|
253
|
+
orderedValues: Ce,
|
|
254
|
+
isValueDisabled: (e) => we.value.has(e),
|
|
255
|
+
onBeforeFocusItem: async (e) => {
|
|
256
|
+
await Te(e);
|
|
257
|
+
},
|
|
258
|
+
onFocusGroup: () => {
|
|
259
|
+
k.value?.focus();
|
|
260
|
+
}
|
|
261
|
+
}), Ee = s(() => M.value && me(F.value)), Y = () => {
|
|
262
|
+
if (P.value) {
|
|
263
|
+
k.value?.focus();
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
A.value?.focus();
|
|
267
|
+
}, De = () => {
|
|
268
|
+
J.focusedValue.value = void 0, w.value = void 0;
|
|
269
|
+
let e = document.activeElement;
|
|
270
|
+
e instanceof HTMLElement && e !== k.value && e.blur(), Y();
|
|
271
|
+
}, X = async (e) => {
|
|
272
|
+
P.value && await Te(e);
|
|
273
|
+
}, Oe = async (e) => {
|
|
274
|
+
if (De(), e.type === "expand" || e.type === "collapse") {
|
|
275
|
+
R(e.rowKey), J.select(e.rowKey, !1), await X(e.rowKey);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
J.select(e.rowKey, !1), await X(e.rowKey);
|
|
279
|
+
}, ke = async (e, t) => {
|
|
280
|
+
if (!Ee.value || e.key !== "ArrowUp" && e.key !== "ArrowDown") return !1;
|
|
281
|
+
let n = B(t, T.value), r = ge(e.key, n, F.value);
|
|
282
|
+
return r ? (e.preventDefault(), De(), J.select(r, !1), await X(r), !0) : !1;
|
|
283
|
+
}, Ae = async (e, t) => {
|
|
284
|
+
if (!Ee.value || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return !1;
|
|
285
|
+
let n = B(t, T.value), r = he(e.key, n, F.value);
|
|
286
|
+
return r ? (e.preventDefault(), await Oe(r), !0) : !1;
|
|
287
|
+
}, Z = () => {
|
|
288
|
+
if (w.value) return w.value;
|
|
289
|
+
let e = B("", T.value);
|
|
290
|
+
if (e) return e;
|
|
291
|
+
let t = Ce.value;
|
|
292
|
+
if (t) {
|
|
293
|
+
for (let e of t) if (!we.value.has(e)) return e;
|
|
294
|
+
}
|
|
295
|
+
}, je = () => Z(), Me = async (e) => {
|
|
296
|
+
let t = je();
|
|
297
|
+
t && await Q(e, t);
|
|
298
|
+
}, Ne = [
|
|
299
|
+
"Enter",
|
|
300
|
+
" ",
|
|
301
|
+
"Spacebar"
|
|
302
|
+
], Pe = (e, t) => {
|
|
303
|
+
if (!Ne.includes(e.key)) return !1;
|
|
304
|
+
let n = F.value.find((e) => e.key === t);
|
|
305
|
+
return n?.loadMoreForKey ? (e.preventDefault(), xe(n.loadMoreForKey, n.item), !0) : !1;
|
|
306
|
+
}, Q = async (e, t) => {
|
|
307
|
+
Pe(e, t) || await ke(e, t) || await Ae(e, t) || (await J.handleItemKeydown(e, t), w.value = J.focusedValue.value, !J.focusedValue.value && !P.value && Y());
|
|
308
|
+
}, Fe = async (e) => {
|
|
309
|
+
let t = Z();
|
|
310
|
+
t && await Q(e, t);
|
|
311
|
+
}, Ie = async (e) => {
|
|
312
|
+
if (P.value || e.target !== A.value) return;
|
|
313
|
+
let t = Z();
|
|
314
|
+
t && await Q(e, t);
|
|
315
|
+
}, Le = async () => {
|
|
316
|
+
let e = Z();
|
|
317
|
+
if (!e) {
|
|
318
|
+
Y();
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
await J.focusItem(e, !1);
|
|
322
|
+
};
|
|
323
|
+
te(i, {
|
|
324
|
+
mode: () => p.selectionMode,
|
|
325
|
+
isSelected: J.isSelected,
|
|
326
|
+
selectItem: J.toggle,
|
|
327
|
+
registerItem: J.registerItem,
|
|
328
|
+
getItemTabIndex: J.getItemTabIndex,
|
|
329
|
+
getGroupTabIndex: J.getGroupTabIndex,
|
|
330
|
+
handleItemKeydown: Q,
|
|
331
|
+
activeKey: () => w.value,
|
|
332
|
+
setActiveKey: (e) => {
|
|
333
|
+
w.value = e;
|
|
334
|
+
},
|
|
335
|
+
isExpanded: (e) => E.value.includes(e),
|
|
336
|
+
toggleExpanded: (e) => {
|
|
337
|
+
if (M.value) {
|
|
338
|
+
R(e);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
let t = new Set(E.value);
|
|
342
|
+
t.has(e) ? t.delete(e) : t.add(e), E.value = [...t];
|
|
343
|
+
},
|
|
344
|
+
revealRight: () => p.revealRight,
|
|
345
|
+
expandOnClick: () => p.expandOnClick,
|
|
346
|
+
getItemOptionId: (e) => {
|
|
347
|
+
if (P.value) return q(e);
|
|
348
|
+
},
|
|
349
|
+
usesActiveDescendantNavigation: () => P.value,
|
|
350
|
+
handlesTreeKeyboardNavigation: () => M.value
|
|
351
|
+
});
|
|
352
|
+
let Re = s(() => K.value.getVirtualItems()), ze = s(() => Re.value.flatMap((e) => {
|
|
353
|
+
let t = F.value[e.index];
|
|
354
|
+
return t ? [{
|
|
355
|
+
virtualRow: e,
|
|
356
|
+
flatRow: t
|
|
357
|
+
}] : [];
|
|
358
|
+
})), Be = s(() => K.value.getTotalSize()), Ve = s(() => ({
|
|
359
|
+
height: `${Be.value}px`,
|
|
360
|
+
position: "relative",
|
|
361
|
+
width: "100%"
|
|
362
|
+
})), He = s(() => {
|
|
363
|
+
let e = {};
|
|
364
|
+
return typeof p.height == "number" ? e.height = `${p.height}px` : p.height && (e.height = p.height), p.maxHeight && (typeof p.maxHeight == "number" ? e.maxHeight = `${p.maxHeight}px` : e.maxHeight = p.maxHeight), e;
|
|
365
|
+
}), Ue = s(() => ({
|
|
366
|
+
"s-ui-list--virtual": P.value,
|
|
367
|
+
"s-ui-list--static": !P.value
|
|
368
|
+
})), We = s(() => ({ "--s-ui-list-gap": de[p.gap] })), Ge = s(() => ({ "s-ui-list__scroll--flat": M.value && !P.value })), Ke = s(() => {
|
|
369
|
+
if (p.selectionMode === e.MULTIPLE) return !0;
|
|
370
|
+
}), qe = s(() => {
|
|
371
|
+
if (!P.value) return "listbox";
|
|
372
|
+
}), Je = s(() => {
|
|
373
|
+
if (!P.value) return Ke.value;
|
|
374
|
+
}), Ye = s(() => {
|
|
375
|
+
if (P.value) return J.getGroupTabIndex();
|
|
376
|
+
}), Xe = s(() => w.value ? w.value : B("", T.value)), Ze = s(() => {
|
|
377
|
+
if (!P.value) return;
|
|
378
|
+
let e = Xe.value;
|
|
379
|
+
if (e) return q(e);
|
|
380
|
+
});
|
|
381
|
+
ue(() => k.value, {
|
|
382
|
+
distance: () => p.endReachedDistance,
|
|
383
|
+
canLoadMore: () => p.canLoadMore ? p.canLoadMore() : !0,
|
|
384
|
+
onEndReached: () => {
|
|
385
|
+
D("endReached", { direction: "bottom" });
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
let Qe = (e) => ({
|
|
389
|
+
position: "absolute",
|
|
390
|
+
top: 0,
|
|
391
|
+
left: 0,
|
|
392
|
+
width: "100%",
|
|
393
|
+
transform: `translateY(${e.start}px)`
|
|
394
|
+
}), $e = (e) => {
|
|
395
|
+
e instanceof HTMLElement && K.value.measureElement(e);
|
|
396
|
+
}, et = (e) => {
|
|
397
|
+
let t = e.item, n = {
|
|
398
|
+
rowKey: e.key,
|
|
399
|
+
depth: e.depth,
|
|
400
|
+
expandable: e.hasChildren,
|
|
401
|
+
expanded: e.expanded,
|
|
402
|
+
selected: J.isSelected(e.key),
|
|
403
|
+
active: w.value === e.key,
|
|
404
|
+
disabled: L(t, p.disabledKey),
|
|
405
|
+
title: I(t, p.titleKey),
|
|
406
|
+
subtitle: I(t, p.subtitleKey),
|
|
407
|
+
iconLeft: z(t, p.iconLeftKey),
|
|
408
|
+
revealRight: p.revealRight
|
|
409
|
+
};
|
|
410
|
+
return p.itemProps ? {
|
|
411
|
+
...n,
|
|
412
|
+
...p.itemProps(t, e)
|
|
413
|
+
} : n;
|
|
414
|
+
}, $ = (e) => ({
|
|
415
|
+
...e,
|
|
416
|
+
revealRight: p.revealRight,
|
|
417
|
+
toggleExpanded: () => {
|
|
418
|
+
R(e.key);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
return m({
|
|
422
|
+
focusNavigation: Le,
|
|
423
|
+
handleKeyboardNavigation: Fe
|
|
424
|
+
}), (e, t) => (v(), l("div", {
|
|
425
|
+
ref_key: "listRootElementRef",
|
|
426
|
+
ref: A,
|
|
427
|
+
class: g(["s-ui-list", Ue.value]),
|
|
428
|
+
style: _(We.value),
|
|
429
|
+
role: qe.value,
|
|
430
|
+
"aria-multiselectable": Je.value,
|
|
431
|
+
tabindex: "-1",
|
|
432
|
+
onKeydown: Ie
|
|
433
|
+
}, [M.value && P.value ? (v(), l("div", {
|
|
434
|
+
key: 0,
|
|
435
|
+
ref_key: "scrollElementRef",
|
|
436
|
+
ref: k,
|
|
437
|
+
class: g(["s-ui-list__scroll", Ge.value]),
|
|
438
|
+
style: _(He.value),
|
|
439
|
+
role: "listbox",
|
|
440
|
+
"aria-multiselectable": Ke.value,
|
|
441
|
+
"aria-activedescendant": Ze.value,
|
|
442
|
+
tabindex: Ye.value,
|
|
443
|
+
onKeydown: Me
|
|
444
|
+
}, [u("div", {
|
|
445
|
+
class: "s-ui-list__virtual-panel",
|
|
446
|
+
style: _(Ve.value)
|
|
447
|
+
}, [(v(!0), l(o, null, ne(ze.value, (t) => (v(), l("div", {
|
|
448
|
+
key: t.virtualRow.index,
|
|
449
|
+
class: "s-ui-list__virtual-row",
|
|
450
|
+
"data-index": t.virtualRow.index,
|
|
451
|
+
ref_for: !0,
|
|
452
|
+
ref: $e,
|
|
453
|
+
style: _(Qe(t.virtualRow))
|
|
454
|
+
}, [t.flatRow.loadMoreForKey ? (v(), l(o, { key: 0 }, [x(O).loadMore ? y(e.$slots, "loadMore", h({
|
|
455
|
+
key: 0,
|
|
456
|
+
ref_for: !0
|
|
457
|
+
}, Se(t.flatRow))) : (v(), c(x(a), {
|
|
458
|
+
key: 1,
|
|
459
|
+
"row-key": t.flatRow.key,
|
|
460
|
+
depth: t.flatRow.depth,
|
|
461
|
+
tiny: "",
|
|
462
|
+
title: U.value,
|
|
463
|
+
onClick: (e) => G(t.flatRow)
|
|
464
|
+
}, d({ _: 2 }, [W(t.flatRow) ? {
|
|
465
|
+
name: "icon-left",
|
|
466
|
+
fn: C(() => [f(x(oe), { size: 16 })]),
|
|
467
|
+
key: "0"
|
|
468
|
+
} : void 0]), 1032, [
|
|
469
|
+
"row-key",
|
|
470
|
+
"depth",
|
|
471
|
+
"title",
|
|
472
|
+
"onClick"
|
|
473
|
+
]))], 64)) : (v(), l(o, { key: 1 }, [x(O).item ? y(e.$slots, "item", h({
|
|
474
|
+
key: 0,
|
|
475
|
+
ref_for: !0
|
|
476
|
+
}, $(t.flatRow))) : (v(), c(x(a), h({
|
|
477
|
+
key: 1,
|
|
478
|
+
ref_for: !0
|
|
479
|
+
}, et(t.flatRow)), null, 16))], 64))], 12, ye))), 128))], 4)], 46, ve)) : M.value ? (v(), l("div", {
|
|
480
|
+
key: 1,
|
|
481
|
+
ref_key: "scrollElementRef",
|
|
482
|
+
ref: k,
|
|
483
|
+
class: g(["s-ui-list__scroll", Ge.value]),
|
|
484
|
+
style: _(He.value)
|
|
485
|
+
}, [(v(!0), l(o, null, ne(x(F), (t) => (v(), l(o, { key: t.key }, [t.loadMoreForKey ? (v(), l(o, { key: 0 }, [x(O).loadMore ? y(e.$slots, "loadMore", h({
|
|
486
|
+
key: 0,
|
|
487
|
+
ref_for: !0
|
|
488
|
+
}, Se(t))) : (v(), c(x(a), {
|
|
489
|
+
key: 1,
|
|
490
|
+
"row-key": t.key,
|
|
491
|
+
depth: t.depth,
|
|
492
|
+
tiny: "",
|
|
493
|
+
title: U.value,
|
|
494
|
+
onClick: (e) => G(t)
|
|
495
|
+
}, d({ _: 2 }, [W(t) ? {
|
|
496
|
+
name: "icon-left",
|
|
497
|
+
fn: C(() => [f(x(oe), { size: 16 })]),
|
|
498
|
+
key: "0"
|
|
499
|
+
} : void 0]), 1032, [
|
|
500
|
+
"row-key",
|
|
501
|
+
"depth",
|
|
502
|
+
"title",
|
|
503
|
+
"onClick"
|
|
504
|
+
]))], 64)) : (v(), l(o, { key: 1 }, [x(O).item ? y(e.$slots, "item", h({
|
|
505
|
+
key: 0,
|
|
506
|
+
ref_for: !0
|
|
507
|
+
}, $(t))) : (v(), c(x(a), h({
|
|
508
|
+
key: 1,
|
|
509
|
+
ref_for: !0
|
|
510
|
+
}, et(t)), null, 16))], 64))], 64))), 128))], 6)) : (v(), l("div", be, [y(e.$slots, "default")]))], 46, _e));
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
//#endregion
|
|
514
|
+
export { P as a, I as i, L as n, ue as o, z as r, N as s, W as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./useSelectionGroup-TaektE-I.cjs"),t=require("./SListItem-CdveotJe.cjs");let n=require("vue"),r=require("@shtabapp/ui-kit-primitives"),i=require("@vueuse/core"),a=require("@tanstack/vue-virtual");var o=(e,t)=>{if(typeof t==`function`)return t(e);let n=e[t];return typeof n==`string`?n:typeof n==`number`?String(n):``},s=(e,t)=>{let n=e[t];return Array.isArray(n)?n.filter(e=>typeof e==`object`&&!!e):[]},c=(e,t)=>{if(!t)return!1;let n=e[t];return typeof n==`boolean`?n:!1},l=`__s-ui-load-more:`,u=e=>`${l}${e}`,d=(e,t,n,r)=>{s(e,n).forEach(e=>{let i=o(e,t);i&&r.add(i),d(e,t,n,r)})},f=(e,t,n,r)=>{for(let i of e){if(o(i,n)===t)return i;let e=f(s(i,r),t,n,r);if(e)return e}},p=(e,t,n,r,i,a,l,d)=>{e.forEach(e=>{let f=o(e,t);if(!f)return;let m=s(e,n),h=m.length>0,g=r.includes(f);l.push({key:f,item:e,depth:i,flatIndex:l.length,hasChildren:h,expanded:g,parentKey:a}),h&&g&&p(m,t,n,r,i+1,f,l,d),h&&g&&c(e,d)&&l.push({key:u(f),item:e,depth:i+1,flatIndex:l.length,hasChildren:!1,expanded:!1,parentKey:f,loadMoreForKey:f})})},m=({items:e,childrenKey:t,itemKey:r,expanded:i,hasMoreChildrenKey:a})=>({flatRows:(0,n.computed)(()=>{let o=[],s=(0,n.toValue)(e),c=(0,n.toValue)(t),l=(0,n.toValue)(r),u=(0,n.toValue)(a);return p(s,l,c,i.value,0,void 0,o,u),o}),toggleExpanded:a=>{let o=(0,n.toValue)(e),s=(0,n.toValue)(t),c=(0,n.toValue)(r),l=new Set(i.value);if(l.has(a)){l.delete(a);let e=f(o,a,c,s);if(e){let t=new Set;d(e,c,s,t),t.forEach(e=>{l.delete(e)})}}else l.add(a);i.value=[...l]},isExpanded:e=>i.value.includes(e)}),h=(e,t)=>(0,i.useInfiniteScroll)(e,()=>{t.onEndReached()},{distance:(0,n.toValue)(t.distance),canLoadMore:()=>t.canLoadMore===void 0?!0:(0,n.toValue)(t.canLoadMore),direction:`bottom`}),g=function(e){return e.NONE=`none`,e.TWO_X_SMALL=`2x-small`,e.X_SMALL=`x-small`,e.SMALL=`small`,e.MEDIUM=`medium`,e.X_MEDIUM=`x-medium`,e.LARGE=`large`,e.X_LARGE=`x-large`,e.TWO_X_LARGE=`2x-large`,e}({}),_=g.TWO_X_SMALL,ee={[g.NONE]:`var(--s-ui-space-gap-none)`,[g.TWO_X_SMALL]:`var(--s-ui-space-gap-2x-small)`,[g.X_SMALL]:`var(--s-ui-space-gap-x-small)`,[g.SMALL]:`var(--s-ui-space-gap-small)`,[g.MEDIUM]:`var(--s-ui-space-gap-medium)`,[g.X_MEDIUM]:`var(--s-ui-space-gap-x-medium)`,[g.LARGE]:`var(--s-ui-space-gap-large)`,[g.X_LARGE]:`var(--s-ui-space-gap-x-large)`,[g.TWO_X_LARGE]:`var(--s-ui-space-gap-2x-large)`},te={[g.NONE]:0,[g.TWO_X_SMALL]:2,[g.X_SMALL]:4,[g.SMALL]:8,[g.MEDIUM]:12,[g.X_MEDIUM]:16,[g.LARGE]:20,[g.X_LARGE]:24,[g.TWO_X_LARGE]:32},ne=(e,t)=>`s-ui-list-option-${e}-${t}`,v=(e,t)=>{let n=e[t];if(typeof n==`string`)return n},y=(e,t)=>{let n=e[t];return typeof n==`boolean`?n:!1},b=e=>e in r.ESIconName,x=(e,t)=>{let n=e[t];if(typeof n==`string`&&n.length>0&&b(n))return n},S=(e,t)=>typeof t==`string`&&t?t:Array.isArray(t)&&t[0]?t[0]:e,re=e=>e.some(e=>e.hasChildren||e.parentKey),C=(e,t,n)=>{if(!e.hasChildren)return null;if(!e.expanded)return{type:`expand`,rowKey:t};let r=n.find(e=>e.parentKey===t);return r?{type:`select`,rowKey:r.key}:null},w=(e,t)=>e.hasChildren&&e.expanded?{type:`collapse`,rowKey:t}:e.parentKey?{type:`select`,rowKey:e.parentKey}:null,T=(e,t,n)=>{let r=n.find(e=>e.key===t);return r?e===`ArrowRight`?C(r,t,n):w(r,t):null},E=(e,t,n,r)=>{for(let i=t;i>=0&&i<e.length;i+=n){let t=e[i];if(t&&t.depth<=r)return t.key}return null},ie=(e,t,n)=>{let r=n.findIndex(e=>e.key===t);if(r===-1)return null;let i=n[r];if(!i)return null;let a=e===`ArrowDown`?1:-1;return E(n,r+a,a,i.depth)},ae=[`role`,`aria-multiselectable`],oe=[`aria-multiselectable`,`aria-activedescendant`,`tabindex`],se=[`data-index`],ce={key:2,class:`s-ui-list__static`},D=(0,n.defineComponent)({__name:`SList`,props:(0,n.mergeModels)({items:{},itemKey:{type:[String,Function],default:`id`},childrenKey:{default:`children`},titleKey:{default:`title`},subtitleKey:{default:`subtitle`},iconLeftKey:{default:`iconLeft`},disabledKey:{default:`disabled`},itemProps:{type:Function},selectionMode:{default:()=>e.n.NONE},mandatory:{type:Boolean,default:!1},virtual:{type:Boolean},gap:{default:()=>_},estimateItemSize:{default:36},overscan:{default:5},endReachedDistance:{default:0},canLoadMore:{type:Function},height:{default:320},maxHeight:{},revealRight:{type:Boolean,default:!1},expandOnClick:{type:Boolean,default:!1},hasMoreChildrenKey:{},loadingMoreChildrenKeys:{default:()=>[]}},{modelValue:{},modelModifiers:{},selected:{},selectedModifiers:{},expanded:{default:()=>[]},expandedModifiers:{}}),emits:(0,n.mergeModels)([`endReached`,`loadMoreChildren`],[`update:modelValue`,`update:selected`,`update:expanded`]),setup(i,{expose:o,emit:s}){let c=(0,n.useModel)(i,`modelValue`),l=(0,n.useModel)(i,`selected`),u=(0,n.useModel)(i,`expanded`),d=s,f=(0,n.useSlots)(),p=(0,n.useId)(),g=(0,n.useTemplateRef)(`scrollElementRef`),_=(0,n.useTemplateRef)(`listRootElementRef`),b=(0,n.computed)(()=>te[i.gap]),C=(0,n.computed)(()=>i.items!==void 0),w=(0,n.computed)(()=>C.value?i.virtual===void 0?!0:i.virtual:!1),{flatRows:E,toggleExpanded:D}=m({items:()=>i.items??[],childrenKey:()=>i.childrenKey,itemKey:()=>i.itemKey,expanded:u,hasMoreChildrenKey:()=>i.hasMoreChildrenKey}),{t:O}=(0,r.useUiKitI18n)(),k=(0,n.computed)(()=>new Set(i.loadingMoreChildrenKeys)),A=(0,n.computed)(()=>O(`list.loadMore`)),j=e=>e.loadMoreForKey?k.value.has(e.loadMoreForKey):!1,M=(e,t)=>{k.value.has(e)||d(`loadMoreChildren`,{key:e,item:t})},N=e=>{e.loadMoreForKey&&M(e.loadMoreForKey,e.item)},P=e=>({parentKey:e.loadMoreForKey??``,parentItem:e.item,depth:e.depth,loading:j(e),loadMore:()=>{N(e)}}),F=(0,a.useVirtualizer)((0,n.computed)(()=>({count:E.value.length,getScrollElement:()=>g.value,estimateSize:()=>i.estimateItemSize,gap:b.value,overscan:i.overscan}))),I=(0,n.computed)(()=>{if(C.value)return E.value.map(e=>e.key)}),L=(0,n.computed)(()=>{let e=new Set;for(let t of E.value)!t.loadMoreForKey&&y(t.item,i.disabledKey)&&e.add(t.key);return e}),R=async e=>{if(!w.value)return;let t=E.value.findIndex(t=>t.key===e);t!==-1&&(F.value.scrollToIndex(t,{align:`auto`}),await new Promise(e=>{requestAnimationFrame(()=>{e()})}),await(0,n.nextTick)())},z=e=>ne(p,e),B=e.o({modelValue:()=>l.value,onUpdateModelValue:e=>{l.value=e},mode:()=>i.selectionMode,mandatory:()=>i.mandatory,orientation:()=>e.r.VERTICAL,enableTabNavigation:!0,focusMode:()=>w.value?e.t.ACTIVE_DESCENDANT:e.t.DOM,orderedValues:I,isValueDisabled:e=>L.value.has(e),onBeforeFocusItem:async e=>{await R(e)},onFocusGroup:()=>{g.value?.focus()}}),V=(0,n.computed)(()=>C.value&&re(E.value)),H=()=>{if(w.value){g.value?.focus();return}_.value?.focus()},U=()=>{B.focusedValue.value=void 0,c.value=void 0;let e=document.activeElement;e instanceof HTMLElement&&e!==g.value&&e.blur(),H()},W=async e=>{w.value&&await R(e)},G=async e=>{if(U(),e.type===`expand`||e.type===`collapse`){D(e.rowKey),B.select(e.rowKey,!1),await W(e.rowKey);return}B.select(e.rowKey,!1),await W(e.rowKey)},K=async(e,t)=>{if(!V.value||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return!1;let n=S(t,l.value),r=ie(e.key,n,E.value);return r?(e.preventDefault(),U(),B.select(r,!1),await W(r),!0):!1},le=async(e,t)=>{if(!V.value||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return!1;let n=S(t,l.value),r=T(e.key,n,E.value);return r?(e.preventDefault(),await G(r),!0):!1},q=()=>{if(c.value)return c.value;let e=S(``,l.value);if(e)return e;let t=I.value;if(t){for(let e of t)if(!L.value.has(e))return e}},ue=()=>q(),de=async e=>{let t=ue();t&&await J(e,t)},fe=[`Enter`,` `,`Spacebar`],pe=(e,t)=>{if(!fe.includes(e.key))return!1;let n=E.value.find(e=>e.key===t);return n?.loadMoreForKey?(e.preventDefault(),M(n.loadMoreForKey,n.item),!0):!1},J=async(e,t)=>{pe(e,t)||await K(e,t)||await le(e,t)||(await B.handleItemKeydown(e,t),c.value=B.focusedValue.value,!B.focusedValue.value&&!w.value&&H())},me=async e=>{let t=q();t&&await J(e,t)},he=async e=>{if(w.value||e.target!==_.value)return;let t=q();t&&await J(e,t)},ge=async()=>{let e=q();if(!e){H();return}await B.focusItem(e,!1)};(0,n.provide)(t.r,{mode:()=>i.selectionMode,isSelected:B.isSelected,selectItem:B.toggle,registerItem:B.registerItem,getItemTabIndex:B.getItemTabIndex,getGroupTabIndex:B.getGroupTabIndex,handleItemKeydown:J,activeKey:()=>c.value,setActiveKey:e=>{c.value=e},isExpanded:e=>u.value.includes(e),toggleExpanded:e=>{if(C.value){D(e);return}let t=new Set(u.value);t.has(e)?t.delete(e):t.add(e),u.value=[...t]},revealRight:()=>i.revealRight,expandOnClick:()=>i.expandOnClick,getItemOptionId:e=>{if(w.value)return z(e)},usesActiveDescendantNavigation:()=>w.value,handlesTreeKeyboardNavigation:()=>C.value});let _e=(0,n.computed)(()=>F.value.getVirtualItems()),ve=(0,n.computed)(()=>_e.value.flatMap(e=>{let t=E.value[e.index];return t?[{virtualRow:e,flatRow:t}]:[]})),ye=(0,n.computed)(()=>F.value.getTotalSize()),be=(0,n.computed)(()=>({height:`${ye.value}px`,position:`relative`,width:`100%`})),Y=(0,n.computed)(()=>{let e={};return typeof i.height==`number`?e.height=`${i.height}px`:i.height&&(e.height=i.height),i.maxHeight&&(typeof i.maxHeight==`number`?e.maxHeight=`${i.maxHeight}px`:e.maxHeight=i.maxHeight),e}),xe=(0,n.computed)(()=>({"s-ui-list--virtual":w.value,"s-ui-list--static":!w.value})),Se=(0,n.computed)(()=>({"--s-ui-list-gap":ee[i.gap]})),X=(0,n.computed)(()=>({"s-ui-list__scroll--flat":C.value&&!w.value})),Z=(0,n.computed)(()=>{if(i.selectionMode===e.n.MULTIPLE)return!0}),Ce=(0,n.computed)(()=>{if(!w.value)return`listbox`}),we=(0,n.computed)(()=>{if(!w.value)return Z.value}),Te=(0,n.computed)(()=>{if(w.value)return B.getGroupTabIndex()}),Ee=(0,n.computed)(()=>c.value?c.value:S(``,l.value)),De=(0,n.computed)(()=>{if(!w.value)return;let e=Ee.value;if(e)return z(e)});h(()=>g.value,{distance:()=>i.endReachedDistance,canLoadMore:()=>i.canLoadMore?i.canLoadMore():!0,onEndReached:()=>{d(`endReached`,{direction:`bottom`})}});let Oe=e=>({position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`}),ke=e=>{e instanceof HTMLElement&&F.value.measureElement(e)},Q=e=>{let t=e.item,n={rowKey:e.key,depth:e.depth,expandable:e.hasChildren,expanded:e.expanded,selected:B.isSelected(e.key),active:c.value===e.key,disabled:y(t,i.disabledKey),title:v(t,i.titleKey),subtitle:v(t,i.subtitleKey),iconLeft:x(t,i.iconLeftKey),revealRight:i.revealRight};return i.itemProps?{...n,...i.itemProps(t,e)}:n},$=e=>({...e,revealRight:i.revealRight,toggleExpanded:()=>{D(e.key)}});return o({focusNavigation:ge,handleKeyboardNavigation:me}),(e,i)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{ref_key:`listRootElementRef`,ref:_,class:(0,n.normalizeClass)([`s-ui-list`,xe.value]),style:(0,n.normalizeStyle)(Se.value),role:Ce.value,"aria-multiselectable":we.value,tabindex:`-1`,onKeydown:he},[C.value&&w.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,ref_key:`scrollElementRef`,ref:g,class:(0,n.normalizeClass)([`s-ui-list__scroll`,X.value]),style:(0,n.normalizeStyle)(Y.value),role:`listbox`,"aria-multiselectable":Z.value,"aria-activedescendant":De.value,tabindex:Te.value,onKeydown:de},[(0,n.createElementVNode)(`div`,{class:`s-ui-list__virtual-panel`,style:(0,n.normalizeStyle)(be.value)},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(ve.value,i=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:i.virtualRow.index,class:`s-ui-list__virtual-row`,"data-index":i.virtualRow.index,ref_for:!0,ref:ke,style:(0,n.normalizeStyle)(Oe(i.virtualRow))},[i.flatRow.loadMoreForKey?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.unref)(f).loadMore?(0,n.renderSlot)(e.$slots,`loadMore`,(0,n.mergeProps)({key:0,ref_for:!0},P(i.flatRow))):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(t.t),{key:1,"row-key":i.flatRow.key,depth:i.flatRow.depth,tiny:``,title:A.value,onClick:e=>N(i.flatRow)},(0,n.createSlots)({_:2},[j(i.flatRow)?{name:`icon-left`,fn:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.SSpinner),{size:16})]),key:`0`}:void 0]),1032,[`row-key`,`depth`,`title`,`onClick`]))],64)):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.unref)(f).item?(0,n.renderSlot)(e.$slots,`item`,(0,n.mergeProps)({key:0,ref_for:!0},$(i.flatRow))):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(t.t),(0,n.mergeProps)({key:1,ref_for:!0},Q(i.flatRow)),null,16))],64))],12,se))),128))],4)],46,oe)):C.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:1,ref_key:`scrollElementRef`,ref:g,class:(0,n.normalizeClass)([`s-ui-list__scroll`,X.value]),style:(0,n.normalizeStyle)(Y.value)},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(E),i=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:i.key},[i.loadMoreForKey?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.unref)(f).loadMore?(0,n.renderSlot)(e.$slots,`loadMore`,(0,n.mergeProps)({key:0,ref_for:!0},P(i))):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(t.t),{key:1,"row-key":i.key,depth:i.depth,tiny:``,title:A.value,onClick:e=>N(i)},(0,n.createSlots)({_:2},[j(i)?{name:`icon-left`,fn:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(r.SSpinner),{size:16})]),key:`0`}:void 0]),1032,[`row-key`,`depth`,`title`,`onClick`]))],64)):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.unref)(f).item?(0,n.renderSlot)(e.$slots,`item`,(0,n.mergeProps)({key:0,ref_for:!0},$(i))):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(t.t),(0,n.mergeProps)({key:1,ref_for:!0},Q(i)),null,16))],64))],64))),128))],6)):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,ce,[(0,n.renderSlot)(e.$slots,`default`)]))],46,ae))}});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
|
|
@@ -3,7 +3,7 @@ import { t as r } from "./SButton-DnU_XZ1C.js";
|
|
|
3
3
|
import { n as i } from "./useSelectionGroup-cKj38lEN.js";
|
|
4
4
|
import { t as a } from "./SDropdown-CTQ5Qlez.js";
|
|
5
5
|
import { n as o, t as s } from "./SInput-CkanJfLx.js";
|
|
6
|
-
import { i as c, n as l, r as u, t as d } from "./SList-
|
|
6
|
+
import { i as c, n as l, r as u, t as d } from "./SList-DAzztC-7.js";
|
|
7
7
|
import { t as f } from "./SListItem-BRXZEePg.js";
|
|
8
8
|
import { computed as p, createBlock as ee, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createSlots as _, createTextVNode as te, createVNode as v, defineComponent as y, guardReactiveProps as b, isRef as ne, mergeModels as x, mergeProps as re, nextTick as S, normalizeClass as C, normalizeProps as w, normalizeStyle as T, openBlock as E, ref as D, renderSlot as O, toDisplayString as k, toValue as A, unref as j, useId as ie, useModel as ae, useSlots as oe, useTemplateRef as M, vModelText as se, watch as N, withCtx as P, withDirectives as ce, withModifiers as le } from "vue";
|
|
9
9
|
import { SIcon as ue, useUiKitI18n as de } from "@shtabapp/ui-kit-primitives";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-C-z_q5CG.cjs"),n=require("./useSelectionGroup-TaektE-I.cjs"),r=require("./SDropdown-_QUOP-rw.cjs"),i=require("./SInput-C07kFnj_.cjs"),a=require("./SList-fZQdPkFG.cjs"),o=require("./SListItem-CdveotJe.cjs");let s=require("vue"),c=require("@shtabapp/ui-kit-primitives");var l={key:0,class:`s-ui-dropdown-menu__header`},u={key:1,class:`s-ui-dropdown-menu__footer`},d=(0,s.defineComponent)({__name:`SDropdownMenu`,props:{width:{},maxHeight:{},accent:{type:Boolean,default:!1}},setup(e){let t=(0,s.useSlots)(),n=e=>typeof e==`number`?`${e}px`:e,r=(0,s.computed)(()=>({"s-ui-dropdown-menu--accent":e.accent,"s-ui-dropdown-menu--bounded":!!e.maxHeight})),i=(0,s.computed)(()=>({"s-ui-dropdown-menu__body--scrollable":!!e.maxHeight})),a=(0,s.computed)(()=>({"--s-ui-dropdown-menu-width":n(e.width),"--s-ui-dropdown-menu-max-height":n(e.maxHeight)}));return(e,n)=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{class:(0,s.normalizeClass)([`s-ui-dropdown-menu`,r.value]),style:(0,s.normalizeStyle)(a.value)},[(0,s.unref)(t).header?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,l,[(0,s.renderSlot)(e.$slots,`header`)])):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,{class:(0,s.normalizeClass)([`s-ui-dropdown-menu__body`,i.value])},[(0,s.renderSlot)(e.$slots,`default`)],2),(0,s.unref)(t).footer?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,u,[(0,s.renderSlot)(e.$slots,`footer`)])):(0,s.createCommentVNode)(``,!0)],6))}}),f=({listItemScope:e,itemTitle:t,itemSubtitle:n,itemDisabled:r,itemIconLeft:i,listActiveKey:o,isOptionSelected:s})=>{let c=e.item;return{rowKey:e.key,title:a.i(c,t),subtitle:a.i(c,n),disabled:a.n(c,r),iconLeft:a.r(c,i),selected:s,active:o===e.key,revealRight:e.revealRight,tiny:!0}},p=e=>typeof e==`string`||typeof e==`number`,m=(e,t)=>{let n=e[t];if(p(n))return n},h=e=>typeof e==`string`?e:String(e),g=e=>e==null?!1:typeof e==`string`?e.length>0:!0,_=(e,t,n)=>t.find(t=>h(m(t,n)??``)===e),v=e=>typeof e==`object`&&!!e,y=(e,t,n)=>{let r=_(e,t,n);if(r)return m(r,n)},b=function(e){return e.INPUT=`input`,e.CONTENT=`content`,e}({}),x=(e,t,n)=>{if(!e)return!0;let r=e.toLocaleLowerCase(),i=a.i(t,n.itemTitle)?.toLocaleLowerCase()??``,o=h(m(t,n.itemValue)??``).toLocaleLowerCase();return i.includes(r)||o.includes(r)},S=(e,t,n,r)=>{let i=r??((e,t)=>x(e,t,n));return t?e.filter(e=>i(t,e)):[...e]},C=e=>typeof e==`string`&&g(e),w=e=>typeof e==`number`&&g(e),T=(e,t,n)=>{if(t){if(!v(e))return;let t=m(e,n);return C(t)||w(t)?t:void 0}let r=typeof e==`string`||typeof e==`number`?e:void 0;if(C(r)||w(r))return r},E=(e,t,n)=>e?(Array.isArray(e)?e:[e]).flatMap(e=>{let r=T(e,t,n);return g(r)?[r]:[]}):[],D=(e,t)=>{if(C(t)){e.value=t;return}if(w(t)){e.value=t;return}e.value=void 0},O=(e,t,n)=>t.flatMap(t=>{let r=h(t),i=e.find(e=>h(m(e,n)??``)===r);return i?[i]:[]}),ee=({modelValue:e,options:t,itemFields:r,multiple:i,returnObject:o,searchable:c,filterOption:l,isDropdownOpen:u,searchQuery:d})=>{let f=(0,s.computed)(()=>(0,s.toValue)(i)),p=(0,s.computed)(()=>(0,s.toValue)(o)),v=(0,s.computed)(()=>(0,s.toValue)(c)===b.INPUT),x=(0,s.computed)(()=>(0,s.toValue)(c)===b.CONTENT),C=(0,s.computed)(()=>!!(0,s.toValue)(c)),w=(0,s.computed)(()=>{let t=(0,s.toValue)(r);return E(e.value,p.value,t.itemValue)}),T=(0,s.computed)(()=>{let e=(0,s.toValue)(t),n=(0,s.toValue)(r);return S(e,C.value?d.value:``,n,(0,s.toValue)(l))}),ee=(0,s.computed)(()=>f.value?n.n.MULTIPLE:n.n.SINGLE),k=(t,n,r)=>{if(p.value){e.value=O(n,t,r);return}e.value=t},te=(t,n,r)=>{if(!t){e.value=void 0;return}if(p.value){e.value=_(t,n,r)??void 0;return}D(e,y(t,n,r))},A=(0,s.computed)({get:()=>{if(f.value)return w.value.map(e=>h(e));let e=w.value[0];if(g(e))return h(e)},set:e=>{let n=(0,s.toValue)(t),i=(0,s.toValue)(r);if(f.value){k((Array.isArray(e)?e:[]).map(e=>y(e,n,i.itemValue)).filter(e=>g(e)),n,i.itemValue);return}te(typeof e==`string`?e:void 0,n,i.itemValue)}}),ne=(0,s.computed)(()=>w.value.length>0),j=(e,t,n)=>{let r=h(t);return e.find(e=>h(m(e,n)??``)===r)},M=(0,s.computed)(()=>{let e=w.value[0];if(!g(e))return``;let n=(0,s.toValue)(r),i=j((0,s.toValue)(t),e,n.itemValue);return i?a.i(i,n.itemTitle)??``:h(e)}),N=(0,s.computed)(()=>{let e=(0,s.toValue)(t),n=(0,s.toValue)(r);return w.value.map(t=>{let r=j(e,t,n.itemValue);return r?a.i(r,n.itemTitle)??``:h(t)})}),re=(0,s.computed)(()=>N.value.join(`, `)),ie=(0,s.computed)(()=>f.value?w.value.length===0:!M.value),ae=(0,s.computed)(()=>v.value&&(u.value||f.value)),P=()=>{d.value=``};return(0,s.watch)(u,e=>{e||P()}),(0,s.watch)(()=>(0,s.toValue)(c),()=>{P()}),{searchQuery:d,selectedValues:w,filteredOptions:T,listSelectionMode:ee,listSelectedModel:A,hasSelectedValues:ne,singleDisplayLabel:M,multipleDisplayLabels:N,multipleDisplayText:re,showPlaceholder:ie,showInputSearchField:ae,isSearchableMode:C,isSearchableInputMode:v,isSearchableContentMode:x,isMultipleMode:f,isReturnObjectMode:p,clearSelection:()=>{e.value=void 0,P()},removeSelectedValue:e=>{let n=h(e);k(w.value.filter(e=>h(e)!==n),(0,s.toValue)(t),(0,s.toValue)(r).itemValue)},resetSearchQuery:P,formatSelectListKey:h,resolveValueFromListKey:e=>y(e,(0,s.toValue)(t),(0,s.toValue)(r).itemValue)}},k={key:1,class:`s-ui-select__empty s-ui-typography-body-14-regular`},te=[`id`,`aria-expanded`,`aria-controls`,`aria-disabled`,`aria-readonly`,`aria-autocomplete`,`tabindex`],A={key:0,class:`s-ui-select__value`},ne={key:1,class:`s-ui-select__placeholder`},j={key:1,class:`s-ui-select__placeholder`},M={key:2,class:`s-ui-select__value`},N={key:3,class:`s-ui-select__value-suffix`},re=[`name`,`placeholder`,`disabled`,`readonly`],ie=20,ae=20,P=(0,s.defineComponent)({inheritAttrs:!1,__name:`SSelect`,props:(0,s.mergeModels)({options:{},itemValue:{default:`value`},itemTitle:{default:`label`},itemSubtitle:{default:`subtitle`},itemId:{},itemDisabled:{default:`disabled`},itemIconLeft:{default:`iconLeft`},multiple:{type:Boolean,default:!1},returnObject:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},closableOptions:{type:Boolean,default:!1},searchable:{type:[String,Boolean],default:!1},closeOnSelect:{type:Boolean,default:!0},listHeight:{default:320},searchPlaceholder:{default:`Search`},filterOption:{type:Function},fitViewport:{type:Boolean,default:!0},label:{},labelProps:{},placeholder:{},helpMessages:{},errorMessages:{},bordered:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},iconLeft:{},customize:{default:()=>i.n.NONE},name:{},id:{}},{modelValue:{},modelModifiers:{},searchQuery:{default:``},searchQueryModifiers:{}}),emits:(0,s.mergeModels)([`clear`,`focus`,`blur`,`open`,`close`],[`update:modelValue`,`update:searchQuery`]),setup(n,{expose:l,emit:u}){let p=(0,s.useModel)(n,`modelValue`),m=(0,s.useModel)(n,`searchQuery`),h=u,{t:_}=(0,c.useUiKitI18n)(),v=(0,s.useSlots)(),y=(0,s.useId)(),b=(0,s.useId)(),x=(0,s.useTemplateRef)(`triggerInputRef`),S=(0,s.ref)(``),C=(0,s.useTemplateRef)(`searchInputElementRef`),w=(0,s.useTemplateRef)(`panelSearchInputElementRef`),T=(0,s.useTemplateRef)(`listElementRef`),E=(0,s.ref)(),D=(0,s.ref)(!1),O=(0,s.ref)(!1),P=(0,s.computed)(()=>n.itemId??n.itemValue),oe=(0,s.computed)(()=>({itemValue:n.itemValue,itemTitle:n.itemTitle,itemSubtitle:n.itemSubtitle,itemId:P.value})),{selectedValues:F,filteredOptions:I,listSelectionMode:se,listSelectedModel:L,hasSelectedValues:R,singleDisplayLabel:ce,multipleDisplayLabels:le,multipleDisplayText:z,showPlaceholder:B,showInputSearchField:V,isSearchableMode:ue,isSearchableInputMode:H,isSearchableContentMode:U,isMultipleMode:W,clearSelection:de,removeSelectedValue:G,resolveValueFromListKey:K,formatSelectListKey:q}=ee({modelValue:p,options:()=>n.options,itemFields:()=>oe.value,multiple:()=>n.multiple,returnObject:()=>n.returnObject,searchable:()=>n.searchable,filterOption:()=>n.filterOption,isDropdownOpen:D,searchQuery:m}),fe=(0,s.computed)(()=>!!v[`value-suffix`]),pe=(0,s.computed)(()=>({disabled:n.disabled,displayLabel:ce.value})),J=(0,s.computed)(()=>I.value.length>ae),me=(0,s.computed)(()=>U.value||J.value?n.listHeight:`auto`),he=(0,s.computed)(()=>{if(!(U.value||J.value))return n.listHeight}),ge=(0,s.computed)(()=>F.value.map(e=>q(e))),_e=e=>ge.value.includes(e),ve=()=>({tiny:!0}),ye=e=>f({listItemScope:e,itemTitle:n.itemTitle,itemSubtitle:n.itemSubtitle,itemDisabled:n.itemDisabled,itemIconLeft:n.itemIconLeft,listActiveKey:E.value,isOptionSelected:_e(e.key)}),be=e=>{let t=K(e);if(g(t)){if(W.value){G(t);return}p.value=void 0}},xe=(0,s.computed)(()=>n.id??y),Se=(0,s.computed)(()=>b),Ce=(0,s.computed)(()=>x.value?.fieldElementRef??null),we=(0,s.computed)(()=>({labels:le.value,values:F.value,displayText:z.value,disabled:n.disabled||n.readonly,removeValue:G})),Te=(0,s.computed)(()=>{if(!n.disabled&&(n.readonly&&!H.value||!H.value))return 0}),Ee=(0,s.computed)(()=>({"s-ui-select--disabled":n.disabled,"s-ui-select--readonly":n.readonly,"s-ui-select--multiple":W.value,"s-ui-select--open":D.value})),De=()=>{if(U.value){w.value?.focus();return}C.value?.focus()},Oe=async()=>{await(0,s.nextTick)(),w.value?.focus()},Y=async()=>{await(0,s.nextTick)(),await T.value?.focusNavigation()},X=async()=>{if(!(n.disabled||n.readonly)&&!D.value){if(D.value=!0,h(`open`),U.value){await Oe();return}if(H.value){await(0,s.nextTick)(),C.value?.focus();return}await Y()}},ke=async()=>{n.disabled||n.readonly||D.value||await X()};(0,s.watch)(m,async e=>{H.value&&(n.disabled||n.readonly||e&&(D.value||await X()))});let Z=()=>{D.value&&(D.value=!1,E.value=void 0,h(`close`))},Q=()=>{!n.closeOnSelect||W.value||Z()};(0,s.watch)(p,(e,t)=>{!n.closeOnSelect||W.value||!D.value||!e||e===t||Z()});let Ae=e=>{D.value&&e.target instanceof Element&&e.target.closest(`.s-ui-list-item`)&&Q()},je=async e=>{e.key!==`Enter`&&e.key!==` `&&e.key!==`Spacebar`||D.value&&(await(0,s.nextTick)(),Q())},$=async()=>{if(D.value){Z();return}await X()},Me=async e=>{if(!(n.disabled||n.readonly)&&e.target instanceof HTMLElement){if(e.target.closest(`.s-ui-select__search-input`)){D.value||await X();return}await $()}},Ne=async e=>e.key!==`ArrowDown`&&e.key!==`ArrowUp`?!1:(e.preventDefault(),e.stopPropagation(),D.value||await X(),await Y(),await T.value?.handleKeyboardNavigation(e),!0),Pe=e=>{let t=K(e);if(t){if(W.value){F.value.some(t=>q(t)===e)?G(t):L.value=[...F.value.map(e=>q(e)),e];return}L.value=e,Q()}},Fe=async e=>{if(!(n.disabled||n.readonly)&&!await Ne(e)){if(e.key===`Escape`){e.preventDefault(),Z();return}if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),D.value&&E.value){Pe(E.value);return}await $()}}},Ie=async e=>{if(e.key===`Escape`){e.preventDefault(),Z();return}await Ne(e)},Le=Ie,Re=e=>{n.disabled||(O.value||h(`focus`,e),O.value=!0)},ze=e=>{if(!(e.currentTarget instanceof HTMLElement))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(O.value=!1,h(`blur`,e))},Be=()=>{de(),h(`clear`)};return l({open:X,close:Z,toggle:$,focusSearchInput:De}),(l,u)=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{class:(0,s.normalizeClass)([`s-ui-select`,Ee.value])},[(0,s.createVNode)((0,s.unref)(r.t),{modelValue:D.value,"onUpdate:modelValue":u[4]||=e=>D.value=e,reference:Ce.value,disabled:n.disabled,"match-reference-width":!0,"fit-viewport":n.fitViewport,"content-id":Se.value,"dismiss-on-click-outside":!0,"dismiss-on-escape":!0},{content:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(d),{class:`s-ui-select__menu`,width:`100%`},(0,s.createSlots)({default:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`div`,{class:`s-ui-select__menu-body`,onClick:Ae,onKeydown:je},[(0,s.unref)(I).length>0?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(a.t),{key:0,ref_key:`listElementRef`,ref:T,modelValue:E.value,"onUpdate:modelValue":u[2]||=e=>E.value=e,selected:(0,s.unref)(L),"onUpdate:selected":u[3]||=e=>(0,s.isRef)(L)?L.value=e:null,items:(0,s.unref)(I),"item-key":P.value,"title-key":n.itemTitle,"subtitle-key":n.itemSubtitle,"icon-left-key":n.itemIconLeft,"disabled-key":n.itemDisabled,"selection-mode":(0,s.unref)(se),mandatory:!n.multiple,height:me.value,"max-height":he.value,virtual:J.value,"item-props":ve},(0,s.createSlots)({_:2},[(0,s.unref)(v).option?{name:`item`,fn:(0,s.withCtx)(e=>[(0,s.renderSlot)(l.$slots,`option`,(0,s.normalizeProps)((0,s.guardReactiveProps)(e)))]),key:`0`}:n.closableOptions?{name:`item`,fn:(0,s.withCtx)(n=>[(0,s.createVNode)((0,s.unref)(o.t),(0,s.normalizeProps)((0,s.guardReactiveProps)(ye(n))),(0,s.createSlots)({_:2},[_e(n.key)?{name:`right`,fn:(0,s.withCtx)(r=>[(0,s.createVNode)((0,s.unref)(t.t),{appearance:(0,s.unref)(e.t).BARE,variant:(0,s.unref)(e.r).NEUTRAL,size:(0,s.unref)(e.n).SMALL,icon:`closeMini`,"aria-label":(0,s.unref)(_)(`select.removeOption`),disabled:r.disabled||r.readonly,tabindex:-1,onClick:(0,s.withModifiers)(e=>be(n.key),[`stop`])},null,8,[`appearance`,`variant`,`size`,`aria-label`,`disabled`,`onClick`])]),key:`0`}:void 0]),1040)]),key:`1`}:void 0]),1032,[`modelValue`,`selected`,`items`,`item-key`,`title-key`,`subtitle-key`,`icon-left-key`,`disabled-key`,`selection-mode`,`mandatory`,`height`,`max-height`,`virtual`])):((0,s.openBlock)(),(0,s.createElementBlock)(`div`,k,[(0,s.renderSlot)(l.$slots,`empty`,{},()=>[(0,s.createTextVNode)((0,s.toDisplayString)((0,s.unref)(_)(`select.noOptions`)),1)])]))],32)]),_:2},[(0,s.unref)(U)?{name:`header`,fn:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(i.t),{ref_key:`panelSearchInputElementRef`,ref:w,modelValue:m.value,"onUpdate:modelValue":u[0]||=e=>m.value=e,placeholder:n.searchPlaceholder,disabled:n.disabled,clearable:!1,"icon-left":`search`,onClick:u[1]||=(0,s.withModifiers)(()=>{},[`stop`]),onKeydown:(0,s.unref)(Le)},null,8,[`modelValue`,`placeholder`,`disabled`,`onKeydown`])]),key:`0`}:void 0,(0,s.unref)(v)[`panel-footer`]?{name:`footer`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`panel-footer`)]),key:`1`}:void 0]),1024)]),_:3},8,[`modelValue`,`reference`,`disabled`,`fit-viewport`,`content-id`]),(0,s.createVNode)((0,s.unref)(i.t),{ref_key:`triggerInputRef`,ref:x,modelValue:S.value,"onUpdate:modelValue":u[7]||=e=>S.value=e,label:n.label,"label-props":n.labelProps,placeholder:n.placeholder,"help-messages":n.helpMessages,"error-messages":n.errorMessages,bordered:n.bordered,disabled:n.disabled,readonly:n.readonly,clearable:n.clearable,"has-value":(0,s.unref)(R),focused:O.value||D.value,"icon-left":n.iconLeft,customize:n.customize,name:n.name,id:xe.value,onClear:Be,onFocus:Re,onBlur:ze},(0,s.createSlots)({control:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`div`,{id:xe.value,class:(0,s.normalizeClass)([`s-ui-select__control s-ui-typography-body-14-regular`,{"s-ui-select__control--multiple":(0,s.unref)(W),"s-ui-select__control--empty":(0,s.unref)(W)&&!(0,s.unref)(R)&&!(0,s.unref)(V),"s-ui-select__control--with-value-suffix":fe.value&&!(0,s.unref)(W)&&!(0,s.unref)(V)&&!(0,s.unref)(B)}]),role:`combobox`,"aria-expanded":D.value,"aria-controls":Se.value,"aria-haspopup":`listbox`,"aria-disabled":n.disabled?!0:void 0,"aria-readonly":n.readonly?!0:void 0,"aria-autocomplete":(0,s.unref)(ue)?`list`:void 0,tabindex:Te.value,onClick:Me,onKeydown:Fe},[(0,s.unref)(W)?(0,s.renderSlot)(l.$slots,`selection`,(0,s.normalizeProps)((0,s.mergeProps)({key:0},we.value)),()=>[(0,s.unref)(z)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,A,(0,s.toDisplayString)((0,s.unref)(z)),1)):(0,s.unref)(B)&&!(0,s.unref)(V)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,ne,(0,s.toDisplayString)(n.placeholder),1)):(0,s.createCommentVNode)(``,!0)]):(0,s.unref)(B)&&!(0,s.unref)(V)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,j,(0,s.toDisplayString)(n.placeholder),1)):(0,s.unref)(V)?(0,s.createCommentVNode)(``,!0):((0,s.openBlock)(),(0,s.createElementBlock)(`span`,M,(0,s.toDisplayString)((0,s.unref)(ce)),1)),fe.value&&!(0,s.unref)(W)&&!(0,s.unref)(V)&&!(0,s.unref)(B)?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,N,[(0,s.renderSlot)(l.$slots,`value-suffix`,(0,s.normalizeProps)((0,s.guardReactiveProps)(pe.value)))])):(0,s.createCommentVNode)(``,!0),(0,s.unref)(V)?(0,s.withDirectives)(((0,s.openBlock)(),(0,s.createElementBlock)(`input`,{key:4,ref_key:`searchInputElementRef`,ref:C,"onUpdate:modelValue":u[5]||=e=>m.value=e,class:`s-ui-select__search-input`,type:`text`,name:n.name,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,autocomplete:`off`,onClick:u[6]||=(0,s.withModifiers)(()=>{},[`stop`]),onFocus:ke,onKeydown:Ie},null,40,re)),[[s.vModelText,m.value]]):(0,s.createCommentVNode)(``,!0)],42,te)]),action:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(c.SIcon),{name:`chevronMiniDown`,size:ie,class:`s-ui-select__chevron`})]),_:2},[(0,s.unref)(v).label?{name:`label`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`label`)]),key:`0`}:void 0,(0,s.unref)(v).prefix?{name:`prefix`,fn:(0,s.withCtx)(e=>[(0,s.renderSlot)(l.$slots,`prefix`,(0,s.normalizeProps)((0,s.guardReactiveProps)(e)))]),key:`1`}:void 0,(0,s.unref)(v).prepend?{name:`prepend`,fn:(0,s.withCtx)(e=>[(0,s.renderSlot)(l.$slots,`prepend`,(0,s.normalizeProps)((0,s.guardReactiveProps)(e)))]),key:`2`}:void 0,(0,s.unref)(v).message?{name:`message`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`message`)]),key:`3`}:void 0]),1032,[`modelValue`,`label`,`label-props`,`placeholder`,`help-messages`,`error-messages`,`bordered`,`disabled`,`readonly`,`clearable`,`has-value`,`focused`,`icon-left`,`customize`,`name`,`id`])],2))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return P}});
|
|
1
|
+
const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-C-z_q5CG.cjs"),n=require("./useSelectionGroup-TaektE-I.cjs"),r=require("./SDropdown-_QUOP-rw.cjs"),i=require("./SInput-C07kFnj_.cjs"),a=require("./SList-S18K8mlH.cjs"),o=require("./SListItem-CdveotJe.cjs");let s=require("vue"),c=require("@shtabapp/ui-kit-primitives");var l={key:0,class:`s-ui-dropdown-menu__header`},u={key:1,class:`s-ui-dropdown-menu__footer`},d=(0,s.defineComponent)({__name:`SDropdownMenu`,props:{width:{},maxHeight:{},accent:{type:Boolean,default:!1}},setup(e){let t=(0,s.useSlots)(),n=e=>typeof e==`number`?`${e}px`:e,r=(0,s.computed)(()=>({"s-ui-dropdown-menu--accent":e.accent,"s-ui-dropdown-menu--bounded":!!e.maxHeight})),i=(0,s.computed)(()=>({"s-ui-dropdown-menu__body--scrollable":!!e.maxHeight})),a=(0,s.computed)(()=>({"--s-ui-dropdown-menu-width":n(e.width),"--s-ui-dropdown-menu-max-height":n(e.maxHeight)}));return(e,n)=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{class:(0,s.normalizeClass)([`s-ui-dropdown-menu`,r.value]),style:(0,s.normalizeStyle)(a.value)},[(0,s.unref)(t).header?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,l,[(0,s.renderSlot)(e.$slots,`header`)])):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,{class:(0,s.normalizeClass)([`s-ui-dropdown-menu__body`,i.value])},[(0,s.renderSlot)(e.$slots,`default`)],2),(0,s.unref)(t).footer?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,u,[(0,s.renderSlot)(e.$slots,`footer`)])):(0,s.createCommentVNode)(``,!0)],6))}}),f=({listItemScope:e,itemTitle:t,itemSubtitle:n,itemDisabled:r,itemIconLeft:i,listActiveKey:o,isOptionSelected:s})=>{let c=e.item;return{rowKey:e.key,title:a.i(c,t),subtitle:a.i(c,n),disabled:a.n(c,r),iconLeft:a.r(c,i),selected:s,active:o===e.key,revealRight:e.revealRight,tiny:!0}},p=e=>typeof e==`string`||typeof e==`number`,m=(e,t)=>{let n=e[t];if(p(n))return n},h=e=>typeof e==`string`?e:String(e),g=e=>e==null?!1:typeof e==`string`?e.length>0:!0,_=(e,t,n)=>t.find(t=>h(m(t,n)??``)===e),v=e=>typeof e==`object`&&!!e,y=(e,t,n)=>{let r=_(e,t,n);if(r)return m(r,n)},b=function(e){return e.INPUT=`input`,e.CONTENT=`content`,e}({}),x=(e,t,n)=>{if(!e)return!0;let r=e.toLocaleLowerCase(),i=a.i(t,n.itemTitle)?.toLocaleLowerCase()??``,o=h(m(t,n.itemValue)??``).toLocaleLowerCase();return i.includes(r)||o.includes(r)},S=(e,t,n,r)=>{let i=r??((e,t)=>x(e,t,n));return t?e.filter(e=>i(t,e)):[...e]},C=e=>typeof e==`string`&&g(e),w=e=>typeof e==`number`&&g(e),T=(e,t,n)=>{if(t){if(!v(e))return;let t=m(e,n);return C(t)||w(t)?t:void 0}let r=typeof e==`string`||typeof e==`number`?e:void 0;if(C(r)||w(r))return r},E=(e,t,n)=>e?(Array.isArray(e)?e:[e]).flatMap(e=>{let r=T(e,t,n);return g(r)?[r]:[]}):[],D=(e,t)=>{if(C(t)){e.value=t;return}if(w(t)){e.value=t;return}e.value=void 0},O=(e,t,n)=>t.flatMap(t=>{let r=h(t),i=e.find(e=>h(m(e,n)??``)===r);return i?[i]:[]}),ee=({modelValue:e,options:t,itemFields:r,multiple:i,returnObject:o,searchable:c,filterOption:l,isDropdownOpen:u,searchQuery:d})=>{let f=(0,s.computed)(()=>(0,s.toValue)(i)),p=(0,s.computed)(()=>(0,s.toValue)(o)),v=(0,s.computed)(()=>(0,s.toValue)(c)===b.INPUT),x=(0,s.computed)(()=>(0,s.toValue)(c)===b.CONTENT),C=(0,s.computed)(()=>!!(0,s.toValue)(c)),w=(0,s.computed)(()=>{let t=(0,s.toValue)(r);return E(e.value,p.value,t.itemValue)}),T=(0,s.computed)(()=>{let e=(0,s.toValue)(t),n=(0,s.toValue)(r);return S(e,C.value?d.value:``,n,(0,s.toValue)(l))}),ee=(0,s.computed)(()=>f.value?n.n.MULTIPLE:n.n.SINGLE),k=(t,n,r)=>{if(p.value){e.value=O(n,t,r);return}e.value=t},te=(t,n,r)=>{if(!t){e.value=void 0;return}if(p.value){e.value=_(t,n,r)??void 0;return}D(e,y(t,n,r))},A=(0,s.computed)({get:()=>{if(f.value)return w.value.map(e=>h(e));let e=w.value[0];if(g(e))return h(e)},set:e=>{let n=(0,s.toValue)(t),i=(0,s.toValue)(r);if(f.value){k((Array.isArray(e)?e:[]).map(e=>y(e,n,i.itemValue)).filter(e=>g(e)),n,i.itemValue);return}te(typeof e==`string`?e:void 0,n,i.itemValue)}}),ne=(0,s.computed)(()=>w.value.length>0),j=(e,t,n)=>{let r=h(t);return e.find(e=>h(m(e,n)??``)===r)},M=(0,s.computed)(()=>{let e=w.value[0];if(!g(e))return``;let n=(0,s.toValue)(r),i=j((0,s.toValue)(t),e,n.itemValue);return i?a.i(i,n.itemTitle)??``:h(e)}),N=(0,s.computed)(()=>{let e=(0,s.toValue)(t),n=(0,s.toValue)(r);return w.value.map(t=>{let r=j(e,t,n.itemValue);return r?a.i(r,n.itemTitle)??``:h(t)})}),re=(0,s.computed)(()=>N.value.join(`, `)),ie=(0,s.computed)(()=>f.value?w.value.length===0:!M.value),ae=(0,s.computed)(()=>v.value&&(u.value||f.value)),P=()=>{d.value=``};return(0,s.watch)(u,e=>{e||P()}),(0,s.watch)(()=>(0,s.toValue)(c),()=>{P()}),{searchQuery:d,selectedValues:w,filteredOptions:T,listSelectionMode:ee,listSelectedModel:A,hasSelectedValues:ne,singleDisplayLabel:M,multipleDisplayLabels:N,multipleDisplayText:re,showPlaceholder:ie,showInputSearchField:ae,isSearchableMode:C,isSearchableInputMode:v,isSearchableContentMode:x,isMultipleMode:f,isReturnObjectMode:p,clearSelection:()=>{e.value=void 0,P()},removeSelectedValue:e=>{let n=h(e);k(w.value.filter(e=>h(e)!==n),(0,s.toValue)(t),(0,s.toValue)(r).itemValue)},resetSearchQuery:P,formatSelectListKey:h,resolveValueFromListKey:e=>y(e,(0,s.toValue)(t),(0,s.toValue)(r).itemValue)}},k={key:1,class:`s-ui-select__empty s-ui-typography-body-14-regular`},te=[`id`,`aria-expanded`,`aria-controls`,`aria-disabled`,`aria-readonly`,`aria-autocomplete`,`tabindex`],A={key:0,class:`s-ui-select__value`},ne={key:1,class:`s-ui-select__placeholder`},j={key:1,class:`s-ui-select__placeholder`},M={key:2,class:`s-ui-select__value`},N={key:3,class:`s-ui-select__value-suffix`},re=[`name`,`placeholder`,`disabled`,`readonly`],ie=20,ae=20,P=(0,s.defineComponent)({inheritAttrs:!1,__name:`SSelect`,props:(0,s.mergeModels)({options:{},itemValue:{default:`value`},itemTitle:{default:`label`},itemSubtitle:{default:`subtitle`},itemId:{},itemDisabled:{default:`disabled`},itemIconLeft:{default:`iconLeft`},multiple:{type:Boolean,default:!1},returnObject:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},closableOptions:{type:Boolean,default:!1},searchable:{type:[String,Boolean],default:!1},closeOnSelect:{type:Boolean,default:!0},listHeight:{default:320},searchPlaceholder:{default:`Search`},filterOption:{type:Function},fitViewport:{type:Boolean,default:!0},label:{},labelProps:{},placeholder:{},helpMessages:{},errorMessages:{},bordered:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},iconLeft:{},customize:{default:()=>i.n.NONE},name:{},id:{}},{modelValue:{},modelModifiers:{},searchQuery:{default:``},searchQueryModifiers:{}}),emits:(0,s.mergeModels)([`clear`,`focus`,`blur`,`open`,`close`],[`update:modelValue`,`update:searchQuery`]),setup(n,{expose:l,emit:u}){let p=(0,s.useModel)(n,`modelValue`),m=(0,s.useModel)(n,`searchQuery`),h=u,{t:_}=(0,c.useUiKitI18n)(),v=(0,s.useSlots)(),y=(0,s.useId)(),b=(0,s.useId)(),x=(0,s.useTemplateRef)(`triggerInputRef`),S=(0,s.ref)(``),C=(0,s.useTemplateRef)(`searchInputElementRef`),w=(0,s.useTemplateRef)(`panelSearchInputElementRef`),T=(0,s.useTemplateRef)(`listElementRef`),E=(0,s.ref)(),D=(0,s.ref)(!1),O=(0,s.ref)(!1),P=(0,s.computed)(()=>n.itemId??n.itemValue),oe=(0,s.computed)(()=>({itemValue:n.itemValue,itemTitle:n.itemTitle,itemSubtitle:n.itemSubtitle,itemId:P.value})),{selectedValues:F,filteredOptions:I,listSelectionMode:se,listSelectedModel:L,hasSelectedValues:R,singleDisplayLabel:ce,multipleDisplayLabels:le,multipleDisplayText:z,showPlaceholder:B,showInputSearchField:V,isSearchableMode:ue,isSearchableInputMode:H,isSearchableContentMode:U,isMultipleMode:W,clearSelection:de,removeSelectedValue:G,resolveValueFromListKey:K,formatSelectListKey:q}=ee({modelValue:p,options:()=>n.options,itemFields:()=>oe.value,multiple:()=>n.multiple,returnObject:()=>n.returnObject,searchable:()=>n.searchable,filterOption:()=>n.filterOption,isDropdownOpen:D,searchQuery:m}),fe=(0,s.computed)(()=>!!v[`value-suffix`]),pe=(0,s.computed)(()=>({disabled:n.disabled,displayLabel:ce.value})),J=(0,s.computed)(()=>I.value.length>ae),me=(0,s.computed)(()=>U.value||J.value?n.listHeight:`auto`),he=(0,s.computed)(()=>{if(!(U.value||J.value))return n.listHeight}),ge=(0,s.computed)(()=>F.value.map(e=>q(e))),_e=e=>ge.value.includes(e),ve=()=>({tiny:!0}),ye=e=>f({listItemScope:e,itemTitle:n.itemTitle,itemSubtitle:n.itemSubtitle,itemDisabled:n.itemDisabled,itemIconLeft:n.itemIconLeft,listActiveKey:E.value,isOptionSelected:_e(e.key)}),be=e=>{let t=K(e);if(g(t)){if(W.value){G(t);return}p.value=void 0}},xe=(0,s.computed)(()=>n.id??y),Se=(0,s.computed)(()=>b),Ce=(0,s.computed)(()=>x.value?.fieldElementRef??null),we=(0,s.computed)(()=>({labels:le.value,values:F.value,displayText:z.value,disabled:n.disabled||n.readonly,removeValue:G})),Te=(0,s.computed)(()=>{if(!n.disabled&&(n.readonly&&!H.value||!H.value))return 0}),Ee=(0,s.computed)(()=>({"s-ui-select--disabled":n.disabled,"s-ui-select--readonly":n.readonly,"s-ui-select--multiple":W.value,"s-ui-select--open":D.value})),De=()=>{if(U.value){w.value?.focus();return}C.value?.focus()},Oe=async()=>{await(0,s.nextTick)(),w.value?.focus()},Y=async()=>{await(0,s.nextTick)(),await T.value?.focusNavigation()},X=async()=>{if(!(n.disabled||n.readonly)&&!D.value){if(D.value=!0,h(`open`),U.value){await Oe();return}if(H.value){await(0,s.nextTick)(),C.value?.focus();return}await Y()}},ke=async()=>{n.disabled||n.readonly||D.value||await X()};(0,s.watch)(m,async e=>{H.value&&(n.disabled||n.readonly||e&&(D.value||await X()))});let Z=()=>{D.value&&(D.value=!1,E.value=void 0,h(`close`))},Q=()=>{!n.closeOnSelect||W.value||Z()};(0,s.watch)(p,(e,t)=>{!n.closeOnSelect||W.value||!D.value||!e||e===t||Z()});let Ae=e=>{D.value&&e.target instanceof Element&&e.target.closest(`.s-ui-list-item`)&&Q()},je=async e=>{e.key!==`Enter`&&e.key!==` `&&e.key!==`Spacebar`||D.value&&(await(0,s.nextTick)(),Q())},$=async()=>{if(D.value){Z();return}await X()},Me=async e=>{if(!(n.disabled||n.readonly)&&e.target instanceof HTMLElement){if(e.target.closest(`.s-ui-select__search-input`)){D.value||await X();return}await $()}},Ne=async e=>e.key!==`ArrowDown`&&e.key!==`ArrowUp`?!1:(e.preventDefault(),e.stopPropagation(),D.value||await X(),await Y(),await T.value?.handleKeyboardNavigation(e),!0),Pe=e=>{let t=K(e);if(t){if(W.value){F.value.some(t=>q(t)===e)?G(t):L.value=[...F.value.map(e=>q(e)),e];return}L.value=e,Q()}},Fe=async e=>{if(!(n.disabled||n.readonly)&&!await Ne(e)){if(e.key===`Escape`){e.preventDefault(),Z();return}if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),D.value&&E.value){Pe(E.value);return}await $()}}},Ie=async e=>{if(e.key===`Escape`){e.preventDefault(),Z();return}await Ne(e)},Le=Ie,Re=e=>{n.disabled||(O.value||h(`focus`,e),O.value=!0)},ze=e=>{if(!(e.currentTarget instanceof HTMLElement))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(O.value=!1,h(`blur`,e))},Be=()=>{de(),h(`clear`)};return l({open:X,close:Z,toggle:$,focusSearchInput:De}),(l,u)=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{class:(0,s.normalizeClass)([`s-ui-select`,Ee.value])},[(0,s.createVNode)((0,s.unref)(r.t),{modelValue:D.value,"onUpdate:modelValue":u[4]||=e=>D.value=e,reference:Ce.value,disabled:n.disabled,"match-reference-width":!0,"fit-viewport":n.fitViewport,"content-id":Se.value,"dismiss-on-click-outside":!0,"dismiss-on-escape":!0},{content:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(d),{class:`s-ui-select__menu`,width:`100%`},(0,s.createSlots)({default:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`div`,{class:`s-ui-select__menu-body`,onClick:Ae,onKeydown:je},[(0,s.unref)(I).length>0?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(a.t),{key:0,ref_key:`listElementRef`,ref:T,modelValue:E.value,"onUpdate:modelValue":u[2]||=e=>E.value=e,selected:(0,s.unref)(L),"onUpdate:selected":u[3]||=e=>(0,s.isRef)(L)?L.value=e:null,items:(0,s.unref)(I),"item-key":P.value,"title-key":n.itemTitle,"subtitle-key":n.itemSubtitle,"icon-left-key":n.itemIconLeft,"disabled-key":n.itemDisabled,"selection-mode":(0,s.unref)(se),mandatory:!n.multiple,height:me.value,"max-height":he.value,virtual:J.value,"item-props":ve},(0,s.createSlots)({_:2},[(0,s.unref)(v).option?{name:`item`,fn:(0,s.withCtx)(e=>[(0,s.renderSlot)(l.$slots,`option`,(0,s.normalizeProps)((0,s.guardReactiveProps)(e)))]),key:`0`}:n.closableOptions?{name:`item`,fn:(0,s.withCtx)(n=>[(0,s.createVNode)((0,s.unref)(o.t),(0,s.normalizeProps)((0,s.guardReactiveProps)(ye(n))),(0,s.createSlots)({_:2},[_e(n.key)?{name:`right`,fn:(0,s.withCtx)(r=>[(0,s.createVNode)((0,s.unref)(t.t),{appearance:(0,s.unref)(e.t).BARE,variant:(0,s.unref)(e.r).NEUTRAL,size:(0,s.unref)(e.n).SMALL,icon:`closeMini`,"aria-label":(0,s.unref)(_)(`select.removeOption`),disabled:r.disabled||r.readonly,tabindex:-1,onClick:(0,s.withModifiers)(e=>be(n.key),[`stop`])},null,8,[`appearance`,`variant`,`size`,`aria-label`,`disabled`,`onClick`])]),key:`0`}:void 0]),1040)]),key:`1`}:void 0]),1032,[`modelValue`,`selected`,`items`,`item-key`,`title-key`,`subtitle-key`,`icon-left-key`,`disabled-key`,`selection-mode`,`mandatory`,`height`,`max-height`,`virtual`])):((0,s.openBlock)(),(0,s.createElementBlock)(`div`,k,[(0,s.renderSlot)(l.$slots,`empty`,{},()=>[(0,s.createTextVNode)((0,s.toDisplayString)((0,s.unref)(_)(`select.noOptions`)),1)])]))],32)]),_:2},[(0,s.unref)(U)?{name:`header`,fn:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(i.t),{ref_key:`panelSearchInputElementRef`,ref:w,modelValue:m.value,"onUpdate:modelValue":u[0]||=e=>m.value=e,placeholder:n.searchPlaceholder,disabled:n.disabled,clearable:!1,"icon-left":`search`,onClick:u[1]||=(0,s.withModifiers)(()=>{},[`stop`]),onKeydown:(0,s.unref)(Le)},null,8,[`modelValue`,`placeholder`,`disabled`,`onKeydown`])]),key:`0`}:void 0,(0,s.unref)(v)[`panel-footer`]?{name:`footer`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`panel-footer`)]),key:`1`}:void 0]),1024)]),_:3},8,[`modelValue`,`reference`,`disabled`,`fit-viewport`,`content-id`]),(0,s.createVNode)((0,s.unref)(i.t),{ref_key:`triggerInputRef`,ref:x,modelValue:S.value,"onUpdate:modelValue":u[7]||=e=>S.value=e,label:n.label,"label-props":n.labelProps,placeholder:n.placeholder,"help-messages":n.helpMessages,"error-messages":n.errorMessages,bordered:n.bordered,disabled:n.disabled,readonly:n.readonly,clearable:n.clearable,"has-value":(0,s.unref)(R),focused:O.value||D.value,"icon-left":n.iconLeft,customize:n.customize,name:n.name,id:xe.value,onClear:Be,onFocus:Re,onBlur:ze},(0,s.createSlots)({control:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`div`,{id:xe.value,class:(0,s.normalizeClass)([`s-ui-select__control s-ui-typography-body-14-regular`,{"s-ui-select__control--multiple":(0,s.unref)(W),"s-ui-select__control--empty":(0,s.unref)(W)&&!(0,s.unref)(R)&&!(0,s.unref)(V),"s-ui-select__control--with-value-suffix":fe.value&&!(0,s.unref)(W)&&!(0,s.unref)(V)&&!(0,s.unref)(B)}]),role:`combobox`,"aria-expanded":D.value,"aria-controls":Se.value,"aria-haspopup":`listbox`,"aria-disabled":n.disabled?!0:void 0,"aria-readonly":n.readonly?!0:void 0,"aria-autocomplete":(0,s.unref)(ue)?`list`:void 0,tabindex:Te.value,onClick:Me,onKeydown:Fe},[(0,s.unref)(W)?(0,s.renderSlot)(l.$slots,`selection`,(0,s.normalizeProps)((0,s.mergeProps)({key:0},we.value)),()=>[(0,s.unref)(z)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,A,(0,s.toDisplayString)((0,s.unref)(z)),1)):(0,s.unref)(B)&&!(0,s.unref)(V)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,ne,(0,s.toDisplayString)(n.placeholder),1)):(0,s.createCommentVNode)(``,!0)]):(0,s.unref)(B)&&!(0,s.unref)(V)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,j,(0,s.toDisplayString)(n.placeholder),1)):(0,s.unref)(V)?(0,s.createCommentVNode)(``,!0):((0,s.openBlock)(),(0,s.createElementBlock)(`span`,M,(0,s.toDisplayString)((0,s.unref)(ce)),1)),fe.value&&!(0,s.unref)(W)&&!(0,s.unref)(V)&&!(0,s.unref)(B)?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,N,[(0,s.renderSlot)(l.$slots,`value-suffix`,(0,s.normalizeProps)((0,s.guardReactiveProps)(pe.value)))])):(0,s.createCommentVNode)(``,!0),(0,s.unref)(V)?(0,s.withDirectives)(((0,s.openBlock)(),(0,s.createElementBlock)(`input`,{key:4,ref_key:`searchInputElementRef`,ref:C,"onUpdate:modelValue":u[5]||=e=>m.value=e,class:`s-ui-select__search-input`,type:`text`,name:n.name,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,autocomplete:`off`,onClick:u[6]||=(0,s.withModifiers)(()=>{},[`stop`]),onFocus:ke,onKeydown:Ie},null,40,re)),[[s.vModelText,m.value]]):(0,s.createCommentVNode)(``,!0)],42,te)]),action:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(c.SIcon),{name:`chevronMiniDown`,size:ie,class:`s-ui-select__chevron`})]),_:2},[(0,s.unref)(v).label?{name:`label`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`label`)]),key:`0`}:void 0,(0,s.unref)(v).prefix?{name:`prefix`,fn:(0,s.withCtx)(e=>[(0,s.renderSlot)(l.$slots,`prefix`,(0,s.normalizeProps)((0,s.guardReactiveProps)(e)))]),key:`1`}:void 0,(0,s.unref)(v).prepend?{name:`prepend`,fn:(0,s.withCtx)(e=>[(0,s.renderSlot)(l.$slots,`prepend`,(0,s.normalizeProps)((0,s.guardReactiveProps)(e)))]),key:`2`}:void 0,(0,s.unref)(v).message?{name:`message`,fn:(0,s.withCtx)(()=>[(0,s.renderSlot)(l.$slots,`message`)]),key:`3`}:void 0]),1032,[`modelValue`,`label`,`label-props`,`placeholder`,`help-messages`,`error-messages`,`bordered`,`disabled`,`readonly`,`clearable`,`has-value`,`focused`,`icon-left`,`customize`,`name`,`id`])],2))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return P}});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ISChartBurnupProps } from './SChartBurnup.types';
|
|
2
|
-
declare const __VLS_export: import("vue").DefineComponent<ISChartBurnupProps, {
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<ISChartBurnupProps, {
|
|
3
|
+
/** PNG-снимок текущего чарта (dataURL) с непрозрачным фоном. */
|
|
4
|
+
exportImage: () => string | undefined;
|
|
5
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ISChartBurnupProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
6
|
declare const _default: typeof __VLS_export;
|
|
4
7
|
export default _default;
|
|
5
8
|
//# sourceMappingURL=SChartBurnup.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SChartBurnup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/SChartBurnup/SChartBurnup.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SChartBurnup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/SChartBurnup/SChartBurnup.vue"],"names":[],"mappings":"AAwHA,OAAO,KAAK,EAA0B,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAwJtF,QAAA,MAAM,YAAY;IAvEhB,gEAAgE;;2PA0EhE,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|