@astrato-io/visualizations 0.6.4 → 0.7.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 (220) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/README.md +32 -2
  3. package/THIRD_PARTY_NOTICES.md +68 -205
  4. package/VISUALIZATION_DEFINITIONS.md +68 -114
  5. package/chunks/Button-BrGKp9Nm.js +110 -0
  6. package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
  7. package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
  8. package/chunks/{LinearProgress-CUZ0D8_t.js → LinearProgress-VtfFx2vJ.js} +51 -51
  9. package/chunks/MenuOption-ByRqhRdX.js +3934 -0
  10. package/chunks/Title-CO5dP1ma.js +1691 -0
  11. package/chunks/ToggleButton-KOBAimC1.js +112 -0
  12. package/chunks/app-filter-bar.compiler-TwVTeoj5.js +64 -0
  13. package/chunks/bar.compiler-DuQg8EUb.js +374 -0
  14. package/chunks/builder-DEDvNq1k.js +201 -0
  15. package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
  16. package/chunks/color-settings-3VRlf_Vw.js +6 -0
  17. package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
  18. package/chunks/coloring-CncX_JRX.js +278 -0
  19. package/chunks/{src-BC7cGcJ-.js → definitions-BPJQTx16.js} +650 -464
  20. package/chunks/{escobar-BGqT1EsE.js → escobar-DRhRMYRE.js} +6282 -4931
  21. package/chunks/event-bus-CrLB-Y8z.js +3 -0
  22. package/chunks/extend-preset-CUFNpmPe.js +4398 -0
  23. package/chunks/filter.compiler-w27dlv0C.js +70 -0
  24. package/chunks/filtering-cc7WqWpg.js +1153 -0
  25. package/chunks/handlers-TOT-7INo.js +12871 -0
  26. package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
  27. package/chunks/isEqual-B8loyPsC.js +12 -0
  28. package/chunks/label-format-type-weq1XfcX.js +8 -0
  29. package/chunks/line.compiler-Ct1WhN2p.js +198 -0
  30. package/chunks/logger-DpQtYQnX.js +1163 -0
  31. package/chunks/lookup-BWllin0q.js +36 -0
  32. package/chunks/{metadata-CPXdYoln.js → metadata-WABZrt7Y.js} +1 -1
  33. package/chunks/number.compiler-D8TPly-4.js +53 -0
  34. package/chunks/{src-C0LgoUWY.js → operations-Dh4v1Ovt.js} +7716 -7541
  35. package/chunks/{range-DrzdfBX4.js → range-Bi-7zT0k.js} +2 -2
  36. package/chunks/registry-KervaxqJ.js +31 -0
  37. package/chunks/render-wrappers-OEmtaM8g.js +2 -0
  38. package/chunks/{registry-CExpGJ1N.js → requirements-PAoRaJyb.js} +294 -326
  39. package/chunks/responsive.styles-DSiOGD7u.js +82 -0
  40. package/chunks/shared-Bn4N5QcZ.js +1218 -0
  41. package/chunks/src-77e3mC7i.js +391 -0
  42. package/chunks/standalone-B55oyW6c.js +689 -0
  43. package/chunks/{standalone-CY57qwZ-.js → standalone-BDhPQtzQ.js} +386 -352
  44. package/chunks/{standalone-BDCwI6Hn.js → standalone-BGkmozIb.js} +1108 -953
  45. package/chunks/standalone-BMTCb10X.js +179 -0
  46. package/chunks/standalone-BXKRE_Se.js +468 -0
  47. package/chunks/standalone-Bes8srx1.js +354 -0
  48. package/chunks/standalone-BjZp0QMe.js +2 -0
  49. package/chunks/{standalone-BH5NqDwp.js → standalone-BlMIwpEe.js} +687 -573
  50. package/chunks/{standalone-CCNtaJ7s.js → standalone-C8ZAEutO.js} +44 -43
  51. package/chunks/standalone-C8qAelL4.js +2 -0
  52. package/chunks/standalone-CJvIXsQE.js +743 -0
  53. package/chunks/standalone-CLmGb7nn2.js +355 -0
  54. package/chunks/{ui-D1HQNIBy.js → standalone-CM5XcAN5.js} +15946 -17658
  55. package/chunks/standalone-CXNP6-xD.js +420 -0
  56. package/chunks/{standalone-BYm1UjLr.js → standalone-D5Q5ngsD.js} +59 -57
  57. package/chunks/standalone-DLlyRIE6.js +287 -0
  58. package/chunks/standalone-DMcI1afI.js +396 -0
  59. package/chunks/{standalone-jiz0L2Dg.js → standalone-DN4S1MjT.js} +1113 -1094
  60. package/chunks/{standalone-QJ1kKMnO.js → standalone-DT0wKji7.js} +2 -2
  61. package/chunks/{standalone-D5vnf-9y.js → standalone-DVTJwsTY.js} +1110 -1035
  62. package/chunks/standalone-DW6NT205.js +518 -0
  63. package/chunks/standalone-DYQIQH4c.js +2095 -0
  64. package/chunks/standalone-D__XCp-h.js +1003 -0
  65. package/chunks/standalone-XTgSsTAa.js +354 -0
  66. package/chunks/standalone-XuGksArp.js +68 -0
  67. package/chunks/{standalone-CNyNHKVx.js → standalone-we5D5MIn.js} +176 -172
  68. package/chunks/table.compiler-DMeeHxb6.js +222 -0
  69. package/chunks/useFieldName-Cjn9KCVp.js +7 -0
  70. package/chunks/useSlotProps-DLbQp4lc.js +166 -0
  71. package/chunks/{utils-Ba9T0TqC.js → utils-vdmi_2PK.js} +6266 -6517
  72. package/chunks/{src-DvX5LU9T.js → view-BuwQugKb.js} +2893 -5956
  73. package/chunks/visualization-filters-Cc4KU-l-.js +7455 -0
  74. package/chunks/web-components-DqClFkgO.js +1185 -0
  75. package/chunks/with-html-element-D0uY2zjI.js +7328 -0
  76. package/definitions.js +3 -3
  77. package/docs/operations/astrato-app-filter-bar.md +17 -17
  78. package/docs/operations/bar.md +1006 -1071
  79. package/docs/operations/combo.md +717 -738
  80. package/docs/operations/date-picker.md +27 -27
  81. package/docs/operations/distribution-gauge.md +471 -607
  82. package/docs/operations/dot.md +787 -879
  83. package/docs/operations/filter.md +139 -163
  84. package/docs/operations/gauge.md +491 -627
  85. package/docs/operations/heatMap.md +834 -916
  86. package/docs/operations/histogram.md +166 -180
  87. package/docs/operations/iframe.md +5 -5
  88. package/docs/operations/image.md +16 -16
  89. package/docs/operations/index.md +12 -12
  90. package/docs/operations/line.md +811 -888
  91. package/docs/operations/number.md +470 -536
  92. package/docs/operations/pie.md +825 -958
  93. package/docs/operations/radar.md +599 -679
  94. package/docs/operations/sankey.md +462 -584
  95. package/docs/operations/scatter.md +823 -929
  96. package/docs/operations/shape.md +34 -34
  97. package/docs/operations/simpleTextObject.md +18 -25
  98. package/docs/operations/slider.md +33 -43
  99. package/docs/operations/table.md +1177 -1150
  100. package/docs/operations/tree.md +404 -397
  101. package/docs/operations/treemap.md +595 -673
  102. package/docs/operations/waterfall.md +369 -379
  103. package/docs/operations/word-cloud.md +512 -583
  104. package/getters.js +7 -7
  105. package/index.js +3 -1183
  106. package/metadata.js +18 -18
  107. package/operations.js +13 -13
  108. package/package.json +133 -88
  109. package/render.js +10 -0
  110. package/src/charts/bar.d.ts +1 -0
  111. package/src/charts/combo.d.ts +1 -0
  112. package/src/charts/dot.d.ts +1 -0
  113. package/src/charts/gauge-distribution.d.ts +1 -0
  114. package/src/charts/gauge.d.ts +1 -0
  115. package/src/charts/heat-map.d.ts +1 -0
  116. package/src/charts/histogram.d.ts +1 -0
  117. package/src/charts/line.d.ts +1 -0
  118. package/src/charts/pie.d.ts +1 -0
  119. package/src/charts/radar.d.ts +1 -0
  120. package/src/charts/sankey.d.ts +1 -0
  121. package/src/charts/scatter.d.ts +1 -0
  122. package/src/charts/table.d.ts +1 -0
  123. package/src/charts/tree.d.ts +1 -0
  124. package/src/charts/treemap.d.ts +1 -0
  125. package/src/charts/waterfall.d.ts +1 -0
  126. package/src/charts/word-cloud.d.ts +1 -0
  127. package/src/definitions/index.d.ts +2 -2
  128. package/src/definitions/{shared/lib → model/definitions}/available-fields.d.ts +0 -1
  129. package/src/definitions/{shared/lib/compilers/index.d.ts → model/definitions/compilers/compile.d.ts} +1 -1
  130. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  131. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1364 -0
  132. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  133. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  134. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  135. package/src/definitions/model/definitions/index.d.ts +23 -0
  136. package/src/definitions/{shared/lib → model/definitions}/registry/compile.d.ts +1 -1
  137. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  138. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  139. package/src/definitions/{shared/lib → model/definitions}/schemas/broad-chart.schema.d.ts +1 -1
  140. package/src/definitions/{shared/lib → model/definitions}/schemas/common.schema.d.ts +0 -1
  141. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  142. package/src/definitions/{shared/lib → model/definitions}/schemas/object.schema.d.ts +8 -8
  143. package/src/definitions/{shared/lib → model/definitions}/types/compilation.types.d.ts +10 -0
  144. package/src/definitions/{shared/lib → model/definitions}/types/definition.types.d.ts +1 -1
  145. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  146. package/src/definitions/{shared/lib/registry → model/definitions}/validation.d.ts +1 -1
  147. package/src/getters/index.d.ts +3 -3
  148. package/src/index.d.ts +1 -1
  149. package/src/objects/app-filter-bar.d.ts +1 -0
  150. package/src/objects/date-picker.d.ts +1 -0
  151. package/src/objects/filter.d.ts +1 -0
  152. package/src/objects/iframe.d.ts +1 -0
  153. package/src/objects/image.d.ts +1 -0
  154. package/src/objects/number.d.ts +1 -0
  155. package/src/objects/shape.d.ts +1 -0
  156. package/src/objects/slider.d.ts +1 -0
  157. package/src/objects/text.d.ts +1 -0
  158. package/src/operations/index.d.ts +3 -3
  159. package/src/registry/create-visualization-registry.d.ts +5 -0
  160. package/src/render/index.d.ts +34 -0
  161. package/src/runtime/index.d.ts +2 -2
  162. package/src/types.d.ts +9 -4
  163. package/src/web-components/index.d.ts +3 -3
  164. package/chunks/Radio-Ciu-F4CU.js +0 -957
  165. package/chunks/ToggleButton-BCJc3Jlc.js +0 -153
  166. package/chunks/_baseFlatten-DPXPOrea.js +0 -7076
  167. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +0 -55
  168. package/chunks/bar.compiler-oqaPzIut.js +0 -370
  169. package/chunks/coloring-C16AUZEi.js +0 -663
  170. package/chunks/data-item-resolution-1lvYB5ln.js +0 -53
  171. package/chunks/event-bus-KiSiCJrC.js +0 -2683
  172. package/chunks/events-WZut5Ow6.js +0 -4
  173. package/chunks/filter.compiler-CuLtc_02.js +0 -60
  174. package/chunks/filtering-Yq4DEa0t.js +0 -953
  175. package/chunks/gauge-target-type-BkKXAqkX.js +0 -4
  176. package/chunks/grouping-type-BX_9Ix5q.js +0 -3
  177. package/chunks/interfaces-VUY4_yVO.js +0 -8742
  178. package/chunks/line-settings-DfYTUyPz.js +0 -4
  179. package/chunks/line.compiler-BpA_6Tc7.js +0 -188
  180. package/chunks/number.compiler-DbkWcG4S.js +0 -44
  181. package/chunks/pie-uv42Eqal.js +0 -10
  182. package/chunks/requirements-DNhuShLS.js +0 -6
  183. package/chunks/shared-CKDL4hx9.js +0 -1171
  184. package/chunks/src-Cum_2NLV.js +0 -12145
  185. package/chunks/src-Dun_jXtz.js +0 -10295
  186. package/chunks/standalone-87YV_m9n.js +0 -687
  187. package/chunks/standalone-BLVAWLNJ.js +0 -385
  188. package/chunks/standalone-BPomtAVs.js +0 -2
  189. package/chunks/standalone-BXyBcUOQ.js +0 -2
  190. package/chunks/standalone-BllF4rDp.js +0 -383
  191. package/chunks/standalone-BmfMt74U.js +0 -726
  192. package/chunks/standalone-BqWyrnZI.js +0 -281
  193. package/chunks/standalone-C85u7U6I.js +0 -340
  194. package/chunks/standalone-CDQnr6qT.js +0 -345
  195. package/chunks/standalone-CZynjFG7.js +0 -12979
  196. package/chunks/standalone-DFPva_ku.js +0 -299
  197. package/chunks/standalone-DQxxNwF8.js +0 -675
  198. package/chunks/standalone-DS9T0FZ-.js +0 -830
  199. package/chunks/standalone-Dx3MLlrO.js +0 -512
  200. package/chunks/standalone-DzixzZAL.js +0 -411
  201. package/chunks/standalone-lBm9hQ-q.js +0 -179
  202. package/chunks/standalone-rJ45Zfl1.js +0 -68
  203. package/chunks/table.compiler-BrXkm4Fz.js +0 -213
  204. package/chunks/toInteger-DVZr-D1j.js +0 -11
  205. package/chunks/treemap-x_zmJoG7.js +0 -23
  206. package/chunks/types-dVVCsDWD.js +0 -4
  207. package/chunks/useFieldName-oqQ3bvnO.js +0 -7
  208. package/chunks/view-CLqWMV7Z.js +0 -156
  209. package/src/definitions/shared/index.d.ts +0 -5
  210. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +0 -587
  211. package/src/definitions/shared/lib/registry/index.d.ts +0 -3
  212. package/src/definitions/shared/lib/schemas/index.d.ts +0 -9
  213. package/src/definitions/shared/lib/types/index.d.ts +0 -3
  214. package/src/definitions/{shared/lib → model/definitions}/schemas/app-filter-bar.schema.d.ts +0 -0
  215. package/src/definitions/{shared/lib → model/definitions}/schemas/bar.schema.d.ts +0 -0
  216. package/src/definitions/{shared/lib → model/definitions}/schemas/filter.schema.d.ts +0 -0
  217. package/src/definitions/{shared/lib → model/definitions}/schemas/line.schema.d.ts +0 -0
  218. package/src/definitions/{shared/lib → model/definitions}/schemas/number.schema.d.ts +0 -0
  219. package/src/definitions/{shared/lib → model/definitions}/schemas/table.schema.d.ts +4 -4
  220. /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 };