@embeddable.com/remarkable-ui 0.1.15 → 0.1.16
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/ComparisonPeriod.type.emb-BHz2X91i.js +14 -0
- package/dist/ComparisonPeriod.type.emb-BHz2X91i.js.map +1 -0
- package/dist/ComparisonPeriodSelectFieldPro.js +1 -1
- package/dist/DonutChartPro.js +1 -1
- package/dist/DonutLabelChartPro.js +1 -1
- package/dist/KpiChart-B2OqbXRg.js +79 -0
- package/dist/KpiChart-B2OqbXRg.js.map +1 -0
- package/dist/KpiChartNumberComparisonPro.js +58 -50
- package/dist/KpiChartNumberComparisonPro.js.map +1 -1
- package/dist/KpiChartNumberPro.js +1 -1
- package/dist/PieChartPro.js +1 -1
- package/dist/{charts.fillGaps.hooks-BFmuMVNT.js → charts.fillGaps.hooks-C5Gy3QoW.js} +146 -130
- package/dist/charts.fillGaps.hooks-C5Gy3QoW.js.map +1 -0
- package/dist/embeddable-components.json +6 -6
- package/dist/embeddable-theme-2b917.js +1 -1
- package/dist/embeddable-types-4ace4.js +4 -5
- package/dist/embeddable-types.js.map +1 -1
- package/dist/{index-DEzAFKmN.js → index-BOzeG3mG.js} +2 -2
- package/dist/{index-DEzAFKmN.js.map → index-BOzeG3mG.js.map} +1 -1
- package/dist/{index-Dwb4Z6Hd.js → index-Chlmh1dF.js} +2 -2
- package/dist/{index-Dwb4Z6Hd.js.map → index-Chlmh1dF.js.map} +1 -1
- package/dist/{index-BhW48cz5.js → index-CjS39lkd.js} +2 -2
- package/dist/{index-BhW48cz5.js.map → index-CjS39lkd.js.map} +1 -1
- package/dist/index.js +6 -6
- package/dist/{object.utils-C6JIOYmv.js → object.utils-9RGrU0vr.js} +2 -2
- package/dist/object.utils-9RGrU0vr.js.map +1 -0
- package/dist/{pies.utils-CSx7w1mv.js → pies.utils-BecIV2nV.js} +2 -2
- package/dist/{pies.utils-CSx7w1mv.js.map → pies.utils-BecIV2nV.js.map} +1 -1
- package/dist/remarkable-pro/components/charts/bars/bars.utils.d.ts.map +1 -1
- package/dist/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/index.d.ts +1 -0
- package/dist/remarkable-pro/components/charts/kpis/KpiChartNumberComparisonPro/index.d.ts.map +1 -1
- package/dist/remarkable-ui/charts/kpis/KpiChart.d.ts.map +1 -1
- package/dist/remarkable-ui/charts/kpis/KpiChart.types.d.ts +1 -0
- package/dist/remarkable-ui/charts/kpis/KpiChart.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/ComparisonPeriod.type.emb-61HEPz26.js +0 -15
- package/dist/ComparisonPeriod.type.emb-61HEPz26.js.map +0 -1
- package/dist/KpiChart-CzUK0Dgw.js +0 -77
- package/dist/KpiChart-CzUK0Dgw.js.map +0 -1
- package/dist/charts.fillGaps.hooks-BFmuMVNT.js.map +0 -1
- package/dist/object.utils-C6JIOYmv.js.map +0 -1
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
"DateRangeSelectFieldPro",
|
|
4
4
|
"ComparisonPeriodSelectFieldPro",
|
|
5
5
|
"MultiSelectFieldPro",
|
|
6
|
-
"BarChartGroupedPro",
|
|
7
|
-
"BarChartDefaultHorizontalPro",
|
|
8
6
|
"SingleSelectFieldPro",
|
|
7
|
+
"BarChartDefaultHorizontalPro",
|
|
9
8
|
"BarChartGroupedHorizontalPro",
|
|
10
9
|
"BarChartDefaultPro",
|
|
11
|
-
"
|
|
10
|
+
"KpiChartNumberPro",
|
|
11
|
+
"PieChartPro",
|
|
12
12
|
"BarChartStackedHorizontalPro",
|
|
13
|
+
"BarChartGroupedPro",
|
|
14
|
+
"KpiChartNumberComparisonPro",
|
|
13
15
|
"BarChartStackedPro",
|
|
14
|
-
"KpiChartNumberPro",
|
|
15
16
|
"DonutLabelChartPro",
|
|
16
|
-
"DonutChartPro"
|
|
17
|
-
"PieChartPro"
|
|
17
|
+
"DonutChartPro"
|
|
18
18
|
],
|
|
19
19
|
"editors": [],
|
|
20
20
|
"plugin": "react"
|
|
@@ -1917,7 +1917,7 @@ const Qi = (e) => {
|
|
|
1917
1917
|
style: r ? "currency" : void 0,
|
|
1918
1918
|
currency: r || void 0,
|
|
1919
1919
|
notation: (i = t.inputs) != null && i.abbreviateLargeNumber ? "compact" : void 0,
|
|
1920
|
-
maximumFractionDigits: ((s = t.inputs) == null ? void 0 : s.decimalPlaces) ?? 0
|
|
1920
|
+
maximumFractionDigits: r ? ((s = t.inputs) == null ? void 0 : s.decimalPlaces) ?? 0 : void 0
|
|
1921
1921
|
};
|
|
1922
1922
|
return e.formatter.numberFormatter(e, n);
|
|
1923
1923
|
}, M0 = {
|
|
@@ -6,7 +6,7 @@ const E = "en-US", s = (t, n = {}) => ({
|
|
|
6
6
|
optionLabel: () => t,
|
|
7
7
|
...n
|
|
8
8
|
}
|
|
9
|
-
}), g = () => globalThis.__EMBEDDABLE_BUNDLE_HASH__ ?? null,
|
|
9
|
+
}), g = () => globalThis.__EMBEDDABLE_BUNDLE_HASH__ ?? null, D = (t, n) => {
|
|
10
10
|
if (I.includes(t))
|
|
11
11
|
throw new Error(`Type ${t} is part of the nativeTypes and cannot be defined`, { cause: "sdk" });
|
|
12
12
|
const r = {
|
|
@@ -23,8 +23,8 @@ const E = "en-US", s = (t, n = {}) => ({
|
|
|
23
23
|
...n
|
|
24
24
|
}
|
|
25
25
|
}, r;
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, m = "string", L = "number", p = "boolean", f = "time", A = "timeRange", b = "granularity", S = "dataset", B = "measure", y = "dimension", M = "dimensionOrMeasure", h = [
|
|
27
|
+
m,
|
|
28
28
|
L,
|
|
29
29
|
p,
|
|
30
30
|
f,
|
|
@@ -99,11 +99,10 @@ s("dataset");
|
|
|
99
99
|
s("measure");
|
|
100
100
|
s("dimension");
|
|
101
101
|
s("dimensionOrMeasure");
|
|
102
|
-
const _ =
|
|
102
|
+
const _ = D("comparisonPeriod", {
|
|
103
103
|
label: "Comparison Period",
|
|
104
104
|
optionLabel: (t) => t
|
|
105
105
|
});
|
|
106
|
-
e(_, "summer");
|
|
107
106
|
e(_, "Previous period");
|
|
108
107
|
e(_, "Previous week");
|
|
109
108
|
e(_, "Previous month");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddable-types.js","sources":["../node_modules/@embeddable.com/core/lib/index.esm.js","../src/remarkable-pro/components/types/ComparisonPeriod.type.emb.ts"],"sourcesContent":["import { mergician } from 'mergician';\n\nconst DEFAULT_LOCALE = \"en-US\";\nconst normalizeEntities = (entities, { mapFn = (x) => x, filterFn = Boolean, }) => {\n if (!entities)\n return undefined;\n const filtered = entities.filter(filterFn);\n if (filtered.length === 0)\n return undefined;\n return filtered.map(mapFn);\n};\nconst getName = (x) => x.name;\nconst checkTimeDimension = (timeDimension) => Boolean(timeDimension &&\n timeDimension.dimension &&\n (timeDimension.granularity || timeDimension.dateRange));\nconst validateOrderBy = (orderByParam, dimensions, measures, timeDimensions) => {\n const unknownDimensionsOrMeasures = [];\n const dimensionAndMeasureNames = [\n ...[...measures, ...dimensions].filter(Boolean).map((x) => x.name),\n ...timeDimensions\n .filter(Boolean)\n .map((x) => x.dimension)\n .filter(Boolean),\n ];\n for (const orderBy of orderByParam) {\n const { name } = orderBy.property;\n if (dimensionAndMeasureNames.includes(name))\n continue;\n unknownDimensionsOrMeasures.push(name);\n }\n return unknownDimensionsOrMeasures;\n};\nconst createBuiltInType = (name, typeConfig = {}) => ({\n __embeddableType: \"built-in\",\n toString: () => name,\n typeConfig: {\n label: name,\n optionLabel: () => name,\n ...typeConfig,\n },\n});\nconst validateFilter = (filter) => {\n if (!filter.property)\n return \"filter property must be set\";\n if (!filter.operator)\n return \"filter operator must be set\";\n};\nconst convertFilterValue = (value) => {\n // no need to convert these values\n if (value == null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\" ||\n typeof value === \"number\" ||\n value instanceof Date ||\n Array.isArray(value)) {\n return value;\n }\n // time or timeRange must be converted\n if (value?.relativeTimeString)\n return value?.relativeTimeString;\n if (Object.hasOwn(value, \"date\"))\n return value?.date;\n if (Object.hasOwn(value, \"from\") || Object.hasOwn(value, \"to\")) {\n const timeRange = value;\n return [timeRange?.from, timeRange?.to].filter(Boolean);\n }\n};\nfunction deduplicateEntitiesByName(entities) {\n if (!entities || entities.length === 0)\n return [];\n const seen = new Set();\n return entities.filter((entity) => {\n if (seen.has(entity.name)) {\n return false;\n }\n seen.add(entity.name);\n return true;\n });\n}\n\nconst DIMENSION_TYPE = \"dimension\";\nconst MEASURE_TYPE = \"measure\";\nconst deepFlattenSelect = (input) => {\n if (Array.isArray(input)) {\n return input.flatMap(deepFlattenSelect);\n }\n return [input];\n};\nconst processSelectParam = (selectParam) => {\n const result = {\n dimensions: [],\n measures: [],\n timeDimensions: [],\n };\n if (!selectParam) {\n return result;\n }\n const flat = deepFlattenSelect(selectParam).filter(Boolean);\n if (!flat.length) {\n result.error = \"select must not be empty\";\n return result;\n }\n for (const ent of flat) {\n const isValidEntity = typeof ent === \"object\" &&\n (isDimensionOrMeasure(ent) || isTimeDimension(ent));\n if (!isValidEntity) {\n result.error =\n \"select must only contain Dimension, Measure or TimeDimension objects\";\n return result;\n }\n if (isTimeDimension(ent)) {\n result.timeDimensions.push(ent);\n }\n else if (isDimension(ent)) {\n const dimension = ent;\n const granularity = dimension.inputs?.granularity;\n if (dimension.nativeType === \"time\" && granularity) {\n result.timeDimensions.push({\n dimension: dimension.name,\n granularity,\n title: dimension.title,\n });\n }\n else {\n result.dimensions.push(dimension);\n }\n }\n else if (isMeasure(ent)) {\n result.measures.push(ent);\n }\n else {\n const type = \"__type__\" in ent ? ent.__type__ : typeof ent;\n result.error = `Unknown __type__ in select: ${type}`;\n return result;\n }\n }\n return result;\n};\nfunction validateLegacyFields(request) {\n if (request.measures?.length > 0 &&\n request.measures.some((m) => m?.__type__ !== MEASURE_TYPE)) {\n return \"Unexpected type passed to `measures` in loadData function. Expected an array of type Measure.\";\n }\n if (request.dimensions?.length > 0 &&\n request.dimensions.some((m) => m?.__type__ !== DIMENSION_TYPE)) {\n return \"Unexpected type passed to `dimensions` in loadData function. Expected an array of type Dimension.\";\n }\n return null;\n}\nfunction processApiSelection(request) {\n const result = {\n dimensions: [],\n measures: [],\n timeDimensions: [],\n usingSelect: false,\n };\n if (request.select) {\n result.usingSelect = true;\n const selectResult = processSelectParam(request.select);\n if (selectResult.error) {\n result.error = selectResult.error;\n return result;\n }\n result.dimensions = selectResult.dimensions;\n result.measures = selectResult.measures;\n result.timeDimensions = selectResult.timeDimensions;\n }\n else {\n const legacyError = validateLegacyFields(request);\n if (legacyError) {\n result.error = legacyError;\n return result;\n }\n result.dimensions =\n normalizeEntities(request.dimensions, { mapFn: (x) => x }) ?? [];\n result.measures =\n normalizeEntities(request.measures, { mapFn: (x) => x }) ?? [];\n result.timeDimensions =\n normalizeEntities(request.timeDimensions, { filterFn: Boolean }) ?? [];\n }\n result.dimensions = deduplicateEntitiesByName(result.dimensions);\n result.measures = deduplicateEntitiesByName(result.measures);\n return result;\n}\nfunction validateOrderByLogic(orderBy, dimensions, measures, timeDimensions) {\n const unknownDimensionsOrMeasures = validateOrderBy(orderBy ?? [], dimensions, measures, timeDimensions);\n if (unknownDimensionsOrMeasures.length > 0) {\n return `Cannot order by ${unknownDimensionsOrMeasures.join(\", \")} as no such ${unknownDimensionsOrMeasures.length === 1 ? \"property\" : \"properties\"} has been loaded.`;\n }\n return null;\n}\nfunction validateFiltersLogic(filters) {\n if (filters) {\n const errors = filters\n .map((f, index) => ({\n index,\n message: validateFilter(f),\n }))\n .filter((e) => !!e.message);\n if (errors.length) {\n return errors\n .map((e) => `filter[${e.index}] is not valid: ${e.message}`)\n .join(\"\\n\");\n }\n }\n return null;\n}\nfunction buildQueryObject(request, dimensions, measures, timeDimensions, order) {\n return {\n inputName: request.from.inputName,\n datasetId: request.from.datasetId,\n embeddableId: request.from.embeddableId,\n dimensions: normalizeEntities(dimensions, { mapFn: getName }) ?? [],\n measures: normalizeEntities(measures, { mapFn: getName }) ?? [],\n order,\n timeDimensions: normalizeEntities(timeDimensions, { filterFn: checkTimeDimension }) ?? [],\n offset: request.offset,\n limit: request.limit,\n variableValues: request.from.variableValues,\n filters: request.filters?.map((f) => ({\n member: f.property.name,\n operator: f.operator,\n values: convertFilterValue(f.value),\n })),\n timezone: request.timezone,\n };\n}\n\nconst LOAD_DATA_EVENT = \"embeddable-event:load-data\";\nconst FilterOperator = {\n equals: \"equals\",\n notEquals: \"notEquals\",\n contains: \"contains\",\n notContains: \"notContains\",\n startsWith: \"startsWith\",\n endsWith: \"endsWith\",\n gt: \"gt\",\n gte: \"gte\",\n lt: \"lt\",\n lte: \"lte\",\n notNull: \"set\",\n isNull: \"notSet\",\n inDateRange: \"inDateRange\",\n notInDateRange: \"notInDateRange\",\n beforeDate: \"beforeDate\",\n afterDate: \"afterDate\",\n measureFilter: \"measureFilter\",\n};\nconst isLoadDataParams = (ldp) => typeof ldp === \"object\" &&\n ldp &&\n \"requestParams\" in ldp &&\n \"dataLoader\" in ldp;\nconst executeDataRequest = (triggerElement, request, componentId, propertyName) => {\n if (!request.from)\n return \"No dataset selected\";\n // Mutually exclusive API check\n if (request.select &&\n (request.dimensions || request.measures || request.timeDimensions)) {\n return \"loadData expects you to use either dimensions, timeDimensions and measures, or select. You cannot use both together.\";\n }\n // Process select or legacy fields\n const apiResult = processApiSelection(request);\n if (apiResult.error) {\n return apiResult.error;\n }\n const { dimensions, measures, timeDimensions } = apiResult;\n // Validate required fields\n const dimensionsOrMeasuresDefined = dimensions.length || measures.length || timeDimensions.length;\n if (!dimensionsOrMeasuresDefined) {\n return \"At least a dimension or a measure should be selected.\";\n }\n // Order By Validation\n const orderByError = validateOrderByLogic(request.orderBy, dimensions, measures, timeDimensions);\n if (orderByError) {\n return orderByError;\n }\n // Filter Validation\n const filterError = validateFiltersLogic(request.filters);\n if (filterError) {\n return filterError;\n }\n // Prepare OrderBy for query\n const order = normalizeEntities(request.orderBy, {\n mapFn: (o) => [o.property.name, o.direction],\n });\n // Build Query Object\n const query = buildQueryObject(request, dimensions, measures, timeDimensions, order);\n // Dispatch Event\n triggerElement.dispatchEvent(new CustomEvent(LOAD_DATA_EVENT, {\n bubbles: true,\n composed: true,\n detail: {\n query,\n componentId,\n propertyName,\n },\n }));\n};\nconst loadData = (requestParams) => ({\n requestParams,\n dataLoader: executeDataRequest,\n});\nconst isDimension = (dimensionOrMeasure) => dimensionOrMeasure?.__type__ === DIMENSION_TYPE;\nconst isMeasure = (dimensionOrMeasure) => dimensionOrMeasure?.__type__ === MEASURE_TYPE;\nconst isTimeDimension = (dimensionOrMeasure) => \"dimension\" in (dimensionOrMeasure ?? {}) &&\n !(\"__type__\" in dimensionOrMeasure);\nconst isDimensionOrMeasure = (dimensionOrMeasure) => isDimension(dimensionOrMeasure) || isMeasure(dimensionOrMeasure);\n\nconst getOperationObject = (operation, value) => ({\n operation,\n value: value ?? null,\n __embeddableVariableMeta: true,\n});\nconst Value = {\n noFilter: () => getOperationObject(\"NO_FILTER\"),\n of: (value) => getOperationObject(\"VALUE\", value),\n};\n\nconst UPDATE_VALUE_EVENT = \"embeddable:value:changed\";\nconst setValue = (triggerElement, value, componentId, eventName) => {\n const event = new CustomEvent(UPDATE_VALUE_EVENT, {\n bubbles: true,\n composed: true,\n detail: {\n componentId,\n value,\n eventName,\n },\n });\n triggerElement.dispatchEvent(event);\n};\n\n// Helper to get the bundleHash from window if available\nconst getBundleHash$1 = () => globalThis.__EMBEDDABLE_BUNDLE_HASH__ ?? null;\nconst defineType = (typeName, typeConfig) => {\n if (ALL_NATIVE_TYPES.includes(typeName)) {\n throw new Error(`Type ${typeName} is part of the nativeTypes and cannot be defined`, { cause: \"sdk\" });\n }\n const type = {\n __embeddableType: \"custom\",\n toString: () => typeName,\n typeConfig,\n };\n // Get the bundleHash from stored value or window\n const bundleHash = getBundleHash$1();\n globalThis.__EMBEDDABLE__ = globalThis.__EMBEDDABLE__ || {};\n const embeddable = bundleHash\n ? (globalThis.__EMBEDDABLE__[bundleHash] =\n globalThis.__EMBEDDABLE__[bundleHash] || {})\n : globalThis.__EMBEDDABLE__;\n embeddable.types = embeddable.types || {};\n // Preserve existing types by merging with new type\n embeddable.types = {\n ...embeddable.types,\n [typeName]: {\n name: typeName,\n ...typeConfig,\n },\n };\n return type;\n};\nconst STRING = \"string\";\nconst NUMBER = \"number\";\nconst BOOLEAN = \"boolean\";\nconst TIME = \"time\";\nconst TIME_RANGE = \"timeRange\";\nconst GRANULARITY = \"granularity\";\nconst DATASET = \"dataset\";\nconst MEASURE = \"measure\";\nconst DIMENSION = \"dimension\";\nconst DIMENSION_OR_MEASURE = \"dimensionOrMeasure\";\nconst DEFAULT_NATIVE_TYPES = [\n STRING,\n NUMBER,\n BOOLEAN,\n TIME,\n TIME_RANGE,\n GRANULARITY,\n];\nconst ALL_NATIVE_TYPES = [\n ...DEFAULT_NATIVE_TYPES,\n DATASET,\n MEASURE,\n DIMENSION,\n DIMENSION_OR_MEASURE,\n];\nconst MEASURE_TYPE_STRING = \"string\";\nconst MEASURE_TYPE_TIME = \"time\";\nconst MEASURE_TYPE_BOOLEAN = \"boolean\";\nconst MEASURE_TYPE_NUMBER = \"number\";\nconst MEASURE_TYPE_COUNT = \"count\";\nconst MEASURE_TYPE_COUNT_DISTINCT = \"count_distinct\";\nconst MEASURE_TYPE_COUNT_DISTINCT_APPROX = \"count_distinct_approx\";\nconst MEASURE_TYPE_SUM = \"sum\";\nconst MEASURE_TYPE_AVG = \"avg\";\nconst MEASURE_TYPE_MIN = \"min\";\nconst MEASURE_TYPE_MAX = \"max\";\nconst MEASURE_TYPES = [\n MEASURE_TYPE_STRING,\n MEASURE_TYPE_TIME,\n MEASURE_TYPE_BOOLEAN,\n MEASURE_TYPE_NUMBER,\n MEASURE_TYPE_COUNT,\n MEASURE_TYPE_COUNT_DISTINCT,\n MEASURE_TYPE_COUNT_DISTINCT_APPROX,\n MEASURE_TYPE_SUM,\n MEASURE_TYPE_AVG,\n MEASURE_TYPE_MIN,\n MEASURE_TYPE_MAX,\n];\nconst DIMENSION_TYPE_STRING = \"string\";\nconst DIMENSION_TYPE_NUMBER = \"number\";\nconst DIMENSION_TYPE_BOOLEAN = \"boolean\";\nconst DIMENSION_TYPE_GEO = \"geo\";\nconst DIMENSION_TYPE_TIME = \"time\";\nconst DIMENSION_TYPES = [\n DIMENSION_TYPE_STRING,\n DIMENSION_TYPE_NUMBER,\n DIMENSION_TYPE_BOOLEAN,\n DIMENSION_TYPE_GEO,\n DIMENSION_TYPE_TIME,\n];\nconst DIMENSION_OR_MEASURE_TYPES = [\n ...DIMENSION_TYPES,\n ...MEASURE_TYPES,\n];\n\n// Helper to get the bundleHash from window if available\n// Check if we have a bundleHash in the window\nconst getBundleHash = () => globalThis.__EMBEDDABLE_BUNDLE_HASH__ ?? null;\nconst defineOption = (type, option) => {\n // Get the bundleHash from stored value or window\n const bundleHash = getBundleHash();\n globalThis.__EMBEDDABLE__ ??= {};\n const embeddable = bundleHash\n ? (globalThis.__EMBEDDABLE__[bundleHash] ??= {})\n : globalThis.__EMBEDDABLE__;\n if (typeof type === \"string\") {\n // Handle native types\n embeddable.nativeTypes = embeddable.nativeTypes || {};\n embeddable.nativeTypes[type] = embeddable.nativeTypes[type] || {};\n embeddable.nativeTypes[type].options ??= [];\n embeddable.nativeTypes[type].options.push(option);\n }\n else {\n // Handle custom types\n const typeName = type.toString();\n if (!embeddable?.types?.[typeName])\n return;\n embeddable.types[typeName].options ??= [];\n embeddable.types[typeName].options.push(option);\n }\n};\n\nconst StringType = createBuiltInType(\"string\", {\n transform: (value) => value,\n optionLabel: (value) => Array.isArray(value)\n ? `[${value.map((v) => `\"${v}\"`).join(\",\")}]`\n : `\"${value}\"`,\n});\nconst NumberType = createBuiltInType(\"number\", {\n transform: (value) => Array.isArray(value) ? value : value ? Number(value) : value,\n optionLabel: (value) => Array.isArray(value)\n ? `[${value.join(\",\")}]`\n : (value?.toLocaleString(DEFAULT_LOCALE) ?? \"\"),\n});\nconst BooleanType = createBuiltInType(\"boolean\", {\n transform: (value) => value === \"true\" || value === true,\n optionLabel: (value) => (value ? \"true\" : \"false\"),\n});\nconst TimeType = createBuiltInType(\"time\", {\n transform: (value) => {\n const date = value?.date ? new Date(value.date) : undefined;\n const isValid = date && date.toString() !== \"Invalid Date\";\n return {\n date: isValid ? date : undefined,\n relativeTimeString: value?.relativeTimeString,\n };\n },\n optionLabel: (value) => {\n if (!value)\n return \"\";\n if (value?.date) {\n return (value.date?.toLocaleDateString(DEFAULT_LOCALE) ??\n value.date.toLocaleString());\n }\n return value.relativeTimeString;\n },\n});\nconst TimeRangeType = createBuiltInType(\"timeRange\", {\n transform: (value) => {\n // Return undefined instead of a null populated object\n if (!value)\n return undefined;\n const [from, to] = [value?.from, value?.to];\n const fromDate = new Date(from);\n const toDate = new Date(to);\n return {\n from: fromDate.toString() !== \"Invalid Date\" ? fromDate : undefined,\n to: toDate.toString() !== \"Invalid Date\" ? toDate : undefined,\n relativeTimeString: value?.relativeTimeString,\n };\n },\n optionLabel: (value) => {\n if (!value)\n return \"\";\n if (value?.from && value?.to) {\n return `${value.from?.toLocaleDateString(DEFAULT_LOCALE) ??\n value.from?.toLocaleString()},${value.to?.toLocaleDateString(DEFAULT_LOCALE) ??\n value.to?.toLocaleString()}`;\n }\n return value?.relativeTimeString;\n },\n});\nconst GranularityType = createBuiltInType(\"granularity\", {\n transform: (value) => value,\n optionLabel: (value) => value,\n});\nconst DatasetType = createBuiltInType(\"dataset\");\nconst MeasureType = createBuiltInType(\"measure\");\nconst DimensionType = createBuiltInType(\"dimension\");\nconst DimensionOrMeasureType = createBuiltInType(\"dimensionOrMeasure\");\n\nvar nativeTypes = /*#__PURE__*/Object.freeze({\n __proto__: null,\n BooleanType: BooleanType,\n DatasetType: DatasetType,\n DimensionOrMeasureType: DimensionOrMeasureType,\n DimensionType: DimensionType,\n GranularityType: GranularityType,\n MeasureType: MeasureType,\n NumberType: NumberType,\n StringType: StringType,\n TimeRangeType: TimeRangeType,\n TimeType: TimeType\n});\n\nconst defineTheme = (parentTheme, childTheme) => {\n return mergician(parentTheme, childTheme);\n};\n\nexport { ALL_NATIVE_TYPES, DEFAULT_NATIVE_TYPES, DIMENSION_OR_MEASURE_TYPES, DIMENSION_TYPES, FilterOperator, MEASURE_TYPES, Value, defineOption, defineTheme, defineType, isDimension, isDimensionOrMeasure, isLoadDataParams, isMeasure, isTimeDimension, loadData, nativeTypes, setValue };\n","import { defineOption, defineType } from '@embeddable.com/core';\n\nconst ComparisonPeriodType = defineType('comparisonPeriod', {\n label: 'Comparison Period',\n optionLabel: (value: string) => value,\n});\n\ndefineOption(ComparisonPeriodType, 'summer');\ndefineOption(ComparisonPeriodType, 'Previous period');\ndefineOption(ComparisonPeriodType, 'Previous week');\ndefineOption(ComparisonPeriodType, 'Previous month');\ndefineOption(ComparisonPeriodType, 'Previous quarter');\ndefineOption(ComparisonPeriodType, 'Previous year');\n\nexport default ComparisonPeriodType;\n"],"names":["DEFAULT_LOCALE","createBuiltInType","name","typeConfig","getBundleHash$1","defineType","typeName","ALL_NATIVE_TYPES","type","bundleHash","embeddable","STRING","NUMBER","BOOLEAN","TIME","TIME_RANGE","GRANULARITY","DATASET","MEASURE","DIMENSION","DIMENSION_OR_MEASURE","DEFAULT_NATIVE_TYPES","getBundleHash","defineOption","option","_a","_b","_c","_d","value","v","date","from","to","fromDate","toDate","ComparisonPeriodType"],"mappings":"AAEA,MAAMA,IAAiB,SA8BjBC,IAAoB,CAACC,GAAMC,IAAa,QAAQ;AAAA,EAClD,kBAAkB;AAAA,EAClB,UAAU,MAAMD;AAAA,EAChB,YAAY;AAAA,IACR,OAAOA;AAAA,IACP,aAAa,MAAMA;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AAAA,EACrD,WAAW,CAAC4B,MAAUA;AAAA,EACtB,aAAa,CAACA,MAAUA;AAC5B,CAAC;AACmB5B,EAAkB,SAAS;AAC3BA,EAAkB,SAAS;AACzBA,EAAkB,WAAW;AACpBA,EAAkB,oBAAoB;ACvgBrE,MAAMmC,IAAuB/B,EAAW,oBAAoB;AAAA,EAC1D,OAAO;AAAA,EACP,aAAa,CAACwB,MAAkBA;AAClC,CAAC;AAEDN,EAAaa,GAAsB,QAAQ;AAC3Cb,EAAaa,GAAsB,iBAAiB;AACpDb,EAAaa,GAAsB,eAAe;AAClDb,EAAaa,GAAsB,gBAAgB;AACnDb,EAAaa,GAAsB,kBAAkB;AACrDb,EAAaa,GAAsB,eAAe;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"embeddable-types.js","sources":["../node_modules/@embeddable.com/core/lib/index.esm.js","../src/remarkable-pro/components/types/ComparisonPeriod.type.emb.ts"],"sourcesContent":["import { mergician } from 'mergician';\n\nconst DEFAULT_LOCALE = \"en-US\";\nconst normalizeEntities = (entities, { mapFn = (x) => x, filterFn = Boolean, }) => {\n if (!entities)\n return undefined;\n const filtered = entities.filter(filterFn);\n if (filtered.length === 0)\n return undefined;\n return filtered.map(mapFn);\n};\nconst getName = (x) => x.name;\nconst checkTimeDimension = (timeDimension) => Boolean(timeDimension &&\n timeDimension.dimension &&\n (timeDimension.granularity || timeDimension.dateRange));\nconst validateOrderBy = (orderByParam, dimensions, measures, timeDimensions) => {\n const unknownDimensionsOrMeasures = [];\n const dimensionAndMeasureNames = [\n ...[...measures, ...dimensions].filter(Boolean).map((x) => x.name),\n ...timeDimensions\n .filter(Boolean)\n .map((x) => x.dimension)\n .filter(Boolean),\n ];\n for (const orderBy of orderByParam) {\n const { name } = orderBy.property;\n if (dimensionAndMeasureNames.includes(name))\n continue;\n unknownDimensionsOrMeasures.push(name);\n }\n return unknownDimensionsOrMeasures;\n};\nconst createBuiltInType = (name, typeConfig = {}) => ({\n __embeddableType: \"built-in\",\n toString: () => name,\n typeConfig: {\n label: name,\n optionLabel: () => name,\n ...typeConfig,\n },\n});\nconst validateFilter = (filter) => {\n if (!filter.property)\n return \"filter property must be set\";\n if (!filter.operator)\n return \"filter operator must be set\";\n};\nconst convertFilterValue = (value) => {\n // no need to convert these values\n if (value == null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\" ||\n typeof value === \"number\" ||\n value instanceof Date ||\n Array.isArray(value)) {\n return value;\n }\n // time or timeRange must be converted\n if (value?.relativeTimeString)\n return value?.relativeTimeString;\n if (Object.hasOwn(value, \"date\"))\n return value?.date;\n if (Object.hasOwn(value, \"from\") || Object.hasOwn(value, \"to\")) {\n const timeRange = value;\n return [timeRange?.from, timeRange?.to].filter(Boolean);\n }\n};\nfunction deduplicateEntitiesByName(entities) {\n if (!entities || entities.length === 0)\n return [];\n const seen = new Set();\n return entities.filter((entity) => {\n if (seen.has(entity.name)) {\n return false;\n }\n seen.add(entity.name);\n return true;\n });\n}\n\nconst DIMENSION_TYPE = \"dimension\";\nconst MEASURE_TYPE = \"measure\";\nconst deepFlattenSelect = (input) => {\n if (Array.isArray(input)) {\n return input.flatMap(deepFlattenSelect);\n }\n return [input];\n};\nconst processSelectParam = (selectParam) => {\n const result = {\n dimensions: [],\n measures: [],\n timeDimensions: [],\n };\n if (!selectParam) {\n return result;\n }\n const flat = deepFlattenSelect(selectParam).filter(Boolean);\n if (!flat.length) {\n result.error = \"select must not be empty\";\n return result;\n }\n for (const ent of flat) {\n const isValidEntity = typeof ent === \"object\" &&\n (isDimensionOrMeasure(ent) || isTimeDimension(ent));\n if (!isValidEntity) {\n result.error =\n \"select must only contain Dimension, Measure or TimeDimension objects\";\n return result;\n }\n if (isTimeDimension(ent)) {\n result.timeDimensions.push(ent);\n }\n else if (isDimension(ent)) {\n const dimension = ent;\n const granularity = dimension.inputs?.granularity;\n if (dimension.nativeType === \"time\" && granularity) {\n result.timeDimensions.push({\n dimension: dimension.name,\n granularity,\n title: dimension.title,\n });\n }\n else {\n result.dimensions.push(dimension);\n }\n }\n else if (isMeasure(ent)) {\n result.measures.push(ent);\n }\n else {\n const type = \"__type__\" in ent ? ent.__type__ : typeof ent;\n result.error = `Unknown __type__ in select: ${type}`;\n return result;\n }\n }\n return result;\n};\nfunction validateLegacyFields(request) {\n if (request.measures?.length > 0 &&\n request.measures.some((m) => m?.__type__ !== MEASURE_TYPE)) {\n return \"Unexpected type passed to `measures` in loadData function. Expected an array of type Measure.\";\n }\n if (request.dimensions?.length > 0 &&\n request.dimensions.some((m) => m?.__type__ !== DIMENSION_TYPE)) {\n return \"Unexpected type passed to `dimensions` in loadData function. Expected an array of type Dimension.\";\n }\n return null;\n}\nfunction processApiSelection(request) {\n const result = {\n dimensions: [],\n measures: [],\n timeDimensions: [],\n usingSelect: false,\n };\n if (request.select) {\n result.usingSelect = true;\n const selectResult = processSelectParam(request.select);\n if (selectResult.error) {\n result.error = selectResult.error;\n return result;\n }\n result.dimensions = selectResult.dimensions;\n result.measures = selectResult.measures;\n result.timeDimensions = selectResult.timeDimensions;\n }\n else {\n const legacyError = validateLegacyFields(request);\n if (legacyError) {\n result.error = legacyError;\n return result;\n }\n result.dimensions =\n normalizeEntities(request.dimensions, { mapFn: (x) => x }) ?? [];\n result.measures =\n normalizeEntities(request.measures, { mapFn: (x) => x }) ?? [];\n result.timeDimensions =\n normalizeEntities(request.timeDimensions, { filterFn: Boolean }) ?? [];\n }\n result.dimensions = deduplicateEntitiesByName(result.dimensions);\n result.measures = deduplicateEntitiesByName(result.measures);\n return result;\n}\nfunction validateOrderByLogic(orderBy, dimensions, measures, timeDimensions) {\n const unknownDimensionsOrMeasures = validateOrderBy(orderBy ?? [], dimensions, measures, timeDimensions);\n if (unknownDimensionsOrMeasures.length > 0) {\n return `Cannot order by ${unknownDimensionsOrMeasures.join(\", \")} as no such ${unknownDimensionsOrMeasures.length === 1 ? \"property\" : \"properties\"} has been loaded.`;\n }\n return null;\n}\nfunction validateFiltersLogic(filters) {\n if (filters) {\n const errors = filters\n .map((f, index) => ({\n index,\n message: validateFilter(f),\n }))\n .filter((e) => !!e.message);\n if (errors.length) {\n return errors\n .map((e) => `filter[${e.index}] is not valid: ${e.message}`)\n .join(\"\\n\");\n }\n }\n return null;\n}\nfunction buildQueryObject(request, dimensions, measures, timeDimensions, order) {\n return {\n inputName: request.from.inputName,\n datasetId: request.from.datasetId,\n embeddableId: request.from.embeddableId,\n dimensions: normalizeEntities(dimensions, { mapFn: getName }) ?? [],\n measures: normalizeEntities(measures, { mapFn: getName }) ?? [],\n order,\n timeDimensions: normalizeEntities(timeDimensions, { filterFn: checkTimeDimension }) ?? [],\n offset: request.offset,\n limit: request.limit,\n variableValues: request.from.variableValues,\n filters: request.filters?.map((f) => ({\n member: f.property.name,\n operator: f.operator,\n values: convertFilterValue(f.value),\n })),\n timezone: request.timezone,\n };\n}\n\nconst LOAD_DATA_EVENT = \"embeddable-event:load-data\";\nconst FilterOperator = {\n equals: \"equals\",\n notEquals: \"notEquals\",\n contains: \"contains\",\n notContains: \"notContains\",\n startsWith: \"startsWith\",\n endsWith: \"endsWith\",\n gt: \"gt\",\n gte: \"gte\",\n lt: \"lt\",\n lte: \"lte\",\n notNull: \"set\",\n isNull: \"notSet\",\n inDateRange: \"inDateRange\",\n notInDateRange: \"notInDateRange\",\n beforeDate: \"beforeDate\",\n afterDate: \"afterDate\",\n measureFilter: \"measureFilter\",\n};\nconst isLoadDataParams = (ldp) => typeof ldp === \"object\" &&\n ldp &&\n \"requestParams\" in ldp &&\n \"dataLoader\" in ldp;\nconst executeDataRequest = (triggerElement, request, componentId, propertyName) => {\n if (!request.from)\n return \"No dataset selected\";\n // Mutually exclusive API check\n if (request.select &&\n (request.dimensions || request.measures || request.timeDimensions)) {\n return \"loadData expects you to use either dimensions, timeDimensions and measures, or select. You cannot use both together.\";\n }\n // Process select or legacy fields\n const apiResult = processApiSelection(request);\n if (apiResult.error) {\n return apiResult.error;\n }\n const { dimensions, measures, timeDimensions } = apiResult;\n // Validate required fields\n const dimensionsOrMeasuresDefined = dimensions.length || measures.length || timeDimensions.length;\n if (!dimensionsOrMeasuresDefined) {\n return \"At least a dimension or a measure should be selected.\";\n }\n // Order By Validation\n const orderByError = validateOrderByLogic(request.orderBy, dimensions, measures, timeDimensions);\n if (orderByError) {\n return orderByError;\n }\n // Filter Validation\n const filterError = validateFiltersLogic(request.filters);\n if (filterError) {\n return filterError;\n }\n // Prepare OrderBy for query\n const order = normalizeEntities(request.orderBy, {\n mapFn: (o) => [o.property.name, o.direction],\n });\n // Build Query Object\n const query = buildQueryObject(request, dimensions, measures, timeDimensions, order);\n // Dispatch Event\n triggerElement.dispatchEvent(new CustomEvent(LOAD_DATA_EVENT, {\n bubbles: true,\n composed: true,\n detail: {\n query,\n componentId,\n propertyName,\n },\n }));\n};\nconst loadData = (requestParams) => ({\n requestParams,\n dataLoader: executeDataRequest,\n});\nconst isDimension = (dimensionOrMeasure) => dimensionOrMeasure?.__type__ === DIMENSION_TYPE;\nconst isMeasure = (dimensionOrMeasure) => dimensionOrMeasure?.__type__ === MEASURE_TYPE;\nconst isTimeDimension = (dimensionOrMeasure) => \"dimension\" in (dimensionOrMeasure ?? {}) &&\n !(\"__type__\" in dimensionOrMeasure);\nconst isDimensionOrMeasure = (dimensionOrMeasure) => isDimension(dimensionOrMeasure) || isMeasure(dimensionOrMeasure);\n\nconst getOperationObject = (operation, value) => ({\n operation,\n value: value ?? null,\n __embeddableVariableMeta: true,\n});\nconst Value = {\n noFilter: () => getOperationObject(\"NO_FILTER\"),\n of: (value) => getOperationObject(\"VALUE\", value),\n};\n\nconst UPDATE_VALUE_EVENT = \"embeddable:value:changed\";\nconst setValue = (triggerElement, value, componentId, eventName) => {\n const event = new CustomEvent(UPDATE_VALUE_EVENT, {\n bubbles: true,\n composed: true,\n detail: {\n componentId,\n value,\n eventName,\n },\n });\n triggerElement.dispatchEvent(event);\n};\n\n// Helper to get the bundleHash from window if available\nconst getBundleHash$1 = () => globalThis.__EMBEDDABLE_BUNDLE_HASH__ ?? null;\nconst defineType = (typeName, typeConfig) => {\n if (ALL_NATIVE_TYPES.includes(typeName)) {\n throw new Error(`Type ${typeName} is part of the nativeTypes and cannot be defined`, { cause: \"sdk\" });\n }\n const type = {\n __embeddableType: \"custom\",\n toString: () => typeName,\n typeConfig,\n };\n // Get the bundleHash from stored value or window\n const bundleHash = getBundleHash$1();\n globalThis.__EMBEDDABLE__ = globalThis.__EMBEDDABLE__ || {};\n const embeddable = bundleHash\n ? (globalThis.__EMBEDDABLE__[bundleHash] =\n globalThis.__EMBEDDABLE__[bundleHash] || {})\n : globalThis.__EMBEDDABLE__;\n embeddable.types = embeddable.types || {};\n // Preserve existing types by merging with new type\n embeddable.types = {\n ...embeddable.types,\n [typeName]: {\n name: typeName,\n ...typeConfig,\n },\n };\n return type;\n};\nconst STRING = \"string\";\nconst NUMBER = \"number\";\nconst BOOLEAN = \"boolean\";\nconst TIME = \"time\";\nconst TIME_RANGE = \"timeRange\";\nconst GRANULARITY = \"granularity\";\nconst DATASET = \"dataset\";\nconst MEASURE = \"measure\";\nconst DIMENSION = \"dimension\";\nconst DIMENSION_OR_MEASURE = \"dimensionOrMeasure\";\nconst DEFAULT_NATIVE_TYPES = [\n STRING,\n NUMBER,\n BOOLEAN,\n TIME,\n TIME_RANGE,\n GRANULARITY,\n];\nconst ALL_NATIVE_TYPES = [\n ...DEFAULT_NATIVE_TYPES,\n DATASET,\n MEASURE,\n DIMENSION,\n DIMENSION_OR_MEASURE,\n];\nconst MEASURE_TYPE_STRING = \"string\";\nconst MEASURE_TYPE_TIME = \"time\";\nconst MEASURE_TYPE_BOOLEAN = \"boolean\";\nconst MEASURE_TYPE_NUMBER = \"number\";\nconst MEASURE_TYPE_COUNT = \"count\";\nconst MEASURE_TYPE_COUNT_DISTINCT = \"count_distinct\";\nconst MEASURE_TYPE_COUNT_DISTINCT_APPROX = \"count_distinct_approx\";\nconst MEASURE_TYPE_SUM = \"sum\";\nconst MEASURE_TYPE_AVG = \"avg\";\nconst MEASURE_TYPE_MIN = \"min\";\nconst MEASURE_TYPE_MAX = \"max\";\nconst MEASURE_TYPES = [\n MEASURE_TYPE_STRING,\n MEASURE_TYPE_TIME,\n MEASURE_TYPE_BOOLEAN,\n MEASURE_TYPE_NUMBER,\n MEASURE_TYPE_COUNT,\n MEASURE_TYPE_COUNT_DISTINCT,\n MEASURE_TYPE_COUNT_DISTINCT_APPROX,\n MEASURE_TYPE_SUM,\n MEASURE_TYPE_AVG,\n MEASURE_TYPE_MIN,\n MEASURE_TYPE_MAX,\n];\nconst DIMENSION_TYPE_STRING = \"string\";\nconst DIMENSION_TYPE_NUMBER = \"number\";\nconst DIMENSION_TYPE_BOOLEAN = \"boolean\";\nconst DIMENSION_TYPE_GEO = \"geo\";\nconst DIMENSION_TYPE_TIME = \"time\";\nconst DIMENSION_TYPES = [\n DIMENSION_TYPE_STRING,\n DIMENSION_TYPE_NUMBER,\n DIMENSION_TYPE_BOOLEAN,\n DIMENSION_TYPE_GEO,\n DIMENSION_TYPE_TIME,\n];\nconst DIMENSION_OR_MEASURE_TYPES = [\n ...DIMENSION_TYPES,\n ...MEASURE_TYPES,\n];\n\n// Helper to get the bundleHash from window if available\n// Check if we have a bundleHash in the window\nconst getBundleHash = () => globalThis.__EMBEDDABLE_BUNDLE_HASH__ ?? null;\nconst defineOption = (type, option) => {\n // Get the bundleHash from stored value or window\n const bundleHash = getBundleHash();\n globalThis.__EMBEDDABLE__ ??= {};\n const embeddable = bundleHash\n ? (globalThis.__EMBEDDABLE__[bundleHash] ??= {})\n : globalThis.__EMBEDDABLE__;\n if (typeof type === \"string\") {\n // Handle native types\n embeddable.nativeTypes = embeddable.nativeTypes || {};\n embeddable.nativeTypes[type] = embeddable.nativeTypes[type] || {};\n embeddable.nativeTypes[type].options ??= [];\n embeddable.nativeTypes[type].options.push(option);\n }\n else {\n // Handle custom types\n const typeName = type.toString();\n if (!embeddable?.types?.[typeName])\n return;\n embeddable.types[typeName].options ??= [];\n embeddable.types[typeName].options.push(option);\n }\n};\n\nconst StringType = createBuiltInType(\"string\", {\n transform: (value) => value,\n optionLabel: (value) => Array.isArray(value)\n ? `[${value.map((v) => `\"${v}\"`).join(\",\")}]`\n : `\"${value}\"`,\n});\nconst NumberType = createBuiltInType(\"number\", {\n transform: (value) => Array.isArray(value) ? value : value ? Number(value) : value,\n optionLabel: (value) => Array.isArray(value)\n ? `[${value.join(\",\")}]`\n : (value?.toLocaleString(DEFAULT_LOCALE) ?? \"\"),\n});\nconst BooleanType = createBuiltInType(\"boolean\", {\n transform: (value) => value === \"true\" || value === true,\n optionLabel: (value) => (value ? \"true\" : \"false\"),\n});\nconst TimeType = createBuiltInType(\"time\", {\n transform: (value) => {\n const date = value?.date ? new Date(value.date) : undefined;\n const isValid = date && date.toString() !== \"Invalid Date\";\n return {\n date: isValid ? date : undefined,\n relativeTimeString: value?.relativeTimeString,\n };\n },\n optionLabel: (value) => {\n if (!value)\n return \"\";\n if (value?.date) {\n return (value.date?.toLocaleDateString(DEFAULT_LOCALE) ??\n value.date.toLocaleString());\n }\n return value.relativeTimeString;\n },\n});\nconst TimeRangeType = createBuiltInType(\"timeRange\", {\n transform: (value) => {\n // Return undefined instead of a null populated object\n if (!value)\n return undefined;\n const [from, to] = [value?.from, value?.to];\n const fromDate = new Date(from);\n const toDate = new Date(to);\n return {\n from: fromDate.toString() !== \"Invalid Date\" ? fromDate : undefined,\n to: toDate.toString() !== \"Invalid Date\" ? toDate : undefined,\n relativeTimeString: value?.relativeTimeString,\n };\n },\n optionLabel: (value) => {\n if (!value)\n return \"\";\n if (value?.from && value?.to) {\n return `${value.from?.toLocaleDateString(DEFAULT_LOCALE) ??\n value.from?.toLocaleString()},${value.to?.toLocaleDateString(DEFAULT_LOCALE) ??\n value.to?.toLocaleString()}`;\n }\n return value?.relativeTimeString;\n },\n});\nconst GranularityType = createBuiltInType(\"granularity\", {\n transform: (value) => value,\n optionLabel: (value) => value,\n});\nconst DatasetType = createBuiltInType(\"dataset\");\nconst MeasureType = createBuiltInType(\"measure\");\nconst DimensionType = createBuiltInType(\"dimension\");\nconst DimensionOrMeasureType = createBuiltInType(\"dimensionOrMeasure\");\n\nvar nativeTypes = /*#__PURE__*/Object.freeze({\n __proto__: null,\n BooleanType: BooleanType,\n DatasetType: DatasetType,\n DimensionOrMeasureType: DimensionOrMeasureType,\n DimensionType: DimensionType,\n GranularityType: GranularityType,\n MeasureType: MeasureType,\n NumberType: NumberType,\n StringType: StringType,\n TimeRangeType: TimeRangeType,\n TimeType: TimeType\n});\n\nconst defineTheme = (parentTheme, childTheme) => {\n return mergician(parentTheme, childTheme);\n};\n\nexport { ALL_NATIVE_TYPES, DEFAULT_NATIVE_TYPES, DIMENSION_OR_MEASURE_TYPES, DIMENSION_TYPES, FilterOperator, MEASURE_TYPES, Value, defineOption, defineTheme, defineType, isDimension, isDimensionOrMeasure, isLoadDataParams, isMeasure, isTimeDimension, loadData, nativeTypes, setValue };\n","import { defineOption, defineType } from '@embeddable.com/core';\n\nconst ComparisonPeriodType = defineType('comparisonPeriod', {\n label: 'Comparison Period',\n optionLabel: (value: string) => value,\n});\n\ndefineOption(ComparisonPeriodType, 'Previous period');\ndefineOption(ComparisonPeriodType, 'Previous week');\ndefineOption(ComparisonPeriodType, 'Previous month');\ndefineOption(ComparisonPeriodType, 'Previous quarter');\ndefineOption(ComparisonPeriodType, 'Previous year');\n\nexport default ComparisonPeriodType;\n"],"names":["DEFAULT_LOCALE","createBuiltInType","name","typeConfig","getBundleHash$1","defineType","typeName","ALL_NATIVE_TYPES","type","bundleHash","embeddable","STRING","NUMBER","BOOLEAN","TIME","TIME_RANGE","GRANULARITY","DATASET","MEASURE","DIMENSION","DIMENSION_OR_MEASURE","DEFAULT_NATIVE_TYPES","getBundleHash","defineOption","option","_a","_b","_c","_d","value","v","date","from","to","fromDate","toDate","ComparisonPeriodType"],"mappings":"AAEA,MAAMA,IAAiB,SA8BjBC,IAAoB,CAACC,GAAMC,IAAa,QAAQ;AAAA,EAClD,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AAU,iBAAgB,KAE3BC,KAAA,gBAAAA,EAAO,qBANH;AAAA,EAOf;AACJ,CAAC;AACuB5B,EAAkB,eAAe;AAAA,EACrD,WAAW,CAAC4B,MAAUA;AAAA,EACtB,aAAa,CAACA,MAAUA;AAC5B,CAAC;AACmB5B,EAAkB,SAAS;AAC3BA,EAAkB,SAAS;AACzBA,EAAkB,WAAW;AACpBA,EAAkB,oBAAoB;ACvgBrE,MAAMmC,IAAuB/B,EAAW,oBAAoB;AAAA,EAC1D,OAAO;AAAA,EACP,aAAa,CAACwB,MAAkBA;AAClC,CAAC;AAEDN,EAAaa,GAAsB,iBAAiB;AACpDb,EAAaa,GAAsB,eAAe;AAClDb,EAAaa,GAAsB,gBAAgB;AACnDb,EAAaa,GAAsB,kBAAkB;AACrDb,EAAaa,GAAsB,eAAe;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as P, r as S, m as b, j as m, ae as D } from "./component.constants-Bn9l4N1t.js";
|
|
2
2
|
import { useTheme as v } from "@embeddable.com/react";
|
|
3
|
-
import { g as _, a as k } from "./pies.utils-
|
|
3
|
+
import { g as _, a as k } from "./pies.utils-BecIV2nV.js";
|
|
4
4
|
import { C as w } from "./ChartCard-Cb0QE9kP.js";
|
|
5
5
|
import "react";
|
|
6
6
|
const L = (d) => {
|
|
@@ -54,4 +54,4 @@ export {
|
|
|
54
54
|
L as D,
|
|
55
55
|
V as i
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=index-
|
|
57
|
+
//# sourceMappingURL=index-BOzeG3mG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BOzeG3mG.js","sources":["../src/remarkable-pro/components/charts/pies/DonutChartPro/index.tsx"],"sourcesContent":["import { useTheme } from '@embeddable.com/react';\nimport { Theme } from '../../../../theme/theme.types';\nimport { DefaultPieChartOptions, getDefaultPieChartOptions, getPieChartData } from '../pies.utils';\nimport { DefaultPieChartProps } from '../pies.types';\nimport { i18nSetup } from '../../../../theme/i18n/i18n';\nimport { ChartCard } from '../../shared/ChartCard/ChartCard';\nimport { DonutChart } from '../../../../../remarkable-ui';\nimport { mergician } from 'mergician';\nimport { resolveI18nProps } from '../../../component.utils';\n\ntype DonutChartProProps = DefaultPieChartProps;\n\nconst DonutChartPro = (props: DonutChartProProps) => {\n const theme = useTheme() as Theme;\n i18nSetup(theme);\n\n const {\n description,\n dimension,\n maxLegendItems,\n measure,\n results,\n showLegend,\n showTooltips,\n showValueLabels,\n title,\n onSegmentClick,\n } = resolveI18nProps(props);\n\n const data = getPieChartData({ data: results.data, dimension, measure, maxLegendItems }, theme);\n\n const options = mergician(\n getDefaultPieChartOptions(\n {\n measure,\n showTooltips,\n showLegend,\n showValueLabels,\n } as DefaultPieChartOptions,\n theme,\n ),\n theme.charts.donutChartPro?.options ?? {},\n );\n\n const handleSegmentClick = (index: number | undefined) => {\n onSegmentClick({\n dimensionValue: index === undefined ? undefined : results.data?.[index]?.[dimension.name],\n });\n };\n\n return (\n <ChartCard\n data={results}\n dimensionsAndMeasures={[dimension, measure]}\n errorMessage={results.error}\n subtitle={description}\n title={title}\n >\n <DonutChart data={data} options={options} onSegmentClick={handleSegmentClick} />\n </ChartCard>\n );\n};\n\nexport default DonutChartPro;\n"],"names":["DonutChartPro","props","theme","useTheme","i18nSetup","description","dimension","maxLegendItems","measure","results","showLegend","showTooltips","showValueLabels","title","onSegmentClick","resolveI18nProps","data","getPieChartData","options","mergician","getDefaultPieChartOptions","_a","handleSegmentClick","index","_b","jsx","ChartCard","DonutChart"],"mappings":";;;;;AAYA,MAAMA,IAAgB,CAACC,MAA8B;;AACnD,QAAMC,IAAQC,EAAA;AACd,EAAAC,EAAUF,CAAK;AAEf,QAAM;AAAA,IACJ,aAAAG;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,OAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,IACEC,EAAiBd,CAAK,GAEpBe,IAAOC,EAAgB,EAAE,MAAMR,EAAQ,MAAM,WAAAH,GAAW,SAAAE,GAAS,gBAAAD,EAAA,GAAkBL,CAAK,GAExFgB,IAAUC;AAAA,IACdC;AAAA,MACE;AAAA,QACE,SAAAZ;AAAA,QACA,cAAAG;AAAA,QACA,YAAAD;AAAA,QACA,iBAAAE;AAAA,MAAA;AAAA,MAEFV;AAAA,IAAA;AAAA,MAEFmB,IAAAnB,EAAM,OAAO,kBAAb,gBAAAmB,EAA4B,YAAW,CAAA;AAAA,EAAC,GAGpCC,IAAqB,CAACC,MAA8B;;AACxD,IAAAT,EAAe;AAAA,MACb,gBAAgBS,MAAU,WAAwBC,KAAAH,IAAAZ,EAAQ,SAAR,gBAAAY,EAAeE,OAAf,OAAZ,SAAYC,EAAwBlB,EAAU;AAAA,IAAI,CACzF;AAAA,EACH;AAEA,SACEmB,gBAAAA,EAAAA;AAAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAMjB;AAAA,MACN,uBAAuB,CAACH,GAAWE,CAAO;AAAA,MAC1C,cAAcC,EAAQ;AAAA,MACtB,UAAUJ;AAAA,MACV,OAAAQ;AAAA,MAEA,UAAAY,gBAAAA,EAAAA,IAACE,GAAA,EAAW,MAAAX,GAAY,SAAAE,GAAkB,gBAAgBI,EAAA,CAAoB;AAAA,IAAA;AAAA,EAAA;AAGpF;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as x, r as S, m as b, j as m, af as v } from "./component.constants-Bn9l4N1t.js";
|
|
2
2
|
import { useTheme as _ } from "@embeddable.com/react";
|
|
3
3
|
import "react";
|
|
4
|
-
import { g as k, a as w } from "./pies.utils-
|
|
4
|
+
import { g as k, a as w } from "./pies.utils-BecIV2nV.js";
|
|
5
5
|
import { C as L } from "./ChartCard-Cb0QE9kP.js";
|
|
6
6
|
const M = (d) => {
|
|
7
7
|
var a;
|
|
@@ -54,4 +54,4 @@ export {
|
|
|
54
54
|
M as P,
|
|
55
55
|
V as i
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=index-
|
|
57
|
+
//# sourceMappingURL=index-Chlmh1dF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Chlmh1dF.js","sources":["../src/remarkable-pro/components/charts/pies/PieChartPro/index.tsx"],"sourcesContent":["import { useTheme } from '@embeddable.com/react';\nimport { PieChart } from '../../../../../remarkable-ui';\nimport { Theme } from '../../../../theme/theme.types';\nimport { DefaultPieChartOptions, getDefaultPieChartOptions, getPieChartData } from '../pies.utils';\nimport { DefaultPieChartProps } from '../pies.types';\nimport { i18nSetup } from '../../../../theme/i18n/i18n';\nimport { ChartCard } from '../../shared/ChartCard/ChartCard';\nimport { mergician } from 'mergician';\nimport { resolveI18nProps } from '../../../component.utils';\n\ntype PieChartProProps = DefaultPieChartProps;\n\nconst PieChartPro = (props: PieChartProProps) => {\n const theme = useTheme() as Theme;\n i18nSetup(theme);\n\n const {\n description,\n dimension,\n maxLegendItems,\n measure,\n results,\n showLegend,\n showTooltips,\n showValueLabels,\n title,\n onSegmentClick,\n } = resolveI18nProps(props);\n\n const data = getPieChartData({ data: results.data, dimension, measure, maxLegendItems }, theme);\n\n const options = mergician(\n getDefaultPieChartOptions(\n {\n measure,\n showTooltips,\n showLegend,\n showValueLabels,\n } as DefaultPieChartOptions,\n theme,\n ),\n theme.charts.pieChartPro?.options ?? {},\n );\n\n const handleSegmentClick = (index: number | undefined) => {\n onSegmentClick({\n dimensionValue: index === undefined ? undefined : results.data?.[index]?.[dimension.name],\n });\n };\n\n return (\n <ChartCard\n data={results}\n dimensionsAndMeasures={[dimension, measure]}\n errorMessage={results.error}\n subtitle={description}\n title={title}\n >\n <PieChart data={data} options={options} onSegmentClick={handleSegmentClick} />\n </ChartCard>\n );\n};\n\nexport default PieChartPro;\n"],"names":["PieChartPro","props","theme","useTheme","i18nSetup","description","dimension","maxLegendItems","measure","results","showLegend","showTooltips","showValueLabels","title","onSegmentClick","resolveI18nProps","data","getPieChartData","options","mergician","getDefaultPieChartOptions","_a","handleSegmentClick","index","_b","jsx","ChartCard","PieChart"],"mappings":";;;;;AAYA,MAAMA,IAAc,CAACC,MAA4B;;AAC/C,QAAMC,IAAQC,EAAA;AACd,EAAAC,EAAUF,CAAK;AAEf,QAAM;AAAA,IACJ,aAAAG;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,OAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,IACEC,EAAiBd,CAAK,GAEpBe,IAAOC,EAAgB,EAAE,MAAMR,EAAQ,MAAM,WAAAH,GAAW,SAAAE,GAAS,gBAAAD,EAAA,GAAkBL,CAAK,GAExFgB,IAAUC;AAAA,IACdC;AAAA,MACE;AAAA,QACE,SAAAZ;AAAA,QACA,cAAAG;AAAA,QACA,YAAAD;AAAA,QACA,iBAAAE;AAAA,MAAA;AAAA,MAEFV;AAAA,IAAA;AAAA,MAEFmB,IAAAnB,EAAM,OAAO,gBAAb,gBAAAmB,EAA0B,YAAW,CAAA;AAAA,EAAC,GAGlCC,IAAqB,CAACC,MAA8B;;AACxD,IAAAT,EAAe;AAAA,MACb,gBAAgBS,MAAU,WAAwBC,KAAAH,IAAAZ,EAAQ,SAAR,gBAAAY,EAAeE,OAAf,OAAZ,SAAYC,EAAwBlB,EAAU;AAAA,IAAI,CACzF;AAAA,EACH;AAEA,SACEmB,gBAAAA,EAAAA;AAAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAMjB;AAAA,MACN,uBAAuB,CAACH,GAAWE,CAAO;AAAA,MAC1C,cAAcC,EAAQ;AAAA,MACtB,UAAUJ;AAAA,MACV,OAAAQ;AAAA,MAEA,UAAAY,gBAAAA,EAAAA,IAACE,GAAA,EAAS,MAAAX,GAAY,SAAAE,GAAkB,gBAAgBI,EAAA,CAAoB;AAAA,IAAA;AAAA,EAAA;AAGlF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as M, r as _, m as k, j as c, ae as w } from "./component.constants-Bn9l4N1t.js";
|
|
2
2
|
import { useTheme as O } from "@embeddable.com/react";
|
|
3
|
-
import { g as y, a as F } from "./pies.utils-
|
|
3
|
+
import { g as y, a as F } from "./pies.utils-BecIV2nV.js";
|
|
4
4
|
import { g as V } from "./formatter.utils-Ba_5cIcm.js";
|
|
5
5
|
import { C as z } from "./ChartCard-Cb0QE9kP.js";
|
|
6
6
|
import "react";
|
|
@@ -70,4 +70,4 @@ export {
|
|
|
70
70
|
A as D,
|
|
71
71
|
H as i
|
|
72
72
|
};
|
|
73
|
-
//# sourceMappingURL=index-
|
|
73
|
+
//# sourceMappingURL=index-CjS39lkd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-CjS39lkd.js","sources":["../src/remarkable-pro/components/charts/pies/DonutLabelChartPro/index.tsx"],"sourcesContent":["import { useTheme } from '@embeddable.com/react';\nimport { Theme } from '../../../../theme/theme.types';\nimport { DefaultPieChartOptions, getDefaultPieChartOptions, getPieChartData } from '../pies.utils';\nimport { DefaultPieChartProps } from '../pies.types';\nimport { DataResponse, Measure } from '@embeddable.com/core';\nimport { getThemeFormatter } from '../../../../theme/formatter/formatter.utils';\nimport { i18nSetup } from '../../../../theme/i18n/i18n';\nimport { ChartCard } from '../../shared/ChartCard/ChartCard';\nimport { DonutChart } from '../../../../../remarkable-ui';\nimport { mergician } from 'mergician';\nimport { resolveI18nProps } from '../../../component.utils';\n\ntype DonutLabelChartProProps = DefaultPieChartProps & {\n innerLabelMeasure: Measure;\n innerLabelText: string;\n resultsInnerLabel: DataResponse;\n};\n\nconst DonutChartPro = (props: DonutLabelChartProProps) => {\n const theme = useTheme() as Theme;\n const themeFormatter = getThemeFormatter(theme);\n i18nSetup(theme);\n\n const {\n description,\n dimension,\n maxLegendItems,\n measure,\n results,\n showLegend,\n showTooltips,\n showValueLabels,\n title,\n innerLabelMeasure,\n resultsInnerLabel,\n innerLabelText,\n onSegmentClick,\n } = resolveI18nProps(props);\n\n const data = getPieChartData({ data: results.data, dimension, measure, maxLegendItems }, theme);\n\n const handleSegmentClick = (index: number | undefined) => {\n onSegmentClick({\n dimensionValue: index === undefined ? undefined : results.data?.[index]?.[dimension.name],\n });\n };\n\n const label = themeFormatter.data(\n innerLabelMeasure,\n resultsInnerLabel?.data?.[0]?.[innerLabelMeasure.name],\n );\n\n const options = mergician(\n getDefaultPieChartOptions(\n {\n measure,\n showTooltips,\n showLegend,\n showValueLabels,\n } as DefaultPieChartOptions,\n theme,\n ),\n theme.charts.donutLabelChartPro?.options ?? {},\n );\n\n return (\n <ChartCard\n data={results}\n dimensionsAndMeasures={[dimension, measure]}\n errorMessage={results.error}\n subtitle={description}\n title={title}\n >\n <DonutChart\n label={label}\n subLabel={innerLabelText}\n data={data}\n options={options}\n onSegmentClick={handleSegmentClick}\n />\n </ChartCard>\n );\n};\n\nexport default DonutChartPro;\n"],"names":["DonutChartPro","props","theme","useTheme","themeFormatter","getThemeFormatter","i18nSetup","description","dimension","maxLegendItems","measure","results","showLegend","showTooltips","showValueLabels","title","innerLabelMeasure","resultsInnerLabel","innerLabelText","onSegmentClick","resolveI18nProps","data","getPieChartData","handleSegmentClick","index","_b","_a","label","options","mergician","getDefaultPieChartOptions","_c","jsx","ChartCard","DonutChart"],"mappings":";;;;;;AAkBA,MAAMA,IAAgB,CAACC,MAAmC;;AACxD,QAAMC,IAAQC,EAAA,GACRC,IAAiBC,EAAkBH,CAAK;AAC9C,EAAAI,EAAUJ,CAAK;AAEf,QAAM;AAAA,IACJ,aAAAK;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;A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BL;AAAA,QAAA;AAAA,MAAA;AAAA,IAClB;AAAA,EAAA;AAGN;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -8,13 +8,13 @@ import { E as _a, S as Ca } from "./EditorCard-DWz8Bm-e.js";
|
|
|
8
8
|
import { B as _ } from "./index-DYBt2TuY.js";
|
|
9
9
|
import { b as ya, i as ja } from "./index-DYBt2TuY.js";
|
|
10
10
|
import { S as va } from "./SingleSelectField-BJnoOYrw.js";
|
|
11
|
-
import { K as Ia } from "./KpiChart-
|
|
12
|
-
import { g as $a, r as Ta, s as ka } from "./object.utils-
|
|
11
|
+
import { K as Ia } from "./KpiChart-B2OqbXRg.js";
|
|
12
|
+
import { g as $a, r as Ta, s as ka } from "./object.utils-9RGrU0vr.js";
|
|
13
13
|
import { g as La } from "./formatter.utils-Ba_5cIcm.js";
|
|
14
|
-
import { a as Ma, g as Ba } from "./pies.utils-
|
|
15
|
-
import { i as Ra } from "./index-
|
|
16
|
-
import { i as za } from "./index-
|
|
17
|
-
import { i as Wa } from "./index-
|
|
14
|
+
import { a as Ma, g as Ba } from "./pies.utils-BecIV2nV.js";
|
|
15
|
+
import { i as Ra } from "./index-Chlmh1dF.js";
|
|
16
|
+
import { i as za } from "./index-BOzeG3mG.js";
|
|
17
|
+
import { i as Wa } from "./index-CjS39lkd.js";
|
|
18
18
|
import { i as qa } from "./index-6ilf5W1J.js";
|
|
19
19
|
import { i as Xa } from "./index-CobXKlOi.js";
|
|
20
20
|
const L = "_container_436fl_1", A = "_column_436fl_10", M = "_box_436fl_20", B = "_short_436fl_26", D = "_tall_436fl_34", a = {
|
|
@@ -675,7 +675,7 @@ const xs = {
|
|
|
675
675
|
style: r ? "currency" : void 0,
|
|
676
676
|
currency: r || void 0,
|
|
677
677
|
notation: (i = t.inputs) != null && i.abbreviateLargeNumber ? "compact" : void 0,
|
|
678
|
-
maximumFractionDigits: ((s = t.inputs) == null ? void 0 : s.decimalPlaces) ?? 0
|
|
678
|
+
maximumFractionDigits: r ? ((s = t.inputs) == null ? void 0 : s.decimalPlaces) ?? 0 : void 0
|
|
679
679
|
};
|
|
680
680
|
return e.formatter.numberFormatter(e, n);
|
|
681
681
|
}, Ds = {
|
|
@@ -17381,4 +17381,4 @@ export {
|
|
|
17381
17381
|
nm as r,
|
|
17382
17382
|
Ts as s
|
|
17383
17383
|
};
|
|
17384
|
-
//# sourceMappingURL=object.utils-
|
|
17384
|
+
//# sourceMappingURL=object.utils-9RGrU0vr.js.map
|