@embeddable.com/remarkable-ui 0.1.30 → 0.1.31
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 +1 -1
- package/dist/BarChartDefaultPro.js +1 -1
- package/dist/BarChartGroupedHorizontalPro.js +1 -1
- package/dist/BarChartGroupedPro.js +1 -1
- package/dist/BarChartStackedHorizontalPro.js +1 -1
- package/dist/BarChartStackedPro.js +1 -1
- package/dist/DateRangeSelectFieldPro.js +1 -1
- package/dist/KpiChartNumberComparisonPro.js +10 -10
- package/dist/KpiChartNumberComparisonPro.js.map +1 -1
- package/dist/LineChartComparisonDefaultPro.js +1 -1
- package/dist/LineChartDefaultPro.js +1 -1
- package/dist/LineChartGroupedPro.js +1 -1
- package/dist/{charts.newFillGaps.hooks-CJLaShd4.js → charts.newFillGaps.hooks-8oF8pYjr.js} +20 -20
- package/dist/charts.newFillGaps.hooks-8oF8pYjr.js.map +1 -0
- package/dist/embeddable-components.json +12 -12
- package/dist/{index-CS8g--Wz.js → index-DXHlr-gm.js} +17 -15
- package/dist/{index-CS8g--Wz.js.map → index-DXHlr-gm.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/index.d.ts.map +1 -1
- package/dist/remarkable-pro/components/editors/DateRangeSelectFieldPro/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/charts.newFillGaps.hooks-CJLaShd4.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { i as L, r as w, m as M, j as l, d as V, a as y, b as z, t as P, c as k,
|
|
|
2
2
|
import { useTheme as W, defineComponent as _ } from "@embeddable.com/react";
|
|
3
3
|
import { C as q } from "./ChartCard-CACbKXZ7.js";
|
|
4
4
|
import { g as J, a as K, B as N } from "./bars.utils-BaxcPPid.js";
|
|
5
|
-
import { u as Q } from "./charts.newFillGaps.hooks-
|
|
5
|
+
import { u as Q } from "./charts.newFillGaps.hooks-8oF8pYjr.js";
|
|
6
6
|
const U = (a) => {
|
|
7
7
|
var i, n;
|
|
8
8
|
const s = W();
|
|
@@ -2,7 +2,7 @@ import { i as L, r as y, m as w, j as l, d as M, a as V, b as P, t as v, c as k,
|
|
|
2
2
|
import { useTheme as W, defineComponent as _ } from "@embeddable.com/react";
|
|
3
3
|
import { C as H } from "./ChartCard-CACbKXZ7.js";
|
|
4
4
|
import { g as J, a as K, B as N } from "./bars.utils-BaxcPPid.js";
|
|
5
|
-
import { u as Q } from "./charts.newFillGaps.hooks-
|
|
5
|
+
import { u as Q } from "./charts.newFillGaps.hooks-8oF8pYjr.js";
|
|
6
6
|
const U = (a) => {
|
|
7
7
|
var o, n;
|
|
8
8
|
const s = W();
|
|
@@ -2,7 +2,7 @@ import { i as L, r as w, m as k, j as m, d as z, w as G, b as P, z as R, t as M,
|
|
|
2
2
|
import { useTheme as q, defineComponent as J } from "@embeddable.com/react";
|
|
3
3
|
import { C as K } from "./ChartCard-CACbKXZ7.js";
|
|
4
4
|
import { b as N, a as Q, B as U } from "./bars.utils-BaxcPPid.js";
|
|
5
|
-
import { u as X } from "./charts.newFillGaps.hooks-
|
|
5
|
+
import { u as X } from "./charts.newFillGaps.hooks-8oF8pYjr.js";
|
|
6
6
|
const Z = (e) => {
|
|
7
7
|
var n, l;
|
|
8
8
|
const a = q();
|
|
@@ -2,7 +2,7 @@ import { i as L, r as w, m as G, j as m, d as k, w as P, b as R, z as M, t as j,
|
|
|
2
2
|
import { useTheme as H, defineComponent as J } from "@embeddable.com/react";
|
|
3
3
|
import { C as K } from "./ChartCard-CACbKXZ7.js";
|
|
4
4
|
import { b as N, a as Q, B as U } from "./bars.utils-BaxcPPid.js";
|
|
5
|
-
import { u as Y } from "./charts.newFillGaps.hooks-
|
|
5
|
+
import { u as Y } from "./charts.newFillGaps.hooks-8oF8pYjr.js";
|
|
6
6
|
const Z = (e) => {
|
|
7
7
|
var n, l;
|
|
8
8
|
const a = H();
|
|
@@ -2,7 +2,7 @@ import { i as L, r as f, m as w, j as m, d as S, w as z, b as P, z as R, t as M,
|
|
|
2
2
|
import { useTheme as J, defineComponent as K } from "@embeddable.com/react";
|
|
3
3
|
import { C as N } from "./ChartCard-CACbKXZ7.js";
|
|
4
4
|
import { b as Q, a as U, B as X } from "./bars.utils-BaxcPPid.js";
|
|
5
|
-
import { u as Z } from "./charts.newFillGaps.hooks-
|
|
5
|
+
import { u as Z } from "./charts.newFillGaps.hooks-8oF8pYjr.js";
|
|
6
6
|
const $ = (a) => {
|
|
7
7
|
var n, l;
|
|
8
8
|
const e = J();
|
|
@@ -2,7 +2,7 @@ import { i as D, r as L, m as w, j as m, d as S, w as P, b as R, z as M, t as T,
|
|
|
2
2
|
import { useTheme as J, defineComponent as K } from "@embeddable.com/react";
|
|
3
3
|
import { C as N } from "./ChartCard-CACbKXZ7.js";
|
|
4
4
|
import { b as Q, a as U, B as Y } from "./bars.utils-BaxcPPid.js";
|
|
5
|
-
import { u as Z } from "./charts.newFillGaps.hooks-
|
|
5
|
+
import { u as Z } from "./charts.newFillGaps.hooks-8oF8pYjr.js";
|
|
6
6
|
const $ = (a) => {
|
|
7
7
|
var n, l;
|
|
8
8
|
const e = J();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as t } from "@embeddable.com/react";
|
|
2
2
|
import { t as l, c as n, a5 as r, V as a } from "./component.constants-B1QqUi2G.js";
|
|
3
|
-
import { D as o } from "./index-
|
|
3
|
+
import { D as o } from "./index-DXHlr-gm.js";
|
|
4
4
|
const i = {
|
|
5
5
|
name: "DateRangeSelectFieldPro",
|
|
6
6
|
label: "Date Range Select Field",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useTheme as j, defineComponent as w } from "@embeddable.com/react";
|
|
2
|
-
import { i as A, r as Y, U as l, j as f, d as q, w as
|
|
2
|
+
import { i as A, r as Y, U as l, j as f, d as q, w as B, W as E, X as M, t as I, c as J, Y as y, Z as c, o as b } from "./component.constants-B1QqUi2G.js";
|
|
3
3
|
import { C as O } from "./ChartCard-CACbKXZ7.js";
|
|
4
4
|
import { useEffect as U } from "react";
|
|
5
5
|
import { K as W } from "./KpiChart-C-SmtMQp.js";
|
|
@@ -7,7 +7,7 @@ import { g as X } from "./formatter.utils-B3HZzPUm.js";
|
|
|
7
7
|
import { g as Z, a as $ } from "./timeRange.utils-C0iy3N-l.js";
|
|
8
8
|
import { C as k } from "./ComparisonPeriod.type.emb-Q_A2MmQY.js";
|
|
9
9
|
const G = (e) => {
|
|
10
|
-
var g, d, C,
|
|
10
|
+
var g, d, C, P, h, u;
|
|
11
11
|
const a = j();
|
|
12
12
|
A(a);
|
|
13
13
|
const { title: i, description: n } = Y(e), {
|
|
@@ -32,11 +32,11 @@ const G = (e) => {
|
|
|
32
32
|
);
|
|
33
33
|
z(m);
|
|
34
34
|
}, [s, JSON.stringify(p), a]);
|
|
35
|
-
const K = (d = (g = o.data) == null ? void 0 : g[0]) == null ? void 0 : d[t.name], T = D ? (
|
|
36
|
-
isLoading: o.isLoading,
|
|
37
|
-
data: o.
|
|
38
|
-
...(
|
|
39
|
-
...(
|
|
35
|
+
const K = (d = (g = o.data) == null ? void 0 : g[0]) == null ? void 0 : d[t.name], T = D ? (P = (C = r == null ? void 0 : r.data) == null ? void 0 : C[0]) == null ? void 0 : P[t.name] : void 0, L = X(a), V = (m) => L.data(t, m), x = `vs ${$(s, a).toLowerCase()}`, _ = {
|
|
36
|
+
isLoading: !!(o.isLoading || r != null && r.isLoading),
|
|
37
|
+
data: !(o != null && o.data) && !(r != null && r.data) ? void 0 : [
|
|
38
|
+
...(h = o.data) != null && h.length ? [{ label: l.t("charts.primaryPeriod"), ...o.data[0] }] : [],
|
|
39
|
+
...(u = r == null ? void 0 : r.data) != null && u.length ? [{ label: l.t("charts.comparisonPeriod"), ...r.data[0] }] : []
|
|
40
40
|
]
|
|
41
41
|
};
|
|
42
42
|
return /* @__PURE__ */ f.jsx(
|
|
@@ -78,10 +78,10 @@ const G = (e) => {
|
|
|
78
78
|
category: "Kpi Charts",
|
|
79
79
|
inputs: [
|
|
80
80
|
q,
|
|
81
|
-
|
|
82
|
-
{ ...
|
|
81
|
+
B,
|
|
82
|
+
{ ...E, name: "timeProperty", label: "Time Property" },
|
|
83
83
|
{
|
|
84
|
-
...
|
|
84
|
+
...M,
|
|
85
85
|
name: "primaryDateRange",
|
|
86
86
|
label: "Primary Date Range",
|
|
87
87
|
description: "You can also connect this to a date range selector using its variable",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KpiChartNumberComparisonPro.js","sources":["../src/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/index.tsx","../src/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/KpiChartNumberComparisonPro.emb.ts"],"sourcesContent":["import { useTheme } from '@embeddable.com/react';\nimport { Theme } from '../../../../theme/theme.types';\nimport { DataResponse, Measure, TimeRange } from '@embeddable.com/core';\nimport { i18n, i18nSetup } from '../../../../theme/i18n/i18n';\nimport { resolveI18nProps } from '../../../component.utils';\nimport { ChartCard } from '../../shared/ChartCard/ChartCard';\nimport { KpiChart } from '../../../../../remarkable-ui';\nimport { getThemeFormatter } from '../../../../theme/formatter/formatter.utils';\nimport { useEffect } from 'react';\nimport {\n getComparisonPeriodDateRange,\n getComparisonPeriodLabel,\n} from '../../../utils/timeRange.utils';\n\ntype KpiChartNumberComparisonProProp = {\n changeFontSize: number;\n comparisonPeriod?: string;\n description: string;\n displayChangeAsPercentage?: boolean;\n fontSize: number;\n measure: Measure;\n primaryDateRange: TimeRange;\n results: DataResponse;\n resultsComparison: DataResponse | undefined;\n reversePositiveNegativeColors?: boolean;\n title: string;\n percentageDecimalPlaces: number;\n comparisonDateRange: TimeRange;\n setComparisonDateRange: (dateRange: TimeRange) => void;\n};\n\nconst KpiChartNumberComparisonPro = (props: KpiChartNumberComparisonProProp) => {\n const theme: Theme = useTheme() as Theme;\n i18nSetup(theme);\n\n const { title, description } = resolveI18nProps(props);\n const {\n changeFontSize,\n comparisonPeriod,\n comparisonDateRange,\n displayChangeAsPercentage,\n fontSize,\n measure,\n primaryDateRange,\n results,\n resultsComparison,\n reversePositiveNegativeColors,\n percentageDecimalPlaces,\n setComparisonDateRange,\n } = props;\n\n useEffect(() => {\n const newComparisonDateRange = getComparisonPeriodDateRange(\n primaryDateRange,\n comparisonPeriod,\n theme,\n );\n setComparisonDateRange(newComparisonDateRange);\n }, [comparisonPeriod, JSON.stringify(primaryDateRange), theme]);\n\n const value: number = results.data?.[0]?.[measure.name];\n const comparisonValue = comparisonDateRange\n ? resultsComparison?.data?.[0]?.[measure.name]\n : undefined;\n\n const themeFormatter = getThemeFormatter(theme);\n const valueFormatter = (valueToFormat: number) => themeFormatter.data(measure, valueToFormat);\n const comparisonLabel = `vs ${getComparisonPeriodLabel(comparisonPeriod, theme).toLowerCase()}`;\n\n const resultsCombined: DataResponse = {\n isLoading: results.isLoading,\n data: results.isLoading\n ? undefined\n : [\n ...(results.data?.length\n ? [{ label: i18n.t('charts.primaryPeriod'), ...results.data[0] }]\n : []),\n ...(resultsComparison?.data?.length\n ? [{ label: i18n.t('charts.comparisonPeriod'), ...resultsComparison.data[0] }]\n : []),\n ],\n };\n\n return (\n <ChartCard\n data={resultsCombined}\n dimensionsAndMeasures={[\n // Add a label dimension to distinguish primary and comparison periods in exports\n {\n name: 'label',\n title: i18n.t('charts.label'),\n nativeType: 'string',\n __type__: 'dimension',\n },\n measure,\n ]}\n errorMessage={results.error}\n subtitle={description}\n title={title}\n >\n <KpiChart\n value={value}\n comparisonValue={comparisonValue}\n valueFormatter={valueFormatter}\n valueFontSize={fontSize}\n changeFontSize={changeFontSize}\n invertChangeColors={reversePositiveNegativeColors}\n showChangeAsPercentage={displayChangeAsPercentage}\n comparisonLabel={comparisonLabel}\n percentageDecimalPlaces={percentageDecimalPlaces}\n />\n </ChartCard>\n );\n};\n\nexport default KpiChartNumberComparisonPro;\n","import { defineComponent, EmbeddedComponentMeta, Inputs } from '@embeddable.com/react';\nimport {\n dataset,\n description,\n dimensionTime,\n genericBoolean,\n genericNumber,\n genericTimeRange,\n measure,\n title,\n} from '../../../component.constants';\nimport KpiChartNumberComparisonPro from './index';\nimport { loadData, TimeRange } from '@embeddable.com/core';\nimport ComparisonPeriodType from '../../../types/ComparisonPeriod.type.emb';\n\nexport const meta = {\n name: 'KpiChartNumberComparisonPro',\n label: 'Kpi Chart - Number Comparison',\n category: 'Kpi Charts',\n inputs: [\n dataset,\n measure,\n { ...dimensionTime, name: 'timeProperty', label: 'Time Property' },\n {\n ...genericTimeRange,\n name: 'primaryDateRange',\n label: 'Primary Date Range',\n description: 'You can also connect this to a date range selector using its variable',\n category: 'Component Data',\n },\n {\n name: 'comparisonPeriod',\n type: ComparisonPeriodType,\n label: 'Comparison Period',\n description: 'You can also connect this to a comparison period selector using its variable',\n category: 'Component Data',\n },\n title,\n description,\n {\n ...genericBoolean,\n name: 'displayChangeAsPercentage',\n label: 'Display Change as %',\n defaultValue: false,\n },\n {\n ...genericNumber,\n name: 'percentageDecimalPlaces',\n label: 'Percentage Decimal Places',\n defaultValue: 1,\n },\n {\n ...genericBoolean,\n name: 'reversePositiveNegativeColors',\n label: 'Reverse Positive/Negative Colors',\n defaultValue: false,\n },\n { ...genericNumber, name: 'fontSize', label: 'Font Size', defaultValue: 44, required: true },\n {\n ...genericNumber,\n name: 'changeFontSize',\n label: 'Change Font Size',\n defaultValue: 16,\n required: true,\n },\n ],\n} as const satisfies EmbeddedComponentMeta;\n\ntype KpiChartNumberComparisonProState = {\n comparisonDateRange: TimeRange;\n};\n\nexport default defineComponent(KpiChartNumberComparisonPro, meta, {\n /* @ts-expect-error - to be fixed in @embeddable.com/react */\n props: (\n inputs: Inputs<typeof meta>,\n [state, setState]: [\n KpiChartNumberComparisonProState,\n (state: KpiChartNumberComparisonProState) => void,\n ],\n ) => {\n return {\n ...inputs,\n comparisonDateRange: state?.comparisonDateRange,\n setComparisonDateRange: (comparisonDateRange: TimeRange) => setState({ comparisonDateRange }),\n results: loadData({\n from: inputs.dataset,\n select: [inputs.measure],\n limit: 1,\n filters:\n inputs.primaryDateRange && inputs.timeProperty\n ? [\n {\n property: inputs.timeProperty,\n operator: 'inDateRange',\n value: inputs.primaryDateRange,\n },\n ]\n : undefined,\n }),\n resultsComparison:\n inputs.primaryDateRange && inputs.timeProperty && state?.comparisonDateRange\n ? loadData({\n from: inputs.dataset,\n select: [inputs.measure],\n limit: 1,\n filters: [\n {\n property: inputs.timeProperty,\n operator: 'inDateRange',\n value: state.comparisonDateRange,\n },\n ],\n })\n : undefined,\n };\n },\n});\n"],"names":["KpiChartNumberComparisonPro","props","theme","useTheme","i18nSetup","title","description","resolveI18nProps","changeFontSize","comparisonPeriod","comparisonDateRange","displayChangeAsPercentage","fontSize","measure","primaryDateRange","results","resultsComparison","reversePositiveNegativeColors","percentageDecimalPlaces","setComparisonDateRange","useEffect","newComparisonDateRange","getComparisonPeriodDateRange","value","_b","_a","comparisonValue","_d","_c","themeFormatter","getThemeFormatter","valueFormatter","valueToFormat","comparisonLabel","getComparisonPeriodLabel","resultsCombined","_e","i18n","_f","jsx","ChartCard","KpiChart","meta","dataset","dimensionTime","genericTimeRange","ComparisonPeriodType","genericBoolean","genericNumber","KpiChartNumberComparisonPro_emb","defineComponent","inputs","state","setState","loadData"],"mappings":";;;;;;;;AA+BA,MAAMA,IAA8B,CAACC,MAA2C;;AAC9E,QAAMC,IAAeC,EAAA;AACrB,EAAAC,EAAUF,CAAK;AAEf,QAAM,EAAE,OAAAG,GAAO,aAAAC,MAAgBC,EAAiBN,CAAK,GAC/C;AAAA,IACJ,gBAAAO;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,+BAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,wBAAAC;AAAA,EAA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,cAAc;AAAA,MACd,UAAU;AAAA,IAAA;AAAA,EACZ;AAEJ,GAMAC,KAAeC,EAAgBlD,GAA6B0C,GAAM;AAAA;AAAA,EAEhE,OAAO,CACLS,GACA,CAACC,GAAOC,CAAQ,OAKT;AAAA,IACL,GAAGF;AAAA,IACH,qBAAqBC,KAAA,gBAAAA,EAAO;AAAA,IAC5B,wBAAwB,CAAC1C,MAAmC2C,EAAS,EAAE,qBAAA3C,GAAqB;AAAA,IAC5F,SAAS4C,EAAS;AAAA,MAChB,MAAMH,EAAO;AAAA,MACb,QAAQ,CAACA,EAAO,OAAO;AAAA,MACvB,OAAO;AAAA,MACP,SACEA,EAAO,oBAAoBA,EAAO,eAC9B;AAAA,QACE;AAAA,UACE,UAAUA,EAAO;AAAA,UACjB,UAAU;AAAA,UACV,OAAOA,EAAO;AAAA,QAAA;AAAA,MAChB,IAEF;AAAA,IAAA,CACP;AAAA,IACD,mBACEA,EAAO,oBAAoBA,EAAO,iBAAgBC,KAAA,QAAAA,EAAO,uBACrDE,EAAS;AAAA,MACP,MAAMH,EAAO;AAAA,MACb,QAAQ,CAACA,EAAO,OAAO;AAAA,MACvB,OAAO;AAAA,MACP,SAAS;AAAA,QACP;AAAA,UACE,UAAUA,EAAO;AAAA,UACjB,UAAU;AAAA,UACV,OAAOC,EAAM;AAAA,QAAA;AAAA,MACf;AAAA,IACF,CACD,IACD;AAAA,EAAA;AAGZ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"KpiChartNumberComparisonPro.js","sources":["../src/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/index.tsx","../src/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/KpiChartNumberComparisonPro.emb.ts"],"sourcesContent":["import { useTheme } from '@embeddable.com/react';\nimport { Theme } from '../../../../theme/theme.types';\nimport { DataResponse, Measure, TimeRange } from '@embeddable.com/core';\nimport { i18n, i18nSetup } from '../../../../theme/i18n/i18n';\nimport { resolveI18nProps } from '../../../component.utils';\nimport { ChartCard } from '../../shared/ChartCard/ChartCard';\nimport { KpiChart } from '../../../../../remarkable-ui';\nimport { getThemeFormatter } from '../../../../theme/formatter/formatter.utils';\nimport { useEffect } from 'react';\nimport {\n getComparisonPeriodDateRange,\n getComparisonPeriodLabel,\n} from '../../../utils/timeRange.utils';\n\ntype KpiChartNumberComparisonProProp = {\n changeFontSize: number;\n comparisonPeriod?: string;\n description: string;\n displayChangeAsPercentage?: boolean;\n fontSize: number;\n measure: Measure;\n primaryDateRange: TimeRange;\n results: DataResponse;\n resultsComparison: DataResponse | undefined;\n reversePositiveNegativeColors?: boolean;\n title: string;\n percentageDecimalPlaces: number;\n comparisonDateRange: TimeRange;\n setComparisonDateRange: (dateRange: TimeRange) => void;\n};\n\nconst KpiChartNumberComparisonPro = (props: KpiChartNumberComparisonProProp) => {\n const theme: Theme = useTheme() as Theme;\n i18nSetup(theme);\n\n const { title, description } = resolveI18nProps(props);\n const {\n changeFontSize,\n comparisonPeriod,\n comparisonDateRange,\n displayChangeAsPercentage,\n fontSize,\n measure,\n primaryDateRange,\n results,\n resultsComparison,\n reversePositiveNegativeColors,\n percentageDecimalPlaces,\n setComparisonDateRange,\n } = props;\n\n useEffect(() => {\n const newComparisonDateRange = getComparisonPeriodDateRange(\n primaryDateRange,\n comparisonPeriod,\n theme,\n );\n setComparisonDateRange(newComparisonDateRange);\n }, [comparisonPeriod, JSON.stringify(primaryDateRange), theme]);\n\n const value: number = results.data?.[0]?.[measure.name];\n const comparisonValue = comparisonDateRange\n ? resultsComparison?.data?.[0]?.[measure.name]\n : undefined;\n\n const themeFormatter = getThemeFormatter(theme);\n const valueFormatter = (valueToFormat: number) => themeFormatter.data(measure, valueToFormat);\n const comparisonLabel = `vs ${getComparisonPeriodLabel(comparisonPeriod, theme).toLowerCase()}`;\n\n const resultsCombined: DataResponse = {\n isLoading: Boolean(results.isLoading || resultsComparison?.isLoading),\n data:\n !results?.data && !resultsComparison?.data\n ? undefined\n : [\n ...(results.data?.length\n ? [{ label: i18n.t('charts.primaryPeriod'), ...results.data[0] }]\n : []),\n ...(resultsComparison?.data?.length\n ? [{ label: i18n.t('charts.comparisonPeriod'), ...resultsComparison.data[0] }]\n : []),\n ],\n };\n\n return (\n <ChartCard\n data={resultsCombined}\n dimensionsAndMeasures={[\n // Add a label dimension to distinguish primary and comparison periods in exports\n {\n name: 'label',\n title: i18n.t('charts.label'),\n nativeType: 'string',\n __type__: 'dimension',\n },\n measure,\n ]}\n errorMessage={results.error}\n subtitle={description}\n title={title}\n >\n <KpiChart\n value={value}\n comparisonValue={comparisonValue}\n valueFormatter={valueFormatter}\n valueFontSize={fontSize}\n changeFontSize={changeFontSize}\n invertChangeColors={reversePositiveNegativeColors}\n showChangeAsPercentage={displayChangeAsPercentage}\n comparisonLabel={comparisonLabel}\n percentageDecimalPlaces={percentageDecimalPlaces}\n />\n </ChartCard>\n );\n};\n\nexport default KpiChartNumberComparisonPro;\n","import { defineComponent, EmbeddedComponentMeta, Inputs } from '@embeddable.com/react';\nimport {\n dataset,\n description,\n dimensionTime,\n genericBoolean,\n genericNumber,\n genericTimeRange,\n measure,\n title,\n} from '../../../component.constants';\nimport KpiChartNumberComparisonPro from './index';\nimport { loadData, TimeRange } from '@embeddable.com/core';\nimport ComparisonPeriodType from '../../../types/ComparisonPeriod.type.emb';\n\nexport const meta = {\n name: 'KpiChartNumberComparisonPro',\n label: 'Kpi Chart - Number Comparison',\n category: 'Kpi Charts',\n inputs: [\n dataset,\n measure,\n { ...dimensionTime, name: 'timeProperty', label: 'Time Property' },\n {\n ...genericTimeRange,\n name: 'primaryDateRange',\n label: 'Primary Date Range',\n description: 'You can also connect this to a date range selector using its variable',\n category: 'Component Data',\n },\n {\n name: 'comparisonPeriod',\n type: ComparisonPeriodType,\n label: 'Comparison Period',\n description: 'You can also connect this to a comparison period selector using its variable',\n category: 'Component Data',\n },\n title,\n description,\n {\n ...genericBoolean,\n name: 'displayChangeAsPercentage',\n label: 'Display Change as %',\n defaultValue: false,\n },\n {\n ...genericNumber,\n name: 'percentageDecimalPlaces',\n label: 'Percentage Decimal Places',\n defaultValue: 1,\n },\n {\n ...genericBoolean,\n name: 'reversePositiveNegativeColors',\n label: 'Reverse Positive/Negative Colors',\n defaultValue: false,\n },\n { ...genericNumber, name: 'fontSize', label: 'Font Size', defaultValue: 44, required: true },\n {\n ...genericNumber,\n name: 'changeFontSize',\n label: 'Change Font Size',\n defaultValue: 16,\n required: true,\n },\n ],\n} as const satisfies EmbeddedComponentMeta;\n\ntype KpiChartNumberComparisonProState = {\n comparisonDateRange: TimeRange;\n};\n\nexport default defineComponent(KpiChartNumberComparisonPro, meta, {\n /* @ts-expect-error - to be fixed in @embeddable.com/react */\n props: (\n inputs: Inputs<typeof meta>,\n [state, setState]: [\n KpiChartNumberComparisonProState,\n (state: KpiChartNumberComparisonProState) => void,\n ],\n ) => {\n return {\n ...inputs,\n comparisonDateRange: state?.comparisonDateRange,\n setComparisonDateRange: (comparisonDateRange: TimeRange) => setState({ comparisonDateRange }),\n results: loadData({\n from: inputs.dataset,\n select: [inputs.measure],\n limit: 1,\n filters:\n inputs.primaryDateRange && inputs.timeProperty\n ? [\n {\n property: inputs.timeProperty,\n operator: 'inDateRange',\n value: inputs.primaryDateRange,\n },\n ]\n : undefined,\n }),\n resultsComparison:\n inputs.primaryDateRange && inputs.timeProperty && state?.comparisonDateRange\n ? loadData({\n from: inputs.dataset,\n select: [inputs.measure],\n limit: 1,\n filters: [\n {\n property: inputs.timeProperty,\n operator: 'inDateRange',\n value: state.comparisonDateRange,\n },\n ],\n })\n : undefined,\n };\n },\n});\n"],"names":["KpiChartNumberComparisonPro","props","theme","useTheme","i18nSetup","title","description","resolveI18nProps","changeFontSize","comparisonPeriod","comparisonDateRange","displayChangeAsPercentage","fontSize","measure","primaryDateRange","results","resultsComparison","reversePositiveNegativeColors","percentageDecimalPlaces","setComparisonDateRange","useEffect","newComparisonDateRange","getComparisonPeriodDateRange","value","_b","_a","comparisonValue","_d","_c","themeFormatter","getThemeFormatter","valueFormatter","valueToFormat","comparisonLabel","getComparisonPeriodLabel","resultsCombined","_e","i18n","_f","jsx","ChartCard","KpiChart","meta","dataset","dimensionTime","genericTimeRange","ComparisonPeriodType","genericBoolean","genericNumber","KpiChartNumberComparisonPro_emb","defineComponent","inputs","state","setState","loadData"],"mappings":";;;;;;;;AA+BA,MAAMA,IAA8B,CAACC,MAA2C;;AAC9E,QAAMC,IAAeC,EAAA;AACrB,EAAAC,EAAUF,CAAK;AAEf,QAAM,EAAE,OAAAG,GAAO,aAAAC,MAAgBC,EAAiBN,CAAK,GAC/C;AAAA,IACJ,gBAAAO;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,+BAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,wBAAAC;AAAA,EAAA,IACElB;AAEJ,EAAAmB,EAAU,MAAM;AACd,UAAMC,IAAyBC;AAAA,MAC7BR;AAAA,MACAL;AAAA,MACAP;AAAA,IAAA;AAEF,IAAAiB,EAAuBE,CAAsB;AAAA,EAC/C,GAAG,CAACZ,GAAkB,KAAK,UAAUK,CAAgB,GAAGZ,CAAK,CAAC;AAE9D,QAAMqB,KAAgBC,KAAAC,IAAAV,EAAQ,SAAR,gBAAAU,EAAe,OAAf,gBAAAD,EAAoBX,EAAQ,OAC5Ca,IAAkBhB,KACpBiB,KAAAC,IAAAZ,KAAA,gBAAAA,EAAmB,SAAnB,gBAAAY,EAA0B,OAA1B,gBAAAD,EAA+Bd,EAAQ,QACvC,QAEEgB,IAAiBC,EAAkB5B,CAAK,GACxC6B,IAAiB,CAACC,MAA0BH,EAAe,KAAKhB,GAASmB,CAAa,GACtFC,IAAkB,MAAMC,EAAyBzB,GAAkBP,CAAK,EAAE,aAAa,IAEvFiC,IAAgC;AAAA,IACpC,WAAW,GAAQpB,EA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EF;AAAA,IAAA,CACP;AAAA,IACD,mBACEA,EAAO,oBAAoBA,EAAO,iBAAgBC,KAAA,QAAAA,EAAO,uBACrDE,EAAS;AAAA,MACP,MAAMH,EAAO;AAAA,MACb,QAAQ,CAACA,EAAO,OAAO;AAAA,MACvB,OAAO;AAAA,MACP,SAAS;AAAA,QACP;AAAA,UACE,UAAUA,EAAO;AAAA,UACjB,UAAU;AAAA,UACV,OAAOC,EAAM;AAAA,QAAA;AAAA,MACf;AAAA,IACF,CACD,IACD;AAAA,EAAA;AAGZ,CAAC;"}
|
|
@@ -7,7 +7,7 @@ import { g as M } from "./formatter.utils-B3HZzPUm.js";
|
|
|
7
7
|
import { g as ge, a as he } from "./object.utils-BNKDL7Y9.js";
|
|
8
8
|
import { i as be, s as xe } from "./color.utils-CVyp-fGP.js";
|
|
9
9
|
import { g as Ce } from "./lines.utils-CFEUUo4k.js";
|
|
10
|
-
import { u as N } from "./charts.newFillGaps.hooks-
|
|
10
|
+
import { u as N } from "./charts.newFillGaps.hooks-8oF8pYjr.js";
|
|
11
11
|
import { C as fe } from "./ComparisonPeriod.type.emb-Q_A2MmQY.js";
|
|
12
12
|
const P = "mainAxis", k = "comparisonAxis", $ = (a, t) => {
|
|
13
13
|
var v, R, x, g;
|
|
@@ -5,7 +5,7 @@ import { g as V } from "./formatter.utils-B3HZzPUm.js";
|
|
|
5
5
|
import { g as H, a as y } from "./object.utils-BNKDL7Y9.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import { i as D, s as J } from "./color.utils-CVyp-fGP.js";
|
|
8
|
-
import { u as Q } from "./charts.newFillGaps.hooks-
|
|
8
|
+
import { u as Q } from "./charts.newFillGaps.hooks-8oF8pYjr.js";
|
|
9
9
|
const Z = (e, o) => {
|
|
10
10
|
if (!e.data)
|
|
11
11
|
return {
|
|
@@ -6,7 +6,7 @@ import { g as I, a as G } from "./object.utils-BNKDL7Y9.js";
|
|
|
6
6
|
import { s as ee } from "./color.utils-CVyp-fGP.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import { g as ae } from "./lines.utils-CFEUUo4k.js";
|
|
9
|
-
import { u as se } from "./charts.newFillGaps.hooks-
|
|
9
|
+
import { u as se } from "./charts.newFillGaps.hooks-8oF8pYjr.js";
|
|
10
10
|
const ne = (e, o) => {
|
|
11
11
|
const u = M(o), { data: t = [], dimension: l, groupDimension: r, measure: n, hasMinMaxYAxisRange: c } = e, m = [...new Set(t.map((s) => s[l.name]).filter(Boolean))].sort(), d = [...new Set(t.map((s) => s[r.name]))].filter(Boolean), a = I(o), i = d.map((s, x) => {
|
|
12
12
|
var p;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as q, d as
|
|
1
|
+
import { g as q, d as n, u as B } from "./utc-B2gCnkBk.js";
|
|
2
2
|
import { i as E } from "./object.utils-BNKDL7Y9.js";
|
|
3
3
|
import { useTheme as F } from "@embeddable.com/react";
|
|
4
4
|
import { useMemo as M } from "react";
|
|
@@ -18,39 +18,39 @@ function Z() {
|
|
|
18
18
|
}
|
|
19
19
|
var $ = Z();
|
|
20
20
|
const b = /* @__PURE__ */ q($);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
n.extend(B);
|
|
22
|
+
n.extend(E);
|
|
23
|
+
n.extend(b);
|
|
24
24
|
function A(O) {
|
|
25
25
|
const h = F(), { results: e, dimension: t, orderDirection: f = "asc", externalDateBounds: r } = O;
|
|
26
26
|
return M(() => {
|
|
27
27
|
var k, I, R, V, w;
|
|
28
|
-
const l = (k = t.inputs) == null ? void 0 : k.granularity,
|
|
29
|
-
if (!l || !
|
|
30
|
-
const a =
|
|
28
|
+
const l = (k = t.inputs) == null ? void 0 : k.granularity, c = t.name, s = (I = t.inputs) == null ? void 0 : I.dateBounds;
|
|
29
|
+
if (!l || !c || !s) return e;
|
|
30
|
+
const a = s != null && s.relativeTimeString ? (R = h.defaults.dateRangesOptions.find((o) => o.value === (s == null ? void 0 : s.relativeTimeString))) == null ? void 0 : R.getRange() : s;
|
|
31
31
|
if (t.nativeType !== "time") return e;
|
|
32
|
-
const p = [...(e == null ? void 0 : e.data) ?? []].sort((o,
|
|
33
|
-
const u = o[
|
|
34
|
-
return u == null ? 1 : m == null ? -1 :
|
|
35
|
-
}), x =
|
|
36
|
-
(r == null ? void 0 : r.from) ?? (a == null ? void 0 : a.from) ?? ((V = p[0]) == null ? void 0 : V[
|
|
37
|
-
), y =
|
|
38
|
-
(r == null ? void 0 : r.to) ?? (a == null ? void 0 : a.to) ?? ((w = p[p.length - 1]) == null ? void 0 : w[
|
|
32
|
+
const p = [...(e == null ? void 0 : e.data) ?? []].sort((o, i) => {
|
|
33
|
+
const u = o[c], m = i[c];
|
|
34
|
+
return u == null ? 1 : m == null ? -1 : n.utc(u).diff(n.utc(m));
|
|
35
|
+
}), x = n.utc(
|
|
36
|
+
(r == null ? void 0 : r.from) ?? (a == null ? void 0 : a.from) ?? ((V = p[0]) == null ? void 0 : V[c])
|
|
37
|
+
), y = n.utc(
|
|
38
|
+
(r == null ? void 0 : r.to) ?? (a == null ? void 0 : a.to) ?? ((w = p[p.length - 1]) == null ? void 0 : w[c])
|
|
39
39
|
);
|
|
40
40
|
if (!x.isValid() || !y.isValid())
|
|
41
41
|
return { ...e, data: [] };
|
|
42
42
|
const v = /* @__PURE__ */ new Map();
|
|
43
43
|
for (const o of p) {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const u =
|
|
44
|
+
const i = o[c];
|
|
45
|
+
if (i == null) continue;
|
|
46
|
+
const u = n.utc(i).toISOString().split("Z")[0], m = v.get(u) ?? [];
|
|
47
47
|
m.push(o), v.set(u, m);
|
|
48
48
|
}
|
|
49
49
|
const d = [];
|
|
50
50
|
let g = x.startOf(l === "week" ? "isoWeek" : l);
|
|
51
51
|
for (; g.isSameOrBefore(y); ) {
|
|
52
|
-
const o = g.toISOString().split("Z")[0],
|
|
53
|
-
|
|
52
|
+
const o = g.toISOString().split("Z")[0], i = v.get(o);
|
|
53
|
+
i && i.length > 0 ? d.push(...i) : d.push({ [c]: o }), g = g.add(1, l);
|
|
54
54
|
}
|
|
55
55
|
return f === "desc" && d.reverse(), {
|
|
56
56
|
...e,
|
|
@@ -61,4 +61,4 @@ function A(O) {
|
|
|
61
61
|
export {
|
|
62
62
|
A as u
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=charts.newFillGaps.hooks-
|
|
64
|
+
//# sourceMappingURL=charts.newFillGaps.hooks-8oF8pYjr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts.newFillGaps.hooks-8oF8pYjr.js","sources":["../node_modules/dayjs/plugin/isSameOrBefore.js","../src/remarkable-pro/components/charts/charts.newFillGaps.hooks.ts"],"sourcesContent":["!function(e,i){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=i():\"function\"==typeof define&&define.amd?define(i):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).dayjs_plugin_isSameOrBefore=i()}(this,(function(){\"use strict\";return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)}}}));","import { DataResponse, Dimension, TimeRange } from '@embeddable.com/core';\nimport dayjs, { QUnitType } from 'dayjs';\nimport isoWeek from 'dayjs/plugin/isoWeek.js';\nimport utc from 'dayjs/plugin/utc.js';\nimport isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js';\nimport { Theme } from '../../theme/theme.types';\nimport { useTheme } from '@embeddable.com/react';\nimport { useMemo } from 'react';\n\ndayjs.extend(utc);\ndayjs.extend(isoWeek);\ndayjs.extend(isSameOrBefore);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype DataRecord = { [key: string]: any };\n\ntype UseFillGapsProps = {\n results: DataResponse | undefined;\n dimension: Dimension;\n orderDirection?: 'asc' | 'desc';\n externalDateBounds?: TimeRange;\n};\n\nexport function useFillGaps(props: UseFillGapsProps): DataResponse {\n const theme = useTheme() as Theme;\n const { results, dimension, orderDirection = 'asc', externalDateBounds } = props;\n\n const processed = useMemo(() => {\n const granularity = dimension.inputs?.granularity;\n const dimensionName = dimension.name;\n const dateBoundsTmp: TimeRange = dimension.inputs?.dateBounds;\n\n if (!granularity || !dimensionName || !dateBoundsTmp) return results;\n\n const dateBounds = dateBoundsTmp?.relativeTimeString\n ? theme.defaults.dateRangesOptions\n .find((option) => option.value === dateBoundsTmp?.relativeTimeString)\n ?.getRange()\n : dateBoundsTmp;\n\n if (dimension.nativeType !== 'time') return results;\n\n const sortedResults = [...(results?.data ?? [])].sort((a, b) => {\n const aVal = a[dimensionName];\n const bVal = b[dimensionName];\n if (aVal == null) return 1;\n if (bVal == null) return -1;\n return dayjs.utc(aVal).diff(dayjs.utc(bVal));\n });\n\n // Determine the full date range even if data is empty\n const from = dayjs.utc(\n externalDateBounds?.from ?? dateBounds?.from ?? sortedResults[0]?.[dimensionName],\n );\n const to = dayjs.utc(\n externalDateBounds?.to ??\n dateBounds?.to ??\n sortedResults[sortedResults.length - 1]?.[dimensionName],\n );\n\n // If we *still* don’t have valid date bounds, bail out safely\n if (!from.isValid() || !to.isValid()) {\n return { ...results, data: [] };\n }\n\n const recordsByDate = new Map<string, DataRecord[]>();\n for (const record of sortedResults) {\n const value = record[dimensionName];\n if (value == null) continue;\n const key = dayjs.utc(value).toISOString().split('Z')[0]!;\n const arr = recordsByDate.get(key) ?? [];\n arr.push(record);\n recordsByDate.set(key, arr);\n }\n\n const filled: DataRecord[] = [];\n let current = from.startOf((granularity === 'week' ? 'isoWeek' : granularity) as QUnitType);\n\n while (current.isSameOrBefore(to)) {\n const key = current.toISOString().split('Z')[0]!;\n const records = recordsByDate.get(key);\n\n if (records && records.length > 0) {\n filled.push(...records);\n } else {\n filled.push({ [dimensionName]: key });\n }\n\n current = current.add(1, granularity as QUnitType);\n }\n\n if (orderDirection === 'desc') {\n filled.reverse();\n }\n\n return {\n ...results,\n data: filled,\n };\n }, [results, dimension, orderDirection, theme]);\n\n return processed as DataResponse;\n}\n"],"names":["i","module","this","e","dayjs","utc","isoWeek","isSameOrBefore","useFillGaps","props","theme","useTheme","results","dimension","orderDirection","externalDateBounds","useMemo","granularity","_a","dimensionName","dateBoundsTmp","_b","dateBounds","_c","option","sortedResults","a","b","aVal","bVal","from","_d","to","_e","recordsByDate","record","value","key","arr","filled","current","records"],"mappings":";;;;;;;AAAA,KAAC,SAAS,GAAEA,GAAE;AAAsD,MAAAC,EAAA,UAAeD,EAAC;AAAA,IAAwI,GAAEE,IAAM,WAAU;AAAc,aAAO,SAAS,GAAEF,GAAE;AAAC,QAAAA,EAAE,UAAU,iBAAe,SAASG,GAAEH,GAAE;AAAC,iBAAO,KAAK,OAAOG,GAAEH,CAAC,KAAG,KAAK,SAASG,GAAEH,CAAC;AAAA,QAAC;AAAA,MAAC;AAAA,IAAC,EAAC;AAAA;;;;ACSxWI,EAAM,OAAOC,CAAG;AAChBD,EAAM,OAAOE,CAAO;AACpBF,EAAM,OAAOG,CAAc;AAYpB,SAASC,EAAYC,GAAuC;AACjE,QAAMC,IAAQC,EAAA,GACR,EAAE,SAAAC,GAAS,WAAAC,GAAW,gBAAAC,IAAiB,OAAO,oBAAAC,MAAuBN;AA4E3E,SA1EkBO,EAAQ,MAAM;;AAC9B,UAAMC,KAAcC,IAAAL,EAAU,WAAV,gBAAAK,EAAkB,aAChCC,IAAgBN,EAAU,MAC1BO,KAA2BC,IAAAR,EAAU,WAAV,gBAAAQ,EAAkB;AAEnD,QAAI,CAACJ,KAAe,CAACE,KAAiB,CAACC,EAAe,QAAOR;AAE7D,UAAMU,IAAaF,KAAA,QAAAA,EAAe,sBAC9BG,IAAAb,EAAM,SAAS,kBACZ,KAAK,CAACc,MAAWA,EAAO,WAAUJ,KAAA,gBAAAA,EAAe,mBAAkB,MADtE,gBAAAG,EAEI,aACJH;AAEJ,QAAIP,EAAU,eAAe,OAAQ,QAAOD;AAE5C,UAAMa,IAAgB,CAAC,IAAIb,KAAA,gBAAAA,EAAS,SAAQ,CAAA,CAAG,EAAE,KAAK,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AAO,IAEtBF,EAAO,KAAK,EAAE,CAACpB,CAAa,GAAGkB,GAAK,GAGtCG,IAAUA,EAAQ,IAAI,GAAGvB,CAAwB;AAAA,IACnD;AAEA,WAAIH,MAAmB,UACrByB,EAAO,QAAA,GAGF;AAAA,MACL,GAAG3B;AAAA,MACH,MAAM2B;AAAA,IAAA;AAAA,EAEV,GAAG,CAAC3B,GAASC,GAAWC,GAAgBJ,CAAK,CAAC;AAGhD;","x_google_ignoreList":[0]}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"components": [
|
|
3
|
-
"MultiSelectFieldPro",
|
|
4
3
|
"ComparisonPeriodSelectFieldPro",
|
|
5
4
|
"DateRangeSelectFieldPro",
|
|
6
|
-
"
|
|
7
|
-
"BarChartStackedPro",
|
|
8
|
-
"SingleSelectFieldPro",
|
|
9
|
-
"BarChartDefaultPro",
|
|
5
|
+
"MultiSelectFieldPro",
|
|
10
6
|
"BarChartGroupedPro",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"KpiChartNumberPro",
|
|
14
|
-
"PieChartPro",
|
|
7
|
+
"LineChartDefaultPro",
|
|
8
|
+
"SingleSelectFieldPro",
|
|
15
9
|
"LineChartComparisonDefaultPro",
|
|
16
|
-
"
|
|
10
|
+
"KpiChartNumberPro",
|
|
11
|
+
"BarChartDefaultHorizontalPro",
|
|
17
12
|
"BarChartStackedHorizontalPro",
|
|
18
|
-
"
|
|
13
|
+
"KpiChartNumberComparisonPro",
|
|
14
|
+
"BarChartDefaultPro",
|
|
19
15
|
"LineChartGroupedPro",
|
|
20
|
-
"
|
|
16
|
+
"DonutChartPro",
|
|
17
|
+
"PieChartPro",
|
|
18
|
+
"BarChartStackedPro",
|
|
19
|
+
"DonutLabelChartPro",
|
|
20
|
+
"BarChartGroupedHorizontalPro"
|
|
21
21
|
],
|
|
22
22
|
"editors": [],
|
|
23
23
|
"plugin": "react"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a4 as R, r as S, j as
|
|
1
|
+
import { a4 as R, r as S, j as d, U as b } from "./component.constants-B1QqUi2G.js";
|
|
2
2
|
import { useTheme as O } from "@embeddable.com/react";
|
|
3
|
-
import { useState as j, useEffect as
|
|
3
|
+
import { useState as j, useEffect as c } from "react";
|
|
4
4
|
import { S as C } from "./SingleSelectField-AZ79m6bQ.js";
|
|
5
5
|
import { g as y, u as x } from "./editors.timeRange.utils-CteuBPel.js";
|
|
6
6
|
import { E as F } from "./EditorCard-CNU8sUaR.js";
|
|
@@ -15,31 +15,33 @@ const T = [["path", { d: "M16 2a1 1 0 0 1 .993 .883l.007 .117v1h1a3 3 0 0 1 2.99
|
|
|
15
15
|
value: a.value,
|
|
16
16
|
label: a.label
|
|
17
17
|
})), z = (l) => {
|
|
18
|
-
const a = O(), { dayjsLocaleReady: m } = x(), { selectedValue: e, onChange:
|
|
18
|
+
const a = O(), { dayjsLocaleReady: m } = x(), { selectedValue: e, onChange: v } = l, [o, i] = j(
|
|
19
19
|
e == null ? void 0 : e.relativeTimeString
|
|
20
20
|
), n = a.defaults.dateRangesOptions, r = e == null ? void 0 : e.relativeTimeString;
|
|
21
|
-
if (
|
|
21
|
+
if (c(() => {
|
|
22
22
|
if (!r) return;
|
|
23
23
|
const t = n.find(
|
|
24
|
-
(
|
|
24
|
+
(s) => s.value === r
|
|
25
25
|
);
|
|
26
|
-
|
|
27
|
-
}, [r, n]),
|
|
26
|
+
i(t ? t.value : void 0);
|
|
27
|
+
}, [r, n]), c(() => {
|
|
28
28
|
if (!e && !o) return;
|
|
29
|
-
const t = n.find((h) => h.value === o),
|
|
30
|
-
|
|
31
|
-
}, [o, n]),
|
|
29
|
+
const t = n.find((h) => h.value === o), s = t ? t.getRange() : void 0;
|
|
30
|
+
v(s);
|
|
31
|
+
}, [o, n]), c(() => {
|
|
32
|
+
e || i(void 0);
|
|
33
|
+
}, [e]), !m)
|
|
32
34
|
return null;
|
|
33
|
-
const { description:
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
+
const { description: u, placeholder: g, title: f } = S(l), p = L(n);
|
|
36
|
+
return /* @__PURE__ */ d.jsx(F, { title: f, subtitle: u, children: /* @__PURE__ */ d.jsx(
|
|
35
37
|
C,
|
|
36
38
|
{
|
|
37
39
|
startIcon: _,
|
|
38
40
|
isClearable: !0,
|
|
39
41
|
placeholder: g,
|
|
40
42
|
value: o,
|
|
41
|
-
onChange: (t) =>
|
|
42
|
-
options:
|
|
43
|
+
onChange: (t) => i(t || void 0),
|
|
44
|
+
options: p,
|
|
43
45
|
noOptionsMessage: b.t("common.noOptionsAvailable")
|
|
44
46
|
}
|
|
45
47
|
) });
|
|
@@ -51,4 +53,4 @@ export {
|
|
|
51
53
|
z as D,
|
|
52
54
|
w as i
|
|
53
55
|
};
|
|
54
|
-
//# sourceMappingURL=index-
|
|
56
|
+
//# sourceMappingURL=index-DXHlr-gm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-DXHlr-gm.js","sources":["../node_modules/@tabler/icons-react/dist/esm/icons/IconCalendarFilled.mjs","../src/remarkable-pro/components/editors/DateRangeSelectFieldPro/DateRangeSelectFieldPro.utils.ts","../src/remarkable-pro/components/editors/DateRangeSelectFieldPro/index.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.34.1 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M16 2a1 1 0 0 1 .993 .883l.007 .117v1h1a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h1v-1a1 1 0 0 1 1.993 -.117l.007 .117v1h6v-1a1 1 0 0 1 1 -1zm3 7h-14v9.625c0 .705 .386 1.286 .883 1.366l.117 .009h12c.513 0 .936 -.53 .993 -1.215l.007 -.16v-9.625z\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M12 12a1 1 0 0 1 .993 .883l.007 .117v3a1 1 0 0 1 -1.993 .117l-.007 -.117v-2a1 1 0 0 1 -.117 -1.993l.117 -.007h1z\", \"key\": \"svg-1\" }]];\nconst IconCalendarFilled = createReactComponent(\"filled\", \"calendar-filled\", \"CalendarFilled\", __iconNode);\n\nexport { __iconNode, IconCalendarFilled as default };\n//# sourceMappingURL=IconCalendarFilled.mjs.map\n","import { DateRangeSelectFieldProOption } from './DateRangeSelectFieldPro.types';\nimport { SelectListOptionProps } from '../../../../remarkable-ui';\nimport { getTimeRangeLabel } from '../editors.timeRange.utils';\n\nexport const getDateRangeSelectFieldProOptions = (\n dateRangeSelectFieldProOptions: DateRangeSelectFieldProOption[],\n): SelectListOptionProps[] => {\n return dateRangeSelectFieldProOptions.map((option) => {\n return {\n rightLabel: getTimeRangeLabel(option.getRange(), option.dateFormat),\n value: option.value,\n label: option.label,\n };\n });\n};\n","import { useTheme } from '@embeddable.com/react';\nimport { SingleSelectField } from '../../../../remarkable-ui';\nimport { Theme } from '../../../theme/theme.types';\nimport { useLoadDayjsLocale } from '../../../utils.ts/date.utils';\nimport { getDateRangeSelectFieldProOptions } from './DateRangeSelectFieldPro.utils';\nimport { TimeRange } from '@embeddable.com/core';\nimport { resolveI18nProps } from '../../component.utils';\nimport { EditorCard } from '../shared/EditorCard/EditorCard';\nimport { IconCalendarFilled } from '@tabler/icons-react';\nimport { i18n } from '../../../theme/i18n/i18n';\nimport { useEffect, useState } from 'react';\n\ntype DateRangeSelectFieldProProps = {\n description?: string;\n onChange: (newDateRange: TimeRange) => void;\n placeholder?: string;\n selectedValue: TimeRange;\n title?: string;\n};\n\nconst DateRangeSelectFieldPro = (props: DateRangeSelectFieldProProps) => {\n const theme: Theme = useTheme() as Theme;\n const { dayjsLocaleReady } = useLoadDayjsLocale();\n\n const { selectedValue, onChange } = props;\n const [internalValue, setInternalValue] = useState<string | undefined>(\n selectedValue?.relativeTimeString,\n );\n\n // When updation the selectedValue in the builder, the defined value value can:\n // 1. exist in the options: relativeTimeString converted into TimeRange and onChange is called with the TimeRange\n // 2. not exist in the options: onChange is called with undefined (resets)\n\n const dateRangeOptions = theme.defaults.dateRangesOptions;\n\n const selectedValueRelativeTimeString = selectedValue?.relativeTimeString;\n\n useEffect(() => {\n if (!selectedValueRelativeTimeString) return;\n\n const matchedOption = dateRangeOptions.find(\n (option) => option.value === selectedValueRelativeTimeString,\n );\n\n setInternalValue(matchedOption ? matchedOption.value : undefined);\n }, [selectedValueRelativeTimeString, dateRangeOptions]);\n\n useEffect(() => {\n if (!selectedValue && !internalValue) return;\n\n const matchedOption = dateRangeOptions.find((option) => option.value === internalValue);\n\n const newChangeValue = matchedOption ? matchedOption.getRange() : undefined;\n\n onChange(newChangeValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [internalValue, dateRangeOptions]);\n\n useEffect(() => {\n if (!selectedValue) {\n setInternalValue(undefined);\n }\n }, [selectedValue]);\n\n if (!dayjsLocaleReady) {\n return null;\n }\n\n const { description, placeholder, title } = resolveI18nProps(props);\n\n const options = getDateRangeSelectFieldProOptions(dateRangeOptions);\n\n return (\n <EditorCard title={title} subtitle={description}>\n <SingleSelectField\n startIcon={IconCalendarFilled}\n isClearable\n placeholder={placeholder}\n value={internalValue}\n onChange={(value) => setInternalValue(value || undefined)}\n options={options}\n noOptionsMessage={i18n.t('common.noOptionsAvailable')}\n />\n </EditorCard>\n );\n};\n\nexport default DateRangeSelectFieldPro;\n"],"names":["__iconNode","IconCalendarFilled","createReactComponent","getDateRangeSelectFieldProOptions","dateRangeSelectFieldProOptions","option","getTimeRangeLabel","DateRangeSelectFieldPro","props","theme","useTheme","dayjsLocaleReady","useLoadDayjsLocale","selectedValue","onChange","internalValue","setInternalValue","useState","dateRangeOptions","selectedValueRelativeTimeString","useEffect","matchedOption","newChangeValue","description","placeholder","title","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,MAAM;AACd,IAAKP,KACHG,EAAiB,MAAS;AAAA,EAE9B,GAAG,CAACH,CAAa,CAAC,GAEd,CAACF;AACH,WAAO;AAGT,QAAM,EAAE,aAAAY,GAAa,aAAAC,GAAa,OAAAC,EAAA,IAAUC,EAAiBlB,CAAK,GAE5DmB,IAAUxB,EAAkCe,CAAgB;AAElE,SACEU,gBAAAA,EAAAA,IAACC,GAAA,EAAW,OAAAJ,GAAc,UAAUF,GAClC,UAAAK,gBAAAA,EAAAA;AAAAA,IAACE;AAAA,IAAA;AAAA,MACC,WAAW7B;AAAA,MACX,aAAW;AAAA,MACX,aAAAuB;AAAA,MACA,OAAOT;AAAA,MACP,UAAU,CAACgB,MAAUf,EAAiBe,KAAS,MAAS;AAAA,MACxD,SAAAJ;AAAA,MACA,kBAAkBK,EAAK,EAAE,2BAA2B;AAAA,IAAA;AAAA,EAAA,GAExD;AAEJ;;;;","x_google_ignoreList":[0]}
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { i as Ga } from "./index-SdQVlaEz.js";
|
|
|
17
17
|
import { i as Ya } from "./index-DyMUkLDE.js";
|
|
18
18
|
import { i as Za } from "./index-Fs7N8msy.js";
|
|
19
19
|
import { i as Qa } from "./index-Dye21BCa.js";
|
|
20
|
-
import { i as ae } from "./index-
|
|
20
|
+
import { i as ae } from "./index-DXHlr-gm.js";
|
|
21
21
|
import { C as te } from "./ComparisonPeriod.type.emb-Q_A2MmQY.js";
|
|
22
22
|
import { i as ne, s as re } from "./color.utils-CVyp-fGP.js";
|
|
23
23
|
const L = "_container_436fl_1", A = "_column_436fl_10", M = "_box_436fl_20", D = "_short_436fl_26", F = "_tall_436fl_34", e = {
|
package/dist/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAYxE,KAAK,+BAA+B,GAAG;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,SAAS,CAAC;IAC5B,OAAO,EAAE,YAAY,CAAC;IACtB,iBAAiB,EAAE,YAAY,GAAG,SAAS,CAAC;IAC5C,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB,EAAE,MAAM,CAAC;IAChC,mBAAmB,EAAE,SAAS,CAAC;IAC/B,sBAAsB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,QAAA,MAAM,2BAA2B,GAAI,OAAO,+BAA+B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAYxE,KAAK,+BAA+B,GAAG;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,SAAS,CAAC;IAC5B,OAAO,EAAE,YAAY,CAAC;IACtB,iBAAiB,EAAE,YAAY,GAAG,SAAS,CAAC;IAC5C,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB,EAAE,MAAM,CAAC;IAChC,mBAAmB,EAAE,SAAS,CAAC;IAC/B,sBAAsB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,QAAA,MAAM,2BAA2B,GAAI,OAAO,+BAA+B,4CAmF1E,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/remarkable-pro/components/editors/DateRangeSelectFieldPro/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAOjD,KAAK,4BAA4B,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,YAAY,EAAE,SAAS,KAAK,IAAI,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAI,OAAO,4BAA4B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/remarkable-pro/components/editors/DateRangeSelectFieldPro/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAOjD,KAAK,4BAA4B,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,YAAY,EAAE,SAAS,KAAK,IAAI,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAI,OAAO,4BAA4B,mDAiEnE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"charts.newFillGaps.hooks-CJLaShd4.js","sources":["../node_modules/dayjs/plugin/isSameOrBefore.js","../src/remarkable-pro/components/charts/charts.newFillGaps.hooks.ts"],"sourcesContent":["!function(e,i){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=i():\"function\"==typeof define&&define.amd?define(i):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).dayjs_plugin_isSameOrBefore=i()}(this,(function(){\"use strict\";return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)}}}));","import { DataResponse, Dimension, TimeRange } from '@embeddable.com/core';\nimport dayjs, { QUnitType } from 'dayjs';\nimport isoWeek from 'dayjs/plugin/isoWeek.js';\nimport utc from 'dayjs/plugin/utc.js';\nimport isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js';\nimport { Theme } from '../../theme/theme.types';\nimport { useTheme } from '@embeddable.com/react';\nimport { useMemo } from 'react';\n\ndayjs.extend(utc);\ndayjs.extend(isoWeek);\ndayjs.extend(isSameOrBefore);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype DataRecord = { [key: string]: any };\n\ntype UseFillGapsProps = {\n results: DataResponse | undefined;\n dimension: Dimension;\n orderDirection?: 'asc' | 'desc';\n externalDateBounds?: TimeRange;\n};\n\nexport function useFillGaps(props: UseFillGapsProps): DataResponse {\n const theme = useTheme() as Theme;\n const { results, dimension, orderDirection = 'asc', externalDateBounds } = props;\n\n const processed = useMemo(() => {\n const granularity = dimension.inputs?.granularity;\n const dimensionName = dimension.name;\n const dateBoundsTmp: TimeRange = dimension.inputs?.dateBounds;\n\n if (!granularity || !dimensionName) return results;\n\n const dateBounds = dateBoundsTmp?.relativeTimeString\n ? theme.defaults.dateRangesOptions\n .find((option) => option.value === dateBoundsTmp?.relativeTimeString)\n ?.getRange()\n : dateBoundsTmp;\n\n if (dimension.nativeType !== 'time') return results;\n\n const sortedResults = [...(results?.data ?? [])].sort((a, b) => {\n const aVal = a[dimensionName];\n const bVal = b[dimensionName];\n if (aVal == null) return 1;\n if (bVal == null) return -1;\n return dayjs.utc(aVal).diff(dayjs.utc(bVal));\n });\n\n // Determine the full date range even if data is empty\n const from = dayjs.utc(\n externalDateBounds?.from ?? dateBounds?.from ?? sortedResults[0]?.[dimensionName],\n );\n const to = dayjs.utc(\n externalDateBounds?.to ??\n dateBounds?.to ??\n sortedResults[sortedResults.length - 1]?.[dimensionName],\n );\n\n // If we *still* don’t have valid date bounds, bail out safely\n if (!from.isValid() || !to.isValid()) {\n return { ...results, data: [] };\n }\n\n const recordsByDate = new Map<string, DataRecord[]>();\n for (const record of sortedResults) {\n const value = record[dimensionName];\n if (value == null) continue;\n const key = dayjs.utc(value).toISOString().split('Z')[0]!;\n const arr = recordsByDate.get(key) ?? [];\n arr.push(record);\n recordsByDate.set(key, arr);\n }\n\n const filled: DataRecord[] = [];\n let current = from.startOf((granularity === 'week' ? 'isoWeek' : granularity) as QUnitType);\n\n while (current.isSameOrBefore(to)) {\n const key = current.toISOString().split('Z')[0]!;\n const records = recordsByDate.get(key);\n\n if (records && records.length > 0) {\n filled.push(...records);\n } else {\n filled.push({ [dimensionName]: key });\n }\n\n current = current.add(1, granularity as QUnitType);\n }\n\n if (orderDirection === 'desc') {\n filled.reverse();\n }\n\n return {\n ...results,\n data: filled,\n };\n }, [results, dimension, orderDirection, theme]);\n\n return processed as DataResponse;\n}\n"],"names":["i","module","this","e","dayjs","utc","isoWeek","isSameOrBefore","useFillGaps","props","theme","useTheme","results","dimension","orderDirection","externalDateBounds","useMemo","granularity","_a","dimensionName","dateBoundsTmp","_b","dateBounds","_c","option","sortedResults","a","b","aVal","bVal","from","_d","to","_e","recordsByDate","record","value","key","arr","filled","current","records"],"mappings":";;;;;;;AAAA,KAAC,SAAS,GAAEA,GAAE;AAAsD,MAAAC,EAAA,UAAeD,EAAC;AAAA,IAAwI,GAA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