@astrato-io/visualizations 0.6.4 → 0.6.5

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 (149) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/THIRD_PARTY_NOTICES.md +94 -4
  3. package/chunks/ClickAwayListener-BbeNMAvj.js +52 -0
  4. package/chunks/{LinearProgress-CUZ0D8_t.js → LinearProgress-B1FeWaen.js} +54 -54
  5. package/chunks/app-filter-bar.compiler-BGJ7HAbr.js +64 -0
  6. package/chunks/bar.compiler-CT0ZbQKc.js +374 -0
  7. package/chunks/{src-Cum_2NLV.js → builder-B6dWSIdD.js} +5779 -5635
  8. package/chunks/{coloring-C16AUZEi.js → coloring-B1XAfg6b.js} +234 -233
  9. package/chunks/{src-BC7cGcJ-.js → definitions-D3OVqmXl.js} +438 -360
  10. package/chunks/{escobar-BGqT1EsE.js → escobar-eDjtGpkC.js} +4645 -4619
  11. package/chunks/filter.compiler-DBsyRBJt.js +70 -0
  12. package/chunks/{filtering-Yq4DEa0t.js → filtering-tqjAyJH5.js} +432 -313
  13. package/chunks/{grouping-type-BX_9Ix5q.js → grouping-type-On4s9Thj.js} +1 -1
  14. package/chunks/handlers-VTBfIZYZ.js +13072 -0
  15. package/chunks/isEqual-BDxAhUo8.js +7514 -0
  16. package/chunks/line.compiler-CzdM5Ld0.js +198 -0
  17. package/chunks/{metadata-CPXdYoln.js → metadata-BGElBy5Z.js} +1 -1
  18. package/chunks/number.compiler-G-R7y16P.js +53 -0
  19. package/chunks/{src-C0LgoUWY.js → operations-CTNUX6Sy.js} +9576 -9432
  20. package/chunks/{range-DrzdfBX4.js → range-CiwTbMig.js} +2 -2
  21. package/chunks/{registry-CExpGJ1N.js → registry-CsQQzukD.js} +153 -153
  22. package/chunks/{requirements-DNhuShLS.js → requirements-DYjZCFyf.js} +1 -1
  23. package/chunks/{shared-CKDL4hx9.js → shared-CBvcC5YV.js} +460 -413
  24. package/chunks/{standalone-D5vnf-9y.js → standalone-0M4HlmDW2.js} +823 -822
  25. package/chunks/standalone-0ashe9w1.js +411 -0
  26. package/chunks/{standalone-C85u7U6I.js → standalone-B7jax8wa.js} +93 -94
  27. package/chunks/standalone-BK0VYU-l.js +463 -0
  28. package/chunks/{standalone-BDCwI6Hn.js → standalone-BMIbT1b2.js} +815 -815
  29. package/chunks/standalone-BZV5vOwA.js +6 -0
  30. package/chunks/standalone-BhDrWj4p.js +1980 -0
  31. package/chunks/{standalone-CNyNHKVx.js → standalone-BtSHCp2U2.js} +97 -98
  32. package/chunks/{standalone-CDQnr6qT.js → standalone-BvaKdky9.js} +95 -96
  33. package/chunks/standalone-BwtM31-f.js +2 -0
  34. package/chunks/{standalone-CY57qwZ-.js → standalone-C3gg736V.js} +153 -153
  35. package/chunks/{standalone-DFPva_ku.js → standalone-CC1VUjO32.js} +60 -60
  36. package/chunks/{standalone-CCNtaJ7s.js → standalone-C_rYnZ0N.js} +41 -41
  37. package/chunks/{standalone-CZynjFG7.js → standalone-CoLrAxRV.js} +3701 -3482
  38. package/chunks/{standalone-jiz0L2Dg.js → standalone-DC-aUgXC.js} +104 -104
  39. package/chunks/standalone-DCtRoTWg.js +675 -0
  40. package/chunks/standalone-DUDFTBqL.js +833 -0
  41. package/chunks/standalone-DhZkX9Td.js +2 -0
  42. package/chunks/{standalone-Dx3MLlrO.js → standalone-DtLElfuM.js} +141 -141
  43. package/chunks/{standalone-BmfMt74U.js → standalone-G9Q4Uczu.js} +192 -192
  44. package/chunks/{standalone-BH5NqDwp.js → standalone-JuLF-OoH.js} +390 -391
  45. package/chunks/standalone-_DeX21JJ.js +383 -0
  46. package/chunks/{standalone-lBm9hQ-q.js → standalone-gFhKZh8m.js} +34 -34
  47. package/chunks/standalone-tDNy-SFH.js +281 -0
  48. package/chunks/{standalone-rJ45Zfl1.js → standalone-v1oxfU20.js} +10 -10
  49. package/chunks/{standalone-BYm1UjLr.js → standalone-vzBY6q0I2.js} +18 -18
  50. package/chunks/table.compiler-tb914oj3.js +222 -0
  51. package/chunks/{ui-D1HQNIBy.js → ui-DQWtv2iM.js} +13485 -3973
  52. package/chunks/{useFieldName-oqQ3bvnO.js → useFieldName-BvdcoJRl.js} +1 -1
  53. package/chunks/{utils-Ba9T0TqC.js → utils-Bg7K-t6K.js} +7306 -6024
  54. package/chunks/{src-DvX5LU9T.js → view-Bn83C8d9.js} +2555 -4831
  55. package/definitions.js +3 -3
  56. package/docs/operations/astrato-app-filter-bar.md +17 -17
  57. package/docs/operations/bar.md +989 -1071
  58. package/docs/operations/combo.md +717 -738
  59. package/docs/operations/date-picker.md +25 -25
  60. package/docs/operations/distribution-gauge.md +471 -607
  61. package/docs/operations/dot.md +787 -879
  62. package/docs/operations/filter.md +139 -163
  63. package/docs/operations/gauge.md +491 -627
  64. package/docs/operations/heatMap.md +834 -916
  65. package/docs/operations/histogram.md +166 -180
  66. package/docs/operations/iframe.md +5 -5
  67. package/docs/operations/image.md +16 -16
  68. package/docs/operations/index.md +12 -12
  69. package/docs/operations/line.md +811 -888
  70. package/docs/operations/number.md +470 -536
  71. package/docs/operations/pie.md +825 -958
  72. package/docs/operations/radar.md +599 -679
  73. package/docs/operations/sankey.md +462 -584
  74. package/docs/operations/scatter.md +823 -929
  75. package/docs/operations/shape.md +34 -34
  76. package/docs/operations/simpleTextObject.md +18 -25
  77. package/docs/operations/slider.md +33 -43
  78. package/docs/operations/table.md +1160 -1150
  79. package/docs/operations/tree.md +354 -361
  80. package/docs/operations/treemap.md +545 -637
  81. package/docs/operations/waterfall.md +369 -379
  82. package/docs/operations/word-cloud.md +512 -583
  83. package/getters.js +3 -3
  84. package/index.js +51 -51
  85. package/metadata.js +3 -3
  86. package/operations.js +7 -7
  87. package/package.json +80 -86
  88. package/src/definitions/index.d.ts +2 -2
  89. package/src/definitions/{shared/lib → model/definitions}/available-fields.d.ts +0 -1
  90. package/src/definitions/{shared/lib/compilers/index.d.ts → model/definitions/compilers/compile.d.ts} +1 -1
  91. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  92. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1341 -0
  93. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  94. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  95. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  96. package/src/definitions/model/definitions/index.d.ts +23 -0
  97. package/src/definitions/{shared/lib → model/definitions}/registry/compile.d.ts +1 -1
  98. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  99. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  100. package/src/definitions/{shared/lib → model/definitions}/schemas/broad-chart.schema.d.ts +1 -1
  101. package/src/definitions/{shared/lib → model/definitions}/schemas/common.schema.d.ts +0 -1
  102. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  103. package/src/definitions/{shared/lib → model/definitions}/schemas/object.schema.d.ts +6 -6
  104. package/src/definitions/{shared/lib → model/definitions}/types/definition.types.d.ts +1 -1
  105. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  106. package/src/definitions/{shared/lib/registry → model/definitions}/validation.d.ts +1 -1
  107. package/chunks/Radio-Ciu-F4CU.js +0 -957
  108. package/chunks/ToggleButton-BCJc3Jlc.js +0 -153
  109. package/chunks/_baseFlatten-DPXPOrea.js +0 -7076
  110. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +0 -55
  111. package/chunks/bar.compiler-oqaPzIut.js +0 -370
  112. package/chunks/data-item-resolution-1lvYB5ln.js +0 -53
  113. package/chunks/event-bus-KiSiCJrC.js +0 -2683
  114. package/chunks/filter.compiler-CuLtc_02.js +0 -60
  115. package/chunks/gauge-target-type-BkKXAqkX.js +0 -4
  116. package/chunks/interfaces-VUY4_yVO.js +0 -8742
  117. package/chunks/line-settings-DfYTUyPz.js +0 -4
  118. package/chunks/line.compiler-BpA_6Tc7.js +0 -188
  119. package/chunks/number.compiler-DbkWcG4S.js +0 -44
  120. package/chunks/pie-uv42Eqal.js +0 -10
  121. package/chunks/src-Dun_jXtz.js +0 -10295
  122. package/chunks/standalone-87YV_m9n.js +0 -687
  123. package/chunks/standalone-BLVAWLNJ.js +0 -385
  124. package/chunks/standalone-BPomtAVs.js +0 -2
  125. package/chunks/standalone-BXyBcUOQ.js +0 -2
  126. package/chunks/standalone-BllF4rDp.js +0 -383
  127. package/chunks/standalone-BqWyrnZI.js +0 -281
  128. package/chunks/standalone-DQxxNwF8.js +0 -675
  129. package/chunks/standalone-DS9T0FZ-.js +0 -830
  130. package/chunks/standalone-DzixzZAL.js +0 -411
  131. package/chunks/standalone-QJ1kKMnO.js +0 -6
  132. package/chunks/table.compiler-BrXkm4Fz.js +0 -213
  133. package/chunks/toInteger-DVZr-D1j.js +0 -11
  134. package/chunks/treemap-x_zmJoG7.js +0 -23
  135. package/chunks/types-dVVCsDWD.js +0 -4
  136. package/chunks/view-CLqWMV7Z.js +0 -156
  137. package/src/definitions/shared/index.d.ts +0 -5
  138. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +0 -587
  139. package/src/definitions/shared/lib/registry/index.d.ts +0 -3
  140. package/src/definitions/shared/lib/schemas/index.d.ts +0 -9
  141. package/src/definitions/shared/lib/types/index.d.ts +0 -3
  142. package/src/definitions/{shared/lib → model/definitions}/schemas/app-filter-bar.schema.d.ts +0 -0
  143. package/src/definitions/{shared/lib → model/definitions}/schemas/bar.schema.d.ts +0 -0
  144. package/src/definitions/{shared/lib → model/definitions}/schemas/filter.schema.d.ts +0 -0
  145. package/src/definitions/{shared/lib → model/definitions}/schemas/line.schema.d.ts +0 -0
  146. package/src/definitions/{shared/lib → model/definitions}/schemas/number.schema.d.ts +0 -0
  147. package/src/definitions/{shared/lib → model/definitions}/schemas/table.schema.d.ts +4 -4
  148. /package/src/definitions/{shared/lib → model/definitions}/types/compilation.types.d.ts +0 -0
  149. /package/src/definitions/{shared/lib → model/definitions}/types/descriptor.types.d.ts +0 -0
@@ -1,687 +0,0 @@
1
- import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { Oa as t, Ts as n, Wc as r, do as i, ds as a, fa as o, fo as s } from "./interfaces-VUY4_yVO.js";
3
- import { $n as c, G as l, Gn as u, Ki as d, Sr as f, Zt as p, c as m, d as h, m as g, n as _, s as v, ui as y, wi as b, xn as x } from "./utils-Ba9T0TqC.js";
4
- import { z as S } from "./ui-D1HQNIBy.js";
5
- import { C, w } from "./_baseFlatten-DPXPOrea.js";
6
- import { a as ee, c as te, h as ne, i as T, l as re, m as ie, n as ae, o as oe, r as E, s as se, t as D, u as O } from "./filtering-Yq4DEa0t.js";
7
- import "./src-DvX5LU9T.js";
8
- import { d as ce, f as k, i as A, l as j, n as M, p as N, r as P } from "./Radio-Ciu-F4CU.js";
9
- var le = (e) => ({
10
- hasImage: !!e.dimensions[1]?.dataItem,
11
- hasMeasure: !!e.measures[0]?.dataItem,
12
- searchEnabled: !!e.filterSettings?.searchable,
13
- quickSelection: !!e.filterSettings?.quickSelect
14
- }), F = a(), I = /* @__PURE__ */ e(d()), ue = /* @__PURE__ */ e(u()), L = l({ menuTrigger: ({ responsive: e, isDisplayImportant: t }) => ({
15
- ...e && C,
16
- display: t ? "inline-flex !important" : "inline-flex",
17
- alignItems: "center",
18
- justifyContent: "center",
19
- minWidth: 22,
20
- width: 22,
21
- height: 22,
22
- padding: 0,
23
- borderRadius: 6,
24
- border: "none",
25
- backgroundColor: "transparent",
26
- color: "inherit",
27
- lineHeight: 0,
28
- "&:hover": { boxShadow: "inset 0 0 0 1px currentColor" },
29
- "&:focus": { outline: "none" },
30
- ...e && {
31
- [w.md]: {
32
- minWidth: 20,
33
- width: 20,
34
- height: 20,
35
- borderRadius: 5
36
- },
37
- [w.sm]: {
38
- minWidth: 16,
39
- width: 16,
40
- height: 16,
41
- borderRadius: 4
42
- },
43
- [w.xs]: {
44
- minWidth: 12,
45
- width: 12,
46
- height: 12,
47
- borderRadius: 3
48
- }
49
- }
50
- }) }), R = b();
51
- function z(e) {
52
- let { isPreview: t, areSelectedValues: n, arePendingValues: r, isNotEnabled: i, responsive: a, onClear: o, onDeselectAll: s, onSelectAll: c, onSelectExcluded: l, toggleNotOperator: u, onLockClick: d, isSingleSelectField: p = !1 } = e, [m, h] = (0, I.useState)(!1), g = L({
53
- responsive: a,
54
- isDisplayImportant: !0
55
- }), _ = x().daedalus.getWorkbookProperties()?.isLockUnlockFieldsEnabled ?? !1, v = [{
56
- disabled: t || !r,
57
- key: "clear",
58
- label: "Clear",
59
- type: "option",
60
- onClick: o
61
- }];
62
- return p || v.push({
63
- key: "divider",
64
- type: "divider"
65
- }, {
66
- disabled: t || !n,
67
- key: "deselect-all",
68
- label: "Deselect all",
69
- type: "option",
70
- onClick: s
71
- }, {
72
- disabled: t,
73
- key: "select-all",
74
- label: i ? "Exclude all" : "Select all",
75
- type: "option",
76
- onClick: c
77
- }, {
78
- disabled: t,
79
- key: "invert",
80
- label: "Invert",
81
- type: "option",
82
- onClick: l
83
- }, {
84
- disabled: t,
85
- key: "not",
86
- label: "Exclude",
87
- type: "option",
88
- onClick: u
89
- }), _ && v.push({
90
- key: "divider",
91
- type: "divider"
92
- }, {
93
- key: "lock",
94
- label: "Lock",
95
- type: "option",
96
- icon: { right: /* @__PURE__ */ (0, R.jsx)(f, {}) },
97
- onClick: d
98
- }), /* @__PURE__ */ (0, R.jsx)(j, {
99
- open: m,
100
- placement: "bottom-end",
101
- title: /* @__PURE__ */ (0, R.jsx)(N, {
102
- onClickAway: () => h(!1),
103
- children: /* @__PURE__ */ (0, R.jsx)(M, {
104
- onClose: () => h(!1),
105
- options: v,
106
- responsive: a,
107
- style: { margin: "-8px -12px" }
108
- })
109
- }),
110
- children: /* @__PURE__ */ (0, R.jsx)(A, {
111
- onClick: () => h(!m),
112
- "data-testid": "filter-button-icon-dots",
113
- className: g.menuTrigger,
114
- children: /* @__PURE__ */ (0, R.jsx)(y, {
115
- fill: "currentColor",
116
- size: 20
117
- })
118
- })
119
- });
120
- }
121
- var B = {
122
- borderBottom: `1px solid ${t.grey5}`,
123
- margin: "0 12px",
124
- width: "calc(100% - 24px)"
125
- }, de = {
126
- flexGrow: 1,
127
- borderRadius: 0,
128
- height: 28,
129
- boxShadow: "0 3px 6px rgba(0, 0, 0, 0.2)",
130
- clipPath: "inset(0 0 -10px 0)",
131
- transform: "translateY(-3px)"
132
- }, fe = {
133
- position: "absolute",
134
- inset: 0,
135
- display: "flex",
136
- justifyContent: "center",
137
- alignItems: "flex-end",
138
- pointerEvents: "auto",
139
- zIndex: 2
140
- }, V = ({ vSpec: e, vTheme: t, filterValues: n, isPreview: r, loadMoreData: i, searchTerm: a, setSearchTerm: s, allValuesLoaded: l, isSearching: u = !1, isApplyingFilters: d = !1 }) => {
141
- let f = x(), [p, h] = (0, I.useState)(a), y = !!e.filterSettings?.defaultNotState, [b, C] = (0, I.useState)(y), [w, T] = ne(e), ie = (0, I.useMemo)(() => (0, ue.default)((e) => s(e), 300), [s]), oe = n.reduce((e, t) => (t.disabled || e.push(t.dimension), e), []), A = r ? [] : [{
142
- dataItem: e.dimensions[0]?.dataItem,
143
- dateLevel: e.dimensions[0]?.dateLevel,
144
- datePart: e.dimensions[0]?.datePart,
145
- values: oe
146
- }], { hasImage: j, hasMeasure: M, searchEnabled: N, quickSelection: P } = le(e), L = e.filterSettings?.filterStyle?.backgroundColor ?? o.backgroundColor, V = ce({
147
- ...k,
148
- "--background-color": L
149
- })["--background-color-hover"], [pe] = v(A, {
150
- disabled: r,
151
- state: P ? F.SelectionState.APPLIED : void 0,
152
- defaultOperator: b ? F.FilterOperator.NotInList : F.FilterOperator.InList,
153
- commitHistory: P
154
- }), { onClear: me, onClick: H, onDeselectAll: U, onSelectExcluded: W, onNotOperatorChange: G, onSelectAll: K, field: q, state: J, operators: Y } = pe ?? m, { isFieldLocked: X, toggleFieldLock: he } = _(q), Z = J.pending ?? J.applied ?? [], ge = g([q]);
155
- (0, I.useEffect)(() => {
156
- let e = Y.pending ?? Y.applied;
157
- if (e) {
158
- C(e === F.FilterOperator.NotInList);
159
- return;
160
- }
161
- C(y);
162
- }, [y, Y]);
163
- let _e = (0, I.useCallback)(() => {
164
- C((e) => !e), G();
165
- }, [C, G]);
166
- function ve() {
167
- l ? K() : f.daedalus.emitEvent(F.AstratoEvents.SHOW_GLOBAL_NOTIFICATION, {
168
- type: "warn",
169
- message: "Cannot select values, because not all of them are loaded!"
170
- });
171
- }
172
- let Q = X || d || u, ye = (0, I.useRef)(null);
173
- (0, I.useEffect)(() => {
174
- ye.current?.toggleAttribute("inert", Q);
175
- }, [Q]);
176
- let $ = n;
177
- return X && ($ = n.filter((e) => Z.includes(e.dimension))), /* @__PURE__ */ (0, R.jsx)("div", {
178
- style: {
179
- position: "relative",
180
- height: "100%"
181
- },
182
- children: /* @__PURE__ */ (0, R.jsx)(D, {
183
- blurBackground: !0,
184
- filterStyle: e.filterSettings?.filterStyle,
185
- vTheme: t,
186
- fontSize: e.filterSettings?.fontStyle?.fontSize ?? o.fontSize,
187
- children: /* @__PURE__ */ (0, R.jsxs)(O.Provider, {
188
- value: {
189
- appliedOperator: Y.applied,
190
- pendingOperator: Y.pending
191
- },
192
- children: [
193
- /* @__PURE__ */ (0, R.jsx)(E, {
194
- measureTitle: T,
195
- dimensionTitle: w,
196
- searchEnabled: N && !r,
197
- searchTerm: p,
198
- onSearchChange: (e) => {
199
- h(e), ie(e);
200
- },
201
- onApplySearched: ve,
202
- fontStyle: e.filterSettings?.fontStyle,
203
- vTheme: t,
204
- isNotEnabled: b,
205
- responsive: e?.filterSettings?.responsive,
206
- isLocked: X,
207
- children: P ? null : /* @__PURE__ */ (0, R.jsx)(z, {
208
- isPreview: r,
209
- responsive: e?.filterSettings?.responsive,
210
- areSelectedValues: Z.length > 0,
211
- arePendingValues: !!J.pending,
212
- onClear: me,
213
- onDeselectAll: U,
214
- onSelectExcluded: W,
215
- onSelectAll: K,
216
- toggleNotOperator: _e,
217
- onLockClick: he,
218
- isNotEnabled: b,
219
- isSingleSelectField: ge
220
- })
221
- }),
222
- u ? /* @__PURE__ */ (0, R.jsx)(ee, { loading: !0 }) : /* @__PURE__ */ (0, R.jsx)("div", { style: B }),
223
- /* @__PURE__ */ (0, R.jsx)("div", {
224
- ref: ye,
225
- style: {
226
- height: "100%",
227
- opacity: Q ? .5 : 1,
228
- pointerEvents: Q ? "none" : void 0,
229
- transition: "opacity 0.15s ease"
230
- },
231
- children: /* @__PURE__ */ (0, R.jsxs)(ae, {
232
- loadMoreData: i,
233
- responsive: e?.filterSettings?.responsive,
234
- children: [l && $.length === 0 && !u && !d ? /* @__PURE__ */ (0, R.jsx)(te, {
235
- responsive: e?.filterSettings?.responsive,
236
- applied: !1,
237
- disabled: !1,
238
- selected: !1,
239
- hoverColor: V,
240
- fontStyle: e.filterSettings.fontStyle,
241
- dimensionValue: "No results to display."
242
- }) : null, j || M ? /* @__PURE__ */ (0, R.jsx)(re, {
243
- vSpec: e,
244
- filterValues: $,
245
- hoverColor: V,
246
- onItemClick: H,
247
- selectedValues: Z,
248
- appliedValues: J.applied ?? [],
249
- searchTerm: a
250
- }) : /* @__PURE__ */ (0, R.jsx)(se, {
251
- vSpec: e,
252
- filterValues: $,
253
- hoverColor: V,
254
- onItemClick: H,
255
- selectedValues: Z,
256
- appliedValues: J.applied ?? [],
257
- searchTerm: a
258
- })]
259
- })
260
- }),
261
- X && /* @__PURE__ */ (0, R.jsx)("div", {
262
- style: fe,
263
- children: /* @__PURE__ */ (0, R.jsx)(S, {
264
- color: "secondary",
265
- style: de,
266
- onClick: () => he(),
267
- children: /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)(c, { fill: "white" }), "Unlock"] })
268
- })
269
- })
270
- ]
271
- })
272
- })
273
- });
274
- };
275
- function pe(e) {
276
- 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: p } = e, [m, h] = (0, I.useState)(!1), g = L({ responsive: a }), { appliedOperator: _, pendingOperator: v } = (0, I.useContext)(O), b = _ ?? v ?? F.FilterOperator.InList, S = x().daedalus.getWorkbookProperties()?.isLockUnlockFieldsEnabled ?? !1;
277
- if (t) return null;
278
- let C = [{
279
- disabled: n || !i.pending,
280
- key: "clear",
281
- label: "Clear",
282
- type: "option",
283
- onClick: s
284
- }];
285
- return o || C.push({
286
- key: "divider",
287
- type: "divider"
288
- }, {
289
- disabled: n || !r,
290
- key: "deselect-all",
291
- label: "Deselect all",
292
- type: "option",
293
- onClick: c
294
- }, {
295
- disabled: n,
296
- key: "select-all",
297
- label: b === F.FilterOperator.InList ? "Select all" : "Exclude all",
298
- type: "option",
299
- onClick: l
300
- }, {
301
- disabled: n,
302
- key: "invert",
303
- label: "Invert",
304
- type: "option",
305
- onClick: u
306
- }, {
307
- disabled: n,
308
- key: "not",
309
- label: "Exclude",
310
- type: "option",
311
- onClick: d
312
- }), S && C.push({
313
- key: "divider",
314
- type: "divider"
315
- }, {
316
- key: "lock",
317
- label: "Lock",
318
- type: "option",
319
- icon: { right: /* @__PURE__ */ (0, R.jsx)(f, {}) },
320
- onClick: p
321
- }), /* @__PURE__ */ (0, R.jsx)(j, {
322
- open: m,
323
- placement: "bottom-end",
324
- title: /* @__PURE__ */ (0, R.jsx)(N, {
325
- onClickAway: () => h(!1),
326
- children: /* @__PURE__ */ (0, R.jsx)(M, {
327
- onClose: () => h(!1),
328
- options: C,
329
- responsive: a,
330
- style: { margin: "-8px -12px" }
331
- })
332
- }),
333
- children: /* @__PURE__ */ (0, R.jsx)(A, {
334
- onClick: () => h(!m),
335
- className: g.menuTrigger,
336
- children: /* @__PURE__ */ (0, R.jsx)(y, {
337
- fill: "currentColor",
338
- size: 20
339
- })
340
- })
341
- });
342
- }
343
- var me = l({
344
- searchWrapper: (e) => ({
345
- alignItems: "center",
346
- display: "flex",
347
- flexDirection: "row",
348
- gap: 4,
349
- justifyContent: "space-between",
350
- padding: "8px 8px 8px 12px",
351
- position: "relative",
352
- width: "100%",
353
- ...e && {
354
- [w.md]: { padding: "6px 6px 6px 10px" },
355
- [w.sm]: { padding: "4px 4px 4px 8px" },
356
- [w.xs]: { padding: "2px 2px 2px 4px" }
357
- }
358
- }),
359
- searchWrapperSearch: { flexGrow: 1 },
360
- tooltip: (e) => ({
361
- "& .MuiTooltip-tooltip": {
362
- padding: 0,
363
- margin: 0,
364
- backgroundColor: "transparent"
365
- },
366
- ...U("bottom", e),
367
- ...U("top", e)
368
- }),
369
- unlockButtonStyles: {
370
- width: "100%",
371
- height: 28,
372
- boxShadow: "0 3px 6px rgba(0, 0, 0, 0.2)",
373
- clipPath: "inset(0 0 -10px 0)",
374
- transform: "translateY(-3px)"
375
- }
376
- });
377
- function H(e) {
378
- let { children: n, isOpen: r, setIsOpen: i, isPreview: a, vSpec: s, vTheme: l, onSearchChange: u, setLocalSearch: d, allValuesLoaded: f, onSelectAll: p, localSearch: m, searchTerm: h, loadMoreData: g, headerElement: _, filterValues: v, onNotOperatorChange: y, onClick: b, onDeselectAll: C, onClear: w, onSelectExcluded: ne, state: T, onLockClick: E, isLocked: D, isSingleSelectField: O = !1, isSearching: A = !1, isApplyingFilters: M = !1 } = e, ue = x(), L = me(s?.filterSettings?.responsive), z = M || A, B = (0, I.useRef)(null);
379
- (0, I.useEffect)(() => {
380
- B.current?.toggleAttribute("inert", z);
381
- }, [z]);
382
- let { quickSelection: de, hasMeasure: fe, hasImage: V, searchEnabled: H } = le(s), U = T.pending ?? T.applied ?? [], W = s.filterSettings?.filterStyle?.borderRadius ?? o.borderRadius, G = s.filterSettings?.fontStyle?.fontColor ?? l?.fonts?.general?.color ?? t.mainDarkNavy, K = s.filterSettings?.filterStyle?.backgroundColor ?? o.backgroundColor, q = ce({
383
- ...k,
384
- "--background-color": K
385
- })["--background-color-hover"];
386
- function J(e) {
387
- switch (e.key) {
388
- case "Enter":
389
- f ? p() : ue.daedalus.emitEvent(F.AstratoEvents.SHOW_GLOBAL_NOTIFICATION, {
390
- type: "warn",
391
- message: "Cannot select values, because not all of them are loaded!"
392
- });
393
- break;
394
- case "Escape":
395
- d("");
396
- break;
397
- }
398
- }
399
- return /* @__PURE__ */ (0, R.jsx)(j, {
400
- placement: "bottom-start",
401
- arrow: !1,
402
- open: r,
403
- classes: { popper: L.tooltip },
404
- slotProps: { popper: { anchorEl: _?.current?.firstElementChild } },
405
- title: /* @__PURE__ */ (0, R.jsx)(N, {
406
- onClickAway: () => i(!1),
407
- children: /* @__PURE__ */ (0, R.jsx)("div", {
408
- style: {
409
- minWidth: _.current?.clientWidth ?? null,
410
- maxWidth: "80vw",
411
- fontSize: s.filterSettings?.fontStyle?.fontSize ?? o.fontSize
412
- },
413
- children: r && /* @__PURE__ */ (0, R.jsxs)("div", {
414
- style: { position: "relative" },
415
- children: [/* @__PURE__ */ (0, R.jsx)("div", {
416
- style: {
417
- filter: D ? "brightness(0.93)" : void 0,
418
- pointerEvents: D ? "none" : void 0
419
- },
420
- children: /* @__PURE__ */ (0, R.jsxs)(oe, {
421
- filterStyle: s.filterSettings?.filterStyle,
422
- vTheme: l,
423
- isLocked: D,
424
- children: [
425
- H && !a && /* @__PURE__ */ (0, R.jsxs)("div", {
426
- className: L.searchWrapper,
427
- style: { color: G },
428
- children: [/* @__PURE__ */ (0, R.jsx)(P, {
429
- className: L.searchWrapperSearch,
430
- "data-testid": "filter-search-input",
431
- onChange: (e) => {
432
- u(e.target.value);
433
- },
434
- autoFocus: !D,
435
- onPaste: ie(u),
436
- onKeyDown: J,
437
- style: {
438
- color: G,
439
- borderColor: G
440
- },
441
- value: m,
442
- responsive: s?.filterSettings?.responsive
443
- }), /* @__PURE__ */ (0, R.jsx)(pe, {
444
- responsive: s?.filterSettings?.responsive,
445
- isPreview: a,
446
- quickSelection: de,
447
- areSelectedValues: !!U.length,
448
- state: T,
449
- onClear: w,
450
- onDeselectAll: C,
451
- onSelectAll: p,
452
- onSelectExcluded: ne,
453
- onNotOperatorChange: y,
454
- onLockClick: E,
455
- isSingleSelectField: O
456
- })]
457
- }),
458
- /* @__PURE__ */ (0, R.jsx)(ee, { loading: A }),
459
- /* @__PURE__ */ (0, R.jsx)("div", {
460
- ref: B,
461
- style: {
462
- opacity: z ? .5 : 1,
463
- pointerEvents: z ? "none" : void 0,
464
- transition: "opacity 0.15s ease"
465
- },
466
- children: /* @__PURE__ */ (0, R.jsxs)(ae, {
467
- loadMoreData: g,
468
- isDropdown: !0,
469
- hasSearch: H,
470
- responsive: s?.filterSettings?.responsive,
471
- children: [f && v.length === 0 && !A && !M ? /* @__PURE__ */ (0, R.jsx)(te, {
472
- applied: !1,
473
- disabled: !1,
474
- selected: !1,
475
- hoverColor: q,
476
- fontStyle: s.filterSettings.fontStyle,
477
- dimensionValue: "No results to display.",
478
- responsive: s?.filterSettings?.responsive
479
- }) : null, V || fe ? /* @__PURE__ */ (0, R.jsx)(re, {
480
- vSpec: s,
481
- filterValues: v,
482
- hoverColor: q,
483
- onItemClick: b,
484
- selectedValues: U,
485
- appliedValues: T.applied ?? [],
486
- searchTerm: h
487
- }) : /* @__PURE__ */ (0, R.jsx)(se, {
488
- vSpec: s,
489
- filterValues: v,
490
- hoverColor: q,
491
- onItemClick: b,
492
- selectedValues: U,
493
- appliedValues: T.applied ?? [],
494
- searchTerm: h
495
- })]
496
- })
497
- })
498
- ]
499
- })
500
- }), D && /* @__PURE__ */ (0, R.jsx)(S, {
501
- color: "secondary",
502
- style: { borderRadius: `0 0 ${W}px ${W}px` },
503
- className: L.unlockButtonStyles,
504
- onClick: E,
505
- children: /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)(c, { fill: "white" }), "Unlock"] })
506
- })]
507
- })
508
- })
509
- }),
510
- children: n
511
- });
512
- }
513
- function U(e, t) {
514
- let n = e === "top" ? "marginBottom" : "marginTop";
515
- return { [`&[data-popper-placement*="${e}"]`]: { "& .MuiTooltip-tooltip": {
516
- [n]: 8,
517
- ...t && {
518
- [w.md]: { [n]: 6 },
519
- [w.sm]: { [n]: 4 },
520
- [w.xs]: { [n]: 2 }
521
- }
522
- } } };
523
- }
524
- var W = {
525
- backgroundColor: "transparent",
526
- borderEnabled: !1
527
- }, G = ({ vSpec: e, filterValues: t, isPreview: n, vTheme: r, loadMoreData: i, searchTerm: a, setSearchTerm: s, allValuesLoaded: c, isSearching: l = !1, isApplyingFilters: u = !1 }) => {
528
- let d = (0, I.useRef)(), [f, p] = (0, I.useState)(!1), [h, y] = (0, I.useState)(a), b = e.dimensions[0]?.formatter, x = t.map((e) => e.dimension), [S, C] = ne(e), { quickSelection: w } = le(e), ee = e.filterSettings?.defaultNotState ? F.FilterOperator.NotInList : F.FilterOperator.InList, [te] = v(n ? [] : [{
529
- dataItem: e.dimensions[0]?.dataItem,
530
- dateLevel: e.dimensions[0]?.dateLevel,
531
- datePart: e.dimensions[0]?.datePart,
532
- values: x
533
- }], {
534
- disabled: n,
535
- state: w ? F.SelectionState.APPLIED : void 0,
536
- defaultOperator: ee,
537
- commitHistory: w
538
- }), re = (0, I.useMemo)(() => (0, ue.default)((e) => s(e), 300), [s]), { onClear: ie, onClick: ae, onDeselectAll: oe, onSelectExcluded: E, onSelectAll: se, onNotOperatorChange: ce, state: k, operators: A, field: j } = te ?? m, M = k.pending ?? k.applied ?? [], { isFieldLocked: N, toggleFieldLock: P } = _(j), L = g([j]), z = (e) => {
539
- y(e), re(e);
540
- }, B = t;
541
- return N && (B = t.filter((e) => M.includes(e.dimension))), /* @__PURE__ */ (0, R.jsx)(D, {
542
- noBorder: !0,
543
- vTheme: r,
544
- filterStyle: W,
545
- fontSize: e.filterSettings?.fontStyle?.fontSize ?? o.fontSize,
546
- children: /* @__PURE__ */ (0, R.jsx)(O.Provider, {
547
- value: {
548
- appliedOperator: A.applied,
549
- pendingOperator: A.pending
550
- },
551
- children: /* @__PURE__ */ (0, R.jsx)(H, {
552
- isOpen: f,
553
- isPreview: n,
554
- vSpec: e,
555
- vTheme: r,
556
- allValuesLoaded: c,
557
- localSearch: h,
558
- searchTerm: a,
559
- headerElement: d,
560
- setIsOpen: p,
561
- onSearchChange: z,
562
- setLocalSearch: y,
563
- loadMoreData: i,
564
- filterValues: B,
565
- onNotOperatorChange: ce,
566
- onClick: ae,
567
- onDeselectAll: oe,
568
- onSelectAll: se,
569
- onClear: ie,
570
- onSelectExcluded: E,
571
- state: k,
572
- onLockClick: P,
573
- isLocked: N,
574
- isSingleSelectField: L,
575
- isSearching: l,
576
- isApplyingFilters: u,
577
- children: /* @__PURE__ */ (0, R.jsx)("div", {
578
- ref: d,
579
- style: { height: "100%" },
580
- children: /* @__PURE__ */ (0, R.jsx)(T, {
581
- measureTitle: C,
582
- dimensionTitle: S,
583
- isOpen: f,
584
- onToggle: () => p(!f),
585
- dimensionFormatter: b,
586
- selectedValues: M,
587
- fontStyle: e.filterSettings?.fontStyle,
588
- filterStyle: e.filterSettings?.filterStyle,
589
- responsive: e?.filterSettings?.responsive,
590
- isLocked: N
591
- })
592
- })
593
- })
594
- })
595
- });
596
- }, K = [
597
- { value: "Value 1" },
598
- { value: "Value 2" },
599
- { value: "Value 3" },
600
- { value: "Value 4" },
601
- { value: "Value 5" },
602
- { value: "Value 6" },
603
- { value: "Value 7" },
604
- { value: "Value 8" },
605
- { value: "Value 9" },
606
- { value: "Value 10" },
607
- { value: "Value 11" }
608
- ], q = ({ vSpec: e, vTheme: t }) => {
609
- let a = K.map((e) => ({ dimension: e.value })), o = {
610
- ...e,
611
- dimensions: [{
612
- dataItem: {
613
- internalKey: null,
614
- uniqueSignature: n(),
615
- schema: "excel",
616
- view: "pokemon",
617
- name: "city",
618
- dataType: F.FieldType.STRING,
619
- type: r.Dimension
620
- },
621
- label: "Dimension"
622
- }],
623
- measures: []
624
- };
625
- return e.filterSettings.mode === i.Dropdown ? /* @__PURE__ */ (0, R.jsx)(G, {
626
- allValuesLoaded: !0,
627
- vSpec: o,
628
- vTheme: t,
629
- filterValues: a,
630
- isPreview: !0,
631
- searchTerm: "",
632
- setSearchTerm: () => null,
633
- loadMoreData: () => null
634
- }) : /* @__PURE__ */ (0, R.jsx)(V, {
635
- allValuesLoaded: !0,
636
- vSpec: o,
637
- vTheme: t,
638
- filterValues: a,
639
- isPreview: !0,
640
- searchTerm: "",
641
- setSearchTerm: () => null,
642
- loadMoreData: () => null
643
- });
644
- }, J = p(({ vSpec: e, filterValues: t = [], vTheme: n, loadMoreData: r, searchTerm: a, setSearchTerm: o, allValuesLoaded: c, isSearching: l = !1, isApplyingFilters: u = !1 }) => {
645
- let d = h();
646
- if ((0, I.useEffect)(() => {
647
- e?.dimensions?.length < 2 && d();
648
- }, [e]), !e?.dimensions?.length && e?.dimensions !== void 0) return /* @__PURE__ */ (0, R.jsx)(q, {
649
- vSpec: {
650
- ...e,
651
- filterSettings: {
652
- ...e.filterSettings,
653
- mode: e.filterSettings?.mode ?? i.Listbox,
654
- source: e.filterSettings?.source ?? s.Engine
655
- }
656
- },
657
- vTheme: n
658
- });
659
- if (e?.dimensions === void 0 || !e?.filterSettings?.mode || !e?.filterSettings?.source) return null;
660
- switch (e.filterSettings.mode) {
661
- case i.Image: return null;
662
- case i.Dropdown: return /* @__PURE__ */ (0, R.jsx)(G, {
663
- allValuesLoaded: c,
664
- vSpec: e,
665
- vTheme: n,
666
- filterValues: t,
667
- loadMoreData: r,
668
- searchTerm: a,
669
- setSearchTerm: o,
670
- isSearching: l,
671
- isApplyingFilters: u
672
- });
673
- case i.Listbox:
674
- default: return /* @__PURE__ */ (0, R.jsx)(V, {
675
- allValuesLoaded: c,
676
- vSpec: e,
677
- vTheme: n,
678
- filterValues: t,
679
- loadMoreData: r,
680
- searchTerm: a,
681
- setSearchTerm: o,
682
- isSearching: l,
683
- isApplyingFilters: u
684
- });
685
- }
686
- });
687
- export { J as Filter };