@embeddable.com/remarkable-pro 0.3.4 → 0.3.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.
@@ -1,603 +0,0 @@
1
- import { useTheme as ge, definePreview as he } from "@embeddable.com/react";
2
- import { g as ve, a0 as te, j as s, a1 as x, a2 as m, $ as Oe, t as $, I as Be, a3 as ne, f as _e, a4 as Ne, a5 as ye, A as Fe, V as be, l as je } from "./index-BDd5cXFC.js";
3
- import Ce, { useState as T, useRef as q, useEffect as j, useCallback as xe } from "react";
4
- import { g as J } from "./dimensionsAndMeasures.utils-BolsWK6X.js";
5
- import { a as h, i as Me, r as Te } from "./component.utils-oQMZT7TK.js";
6
- import { g as Ae } from "./formatter.utils-DE-_ADag.js";
7
- import { E as Se } from "./EditorCard-DivoetAt.js";
8
- import { i as S } from "./component.inputs.constants-DoBT8ykS.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 Ie = [["path", { d: "M12 5l0 14", key: "svg-0" }], ["path", { d: "M5 12l14 0", key: "svg-1" }]], oe = ve("outline", "plus", "Plus", Ie), Re = "_container_2pz3g_1", qe = "_scroll_2pz3g_13", we = "_filter_2pz3g_26", De = "_addButton_2pz3g_32", ze = "_memberButton_2pz3g_60", Le = "_deleteButton_2pz3g_83", Ve = "_operatorButton_2pz3g_114", Ee = "_valueButton_2pz3g_138", Pe = "_loadingSpinner_2pz3g_175", ke = "_valueButtonEmpty_2pz3g_183", $e = "_clearButton_2pz3g_187", We = "_scrollRightButton_2pz3g_207", Je = "_scrollLeftButton_2pz3g_240", Ue = "_valueInput_2pz3g_273", O = {
16
- container: Re,
17
- scroll: qe,
18
- filter: we,
19
- addButton: De,
20
- memberButton: ze,
21
- deleteButton: Le,
22
- operatorButton: Ve,
23
- valueButton: Ee,
24
- loadingSpinner: Pe,
25
- valueButtonEmpty: ke,
26
- clearButton: $e,
27
- scrollRightButton: We,
28
- scrollLeftButton: Je,
29
- valueInput: Ue
30
- }, W = (e) => e.target.value === "" ? null : Number(e.target.value), He = ({
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, a] = T(
37
- Array.isArray(e.value) ? e.value[1] ?? null : null
38
- ), p = q(null), d = te((v) => {
39
- r(v);
40
- });
41
- return j(() => {
42
- u != null && n != null && d([u, n]);
43
- }, [u, n, d]), j(() => {
44
- o != null && d(o);
45
- }, [o, d]), j(() => {
46
- e.value || setTimeout(() => {
47
- var v;
48
- (v = p.current) == null || v.focus();
49
- }, 100);
50
- }, [e.value, 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(W(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) => a(W(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(W(v))
79
- }
80
- );
81
- }, Ke = ({
82
- filter: e,
83
- onSelectValue: r
84
- }) => {
85
- const [o, f] = T((e == null ? void 0 : e.value) ?? ""), u = q(null), c = te((n) => {
86
- r(n);
87
- });
88
- return j(() => {
89
- c(o || null);
90
- }, [o, c]), j(() => {
91
- e.value || setTimeout(() => {
92
- var n;
93
- (n = u.current) == null || n.focus();
94
- }, 100);
95
- }, [e.value, 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
- }, Xe = {
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
- }, y = {
118
- equals: m.equals,
119
- notEquals: m.notEquals,
120
- gte: m.gte,
121
- lte: m.lte,
122
- between: "between"
123
- }, Ye = {
124
- [y.equals]: m.equals,
125
- [y.notEquals]: m.notEquals,
126
- [y.gte]: m.gte,
127
- [y.lte]: m.lte
128
- }, U = {
129
- AND: "and"
130
- }, Ge = [
131
- x.string,
132
- x.boolean,
133
- x.number
134
- ], se = (e) => e.filter(
135
- (r) => Ge.includes(r.nativeType)
136
- ), Qe = (e) => {
137
- var o;
138
- if (e.operator === y.between && ((o = e.dimensionOrMeasure) == null ? void 0 : o.nativeType) === x.number) {
139
- const [f, u] = e.value;
140
- return [
141
- {
142
- operator: U.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 = Xe[e.operator] ?? Ye[e.operator];
151
- return [{ property: e.dimensionOrMeasure.name, operator: r, value: e.value }];
152
- }, Ze = (e, r) => {
153
- const o = r.filter((f) => f.dimensionOrMeasure && f.operator && f.value != null).flatMap(Qe);
154
- return o.length === 0 ? null : { operator: e, clauses: o };
155
- }, et = (e, r, o) => {
156
- if ("clauses" in e) {
157
- const p = e.clauses[0], d = e.clauses[1];
158
- if (e.operator === U.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: y.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 a = null;
172
- return (n == null ? void 0 : n.nativeType) === x.number ? a = {
173
- [m.equals]: y.equals,
174
- [m.notEquals]: y.notEquals,
175
- [m.gte]: y.gte,
176
- [m.lte]: y.lte
177
- }[u] ?? null : u === m.contains ? a = Array.isArray(c) ? g.isOneOf : g.contains : a = {
178
- [m.equals]: g.is,
179
- [m.notEquals]: g.isNot,
180
- [m.notContains]: g.isNotOneOf
181
- }[u] ?? null, { id: o, dimensionOrMeasure: n, search: "", operator: a, value: c };
182
- }, tt = (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 = et(f, r, u + 1);
188
- c && o.push(c);
189
- }), o.length ? o : [];
190
- }, nt = (e) => Array.isArray(e) ? e : e == null ? [] : [e], ot = (e, r) => [
191
- ...e.filter((o) => r.includes(o.value)),
192
- ...e.filter((o) => !r.includes(o.value))
193
- ], st = (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: _e(O.valueButton, !e && O.valueButtonEmpty), ...c, children: [
201
- r ? /* @__PURE__ */ s.jsx(Be, { className: O.loadingSpinner }) : o,
202
- f && /* @__PURE__ */ s.jsx(ne, { onClick: u })
203
- ] }), rt = ({
204
- filter: e,
205
- dimensionOrMeasure: r,
206
- results: o,
207
- theme: f,
208
- onSelectValue: u,
209
- onSearchValue: c
210
- }) => {
211
- var L, V;
212
- const n = Ae(f), a = q({}), p = ((L = o == null ? void 0 : o.data) == null ? void 0 : L.map((_) => ({
213
- value: _[r.name],
214
- label: n.data(r, _[r.name])
215
- }))) ?? [];
216
- p.forEach(({ value: _, label: B }) => {
217
- _ != null && (a.current[_] = B);
218
- });
219
- const d = (_) => a.current[_] ?? _, v = nt(e.value), M = ot(p, v), b = o == null ? void 0 : o.isLoading, I = !b && (((V = o == null ? void 0 : o.data) == null ? void 0 : V.length) ?? 0) === 0;
220
- if (r.nativeType === x.number)
221
- return /* @__PURE__ */ s.jsx(He, { filter: e, onSelectValue: u });
222
- if (r.nativeType === x.string && e.operator === g.contains)
223
- return /* @__PURE__ */ s.jsx(Ke, { filter: e, onSelectValue: u });
224
- const F = e.operator === g.isOneOf || e.operator === g.isNotOneOf, C = e.value != null, A = !b && C;
225
- if (F) {
226
- const _ = e.value ?? [], B = st(_, d);
227
- return /* @__PURE__ */ s.jsx(
228
- Oe,
229
- {
230
- triggerComponent: /* @__PURE__ */ s.jsx(
231
- ee,
232
- {
233
- hasValue: C,
234
- isLoading: b,
235
- displayValue: B,
236
- showClearIcon: A,
237
- onClear: () => u(null)
238
- }
239
- ),
240
- isSearchable: !0,
241
- isClearable: !0,
242
- isLoading: b,
243
- values: _,
244
- options: M,
245
- onChange: (E) => u(E.length === 0 ? null : E),
246
- onSearch: c,
247
- avoidCollisions: !1,
248
- noOptionsMessage: I ? h.t("common.noOptionsFound") : void 0
249
- }
250
- );
251
- }
252
- if (e.operator === g.is || e.operator === g.isNot) {
253
- const _ = e.value != null ? d(e.value) : "...";
254
- return /* @__PURE__ */ s.jsx(
255
- $,
256
- {
257
- triggerComponent: /* @__PURE__ */ s.jsx(
258
- ee,
259
- {
260
- hasValue: C,
261
- isLoading: b,
262
- displayValue: _,
263
- showClearIcon: A,
264
- onClear: () => u(null)
265
- }
266
- ),
267
- searchable: !0,
268
- clearable: !0,
269
- isLoading: b,
270
- value: e.value,
271
- options: M,
272
- onChange: u,
273
- onSearch: c,
274
- avoidCollisions: !1,
275
- noOptionsMessage: I ? h.t("common.noOptionsFound") : void 0
276
- }
277
- );
278
- }
279
- return null;
280
- }, lt = () => [
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
- ], at = () => [
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
- ], it = () => [
292
- { value: y.equals, label: h.t("editors.filterBuilder.equals") },
293
- { value: y.notEquals, label: h.t("editors.filterBuilder.doesNotEqual") },
294
- { value: y.gte, label: h.t("editors.filterBuilder.greaterThanOrEqualTo") },
295
- { value: y.lte, label: h.t("editors.filterBuilder.lessThanOrEqualTo") },
296
- { value: y.between, label: h.t("editors.filterBuilder.between") }
297
- ], ut = ({
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 a;
308
- return e.nativeType === x.number ? a = it() : e.nativeType === x.boolean ? a = at() : a = lt(), j(() => {
309
- r.operator || u(a[0].value);
310
- }), /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
311
- /* @__PURE__ */ s.jsx(
312
- $,
313
- {
314
- triggerComponent: /* @__PURE__ */ s.jsx("button", { className: O.operatorButton, children: (p = a.find((d) => d.value === r.operator)) == null ? void 0 : p.label }),
315
- value: r.operator,
316
- options: a,
317
- onChange: u,
318
- avoidCollisions: !1
319
- }
320
- ),
321
- /* @__PURE__ */ s.jsx(
322
- rt,
323
- {
324
- filter: r,
325
- dimensionOrMeasure: e,
326
- results: o,
327
- theme: f,
328
- onSelectValue: c,
329
- onSearchValue: n
330
- }
331
- )
332
- ] });
333
- }, ct = ({
334
- filter: e,
335
- dimensionsAndMeasures: r,
336
- results: o,
337
- theme: f,
338
- onSelectDimensionOrMeasure: u,
339
- onSelectOperator: c,
340
- onSelectValue: n,
341
- onSearchValue: a,
342
- onDelete: p
343
- }) => {
344
- var C;
345
- const { dimensionOrMeasure: d } = e, [v, M] = T(""), b = se(r), I = J({
346
- dimensionsAndMeasures: b,
347
- theme: f
348
- }), D = J({
349
- dimensionsAndMeasures: b,
350
- searchValue: v,
351
- theme: f
352
- }), z = (C = I.find(
353
- (A) => A.value === (d == null ? void 0 : d.name)
354
- )) == null ? void 0 : C.label, F = () => d ? /* @__PURE__ */ s.jsx("button", { className: O.memberButton, children: z }) : /* @__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
- $,
361
- {
362
- triggerComponent: F(),
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
- ut,
375
- {
376
- dimensionOrMeasure: d,
377
- filter: e,
378
- results: o,
379
- theme: f,
380
- onSelectOperator: c,
381
- onSelectValue: n,
382
- onSearchValue: a
383
- }
384
- ),
385
- /* @__PURE__ */ s.jsx("button", { className: O.deleteButton, onClick: p, children: /* @__PURE__ */ s.jsx(ne, {}) })
386
- ] })
387
- ] });
388
- }, H = (e) => {
389
- var K, X, Y, G, Q, Z;
390
- const r = ge();
391
- Me(r);
392
- const { title: o, description: f, tooltip: u } = Te(e), {
393
- dimensionsAndMeasures: c = [],
394
- setEmbeddableState: n,
395
- embeddableState: a,
396
- onChange: p,
397
- defaultFilters: d
398
- } = e, [v, M] = T(""), [b, I] = T(!1), [D, z] = T(!1), F = q(null), C = q(void 0), A = q(!0);
399
- j(() => {
400
- if (!d || !(c != null && c.length))
401
- return;
402
- const t = tt(d, c);
403
- t.length > 0 && (n == null || n((l) => {
404
- var i;
405
- return (i = l == null ? void 0 : l.filters) != null && i.length ? l : { ...l, filters: t };
406
- })), setTimeout(() => {
407
- A.current = !1;
408
- }, 100);
409
- }, [d, c]);
410
- const R = xe(() => {
411
- const t = F.current;
412
- t && (z(t.scrollLeft > 1), I(t.scrollLeft + t.clientWidth < t.scrollWidth - 1));
413
- }, []), L = () => {
414
- var t;
415
- (t = F.current) == null || t.scrollBy({ left: 200, behavior: "smooth" });
416
- }, V = () => {
417
- var t;
418
- (t = F.current) == null || t.scrollBy({ left: -200, behavior: "smooth" });
419
- };
420
- j(() => {
421
- const t = F.current;
422
- if (!t) return;
423
- const l = new ResizeObserver(R);
424
- return l.observe(t), t.addEventListener("scroll", R), R(), () => {
425
- l.disconnect(), t.removeEventListener("scroll", R);
426
- };
427
- }, [R, a == null ? void 0 : a.filters]);
428
- const _ = ((X = (K = a == null ? void 0 : a.filters) == null ? void 0 : K[a.filters.length - 1]) == null ? void 0 : X.id) ?? 0, B = (Y = a == null ? void 0 : a.filters) == null ? void 0 : Y[a.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
- j(() => {
430
- A.current || setTimeout(() => {
431
- var t;
432
- (t = F.current) == null || t.scrollTo({ left: F.current.scrollWidth, behavior: "smooth" });
433
- }, 100);
434
- }, [E]);
435
- const P = (t = null) => {
436
- const l = c.find((i) => i.name === t) ?? null;
437
- return { id: _ + 1, dimensionOrMeasure: l, search: "", operator: null, value: null };
438
- }, w = (Q = a == null ? void 0 : a.filters) != null && Q.length ? a.filters : [P()], re = (t, l) => {
439
- n == null || n((i) => {
440
- const N = [...(i == null ? void 0 : i.filters) ?? []], k = N[t];
441
- return N[t] = {
442
- ...P(l),
443
- ...k != null && k.id ? { id: k.id } : {}
444
- }, { ...i, filters: N };
445
- });
446
- }, le = (t, l) => {
447
- n == null || n((i) => {
448
- const N = [...(i == null ? void 0 : i.filters) ?? []];
449
- return N[t] = { ...N[t], operator: l, value: null }, { ...i, filters: N };
450
- });
451
- }, ae = (t, l) => {
452
- n == null || n((i) => {
453
- const N = [...(i == null ? void 0 : i.filters) ?? []];
454
- return N[t] = { ...N[t], value: l }, { ...i, filters: N };
455
- });
456
- }, ie = (t, l) => {
457
- n == null || n((i) => {
458
- const N = [...(i == null ? void 0 : i.filters) ?? []];
459
- return N[t] = { ...N[t], search: l }, { ...i, filters: N };
460
- });
461
- }, ue = (t) => {
462
- n == null || n((l) => {
463
- const i = [...(l == null ? void 0 : l.filters) ?? []];
464
- return i.splice(t, 1), { ...l, filters: i };
465
- });
466
- }, ce = (t) => {
467
- n == null || n((l) => {
468
- const i = [...(l == null ? void 0 : l.filters) ?? [], P(t)];
469
- return { ...l, filters: i };
470
- }), setTimeout(() => {
471
- var l;
472
- (l = F.current) == null || l.scrollTo({ left: F.current.scrollWidth, behavior: "smooth" });
473
- }, 0);
474
- };
475
- j(() => {
476
- const t = Ze(U.AND, w);
477
- JSON.stringify(t) !== JSON.stringify(C.current) && (C.current = t, p == null || p(t));
478
- }, [w]);
479
- const de = se(c), pe = J({
480
- dimensionsAndMeasures: de,
481
- searchValue: v,
482
- theme: r
483
- }), fe = w.some((t) => t.dimensionOrMeasure && t.operator && t.value != null), me = () => {
484
- n == null || n((t) => ({ ...t, filters: [P()] }));
485
- };
486
- return /* @__PURE__ */ s.jsx(Se, { 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(Ne, {}) }),
488
- /* @__PURE__ */ s.jsx("div", { className: O.scroll, ref: F, children: w.map((t, l) => /* @__PURE__ */ s.jsx(Ce.Fragment, { children: /* @__PURE__ */ s.jsx(
489
- ct,
490
- {
491
- filter: t,
492
- dimensionsAndMeasures: c,
493
- results: e[`filterResults${t.id}`],
494
- theme: r,
495
- onSelectDimensionOrMeasure: (i) => re(l, i),
496
- onSelectOperator: (i) => le(l, i),
497
- onSelectValue: (i) => ae(l, i),
498
- onSearchValue: (i) => ie(l, i),
499
- onDelete: () => ue(l)
500
- }
501
- ) }, t.id)) }),
502
- b && /* @__PURE__ */ s.jsx("button", { className: O.scrollRightButton, onClick: L, children: /* @__PURE__ */ s.jsx(ye, {}) }),
503
- ((Z = w[0]) == null ? void 0 : Z.dimensionOrMeasure) && /* @__PURE__ */ s.jsx(
504
- $,
505
- {
506
- triggerComponent: /* @__PURE__ */ s.jsx(Fe, { icon: oe }),
507
- searchable: !0,
508
- onChange: (t) => ce(t),
509
- onSearch: M,
510
- options: pe,
511
- noOptionsMessage: h.t("common.noOptionsFound")
512
- }
513
- ),
514
- fe && /* @__PURE__ */ s.jsx("button", { className: O.clearButton, onClick: me, children: h.t("editors.filterBuilder.clearAll") })
515
- ] }) });
516
- }, Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
517
- __proto__: null,
518
- default: H
519
- }, Symbol.toStringTag, { value: "Module" })), dt = {
520
- name: "FilterBuilderPro",
521
- label: "Filter Builder",
522
- description: "Free-form filter builder that lets end users compose member/operator/value clauses. Use to expose ad-hoc filtering on a dataset.",
523
- category: "Filters",
524
- defaultWidth: 600,
525
- defaultHeight: 120,
526
- inputs: [
527
- S.dataset,
528
- {
529
- ...S.dimensionsAndMeasures,
530
- config: {
531
- ...S.dimensionsAndMeasures.config,
532
- supportedTypes: ["string", "number", "boolean"]
533
- }
534
- },
535
- {
536
- ...S.filters,
537
- name: "defaultFilters",
538
- label: "Default filters",
539
- defaultValue: null
540
- },
541
- S.title,
542
- S.description,
543
- S.tooltip
544
- ],
545
- events: [
546
- {
547
- name: "onChange",
548
- label: "Filter value updated",
549
- properties: [
550
- {
551
- name: "value",
552
- type: "filters"
553
- }
554
- ]
555
- }
556
- ],
557
- variables: [
558
- {
559
- name: "filter value",
560
- type: "filters",
561
- defaultValue: {},
562
- inputs: ["defaultFilters"],
563
- events: [{ name: "onChange", property: "value" }]
564
- }
565
- ]
566
- }, pt = he(H, {}), ft = (e, [r, o]) => {
567
- var u;
568
- const f = (u = r == null ? void 0 : r.filters) == null ? void 0 : u.reduce((c, n) => {
569
- var d;
570
- if (((d = n.dimensionOrMeasure) == null ? void 0 : d.__type__) !== "dimension" || !n.operator)
571
- return c;
572
- const { dimensionOrMeasure: a } = n, p = a.nativeType === "string" ? m.contains : m.equals;
573
- return c[`filterResults${n.id}`] = je({
574
- from: e.dataset,
575
- select: [n.dimensionOrMeasure],
576
- filters: n.search ? [{ operator: p, property: a, value: n.search }] : void 0
577
- }), c;
578
- }, {});
579
- return {
580
- ...e,
581
- embeddableState: r,
582
- setEmbeddableState: o,
583
- dimensionsAndMeasures: e.dimensionsAndMeasures ?? [],
584
- ...f
585
- };
586
- }, mt = {
587
- onChange: (e) => ({
588
- value: e ?? be.noFilter()
589
- })
590
- }, bt = {
591
- Component: H,
592
- meta: dt,
593
- preview: pt,
594
- config: {
595
- props: ft,
596
- events: mt
597
- }
598
- };
599
- export {
600
- bt as f,
601
- Ft as i
602
- };
603
- //# sourceMappingURL=definition-DP17cDpI.js.map