@astrato-io/visualizations 0.8.0 → 0.9.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.
Files changed (125) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.md +307 -378
  3. package/chunks/{Button-BrGKp9Nm.js → Button-5CxPEACP.js} +11 -11
  4. package/chunks/CircularProgress-DFS-LQb7.js +765 -0
  5. package/chunks/FieldTypeIcon-pSVQFemC.js +22 -0
  6. package/chunks/LinearProgress-CjIQfkNA.js +327 -0
  7. package/chunks/{MenuOption-ByRqhRdX.js → MenuOption-Cb7B7x6z.js} +1384 -1002
  8. package/chunks/Title-CtFw1bVg.js +1804 -0
  9. package/chunks/ToggleButton-Br9HCPCv.js +150 -0
  10. package/chunks/{app-filter-bar.compiler-TwVTeoj5.js → app-filter-bar.compiler-B9775gLJ.js} +3 -3
  11. package/chunks/{bar.compiler-DuQg8EUb.js → bar.compiler-B7wlH_Ro.js} +4 -4
  12. package/chunks/{builder-DEDvNq1k.js → builder-Dxo7D7c6.js} +118 -55
  13. package/chunks/{coloring-CncX_JRX.js → coloring-B-Wa8D5P.js} +3 -3
  14. package/chunks/contains-BK-sRXcB.js +21 -0
  15. package/chunks/{definitions-BPJQTx16.js → definitions-DNpzD9tY.js} +26 -26
  16. package/chunks/{escobar-DRhRMYRE.js → escobar-C4Nm3eJ7.js} +4436 -4802
  17. package/chunks/{extend-preset-CUFNpmPe.js → extend-preset-BVKFtoe-.js} +46 -46
  18. package/chunks/{filter.compiler-w27dlv0C.js → filter.compiler-BlS3zoy_.js} +7 -7
  19. package/chunks/{filtering-cc7WqWpg.js → filtering-CGuLpg7u.js} +494 -270
  20. package/chunks/{handlers-TOT-7INo.js → handlers-CMbyj5y1.js} +1513 -1454
  21. package/chunks/{icon-picker-styles-CoJmwTRi.js → icon-picker-styles-DYQgVEKG.js} +8 -8
  22. package/chunks/{isEqual-B8loyPsC.js → isEqual-DBg_b35N.js} +1 -1
  23. package/chunks/isFocusVisible-B1_z03UT.js +144 -0
  24. package/chunks/{line.compiler-Ct1WhN2p.js → line.compiler-Bo9i9qag.js} +7 -7
  25. package/chunks/{logger-DpQtYQnX.js → logger-3lng-wOw.js} +7 -3
  26. package/chunks/{metadata-WABZrt7Y.js → metadata-Fmx1swpK.js} +1 -1
  27. package/chunks/{number.compiler-D8TPly-4.js → number.compiler-CdLd5aGW.js} +7 -7
  28. package/chunks/{operations-Dh4v1Ovt.js → operations-HSqnCRvv.js} +9156 -9112
  29. package/chunks/{range-Bi-7zT0k.js → range-CzO4isKK.js} +2 -2
  30. package/chunks/react-dom-BwZT0N3F.js +368 -0
  31. package/chunks/{render-wrappers-OEmtaM8g.js → render-wrappers-CAuvgMxi.js} +1 -1
  32. package/chunks/{requirements-Dvd8jqYF.js → requirements-CYpVh65U.js} +52 -52
  33. package/chunks/responsive.styles-FItb913l.js +93 -0
  34. package/chunks/{shared-Bn4N5QcZ.js → shared-DFoJxjVN.js} +401 -401
  35. package/chunks/{standalone-D__XCp-h.js → standalone-530a5lvf.js} +306 -306
  36. package/chunks/{standalone-CXNP6-xD.js → standalone-5DnapeHH.js} +112 -112
  37. package/chunks/{standalone-XTgSsTAa.js → standalone-B4jrf4KE.js} +70 -70
  38. package/chunks/{standalone-Bes8srx1.js → standalone-B6s_xG2u.js} +14 -14
  39. package/chunks/{standalone-vBnBS2YC.js → standalone-BDrQMxLi.js} +98 -98
  40. package/chunks/standalone-BMoJXGYe.js +2 -0
  41. package/chunks/{standalone-CLmGb7nn2.js → standalone-BfvGggeM2.js} +76 -76
  42. package/chunks/{standalone-D5Q5ngsD.js → standalone-BvWdpUL3.js} +26 -26
  43. package/chunks/{standalone-we5D5MIn.js → standalone-C6XDHYAM.js} +31 -31
  44. package/chunks/standalone-CMJJIi9v.js +2 -0
  45. package/chunks/{standalone-C8ZAEutO.js → standalone-CNkHsynO.js} +28 -28
  46. package/chunks/{standalone-BMTCb10X.js → standalone-CPUiiWNP.js} +5 -5
  47. package/chunks/{standalone-XuGksArp.js → standalone-CXniic5x.js} +9 -9
  48. package/chunks/standalone-C_Jd4gkj.js +6 -0
  49. package/chunks/{standalone-DW6NT205.js → standalone-CiaaibTa.js} +142 -142
  50. package/chunks/standalone-CoQxJ6ov.js +3638 -0
  51. package/chunks/{standalone-CM5XcAN5.js → standalone-Cu73fzSr.js} +7660 -7534
  52. package/chunks/standalone-DBeXQrwH.js +468 -0
  53. package/chunks/{standalone-DMcI1afI.js → standalone-DMCwtebn.js} +81 -81
  54. package/chunks/{standalone-BlMIwpEe.js → standalone-DWPfdP0A.js} +800 -668
  55. package/chunks/{standalone-DLlyRIE6.js → standalone-DpSRmAWx.js} +59 -59
  56. package/chunks/{standalone-BGkmozIb.js → standalone-DuwTOBXH.js} +256 -256
  57. package/chunks/{standalone-BDhPQtzQ.js → standalone-LFVgLhia.js} +234 -234
  58. package/chunks/{standalone-B55oyW6c.js → standalone-kzAhwH19.js} +149 -149
  59. package/chunks/{standalone-DN4S1MjT.js → standalone-mb7LwEiq.js} +885 -885
  60. package/chunks/{standalone-CJvIXsQE.js → standalone-r4ObFvys.js} +155 -155
  61. package/chunks/{table.compiler-DMeeHxb6.js → table.compiler-C1qjqXaT.js} +7 -7
  62. package/chunks/{typeof-CJDtcySz.js → typeof-DCq3QgvY.js} +6 -1
  63. package/chunks/useFieldName-mWrD_uk_.js +7 -0
  64. package/chunks/{utils-vdmi_2PK.js → utils-DYYD4Zzf.js} +7593 -12707
  65. package/chunks/{view-BuwQugKb.js → view-7fH6mGmY.js} +2034 -2070
  66. package/chunks/{visualization-filters-Cc4KU-l-.js → visualization-filters-mVnsnvLP.js} +3581 -3555
  67. package/chunks/with-html-element-B0Clt4jY.js +15901 -0
  68. package/definitions.js +2 -2
  69. package/docs/operations/astrato-app-filter-bar.md +1 -1
  70. package/docs/operations/bar.md +1 -1
  71. package/docs/operations/combo.md +1 -1
  72. package/docs/operations/date-picker.md +1 -1
  73. package/docs/operations/distribution-gauge.md +1 -1
  74. package/docs/operations/dot.md +1 -1
  75. package/docs/operations/filter.md +1 -1
  76. package/docs/operations/gauge.md +1 -1
  77. package/docs/operations/heatMap.md +1 -1
  78. package/docs/operations/histogram.md +1 -1
  79. package/docs/operations/iframe.md +1 -1
  80. package/docs/operations/image.md +1 -1
  81. package/docs/operations/index.md +2 -2
  82. package/docs/operations/line.md +1 -1
  83. package/docs/operations/number.md +1 -1
  84. package/docs/operations/pie.md +1 -1
  85. package/docs/operations/radar.md +1 -1
  86. package/docs/operations/sankey.md +1 -1
  87. package/docs/operations/scatter.md +1 -1
  88. package/docs/operations/shape.md +1 -1
  89. package/docs/operations/simpleTextObject.md +1 -1
  90. package/docs/operations/slider.md +1 -1
  91. package/docs/operations/table.md +66 -1
  92. package/docs/operations/tree.md +1 -1
  93. package/docs/operations/treemap.md +1 -1
  94. package/docs/operations/waterfall.md +1 -1
  95. package/docs/operations/word-cloud.md +1 -1
  96. package/getters.js +2 -2
  97. package/index.js +74 -68
  98. package/metadata.js +2 -2
  99. package/operations.js +5 -5
  100. package/package.json +67 -66
  101. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +348 -348
  102. package/src/definitions/model/definitions/schema-registry.d.ts +101 -101
  103. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +8 -8
  104. package/src/definitions/model/definitions/schemas/common.schema.d.ts +29 -29
  105. package/src/definitions/model/definitions/schemas/line.schema.d.ts +10 -10
  106. package/src/definitions/model/definitions/schemas/number.schema.d.ts +4 -4
  107. package/src/definitions/model/definitions/schemas/object.schema.d.ts +38 -38
  108. package/src/definitions/model/definitions/schemas/table.schema.d.ts +61 -61
  109. package/src/visualization-catalog.d.ts +26 -26
  110. package/chunks/DefaultPropsProvider-BsfB7QTn.js +0 -257
  111. package/chunks/FieldTypeIcon-Drs6hSJF.js +0 -22
  112. package/chunks/LinearProgress-VtfFx2vJ.js +0 -253
  113. package/chunks/Title-CO5dP1ma.js +0 -1691
  114. package/chunks/ToggleButton-KOBAimC1.js +0 -112
  115. package/chunks/colorManipulator-D8Pjy1pf.js +0 -45
  116. package/chunks/responsive.styles-DSiOGD7u.js +0 -82
  117. package/chunks/standalone-BXKRE_Se.js +0 -468
  118. package/chunks/standalone-BjZp0QMe.js +0 -2
  119. package/chunks/standalone-C8qAelL4.js +0 -2
  120. package/chunks/standalone-DT0wKji7.js +0 -6
  121. package/chunks/standalone-DYQIQH4c.js +0 -2095
  122. package/chunks/useFieldName-Cjn9KCVp.js +0 -7
  123. package/chunks/useSlotProps-DLbQp4lc.js +0 -166
  124. package/chunks/with-html-element-D0uY2zjI.js +0 -7328
  125. /package/chunks/{src-BOS6SqkZ.js → src-BOS6SqkZ2.js} +0 -0
@@ -1,2095 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Da as t, Ei as n, Hi as r, Oa as i, Pi as a, Vo as o, _c as s, da as c, ka as l, wi as u, zi as d } from "./visualization-filters-Cc4KU-l-.js";
3
- import { $ as f, Bn as p, Bt as m, Ei as h, G as g, Ht as _, J as v, Jn as y, K as b, Qr as x, Vt as S, W as C, Wr as w, Xr as T, Xt as E, bn as D, c as O, d as k, ln as A, m as j, n as M, p as N, ri as P, rt as F, s as I, un as L, ur as R } from "./utils-vdmi_2PK.js";
4
- import { s as z } from "./logger-DpQtYQnX.js";
5
- import { T as B, a as V, d as H, h as U, m as ee, u as te } from "./MenuOption-ByRqhRdX.js";
6
- import { _ as ne, a as re, c as ie, d as ae, g as oe, h as se, i as ce, l as le, n as ue, o as de, r as fe, s as pe, t as me, u as he } from "./filtering-cc7WqWpg.js";
7
- import { c as W, d as G, l as ge, r as K, t as _e, u as ve } from "./DefaultPropsProvider-BsfB7QTn.js";
8
- import { t as ye } from "./colorManipulator-D8Pjy1pf.js";
9
- import { c as be, f as xe, l as q, s as Se } from "./useSlotProps-DLbQp4lc.js";
10
- import { c as J, m as Ce, n as we, u as Te } from "./Title-CO5dP1ma.js";
11
- import { d as Ee, f as Y } from "./responsive.styles-DSiOGD7u.js";
12
- import { t as De } from "./Button-BrGKp9Nm.js";
13
- function Oe({ props: e, name: t }) {
14
- return ne({
15
- props: e,
16
- name: t,
17
- defaultTheme: b,
18
- themeId: _
19
- });
20
- }
21
- function ke(e) {
22
- return ve("MuiCollapse", e);
23
- }
24
- ge("MuiCollapse", [
25
- "root",
26
- "horizontal",
27
- "vertical",
28
- "entered",
29
- "hidden",
30
- "wrapper",
31
- "wrapperInner"
32
- ]), S(), L();
33
- var X = /* @__PURE__ */ e(h()), Z = P(), Ae = [
34
- "addEndListener",
35
- "children",
36
- "className",
37
- "collapsedSize",
38
- "component",
39
- "easing",
40
- "in",
41
- "onEnter",
42
- "onEntered",
43
- "onEntering",
44
- "onExit",
45
- "onExited",
46
- "onExiting",
47
- "orientation",
48
- "style",
49
- "timeout",
50
- "TransitionComponent"
51
- ], je = (e) => {
52
- let { orientation: t, classes: n } = e;
53
- return W({
54
- root: ["root", `${t}`],
55
- entered: ["entered"],
56
- hidden: ["hidden"],
57
- wrapper: ["wrapper", `${t}`],
58
- wrapperInner: ["wrapperInner", `${t}`]
59
- }, ke, n);
60
- }, Me = K("div", {
61
- name: "MuiCollapse",
62
- slot: "Root",
63
- overridesResolver: (e, t) => {
64
- let { ownerState: n } = e;
65
- return [
66
- t.root,
67
- t[n.orientation],
68
- n.state === "entered" && t.entered,
69
- n.state === "exited" && !n.in && n.collapsedSize === "0px" && t.hidden
70
- ];
71
- }
72
- })(({ theme: e, ownerState: t }) => A({
73
- height: 0,
74
- overflow: "hidden",
75
- transition: e.transitions.create("height")
76
- }, t.orientation === "horizontal" && {
77
- height: "auto",
78
- width: 0,
79
- transition: e.transitions.create("width")
80
- }, t.state === "entered" && A({
81
- height: "auto",
82
- overflow: "visible"
83
- }, t.orientation === "horizontal" && { width: "auto" }), t.state === "exited" && !t.in && t.collapsedSize === "0px" && { visibility: "hidden" })), Ne = K("div", {
84
- name: "MuiCollapse",
85
- slot: "Wrapper",
86
- overridesResolver: (e, t) => t.wrapper
87
- })(({ ownerState: e }) => A({
88
- display: "flex",
89
- width: "100%"
90
- }, e.orientation === "horizontal" && {
91
- width: "auto",
92
- height: "100%"
93
- })), Pe = K("div", {
94
- name: "MuiCollapse",
95
- slot: "WrapperInner",
96
- overridesResolver: (e, t) => t.wrapperInner
97
- })(({ ownerState: e }) => A({ width: "100%" }, e.orientation === "horizontal" && {
98
- width: "auto",
99
- height: "100%"
100
- })), Fe = /*#__PURE__*/ X.forwardRef(function(e, t) {
101
- let n = _e({
102
- props: e,
103
- name: "MuiCollapse"
104
- }), { addEndListener: r, children: i, className: a, collapsedSize: o = "0px", component: s, easing: c, in: l, onEnter: u, onEntered: d, onEntering: f, onExit: p, onExited: h, onExiting: _, orientation: y = "vertical", style: b, timeout: x = v.standard, TransitionComponent: S = Te } = n, C = m(n, Ae), w = A({}, n, {
105
- orientation: y,
106
- collapsedSize: o
107
- }), T = je(w), E = g(), D = Se(), O = X.useRef(null), k = X.useRef(), j = typeof o == "number" ? `${o}px` : o, M = y === "horizontal", N = M ? "width" : "height", P = X.useRef(null), F = Ce(t, P), I = (e) => (t) => {
108
- if (e) {
109
- let n = P.current;
110
- t === void 0 ? e(n) : e(n, t);
111
- }
112
- }, L = () => O.current ? O.current[M ? "clientWidth" : "clientHeight"] : 0, R = I((e, t) => {
113
- O.current && M && (O.current.style.position = "absolute"), e.style[N] = j, u && u(e, t);
114
- }), z = I((e, t) => {
115
- let n = L();
116
- O.current && M && (O.current.style.position = "");
117
- let { duration: r, easing: i } = J({
118
- style: b,
119
- timeout: x,
120
- easing: c
121
- }, { mode: "enter" });
122
- if (x === "auto") {
123
- let t = E.transitions.getAutoHeightDuration(n);
124
- e.style.transitionDuration = `${t}ms`, k.current = t;
125
- } else e.style.transitionDuration = typeof r == "string" ? r : `${r}ms`;
126
- e.style[N] = `${n}px`, e.style.transitionTimingFunction = i, f && f(e, t);
127
- }), B = I((e, t) => {
128
- e.style[N] = "auto", d && d(e, t);
129
- }), V = I((e) => {
130
- e.style[N] = `${L()}px`, p && p(e);
131
- }), H = I(h), U = I((e) => {
132
- let t = L(), { duration: n, easing: r } = J({
133
- style: b,
134
- timeout: x,
135
- easing: c
136
- }, { mode: "exit" });
137
- if (x === "auto") {
138
- let n = E.transitions.getAutoHeightDuration(t);
139
- e.style.transitionDuration = `${n}ms`, k.current = n;
140
- } else e.style.transitionDuration = typeof n == "string" ? n : `${n}ms`;
141
- e.style[N] = j, e.style.transitionTimingFunction = r, _ && _(e);
142
- });
143
- return /*#__PURE__*/ (0, Z.jsx)(S, A({
144
- in: l,
145
- onEnter: R,
146
- onEntered: B,
147
- onEntering: z,
148
- onExit: V,
149
- onExited: H,
150
- onExiting: U,
151
- addEndListener: (e) => {
152
- x === "auto" && D.start(k.current || 0, e), r && r(P.current, e);
153
- },
154
- nodeRef: P,
155
- timeout: x === "auto" ? null : x
156
- }, C, { children: (e, t) => /*#__PURE__*/ (0, Z.jsx)(Me, A({
157
- as: s,
158
- className: G(T.root, a, {
159
- entered: T.entered,
160
- exited: !l && j === "0px" && T.hidden
161
- }[e]),
162
- style: A({ [M ? "minWidth" : "minHeight"]: j }, b),
163
- ref: F
164
- }, t, {
165
- ownerState: A({}, w, { state: e }),
166
- children: /*#__PURE__*/ (0, Z.jsx)(Ne, {
167
- ownerState: A({}, w, { state: e }),
168
- className: T.wrapper,
169
- ref: O,
170
- children: /*#__PURE__*/ (0, Z.jsx)(Pe, {
171
- ownerState: A({}, w, { state: e }),
172
- className: T.wrapperInner,
173
- children: i
174
- })
175
- })
176
- })) }));
177
- });
178
- Fe.muiSupportAuto = !0;
179
- var Ie = (e) => ({
180
- hasImage: !!e.dimensions[1]?.dataItem,
181
- hasMeasure: !!e.measures[0]?.dataItem,
182
- searchEnabled: !!e.filterSettings?.searchable,
183
- quickSelection: !!e.filterSettings?.quickSelect
184
- }), Q = z(), Le = /* @__PURE__ */ e(p()), Re = C({ menuTrigger: ({ responsive: e, isDisplayImportant: t }) => ({
185
- ...e && Ee,
186
- display: t ? "inline-flex !important" : "inline-flex",
187
- alignItems: "center",
188
- justifyContent: "center",
189
- minWidth: 22,
190
- width: 22,
191
- height: 22,
192
- padding: 0,
193
- borderRadius: 6,
194
- border: "none",
195
- backgroundColor: "transparent",
196
- color: "inherit",
197
- lineHeight: 0,
198
- "&:hover": { boxShadow: "inset 0 0 0 1px currentColor" },
199
- "&:focus": { outline: "none" },
200
- ...e && {
201
- [Y.md]: {
202
- minWidth: 20,
203
- width: 20,
204
- height: 20,
205
- borderRadius: 5
206
- },
207
- [Y.sm]: {
208
- minWidth: 16,
209
- width: 16,
210
- height: 16,
211
- borderRadius: 4
212
- },
213
- [Y.xs]: {
214
- minWidth: 12,
215
- width: 12,
216
- height: 12,
217
- borderRadius: 3
218
- }
219
- }
220
- }) });
221
- function ze(e) {
222
- let { isPreview: t, areSelectedValues: n, arePendingValues: r, isNotEnabled: i, responsive: a, onClear: o, onDeselectAll: s, onSelectAll: c, onSelectExcluded: l, toggleNotOperator: u, onLockClick: d, isSingleSelectField: f = !1 } = e, [p, m] = (0, X.useState)(!1), h = Re({
223
- responsive: a,
224
- isDisplayImportant: !0
225
- }), g = D().daedalus.getWorkbookProperties()?.isLockUnlockFieldsEnabled ?? !1, _ = [{
226
- disabled: t || !r,
227
- key: "clear",
228
- label: "Clear",
229
- type: "option",
230
- onClick: o
231
- }];
232
- return f || _.push({
233
- key: "divider",
234
- type: "divider"
235
- }, {
236
- disabled: t || !n,
237
- key: "deselect-all",
238
- label: "Deselect all",
239
- type: "option",
240
- onClick: s
241
- }, {
242
- disabled: t,
243
- key: "select-all",
244
- label: i ? "Exclude all" : "Select all",
245
- type: "option",
246
- onClick: c
247
- }, {
248
- disabled: t,
249
- key: "invert",
250
- label: "Invert",
251
- type: "option",
252
- onClick: l
253
- }, {
254
- disabled: t,
255
- key: "not",
256
- label: "Exclude",
257
- type: "option",
258
- onClick: u
259
- }), g && _.push({
260
- key: "divider",
261
- type: "divider"
262
- }, {
263
- key: "lock",
264
- label: "Lock",
265
- type: "option",
266
- icon: { right: /* @__PURE__ */ (0, Z.jsx)(R, {}) },
267
- onClick: d
268
- }), /* @__PURE__ */ (0, Z.jsx)(we, {
269
- open: p,
270
- placement: "bottom-end",
271
- title: /* @__PURE__ */ (0, Z.jsx)(B, {
272
- onClickAway: () => m(!1),
273
- children: /* @__PURE__ */ (0, Z.jsx)(V, {
274
- appearance: "legacy",
275
- onClose: () => m(!1),
276
- options: _,
277
- responsive: a,
278
- style: { margin: "-8px -12px" }
279
- })
280
- }),
281
- children: /* @__PURE__ */ (0, Z.jsx)(H, {
282
- onClick: () => m(!p),
283
- "data-testid": "filter-button-icon-dots",
284
- className: h.menuTrigger,
285
- children: /* @__PURE__ */ (0, Z.jsx)(w, {
286
- fill: "currentColor",
287
- size: 20
288
- })
289
- })
290
- });
291
- }
292
- function Be(e) {
293
- return typeof e == "string";
294
- }
295
- function Ve(e, t, n) {
296
- return e === void 0 || Be(e) ? t : {
297
- ...t,
298
- ownerState: {
299
- ...t.ownerState,
300
- ...n
301
- }
302
- };
303
- }
304
- function He(e, t = []) {
305
- if (e === void 0) return {};
306
- let n = {};
307
- return Object.keys(e).filter((n) => n.match(/^on[A-Z]/) && typeof e[n] == "function" && !t.includes(n)).forEach((t) => {
308
- n[t] = e[t];
309
- }), n;
310
- }
311
- function Ue(e, t, n) {
312
- return typeof e == "function" ? e(t, n) : e;
313
- }
314
- function We(...e) {
315
- let t = X.useRef(void 0), n = X.useCallback((t) => {
316
- let n = e.map((e) => {
317
- if (e == null) return null;
318
- if (typeof e == "function") {
319
- let n = e, r = n(t);
320
- return typeof r == "function" ? r : () => {
321
- n(null);
322
- };
323
- }
324
- return e.current = t, () => {
325
- e.current = null;
326
- };
327
- });
328
- return () => {
329
- n.forEach((e) => e?.());
330
- };
331
- }, e);
332
- return X.useMemo(() => e.every((e) => e == null) ? null : (e) => {
333
- t.current &&= (t.current(), void 0), e != null && (t.current = n(e));
334
- }, e);
335
- }
336
- function Ge(e, t, n = void 0) {
337
- let r = {};
338
- for (let i in e) {
339
- let a = e[i], o = "", s = !0;
340
- for (let e = 0; e < a.length; e += 1) {
341
- let r = a[e];
342
- r && (o += (s === !0 ? "" : " ") + t(r), s = !1, n && n[r] && (o += " " + n[r]));
343
- }
344
- r[i] = o;
345
- }
346
- return r;
347
- }
348
- function Ke(e) {
349
- if (e === void 0) return {};
350
- let t = {};
351
- return Object.keys(e).filter((t) => !(t.match(/^on[A-Z]/) && typeof e[t] == "function")).forEach((n) => {
352
- t[n] = e[n];
353
- }), t;
354
- }
355
- function qe(e) {
356
- let { getSlotProps: t, additionalProps: n, externalSlotProps: r, externalForwardedProps: i, className: a } = e;
357
- if (!t) {
358
- let e = G(n?.className, a, i?.className, r?.className), t = {
359
- ...n?.style,
360
- ...i?.style,
361
- ...r?.style
362
- }, o = {
363
- ...n,
364
- ...i,
365
- ...r
366
- };
367
- return e.length > 0 && (o.className = e), Object.keys(t).length > 0 && (o.style = t), {
368
- props: o,
369
- internalRef: void 0
370
- };
371
- }
372
- let o = He({
373
- ...i,
374
- ...r
375
- }), s = Ke(r), c = Ke(i), l = t(o), u = G(l?.className, n?.className, a, i?.className, r?.className), d = {
376
- ...l?.style,
377
- ...n?.style,
378
- ...i?.style,
379
- ...r?.style
380
- }, f = {
381
- ...l,
382
- ...n,
383
- ...c,
384
- ...s
385
- };
386
- return u.length > 0 && (f.className = u), Object.keys(d).length > 0 && (f.style = d), {
387
- props: f,
388
- internalRef: l.ref
389
- };
390
- }
391
- function Je(e) {
392
- let { elementType: t, externalSlotProps: n, ownerState: r, skipResolvingSlotProps: i = !1, ...a } = e, o = i ? {} : Ue(n, r), { props: s, internalRef: c } = qe({
393
- ...a,
394
- externalSlotProps: o
395
- }), l = We(c, o?.ref, e.additionalProps?.ref);
396
- return Ve(t, {
397
- ...s,
398
- ref: l
399
- }, r);
400
- }
401
- S(), L();
402
- var Ye = ["element"];
403
- function Xe(e, t) {
404
- for (let n = 0; n < e.length; n += 1) if (t(e[n])) return n;
405
- return -1;
406
- }
407
- function Ze(e, t) {
408
- let n = 0, r = e.length - 1;
409
- for (; n <= r;) {
410
- let i = Math.floor((n + r) / 2);
411
- if (e[i].element === t) return i;
412
- e[i].element.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_PRECEDING ? r = i - 1 : n = i + 1;
413
- }
414
- return n;
415
- }
416
- var Qe = /*#__PURE__*/ X.createContext({});
417
- function $e(e) {
418
- let t = X.useRef(null);
419
- return X.useEffect(() => {
420
- t.current = e;
421
- }, [e]), t.current;
422
- }
423
- var et = () => {};
424
- function tt(e) {
425
- let [, t] = X.useState(), { registerDescendant: n = et, unregisterDescendant: r = et, descendants: i = [], parentId: a = null } = X.useContext(Qe), o = Xe(i, (t) => t.element === e.element), s = $e(i);
426
- return F(() => {
427
- if (e.element) return n(A({}, e, { index: o })), () => {
428
- r(e.element);
429
- };
430
- t({});
431
- }, [
432
- n,
433
- r,
434
- o,
435
- i.some((e, t) => s && s[t] && s[t].element !== e.element),
436
- e
437
- ]), {
438
- parentId: a,
439
- index: o
440
- };
441
- }
442
- function nt(e) {
443
- let { children: t, id: n } = e, [r, i] = X.useState([]), a = X.useCallback((e) => {
444
- let { element: t } = e, n = m(e, Ye);
445
- i((e) => {
446
- if (e.length === 0) return [A({}, n, {
447
- element: t,
448
- index: 0
449
- })];
450
- let r = Ze(e, t), i;
451
- if (e[r] && e[r].element === t) i = e;
452
- else {
453
- let a = A({}, n, {
454
- element: t,
455
- index: r
456
- });
457
- i = e.slice(), i.splice(r, 0, a);
458
- }
459
- return i.forEach((e, t) => {
460
- e.index = t;
461
- }), i;
462
- });
463
- }, []), o = X.useCallback((e) => {
464
- i((t) => t.filter((t) => e !== t.element));
465
- }, []), s = X.useMemo(() => ({
466
- descendants: r,
467
- registerDescendant: a,
468
- unregisterDescendant: o,
469
- parentId: n
470
- }), [
471
- r,
472
- a,
473
- o,
474
- n
475
- ]);
476
- return /*#__PURE__*/ (0, Z.jsx)(Qe.Provider, {
477
- value: s,
478
- children: t
479
- });
480
- }
481
- var rt = {
482
- instance: null,
483
- multiSelect: !1,
484
- disabledItemsFocusable: !1,
485
- treeId: void 0,
486
- icons: {
487
- defaultCollapseIcon: null,
488
- defaultExpandIcon: null,
489
- defaultParentIcon: null,
490
- defaultEndIcon: null
491
- }
492
- }, it = /*#__PURE__*/ X.createContext(rt), at = () => X.useContext(it);
493
- function ot(e) {
494
- let { instance: t, multiSelect: n } = at(), r = t ? t.isNodeExpandable(e) : !1, i = t ? t.isNodeExpanded(e) : !1, a = t ? t.isNodeFocused(e) : !1, o = t ? t.isNodeSelected(e) : !1, s = t ? t.isNodeDisabled(e) : !1;
495
- return {
496
- disabled: s,
497
- expanded: i,
498
- selected: o,
499
- focused: a,
500
- handleExpansion: (i) => {
501
- if (t && !s) {
502
- a || t.focusNode(i, e);
503
- let o = n && (i.shiftKey || i.ctrlKey || i.metaKey);
504
- r && !(o && t.isNodeExpanded(e)) && t.toggleNodeExpansion(i, e);
505
- }
506
- },
507
- handleSelection: (r) => {
508
- t && !s && (a || t.focusNode(r, e), n && (r.shiftKey || r.ctrlKey || r.metaKey) ? r.shiftKey ? t.selectRange(r, { end: e }) : t.selectNode(r, e, !0) : t.selectNode(r, e));
509
- },
510
- preventSelection: (e) => {
511
- (e.shiftKey || e.ctrlKey || e.metaKey || s) && e.preventDefault();
512
- }
513
- };
514
- }
515
- L(), S();
516
- var st = [
517
- "classes",
518
- "className",
519
- "displayIcon",
520
- "expansionIcon",
521
- "icon",
522
- "label",
523
- "nodeId",
524
- "onClick",
525
- "onMouseDown"
526
- ], ct = /*#__PURE__*/ X.forwardRef(function(e, t) {
527
- let { classes: n, className: r, displayIcon: i, expansionIcon: a, icon: o, label: s, nodeId: c, onClick: l, onMouseDown: u } = e, d = m(e, st), { disabled: f, expanded: p, selected: h, focused: g, handleExpansion: _, handleSelection: v, preventSelection: y } = ot(c), b = o || a || i;
528
- return /*#__PURE__*/ (0, Z.jsxs)("div", A({}, d, {
529
- className: G(r, n.root, p && n.expanded, h && n.selected, g && n.focused, f && n.disabled),
530
- onClick: (e) => {
531
- _(e), v(e), l && l(e);
532
- },
533
- onMouseDown: (e) => {
534
- y(e), u && u(e);
535
- },
536
- ref: t,
537
- children: [/*#__PURE__*/ (0, Z.jsx)("div", {
538
- className: n.iconContainer,
539
- children: b
540
- }), /*#__PURE__*/ (0, Z.jsx)("div", {
541
- className: n.label,
542
- children: s
543
- })]
544
- }));
545
- });
546
- function lt(e) {
547
- return ve("MuiTreeItem", e);
548
- }
549
- var $ = ge("MuiTreeItem", [
550
- "root",
551
- "group",
552
- "content",
553
- "expanded",
554
- "selected",
555
- "focused",
556
- "disabled",
557
- "iconContainer",
558
- "label"
559
- ]);
560
- S(), L();
561
- var ut = [
562
- "children",
563
- "className",
564
- "collapseIcon",
565
- "ContentComponent",
566
- "ContentProps",
567
- "endIcon",
568
- "expandIcon",
569
- "disabled",
570
- "icon",
571
- "id",
572
- "label",
573
- "nodeId",
574
- "onClick",
575
- "onMouseDown",
576
- "TransitionComponent",
577
- "TransitionProps"
578
- ], dt = (e) => {
579
- let { classes: t } = e;
580
- return Ge({
581
- root: ["root"],
582
- content: ["content"],
583
- expanded: ["expanded"],
584
- selected: ["selected"],
585
- focused: ["focused"],
586
- disabled: ["disabled"],
587
- iconContainer: ["iconContainer"],
588
- label: ["label"],
589
- group: ["group"]
590
- }, lt, t);
591
- }, ft = K("li", {
592
- name: "MuiTreeItem",
593
- slot: "Root",
594
- overridesResolver: (e, t) => t.root
595
- })({
596
- listStyle: "none",
597
- margin: 0,
598
- padding: 0,
599
- outline: 0
600
- }), pt = K(ct, {
601
- name: "MuiTreeItem",
602
- slot: "Content",
603
- overridesResolver: (e, t) => [
604
- t.content,
605
- t.iconContainer && { [`& .${$.iconContainer}`]: t.iconContainer },
606
- t.label && { [`& .${$.label}`]: t.label }
607
- ]
608
- })(({ theme: e }) => ({
609
- padding: "0 8px",
610
- width: "100%",
611
- boxSizing: "border-box",
612
- display: "flex",
613
- alignItems: "center",
614
- cursor: "pointer",
615
- WebkitTapHighlightColor: "transparent",
616
- "&:hover": {
617
- backgroundColor: (e.vars || e).palette.action.hover,
618
- "@media (hover: none)": { backgroundColor: "transparent" }
619
- },
620
- [`&.${$.disabled}`]: {
621
- opacity: (e.vars || e).palette.action.disabledOpacity,
622
- backgroundColor: "transparent"
623
- },
624
- [`&.${$.focused}`]: { backgroundColor: (e.vars || e).palette.action.focus },
625
- [`&.${$.selected}`]: {
626
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : ye(e.palette.primary.main, e.palette.action.selectedOpacity),
627
- "&:hover": {
628
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))` : ye(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.hoverOpacity),
629
- "@media (hover: none)": { backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : ye(e.palette.primary.main, e.palette.action.selectedOpacity) }
630
- },
631
- [`&.${$.focused}`]: { backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))` : ye(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.focusOpacity) }
632
- },
633
- [`& .${$.iconContainer}`]: {
634
- marginRight: 4,
635
- width: 15,
636
- display: "flex",
637
- flexShrink: 0,
638
- justifyContent: "center",
639
- "& svg": { fontSize: 18 }
640
- },
641
- [`& .${$.label}`]: A({
642
- paddingLeft: 4,
643
- width: "100%",
644
- boxSizing: "border-box",
645
- minWidth: 0,
646
- position: "relative"
647
- }, e.typography.body1)
648
- })), mt = K(Fe, {
649
- name: "MuiTreeItem",
650
- slot: "Group",
651
- overridesResolver: (e, t) => t.group
652
- })({
653
- margin: 0,
654
- padding: 0,
655
- marginLeft: 17
656
- }), ht = /*#__PURE__*/ X.forwardRef(function(e, t) {
657
- let n = Oe({
658
- props: e,
659
- name: "MuiTreeItem"
660
- }), { children: r, className: i, collapseIcon: a, ContentComponent: o = ct, ContentProps: s, endIcon: c, expandIcon: l, disabled: u, icon: d, id: f, label: p, nodeId: h, onClick: g, onMouseDown: _, TransitionComponent: v = Fe, TransitionProps: y } = n, b = m(n, ut), { icons: x, multiSelect: S, disabledItemsFocusable: C, treeId: w, instance: T } = at(), E;
661
- f == null ? w && h && (E = `${w}-${h}`) : E = f;
662
- let [D, O] = X.useState(null), k = X.useRef(null), j = be(O, t), { index: M, parentId: N } = tt(X.useMemo(() => ({
663
- element: D,
664
- id: h
665
- }), [h, D])), P = !!(Array.isArray(r) ? r.length : r), F = T ? T.isNodeExpanded(h) : !1, I = T ? T.isNodeFocused(h) : !1, L = T ? T.isNodeSelected(h) : !1, R = T ? T.isNodeDisabled(h) : !1, z = A({}, n, {
666
- expanded: F,
667
- focused: I,
668
- selected: L,
669
- disabled: R
670
- }), B = dt(z), V, H;
671
- P && (H = F ? a || x.defaultCollapseIcon : l || x.defaultExpandIcon), V = P ? x.defaultParentIcon : c || x.defaultEndIcon, X.useEffect(() => {
672
- if (T && M !== -1) return T.updateNode({
673
- id: h,
674
- idAttribute: E,
675
- index: M,
676
- parentId: N,
677
- expandable: P,
678
- disabled: u
679
- }), () => T.removeNode(h);
680
- }, [
681
- T,
682
- N,
683
- M,
684
- h,
685
- P,
686
- u,
687
- E
688
- ]), X.useEffect(() => {
689
- if (T && p) return T.mapFirstChar(h, (k.current?.textContent ?? "").substring(0, 1).toLowerCase());
690
- }, [
691
- T,
692
- h,
693
- p
694
- ]);
695
- let U;
696
- S ? U = L : L && (U = !0);
697
- function ee(e) {
698
- if (e.target === e.currentTarget) {
699
- let t;
700
- t = typeof e.target.getRootNode == "function" ? e.target.getRootNode() : xe(e.target), t.getElementById(w).focus({ preventScroll: !0 });
701
- }
702
- let t = !C && R;
703
- T && !I && e.currentTarget === e.target && !t && T.focusNode(e, h);
704
- }
705
- return /*#__PURE__*/ (0, Z.jsxs)(ft, A({
706
- className: G(B.root, i),
707
- role: "treeitem",
708
- "aria-expanded": P ? F : void 0,
709
- "aria-selected": U,
710
- "aria-disabled": R || void 0,
711
- id: E,
712
- tabIndex: -1
713
- }, b, {
714
- ownerState: z,
715
- onFocus: ee,
716
- ref: j,
717
- children: [/*#__PURE__*/ (0, Z.jsx)(pt, A({
718
- as: o,
719
- ref: k,
720
- classes: {
721
- root: B.content,
722
- expanded: B.expanded,
723
- selected: B.selected,
724
- focused: B.focused,
725
- disabled: B.disabled,
726
- iconContainer: B.iconContainer,
727
- label: B.label
728
- },
729
- label: p,
730
- nodeId: h,
731
- onClick: g,
732
- onMouseDown: _,
733
- icon: d,
734
- expansionIcon: H,
735
- displayIcon: V,
736
- ownerState: z
737
- }, s)), r && /*#__PURE__*/ (0, Z.jsx)(nt, {
738
- id: h,
739
- children: /*#__PURE__*/ (0, Z.jsx)(mt, A({
740
- as: v,
741
- unmountOnExit: !0,
742
- className: B.group,
743
- in: F,
744
- component: "ul",
745
- role: "group"
746
- }, y, { children: r }))
747
- })]
748
- }));
749
- });
750
- function gt(e) {
751
- return ve("MuiTreeView", e);
752
- }
753
- ge("MuiTreeView", ["root"]), L();
754
- var _t = (e, t) => {
755
- let n = X.useRef({}), [r, i] = X.useState(() => {
756
- let r = {};
757
- return e.forEach((e) => {
758
- e.models && Object.entries(e.models).forEach(([e, i]) => {
759
- n.current[e] = {
760
- controlledProp: i.controlledProp,
761
- defaultProp: i.defaultProp,
762
- isControlled: t[i.controlledProp] !== void 0
763
- }, r[e] = t[i.defaultProp];
764
- });
765
- }), r;
766
- });
767
- return Object.fromEntries(Object.entries(n.current).map(([e, n]) => [e, {
768
- value: n.isControlled ? t[n.controlledProp] : r[e],
769
- setValue: (t) => {
770
- n.isControlled || i((n) => A({}, n, { [e]: t }));
771
- }
772
- }]));
773
- }, vt = class {
774
- constructor() {
775
- this.maxListeners = 20, this.warnOnce = !1, this.events = {};
776
- }
777
- on(e, t, n = {}) {
778
- let r = this.events[e];
779
- r || (r = {
780
- highPriority: /* @__PURE__ */ new Map(),
781
- regular: /* @__PURE__ */ new Map()
782
- }, this.events[e] = r), n.isFirst ? r.highPriority.set(t, !0) : r.regular.set(t, !0);
783
- }
784
- removeListener(e, t) {
785
- this.events[e] && (this.events[e].regular.delete(t), this.events[e].highPriority.delete(t));
786
- }
787
- removeAllListeners() {
788
- this.events = {};
789
- }
790
- emit(e, ...t) {
791
- let n = this.events[e];
792
- if (!n) return;
793
- let r = Array.from(n.highPriority.keys()), i = Array.from(n.regular.keys());
794
- for (let e = r.length - 1; e >= 0; --e) {
795
- let i = r[e];
796
- n.highPriority.has(i) && i.apply(this, t);
797
- }
798
- for (let e = 0; e < i.length; e += 1) {
799
- let r = i[e];
800
- n.regular.has(r) && r.apply(this, t);
801
- }
802
- }
803
- once(e, t) {
804
- let n = this;
805
- this.on(e, function r(...i) {
806
- n.removeListener(e, r), t.apply(n, i);
807
- });
808
- }
809
- }, yt = (e, t) => {
810
- let n = e.getNode(t), r = e.getNavigableChildrenIds(n.parentId), i = r.indexOf(t);
811
- if (i === 0) return n.parentId;
812
- let a = r[i - 1];
813
- for (; e.isNodeExpanded(a) && e.getNavigableChildrenIds(a).length > 0;) a = e.getNavigableChildrenIds(a).pop();
814
- return a;
815
- }, bt = (e, t) => {
816
- if (e.isNodeExpanded(t) && e.getNavigableChildrenIds(t).length > 0) return e.getNavigableChildrenIds(t)[0];
817
- let n = e.getNode(t);
818
- for (; n != null;) {
819
- let t = e.getNavigableChildrenIds(n.parentId), r = t[t.indexOf(n.id) + 1];
820
- if (r) return r;
821
- n = e.getNode(n.parentId);
822
- }
823
- return null;
824
- }, xt = (e) => {
825
- let t = e.getNavigableChildrenIds(null).pop();
826
- for (; e.isNodeExpanded(t);) t = e.getNavigableChildrenIds(t).pop();
827
- return t;
828
- }, St = (e) => e.getNavigableChildrenIds(null)[0], Ct = (e, t) => {
829
- Object.assign(e, t);
830
- }, wt = (e) => e.isPropagationStopped !== void 0, Tt = [({ instance: e }) => {
831
- let [t] = X.useState(() => new vt());
832
- Ct(e, {
833
- $$publishEvent: X.useCallback((...e) => {
834
- let [n, r, i = {}] = e;
835
- i.defaultMuiPrevented = !1, !(wt(i) && i.isPropagationStopped()) && t.emit(n, r, i);
836
- }, [t]),
837
- $$subscribeEvent: X.useCallback((e, n) => (t.on(e, n), () => {
838
- t.removeListener(e, n);
839
- }), [t])
840
- });
841
- }];
842
- L();
843
- var Et = (e) => {
844
- let t = [...Tt, ...e.plugins], n = t.reduce((e, t) => t.getDefaultizedParams ? t.getDefaultizedParams(e) : e, e), r = _t(t, n), i = X.useRef({}).current, a = X.useRef(null), o = be(a, e.rootRef), [s, c] = X.useState(() => {
845
- let e = {};
846
- return t.forEach((t) => {
847
- t.getInitialState && Object.assign(e, t.getInitialState(n));
848
- }), e;
849
- }), l = [], u = rt;
850
- return t.forEach((e) => {
851
- let t = e({
852
- instance: i,
853
- params: n,
854
- state: s,
855
- setState: c,
856
- rootRef: a,
857
- models: r
858
- }) || {};
859
- t.getRootProps && l.push(t.getRootProps), t.contextValue && (u = t.contextValue);
860
- }), {
861
- getRootProps: (e = {}) => {
862
- let t = A({
863
- role: "tree",
864
- tabIndex: 0
865
- }, e, { ref: o });
866
- return l.forEach((n) => {
867
- Object.assign(t, n(e));
868
- }), t;
869
- },
870
- rootRef: o,
871
- contextValue: u
872
- };
873
- };
874
- function Dt(e) {
875
- let { value: t, children: n } = e;
876
- return /*#__PURE__*/ (0, Z.jsx)(it.Provider, {
877
- value: t,
878
- children: /*#__PURE__*/ (0, Z.jsx)(nt, { children: n })
879
- });
880
- }
881
- var Ot = (e, t, n) => {
882
- e.$$publishEvent(t, n);
883
- };
884
- L();
885
- var kt = ({ instance: e, params: t }) => {
886
- let n = X.useRef({}), r = X.useCallback((e) => n.current[e], []), i = X.useCallback((e) => {
887
- n.current[e.id] = e;
888
- }, []), a = X.useCallback((t) => {
889
- let r = A({}, n.current);
890
- delete r[t], n.current = r, Ot(e, "removeNode", { id: t });
891
- }, [e]), o = X.useCallback((t) => {
892
- if (t == null) return !1;
893
- let n = e.getNode(t);
894
- if (!n) return !1;
895
- if (n.disabled) return !0;
896
- for (; n.parentId != null;) if (n = e.getNode(n.parentId), n.disabled) return !0;
897
- return !1;
898
- }, [e]);
899
- Ct(e, {
900
- getNode: r,
901
- updateNode: i,
902
- removeNode: a,
903
- getChildrenIds: q((e) => Object.values(n.current).filter((t) => t.parentId === e).sort((e, t) => e.index - t.index).map((e) => e.id)),
904
- getNavigableChildrenIds: (n) => {
905
- let r = e.getChildrenIds(n);
906
- return t.disabledItemsFocusable || (r = r.filter((t) => !e.isNodeDisabled(t))), r;
907
- },
908
- isNodeDisabled: o
909
- });
910
- };
911
- L();
912
- var At = ({ instance: e, params: t, models: n }) => {
913
- Ct(e, {
914
- isNodeExpanded: X.useCallback((e) => Array.isArray(n.expanded.value) ? n.expanded.value.indexOf(e) !== -1 : !1, [n.expanded.value]),
915
- isNodeExpandable: X.useCallback((t) => {
916
- var n;
917
- return !!((n = e.getNode(t)) != null && n.expandable);
918
- }, [e]),
919
- toggleNodeExpansion: q((e, r) => {
920
- if (r == null) return;
921
- let i;
922
- i = n.expanded.value.indexOf(r) === -1 ? [r].concat(n.expanded.value) : n.expanded.value.filter((e) => e !== r), t.onNodeToggle && t.onNodeToggle(e, i), n.expanded.setValue(i);
923
- }),
924
- expandAllSiblings: (r, i) => {
925
- let a = e.getNode(i), o = e.getChildrenIds(a.parentId).filter((t) => e.isNodeExpandable(t) && !e.isNodeExpanded(t)), s = n.expanded.value.concat(o);
926
- o.length > 0 && (n.expanded.setValue(s), t.onNodeToggle && t.onNodeToggle(r, s));
927
- }
928
- });
929
- };
930
- At.models = { expanded: {
931
- controlledProp: "expanded",
932
- defaultProp: "defaultExpanded"
933
- } };
934
- var jt = [];
935
- At.getDefaultizedParams = (e) => A({}, e, { defaultExpanded: e.defaultExpanded ?? jt });
936
- var Mt = (e, t, n) => {
937
- if (t === n) return [t, n];
938
- let r = e.getNode(t), i = e.getNode(n);
939
- if (r.parentId === i.id || i.parentId === r.id) return i.parentId === r.id ? [r.id, i.id] : [i.id, r.id];
940
- let a = [r.id], o = [i.id], s = r.parentId, c = i.parentId, l = o.indexOf(s) !== -1, u = a.indexOf(c) !== -1, d = !0, f = !0;
941
- for (; !u && !l;) d && (a.push(s), l = o.indexOf(s) !== -1, d = s !== null, !l && d && (s = e.getNode(s).parentId)), f && !l && (o.push(c), u = a.indexOf(c) !== -1, f = c !== null, !u && f && (c = e.getNode(c).parentId));
942
- let p = l ? s : c, m = e.getChildrenIds(p), h = a[a.indexOf(p) - 1], g = o[o.indexOf(p) - 1];
943
- return m.indexOf(h) < m.indexOf(g) ? [t, n] : [n, t];
944
- };
945
- L();
946
- var Nt = ({ instance: e, params: t, models: n }) => {
947
- let r = X.useRef(null), i = X.useRef(!1), a = X.useRef([]), o = (e) => Array.isArray(n.selected.value) ? n.selected.value.indexOf(e) !== -1 : n.selected.value === e, s = (e, o, s = !1) => {
948
- if (!t.disableSelection) {
949
- if (s) {
950
- if (Array.isArray(n.selected.value)) {
951
- let r;
952
- r = n.selected.value.indexOf(o) === -1 ? [o].concat(n.selected.value) : n.selected.value.filter((e) => e !== o), t.onNodeSelect && t.onNodeSelect(e, r), n.selected.setValue(r);
953
- }
954
- } else {
955
- let r = t.multiSelect ? [o] : o;
956
- t.onNodeSelect && t.onNodeSelect(e, r), n.selected.setValue(r);
957
- }
958
- r.current = o, i.current = !1, a.current = [];
959
- }
960
- }, c = (t, n) => {
961
- let [r, i] = Mt(e, t, n), a = [r], o = r;
962
- for (; o !== i;) o = bt(e, o), a.push(o);
963
- return a;
964
- }, l = (e, r) => {
965
- let o = n.selected.value.slice(), { start: s, next: c, current: l } = r;
966
- !c || !l || (a.current.indexOf(l) === -1 && (a.current = []), i.current ? a.current.indexOf(c) === -1 ? (o.push(c), a.current.push(c)) : (o = o.filter((e) => e === s || e !== l), a.current = a.current.filter((e) => e === s || e !== l)) : (o.push(c), a.current.push(l, c)), t.onNodeSelect && t.onNodeSelect(e, o), n.selected.setValue(o));
967
- }, u = (r, o) => {
968
- let s = n.selected.value.slice(), { start: l, end: u } = o;
969
- i.current && (s = s.filter((e) => a.current.indexOf(e) === -1));
970
- let d = c(l, u);
971
- d = d.filter((t) => !e.isNodeDisabled(t)), a.current = d;
972
- let f = s.concat(d);
973
- f = f.filter((e, t) => f.indexOf(e) === t), t.onNodeSelect && t.onNodeSelect(r, f), n.selected.setValue(f);
974
- };
975
- return Ct(e, {
976
- isNodeSelected: o,
977
- selectNode: s,
978
- selectRange: (e, n, a = !1) => {
979
- if (t.disableSelection) return;
980
- let { start: o = r.current, end: s, current: c } = n;
981
- a ? l(e, {
982
- start: o,
983
- next: s,
984
- current: c
985
- }) : o != null && s != null && u(e, {
986
- start: o,
987
- end: s
988
- }), i.current = !0;
989
- },
990
- rangeSelectToLast: (t, n) => {
991
- r.current ||= n;
992
- let a = i.current ? r.current : n;
993
- e.selectRange(t, {
994
- start: a,
995
- end: xt(e)
996
- });
997
- },
998
- rangeSelectToFirst: (t, n) => {
999
- r.current ||= n;
1000
- let a = i.current ? r.current : n;
1001
- e.selectRange(t, {
1002
- start: a,
1003
- end: St(e)
1004
- });
1005
- }
1006
- }), { getRootProps: () => ({ "aria-multiselectable": t.multiSelect }) };
1007
- };
1008
- Nt.models = { selected: {
1009
- controlledProp: "selected",
1010
- defaultProp: "defaultSelected"
1011
- } };
1012
- var Pt = [];
1013
- Nt.getDefaultizedParams = (e) => A({}, e, {
1014
- disableSelection: e.disableSelection ?? !1,
1015
- multiSelect: e.multiSelect ?? !1,
1016
- defaultSelected: e.defaultSelected ?? (e.multiSelect ? Pt : null)
1017
- });
1018
- var Ft = 1e3, It = class {
1019
- constructor(e = Ft) {
1020
- this.timeouts = /* @__PURE__ */ new Map(), this.cleanupTimeout = Ft, this.cleanupTimeout = e;
1021
- }
1022
- register(e, t, n) {
1023
- this.timeouts ||= /* @__PURE__ */ new Map();
1024
- let r = setTimeout(() => {
1025
- typeof t == "function" && t(), this.timeouts.delete(n.cleanupToken);
1026
- }, this.cleanupTimeout);
1027
- this.timeouts.set(n.cleanupToken, r);
1028
- }
1029
- unregister(e) {
1030
- let t = this.timeouts.get(e.cleanupToken);
1031
- t && (this.timeouts.delete(e.cleanupToken), clearTimeout(t));
1032
- }
1033
- reset() {
1034
- this.timeouts &&= (this.timeouts.forEach((e, t) => {
1035
- this.unregister({ cleanupToken: t });
1036
- }), void 0);
1037
- }
1038
- }, Lt = class {
1039
- constructor() {
1040
- this.registry = new FinalizationRegistry((e) => {
1041
- typeof e == "function" && e();
1042
- });
1043
- }
1044
- register(e, t, n) {
1045
- this.registry.register(e, t, n);
1046
- }
1047
- unregister(e) {
1048
- this.registry.unregister(e);
1049
- }
1050
- reset() {}
1051
- }, Rt = class {};
1052
- function zt(e) {
1053
- let t = 0;
1054
- return function(n, r, i) {
1055
- e.registry === null && (e.registry = typeof FinalizationRegistry < "u" ? new Lt() : new It());
1056
- let [a] = X.useState(new Rt()), o = X.useRef(null), s = X.useRef();
1057
- s.current = i;
1058
- let c = X.useRef(null);
1059
- !o.current && s.current ? (o.current = n.$$subscribeEvent(r, (e, t) => {
1060
- if (!t.defaultMuiPrevented) {
1061
- var n;
1062
- (n = s.current) == null || n.call(s, e, t);
1063
- }
1064
- }), t += 1, c.current = { cleanupToken: t }, e.registry.register(a, () => {
1065
- var e;
1066
- (e = o.current) == null || e.call(o), o.current = null, c.current = null;
1067
- }, c.current)) : !s.current && o.current && (o.current(), o.current = null, c.current &&= (e.registry.unregister(c.current), null)), X.useEffect(() => (!o.current && s.current && (o.current = n.$$subscribeEvent(r, (e, t) => {
1068
- if (!t.defaultMuiPrevented) {
1069
- var n;
1070
- (n = s.current) == null || n.call(s, e, t);
1071
- }
1072
- })), c.current && e.registry && (e.registry.unregister(c.current), c.current = null), () => {
1073
- var e;
1074
- (e = o.current) == null || e.call(o), o.current = null;
1075
- }), [n, r]);
1076
- };
1077
- }
1078
- var Bt = zt({ registry: null });
1079
- L();
1080
- var Vt = ({ instance: e, params: t, state: n, setState: r, models: i, rootRef: a }) => {
1081
- let o = q((e) => {
1082
- let t = typeof e == "function" ? e(n.focusedNodeId) : e;
1083
- r((e) => A({}, e, { focusedNodeId: t }));
1084
- });
1085
- Ct(e, {
1086
- isNodeFocused: X.useCallback((e) => n.focusedNodeId === e, [n.focusedNodeId]),
1087
- focusNode: q((e, n) => {
1088
- n && (o(n), t.onNodeFocus && t.onNodeFocus(e, n));
1089
- })
1090
- }), Bt(e, "removeNode", ({ id: t }) => {
1091
- o((n) => n === t && a.current === xe(a.current).activeElement ? e.getChildrenIds(null)[0] : n);
1092
- });
1093
- let s = (t) => (n) => {
1094
- var r;
1095
- if ((r = t.onFocus) == null || r.call(t, n), n.target === n.currentTarget) {
1096
- let t = (t) => {
1097
- let n = e.getNode(t);
1098
- return n && (n.parentId == null || e.isNodeExpanded(n.parentId));
1099
- }, r;
1100
- Array.isArray(i.selected.value) ? r = i.selected.value.find(t) : i.selected.value != null && t(i.selected.value) && (r = i.selected.value), r ??= e.getNavigableChildrenIds(null)[0], e.focusNode(n, r);
1101
- }
1102
- }, c = (e) => (t) => {
1103
- var n;
1104
- (n = e.onBlur) == null || n.call(e, t), o(null);
1105
- }, l = e.getNode(n.focusedNodeId), u = l ? l.idAttribute : null;
1106
- return { getRootProps: (e) => ({
1107
- onFocus: s(e),
1108
- onBlur: c(e),
1109
- "aria-activedescendant": u ?? void 0
1110
- }) };
1111
- };
1112
- Vt.getInitialState = () => ({ focusedNodeId: null }), Vt.getDefaultizedParams = (e) => A({}, e, { disabledItemsFocusable: e.disabledItemsFocusable ?? !1 }), L();
1113
- function Ht(e) {
1114
- return e && e.length === 1 && e.match(/\S/);
1115
- }
1116
- function Ut(e, t, n) {
1117
- for (let r = t; r < e.length; r += 1) if (n === e[r]) return r;
1118
- return -1;
1119
- }
1120
- var Wt = [
1121
- kt,
1122
- At,
1123
- Nt,
1124
- Vt,
1125
- ({ instance: e, params: t, state: n }) => {
1126
- let r = g().direction === "rtl", i = X.useRef({});
1127
- Ct(e, { mapFirstChar: q((e, t) => (i.current[e] = t, () => {
1128
- let t = A({}, i.current);
1129
- delete t[e], i.current = t;
1130
- })) });
1131
- let a = (t) => (n.focusedNodeId != null && e.isNodeExpandable(n.focusedNodeId) && (e.isNodeExpanded(n.focusedNodeId) ? e.focusNode(t, bt(e, n.focusedNodeId)) : e.isNodeDisabled(n.focusedNodeId) || e.toggleNodeExpansion(t, n.focusedNodeId)), !0), o = (t) => {
1132
- if (n.focusedNodeId == null) return !1;
1133
- if (e.isNodeExpanded(n.focusedNodeId) && !e.isNodeDisabled(n.focusedNodeId)) return e.toggleNodeExpansion(t, n.focusedNodeId), !0;
1134
- let r = e.getNode(n.focusedNodeId).parentId;
1135
- return r ? (e.focusNode(t, r), !0) : !1;
1136
- }, s = (n, r, a) => {
1137
- let o, s, c = a.toLowerCase(), l = [], u = [];
1138
- Object.keys(i.current).forEach((n) => {
1139
- let r = e.getNode(n), a = !r.parentId || e.isNodeExpanded(r.parentId), o = !t.disabledItemsFocusable && e.isNodeDisabled(n);
1140
- a && !o && (l.push(n), u.push(i.current[n]));
1141
- }), o = l.indexOf(r) + 1, o >= l.length && (o = 0), s = Ut(u, o, c), s === -1 && (s = Ut(u, 0, c)), s > -1 && e.focusNode(n, l[s]);
1142
- }, c = (t, n) => {
1143
- e.isNodeDisabled(bt(e, n)) || e.selectRange(t, {
1144
- end: bt(e, n),
1145
- current: n
1146
- }, !0);
1147
- }, l = (t, n) => {
1148
- e.isNodeDisabled(yt(e, n)) || e.selectRange(t, {
1149
- end: yt(e, n),
1150
- current: n
1151
- }, !0);
1152
- }, u = (i) => (u) => {
1153
- var d;
1154
- (d = i.onKeyDown) == null || d.call(i, u);
1155
- let f = !1, p = u.key;
1156
- if (u.altKey || u.currentTarget !== u.target || n.focusedNodeId == null) return;
1157
- let m = u.ctrlKey || u.metaKey;
1158
- switch (p) {
1159
- case " ":
1160
- !t.disableSelection && !e.isNodeDisabled(n.focusedNodeId) && (f = !0, t.multiSelect && u.shiftKey ? e.selectRange(u, { end: n.focusedNodeId }) : t.multiSelect ? e.selectNode(u, n.focusedNodeId, !0) : e.selectNode(u, n.focusedNodeId)), u.stopPropagation();
1161
- break;
1162
- case "Enter":
1163
- e.isNodeDisabled(n.focusedNodeId) || (e.isNodeExpandable(n.focusedNodeId) ? (e.toggleNodeExpansion(u, n.focusedNodeId), f = !0) : t.disableSelection || (f = !0, t.multiSelect ? e.selectNode(u, n.focusedNodeId, !0) : e.selectNode(u, n.focusedNodeId))), u.stopPropagation();
1164
- break;
1165
- case "ArrowDown":
1166
- t.multiSelect && u.shiftKey && !t.disableSelection && c(u, n.focusedNodeId), e.focusNode(u, bt(e, n.focusedNodeId)), f = !0;
1167
- break;
1168
- case "ArrowUp":
1169
- t.multiSelect && u.shiftKey && !t.disableSelection && l(u, n.focusedNodeId), e.focusNode(u, yt(e, n.focusedNodeId)), f = !0;
1170
- break;
1171
- case "ArrowRight":
1172
- f = r ? o(u) : a(u);
1173
- break;
1174
- case "ArrowLeft":
1175
- f = r ? a(u) : o(u);
1176
- break;
1177
- case "Home":
1178
- t.multiSelect && m && u.shiftKey && !t.disableSelection && !e.isNodeDisabled(n.focusedNodeId) && e.rangeSelectToFirst(u, n.focusedNodeId), e.focusNode(u, St(e)), f = !0;
1179
- break;
1180
- case "End":
1181
- t.multiSelect && m && u.shiftKey && !t.disableSelection && !e.isNodeDisabled(n.focusedNodeId) && e.rangeSelectToLast(u, n.focusedNodeId), e.focusNode(u, xt(e)), f = !0;
1182
- break;
1183
- default: p === "*" ? (e.expandAllSiblings(u, n.focusedNodeId), f = !0) : t.multiSelect && m && p.toLowerCase() === "a" && !t.disableSelection ? (e.selectRange(u, {
1184
- start: St(e),
1185
- end: xt(e)
1186
- }), f = !0) : !m && !u.shiftKey && Ht(p) && (s(u, n.focusedNodeId, p), f = !0);
1187
- }
1188
- f && (u.preventDefault(), u.stopPropagation());
1189
- };
1190
- return { getRootProps: (e) => ({ onKeyDown: u(e) }) };
1191
- },
1192
- ({ instance: e, params: t }) => {
1193
- let n = f(t.id);
1194
- return {
1195
- getRootProps: () => ({ id: n }),
1196
- contextValue: {
1197
- treeId: n,
1198
- instance: e,
1199
- multiSelect: t.multiSelect,
1200
- disabledItemsFocusable: t.disabledItemsFocusable,
1201
- icons: {
1202
- defaultCollapseIcon: t.defaultCollapseIcon,
1203
- defaultEndIcon: t.defaultEndIcon,
1204
- defaultExpandIcon: t.defaultExpandIcon,
1205
- defaultParentIcon: t.defaultParentIcon
1206
- }
1207
- }
1208
- };
1209
- }
1210
- ];
1211
- L(), S();
1212
- var Gt = [
1213
- "disabledItemsFocusable",
1214
- "expanded",
1215
- "defaultExpanded",
1216
- "onNodeToggle",
1217
- "onNodeFocus",
1218
- "disableSelection",
1219
- "defaultSelected",
1220
- "selected",
1221
- "multiSelect",
1222
- "onNodeSelect",
1223
- "id",
1224
- "defaultCollapseIcon",
1225
- "defaultEndIcon",
1226
- "defaultExpandIcon",
1227
- "defaultParentIcon",
1228
- "children"
1229
- ], Kt = (e) => {
1230
- let { classes: t } = e;
1231
- return W({ root: ["root"] }, gt, t);
1232
- }, qt = K("ul", {
1233
- name: "MuiTreeView",
1234
- slot: "Root",
1235
- overridesResolver: (e, t) => t.root
1236
- })({
1237
- padding: 0,
1238
- margin: 0,
1239
- listStyle: "none",
1240
- outline: 0
1241
- }), Jt = /*#__PURE__*/ X.forwardRef(function(e, t) {
1242
- let n = Oe({
1243
- props: e,
1244
- name: "MuiTreeView"
1245
- }), r = n, i = n, { disabledItemsFocusable: a, expanded: o, defaultExpanded: s, onNodeToggle: c, onNodeFocus: l, disableSelection: u, defaultSelected: d, selected: f, multiSelect: p, onNodeSelect: h, id: g, defaultCollapseIcon: _, defaultEndIcon: v, defaultExpandIcon: y, defaultParentIcon: b, children: x } = i, S = m(i, Gt), { getRootProps: C, contextValue: w } = Et({
1246
- disabledItemsFocusable: a,
1247
- expanded: o,
1248
- defaultExpanded: s,
1249
- onNodeToggle: c,
1250
- onNodeFocus: l,
1251
- disableSelection: u,
1252
- defaultSelected: d,
1253
- selected: f,
1254
- multiSelect: p,
1255
- onNodeSelect: h,
1256
- id: g,
1257
- defaultCollapseIcon: _,
1258
- defaultEndIcon: v,
1259
- defaultExpandIcon: y,
1260
- defaultParentIcon: b,
1261
- plugins: Wt,
1262
- rootRef: t
1263
- }), T = Je({
1264
- elementType: qt,
1265
- externalSlotProps: {},
1266
- externalForwardedProps: S,
1267
- className: Kt(n).root,
1268
- getSlotProps: C,
1269
- ownerState: r
1270
- });
1271
- return /*#__PURE__*/ (0, Z.jsx)(Dt, {
1272
- value: w,
1273
- children: /*#__PURE__*/ (0, Z.jsx)(qt, A({}, T, { children: x }))
1274
- });
1275
- }), Yt = "5px", Xt = (e) => ({ "& > .MuiTreeItem-content": {
1276
- backgroundColor: `${e} !important`,
1277
- borderRadius: Yt
1278
- } }), Zt = (e, t) => ({
1279
- width: "100%",
1280
- minWidth: 0,
1281
- "& .MuiTreeItem-group": { paddingLeft: "5px" },
1282
- "& .MuiTreeItem-content": { minWidth: 0 },
1283
- "& .MuiTreeItem-content:hover": {
1284
- backgroundColor: `${e} !important`,
1285
- borderRadius: Yt
1286
- },
1287
- "& .MuiTreeItem-content:hover .MuiTreeItem-iconContainer:has(svg)": {
1288
- backgroundColor: e,
1289
- borderRadius: Yt
1290
- },
1291
- ...t && {
1292
- [Y.md]: { "& .MuiTreeItem-group": { paddingLeft: "4px" } },
1293
- [Y.sm]: {
1294
- "& .MuiTreeItem-group": { paddingLeft: "3px" },
1295
- "& .MuiTreeItem-iconContainer": {
1296
- width: "16px",
1297
- "& svg": {
1298
- width: "16px",
1299
- height: "16px"
1300
- }
1301
- }
1302
- },
1303
- [Y.xs]: {
1304
- "& .MuiTreeItem-group": { paddingLeft: "2px" },
1305
- "& .MuiTreeItem-iconContainer": {
1306
- width: "12px",
1307
- "& svg": {
1308
- width: "12px",
1309
- height: "12px"
1310
- }
1311
- }
1312
- }
1313
- }
1314
- }), Qt = (e, t, n) => {
1315
- let r = n[t] ?? [];
1316
- return [...e].sort(([, e], [, t]) => {
1317
- let n = Number(r.includes(t.value)) - Number(r.includes(e.value)), i = Number(e.disabled) - Number(t.disabled);
1318
- return n || i;
1319
- });
1320
- }, $t = ({ filterValues: e, filterDimensionsCount: t, searchTerm: n, isLoading: r = !1, isPreview: a, isFieldLocked: o, hoverColor: s, filterFontSize: l, filterFontColor: u, vSpec: d, dimensionSelectionMethods: f, selectionMode: p }) => {
1321
- let [m, h] = (0, X.useState)([]), g = j(f.map(({ field: e, fieldKey: t }) => e ?? { fieldKey: t })), _ = d.dimensions.filter((e) => e.role === c.FILTER_DIMENSION), v = d.dimensions.find((e) => e.role === c.FILTER_IMAGE) ?? (d.dimensions.every((e) => !e.role) ? d.dimensions[1] : void 0), y = e.reduce((e, t) => typeof t.measure1 == "number" ? e === null ? t.measure1 : Math.max(e, t.measure1) : e, null), b = (0, X.useMemo)(() => {
1322
- let t = /* @__PURE__ */ new Map();
1323
- return e.forEach(({ dimension: e, childDimension: n, dimensionValues: r, disabled: i, image: a, measure1: o, measure2: s }) => {
1324
- let c = r ?? [e, ...n === void 0 ? [] : [n]], l = c.length;
1325
- for (; l > 0 && c[l - 1] == null;) --l;
1326
- let u = t, d;
1327
- for (let e of c.slice(0, l)) {
1328
- let t = JSON.stringify(e), n = u.get(t) ?? {
1329
- value: e,
1330
- label: String(e),
1331
- disabled: !!i,
1332
- children: /* @__PURE__ */ new Map()
1333
- };
1334
- n.disabled = n.disabled && !!i, u.set(t, n), d = n, u = n.children;
1335
- }
1336
- d && (o != null || s != null) && (d.measure1 = o, d.measure2 = s), d && a && (d.image = a);
1337
- }), Array.from(t.entries());
1338
- }, [e]), S = (0, X.useMemo)(() => {
1339
- let e = /* @__PURE__ */ new Map(), t = (e) => `tree-${encodeURIComponent(JSON.stringify(e))}`, n = (r, i) => {
1340
- let a = t(i);
1341
- e.set(a, r), Array.from(r.children.entries()).forEach(([e, t]) => {
1342
- n(t, [...i, e]);
1343
- });
1344
- };
1345
- return b.forEach(([e, t]) => n(t, [e])), e;
1346
- }, [b]);
1347
- (0, X.useEffect)(() => {
1348
- !n || r || h(Array.from(S.entries()).filter(([, e]) => e.children.size > 0).map(([e]) => e));
1349
- }, [
1350
- r,
1351
- n,
1352
- S
1353
- ]), (0, X.useEffect)(() => {
1354
- n || h([]);
1355
- }, [n]);
1356
- let C = (e, t) => {
1357
- h(t);
1358
- }, w = f.map((e) => e?.state.pending ?? e?.state.applied ?? []), E = f.map((e) => e?.state.applied ?? []), D = (e, n, r, a = w) => {
1359
- if (p === i.AllLevels && r.some((e, t) => {
1360
- let n = a[t] ?? [];
1361
- return (f[t]?.operators.pending ?? f[t]?.operators.applied) !== Q.FilterOperator.NotInList && n.length > 0 && !n.includes(e.value);
1362
- })) return "none";
1363
- if (n === t - 1) return a[n]?.includes(e.value) ? "full" : "none";
1364
- let o = Array.from(e.children.values()).map((t) => D(t, n + 1, [...r, e], a));
1365
- return o.length > 0 && o.every((e) => e === "full") ? "full" : o.some((e) => e !== "none") ? "partial" : "none";
1366
- }, O = (e) => e.some((e, t) => {
1367
- let n = E[t] ?? [];
1368
- return f[t]?.operators.applied !== Q.FilterOperator.NotInList && n.length > 0 && !n.includes(e.value);
1369
- }), k = (e, r, c, u) => {
1370
- let m = `tree-${encodeURIComponent(JSON.stringify(c))}`, h = r < t - 1 && !!_[r]?.expandOnly, x = Qt(Array.from(e.children.entries()), r + 1, E), S = x.length > 0, C = O(u), T = D(e, r, u), A = T !== "full", j = p === i.AllLevels, M = /* @__PURE__ */ new Map(), N = (e, t) => {
1371
- let n = M.get(t) ?? /* @__PURE__ */ new Set();
1372
- n.add(e), M.set(t, n);
1373
- };
1374
- j && A && u.forEach((e, t) => {
1375
- _[t]?.expandOnly || N(e.value, t);
1376
- });
1377
- let P = (e, n) => {
1378
- if (e.disabled) return !1;
1379
- let r = n === t - 1, i = !r && Array.from(e.children.values()).map((e) => P(e, n + 1)).some(Boolean);
1380
- return !r && !i ? !1 : ((r || j && !_[n]?.expandOnly) && N(e.value, n), !0);
1381
- }, F = P(e, r), I = A && Array.from(M).some(([e, t]) => g[e] && t.size > 1), L = !F || e.disabled || C || o || !!a || I, R = (!F || e.disabled || C) && !S || o || !!a;
1382
- return /* @__PURE__ */ (0, Z.jsx)(ht, {
1383
- nodeId: m,
1384
- disabled: R,
1385
- sx: T === "full" ? Xt(s) : void 0,
1386
- "data-testid": `${e.label}-tree-item`,
1387
- label: /* @__PURE__ */ (0, Z.jsx)(he, {
1388
- selected: T === "full",
1389
- applied: !1,
1390
- disabled: L,
1391
- hoverColor: s,
1392
- onSelect: h ? void 0 : (e) => {
1393
- if (e.stopPropagation(), !L) {
1394
- if (j && !A) {
1395
- let e = w.map((e, t) => g[t] ? e : e.filter((e) => !M.get(t)?.has(e))), n = /* @__PURE__ */ new Map(), r = (i, a, o) => {
1396
- if (a === t - 1) {
1397
- D(i, a, o, e) === "full" && o.forEach((e, t) => {
1398
- let r = n.get(t) ?? /* @__PURE__ */ new Set();
1399
- r.add(e.value), n.set(t, r);
1400
- });
1401
- return;
1402
- }
1403
- i.children.forEach((e) => r(e, a + 1, [...o, i]));
1404
- };
1405
- b.forEach(([, e]) => r(e, 0, [])), u.forEach((e, t) => {
1406
- !_[t]?.expandOnly && !n.get(t)?.has(e.value) && N(e.value, t);
1407
- });
1408
- }
1409
- M.forEach((e, t) => {
1410
- if (!A && g[t]) return;
1411
- let n = w[t] ?? [], r = Array.from(e).filter((e) => n.includes(e) !== A);
1412
- r.length && f[t]?.onClickValues(r, {
1413
- on: A,
1414
- off: !A
1415
- });
1416
- });
1417
- }
1418
- },
1419
- showProgressBar: d.filterSettings?.showProgressBar,
1420
- showCheckbox: !h,
1421
- showSelectionIcon: !h,
1422
- checkboxState: T,
1423
- dimensionValue: e.value,
1424
- dimensionFormatter: _[r]?.formatter,
1425
- measure1Value: e.measure1,
1426
- measure1Label: d.measures[0]?.filterValueLabel,
1427
- measure1Formatter: d.measures[0]?.formatter,
1428
- measure2Value: e.measure2,
1429
- measure2Label: d.measures[1]?.filterValueLabel,
1430
- measure2Formatter: d.measures[1]?.formatter,
1431
- maxValue: y,
1432
- imageValue: e.image,
1433
- imageFit: v?.imageFit,
1434
- searchTerm: n,
1435
- fontStyle: d.filterSettings?.fontStyle,
1436
- fontSize: l,
1437
- progressBarColor: d.filterSettings?.filterStyle?.progressBarColor,
1438
- responsive: d?.filterSettings?.responsive
1439
- }),
1440
- children: x.map(([t, n]) => k(n, r + 1, [...c, t], [...u, e]))
1441
- }, m);
1442
- };
1443
- return /* @__PURE__ */ (0, Z.jsx)(Jt, {
1444
- "aria-label": "Filter values",
1445
- defaultCollapseIcon: /* @__PURE__ */ (0, Z.jsx)(x, {
1446
- size: l,
1447
- fill: u,
1448
- "data-testid": "collapse-icon"
1449
- }),
1450
- defaultExpandIcon: /* @__PURE__ */ (0, Z.jsx)(T, {
1451
- size: l,
1452
- fill: u,
1453
- "data-testid": "expand-icon"
1454
- }),
1455
- sx: Zt(s, d?.filterSettings?.responsive),
1456
- expanded: m,
1457
- selected: null,
1458
- onNodeToggle: C,
1459
- children: Qt(b, 0, E).map(([e, t]) => k(t, 0, [e], []))
1460
- });
1461
- }, en = {
1462
- borderBottom: `1px solid ${r.grey5}`,
1463
- margin: "0 12px",
1464
- width: "calc(100% - 24px)"
1465
- }, tn = {
1466
- flexGrow: 1,
1467
- borderRadius: 0,
1468
- height: 28,
1469
- boxShadow: "0 3px 6px rgba(0, 0, 0, 0.2)",
1470
- clipPath: "inset(0 0 -10px 0)",
1471
- transform: "translateY(-3px)"
1472
- }, nn = {
1473
- position: "absolute",
1474
- inset: 0,
1475
- display: "flex",
1476
- justifyContent: "center",
1477
- alignItems: "flex-end",
1478
- pointerEvents: "auto",
1479
- zIndex: 2
1480
- }, rn = ({ vSpec: e, vTheme: t, filterValues: i, isPreview: o = !1, loadMoreData: s, searchTerm: l, setSearchTerm: f, allValuesLoaded: p, isSearching: m = !1, isApplyingFilters: h = !1 }) => {
1481
- let g = t ?? d, _ = D(), [v, b] = (0, X.useState)(l), x = !!e.filterSettings?.defaultNotState, S = e.filterSettings?.selectionMode ?? u.selectionMode, [C, w] = (0, X.useState)(x), [T, E] = oe(e), k = (0, X.useMemo)(() => (0, Le.default)((e) => f(e), 300), [f]), A = i.reduce((e, t) => (t.disabled || e.push(t.dimension), e), []), j = e.dimensions.filter((e) => e.role === c.FILTER_DIMENSION), P = j[0] ?? e.dimensions[0], F = j.length > 1, L = o ? [] : j.length > 0 ? j.map((e, t) => ({
1482
- dataItem: e.dataItem,
1483
- dateLevel: e.dateLevel ?? void 0,
1484
- datePart: e.datePart ?? void 0,
1485
- values: i.map((e) => e.dimensionValues ? e.dimensionValues[t] : [e.dimension, e.childDimension][t]).filter((e) => e !== void 0)
1486
- })) : [{
1487
- dataItem: P?.dataItem,
1488
- dateLevel: P?.dateLevel ?? void 0,
1489
- datePart: P?.datePart ?? void 0,
1490
- values: A
1491
- }], { hasImage: R, hasMeasure: z, searchEnabled: B, quickSelection: V } = Ie(e), H = e.filterSettings?.filterStyle, { backgroundColor: te, ...ne } = H ?? {}, se = H && {
1492
- ...ne,
1493
- ..."backgroundColor" in H ? { backgroundColor: te ?? void 0 } : {}
1494
- }, ce = e.filterSettings?.filterStyle?.backgroundColor ?? n.backgroundColor, de = e.filterSettings?.fontStyle?.fontSize ?? n.fontSize, he = a(g, e.filterSettings?.fontStyle?.fontColor), W = ee({
1495
- ...U,
1496
- "--background-color": ce
1497
- })["--background-color-hover"] ?? r.grey3, G = I(L, {
1498
- disabled: o,
1499
- state: V ? Q.SelectionState.APPLIED : void 0,
1500
- defaultOperator: C ? Q.FilterOperator.NotInList : Q.FilterOperator.InList,
1501
- commitHistory: V
1502
- }), { onClear: ge, onClick: K, onDeselectAll: _e, onSelectExcluded: ve, onNotOperatorChange: ye, onSelectAll: be, field: xe, state: q, operators: Se } = G[0] ?? O, { isFieldLocked: J = !1, toggleFieldLock: Ce } = M(xe ?? void 0), we = q.pending ?? q.applied ?? [], Te = N(xe ? [xe] : []);
1503
- (0, X.useEffect)(() => {
1504
- let e = Se.pending ?? Se.applied;
1505
- if (e) {
1506
- w(e === Q.FilterOperator.NotInList);
1507
- return;
1508
- }
1509
- w(x);
1510
- }, [x, Se]);
1511
- let Ee = (0, X.useCallback)(() => {
1512
- w((e) => !e), ye();
1513
- }, [w, ye]);
1514
- function Y() {
1515
- p ? be() : _.daedalus.emitEvent(Q.AstratoEvents.SHOW_GLOBAL_NOTIFICATION, {
1516
- type: "warn",
1517
- message: "Cannot select values, because not all of them are loaded!"
1518
- });
1519
- }
1520
- let Oe = J || h && !F || m, ke = (0, X.useRef)(null);
1521
- (0, X.useEffect)(() => {
1522
- ke.current?.toggleAttribute("inert", Oe);
1523
- }, [Oe]);
1524
- let Ae = (0, X.useMemo)(() => J ? i.filter((e) => (q.pending ?? q.applied ?? []).includes(e.dimension)) : i, [
1525
- i,
1526
- J,
1527
- q.pending,
1528
- q.applied
1529
- ]);
1530
- return /* @__PURE__ */ (0, Z.jsx)("div", {
1531
- style: {
1532
- position: "relative",
1533
- height: "100%"
1534
- },
1535
- children: /* @__PURE__ */ (0, Z.jsx)(me, {
1536
- blurBackground: !0,
1537
- filterStyle: se,
1538
- fontSize: e.filterSettings?.fontStyle?.fontSize ?? n.fontSize,
1539
- children: /* @__PURE__ */ (0, Z.jsxs)(ae.Provider, {
1540
- value: {
1541
- appliedOperator: Se.applied,
1542
- pendingOperator: Se.pending
1543
- },
1544
- children: [
1545
- /* @__PURE__ */ (0, Z.jsx)(fe, {
1546
- measureTitle: E ?? "",
1547
- dimensionTitle: T,
1548
- searchEnabled: B && !o,
1549
- searchTerm: v,
1550
- onSearchChange: (e) => {
1551
- b(e), k(e);
1552
- },
1553
- onApplySearched: Y,
1554
- fontStyle: e.filterSettings?.fontStyle ?? {},
1555
- vTheme: g,
1556
- isNotEnabled: C,
1557
- responsive: e?.filterSettings?.responsive,
1558
- isLocked: J,
1559
- children: V ? null : /* @__PURE__ */ (0, Z.jsx)(ze, {
1560
- isPreview: o,
1561
- responsive: e?.filterSettings?.responsive,
1562
- areSelectedValues: we.length > 0,
1563
- arePendingValues: !!q.pending,
1564
- onClear: ge,
1565
- onDeselectAll: _e,
1566
- onSelectExcluded: ve,
1567
- onSelectAll: be,
1568
- toggleNotOperator: Ee,
1569
- onLockClick: Ce,
1570
- isNotEnabled: C,
1571
- isSingleSelectField: Te
1572
- })
1573
- }),
1574
- m ? /* @__PURE__ */ (0, Z.jsx)(re, { loading: !0 }) : /* @__PURE__ */ (0, Z.jsx)("div", { style: en }),
1575
- /* @__PURE__ */ (0, Z.jsx)("div", {
1576
- ref: ke,
1577
- style: {
1578
- height: "100%",
1579
- opacity: Oe ? .5 : 1,
1580
- pointerEvents: Oe ? "none" : void 0,
1581
- transition: "opacity 0.15s ease"
1582
- },
1583
- children: /* @__PURE__ */ (0, Z.jsxs)(ue, {
1584
- loadMoreData: s,
1585
- responsive: e?.filterSettings?.responsive,
1586
- children: [p && Ae.length === 0 && !m && !h ? /* @__PURE__ */ (0, Z.jsx)(ie, {
1587
- responsive: e?.filterSettings?.responsive,
1588
- applied: !1,
1589
- disabled: !1,
1590
- selected: !1,
1591
- hoverColor: W,
1592
- fontStyle: e.filterSettings?.fontStyle,
1593
- dimensionValue: "No results to display."
1594
- }) : null, F ? /* @__PURE__ */ (0, Z.jsx)($t, {
1595
- filterValues: Ae,
1596
- filterDimensionsCount: j.length,
1597
- searchTerm: l,
1598
- isLoading: m || h,
1599
- isPreview: o,
1600
- isFieldLocked: J,
1601
- hoverColor: W,
1602
- filterFontSize: de,
1603
- filterFontColor: he,
1604
- vSpec: e,
1605
- dimensionSelectionMethods: G,
1606
- selectionMode: S
1607
- }) : R || z ? /* @__PURE__ */ (0, Z.jsx)(le, {
1608
- vSpec: e,
1609
- filterValues: Ae,
1610
- hoverColor: W,
1611
- onItemClick: K,
1612
- selectedValues: we,
1613
- appliedValues: q.applied ?? [],
1614
- searchTerm: l
1615
- }) : /* @__PURE__ */ (0, Z.jsx)(pe, {
1616
- vSpec: e,
1617
- filterValues: Ae,
1618
- hoverColor: W,
1619
- onItemClick: K,
1620
- selectedValues: we,
1621
- appliedValues: q.applied ?? [],
1622
- searchTerm: l
1623
- })]
1624
- })
1625
- }),
1626
- J && /* @__PURE__ */ (0, Z.jsx)("div", {
1627
- style: nn,
1628
- children: /* @__PURE__ */ (0, Z.jsx)(De, {
1629
- color: "secondary",
1630
- style: tn,
1631
- onClick: () => Ce(),
1632
- children: /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)(y, { fill: "white" }), "Unlock"] })
1633
- })
1634
- })
1635
- ]
1636
- })
1637
- })
1638
- });
1639
- };
1640
- function an(e) {
1641
- let { quickSelection: t, isPreview: n, areSelectedValues: r, state: i, responsive: a, isSingleSelectField: o = !1, onClear: s, onDeselectAll: c, onSelectAll: l, onSelectExcluded: u, onNotOperatorChange: d, onLockClick: f } = e, [p, m] = (0, X.useState)(!1), h = Re({ responsive: a }), { appliedOperator: g, pendingOperator: _ } = (0, X.useContext)(ae), v = g ?? _ ?? Q.FilterOperator.InList, y = D().daedalus.getWorkbookProperties()?.isLockUnlockFieldsEnabled ?? !1;
1642
- if (t) return null;
1643
- let b = [{
1644
- disabled: n || !i.pending,
1645
- key: "clear",
1646
- label: "Clear",
1647
- type: "option",
1648
- onClick: s
1649
- }];
1650
- return o || b.push({
1651
- key: "divider",
1652
- type: "divider"
1653
- }, {
1654
- disabled: n || !r,
1655
- key: "deselect-all",
1656
- label: "Deselect all",
1657
- type: "option",
1658
- onClick: c
1659
- }, {
1660
- disabled: n,
1661
- key: "select-all",
1662
- label: v === Q.FilterOperator.InList ? "Select all" : "Exclude all",
1663
- type: "option",
1664
- onClick: l
1665
- }, {
1666
- disabled: n,
1667
- key: "invert",
1668
- label: "Invert",
1669
- type: "option",
1670
- onClick: u
1671
- }, {
1672
- disabled: n,
1673
- key: "not",
1674
- label: "Exclude",
1675
- type: "option",
1676
- onClick: d
1677
- }), y && b.push({
1678
- key: "divider",
1679
- type: "divider"
1680
- }, {
1681
- key: "lock",
1682
- label: "Lock",
1683
- type: "option",
1684
- icon: { right: /* @__PURE__ */ (0, Z.jsx)(R, {}) },
1685
- onClick: f
1686
- }), /* @__PURE__ */ (0, Z.jsx)(we, {
1687
- open: p,
1688
- placement: "bottom-end",
1689
- title: /* @__PURE__ */ (0, Z.jsx)(B, {
1690
- onClickAway: () => m(!1),
1691
- children: /* @__PURE__ */ (0, Z.jsx)(V, {
1692
- appearance: "legacy",
1693
- onClose: () => m(!1),
1694
- options: b,
1695
- responsive: a,
1696
- style: { margin: "-8px -12px" }
1697
- })
1698
- }),
1699
- children: /* @__PURE__ */ (0, Z.jsx)(H, {
1700
- onClick: () => m(!p),
1701
- className: h.menuTrigger,
1702
- children: /* @__PURE__ */ (0, Z.jsx)(w, {
1703
- fill: "currentColor",
1704
- size: 20
1705
- })
1706
- })
1707
- });
1708
- }
1709
- var on = C({
1710
- searchWrapper: (e) => ({
1711
- alignItems: "center",
1712
- display: "flex",
1713
- flexDirection: "row",
1714
- gap: 4,
1715
- justifyContent: "space-between",
1716
- padding: "8px 8px 8px 12px",
1717
- position: "relative",
1718
- width: "100%",
1719
- ...e && {
1720
- [Y.md]: { padding: "6px 6px 6px 10px" },
1721
- [Y.sm]: { padding: "4px 4px 4px 8px" },
1722
- [Y.xs]: { padding: "2px 2px 2px 4px" }
1723
- }
1724
- }),
1725
- searchWrapperSearch: { flexGrow: 1 },
1726
- tooltip: (e) => ({
1727
- "& .MuiTooltip-tooltip": {
1728
- padding: 0,
1729
- margin: 0,
1730
- backgroundColor: "transparent"
1731
- },
1732
- ...cn("bottom", e),
1733
- ...cn("top", e)
1734
- }),
1735
- unlockButtonStyles: {
1736
- width: "100%",
1737
- height: 28,
1738
- boxShadow: "0 3px 6px rgba(0, 0, 0, 0.2)",
1739
- clipPath: "inset(0 0 -10px 0)",
1740
- transform: "translateY(-3px)"
1741
- }
1742
- });
1743
- function sn(e) {
1744
- let { children: t, isOpen: i, setIsOpen: a, isPreview: o, vSpec: s, vTheme: c, onSearchChange: l, setLocalSearch: u, allValuesLoaded: d, onSelectAll: f, localSearch: p, searchTerm: m, loadMoreData: h, headerElement: g, filterValues: _, hierarchicalMode: v, filterDimensionsCount: b, dimensionSelectionMethods: x, selectionMode: S, onNotOperatorChange: C, onClick: w, onDeselectAll: T, onClear: E, onSelectExcluded: O, state: k, onLockClick: A, isLocked: j, isSingleSelectField: M = !1, isSearching: N = !1, isApplyingFilters: P = !1 } = e, F = D(), I = on(s?.filterSettings?.responsive), L = P || N, R = (0, X.useRef)(null);
1745
- (0, X.useEffect)(() => {
1746
- R.current?.toggleAttribute("inert", L);
1747
- }, [L]);
1748
- let { quickSelection: z, hasMeasure: V, hasImage: H, searchEnabled: ne } = Ie(s), ae = k.pending ?? k.applied ?? [], oe = s.filterSettings?.filterStyle, ce;
1749
- if (oe) {
1750
- let { backgroundColor: e, ...t } = oe;
1751
- ce = {
1752
- ...t,
1753
- ..."backgroundColor" in oe ? { backgroundColor: e ?? void 0 } : {}
1754
- };
1755
- }
1756
- let fe = s.filterSettings?.filterStyle?.borderRadius ?? n.borderRadius, me = s.filterSettings?.fontStyle?.fontColor ?? c?.fonts?.general?.color ?? r.mainDarkNavy, he = s.filterSettings?.filterStyle?.backgroundColor ?? n.backgroundColor, W = ee({
1757
- ...U,
1758
- "--background-color": he
1759
- })["--background-color-hover"] ?? r.grey3;
1760
- function G(e) {
1761
- switch (e.key) {
1762
- case "Enter":
1763
- d ? f() : F.daedalus.emitEvent(Q.AstratoEvents.SHOW_GLOBAL_NOTIFICATION, {
1764
- type: "warn",
1765
- message: "Cannot select values, because not all of them are loaded!"
1766
- });
1767
- break;
1768
- case "Escape":
1769
- v ? l("") : u("");
1770
- break;
1771
- }
1772
- }
1773
- return /* @__PURE__ */ (0, Z.jsx)(we, {
1774
- placement: "bottom-start",
1775
- arrow: !1,
1776
- open: i,
1777
- classes: { popper: I.tooltip },
1778
- slotProps: { popper: { anchorEl: g?.current?.firstElementChild } },
1779
- title: /* @__PURE__ */ (0, Z.jsx)(B, {
1780
- onClickAway: () => a(!1),
1781
- children: /* @__PURE__ */ (0, Z.jsx)("div", {
1782
- style: {
1783
- minWidth: g.current?.clientWidth,
1784
- maxWidth: "80vw",
1785
- fontSize: s.filterSettings?.fontStyle?.fontSize ?? n.fontSize
1786
- },
1787
- children: i && /* @__PURE__ */ (0, Z.jsxs)("div", {
1788
- style: { position: "relative" },
1789
- children: [/* @__PURE__ */ (0, Z.jsx)("div", {
1790
- style: {
1791
- filter: j ? "brightness(0.93)" : void 0,
1792
- pointerEvents: j ? "none" : void 0
1793
- },
1794
- children: /* @__PURE__ */ (0, Z.jsxs)(de, {
1795
- filterStyle: ce,
1796
- isLocked: j,
1797
- children: [
1798
- ne && !o && /* @__PURE__ */ (0, Z.jsxs)("div", {
1799
- className: I.searchWrapper,
1800
- style: { color: me },
1801
- children: [/* @__PURE__ */ (0, Z.jsx)(te, {
1802
- className: I.searchWrapperSearch,
1803
- "data-testid": "filter-search-input",
1804
- onChange: (e) => {
1805
- l(e.target.value);
1806
- },
1807
- autoFocus: !j,
1808
- onPaste: se(l),
1809
- onKeyDown: G,
1810
- style: {
1811
- color: me,
1812
- borderColor: me
1813
- },
1814
- value: p,
1815
- responsive: s?.filterSettings?.responsive
1816
- }), /* @__PURE__ */ (0, Z.jsx)(an, {
1817
- responsive: s?.filterSettings?.responsive,
1818
- isPreview: o,
1819
- quickSelection: z,
1820
- areSelectedValues: !!ae.length,
1821
- state: k,
1822
- onClear: E,
1823
- onDeselectAll: T,
1824
- onSelectAll: f,
1825
- onSelectExcluded: O,
1826
- onNotOperatorChange: C,
1827
- onLockClick: A,
1828
- isSingleSelectField: M
1829
- })]
1830
- }),
1831
- /* @__PURE__ */ (0, Z.jsx)(re, { loading: N }),
1832
- /* @__PURE__ */ (0, Z.jsx)("div", {
1833
- ref: R,
1834
- style: {
1835
- opacity: L ? .5 : 1,
1836
- pointerEvents: L ? "none" : void 0,
1837
- transition: "opacity 0.15s ease"
1838
- },
1839
- children: /* @__PURE__ */ (0, Z.jsxs)(ue, {
1840
- loadMoreData: h,
1841
- isDropdown: !0,
1842
- hasSearch: ne,
1843
- responsive: s?.filterSettings?.responsive,
1844
- children: [d && _.length === 0 && !N && !P ? /* @__PURE__ */ (0, Z.jsx)(ie, {
1845
- applied: !1,
1846
- disabled: !1,
1847
- selected: !1,
1848
- hoverColor: W,
1849
- fontStyle: s.filterSettings?.fontStyle,
1850
- dimensionValue: "No results to display.",
1851
- responsive: s?.filterSettings?.responsive
1852
- }) : null, v ? /* @__PURE__ */ (0, Z.jsx)($t, {
1853
- filterValues: _,
1854
- filterDimensionsCount: b,
1855
- searchTerm: m,
1856
- isLoading: N || P,
1857
- isPreview: o,
1858
- isFieldLocked: j,
1859
- hoverColor: W,
1860
- filterFontSize: s.filterSettings?.fontStyle?.fontSize ?? n.fontSize,
1861
- filterFontColor: me,
1862
- vSpec: s,
1863
- dimensionSelectionMethods: x,
1864
- selectionMode: S
1865
- }) : H || V ? /* @__PURE__ */ (0, Z.jsx)(le, {
1866
- vSpec: s,
1867
- filterValues: _,
1868
- hoverColor: W,
1869
- onItemClick: w,
1870
- selectedValues: ae,
1871
- appliedValues: k.applied ?? [],
1872
- searchTerm: m
1873
- }) : /* @__PURE__ */ (0, Z.jsx)(pe, {
1874
- vSpec: s,
1875
- filterValues: _,
1876
- hoverColor: W,
1877
- onItemClick: w,
1878
- selectedValues: ae,
1879
- appliedValues: k.applied ?? [],
1880
- searchTerm: m
1881
- })]
1882
- })
1883
- })
1884
- ]
1885
- })
1886
- }), j && /* @__PURE__ */ (0, Z.jsx)(De, {
1887
- color: "secondary",
1888
- style: { borderRadius: `0 0 ${fe}px ${fe}px` },
1889
- className: I.unlockButtonStyles,
1890
- onClick: A,
1891
- children: /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)(y, { fill: "white" }), "Unlock"] })
1892
- })]
1893
- })
1894
- })
1895
- }),
1896
- children: t
1897
- });
1898
- }
1899
- function cn(e, t) {
1900
- let n = e === "top" ? "marginBottom" : "marginTop";
1901
- return { [`&[data-popper-placement*="${e}"]`]: { "& .MuiTooltip-tooltip": {
1902
- [n]: 8,
1903
- ...t && {
1904
- [Y.md]: { [n]: 6 },
1905
- [Y.sm]: { [n]: 4 },
1906
- [Y.xs]: { [n]: 2 }
1907
- }
1908
- } } };
1909
- }
1910
- var ln = {
1911
- backgroundColor: "transparent",
1912
- borderEnabled: !1
1913
- }, un = ({ vSpec: e, filterValues: t, isPreview: r = !1, vTheme: i, loadMoreData: a, searchTerm: o, setSearchTerm: s, allValuesLoaded: l, isSearching: d = !1, isApplyingFilters: f = !1 }) => {
1914
- let p = (0, X.useRef)(null), [m, h] = (0, X.useState)(!1), [g, _] = (0, X.useState)(o), v = e.dimensions[0]?.formatter, y = e.dimensions.filter((e) => e.role === c.FILTER_DIMENSION), b = y.length > 1, x = t.map((e) => e.dimension), [S, C] = oe(e), { quickSelection: w } = Ie(e), T = e.filterSettings?.filterStyle, E;
1915
- if (T) {
1916
- let { backgroundColor: e, ...t } = T;
1917
- E = {
1918
- ...t,
1919
- ..."backgroundColor" in T ? { backgroundColor: e ?? void 0 } : {}
1920
- };
1921
- }
1922
- let D = e.filterSettings?.defaultNotState ? Q.FilterOperator.NotInList : Q.FilterOperator.InList, k = I(r ? [] : b ? y.map((e, n) => ({
1923
- dataItem: e.dataItem,
1924
- dateLevel: e.dateLevel ?? void 0,
1925
- datePart: e.datePart ?? void 0,
1926
- values: t.map((e) => e.dimensionValues ? e.dimensionValues[n] : [e.dimension, e.childDimension][n]).filter((e) => e !== void 0)
1927
- })) : [{
1928
- dataItem: e.dimensions[0]?.dataItem,
1929
- dateLevel: e.dimensions[0]?.dateLevel ?? void 0,
1930
- datePart: e.dimensions[0]?.datePart ?? void 0,
1931
- values: x
1932
- }], {
1933
- disabled: r,
1934
- state: w ? Q.SelectionState.APPLIED : void 0,
1935
- defaultOperator: D,
1936
- commitHistory: w
1937
- }), A = (0, X.useMemo)(() => (0, Le.default)((e) => s(e), 300), [s]), { onClear: j, onClick: P, onDeselectAll: F, onSelectExcluded: L, onSelectAll: R, onNotOperatorChange: z, state: B, operators: V, field: H } = k[0] ?? O, U = B.pending ?? B.applied ?? [], { isFieldLocked: ee = !1, toggleFieldLock: te } = M(H ?? void 0), ne = N(H ? [H] : []), re = (e) => {
1938
- _(e), A(e);
1939
- }, ie = (0, X.useMemo)(() => ee ? t.filter((e) => (B.pending ?? B.applied ?? []).includes(e.dimension)) : t, [
1940
- t,
1941
- ee,
1942
- B.pending,
1943
- B.applied
1944
- ]);
1945
- return /* @__PURE__ */ (0, Z.jsx)(me, {
1946
- noBorder: !0,
1947
- filterStyle: ln,
1948
- fontSize: e.filterSettings?.fontStyle?.fontSize ?? n.fontSize,
1949
- children: /* @__PURE__ */ (0, Z.jsx)(ae.Provider, {
1950
- value: {
1951
- appliedOperator: V.applied,
1952
- pendingOperator: V.pending
1953
- },
1954
- children: /* @__PURE__ */ (0, Z.jsx)(sn, {
1955
- isOpen: m,
1956
- isPreview: r,
1957
- vSpec: e,
1958
- vTheme: i,
1959
- allValuesLoaded: l,
1960
- localSearch: g,
1961
- searchTerm: o,
1962
- headerElement: p,
1963
- setIsOpen: h,
1964
- onSearchChange: re,
1965
- setLocalSearch: _,
1966
- loadMoreData: a,
1967
- filterValues: ie,
1968
- hierarchicalMode: b,
1969
- filterDimensionsCount: y.length,
1970
- dimensionSelectionMethods: k,
1971
- selectionMode: e.filterSettings?.selectionMode ?? u.selectionMode,
1972
- onNotOperatorChange: z,
1973
- onClick: P,
1974
- onDeselectAll: F,
1975
- onSelectAll: R,
1976
- onClear: j,
1977
- onSelectExcluded: L,
1978
- state: B,
1979
- onLockClick: te,
1980
- isLocked: ee,
1981
- isSingleSelectField: ne,
1982
- isSearching: d,
1983
- isApplyingFilters: f,
1984
- children: /* @__PURE__ */ (0, Z.jsx)("div", {
1985
- ref: p,
1986
- style: { height: "100%" },
1987
- children: /* @__PURE__ */ (0, Z.jsx)(ce, {
1988
- measureTitle: C ?? "",
1989
- dimensionTitle: S,
1990
- isOpen: m,
1991
- onToggle: () => h(!m),
1992
- dimensionFormatter: v,
1993
- selectedValues: U,
1994
- fontStyle: e.filterSettings?.fontStyle ?? {},
1995
- filterStyle: E,
1996
- responsive: e?.filterSettings?.responsive,
1997
- isLocked: ee
1998
- })
1999
- })
2000
- })
2001
- })
2002
- });
2003
- }, dn = [
2004
- { value: "Value 1" },
2005
- { value: "Value 2" },
2006
- { value: "Value 3" },
2007
- { value: "Value 4" },
2008
- { value: "Value 5" },
2009
- { value: "Value 6" },
2010
- { value: "Value 7" },
2011
- { value: "Value 8" },
2012
- { value: "Value 9" },
2013
- { value: "Value 10" },
2014
- { value: "Value 11" }
2015
- ], fn = ({ vSpec: e, vTheme: n }) => {
2016
- let r = dn.map((e) => ({ dimension: e.value })), i = {
2017
- ...e,
2018
- dimensions: [{
2019
- dataItem: {
2020
- internalKey: "filter-preview",
2021
- uniqueSignature: o(),
2022
- schema: "excel",
2023
- view: "pokemon",
2024
- name: "city",
2025
- dataType: Q.FieldType.STRING,
2026
- type: s.Dimension
2027
- },
2028
- label: "Dimension"
2029
- }],
2030
- measures: []
2031
- };
2032
- return e.filterSettings?.mode === t.Dropdown ? /* @__PURE__ */ (0, Z.jsx)(un, {
2033
- allValuesLoaded: !0,
2034
- vSpec: i,
2035
- vTheme: n,
2036
- filterValues: r,
2037
- isPreview: !0,
2038
- searchTerm: "",
2039
- setSearchTerm: () => null,
2040
- loadMoreData: () => void 0
2041
- }) : /* @__PURE__ */ (0, Z.jsx)(rn, {
2042
- allValuesLoaded: !0,
2043
- vSpec: i,
2044
- vTheme: n,
2045
- filterValues: r,
2046
- isPreview: !0,
2047
- searchTerm: "",
2048
- setSearchTerm: () => null,
2049
- loadMoreData: () => void 0
2050
- });
2051
- }, pn = E(({ vSpec: e, filterValues: n = [], vTheme: r, loadMoreData: i, searchTerm: a, setSearchTerm: o, allValuesLoaded: s, isSearching: c = !1, isApplyingFilters: u = !1 }) => {
2052
- let d = k();
2053
- if ((0, X.useEffect)(() => {
2054
- e?.dimensions?.length < 2 && d();
2055
- }, [e]), !e?.dimensions?.length && e?.dimensions !== void 0) return /* @__PURE__ */ (0, Z.jsx)(fn, {
2056
- vSpec: {
2057
- ...e,
2058
- filterSettings: {
2059
- ...e.filterSettings,
2060
- mode: e.filterSettings?.mode ?? t.Listbox,
2061
- source: e.filterSettings?.source ?? l.Engine,
2062
- fontStyle: e.filterSettings?.fontStyle ?? {}
2063
- }
2064
- },
2065
- vTheme: r
2066
- });
2067
- if (e?.dimensions === void 0 || !e?.filterSettings?.mode || !e?.filterSettings?.source) return null;
2068
- switch (e.filterSettings.mode) {
2069
- case t.Image: return null;
2070
- case t.Dropdown: return /* @__PURE__ */ (0, Z.jsx)(un, {
2071
- allValuesLoaded: s,
2072
- vSpec: e,
2073
- vTheme: r,
2074
- filterValues: n,
2075
- loadMoreData: i,
2076
- searchTerm: a,
2077
- setSearchTerm: o,
2078
- isSearching: c,
2079
- isApplyingFilters: u
2080
- });
2081
- case t.Listbox:
2082
- default: return /* @__PURE__ */ (0, Z.jsx)(rn, {
2083
- allValuesLoaded: s,
2084
- vSpec: e,
2085
- vTheme: r,
2086
- filterValues: n,
2087
- loadMoreData: i,
2088
- searchTerm: a,
2089
- setSearchTerm: o,
2090
- isSearching: c,
2091
- isApplyingFilters: u
2092
- });
2093
- }
2094
- });
2095
- export { pn as Filter };