@bino-bi/bn-template-engine 1.0.0-alpha.16 → 1.0.0-alpha.17
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/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-172499ac.entry.js +1 -0
- package/dist/bn-template-engine/p-19e65c04.entry.js +1 -0
- package/dist/bn-template-engine/{p-ff659485.entry.js → p-1a1fd8eb.entry.js} +1 -1
- package/dist/bn-template-engine/p-2849c367.entry.js +1 -0
- package/dist/bn-template-engine/p-44L8rZSd.js +1 -0
- package/dist/bn-template-engine/p-5dd11fcc.entry.js +1 -0
- package/dist/bn-template-engine/p-63f891d9.entry.js +1 -0
- package/dist/bn-template-engine/p-72f63181.entry.js +1 -0
- package/dist/bn-template-engine/p-836ad6f3.entry.js +1 -0
- package/dist/bn-template-engine/p-B2KOyHRY.js +1 -0
- package/dist/bn-template-engine/p-BA48JiHe.js +1 -0
- package/dist/bn-template-engine/p-BnOTt2YD.js +1 -0
- package/dist/bn-template-engine/p-CDPTCKVx.js +1 -0
- package/dist/bn-template-engine/p-CIXlJoMr.js +1 -0
- package/dist/bn-template-engine/{p-BPDZcex5.js → p-COXiPUfj.js} +1 -1
- package/dist/bn-template-engine/p-CPZIJpxn.js +1 -0
- package/dist/bn-template-engine/p-DHibUOw5.js +1 -0
- package/dist/bn-template-engine/p-a50da0f0.entry.js +1 -0
- package/dist/bn-template-engine/p-a9a34fb2.entry.js +1 -0
- package/dist/bn-template-engine/p-b0369558.entry.js +1 -0
- package/dist/bn-template-engine/p-d3fc17ee.entry.js +1 -0
- package/dist/bn-template-engine/p-f8c46905.entry.js +1 -0
- package/dist/bn-template-engine/p-lIy3SJs2.js +1 -0
- package/dist/cjs/AxisConfig-B_GMRfX_.js +233 -0
- package/dist/cjs/LabelCollisionManager-8HGn9W0V.js +8616 -0
- package/dist/cjs/VarianceMeasure-DEOzP-XZ.js +372 -0
- package/dist/cjs/XYChartDataRow-CDl1Ofnv.js +933 -0
- package/dist/cjs/bn-asset_21.cjs.entry.js +1586 -9600
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +761 -0
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +657 -0
- package/dist/cjs/bn-grid.cjs.entry.js +4 -3
- package/dist/cjs/bn-image.cjs.entry.js +4 -3
- package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
- package/dist/cjs/bn-ruleset.cjs.entry.js +41 -0
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +7 -79
- package/dist/cjs/bn-tree.cjs.entry.js +3 -2
- package/dist/cjs/{context-protocol-Cn5PL928.js → context-protocol-CIuyJKkK.js} +206 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +622 -0
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +665 -0
- package/dist/cjs/layoutObserver-CJWRV_y6.js +350 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sanitizeHtml-LuZr1IMd.js +85 -0
- package/dist/cjs/{scaling-DM2UILdF.js → scaling-B4UPXivZ.js} +1 -1
- package/dist/cjs/withScalingGroup-D832DQKp.js +73 -0
- package/dist/cjs/{withStyled-Dx3uRw9g.js → withStyled-COxuhL-N.js} +43 -301
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.css +10 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +1110 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.css +9 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +653 -0
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +472 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.css +10 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +965 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.css +9 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +580 -0
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +409 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +23 -2
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +29 -4
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +3 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +27 -4
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +29 -4
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +16 -4
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -3
- package/dist/collection/components/bn-component-style/bn-component-style.js +1 -1
- package/dist/collection/components/bn-context/bn-context.js +1 -1
- package/dist/collection/components/bn-dataset/bn-dataset.js +1 -1
- package/dist/collection/components/bn-datasource/bn-datasource.js +1 -1
- package/dist/collection/components/bn-footer/bn-footer.js +1 -1
- package/dist/collection/components/bn-grid/bn-grid.js +1 -1
- package/dist/collection/components/bn-image/bn-image.js +1 -1
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +1 -1
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +26 -3
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +33 -4
- package/dist/collection/components/bn-message/bn-message.css +6 -2
- package/dist/collection/components/bn-message/bn-message.js +3 -2
- package/dist/collection/components/bn-page/bn-page.js +1 -1
- package/dist/collection/components/bn-ruleset/bn-ruleset.css +3 -0
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +68 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +1 -1
- package/dist/collection/components/bn-table/bn-table.js +146 -14
- package/dist/collection/components/bn-table/ibcs-table.css +8 -0
- package/dist/collection/components/bn-table/ibcs-table.js +64 -8
- package/dist/collection/components/bn-table/utils/Table.js +43 -5
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +13 -8
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -2
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +47 -0
- package/dist/collection/components/bn-table/utils/elements/index.js +1 -0
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +87 -15
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +284 -3
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +140 -0
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +166 -0
- package/dist/collection/components/bn-table/utils/helper/index.js +2 -0
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +10 -0
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +2 -75
- package/dist/collection/components/bn-title/bn-title.js +27 -3
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.css +4 -0
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +29 -3
- package/dist/collection/components/bn-title/ibcs-title/utils/Title.js +3 -0
- package/dist/collection/components/editor-companion/editor-companion.js +1 -1
- package/dist/collection/stores/componentStyles.js +29 -0
- package/dist/collection/stores/createScopedStores.js +6 -1
- package/dist/collection/stores/internationalization.js +40 -0
- package/dist/collection/stores/ruleSets.js +46 -0
- package/dist/collection/utils/constants.js +5 -0
- package/dist/collection/utils/ibcsRuleSet.js +14 -26
- package/dist/collection/utils/sanitizeHtml.js +81 -0
- package/dist/collection/utils/validate.js +24 -0
- package/dist/collection/utils/withComponentStyle.js +3 -5
- package/dist/collection/utils/withInheritedProps.js +1 -1
- package/dist/collection/utils/withRuleSet.js +105 -0
- package/dist/collection/utils/withScalingGroup.js +3 -0
- package/dist/collection/utils/xy/FacetGrid.js +36 -0
- package/dist/collection/utils/xy/IsoCurves.js +156 -0
- package/dist/collection/utils/xy/NumericScale.js +103 -0
- package/dist/collection/utils/xy/PointLabeler.js +96 -0
- package/dist/collection/utils/xy/RadiusScale.js +42 -0
- package/dist/collection/utils/xy/SeriesPalette.js +80 -0
- package/dist/collection/utils/xy/VarianceMeasure.js +76 -0
- package/dist/collection/utils/xy/XYFrame.js +120 -0
- package/dist/collection/utils/xy/XYLegend.js +107 -0
- package/dist/collection/utils/xy/model/AxisConfig.js +221 -0
- package/dist/collection/utils/xy/model/ScaleFactorsXYChart.js +69 -0
- package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
- package/dist/collection/utils/xy/model/XYChartStyle.js +52 -0
- package/dist/components/AxisConfig.js +1 -0
- package/dist/components/CompareUtil.js +1 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/LabelCollisionManager.js +1 -0
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.js +1 -1
- package/dist/components/SiPrefix.js +1 -0
- package/dist/components/StringAdapter.js +1 -0
- package/dist/components/VarianceMeasure.js +1 -0
- package/dist/components/XYChartDataRow.js +1 -0
- package/dist/components/bn-chart-bubble.d.ts +11 -0
- package/dist/components/bn-chart-bubble.js +1 -0
- package/dist/components/bn-chart-scatter.d.ts +11 -0
- package/dist/components/bn-chart-scatter.js +1 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer2.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message2.js +1 -1
- package/dist/components/bn-page2.js +1 -1
- package/dist/components/bn-ruleset.d.ts +11 -0
- package/dist/components/bn-ruleset.js +1 -0
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-template.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- package/dist/components/formatter.js +1 -0
- package/dist/components/ibcs-chart-bubble.d.ts +11 -0
- package/dist/components/ibcs-chart-bubble.js +1 -0
- package/dist/components/ibcs-chart-bubble2.js +1 -0
- package/dist/components/ibcs-chart-scatter.d.ts +11 -0
- package/dist/components/ibcs-chart-scatter.js +1 -0
- package/dist/components/ibcs-chart-scatter2.js +1 -0
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/layoutObserver.js +1 -1
- package/dist/components/luxon.js +1 -1
- package/dist/components/merge.js +1 -0
- package/dist/components/sanitizeHtml.js +1 -0
- package/dist/components/stackColors.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withComponentStyle.js +1 -1
- package/dist/components/withDataset.js +1 -0
- package/dist/components/withRuleSet.js +1 -0
- package/dist/components/withScalingGroup.js +1 -0
- package/dist/components/withStyled.js +1 -1
- package/dist/esm/AxisConfig-BwUQrme0.js +224 -0
- package/dist/esm/LabelCollisionManager-DZP5Vl8T.js +8599 -0
- package/dist/esm/VarianceMeasure-Cxshx01h.js +364 -0
- package/dist/esm/XYChartDataRow-FF_VxRnF.js +923 -0
- package/dist/esm/bn-asset_21.entry.js +1124 -9138
- package/dist/esm/bn-chart-bubble.entry.js +759 -0
- package/dist/esm/bn-chart-scatter.entry.js +655 -0
- package/dist/esm/bn-grid.entry.js +4 -3
- package/dist/esm/bn-image.entry.js +4 -3
- package/dist/esm/bn-internationalization.entry.js +2 -2
- package/dist/esm/bn-ruleset.entry.js +39 -0
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +1 -1
- package/dist/esm/bn-text.entry.js +6 -78
- package/dist/esm/bn-tree.entry.js +3 -2
- package/dist/esm/{context-protocol-BB-4Onmw.js → context-protocol-BNHTlllP.js} +202 -2
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/ibcs-chart-bubble.entry.js +620 -0
- package/dist/esm/ibcs-chart-scatter.entry.js +663 -0
- package/dist/esm/layoutObserver-D5FY_lQa.js +345 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sanitizeHtml-BA48JiHe.js +83 -0
- package/dist/esm/{scaling-h4KcBet3.js → scaling-B7Pa0d_s.js} +2 -2
- package/dist/esm/withScalingGroup-DBheBsP4.js +71 -0
- package/dist/esm/{withStyled-BBvU2f-A.js → withStyled-DTvj2nar.js} +29 -287
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +193 -0
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +58 -0
- package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +91 -0
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +172 -0
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +53 -0
- package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +66 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +7 -0
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +2 -0
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +1 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +10 -1
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +2 -0
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +1 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +10 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +14 -0
- package/dist/types/components/bn-message/bn-message.d.ts +5 -2
- package/dist/types/components/bn-ruleset/bn-ruleset.d.ts +8 -0
- package/dist/types/components/bn-table/bn-table.d.ts +38 -5
- package/dist/types/components/bn-table/ibcs-table.d.ts +8 -1
- package/dist/types/components/bn-table/utils/Table.d.ts +8 -0
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +33 -0
- package/dist/types/components/bn-table/utils/elements/TableRow.d.ts +2 -1
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +21 -0
- package/dist/types/components/bn-table/utils/elements/index.d.ts +1 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +13 -7
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +17 -0
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +37 -0
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +55 -0
- package/dist/types/components/bn-table/utils/helper/index.d.ts +2 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +4 -0
- package/dist/types/components/bn-table/utils/model/index.d.ts +21 -0
- package/dist/types/components/bn-title/bn-title.d.ts +11 -1
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +2 -0
- package/dist/types/components/bn-title/ibcs-title/utils/Title.d.ts +1 -0
- package/dist/types/components.d.ts +943 -37
- package/dist/types/context/context-protocol.d.ts +2 -0
- package/dist/types/stores/componentStyles.d.ts +21 -0
- package/dist/types/stores/createScopedStores.d.ts +2 -0
- package/dist/types/stores/ruleSets.d.ts +40 -0
- package/dist/types/utils/constants.d.ts +5 -0
- package/dist/types/utils/ibcsRuleSet.d.ts +6 -1
- package/dist/types/utils/model/ChartStyles.d.ts +2 -1
- package/dist/types/utils/sanitizeHtml.d.ts +6 -0
- package/dist/types/utils/validate.d.ts +12 -0
- package/dist/types/utils/withInheritedProps.d.ts +11 -0
- package/dist/types/utils/withRuleSet.d.ts +24 -0
- package/dist/types/utils/xy/FacetGrid.d.ts +27 -0
- package/dist/types/utils/xy/IsoCurves.d.ts +46 -0
- package/dist/types/utils/xy/NumericScale.d.ts +41 -0
- package/dist/types/utils/xy/PointLabeler.d.ts +58 -0
- package/dist/types/utils/xy/RadiusScale.d.ts +26 -0
- package/dist/types/utils/xy/SeriesPalette.d.ts +59 -0
- package/dist/types/utils/xy/VarianceMeasure.d.ts +37 -0
- package/dist/types/utils/xy/XYFrame.d.ts +44 -0
- package/dist/types/utils/xy/XYLegend.d.ts +43 -0
- package/dist/types/utils/xy/model/AxisConfig.d.ts +96 -0
- package/dist/types/utils/xy/model/ScaleFactorsXYChart.d.ts +36 -0
- package/dist/types/utils/xy/model/XYChartDataRow.d.ts +157 -0
- package/dist/types/utils/xy/model/XYChartStyle.d.ts +31 -0
- package/package.json +1 -1
- package/readme.md +7 -3
- package/dist/bn-template-engine/p-19f49fbc.entry.js +0 -1
- package/dist/bn-template-engine/p-3465fcdc.entry.js +0 -1
- package/dist/bn-template-engine/p-67746414.entry.js +0 -1
- package/dist/bn-template-engine/p-6b469808.entry.js +0 -1
- package/dist/bn-template-engine/p-86ca2d5e.entry.js +0 -1
- package/dist/bn-template-engine/p-Tx6omDWp.js +0 -1
- package/dist/bn-template-engine/p-d724ab88.entry.js +0 -1
- package/dist/bn-template-engine/p-efd3b67a.entry.js +0 -1
- package/dist/bn-template-engine/p-z9bPNFYF.js +0 -1
- package/dist/components/ibcsRuleSet.js +0 -1
- package/dist/components/scaling.js +0 -1
- package/dist/components/withInheritedProps.js +0 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var VarianceMeasure = require('./VarianceMeasure-DEOzP-XZ.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parses a raw object-prop attribute value. A blank value yields `data: null`
|
|
7
|
+
* without error. A value starting with `{` must be valid JSON describing an
|
|
8
|
+
* object. Any other bare string is treated as shorthand for
|
|
9
|
+
* `{ [shorthandKey]: value }` when a shorthand key is allowed, otherwise it
|
|
10
|
+
* is a parse error.
|
|
11
|
+
*/
|
|
12
|
+
function parseSpec(raw, shorthandKey) {
|
|
13
|
+
var _a;
|
|
14
|
+
const trimmed = (_a = raw === null || raw === void 0 ? void 0 : raw.trim()) !== null && _a !== void 0 ? _a : "";
|
|
15
|
+
if (trimmed === "" || trimmed === "null") {
|
|
16
|
+
return { data: null, parseError: false };
|
|
17
|
+
}
|
|
18
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
19
|
+
try {
|
|
20
|
+
const parsed = JSON.parse(trimmed);
|
|
21
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
22
|
+
return { data: null, parseError: true };
|
|
23
|
+
}
|
|
24
|
+
return { data: parsed, parseError: false };
|
|
25
|
+
}
|
|
26
|
+
catch (_b) {
|
|
27
|
+
return { data: null, parseError: true };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (shorthandKey !== null) {
|
|
31
|
+
return { data: { [shorthandKey]: trimmed }, parseError: false };
|
|
32
|
+
}
|
|
33
|
+
return { data: null, parseError: true };
|
|
34
|
+
}
|
|
35
|
+
function collectUnknownKeys(data, knownKeys) {
|
|
36
|
+
return Object.keys(data).filter((key) => !knownKeys.includes(key));
|
|
37
|
+
}
|
|
38
|
+
function readString(data, key, invalid) {
|
|
39
|
+
if (!VarianceMeasure.CompareUtil.isExisting(data[key])) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
if (VarianceMeasure.CompareUtil.isString(data[key])) {
|
|
43
|
+
return data[key];
|
|
44
|
+
}
|
|
45
|
+
invalid.push(key);
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
function readNumber(data, key, invalid) {
|
|
49
|
+
if (!VarianceMeasure.CompareUtil.isExisting(data[key])) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
if (VarianceMeasure.CompareUtil.isNumber(data[key])) {
|
|
53
|
+
return data[key];
|
|
54
|
+
}
|
|
55
|
+
invalid.push(key);
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
function readHighlight(data, invalid) {
|
|
59
|
+
if (!VarianceMeasure.CompareUtil.isExisting(data.highlight)) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
if (!VarianceMeasure.CompareUtil.isObject(data.highlight) || Array.isArray(data.highlight)) {
|
|
63
|
+
invalid.push("highlight");
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const range = data.highlight;
|
|
67
|
+
const result = {};
|
|
68
|
+
const from = readNumber(range, "from", invalid);
|
|
69
|
+
const to = readNumber(range, "to", invalid);
|
|
70
|
+
if (from !== undefined) {
|
|
71
|
+
result.from = from;
|
|
72
|
+
}
|
|
73
|
+
if (to !== undefined) {
|
|
74
|
+
result.to = to;
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
const AXIS_KEYS = ["measure", "label", "unit", "min", "max", "refLine", "highlight"];
|
|
79
|
+
function toAxisConfig(data) {
|
|
80
|
+
const invalidFields = [];
|
|
81
|
+
const measure = readString(data, "measure", invalidFields);
|
|
82
|
+
if (measure === undefined || measure.trim() === "") {
|
|
83
|
+
invalidFields.push("measure");
|
|
84
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, AXIS_KEYS), invalidFields };
|
|
85
|
+
}
|
|
86
|
+
const config = { measure: measure.trim() };
|
|
87
|
+
config.label = readString(data, "label", invalidFields);
|
|
88
|
+
config.unit = readString(data, "unit", invalidFields);
|
|
89
|
+
config.min = readNumber(data, "min", invalidFields);
|
|
90
|
+
config.max = readNumber(data, "max", invalidFields);
|
|
91
|
+
config.refLine = readNumber(data, "refLine", invalidFields);
|
|
92
|
+
config.highlight = readHighlight(data, invalidFields);
|
|
93
|
+
return { config, unknownKeys: collectUnknownKeys(data, AXIS_KEYS), invalidFields };
|
|
94
|
+
}
|
|
95
|
+
const SIZE_KEYS = ["measure", "label", "unit", "group"];
|
|
96
|
+
function toSizeConfig(data) {
|
|
97
|
+
const invalidFields = [];
|
|
98
|
+
const measure = readString(data, "measure", invalidFields);
|
|
99
|
+
if (measure === undefined || measure.trim() === "") {
|
|
100
|
+
invalidFields.push("measure");
|
|
101
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, SIZE_KEYS), invalidFields };
|
|
102
|
+
}
|
|
103
|
+
const config = { measure: measure.trim() };
|
|
104
|
+
config.label = readString(data, "label", invalidFields);
|
|
105
|
+
config.unit = readString(data, "unit", invalidFields);
|
|
106
|
+
config.group = readString(data, "group", invalidFields);
|
|
107
|
+
return { config, unknownKeys: collectUnknownKeys(data, SIZE_KEYS), invalidFields };
|
|
108
|
+
}
|
|
109
|
+
const SHARE_KEYS = ["measure"];
|
|
110
|
+
function toShareConfig(data) {
|
|
111
|
+
const invalidFields = [];
|
|
112
|
+
const measure = readString(data, "measure", invalidFields);
|
|
113
|
+
if (measure === undefined || measure.trim() === "") {
|
|
114
|
+
invalidFields.push("measure");
|
|
115
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, SHARE_KEYS), invalidFields };
|
|
116
|
+
}
|
|
117
|
+
return { config: { measure: measure.trim() }, unknownKeys: collectUnknownKeys(data, SHARE_KEYS), invalidFields };
|
|
118
|
+
}
|
|
119
|
+
const ISO_KEYS = ["values", "label", "unit", "highlight"];
|
|
120
|
+
function toIsoConfig(data) {
|
|
121
|
+
const invalidFields = [];
|
|
122
|
+
let values = null;
|
|
123
|
+
if (data.values === "auto") {
|
|
124
|
+
values = "auto";
|
|
125
|
+
}
|
|
126
|
+
else if (VarianceMeasure.CompareUtil.isArray(data.values) && data.values.every((v) => VarianceMeasure.CompareUtil.isNumber(v))) {
|
|
127
|
+
values = data.values;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
invalidFields.push("values");
|
|
131
|
+
}
|
|
132
|
+
if (values === null) {
|
|
133
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, ISO_KEYS), invalidFields };
|
|
134
|
+
}
|
|
135
|
+
const config = { values };
|
|
136
|
+
config.label = readString(data, "label", invalidFields);
|
|
137
|
+
config.unit = readString(data, "unit", invalidFields);
|
|
138
|
+
if (VarianceMeasure.CompareUtil.isExisting(data.highlight)) {
|
|
139
|
+
if (VarianceMeasure.CompareUtil.isObject(data.highlight) && !Array.isArray(data.highlight)) {
|
|
140
|
+
const from = readNumber(data.highlight, "from", invalidFields);
|
|
141
|
+
if (from !== undefined) {
|
|
142
|
+
config.highlight = { from };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
invalidFields.push("highlight");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return { config, unknownKeys: collectUnknownKeys(data, ISO_KEYS), invalidFields };
|
|
150
|
+
}
|
|
151
|
+
const LABEL_KEYS = ["points", "values", "max"];
|
|
152
|
+
function toLabelConfig(data, defaults) {
|
|
153
|
+
const invalidFields = [];
|
|
154
|
+
const config = { points: defaults.points, values: defaults.values, max: defaults.max };
|
|
155
|
+
if (VarianceMeasure.CompareUtil.isExisting(data.points)) {
|
|
156
|
+
if (data.points === "auto" || data.points === "none" || data.points === "all") {
|
|
157
|
+
config.points = data.points;
|
|
158
|
+
}
|
|
159
|
+
else if (VarianceMeasure.CompareUtil.isArray(data.points) && data.points.every((p) => VarianceMeasure.CompareUtil.isString(p))) {
|
|
160
|
+
config.points = data.points;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
invalidFields.push("points");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (VarianceMeasure.CompareUtil.isExisting(data.values)) {
|
|
167
|
+
if (VarianceMeasure.CompareUtil.isBoolean(data.values)) {
|
|
168
|
+
config.values = data.values;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
invalidFields.push("values");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (VarianceMeasure.CompareUtil.isExisting(data.max)) {
|
|
175
|
+
if (VarianceMeasure.CompareUtil.isNumber(data.max) && data.max > 0) {
|
|
176
|
+
config.max = Math.floor(data.max);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
invalidFields.push("max");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return { config, unknownKeys: collectUnknownKeys(data, LABEL_KEYS), invalidFields };
|
|
183
|
+
}
|
|
184
|
+
const FACET_KEYS = ["level", "columns"];
|
|
185
|
+
function toFacetConfig(data) {
|
|
186
|
+
const invalidFields = [];
|
|
187
|
+
const level = VarianceMeasure.CompareUtil.isString(data.level) ? data.level.toLowerCase() : null;
|
|
188
|
+
if (level !== "rowgroup" && level !== "category") {
|
|
189
|
+
invalidFields.push("level");
|
|
190
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, FACET_KEYS), invalidFields };
|
|
191
|
+
}
|
|
192
|
+
const config = { level };
|
|
193
|
+
if (VarianceMeasure.CompareUtil.isExisting(data.columns)) {
|
|
194
|
+
if (VarianceMeasure.CompareUtil.isNumber(data.columns) && data.columns >= 1) {
|
|
195
|
+
config.columns = Math.floor(data.columns);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
invalidFields.push("columns");
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return { config, unknownKeys: collectUnknownKeys(data, FACET_KEYS), invalidFields };
|
|
202
|
+
}
|
|
203
|
+
const LEGEND_KEYS = ["show", "position"];
|
|
204
|
+
function toLegendConfig(data) {
|
|
205
|
+
const invalidFields = [];
|
|
206
|
+
const config = { show: true, position: "right" };
|
|
207
|
+
if (VarianceMeasure.CompareUtil.isExisting(data.show)) {
|
|
208
|
+
if (VarianceMeasure.CompareUtil.isBoolean(data.show)) {
|
|
209
|
+
config.show = data.show;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
invalidFields.push("show");
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (VarianceMeasure.CompareUtil.isExisting(data.position)) {
|
|
216
|
+
if (data.position === "right" || data.position === "bottom") {
|
|
217
|
+
config.position = data.position;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
invalidFields.push("position");
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return { config, unknownKeys: collectUnknownKeys(data, LEGEND_KEYS), invalidFields };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
exports.parseSpec = parseSpec;
|
|
227
|
+
exports.toAxisConfig = toAxisConfig;
|
|
228
|
+
exports.toFacetConfig = toFacetConfig;
|
|
229
|
+
exports.toIsoConfig = toIsoConfig;
|
|
230
|
+
exports.toLabelConfig = toLabelConfig;
|
|
231
|
+
exports.toLegendConfig = toLegendConfig;
|
|
232
|
+
exports.toShareConfig = toShareConfig;
|
|
233
|
+
exports.toSizeConfig = toSizeConfig;
|