@embeddable.com/remarkable-pro 0.3.0 → 0.3.1

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 (88) hide show
  1. package/dist/ComparisonPeriodSelectFieldPro.js +1 -1
  2. package/dist/DonutChartPro.js +1 -1
  3. package/dist/DonutLabelChartPro.js +1 -1
  4. package/dist/FilterBuilderPro.js +6 -599
  5. package/dist/FilterBuilderPro.js.map +1 -1
  6. package/dist/KpiChartNumberComparisonPro.js +1 -1
  7. package/dist/KpiChartNumberPro.js +1 -1
  8. package/dist/LineChartComparisonDefaultPro.js +1 -1
  9. package/dist/LineChartComparisonWithKpiTabsPro.js +1 -1
  10. package/dist/LineChartWithKpiTabsPro.js +1 -1
  11. package/dist/PieChartPro.js +1 -1
  12. package/dist/components/charts/kpis/KpiChartNumberComparisonPro/KpiChartNumberComparisonPro.emb.d.ts +3 -1
  13. package/dist/components/charts/kpis/KpiChartNumberComparisonPro/KpiChartNumberComparisonPro.emb.d.ts.map +1 -1
  14. package/dist/components/charts/kpis/KpiChartNumberComparisonPro/definition.d.ts +6 -2
  15. package/dist/components/charts/kpis/KpiChartNumberComparisonPro/definition.d.ts.map +1 -1
  16. package/dist/components/charts/kpis/KpiChartNumberPro/KpiChartNumberPro.emb.d.ts +2 -0
  17. package/dist/components/charts/kpis/KpiChartNumberPro/KpiChartNumberPro.emb.d.ts.map +1 -1
  18. package/dist/components/charts/kpis/KpiChartNumberPro/definition.d.ts +4 -0
  19. package/dist/components/charts/kpis/KpiChartNumberPro/definition.d.ts.map +1 -1
  20. package/dist/components/charts/lines/LineChartComparisonDefaultPro/LineChartComparisonDefaultPro.emb.d.ts +1 -1
  21. package/dist/components/charts/lines/LineChartComparisonDefaultPro/definition.d.ts +2 -2
  22. package/dist/components/charts/lines/LineChartComparisonDefaultPro/definition.d.ts.map +1 -1
  23. package/dist/components/charts/lines/LineChartComparisonWithKpiTabsPro/LineChartComparisonWithKpiTabsPro.emb.d.ts +3 -1
  24. package/dist/components/charts/lines/LineChartComparisonWithKpiTabsPro/LineChartComparisonWithKpiTabsPro.emb.d.ts.map +1 -1
  25. package/dist/components/charts/lines/LineChartComparisonWithKpiTabsPro/definition.d.ts +10 -6
  26. package/dist/components/charts/lines/LineChartComparisonWithKpiTabsPro/definition.d.ts.map +1 -1
  27. package/dist/components/charts/lines/LineChartWithKpiTabsPro/LineChartWithKpiTabsPro.emb.d.ts +2 -0
  28. package/dist/components/charts/lines/LineChartWithKpiTabsPro/LineChartWithKpiTabsPro.emb.d.ts.map +1 -1
  29. package/dist/components/charts/lines/LineChartWithKpiTabsPro/definition.d.ts +4 -0
  30. package/dist/components/charts/lines/LineChartWithKpiTabsPro/definition.d.ts.map +1 -1
  31. package/dist/components/charts/pies/DonutChartPro/DonutChartPro.emb.d.ts +2 -0
  32. package/dist/components/charts/pies/DonutChartPro/DonutChartPro.emb.d.ts.map +1 -1
  33. package/dist/components/charts/pies/DonutChartPro/definition.d.ts +4 -0
  34. package/dist/components/charts/pies/DonutChartPro/definition.d.ts.map +1 -1
  35. package/dist/components/charts/pies/DonutLabelChartPro/DonutLabelChartPro.emb.d.ts +2 -0
  36. package/dist/components/charts/pies/DonutLabelChartPro/DonutLabelChartPro.emb.d.ts.map +1 -1
  37. package/dist/components/charts/pies/DonutLabelChartPro/definition.d.ts +4 -0
  38. package/dist/components/charts/pies/DonutLabelChartPro/definition.d.ts.map +1 -1
  39. package/dist/components/charts/pies/PieChartPro/PieChartPro.emb.d.ts +2 -0
  40. package/dist/components/charts/pies/PieChartPro/PieChartPro.emb.d.ts.map +1 -1
  41. package/dist/components/charts/pies/PieChartPro/definition.d.ts +4 -0
  42. package/dist/components/charts/pies/PieChartPro/definition.d.ts.map +1 -1
  43. package/dist/components/editors/ComparisonPeriodSelectFieldPro/ComparisonPeriodSelectFieldPro.emb.d.ts +1 -1
  44. package/dist/components/editors/ComparisonPeriodSelectFieldPro/definition.d.ts +3 -3
  45. package/dist/{definition-BPveF-o0.js → definition-9Sm_nFEr.js} +27 -25
  46. package/dist/definition-9Sm_nFEr.js.map +1 -0
  47. package/dist/{definition-BR7yIGzM.js → definition-BdoMwDGX.js} +32 -30
  48. package/dist/definition-BdoMwDGX.js.map +1 -0
  49. package/dist/{definition-BVvy48Df.js → definition-BiIMsrRD.js} +31 -29
  50. package/dist/definition-BiIMsrRD.js.map +1 -0
  51. package/dist/{definition-DvjcMLKk.js → definition-CaY0LXUV.js} +45 -45
  52. package/dist/definition-CaY0LXUV.js.map +1 -0
  53. package/dist/{definition-C-9Q3Ivg.js → definition-CavPpbuT.js} +3 -1
  54. package/dist/definition-CavPpbuT.js.map +1 -0
  55. package/dist/{definition-BZ7Wtvg5.js → definition-CyVZRIeo.js} +14 -14
  56. package/dist/{definition-BZ7Wtvg5.js.map → definition-CyVZRIeo.js.map} +1 -1
  57. package/dist/{definition-CJuA3KVA.js → definition-FRpWLnQJ.js} +20 -18
  58. package/dist/definition-FRpWLnQJ.js.map +1 -0
  59. package/dist/{definition-Vo_CL9pX.js → definition-RwKqVDfv.js} +31 -29
  60. package/dist/definition-RwKqVDfv.js.map +1 -0
  61. package/dist/definition-es5n86g4.js +604 -0
  62. package/dist/definition-es5n86g4.js.map +1 -0
  63. package/dist/{definition-DQdIv_3r.js → definition-xgUWvTDV.js} +25 -23
  64. package/dist/definition-xgUWvTDV.js.map +1 -0
  65. package/dist/embeddable-components.json +54 -54
  66. package/dist/index.d.ts +3 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +50 -47
  69. package/dist/index.js.map +1 -1
  70. package/dist/meta/ComparisonPeriodSelectFieldPro.meta.json +1 -1
  71. package/dist/meta/DonutChartPro.meta.json +2 -0
  72. package/dist/meta/DonutLabelChartPro.meta.json +2 -0
  73. package/dist/meta/KpiChartNumberComparisonPro.meta.json +3 -1
  74. package/dist/meta/KpiChartNumberPro.meta.json +2 -0
  75. package/dist/meta/LineChartComparisonDefaultPro.meta.json +1 -1
  76. package/dist/meta/LineChartComparisonWithKpiTabsPro.meta.json +4 -2
  77. package/dist/meta/LineChartWithKpiTabsPro.meta.json +3 -1
  78. package/dist/meta/PieChartPro.meta.json +2 -0
  79. package/dist/meta/index.json +1 -1
  80. package/package.json +1 -1
  81. package/dist/definition-BPveF-o0.js.map +0 -1
  82. package/dist/definition-BR7yIGzM.js.map +0 -1
  83. package/dist/definition-BVvy48Df.js.map +0 -1
  84. package/dist/definition-C-9Q3Ivg.js.map +0 -1
  85. package/dist/definition-CJuA3KVA.js.map +0 -1
  86. package/dist/definition-DQdIv_3r.js.map +0 -1
  87. package/dist/definition-DvjcMLKk.js.map +0 -1
  88. package/dist/definition-Vo_CL9pX.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as o } from "@embeddable.com/react";
2
- import { c as e } from "./definition-BZ7Wtvg5.js";
2
+ import { c as e } from "./definition-CyVZRIeo.js";
3
3
  const m = e.preview, r = e.meta, n = o(
4
4
  e.Component,
5
5
  r,
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as t } from "@embeddable.com/react";
2
- import { d as o } from "./definition-BPveF-o0.js";
2
+ import { d as o } from "./definition-9Sm_nFEr.js";
3
3
  const m = o.preview, e = o.meta, a = t(o.Component, e, o.config);
4
4
  export {
5
5
  a as default,
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as e } from "@embeddable.com/react";
2
- import { d as o } from "./definition-CJuA3KVA.js";
2
+ import { d as o } from "./definition-FRpWLnQJ.js";
3
3
  const a = o.preview, t = o.meta, m = e(o.Component, t, o.config);
4
4
  export {
5
5
  m as default,
@@ -1,602 +1,9 @@
1
- import { useTheme as he, definePreview as ve, defineComponent as Oe } from "@embeddable.com/react";
2
- import { X as Be, ae as te, a7 as s, N as j, F as m, t as Ne, E as W, n as _e, o as ne, W as Fe, I as ye, m as Ce, A as be, V as xe, a8 as je } from "./index-Cddhb628.js";
3
- import Me, { useState as T, useRef as R, useEffect as b, useCallback as Te } from "react";
4
- import { g as U } from "./dimensionsAndMeasures.utils-SAlbbzn4.js";
5
- import { a as h, i as Ae, r as we } from "./component.utils-oQMZT7TK.js";
6
- import { b as Se } from "./formatter.utils-Dm_mQlX1.js";
7
- import { E as Ie } from "./EditorCard-DOCprGOC.js";
8
- import { i as w } from "./component.inputs.constants-BFlnzCwS.js";
9
- /**
10
- * @license @tabler/icons-react v3.44.0 - MIT
11
- *
12
- * This source code is licensed under the MIT license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */
15
- const Re = [["path", { d: "M12 5l0 14", key: "svg-0" }], ["path", { d: "M5 12l14 0", key: "svg-1" }]], oe = Be("outline", "plus", "Plus", Re), qe = "_container_2pz3g_1", De = "_scroll_2pz3g_13", Le = "_filter_2pz3g_26", ze = "_addButton_2pz3g_32", Ve = "_memberButton_2pz3g_60", Ee = "_deleteButton_2pz3g_83", Pe = "_operatorButton_2pz3g_114", $e = "_valueButton_2pz3g_138", ke = "_loadingSpinner_2pz3g_175", We = "_valueButtonEmpty_2pz3g_183", Je = "_clearButton_2pz3g_187", Ue = "_scrollRightButton_2pz3g_207", Xe = "_scrollLeftButton_2pz3g_240", He = "_valueInput_2pz3g_273", O = {
16
- container: qe,
17
- scroll: De,
18
- filter: Le,
19
- addButton: ze,
20
- memberButton: Ve,
21
- deleteButton: Ee,
22
- operatorButton: Pe,
23
- valueButton: $e,
24
- loadingSpinner: ke,
25
- valueButtonEmpty: We,
26
- clearButton: Je,
27
- scrollRightButton: Ue,
28
- scrollLeftButton: Xe,
29
- valueInput: He
30
- }, J = (e) => e.target.value === "" ? null : Number(e.target.value), Ke = ({
31
- filter: e,
32
- onSelectValue: r
33
- }) => {
34
- const [o, f] = T((e == null ? void 0 : e.value) ?? null), [u, c] = T(
35
- Array.isArray(e.value) ? e.value[0] ?? null : null
36
- ), [n, i] = T(
37
- Array.isArray(e.value) ? e.value[1] ?? null : null
38
- ), p = R(null), d = te((v) => {
39
- r(v);
40
- });
41
- return b(() => {
42
- u != null && n != null && d([u, n]);
43
- }, [u, n, d]), b(() => {
44
- o != null && d(o);
45
- }, [o, d]), b(() => {
46
- setTimeout(() => {
47
- var v;
48
- (v = p.current) == null || v.focus();
49
- }, 100);
50
- }, [e.operator]), e.operator === "between" ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
51
- /* @__PURE__ */ s.jsx(
52
- "input",
53
- {
54
- ref: p,
55
- type: "number",
56
- className: O.valueInput,
57
- value: u ?? "",
58
- onChange: (v) => c(J(v))
59
- }
60
- ),
61
- /* @__PURE__ */ s.jsx("button", { disabled: !0, className: O.operatorButton, children: h.t("editors.filterBuilder.betweenAnd") }),
62
- /* @__PURE__ */ s.jsx(
63
- "input",
64
- {
65
- type: "number",
66
- className: O.valueInput,
67
- value: n ?? "",
68
- onChange: (v) => i(J(v))
69
- }
70
- )
71
- ] }) : /* @__PURE__ */ s.jsx(
72
- "input",
73
- {
74
- ref: p,
75
- type: "number",
76
- className: O.valueInput,
77
- value: o ?? "",
78
- onChange: (v) => f(J(v))
79
- }
80
- );
81
- }, Ye = ({
82
- filter: e,
83
- onSelectValue: r
84
- }) => {
85
- const [o, f] = T((e == null ? void 0 : e.value) ?? ""), u = R(null), c = te((n) => {
86
- r(n);
87
- });
88
- return b(() => {
89
- c(o || null);
90
- }, [o, c]), b(() => {
91
- setTimeout(() => {
92
- var n;
93
- (n = u.current) == null || n.focus();
94
- }, 100);
95
- }, [e.operator]), /* @__PURE__ */ s.jsx(
96
- "input",
97
- {
98
- ref: u,
99
- type: "text",
100
- className: O.valueInput,
101
- value: o,
102
- onChange: (n) => f(n.target.value)
103
- }
104
- );
105
- }, g = {
106
- is: "is",
107
- isNot: "isNot",
108
- isOneOf: "isOneOf",
109
- isNotOneOf: "isNotOneOf",
110
- contains: "contains"
111
- }, Ge = {
112
- [g.is]: m.equals,
113
- [g.isNot]: m.notEquals,
114
- [g.isOneOf]: m.contains,
115
- [g.isNotOneOf]: m.notContains,
116
- [g.contains]: m.contains
117
- }, F = {
118
- equals: m.equals,
119
- notEquals: m.notEquals,
120
- gte: m.gte,
121
- lte: m.lte,
122
- between: "between"
123
- }, Qe = {
124
- [F.equals]: m.equals,
125
- [F.notEquals]: m.notEquals,
126
- [F.gte]: m.gte,
127
- [F.lte]: m.lte
128
- }, X = {
129
- AND: "and"
130
- }, Ze = [
131
- j.string,
132
- j.boolean,
133
- j.number
134
- ], se = (e) => e.filter(
135
- (r) => Ze.includes(r.nativeType)
136
- ), et = (e) => {
137
- var o;
138
- if (e.operator === F.between && ((o = e.dimensionOrMeasure) == null ? void 0 : o.nativeType) === j.number) {
139
- const [f, u] = e.value;
140
- return [
141
- {
142
- operator: X.AND,
143
- clauses: [
144
- { property: e.dimensionOrMeasure.name, operator: m.gte, value: f },
145
- { property: e.dimensionOrMeasure.name, operator: m.lte, value: u }
146
- ]
147
- }
148
- ];
149
- }
150
- const r = Ge[e.operator] ?? Qe[e.operator];
151
- return [{ property: e.dimensionOrMeasure.name, operator: r, value: e.value }];
152
- }, tt = (e, r) => {
153
- const o = r.filter((f) => f.dimensionOrMeasure && f.operator && f.value != null).flatMap(et);
154
- return o.length === 0 ? null : { operator: e, clauses: o };
155
- }, nt = (e, r, o) => {
156
- if ("clauses" in e) {
157
- const p = e.clauses[0], d = e.clauses[1];
158
- if (e.operator === X.AND && e.clauses.length === 2 && p != null && d != null && "property" in p && "property" in d && p.property === d.property && p.operator === m.gte && d.operator === m.lte) {
159
- const v = r.find((M) => M.name === p.property) ?? null;
160
- return {
161
- id: o,
162
- dimensionOrMeasure: v,
163
- search: "",
164
- operator: F.between,
165
- value: [p.value, d.value]
166
- };
167
- }
168
- return null;
169
- }
170
- const { property: f, operator: u, value: c } = e, n = r.find((p) => p.name === f) ?? null;
171
- let i = null;
172
- return (n == null ? void 0 : n.nativeType) === j.number ? i = {
173
- [m.equals]: F.equals,
174
- [m.notEquals]: F.notEquals,
175
- [m.gte]: F.gte,
176
- [m.lte]: F.lte
177
- }[u] ?? null : u === m.contains ? i = Array.isArray(c) ? g.isOneOf : g.contains : i = {
178
- [m.equals]: g.is,
179
- [m.notEquals]: g.isNot,
180
- [m.notContains]: g.isNotOneOf
181
- }[u] ?? null, { id: o, dimensionOrMeasure: n, search: "", operator: i, value: c };
182
- }, ot = (e, r) => {
183
- if (!e) return [];
184
- if (!("clauses" in e)) return [];
185
- const o = [];
186
- return e.clauses.forEach((f, u) => {
187
- const c = nt(f, r, u + 1);
188
- c && o.push(c);
189
- }), o.length ? o : [];
190
- }, st = (e) => Array.isArray(e) ? e : e == null ? [] : [e], rt = (e, r) => [
191
- ...e.filter((o) => r.includes(o.value)),
192
- ...e.filter((o) => !r.includes(o.value))
193
- ], lt = (e, r) => e.length === 0 ? "..." : e.length > 2 ? `${e.length} selected` : e.map(r).join(", "), ee = ({
194
- hasValue: e,
195
- isLoading: r,
196
- displayValue: o,
197
- showClearIcon: f,
198
- onClear: u,
199
- ...c
200
- }) => /* @__PURE__ */ s.jsxs("button", { className: Fe(O.valueButton, !e && O.valueButtonEmpty), ...c, children: [
201
- r ? /* @__PURE__ */ s.jsx(_e, { className: O.loadingSpinner }) : o,
202
- f && /* @__PURE__ */ s.jsx(ne, { onClick: u })
203
- ] }), it = ({
204
- filter: e,
205
- dimensionOrMeasure: r,
206
- results: o,
207
- theme: f,
208
- onSelectValue: u,
209
- onSearchValue: c
210
- }) => {
211
- var z, V;
212
- const n = Se(f), i = R({}), p = ((z = o == null ? void 0 : o.data) == null ? void 0 : z.map((N) => ({
213
- value: N[r.name],
214
- label: n.data(r, N[r.name])
215
- }))) ?? [];
216
- p.forEach(({ value: N, label: B }) => {
217
- N != null && (i.current[N] = B);
218
- });
219
- const d = (N) => i.current[N] ?? N, v = st(e.value), M = rt(p, v), C = o == null ? void 0 : o.isLoading, S = !C && (((V = o == null ? void 0 : o.data) == null ? void 0 : V.length) ?? 0) === 0;
220
- if (r.nativeType === j.number)
221
- return /* @__PURE__ */ s.jsx(Ke, { filter: e, onSelectValue: u });
222
- if (r.nativeType === j.string && e.operator === g.contains)
223
- return /* @__PURE__ */ s.jsx(Ye, { filter: e, onSelectValue: u });
224
- const y = e.operator === g.isOneOf || e.operator === g.isNotOneOf, x = e.value != null, A = !C && x;
225
- if (y) {
226
- const N = e.value ?? [], B = lt(N, d);
227
- return /* @__PURE__ */ s.jsx(
228
- Ne,
229
- {
230
- triggerComponent: /* @__PURE__ */ s.jsx(
231
- ee,
232
- {
233
- hasValue: x,
234
- isLoading: C,
235
- displayValue: B,
236
- showClearIcon: A,
237
- onClear: () => u(null)
238
- }
239
- ),
240
- isSearchable: !0,
241
- isClearable: !0,
242
- isLoading: C,
243
- values: N,
244
- options: M,
245
- onChange: (E) => u(E.length === 0 ? null : E),
246
- onSearch: c,
247
- avoidCollisions: !1,
248
- noOptionsMessage: S ? h.t("common.noOptionsFound") : void 0
249
- }
250
- );
251
- }
252
- if (e.operator === g.is || e.operator === g.isNot) {
253
- const N = e.value != null ? d(e.value) : "...";
254
- return /* @__PURE__ */ s.jsx(
255
- W,
256
- {
257
- triggerComponent: /* @__PURE__ */ s.jsx(
258
- ee,
259
- {
260
- hasValue: x,
261
- isLoading: C,
262
- displayValue: N,
263
- showClearIcon: A,
264
- onClear: () => u(null)
265
- }
266
- ),
267
- searchable: !0,
268
- clearable: !0,
269
- isLoading: C,
270
- value: e.value,
271
- options: M,
272
- onChange: u,
273
- onSearch: c,
274
- avoidCollisions: !1,
275
- noOptionsMessage: S ? h.t("common.noOptionsFound") : void 0
276
- }
277
- );
278
- }
279
- return null;
280
- }, at = () => [
281
- { value: g.is, label: h.t("editors.filterBuilder.is") },
282
- { value: g.isNot, label: h.t("editors.filterBuilder.isNot") },
283
- { value: g.isOneOf, label: h.t("editors.filterBuilder.isOneOf") },
284
- { value: g.isNotOneOf, label: h.t("editors.filterBuilder.isNotOneOf") },
285
- { value: g.contains, label: h.t("editors.filterBuilder.contains") }
286
- ], ut = () => [
287
- { value: g.is, label: h.t("editors.filterBuilder.is") },
288
- { value: g.isNot, label: h.t("editors.filterBuilder.isNot") },
289
- { value: g.isOneOf, label: h.t("editors.filterBuilder.isOneOf") },
290
- { value: g.isNotOneOf, label: h.t("editors.filterBuilder.isNotOneOf") }
291
- ], ct = () => [
292
- { value: F.equals, label: h.t("editors.filterBuilder.equals") },
293
- { value: F.notEquals, label: h.t("editors.filterBuilder.doesNotEqual") },
294
- { value: F.gte, label: h.t("editors.filterBuilder.greaterThanOrEqualTo") },
295
- { value: F.lte, label: h.t("editors.filterBuilder.lessThanOrEqualTo") },
296
- { value: F.between, label: h.t("editors.filterBuilder.between") }
297
- ], dt = ({
298
- dimensionOrMeasure: e,
299
- filter: r,
300
- results: o,
301
- theme: f,
302
- onSelectOperator: u,
303
- onSelectValue: c,
304
- onSearchValue: n
305
- }) => {
306
- var p;
307
- let i;
308
- return e.nativeType === j.number ? i = ct() : e.nativeType === j.boolean ? i = ut() : i = at(), b(() => {
309
- r.operator || u(i[0].value);
310
- }), /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
311
- /* @__PURE__ */ s.jsx(
312
- W,
313
- {
314
- triggerComponent: /* @__PURE__ */ s.jsx("button", { className: O.operatorButton, children: (p = i.find((d) => d.value === r.operator)) == null ? void 0 : p.label }),
315
- value: r.operator,
316
- options: i,
317
- onChange: u,
318
- avoidCollisions: !1
319
- }
320
- ),
321
- /* @__PURE__ */ s.jsx(
322
- it,
323
- {
324
- filter: r,
325
- dimensionOrMeasure: e,
326
- results: o,
327
- theme: f,
328
- onSelectValue: c,
329
- onSearchValue: n
330
- }
331
- )
332
- ] });
333
- }, pt = ({
334
- filter: e,
335
- dimensionsAndMeasures: r,
336
- results: o,
337
- theme: f,
338
- onSelectDimensionOrMeasure: u,
339
- onSelectOperator: c,
340
- onSelectValue: n,
341
- onSearchValue: i,
342
- onDelete: p
343
- }) => {
344
- var x;
345
- const { dimensionOrMeasure: d } = e, [v, M] = T(""), C = se(r), S = U({
346
- dimensionsAndMeasures: C,
347
- theme: f
348
- }), D = U({
349
- dimensionsAndMeasures: C,
350
- searchValue: v,
351
- theme: f
352
- }), L = (x = S.find(
353
- (A) => A.value === (d == null ? void 0 : d.name)
354
- )) == null ? void 0 : x.label, y = () => d ? /* @__PURE__ */ s.jsx("button", { className: O.memberButton, children: L }) : /* @__PURE__ */ s.jsxs("button", { className: O.addButton, children: [
355
- /* @__PURE__ */ s.jsx(oe, {}),
356
- /* @__PURE__ */ s.jsx("span", { children: h.t("editors.filterBuilder.addFilter") })
357
- ] });
358
- return /* @__PURE__ */ s.jsxs("div", { className: O.filter, children: [
359
- /* @__PURE__ */ s.jsx(
360
- W,
361
- {
362
- triggerComponent: y(),
363
- searchable: !0,
364
- value: d == null ? void 0 : d.name,
365
- onChange: u,
366
- onSearch: M,
367
- options: D,
368
- avoidCollisions: !1,
369
- noOptionsMessage: h.t("common.noOptionsFound")
370
- }
371
- ),
372
- d && /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
373
- /* @__PURE__ */ s.jsx(
374
- dt,
375
- {
376
- dimensionOrMeasure: d,
377
- filter: e,
378
- results: o,
379
- theme: f,
380
- onSelectOperator: c,
381
- onSelectValue: n,
382
- onSearchValue: i
383
- }
384
- ),
385
- /* @__PURE__ */ s.jsx("button", { className: O.deleteButton, onClick: p, children: /* @__PURE__ */ s.jsx(ne, {}) })
386
- ] })
387
- ] });
388
- }, re = (e) => {
389
- var H, K, Y, G, Q, Z;
390
- const r = he();
391
- Ae(r);
392
- const { title: o, description: f, tooltip: u } = we(e), {
393
- dimensionsAndMeasures: c = [],
394
- setEmbeddableState: n,
395
- embeddableState: i,
396
- onChange: p,
397
- defaultFilters: d
398
- } = e, [v, M] = T(""), [C, S] = T(!1), [D, L] = T(!1), y = R(null), x = R(void 0), A = R(!0);
399
- b(() => {
400
- if (!d || !(c != null && c.length))
401
- return;
402
- const t = ot(d, c);
403
- t.length > 0 && (n == null || n((l) => {
404
- var a;
405
- return (a = l == null ? void 0 : l.filters) != null && a.length ? l : { ...l, filters: t };
406
- })), setTimeout(() => {
407
- A.current = !1;
408
- }, 100);
409
- }, [d, c]);
410
- const I = Te(() => {
411
- const t = y.current;
412
- t && (L(t.scrollLeft > 1), S(t.scrollLeft + t.clientWidth < t.scrollWidth - 1));
413
- }, []), z = () => {
414
- var t;
415
- (t = y.current) == null || t.scrollBy({ left: 200, behavior: "smooth" });
416
- }, V = () => {
417
- var t;
418
- (t = y.current) == null || t.scrollBy({ left: -200, behavior: "smooth" });
419
- };
420
- b(() => {
421
- const t = y.current;
422
- if (!t) return;
423
- const l = new ResizeObserver(I);
424
- return l.observe(t), t.addEventListener("scroll", I), I(), () => {
425
- l.disconnect(), t.removeEventListener("scroll", I);
426
- };
427
- }, [I, i == null ? void 0 : i.filters]);
428
- const N = ((K = (H = i == null ? void 0 : i.filters) == null ? void 0 : H[i.filters.length - 1]) == null ? void 0 : K.id) ?? 0, B = (Y = i == null ? void 0 : i.filters) == null ? void 0 : Y[i.filters.length - 1], E = `${B == null ? void 0 : B.id}-${(G = B == null ? void 0 : B.dimensionOrMeasure) == null ? void 0 : G.name}-${B == null ? void 0 : B.operator}-${JSON.stringify(B == null ? void 0 : B.value)}`;
429
- b(() => {
430
- A.current || setTimeout(() => {
431
- var t;
432
- (t = y.current) == null || t.scrollTo({ left: y.current.scrollWidth, behavior: "smooth" });
433
- }, 100);
434
- }, [E]);
435
- const P = (t = null) => {
436
- const l = c.find((a) => a.name === t) ?? null;
437
- return { id: N + 1, dimensionOrMeasure: l, search: "", operator: null, value: null };
438
- }, q = (Q = i == null ? void 0 : i.filters) != null && Q.length ? i.filters : [P()], le = (t, l) => {
439
- n == null || n((a) => {
440
- const _ = [...(a == null ? void 0 : a.filters) ?? []], $ = _[t];
441
- return _[t] = {
442
- ...P(l),
443
- ...$ != null && $.id ? { id: $.id } : {}
444
- }, { ...a, filters: _ };
445
- });
446
- }, ie = (t, l) => {
447
- n == null || n((a) => {
448
- const _ = [...(a == null ? void 0 : a.filters) ?? []];
449
- return _[t] = { ..._[t], operator: l, value: null }, { ...a, filters: _ };
450
- });
451
- }, ae = (t, l) => {
452
- n == null || n((a) => {
453
- const _ = [...(a == null ? void 0 : a.filters) ?? []];
454
- return _[t] = { ..._[t], value: l }, { ...a, filters: _ };
455
- });
456
- }, ue = (t, l) => {
457
- n == null || n((a) => {
458
- const _ = [...(a == null ? void 0 : a.filters) ?? []];
459
- return _[t] = { ..._[t], search: l }, { ...a, filters: _ };
460
- });
461
- }, ce = (t) => {
462
- n == null || n((l) => {
463
- const a = [...(l == null ? void 0 : l.filters) ?? []];
464
- return a.splice(t, 1), { ...l, filters: a };
465
- });
466
- }, de = (t) => {
467
- n == null || n((l) => {
468
- const a = [...(l == null ? void 0 : l.filters) ?? [], P(t)];
469
- return { ...l, filters: a };
470
- }), setTimeout(() => {
471
- var l;
472
- (l = y.current) == null || l.scrollTo({ left: y.current.scrollWidth, behavior: "smooth" });
473
- }, 0);
474
- };
475
- b(() => {
476
- const t = tt(X.AND, q);
477
- JSON.stringify(t) !== JSON.stringify(x.current) && (x.current = t, p == null || p(t));
478
- }, [q]);
479
- const pe = se(c), fe = U({
480
- dimensionsAndMeasures: pe,
481
- searchValue: v,
482
- theme: r
483
- }), me = q.some((t) => t.dimensionOrMeasure && t.operator && t.value != null), ge = () => {
484
- n == null || n((t) => ({ ...t, filters: [P()] }));
485
- };
486
- return /* @__PURE__ */ s.jsx(Ie, { title: o, description: f, tooltip: u, children: /* @__PURE__ */ s.jsxs("div", { className: O.container, children: [
487
- D && /* @__PURE__ */ s.jsx("button", { className: O.scrollLeftButton, onClick: V, children: /* @__PURE__ */ s.jsx(ye, {}) }),
488
- /* @__PURE__ */ s.jsx("div", { className: O.scroll, ref: y, children: q.map((t, l) => /* @__PURE__ */ s.jsx(Me.Fragment, { children: /* @__PURE__ */ s.jsx(
489
- pt,
490
- {
491
- filter: t,
492
- dimensionsAndMeasures: c,
493
- results: e[`filterResults${t.id}`],
494
- theme: r,
495
- onSelectDimensionOrMeasure: (a) => le(l, a),
496
- onSelectOperator: (a) => ie(l, a),
497
- onSelectValue: (a) => ae(l, a),
498
- onSearchValue: (a) => ue(l, a),
499
- onDelete: () => ce(l)
500
- }
501
- ) }, t.id)) }),
502
- C && /* @__PURE__ */ s.jsx("button", { className: O.scrollRightButton, onClick: z, children: /* @__PURE__ */ s.jsx(Ce, {}) }),
503
- ((Z = q[0]) == null ? void 0 : Z.dimensionOrMeasure) && /* @__PURE__ */ s.jsx(
504
- W,
505
- {
506
- triggerComponent: /* @__PURE__ */ s.jsx(be, { icon: oe }),
507
- searchable: !0,
508
- onChange: (t) => de(t),
509
- onSearch: M,
510
- options: fe,
511
- avoidCollisions: !1,
512
- noOptionsMessage: h.t("common.noOptionsFound")
513
- }
514
- ),
515
- me && /* @__PURE__ */ s.jsx("button", { className: O.clearButton, onClick: ge, children: h.t("editors.filterBuilder.clearAll") })
516
- ] }) });
517
- }, ft = {
518
- name: "FilterBuilderPro",
519
- label: "Filter Builder",
520
- description: "Free-form filter builder that lets end users compose member/operator/value clauses. Use to expose ad-hoc filtering on a dataset.",
521
- category: "Filters",
522
- defaultWidth: 600,
523
- defaultHeight: 120,
524
- inputs: [
525
- w.dataset,
526
- {
527
- ...w.dimensionsAndMeasures,
528
- config: {
529
- ...w.dimensionsAndMeasures.config,
530
- supportedTypes: ["string", "number", "boolean"]
531
- }
532
- },
533
- {
534
- ...w.filters,
535
- name: "defaultFilters",
536
- label: "Default filters",
537
- defaultValue: null
538
- },
539
- w.title,
540
- w.description,
541
- w.tooltip
542
- ],
543
- events: [
544
- {
545
- name: "onChange",
546
- label: "Filter value updated",
547
- properties: [
548
- {
549
- name: "value",
550
- type: "filters"
551
- }
552
- ]
553
- }
554
- ],
555
- variables: [
556
- {
557
- name: "filter value",
558
- type: "filters",
559
- defaultValue: {},
560
- inputs: ["defaultFilters"],
561
- events: [{ name: "onChange", property: "value" }]
562
- }
563
- ]
564
- }, mt = ve(re, {}), gt = (e, [r, o]) => {
565
- var u;
566
- const f = (u = r == null ? void 0 : r.filters) == null ? void 0 : u.reduce((c, n) => {
567
- var d;
568
- if (((d = n.dimensionOrMeasure) == null ? void 0 : d.__type__) !== "dimension" || !n.operator)
569
- return c;
570
- const { dimensionOrMeasure: i } = n, p = i.nativeType === "string" ? m.contains : m.equals;
571
- return c[`filterResults${n.id}`] = je({
572
- from: e.dataset,
573
- select: [n.dimensionOrMeasure],
574
- filters: n.search ? [{ operator: p, property: i, value: n.search }] : void 0
575
- }), c;
576
- }, {});
577
- return {
578
- ...e,
579
- embeddableState: r,
580
- setEmbeddableState: o,
581
- dimensionsAndMeasures: e.dimensionsAndMeasures ?? [],
582
- ...f
583
- };
584
- }, ht = {
585
- onChange: (e) => ({
586
- value: e ?? xe.noFilter()
587
- })
588
- }, k = {
589
- Component: re,
590
- meta: ft,
591
- preview: mt,
592
- config: {
593
- props: gt,
594
- events: ht
595
- }
596
- }, xt = k.preview, vt = k.meta, jt = Oe(k.Component, vt, k.config);
1
+ import { defineComponent as o } from "@embeddable.com/react";
2
+ import { f as e } from "./definition-es5n86g4.js";
3
+ const m = e.preview, r = e.meta, n = o(e.Component, r, e.config);
597
4
  export {
598
- jt as default,
599
- vt as meta,
600
- xt as preview
5
+ n as default,
6
+ r as meta,
7
+ m as preview
601
8
  };
602
9
  //# sourceMappingURL=FilterBuilderPro.js.map