@embeddable.com/remarkable-pro 0.0.19 → 0.0.21
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.
- package/dist/BarChartDefaultHorizontalPro.js +3 -3
- package/dist/BarChartDefaultPro.js +3 -3
- package/dist/BarChartGroupedHorizontalPro.js +3 -3
- package/dist/BarChartGroupedPro.js +3 -3
- package/dist/BarChartStackedHorizontalPro.js +3 -3
- package/dist/BarChartStackedPro.js +3 -3
- package/dist/ChartCard-D_A88_bS.js +116 -0
- package/dist/ChartCard-D_A88_bS.js.map +1 -0
- package/dist/{Color.type.emb-B6HPqRjW.js → Color.type.emb-Dkh_ZrO6.js} +897 -900
- package/dist/{Color.type.emb-B6HPqRjW.js.map → Color.type.emb-Dkh_ZrO6.js.map} +1 -1
- package/dist/ColorEditor.js +1 -1
- package/dist/ComparisonPeriodSelectFieldPro.js +3 -3
- package/dist/DateRangePickerCustomPro.js +3 -3
- package/dist/DateRangeSelectFieldPro.js +3 -3
- package/dist/DonutChartPro.js +3 -3
- package/dist/DonutLabelChartPro.js +3 -3
- package/dist/{EditorCard-aOGeW4jt.js → EditorCard-1Z3UFd1D.js} +5 -5
- package/dist/{EditorCard-aOGeW4jt.js.map → EditorCard-1Z3UFd1D.js.map} +1 -1
- package/dist/GranularitySelectFieldPro.js +46 -39
- package/dist/GranularitySelectFieldPro.js.map +1 -1
- package/dist/HeatMapPro.js +3 -3
- package/dist/KpiChartNumberComparisonPro.js +3 -3
- package/dist/KpiChartNumberPro.js +3 -3
- package/dist/LineChartComparisonDefaultPro.js +3 -3
- package/dist/LineChartDefaultPro.js +3 -3
- package/dist/LineChartGroupedPro.js +3 -3
- package/dist/MultiSelectFieldPro.js +3 -3
- package/dist/PieChartPro.js +3 -3
- package/dist/PivotTablePro.js +3 -3
- package/dist/SingleSelectFieldPro.js +3 -3
- package/dist/TableChartPaginated.js +3 -3
- package/dist/TableScrollable.js +4 -4
- package/dist/{bars.utils-DtHJ7gBc.js → bars.utils-CsJD9MNL.js} +35 -35
- package/dist/bars.utils-CsJD9MNL.js.map +1 -0
- package/dist/{charts.utils-DM6cHNrK.js → charts.utils-CUPowt7F.js} +13 -13
- package/dist/charts.utils-CUPowt7F.js.map +1 -0
- package/dist/{component.inputs.constants-jJBFejC-.js → component.inputs.constants-CNdmawDt.js} +26 -26
- package/dist/{component.inputs.constants-jJBFejC-.js.map → component.inputs.constants-CNdmawDt.js.map} +1 -1
- package/dist/components/charts/bars/bars.utils.d.ts.map +1 -1
- package/dist/components/charts/shared/ChartCard/ChartCard.d.ts +6 -5
- package/dist/components/charts/shared/ChartCard/ChartCard.d.ts.map +1 -1
- package/dist/components/editors/GranularitySelectFieldPro/GranularitySelectFieldPro.utils.d.ts +2 -10
- package/dist/components/editors/GranularitySelectFieldPro/GranularitySelectFieldPro.utils.d.ts.map +1 -1
- package/dist/components/editors/GranularitySelectFieldPro/index.d.ts.map +1 -1
- package/dist/embeddable-components.json +12 -12
- package/dist/embeddable-theme-0137e.js +191 -191
- package/dist/{formatter.utils-BUUUf91Q.js → formatter.utils-BiWZBhcE.js} +2 -2
- package/dist/{formatter.utils-BUUUf91Q.js.map → formatter.utils-BiWZBhcE.js.map} +1 -1
- package/dist/{index-CxgncSEN.js → index-1vsLONt_.js} +5 -5
- package/dist/{index-CxgncSEN.js.map → index-1vsLONt_.js.map} +1 -1
- package/dist/{index-Bif__GxM.js → index-8PpbF7SA.js} +5 -5
- package/dist/{index-Bif__GxM.js.map → index-8PpbF7SA.js.map} +1 -1
- package/dist/{index-CKT9qwYq.js → index-B3m93Z4r.js} +5 -5
- package/dist/{index-CKT9qwYq.js.map → index-B3m93Z4r.js.map} +1 -1
- package/dist/{index-CZ9Sw8H3.js → index-BBcQWvRk.js} +5 -5
- package/dist/{index-CZ9Sw8H3.js.map → index-BBcQWvRk.js.map} +1 -1
- package/dist/{index-8A8KFAVc.js → index-BOI6FOwo.js} +5 -5
- package/dist/{index-8A8KFAVc.js.map → index-BOI6FOwo.js.map} +1 -1
- package/dist/{index-cLri0mtu.js → index-Boogtc12.js} +6 -6
- package/dist/{index-cLri0mtu.js.map → index-Boogtc12.js.map} +1 -1
- package/dist/{index-BcDgD_JS.js → index-BuBn1ktN.js} +5 -5
- package/dist/{index-BcDgD_JS.js.map → index-BuBn1ktN.js.map} +1 -1
- package/dist/{index-dov3IPMj.js → index-CQ_mo5Eg.js} +6 -6
- package/dist/{index-dov3IPMj.js.map → index-CQ_mo5Eg.js.map} +1 -1
- package/dist/{index-DVE9YBTf.js → index-CSoASUv1.js} +5 -5
- package/dist/{index-DVE9YBTf.js.map → index-CSoASUv1.js.map} +1 -1
- package/dist/{index-DVPIPYNB.js → index-CVJKjJGv.js} +5 -5
- package/dist/{index-DVPIPYNB.js.map → index-CVJKjJGv.js.map} +1 -1
- package/dist/{index-D0Y3IwQg.js → index-Cv4JGkHO.js} +5 -5
- package/dist/{index-D0Y3IwQg.js.map → index-Cv4JGkHO.js.map} +1 -1
- package/dist/{index-LhNKcA1s.js → index-D5CZAWnJ.js} +4 -4
- package/dist/{index-LhNKcA1s.js.map → index-D5CZAWnJ.js.map} +1 -1
- package/dist/{index-CQlKWTOb.js → index-DVUJikiN.js} +5 -5
- package/dist/{index-CQlKWTOb.js.map → index-DVUJikiN.js.map} +1 -1
- package/dist/{index-Ct3Qtgor.js → index-Dhzhtagm.js} +5 -5
- package/dist/{index-Ct3Qtgor.js.map → index-Dhzhtagm.js.map} +1 -1
- package/dist/{index-grfYNj7h.js → index-DkmPuuV8.js} +6 -6
- package/dist/{index-grfYNj7h.js.map → index-DkmPuuV8.js.map} +1 -1
- package/dist/{index-F6XINVuQ.js → index-DoFkdyxp.js} +5 -5
- package/dist/{index-F6XINVuQ.js.map → index-DoFkdyxp.js.map} +1 -1
- package/dist/{index-DZ_H2OEY.js → index-Dp7Av-Oy.js} +5 -5
- package/dist/{index-DZ_H2OEY.js.map → index-Dp7Av-Oy.js.map} +1 -1
- package/dist/{index-Z5AHoasI.js → index-Du2TCRQq.js} +5 -5
- package/dist/{index-Z5AHoasI.js.map → index-Du2TCRQq.js.map} +1 -1
- package/dist/{index-B-Tq5-JV.js → index-XTTodJI4.js} +5 -5
- package/dist/{index-B-Tq5-JV.js.map → index-XTTodJI4.js.map} +1 -1
- package/dist/{index-DZIiW5Nz.js → index-tjFCL7Y-.js} +4 -4
- package/dist/{index-DZIiW5Nz.js.map → index-tjFCL7Y-.js.map} +1 -1
- package/dist/{index-DF_tK19U.js → index-yOOAOJHG.js} +5 -5
- package/dist/{index-DF_tK19U.js.map → index-yOOAOJHG.js.map} +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +83 -83
- package/dist/{pies.utils-CIDqAzCT.js → pies.utils-DCy5LWcY.js} +5 -5
- package/dist/{pies.utils-CIDqAzCT.js.map → pies.utils-DCy5LWcY.js.map} +1 -1
- package/dist/remarkable-pro.css +1 -1
- package/dist/{tables.utils-BVdgLNxV.js → tables.utils-8OmfcPmH.js} +4 -4
- package/dist/{tables.utils-BVdgLNxV.js.map → tables.utils-8OmfcPmH.js.map} +1 -1
- package/dist/{timeRange.utils-xV5aEhJD.js → timeRange.utils-81KUBS9O.js} +2 -2
- package/dist/{timeRange.utils-xV5aEhJD.js.map → timeRange.utils-81KUBS9O.js.map} +1 -1
- package/package.json +2 -2
- package/dist/ChartCard-DsPc_21K.js +0 -124
- package/dist/ChartCard-DsPc_21K.js.map +0 -1
- package/dist/bars.utils-DtHJ7gBc.js.map +0 -1
- package/dist/charts.utils-DM6cHNrK.js.map +0 -1
package/dist/ColorEditor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineEditor as l } from "@embeddable.com/react";
|
|
2
|
-
import { j as r, A as a, I as i,
|
|
2
|
+
import { j as r, A as a, I as i, r as p, V as u } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
3
3
|
import { useState as m, useEffect as C } from "react";
|
|
4
4
|
const I = "_colorInputContainer_1o1qe_1", d = "_colorInput_1o1qe_1", s = {
|
|
5
5
|
colorInputContainer: I,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as i } from "@embeddable.com/react";
|
|
2
|
-
import { V as r } from "./Color.type.emb-
|
|
3
|
-
import { D as t } from "./index-
|
|
4
|
-
import { b as e, C as a } from "./component.inputs.constants-
|
|
2
|
+
import { V as r } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
3
|
+
import { D as t } from "./index-tjFCL7Y-.js";
|
|
4
|
+
import { b as e, C as a } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const n = {
|
|
6
6
|
name: "ComparisonPeriodSelectFieldPro",
|
|
7
7
|
label: "Comparison Period Select Field",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useTheme as v, defineComponent as C } from "@embeddable.com/react";
|
|
2
|
-
import { j as l, f as y, V as s } from "./Color.type.emb-
|
|
2
|
+
import { j as l, f as y, V as s } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
3
3
|
import { u as D, g as P, a as V, b as w } from "./dates.utils-BF32dTLi.js";
|
|
4
|
-
import { a as S, r as j, i as k, b as a } from "./component.inputs.constants-
|
|
5
|
-
import { E as M } from "./EditorCard-
|
|
4
|
+
import { a as S, r as j, i as k, b as a } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
|
+
import { E as M } from "./EditorCard-1Z3UFd1D.js";
|
|
6
6
|
const T = (e) => {
|
|
7
7
|
const t = v();
|
|
8
8
|
S(t);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as n } from "@embeddable.com/react";
|
|
2
|
-
import { V as t } from "./Color.type.emb-
|
|
3
|
-
import { D as l } from "./index-
|
|
4
|
-
import { b as e } from "./component.inputs.constants-
|
|
2
|
+
import { V as t } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
3
|
+
import { D as l } from "./index-D5CZAWnJ.js";
|
|
4
|
+
import { b as e } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const o = {
|
|
6
6
|
name: "DateRangeSelectFieldPro",
|
|
7
7
|
label: "Date-Range Picker - Presets",
|
package/dist/DonutChartPro.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V as o, l as n } from "./Color.type.emb-
|
|
1
|
+
import { V as o, l as n } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
2
2
|
import { defineComponent as a } from "@embeddable.com/react";
|
|
3
|
-
import { D as s } from "./index-
|
|
4
|
-
import { b as e } from "./component.inputs.constants-
|
|
3
|
+
import { D as s } from "./index-BOI6FOwo.js";
|
|
4
|
+
import { b as e } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const r = {
|
|
6
6
|
name: "DonutChartPro",
|
|
7
7
|
label: "Donut Chart",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as n } from "./index-
|
|
2
|
-
import { V as r, l as t } from "./Color.type.emb-
|
|
1
|
+
import { D as n } from "./index-Boogtc12.js";
|
|
2
|
+
import { V as r, l as t } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
3
3
|
import { defineComponent as o } from "@embeddable.com/react";
|
|
4
|
-
import { b as e } from "./component.inputs.constants-
|
|
4
|
+
import { b as e } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const s = {
|
|
6
6
|
name: "DonutLabelChartPro",
|
|
7
7
|
label: "Donut Label Chart",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as r,
|
|
1
|
+
import { j as r, n as c, o as d, p as m, q as l } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
2
2
|
import { useTheme as p } from "@embeddable.com/react";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as x, i as C, I as j } from "./component.inputs.constants-CNdmawDt.js";
|
|
4
4
|
const u = "_card_15bw3_1", f = {
|
|
5
5
|
card: u
|
|
6
6
|
}, b = ({
|
|
@@ -11,13 +11,13 @@ const u = "_card_15bw3_1", f = {
|
|
|
11
11
|
...n
|
|
12
12
|
}) => {
|
|
13
13
|
const o = p();
|
|
14
|
-
|
|
14
|
+
x(o);
|
|
15
15
|
const i = () => s ? /* @__PURE__ */ r.jsx(
|
|
16
16
|
l,
|
|
17
17
|
{
|
|
18
18
|
variant: "error",
|
|
19
19
|
icon: j,
|
|
20
|
-
title:
|
|
20
|
+
title: C.t("editors.errorTitle"),
|
|
21
21
|
message: s
|
|
22
22
|
}
|
|
23
23
|
) : a;
|
|
@@ -29,4 +29,4 @@ const u = "_card_15bw3_1", f = {
|
|
|
29
29
|
export {
|
|
30
30
|
b as E
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=EditorCard-
|
|
32
|
+
//# sourceMappingURL=EditorCard-1Z3UFd1D.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorCard-
|
|
1
|
+
{"version":3,"file":"EditorCard-1Z3UFd1D.js","sources":["../src/components/editors/shared/EditorCard/EditorCard.tsx"],"sourcesContent":["import { useTheme } from '@embeddable.com/react';\nimport { i18n, i18nSetup } from '../../../../theme/i18n/i18n';\nimport styles from './EditorCard.module.css';\nimport { FC } from 'react';\nimport { Theme } from '../../../../theme/theme.types';\nimport { Card, CardContent, CardFeedback, CardHeader } from '@embeddable.com/remarkable-ui';\nimport { IconAlertCircle } from '@tabler/icons-react';\n\ntype EditorCardProps = {\n title?: string;\n subtitle?: string;\n children: React.ReactNode;\n errorMessage?: string;\n};\n\nexport const EditorCard: FC<EditorCardProps> = ({\n title,\n subtitle,\n children,\n errorMessage,\n ...props\n}) => {\n const theme: Theme = useTheme() as Theme;\n i18nSetup(theme);\n\n const getDisplay = () => {\n if (errorMessage) {\n return (\n <CardFeedback\n variant=\"error\"\n icon={IconAlertCircle}\n title={i18n.t('editors.errorTitle')}\n message={errorMessage}\n />\n );\n }\n\n return children;\n };\n\n return (\n <Card className={styles.card} {...props}>\n <CardHeader title={title} subtitle={subtitle} />\n <CardContent>{getDisplay()}</CardContent>\n </Card>\n );\n};\n"],"names":["EditorCard","title","subtitle","children","errorMessage","props","theme","useTheme","i18nSetup","getDisplay","jsx","CardFeedback","IconAlertCircle","i18n","Card","styles","CardHeader","CardContent"],"mappings":";;;;;GAeaA,IAAkC,CAAC;AAAA,EAC9C,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAeC,EAAA;AACrB,EAAAC,EAAUF,CAAK;AAEf,QAAMG,IAAa,MACbL,IAEAM,gBAAAA,EAAAA;AAAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAMC;AAAA,MACN,OAAOC,EAAK,EAAE,oBAAoB;AAAA,MAClC,SAAST;AAAA,IAAA;AAAA,EAAA,IAKRD;AAGT,gCACGW,GAAA,EAAK,WAAWC,EAAO,MAAO,GAAGV,GAChC,UAAA;AAAA,IAAAK,gBAAAA,EAAAA,IAACM,GAAA,EAAW,OAAAf,GAAc,UAAAC,EAAA,CAAoB;AAAA,IAC9CQ,gBAAAA,EAAAA,IAACO,GAAA,EAAa,UAAAR,EAAA,EAAW,CAAE;AAAA,EAAA,GAC7B;AAEJ;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useTheme as T, defineComponent as w } from "@embeddable.com/react";
|
|
2
|
-
import { j as m, S as F, V as C } from "./Color.type.emb-
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { c as
|
|
5
|
-
import { E as P } from "./EditorCard-
|
|
2
|
+
import { j as m, S as F, V as C } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
3
|
+
import { useMemo as k, useEffect as E } from "react";
|
|
4
|
+
import { c as G, a as O, r as D, b as i } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
|
+
import { E as P } from "./EditorCard-1Z3UFd1D.js";
|
|
6
6
|
const t = {
|
|
7
7
|
second: "second",
|
|
8
8
|
minute: "minute",
|
|
@@ -23,73 +23,80 @@ const t = {
|
|
|
23
23
|
{ value: t.year, label: "defaults.granularityOptions.year|Year" }
|
|
24
24
|
], q = 1, x = 100, A = () => V.map((e) => ({
|
|
25
25
|
...e,
|
|
26
|
-
label:
|
|
27
|
-
})),
|
|
26
|
+
label: G(e.label)
|
|
27
|
+
})), p = (e) => {
|
|
28
28
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
29
29
|
if (typeof e == "string" || typeof e == "number") {
|
|
30
30
|
const a = new Date(e);
|
|
31
31
|
return isNaN(a.getTime()) ? null : a;
|
|
32
32
|
}
|
|
33
33
|
return null;
|
|
34
|
-
},
|
|
34
|
+
}, l = (e) => new Date(e.getTime() + 1), o = (e, a, r) => (a.getTime() - e.getTime()) / r;
|
|
35
35
|
function M(e, a, r) {
|
|
36
36
|
if (e > a) return 0;
|
|
37
37
|
switch (r) {
|
|
38
38
|
case t.second:
|
|
39
|
-
return
|
|
39
|
+
return o(e, l(a), 1e3);
|
|
40
40
|
case t.minute:
|
|
41
|
-
return
|
|
41
|
+
return o(e, l(a), 60 * 1e3);
|
|
42
42
|
case t.hour:
|
|
43
|
-
return
|
|
43
|
+
return o(e, l(a), 3600 * 1e3);
|
|
44
44
|
case t.day:
|
|
45
|
-
return
|
|
45
|
+
return o(e, l(a), 1440 * 60 * 1e3);
|
|
46
46
|
case t.week:
|
|
47
|
-
return
|
|
47
|
+
return o(e, l(a), 10080 * 60 * 1e3);
|
|
48
48
|
case t.month:
|
|
49
|
-
return
|
|
49
|
+
return o(e, l(a), 672 * 60 * 60 * 1e3);
|
|
50
50
|
// shortest month
|
|
51
51
|
case t.quarter:
|
|
52
|
-
return
|
|
52
|
+
return o(e, l(a), 2160 * 60 * 60 * 1e3);
|
|
53
53
|
// shortest quarter
|
|
54
54
|
case t.year:
|
|
55
|
-
return
|
|
55
|
+
return o(e, l(a), 365 * 24 * 60 * 60 * 1e3);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
const N = (e, a, r) => {
|
|
59
|
-
const
|
|
60
|
-
return
|
|
59
|
+
const n = M(e, a, r);
|
|
60
|
+
return n >= q && n <= x;
|
|
61
61
|
}, U = (e, a) => {
|
|
62
|
-
const r =
|
|
63
|
-
if (!r || !
|
|
64
|
-
const
|
|
65
|
-
for (const
|
|
66
|
-
const d =
|
|
67
|
-
N(r,
|
|
62
|
+
const r = p(e == null ? void 0 : e.from), n = p(e == null ? void 0 : e.to);
|
|
63
|
+
if (!r || !n) return a;
|
|
64
|
+
const s = /* @__PURE__ */ new Set();
|
|
65
|
+
for (const u of a) {
|
|
66
|
+
const d = u.value;
|
|
67
|
+
N(r, n, d) && s.add(d);
|
|
68
68
|
}
|
|
69
|
-
return a.filter((
|
|
69
|
+
return a.filter((u) => s.has(u.value));
|
|
70
|
+
}, g = (e, a) => {
|
|
71
|
+
var n;
|
|
72
|
+
if (!a)
|
|
73
|
+
return;
|
|
74
|
+
if (e.some((s) => s.value === a))
|
|
75
|
+
return a;
|
|
76
|
+
const r = e.length > 2 ? 1 : 0;
|
|
77
|
+
return (n = e[r]) == null ? void 0 : n.value;
|
|
70
78
|
}, _ = (e) => {
|
|
71
79
|
const a = T();
|
|
72
|
-
|
|
73
|
-
const { granularity: r, granularities:
|
|
74
|
-
|
|
75
|
-
v.filter((c) =>
|
|
76
|
-
), [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
f && o(f);
|
|
80
|
+
O(a);
|
|
81
|
+
const { granularity: r, granularities: n, clearable: s, onChange: u } = e, { description: d, placeholder: b, title: h, primaryTimeRange: f } = D(e), v = A(), y = k(() => U(
|
|
82
|
+
f,
|
|
83
|
+
v.filter((c) => n == null ? void 0 : n.includes(c.value))
|
|
84
|
+
), [f, n]);
|
|
85
|
+
E(() => {
|
|
86
|
+
if (r && !y.some((c) => c.value === r)) {
|
|
87
|
+
const c = g(y, r);
|
|
88
|
+
c && u(c);
|
|
82
89
|
}
|
|
83
|
-
}, [
|
|
84
|
-
const S =
|
|
90
|
+
}, [y, r, u]);
|
|
91
|
+
const S = g(y, r);
|
|
85
92
|
return /* @__PURE__ */ m.jsx(P, { title: h, subtitle: d, children: /* @__PURE__ */ m.jsx(
|
|
86
93
|
F,
|
|
87
94
|
{
|
|
88
|
-
clearable:
|
|
95
|
+
clearable: s,
|
|
89
96
|
placeholder: b,
|
|
90
97
|
value: S,
|
|
91
|
-
options:
|
|
92
|
-
onChange:
|
|
98
|
+
options: y,
|
|
99
|
+
onChange: u
|
|
93
100
|
}
|
|
94
101
|
) });
|
|
95
102
|
}, j = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GranularitySelectFieldPro.js","sources":["../src/theme/defaults/defaults.GranularityOptions.constants.ts","../src/components/editors/GranularitySelectFieldPro/GranularitySelectFieldPro.utils.ts","../src/components/editors/GranularitySelectFieldPro/index.tsx","../src/components/editors/GranularitySelectFieldPro/GranularitySelectFieldPro.emb.ts"],"sourcesContent":["import { SelectListOptionProps } from '@embeddable.com/remarkable-ui';\n\nexport const Granularity = {\n second: 'second',\n minute: 'minute',\n hour: 'hour',\n day: 'day',\n week: 'week',\n month: 'month',\n quarter: 'quarter',\n year: 'year',\n} as const;\n\nexport type TGranularity = keyof typeof Granularity;\nexport type TGranularityValue = (typeof Granularity)[TGranularity];\n\nexport const defaultGranularitySelectFieldOptions: SelectListOptionProps[] = [\n { value: Granularity.second, label: 'defaults.granularityOptions.second|Second' },\n { value: Granularity.minute, label: 'defaults.granularityOptions.minute|Minute' },\n { value: Granularity.hour, label: 'defaults.granularityOptions.hour|Hour' },\n { value: Granularity.day, label: 'defaults.granularityOptions.day|Day' },\n { value: Granularity.week, label: 'defaults.granularityOptions.week|Week' },\n { value: Granularity.month, label: 'defaults.granularityOptions.month|Month' },\n { value: Granularity.quarter, label: 'defaults.granularityOptions.quarter|Quarter' },\n { value: Granularity.year, label: 'defaults.granularityOptions.year|Year' },\n];\n","import { SelectListOptionProps } from '@embeddable.com/remarkable-ui';\nimport { TimeRange } from '@embeddable.com/core';\nimport {\n defaultGranularitySelectFieldOptions,\n Granularity,\n TGranularity,\n TGranularityValue,\n} from '../../../theme/defaults/defaults.GranularityOptions.constants';\nimport { resolveI18nString } from '../../component.utils';\n\nconst DEFAULT_MIN_BUCKETS = 1;\nconst DEFAULT_MAX_BUCKETS = 100;\n\nexport const getGranularitySelectFieldOptions = () =>\n defaultGranularitySelectFieldOptions.map((opt) => ({\n ...opt,\n label: resolveI18nString(opt.label),\n }));\n\n// Convert possibly-string timestamps to Date safely.\nconst toDate = (d: unknown): Date | null => {\n if (d instanceof Date) return isNaN(d.getTime()) ? null : d;\n if (typeof d === 'string' || typeof d === 'number') {\n const parsed = new Date(d);\n return isNaN(parsed.getTime()) ? null : parsed;\n }\n return null;\n};\n\n// Inclusive end -> Exclusive end helper (only used for sub-day diffs)\nconst toExclusiveEnd = (endInclusive: Date): Date => new Date(endInclusive.getTime() + 1);\n\nconst bucketCountByUnit = (start: Date, endExclusive: Date, unitMs: number): number => {\n return (endExclusive.getTime() - start.getTime()) / unitMs;\n};\n\n// Bucket counting (treat end as INCLUSIVE)\nfunction bucketCount(start: Date, endInclusive: Date, granularity: TGranularity): number {\n if (start > endInclusive) return 0;\n\n switch (granularity) {\n case Granularity.second:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 1000);\n\n case Granularity.minute:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 60 * 1000);\n\n case Granularity.hour:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 60 * 60 * 1000);\n\n case Granularity.day:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 24 * 60 * 60 * 1000);\n\n case Granularity.week:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 7 * 24 * 60 * 60 * 1000);\n\n case Granularity.month:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 28 * 24 * 60 * 60 * 1000); // shortest month\n\n case Granularity.quarter:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 90 * 24 * 60 * 60 * 1000); // shortest quarter\n\n case Granularity.year:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 365 * 24 * 60 * 60 * 1000); // shortest year\n }\n}\n\nconst isGranularityValid = (\n start: Date,\n endInclusive: Date,\n granularity: TGranularityValue,\n): boolean => {\n const buckets = bucketCount(start, endInclusive, granularity);\n return buckets >= DEFAULT_MIN_BUCKETS && buckets <= DEFAULT_MAX_BUCKETS;\n};\n\nexport const getAvailableGranularityOptionsFromTimeRange = (\n timeRange: TimeRange,\n allOptions: SelectListOptionProps[],\n): SelectListOptionProps[] => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const from = toDate((timeRange as any)?.from);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const to = toDate((timeRange as any)?.to);\n\n // If we can’t parse range, don’t hide anything (fail open)\n if (!from || !to) return allOptions;\n\n const validSet = new Set<TGranularityValue>();\n\n for (const opt of allOptions) {\n const g = opt.value as TGranularityValue;\n if (isGranularityValid(from, to, g)) {\n validSet.add(g);\n }\n }\n\n // preserve original UI ordering\n return allOptions.filter((opt) => validSet.has(opt.value as TGranularityValue));\n};\n","import { useEffect, useMemo } from 'react';\nimport { useTheme } from '@embeddable.com/react';\nimport { SingleSelectField } from '@embeddable.com/remarkable-ui';\nimport { TimeRange } from '@embeddable.com/core';\nimport { Theme } from '../../../theme/theme.types';\nimport { i18nSetup } from '../../../theme/i18n/i18n';\nimport { resolveI18nProps } from '../../component.utils';\nimport { EditorCard } from '../shared/EditorCard/EditorCard';\nimport {\n getAvailableGranularityOptionsFromTimeRange,\n getGranularitySelectFieldOptions,\n} from './GranularitySelectFieldPro.utils';\n\ntype GranularitySelectFieldProProps = {\n description?: string;\n onChange: (newGranularity: string) => void;\n placeholder?: string;\n primaryTimeRange: TimeRange;\n title?: string;\n granularity?: string;\n granularities?: string[];\n clearable?: boolean;\n};\n\nconst GranularitySelectFieldPro = (props: GranularitySelectFieldProProps) => {\n const theme: Theme = useTheme() as Theme;\n i18nSetup(theme);\n\n const { granularity, granularities, clearable, onChange } = props;\n const { description, placeholder, title, primaryTimeRange } = resolveI18nProps(props);\n\n const granularitySelectFieldOptions = getGranularitySelectFieldOptions();\n\n const availableOptions = useMemo(() => {\n return getAvailableGranularityOptionsFromTimeRange(\n primaryTimeRange,\n granularitySelectFieldOptions.filter((opt) => granularities?.includes(opt.value as string)),\n );\n }, [primaryTimeRange, granularities]);\n\n useEffect(() => {\n if (granularity) {\n // Selected granularity is not available - select 2nd or 1st available (if 2nd is not available)\n if (!availableOptions.some((opt) => opt.value === granularity)) {\n const newGranularity = (availableOptions[1] ?? availableOptions[0])?.value as string;\n if (newGranularity) {\n onChange(newGranularity);\n }\n }\n }\n }, [availableOptions, granularity, onChange]);\n\n const safeValue = availableOptions.some((opt) => opt.value === granularity)\n ? granularity\n : undefined;\n\n return (\n <EditorCard title={title} subtitle={description}>\n <SingleSelectField\n clearable={clearable}\n placeholder={placeholder}\n value={safeValue}\n options={availableOptions}\n onChange={onChange}\n />\n </EditorCard>\n );\n};\n\nexport default GranularitySelectFieldPro;\n","import { defineComponent, EmbeddedComponentMeta, Inputs } from '@embeddable.com/react';\nimport { Value } from '@embeddable.com/core';\nimport DateTimeSelectFieldPro from './index';\nimport { inputs } from '../../component.inputs.constants';\nimport { Granularity } from '../../../theme/defaults/defaults.GranularityOptions.constants';\n\nexport const meta = {\n name: 'GranularitySelectFieldPro',\n label: 'Granularity Select Field',\n category: 'Dropdowns',\n defaultWidth: 300,\n defaultHeight: 120,\n inputs: [\n inputs.title,\n inputs.description,\n { ...inputs.placeholder, defaultValue: 'Select a granularity' },\n {\n ...inputs.granularities,\n label: 'Available granularities',\n category: 'Pre-configured variables',\n // Ignore seconds and minutes\n defaultValue: [\n Granularity.hour,\n Granularity.day,\n Granularity.week,\n Granularity.month,\n Granularity.quarter,\n Granularity.year,\n ],\n },\n {\n ...inputs.granularity,\n label: 'Selected granularity',\n category: 'Pre-configured variables',\n },\n {\n ...inputs.timeRange,\n name: 'primaryTimeRange',\n label: 'Primary date-range',\n description:\n 'Connect your primary date-range variable to enable automatic selection of the most appropriate granularity',\n category: 'Pre-configured variables',\n },\n { ...inputs.clearable, defaultValue: false },\n ],\n events: [\n {\n name: 'onChange',\n label: 'Selected granularity updated',\n properties: [\n {\n name: 'value',\n label: 'Selected granularity',\n type: 'granularity',\n },\n ],\n },\n ],\n variables: [\n {\n name: 'granularity value',\n type: 'granularity',\n defaultValue: 'day',\n inputs: ['granularity'],\n events: [{ name: 'onChange', property: 'value' }],\n },\n ],\n} as const satisfies EmbeddedComponentMeta;\n\nexport default defineComponent(DateTimeSelectFieldPro, meta, {\n props: (inputs: Inputs<typeof meta>) => {\n return {\n ...inputs,\n };\n },\n events: {\n onChange: (granularity) => ({\n value: granularity ?? Value.noFilter(),\n }),\n },\n});\n"],"names":["Granularity","defaultGranularitySelectFieldOptions","DEFAULT_MIN_BUCKETS","DEFAULT_MAX_BUCKETS","getGranularitySelectFieldOptions","opt","resolveI18nString","toDate","d","parsed","toExclusiveEnd","endInclusive","bucketCountByUnit","start","endExclusive","unitMs","bucketCount","granularity","isGranularityValid","buckets","getAvailableGranularityOptionsFromTimeRange","timeRange","allOptions","from","to","validSet","g","GranularitySelectFieldPro","props","theme","useTheme","i18nSetup","granularities","clearable","onChange","description","placeholder","title","primaryTimeRange","resolveI18nProps","granularitySelectFieldOptions","availableOptions","useMemo","useEffect","newGranularity","_a","safeValue","jsx","EditorCard","SingleSelectField","meta","inputs","GranularitySelectFieldPro_emb","defineComponent","DateTimeSelectFieldPro","Value"],"mappings":";;;;;AAEO,MAAMA,IAAc;AAAA,EACzB,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AACR,GAKaC,IAAgE;AAAA,EAC3E,EAAE,OAAOD,EAAY,QAAQ,OAAO,4CAAA;AAAA,EACpC,EAAE,OAAOA,EAAY,QAAQ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,EAAY;AAAA,QACZA,EAAY;AAAA,QACZA,EAAY;AAAA,QACZA,EAAY;AAAA,QACZA,EAAY;AAAA,QACZA,EAAY;AAAA,MAAA;AAAA,IACd;AAAA,IAEF;AAAA,MACE,GAAGmD,EAAO;AAAA,MACV,OAAO;AAAA,MACP,UAAU;AAAA,IAAA;AAAA,IAEZ;AAAA,MACE,GAAGA,EAAO;AAAA,MACV,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aACE;AAAA,MACF,UAAU;AAAA,IAAA;AAAA,IAEZ,EAAE,GAAGA,EAAO,WAAW,cAAc,GAAA;AAAA,EAAM;AAAA,EAE7C,QAAQ;AAAA,IACN;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,YAAY;AAAA,QACV;AAAA,UACE,MAAM;AAAA,UACN,OAAO;AAAA,UACP,MAAM;AAAA,QAAA;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EAEF,WAAW;AAAA,IACT;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,cAAc;AAAA,MACd,QAAQ,CAAC,aAAa;AAAA,MACtB,QAAQ,CAAC,EAAE,MAAM,YAAY,UAAU,SAAS;AAAA,IAAA;AAAA,EAClD;AAEJ,GAEAC,IAAeC,EAAgBC,GAAwBJ,GAAM;AAAA,EAC3D,OAAO,CAACC,OACC;AAAA,IACL,GAAGA;AAAAA,EAAA;AAAA,EAGP,QAAQ;AAAA,IACN,UAAU,CAAClC,OAAiB;AAAA,MAC1B,OAAOA,KAAesC,EAAM,SAAA;AAAA,IAAS;AAAA,EACvC;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"GranularitySelectFieldPro.js","sources":["../src/theme/defaults/defaults.GranularityOptions.constants.ts","../src/components/editors/GranularitySelectFieldPro/GranularitySelectFieldPro.utils.ts","../src/components/editors/GranularitySelectFieldPro/index.tsx","../src/components/editors/GranularitySelectFieldPro/GranularitySelectFieldPro.emb.ts"],"sourcesContent":["import { SelectListOptionProps } from '@embeddable.com/remarkable-ui';\n\nexport const Granularity = {\n second: 'second',\n minute: 'minute',\n hour: 'hour',\n day: 'day',\n week: 'week',\n month: 'month',\n quarter: 'quarter',\n year: 'year',\n} as const;\n\nexport type TGranularity = keyof typeof Granularity;\nexport type TGranularityValue = (typeof Granularity)[TGranularity];\n\nexport const defaultGranularitySelectFieldOptions: SelectListOptionProps[] = [\n { value: Granularity.second, label: 'defaults.granularityOptions.second|Second' },\n { value: Granularity.minute, label: 'defaults.granularityOptions.minute|Minute' },\n { value: Granularity.hour, label: 'defaults.granularityOptions.hour|Hour' },\n { value: Granularity.day, label: 'defaults.granularityOptions.day|Day' },\n { value: Granularity.week, label: 'defaults.granularityOptions.week|Week' },\n { value: Granularity.month, label: 'defaults.granularityOptions.month|Month' },\n { value: Granularity.quarter, label: 'defaults.granularityOptions.quarter|Quarter' },\n { value: Granularity.year, label: 'defaults.granularityOptions.year|Year' },\n];\n","import { SelectListOptionProps } from '@embeddable.com/remarkable-ui';\nimport { TimeRange } from '@embeddable.com/core';\nimport {\n defaultGranularitySelectFieldOptions,\n Granularity,\n TGranularity,\n TGranularityValue,\n} from '../../../theme/defaults/defaults.GranularityOptions.constants';\nimport { resolveI18nString } from '../../component.utils';\n\nconst DEFAULT_MIN_BUCKETS = 1;\nconst DEFAULT_MAX_BUCKETS = 100;\n\nexport const getGranularitySelectFieldOptions = (): SelectListOptionProps[] => {\n return defaultGranularitySelectFieldOptions.map((opt) => ({\n ...opt,\n label: resolveI18nString(opt.label),\n }));\n};\n\n// Convert possibly-string timestamps to Date safely.\nconst toDate = (d: unknown): Date | null => {\n if (d instanceof Date) return isNaN(d.getTime()) ? null : d;\n if (typeof d === 'string' || typeof d === 'number') {\n const parsed = new Date(d);\n return isNaN(parsed.getTime()) ? null : parsed;\n }\n return null;\n};\n\n// Inclusive end -> Exclusive end helper (only used for sub-day diffs)\nconst toExclusiveEnd = (endInclusive: Date): Date => new Date(endInclusive.getTime() + 1);\n\nconst bucketCountByUnit = (start: Date, endExclusive: Date, unitMs: number): number => {\n return (endExclusive.getTime() - start.getTime()) / unitMs;\n};\n\n// Bucket counting (treat end as INCLUSIVE)\nfunction bucketCount(start: Date, endInclusive: Date, granularity: TGranularity): number {\n if (start > endInclusive) return 0;\n\n switch (granularity) {\n case Granularity.second:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 1000);\n\n case Granularity.minute:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 60 * 1000);\n\n case Granularity.hour:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 60 * 60 * 1000);\n\n case Granularity.day:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 24 * 60 * 60 * 1000);\n\n case Granularity.week:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 7 * 24 * 60 * 60 * 1000);\n\n case Granularity.month:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 28 * 24 * 60 * 60 * 1000); // shortest month\n\n case Granularity.quarter:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 90 * 24 * 60 * 60 * 1000); // shortest quarter\n\n case Granularity.year:\n return bucketCountByUnit(start, toExclusiveEnd(endInclusive), 365 * 24 * 60 * 60 * 1000); // shortest year\n }\n}\n\nconst isGranularityValid = (\n start: Date,\n endInclusive: Date,\n granularity: TGranularityValue,\n): boolean => {\n const buckets = bucketCount(start, endInclusive, granularity);\n return buckets >= DEFAULT_MIN_BUCKETS && buckets <= DEFAULT_MAX_BUCKETS;\n};\n\nexport const getAvailableGranularityOptionsFromTimeRange = (\n timeRange: TimeRange,\n allOptions: SelectListOptionProps[],\n): SelectListOptionProps[] => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const from = toDate((timeRange as any)?.from);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const to = toDate((timeRange as any)?.to);\n\n // If we can’t parse range, don’t hide anything (fail open)\n if (!from || !to) return allOptions;\n\n const validSet = new Set<TGranularityValue>();\n\n for (const opt of allOptions) {\n const g = opt.value as TGranularityValue;\n if (isGranularityValid(from, to, g)) {\n validSet.add(g);\n }\n }\n\n // preserve original UI ordering\n return allOptions.filter((opt) => validSet.has(opt.value as TGranularityValue));\n};\n\nexport const getSafeSelection = (\n availableOptions: SelectListOptionProps[],\n granularity?: string,\n): string | undefined => {\n if (!granularity) {\n return undefined;\n }\n\n if (availableOptions.some((opt) => opt.value === granularity)) {\n return granularity;\n }\n\n const optionToSelect = availableOptions.length > 2 ? 1 : 0;\n\n return availableOptions[optionToSelect]?.value as string;\n};\n","import { useEffect, useMemo } from 'react';\nimport { useTheme } from '@embeddable.com/react';\nimport { SingleSelectField } from '@embeddable.com/remarkable-ui';\nimport { TimeRange } from '@embeddable.com/core';\nimport { Theme } from '../../../theme/theme.types';\nimport { i18nSetup } from '../../../theme/i18n/i18n';\nimport { resolveI18nProps } from '../../component.utils';\nimport { EditorCard } from '../shared/EditorCard/EditorCard';\nimport {\n getAvailableGranularityOptionsFromTimeRange,\n getGranularitySelectFieldOptions,\n getSafeSelection,\n} from './GranularitySelectFieldPro.utils';\n\ntype GranularitySelectFieldProProps = {\n description?: string;\n onChange: (newGranularity: string) => void;\n placeholder?: string;\n primaryTimeRange: TimeRange;\n title?: string;\n granularity?: string;\n granularities?: string[];\n clearable?: boolean;\n};\n\nconst GranularitySelectFieldPro = (props: GranularitySelectFieldProProps) => {\n const theme: Theme = useTheme() as Theme;\n i18nSetup(theme);\n\n const { granularity, granularities, clearable, onChange } = props;\n const { description, placeholder, title, primaryTimeRange } = resolveI18nProps(props);\n\n const granularitySelectFieldOptions = getGranularitySelectFieldOptions();\n\n const availableOptions = useMemo(() => {\n return getAvailableGranularityOptionsFromTimeRange(\n primaryTimeRange,\n granularitySelectFieldOptions.filter((opt) => granularities?.includes(opt.value as string)),\n );\n }, [primaryTimeRange, granularities]);\n\n useEffect(() => {\n if (granularity) {\n // Selected granularity is not available\n // Select 1st available option when number of options is =< 2\n // Select 2nd option to avoid when number of options > 2\n if (!availableOptions.some((opt) => opt.value === granularity)) {\n const newGranularity = getSafeSelection(availableOptions, granularity);\n if (newGranularity) {\n onChange(newGranularity);\n }\n }\n }\n }, [availableOptions, granularity, onChange]);\n\n const safeValue = getSafeSelection(availableOptions, granularity);\n\n return (\n <EditorCard title={title} subtitle={description}>\n <SingleSelectField\n clearable={clearable}\n placeholder={placeholder}\n value={safeValue}\n options={availableOptions}\n onChange={onChange}\n />\n </EditorCard>\n );\n};\n\nexport default GranularitySelectFieldPro;\n","import { defineComponent, EmbeddedComponentMeta, Inputs } from '@embeddable.com/react';\nimport { Value } from '@embeddable.com/core';\nimport DateTimeSelectFieldPro from './index';\nimport { inputs } from '../../component.inputs.constants';\nimport { Granularity } from '../../../theme/defaults/defaults.GranularityOptions.constants';\n\nexport const meta = {\n name: 'GranularitySelectFieldPro',\n label: 'Granularity Select Field',\n category: 'Dropdowns',\n defaultWidth: 300,\n defaultHeight: 120,\n inputs: [\n inputs.title,\n inputs.description,\n { ...inputs.placeholder, defaultValue: 'Select a granularity' },\n {\n ...inputs.granularities,\n label: 'Available granularities',\n category: 'Pre-configured variables',\n // Ignore seconds and minutes\n defaultValue: [\n Granularity.hour,\n Granularity.day,\n Granularity.week,\n Granularity.month,\n Granularity.quarter,\n Granularity.year,\n ],\n },\n {\n ...inputs.granularity,\n label: 'Selected granularity',\n category: 'Pre-configured variables',\n },\n {\n ...inputs.timeRange,\n name: 'primaryTimeRange',\n label: 'Primary date-range',\n description:\n 'Connect your primary date-range variable to enable automatic selection of the most appropriate granularity',\n category: 'Pre-configured variables',\n },\n { ...inputs.clearable, defaultValue: false },\n ],\n events: [\n {\n name: 'onChange',\n label: 'Selected granularity updated',\n properties: [\n {\n name: 'value',\n label: 'Selected granularity',\n type: 'granularity',\n },\n ],\n },\n ],\n variables: [\n {\n name: 'granularity value',\n type: 'granularity',\n defaultValue: 'day',\n inputs: ['granularity'],\n events: [{ name: 'onChange', property: 'value' }],\n },\n ],\n} as const satisfies EmbeddedComponentMeta;\n\nexport default defineComponent(DateTimeSelectFieldPro, meta, {\n props: (inputs: Inputs<typeof meta>) => {\n return {\n ...inputs,\n };\n },\n events: {\n onChange: (granularity) => ({\n value: granularity ?? Value.noFilter(),\n }),\n },\n});\n"],"names":["Granularity","defaultGranularitySelectFieldOptions","DEFAULT_MIN_BUCKETS","DEFAULT_MAX_BUCKETS","getGranularitySelectFieldOptions","opt","resolveI18nString","toDate","d","parsed","toExclusiveEnd","endInclusive","bucketCountByUnit","start","endExclusive","unitMs","bucketCount","granularity","isGranularityValid","buckets","getAvailableGranularityOptionsFromTimeRange","timeRange","allOptions","from","to","validSet","g","getSafeSelection","availableOptions","optionToSelect","_a","GranularitySelectFieldPro","props","theme","useTheme","i18nSetup","granularities","clearable","onChange","description","placeholder","title","primaryTimeRange","resolveI18nProps","granularitySelectFieldOptions","useMemo","useEffect","newGranularity","safeValue","jsx","EditorCard","SingleSelectField","meta","inputs","GranularitySelectFieldPro_emb","defineComponent","DateTimeSelectFieldPro","Value"],"mappings":";;;;;AAEO,MAAMA,IAAc;AAAA,EACzB,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AACR,GAKaC,IAAgE;AAAA,EAC3E,EAAE,OAAOD,EAAY,QAAQ,OAAO,4CAAA;AAAA,EACpC,EAAE,OAAOA,EAAY,QAAQ,OAAO,4CAAA;AAAA,EACpC,EAAE,OAAOA,EAAY,MAAM,OAAO,wCAAA;AAAA,EAClC,EAAE,OAAOA,EAAY,KAAK,OAAO,sCAAA;AAAA,EACjC,EAAE,OAAOA,EAAY,MAAM,OAAO,wCAAA;AAAA,EAClC,EAAE,OAAOA,EAAY,OAAO,OAAO,0CAAA;AAAA,EACnC,EAAE,OAAOA,EAAY,SAAS,OAAO,8CAAA;AAAA,EACrC,EAAE,OAAOA,EAAY,MAAM,OAAO,wCAAA;AACpC,GCfME,IAAsB,GACt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AAO;AAAA,MACP,UAAU;AAAA,IAAA;AAAA,IAEZ;AAAA,MACE,GAAGA,EAAO;AAAA,MACV,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aACE;AAAA,MACF,UAAU;AAAA,IAAA;AAAA,IAEZ,EAAE,GAAGA,EAAO,WAAW,cAAc,GAAA;AAAA,EAAM;AAAA,EAE7C,QAAQ;AAAA,IACN;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,YAAY;AAAA,QACV;AAAA,UACE,MAAM;AAAA,UACN,OAAO;AAAA,UACP,MAAM;AAAA,QAAA;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EAEF,WAAW;AAAA,IACT;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,cAAc;AAAA,MACd,QAAQ,CAAC,aAAa;AAAA,MACtB,QAAQ,CAAC,EAAE,MAAM,YAAY,UAAU,SAAS;AAAA,IAAA;AAAA,EAClD;AAEJ,GAEAC,IAAeC,EAAgBC,GAAwBJ,GAAM;AAAA,EAC3D,OAAO,CAACC,OACC;AAAA,IACL,GAAGA;AAAAA,EAAA;AAAA,EAGP,QAAQ;AAAA,IACN,UAAU,CAACpC,OAAiB;AAAA,MAC1B,OAAOA,KAAewC,EAAM,SAAA;AAAA,IAAS;AAAA,EACvC;AAEJ,CAAC;"}
|
package/dist/HeatMapPro.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as t, l as a } from "./Color.type.emb-
|
|
1
|
+
import { g as t, l as a } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
2
2
|
import { defineComponent as n } from "@embeddable.com/react";
|
|
3
|
-
import { H as i } from "./index-
|
|
4
|
-
import { b as e } from "./component.inputs.constants-
|
|
3
|
+
import { H as i } from "./index-Cv4JGkHO.js";
|
|
4
|
+
import { b as e } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const r = {
|
|
6
6
|
name: "HeatMapPro",
|
|
7
7
|
label: "Heat Map",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as n } from "@embeddable.com/react";
|
|
2
|
-
import { K as m } from "./index-
|
|
3
|
-
import { l as r } from "./Color.type.emb-
|
|
4
|
-
import { b as a } from "./component.inputs.constants-
|
|
2
|
+
import { K as m } from "./index-DkmPuuV8.js";
|
|
3
|
+
import { l as r } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
4
|
+
import { b as a } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const l = {
|
|
6
6
|
name: "KpiChartNumberComparisonPro",
|
|
7
7
|
label: "Kpi Chart - Number Comparison",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as e } from "@embeddable.com/react";
|
|
2
|
-
import { K as a } from "./index-
|
|
3
|
-
import { l as o } from "./Color.type.emb-
|
|
4
|
-
import { b as r } from "./component.inputs.constants-
|
|
2
|
+
import { K as a } from "./index-Dhzhtagm.js";
|
|
3
|
+
import { l as o } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
4
|
+
import { b as r } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const m = {
|
|
6
6
|
name: "KpiChartNumberPro",
|
|
7
7
|
label: "Kpi Chart - Number",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as m } from "@embeddable.com/react";
|
|
2
|
-
import { L as p } from "./index-
|
|
3
|
-
import { V as c, l as s } from "./Color.type.emb-
|
|
4
|
-
import { b as e, s as i } from "./component.inputs.constants-
|
|
2
|
+
import { L as p } from "./index-CQ_mo5Eg.js";
|
|
3
|
+
import { V as c, l as s } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
4
|
+
import { b as e, s as i } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const d = {
|
|
6
6
|
name: "LineChartComparisonDefaultPro",
|
|
7
7
|
label: "Line Chart Comparison - Default",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as s } from "@embeddable.com/react";
|
|
2
|
-
import { L as n } from "./index-
|
|
3
|
-
import { V as i, l as o } from "./Color.type.emb-
|
|
4
|
-
import { b as e, s as l } from "./component.inputs.constants-
|
|
2
|
+
import { L as n } from "./index-XTTodJI4.js";
|
|
3
|
+
import { V as i, l as o } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
4
|
+
import { b as e, s as l } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const t = {
|
|
6
6
|
name: "LineChartDefaultPro",
|
|
7
7
|
label: "Line Chart - Default",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as a } from "@embeddable.com/react";
|
|
2
|
-
import { L as o } from "./index-
|
|
3
|
-
import { V as i, l as s } from "./Color.type.emb-
|
|
4
|
-
import { b as e } from "./component.inputs.constants-
|
|
2
|
+
import { L as o } from "./index-BBcQWvRk.js";
|
|
3
|
+
import { V as i, l as s } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
4
|
+
import { b as e } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const t = {
|
|
6
6
|
name: "LineChartGroupedPro",
|
|
7
7
|
label: "Line Chart - Grouped",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as r } from "@embeddable.com/react";
|
|
2
|
-
import { V as t, l as s } from "./Color.type.emb-
|
|
3
|
-
import { M as d, a as u } from "./index-
|
|
4
|
-
import { b as a } from "./component.inputs.constants-
|
|
2
|
+
import { V as t, l as s } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
3
|
+
import { M as d, a as u } from "./index-CSoASUv1.js";
|
|
4
|
+
import { b as a } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const m = {
|
|
6
6
|
name: "MultiSelectFieldPro",
|
|
7
7
|
label: "Multi Select Field",
|
package/dist/PieChartPro.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V as o, l as a } from "./Color.type.emb-
|
|
1
|
+
import { V as o, l as a } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
2
2
|
import { defineComponent as s } from "@embeddable.com/react";
|
|
3
|
-
import { P as i } from "./index-
|
|
4
|
-
import { b as e } from "./component.inputs.constants-
|
|
3
|
+
import { P as i } from "./index-Dp7Av-Oy.js";
|
|
4
|
+
import { b as e } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const n = {
|
|
6
6
|
name: "PieChartPro",
|
|
7
7
|
label: "Pie Chart",
|
package/dist/PivotTablePro.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { l as a } from "./Color.type.emb-
|
|
1
|
+
import { l as a } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
2
2
|
import { defineComponent as n } from "@embeddable.com/react";
|
|
3
|
-
import { P as s } from "./index-
|
|
4
|
-
import { b as e, s as t } from "./component.inputs.constants-
|
|
3
|
+
import { P as s } from "./index-DoFkdyxp.js";
|
|
4
|
+
import { b as e, s as t } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const l = {
|
|
6
6
|
name: "PivotTablePro",
|
|
7
7
|
label: "Pivot Table",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as r } from "@embeddable.com/react";
|
|
2
|
-
import { V as l, l as s } from "./Color.type.emb-
|
|
3
|
-
import { M as d, S as m } from "./index-
|
|
4
|
-
import { b as a } from "./component.inputs.constants-
|
|
2
|
+
import { V as l, l as s } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
3
|
+
import { M as d, S as m } from "./index-Du2TCRQq.js";
|
|
4
|
+
import { b as a } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const c = {
|
|
6
6
|
name: "SingleSelectFieldPro",
|
|
7
7
|
label: "Single Select Field",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V as u, l as s, m as f } from "./Color.type.emb-
|
|
1
|
+
import { V as u, l as s, m as f } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
2
2
|
import { defineComponent as g } from "@embeddable.com/react";
|
|
3
|
-
import { T as p } from "./index-
|
|
4
|
-
import { b as n, s as l } from "./component.inputs.constants-
|
|
3
|
+
import { T as p } from "./index-1vsLONt_.js";
|
|
4
|
+
import { b as n, s as l } from "./component.inputs.constants-CNdmawDt.js";
|
|
5
5
|
const b = {
|
|
6
6
|
name: "TableChartPaginated",
|
|
7
7
|
label: "Table Chart - Paginated",
|
package/dist/TableScrollable.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { j as V,
|
|
1
|
+
import { j as V, t as re, V as oe, l as T, m as ae } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
2
2
|
import { useTheme as se, defineComponent as ie } from "@embeddable.com/react";
|
|
3
|
-
import { a as le, r as ue, i as ce, b as E, s as S } from "./component.inputs.constants-
|
|
4
|
-
import { C as fe } from "./ChartCard-
|
|
3
|
+
import { a as le, r as ue, i as ce, b as E, s as S } from "./component.inputs.constants-CNdmawDt.js";
|
|
4
|
+
import { C as fe } from "./ChartCard-D_A88_bS.js";
|
|
5
5
|
import { useState as N, useRef as R, useEffect as M, useCallback as de } from "react";
|
|
6
|
-
import { b as me, c as pe } from "./tables.utils-
|
|
6
|
+
import { b as me, c as pe } from "./tables.utils-8OmfcPmH.js";
|
|
7
7
|
const v = 25, { getOwnPropertyNames: ge, getOwnPropertySymbols: he } = Object, { hasOwnProperty: be } = Object.prototype;
|
|
8
8
|
function k(t, e) {
|
|
9
9
|
return function(n, a, i) {
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as
|
|
1
|
+
import { a as N, C as P, b as v } from "./Color.type.emb-Dkh_ZrO6.js";
|
|
2
|
+
import { r as x, g as F } from "./charts.utils-CUPowt7F.js";
|
|
3
|
+
import { g as h } from "./formatter.utils-BiWZBhcE.js";
|
|
3
4
|
import { g as p, a as g } from "./object.utils-D_Zzon-H.js";
|
|
4
|
-
|
|
5
|
-
const B = (l, c) => {
|
|
5
|
+
const I = (c, d) => {
|
|
6
6
|
var b;
|
|
7
|
-
const m = h(
|
|
7
|
+
const m = h(d), { data: o = [], dimension: i, groupDimension: l, measure: t } = c, r = [...new Set(o.map((n) => n[i.name]).filter((n) => n != null))].sort(), a = `${l.name}${l.nativeType === P && ((b = l.inputs) != null && b.granularity) ? `.${l.inputs.granularity}` : ""}`, e = [...new Set(o.map((n) => n[a]))].filter((n) => n != null), s = p(d), u = v(), C = e.map((n, k) => {
|
|
8
8
|
const D = g(
|
|
9
9
|
`${s}.charts.backgroundColors`,
|
|
10
|
-
`${
|
|
11
|
-
|
|
10
|
+
`${l.name}.${n}`,
|
|
11
|
+
d.charts.backgroundColors ?? u,
|
|
12
12
|
k
|
|
13
|
-
),
|
|
13
|
+
), T = g(
|
|
14
14
|
`${s}.charts.borderColors`,
|
|
15
|
-
`${
|
|
16
|
-
|
|
15
|
+
`${l.name}.${n}`,
|
|
16
|
+
d.charts.borderColors ?? u,
|
|
17
17
|
k
|
|
18
18
|
);
|
|
19
19
|
return {
|
|
20
|
-
label: m.data(
|
|
20
|
+
label: m.data(l, n),
|
|
21
21
|
rawLabel: n,
|
|
22
22
|
backgroundColor: D,
|
|
23
|
-
borderColor:
|
|
24
|
-
data: r.map((
|
|
23
|
+
borderColor: T,
|
|
24
|
+
data: r.map((w) => {
|
|
25
25
|
const f = o.find(
|
|
26
|
-
($) => $[a] === n && $[i.name] ===
|
|
26
|
+
($) => $[a] === n && $[i.name] === w
|
|
27
27
|
);
|
|
28
28
|
return f ? Number(f[t.name]) : 0;
|
|
29
29
|
})
|
|
@@ -33,25 +33,25 @@ const B = (l, c) => {
|
|
|
33
33
|
labels: r,
|
|
34
34
|
datasets: C
|
|
35
35
|
};
|
|
36
|
-
},
|
|
37
|
-
if (!
|
|
36
|
+
}, B = (c, d = x) => {
|
|
37
|
+
if (!c.data)
|
|
38
38
|
return {
|
|
39
39
|
labels: [],
|
|
40
40
|
datasets: [{ data: [] }]
|
|
41
41
|
};
|
|
42
|
-
const m = h(
|
|
42
|
+
const m = h(d), o = p(d), i = F(c.data, c.dimension, c.measures, c.maxItems), l = N();
|
|
43
43
|
return {
|
|
44
|
-
labels: i.map((t) => t[
|
|
45
|
-
datasets:
|
|
44
|
+
labels: i.map((t) => t[c.dimension.name]),
|
|
45
|
+
datasets: c.measures.map((t, r) => {
|
|
46
46
|
const a = g(
|
|
47
47
|
`${o}.charts.backgroundColors`,
|
|
48
48
|
t.name,
|
|
49
|
-
|
|
49
|
+
d.charts.backgroundColors ?? l,
|
|
50
50
|
r
|
|
51
51
|
), e = g(
|
|
52
52
|
`${o}.charts.borderColors`,
|
|
53
53
|
t.name,
|
|
54
|
-
|
|
54
|
+
d.charts.borderColors ?? l,
|
|
55
55
|
r
|
|
56
56
|
);
|
|
57
57
|
return {
|
|
@@ -62,21 +62,21 @@ const B = (l, c) => {
|
|
|
62
62
|
};
|
|
63
63
|
})
|
|
64
64
|
};
|
|
65
|
-
},
|
|
66
|
-
const { datasets: m } =
|
|
65
|
+
}, O = (c, d) => {
|
|
66
|
+
const { datasets: m } = c.chart.data, o = c.dataIndex, i = m.reduce((l, t) => {
|
|
67
67
|
const r = t.data[o];
|
|
68
|
-
return
|
|
68
|
+
return l + (r || 0);
|
|
69
69
|
}, 0);
|
|
70
|
-
return
|
|
71
|
-
},
|
|
72
|
-
const { onBarClicked: m, measures: o, dimension: i, horizontal:
|
|
70
|
+
return d(i);
|
|
71
|
+
}, K = (c, d) => {
|
|
72
|
+
const { onBarClicked: m, measures: o, dimension: i, horizontal: l, data: t } = c, r = h(d);
|
|
73
73
|
return {
|
|
74
74
|
plugins: {
|
|
75
|
-
legend: { position:
|
|
75
|
+
legend: { position: d.charts.legendPosition ?? "bottom" },
|
|
76
76
|
datalabels: {
|
|
77
77
|
labels: {
|
|
78
78
|
total: {
|
|
79
|
-
formatter: (a, e) =>
|
|
79
|
+
formatter: (a, e) => O(
|
|
80
80
|
e,
|
|
81
81
|
(s) => r.data(o[0], s)
|
|
82
82
|
)
|
|
@@ -107,7 +107,7 @@ const B = (l, c) => {
|
|
|
107
107
|
x: {
|
|
108
108
|
ticks: {
|
|
109
109
|
callback: (a) => {
|
|
110
|
-
if (
|
|
110
|
+
if (l)
|
|
111
111
|
return r.data(o[0], a);
|
|
112
112
|
if (!t || !t.labels) return;
|
|
113
113
|
const e = t.labels[Number(a)];
|
|
@@ -118,7 +118,7 @@ const B = (l, c) => {
|
|
|
118
118
|
y: {
|
|
119
119
|
ticks: {
|
|
120
120
|
callback: (a) => {
|
|
121
|
-
if (!
|
|
121
|
+
if (!l)
|
|
122
122
|
return r.data(o[0], a);
|
|
123
123
|
if (!t || !t.labels) return;
|
|
124
124
|
const e = t.labels[Number(a)];
|
|
@@ -138,8 +138,8 @@ const B = (l, c) => {
|
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
140
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
B as a,
|
|
142
|
+
K as b,
|
|
143
|
+
I as g
|
|
144
144
|
};
|
|
145
|
-
//# sourceMappingURL=bars.utils-
|
|
145
|
+
//# sourceMappingURL=bars.utils-CsJD9MNL.js.map
|