@bino-bi/bn-template-engine 1.0.0-alpha.11 → 1.0.0-alpha.13
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-3c827826.entry.js +1 -0
- package/dist/bn-template-engine/p-46699464.entry.js +1 -0
- package/dist/bn-template-engine/{p-e783733e.entry.js → p-52097456.entry.js} +1 -1
- package/dist/bn-template-engine/p-637e3b8f.entry.js +1 -0
- package/dist/bn-template-engine/{p-c2cbb8ea.entry.js → p-67eae33e.entry.js} +1 -1
- package/dist/bn-template-engine/{p-fdb3e99a.entry.js → p-82023539.entry.js} +1 -1
- package/dist/bn-template-engine/p-BVFHvEXF.js +1 -0
- package/dist/bn-template-engine/p-BjBz5cSL.js +1 -0
- package/dist/bn-template-engine/p-CQnZV3JG.js +1 -0
- package/dist/bn-template-engine/p-DHheVOfP.js +1 -0
- package/dist/bn-template-engine/{p-e94b4e31.entry.js → p-ab3ea8cf.entry.js} +1 -1
- package/dist/cjs/bn-asset_21.cjs.entry.js +576 -730
- package/dist/cjs/bn-grid.cjs.entry.js +2 -2
- package/dist/cjs/bn-image.cjs.entry.js +2 -2
- package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +3 -3
- package/dist/cjs/bn-tree.cjs.entry.js +2 -2
- package/dist/cjs/context-protocol-Op7uUwN3.js +9214 -0
- package/dist/cjs/editor-companion.cjs.entry.js +13 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-eyzCrFB8.js → scaling-57N4Cxb_.js} +44 -40
- package/dist/cjs/{withBodyObserver-D7BKWN2N.js → withBodyObserver-BKUE_ypL.js} +12 -7
- package/dist/cjs/withStyled-C2kmGAK3.js +1405 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +11 -6
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +50 -22
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +51 -48
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +5 -4
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +11 -6
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +47 -22
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +76 -60
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +5 -4
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -0
- package/dist/collection/components/bn-dataset/bn-dataset.js +214 -23
- package/dist/collection/components/bn-datasource/bn-datasource.js +27 -9
- package/dist/collection/components/bn-table/bn-table.js +13 -5
- package/dist/collection/components/bn-table/ibcs-table.js +52 -25
- package/dist/collection/components/bn-table/utils/Table.js +27 -21
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +2 -2
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +52 -43
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +4 -9
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +5 -4
- package/dist/collection/components/editor-companion/editor-companion.js +12 -5
- package/dist/collection/context/scopedDb.js +113 -0
- package/dist/collection/stores/createScopedStores.js +3 -4
- package/dist/collection/utils/dataAnalyzer.js +14 -8
- package/dist/collection/utils/withBodyObserver.js +12 -7
- package/dist/collection/utils/withDataset.js +43 -39
- package/dist/collection/utils/withDatasource.js +28 -18
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- 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/ibcsRuleSet.js +1 -1
- package/dist/components/luxon.js +1 -0
- package/dist/components/scaling.js +1 -1
- package/dist/components/withBodyObserver.js +1 -1
- package/dist/esm/bn-asset_21.entry.js +571 -725
- package/dist/esm/bn-grid.entry.js +2 -2
- package/dist/esm/bn-image.entry.js +2 -2
- package/dist/esm/bn-internationalization.entry.js +2 -2
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +3 -3
- package/dist/esm/bn-tree.entry.js +2 -2
- package/dist/esm/context-protocol-BDhzNbeD.js +9204 -0
- package/dist/esm/editor-companion.entry.js +13 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-BzbiBnuN.js → scaling-La1Ow72h.js} +44 -40
- package/dist/esm/{withBodyObserver-AFk2wwHT.js → withBodyObserver-IokS6fHD.js} +12 -7
- package/dist/esm/withStyled-Bl9cSoRW.js +1372 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +4 -2
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +7 -3
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +11 -12
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +5 -3
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +4 -2
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +7 -3
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +11 -12
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +5 -3
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +39 -5
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +5 -0
- package/dist/types/components/bn-table/bn-table.d.ts +4 -2
- package/dist/types/components/bn-table/ibcs-table.d.ts +11 -3
- package/dist/types/components/bn-table/utils/Table.d.ts +8 -6
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +2 -2
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +7 -3
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +4 -5
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +5 -3
- package/dist/types/components/editor-companion/editor-companion.d.ts +2 -0
- package/dist/types/components.d.ts +105 -46
- package/dist/types/context/context-protocol.d.ts +4 -3
- package/dist/types/context/scopedDb.d.ts +37 -0
- package/dist/types/stores/createScopedStores.d.ts +1 -2
- package/dist/types/utils/DateStringFactory.d.ts +1 -1
- package/dist/types/utils/dataAnalyzer.d.ts +2 -1
- package/dist/types/utils/withDataset.d.ts +6 -2
- package/dist/types/utils/withDatasource.d.ts +3 -3
- package/package.json +2 -1
- package/dist/bn-template-engine/p-095f74d7.entry.js +0 -1
- package/dist/bn-template-engine/p-14318b0d.entry.js +0 -1
- package/dist/bn-template-engine/p-2133e02b.entry.js +0 -1
- package/dist/bn-template-engine/p-7HSTE79g.js +0 -1
- package/dist/bn-template-engine/p-Bi2wx-el.js +0 -1
- package/dist/bn-template-engine/p-CWiZks2h.js +0 -1
- package/dist/bn-template-engine/p-DSXNgKLa.js +0 -1
- package/dist/cjs/context-protocol-B_jipZpJ.js +0 -665
- package/dist/cjs/withStyled-V7xz_x1c.js +0 -9535
- package/dist/collection/stores/datasets.js +0 -14
- package/dist/collection/stores/datasources.js +0 -14
- package/dist/components/_commonjsHelpers.js +0 -1
- package/dist/components/alasql.min.js +0 -1
- package/dist/esm/context-protocol-D-o_UZ33.js +0 -658
- package/dist/esm/withStyled-5RqF8WBL.js +0 -9501
- package/dist/types/stores/datasets.d.ts +0 -14
- package/dist/types/stores/datasources.d.ts +0 -14
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ParentDimensions } from "../../utils/parentDimensions";
|
|
2
|
-
import { StructureChartDataRow } from "./utils/model";
|
|
3
2
|
/**
|
|
4
3
|
* SVG structure (categorical) bar chart following IBCS standards.
|
|
5
4
|
*
|
|
@@ -12,7 +11,10 @@ import { StructureChartDataRow } from "./utils/model";
|
|
|
12
11
|
*/
|
|
13
12
|
export declare class Chart {
|
|
14
13
|
private element;
|
|
15
|
-
|
|
14
|
+
/** Active dataset name (the last subscribed dataset to fire `onUpdate`). */
|
|
15
|
+
private datasetName;
|
|
16
|
+
/** Bumped on every data update so Stencil re-renders even when the name is unchanged. */
|
|
17
|
+
private dataVersion;
|
|
16
18
|
private datasetMeta;
|
|
17
19
|
private appliedScaleFactor;
|
|
18
20
|
private readonly t;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StructureChartDataRow } from "./utils/model";
|
|
2
1
|
import { StackConfigParsed } from "./utils/model/StructureChartComponentConfig";
|
|
3
2
|
import { StructureChartStyle } from "./utils/model/styles/StructureChartStyle";
|
|
4
3
|
import { Order } from "../../utils/model/Order";
|
|
@@ -6,8 +5,11 @@ import { AggregationLevel } from "../../utils/constants";
|
|
|
6
5
|
import { ParentDimensions } from "../../utils/parentDimensions";
|
|
7
6
|
import { DataFormatDigits } from "../../utils/model/DataFormatDigits";
|
|
8
7
|
export declare class IbcsChartStructure {
|
|
9
|
-
element: HTMLElement
|
|
10
|
-
|
|
8
|
+
element: HTMLElement;
|
|
9
|
+
/** Name of the dataset (table or view in the shared alasql database). */
|
|
10
|
+
tableName: string;
|
|
11
|
+
/** Bumped by `bn-chart-structure` when the dataset changes; triggers re-render. */
|
|
12
|
+
dataVersion: number;
|
|
11
13
|
chartTitle: string;
|
|
12
14
|
scenarios: string[];
|
|
13
15
|
variances: string[];
|
|
@@ -28,7 +30,9 @@ export declare class IbcsChartStructure {
|
|
|
28
30
|
parentDimensions: ParentDimensions;
|
|
29
31
|
private chart;
|
|
30
32
|
private pattern;
|
|
33
|
+
private stores;
|
|
31
34
|
constructor();
|
|
35
|
+
private getDb;
|
|
32
36
|
render(): any;
|
|
33
37
|
componentWillLoad(): Promise<void>;
|
|
34
38
|
componentWillUpdate(): Promise<void>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Svg } from "@svgdotjs/svg.js";
|
|
2
|
-
import { StructureChartComponentConfig,
|
|
2
|
+
import { StructureChartComponentConfig, StructureChartStyle } from "./model";
|
|
3
3
|
import { SVGPolgonPattern } from "../../../utils/model";
|
|
4
4
|
import { VisualisationRuleSet } from "../../bn-table/utils/model";
|
|
5
|
+
import { AlaSQLDatabase } from "../../../context/scopedDb";
|
|
5
6
|
/**
|
|
6
7
|
* Orchestrates the full rendering pipeline for an IBCS structure (categorical) chart.
|
|
7
8
|
*
|
|
@@ -38,7 +39,6 @@ export declare class StructureChart {
|
|
|
38
39
|
private hideCategories;
|
|
39
40
|
private axisScenario;
|
|
40
41
|
readonly CSS_CATEGORIES: string;
|
|
41
|
-
private preparedDataSet;
|
|
42
42
|
private state;
|
|
43
43
|
private i18n;
|
|
44
44
|
private titleLength;
|
|
@@ -51,10 +51,13 @@ export declare class StructureChart {
|
|
|
51
51
|
private stackConfig;
|
|
52
52
|
private overflowConfig;
|
|
53
53
|
private highestStackedTotal;
|
|
54
|
-
|
|
54
|
+
private db;
|
|
55
|
+
private tableName;
|
|
56
|
+
private fromExpr;
|
|
57
|
+
private rowCount;
|
|
58
|
+
constructor(ruleSet: VisualisationRuleSet, db: AlaSQLDatabase, tableName: string, config: StructureChartComponentConfig, styles: StructureChartStyle);
|
|
55
59
|
private updatePosition;
|
|
56
60
|
private createElementPosition;
|
|
57
|
-
initSQLFunctions(): void;
|
|
58
61
|
setStyles(newStyle: StructureChartStyle): void;
|
|
59
62
|
setConfig(config: StructureChartComponentConfig): void;
|
|
60
63
|
private sortScenariosbyVisualisationRules;
|
|
@@ -74,15 +77,11 @@ export declare class StructureChart {
|
|
|
74
77
|
setI18n(i18n: Map<string, string>): void;
|
|
75
78
|
private createI18n;
|
|
76
79
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @param data
|
|
82
|
-
* @param filter - data filter
|
|
83
|
-
* @param customColumnNameMap Custon ColumnNameMap can be used if data uses non standard columnames
|
|
80
|
+
* Resolves the dataset (a table or view in the shared alasql database) and
|
|
81
|
+
* caches its row count. All subsequent queries reference the source by name,
|
|
82
|
+
* so alasql doesn't have to ingest a fresh array per call.
|
|
84
83
|
*/
|
|
85
|
-
|
|
84
|
+
setSource(filter: string): void;
|
|
86
85
|
/**
|
|
87
86
|
* Returns the data value whose bar extent is proportional to pixelPerUnit.
|
|
88
87
|
* Used by autoFitScaling to separate fixed vs variable width components.
|
package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { DataFormatDigits, DataFormatDigitsAdapter } from "../../../../utils/mod
|
|
|
5
5
|
import { Order, OrderAdapter } from "../../../../utils/model/Order";
|
|
6
6
|
import { SiPrefix } from "../../../../utils/model/SiPrefix";
|
|
7
7
|
import { StructureChartDataRow, StructureChartDataRowAdapter } from "./StructureChartDataRow";
|
|
8
|
+
import { AlaSQLDatabase } from "../../../../context/scopedDb";
|
|
8
9
|
/** Parsed stacking configuration for multi-scenario bar charts. */
|
|
9
10
|
export interface StackConfigParsed {
|
|
10
11
|
by: StackBy;
|
|
@@ -46,15 +47,16 @@ export declare class StructureChartComponentConfig {
|
|
|
46
47
|
/**
|
|
47
48
|
* Converts untyped JSON into a validated {@link StructureChartComponentConfig}.
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
+
* Reads from the shared alasql database for measure-scale auto-calculation.
|
|
50
51
|
*/
|
|
51
52
|
export declare class StructureChartComponentConfigAdapter implements IAdapter<StructureChartComponentConfig> {
|
|
52
53
|
private dataRowAdapter;
|
|
53
54
|
private orderAdapter;
|
|
54
55
|
private stringAdapter;
|
|
55
56
|
private dataFormatDigitsAdapter;
|
|
56
|
-
private
|
|
57
|
-
|
|
57
|
+
private db;
|
|
58
|
+
private fromExpr;
|
|
59
|
+
constructor(dataRowAdapter: StructureChartDataRowAdapter, orderAdapter: OrderAdapter, stringAdapter: StringAdapter, dataFormatDigitsAdapter: DataFormatDigitsAdapter, db: AlaSQLDatabase, fromExpr: string);
|
|
58
60
|
adapt(data: Record<string, unknown>): StructureChartComponentConfig;
|
|
59
61
|
default(): StructureChartComponentConfig;
|
|
60
62
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ParentDimensions } from "../../utils/parentDimensions";
|
|
2
|
-
import { TimeChartDataRow } from "./utils/model";
|
|
3
2
|
/**
|
|
4
3
|
* SVG time-series chart following IBCS standards.
|
|
5
4
|
*
|
|
@@ -12,7 +11,10 @@ import { TimeChartDataRow } from "./utils/model";
|
|
|
12
11
|
*/
|
|
13
12
|
export declare class Chart {
|
|
14
13
|
private element;
|
|
15
|
-
|
|
14
|
+
/** Active dataset name (the last subscribed dataset to fire `onUpdate`). */
|
|
15
|
+
private datasetName;
|
|
16
|
+
/** Bumped on every data update so Stencil re-renders even when the name is unchanged. */
|
|
17
|
+
private dataVersion;
|
|
16
18
|
private datasetMeta;
|
|
17
19
|
private appliedScaleFactor;
|
|
18
20
|
private readonly t;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { StackConfigParsed } from "./utils/model/TimeChartComponentConfig";
|
|
2
|
-
import { TimeChartDataRow } from "./utils/model/TimeChartDataRow";
|
|
3
2
|
import { TimeChartStyle } from "./utils/model/styles/TimeChartStyle";
|
|
4
3
|
import { DateDistance } from "../../utils/DateStringFactory";
|
|
5
4
|
import { AggregationLevel, AxisLabelsMode, ChartMode } from "../../utils/constants";
|
|
@@ -7,8 +6,11 @@ import { ParentDimensions } from "../../utils/parentDimensions";
|
|
|
7
6
|
import { DataFormatDigits } from "../../utils/model/DataFormatDigits";
|
|
8
7
|
import { Order } from "../../utils/model/Order";
|
|
9
8
|
export declare class IbcsChartTime {
|
|
10
|
-
element: HTMLElement
|
|
11
|
-
|
|
9
|
+
element: HTMLElement;
|
|
10
|
+
/** Name of the dataset (table or view in the shared alasql database). */
|
|
11
|
+
tableName: string;
|
|
12
|
+
/** Bumped by `bn-chart-time` when the dataset changes; triggers re-render. */
|
|
13
|
+
dataVersion: number;
|
|
12
14
|
chartTitle?: string;
|
|
13
15
|
scenarios: string[];
|
|
14
16
|
variances: string[];
|
|
@@ -41,7 +43,9 @@ export declare class IbcsChartTime {
|
|
|
41
43
|
patternElement: HTMLSpanElement | undefined;
|
|
42
44
|
private chart;
|
|
43
45
|
private pattern;
|
|
46
|
+
private stores;
|
|
44
47
|
constructor();
|
|
48
|
+
private getDb;
|
|
45
49
|
render(): any;
|
|
46
50
|
componentWillLoad(): Promise<void>;
|
|
47
51
|
componentWillUpdate(): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Svg } from "@svgdotjs/svg.js";
|
|
2
2
|
import { TimeChartComponentConfig } from "./model/TimeChartComponentConfig";
|
|
3
3
|
import { TimeChartStyle } from "./model/styles/TimeChartStyle";
|
|
4
|
-
import {
|
|
4
|
+
import { AlaSQLDatabase } from "../../../context/scopedDb";
|
|
5
5
|
import { SVGPolgonPattern } from "../../../utils/model";
|
|
6
6
|
import { VisualisationRuleSet } from "../../bn-table/utils/model";
|
|
7
7
|
/**
|
|
@@ -40,7 +40,10 @@ export declare class TimeChart {
|
|
|
40
40
|
private pixelPerPercentage;
|
|
41
41
|
private hideAxisLabels;
|
|
42
42
|
private axisScenario;
|
|
43
|
-
private
|
|
43
|
+
private db;
|
|
44
|
+
private tableName;
|
|
45
|
+
private fromExpr;
|
|
46
|
+
private rowCount;
|
|
44
47
|
private axisCategoryArea;
|
|
45
48
|
private scenariosArea;
|
|
46
49
|
private state;
|
|
@@ -63,9 +66,8 @@ export declare class TimeChart {
|
|
|
63
66
|
private availableWidth;
|
|
64
67
|
private overflowConfig;
|
|
65
68
|
private lastScenarios;
|
|
66
|
-
constructor(ruleSet: VisualisationRuleSet, config: TimeChartComponentConfig, styles: TimeChartStyle, availableWidth?: number);
|
|
69
|
+
constructor(ruleSet: VisualisationRuleSet, db: AlaSQLDatabase, tableName: string, config: TimeChartComponentConfig, styles: TimeChartStyle, availableWidth?: number);
|
|
67
70
|
updatePosition(scenarios: string[]): void;
|
|
68
|
-
initSQLFunctions(): void;
|
|
69
71
|
setStyles(newStyle: TimeChartStyle): void;
|
|
70
72
|
setAvailableWidth(w: number): void;
|
|
71
73
|
setAvailableHeight(availableHeight: number): void;
|
|
@@ -88,15 +90,11 @@ export declare class TimeChart {
|
|
|
88
90
|
*/
|
|
89
91
|
setI18n(i18n: Map<string, string>): void;
|
|
90
92
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* @param data
|
|
96
|
-
* @param filter - data filter
|
|
97
|
-
* @param customColumnNameMap Custon ColumnNameMap can be used if data uses non standard columnames
|
|
93
|
+
* Resolves the dataset (a table or view in the shared alasql database) and
|
|
94
|
+
* caches its row count. Subsequent queries reference the source by name —
|
|
95
|
+
* alasql doesn't have to ingest a fresh array per call.
|
|
98
96
|
*/
|
|
99
|
-
|
|
97
|
+
setSource(filter: string): void;
|
|
100
98
|
getAllocatedCanvasWidth(): number;
|
|
101
99
|
getAllocatedCanvasHeight(): number;
|
|
102
100
|
toString(): string;
|
|
@@ -113,6 +111,7 @@ export declare class TimeChart {
|
|
|
113
111
|
private detectNaNCells;
|
|
114
112
|
private findDateInterval;
|
|
115
113
|
private queryMinMaxDates;
|
|
114
|
+
private static coerceDateTime;
|
|
116
115
|
private queryDataSet;
|
|
117
116
|
private createDataRows;
|
|
118
117
|
private findSmallestDataPointValue;
|
|
@@ -6,6 +6,7 @@ import { DataFormatDigits, DataFormatDigitsAdapter } from "../../../../utils/mod
|
|
|
6
6
|
import { Order, OrderAdapter } from "../../../../utils/model/Order";
|
|
7
7
|
import { SiPrefix } from "../../../../utils/model/SiPrefix";
|
|
8
8
|
import { TimeChartDataRow, TimeChartDataRowAdapter } from "./TimeChartDataRow";
|
|
9
|
+
import { AlaSQLDatabase } from "../../../../context/scopedDb";
|
|
9
10
|
/** Parsed stacking configuration for multi-scenario bar/area charts. */
|
|
10
11
|
export interface StackConfigParsed {
|
|
11
12
|
by: StackBy;
|
|
@@ -59,15 +60,16 @@ export declare class TimeChartComponentConfig {
|
|
|
59
60
|
/**
|
|
60
61
|
* Converts untyped JSON into a validated {@link TimeChartComponentConfig}.
|
|
61
62
|
*
|
|
62
|
-
*
|
|
63
|
+
* Reads from the shared alasql database for measure-scale auto-calculation.
|
|
63
64
|
*/
|
|
64
65
|
export declare class TimeChartComponentConfigAdapter implements IAdapter<TimeChartComponentConfig> {
|
|
65
66
|
private dataRowAdapter;
|
|
66
67
|
private orderAdapter;
|
|
67
68
|
private stringAdapter;
|
|
68
69
|
private dataFormatDigitsAdapter;
|
|
69
|
-
private
|
|
70
|
-
|
|
70
|
+
private db;
|
|
71
|
+
private fromExpr;
|
|
72
|
+
constructor(dataRowAdapter: TimeChartDataRowAdapter, orderAdapter: OrderAdapter, stringAdapter: StringAdapter, dataFormatDigitsAdapter: DataFormatDigitsAdapter, db: AlaSQLDatabase, fromExpr: string);
|
|
71
73
|
adapt(data: Record<string, unknown>): TimeChartComponentConfig;
|
|
72
74
|
default(): TimeChartComponentConfig;
|
|
73
75
|
}
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
* Queries data from one or more `bn-datasource` entries via AlaSQL and
|
|
3
3
|
* writes the result to the `datasets` store (+ computed `DatasetMeta`).
|
|
4
4
|
*
|
|
5
|
-
* The
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The body content is observed via `withBodyObserver` and may be:
|
|
6
|
+
* 1. **SQL** (default) — AlaSQL query against referenced `datasources`.
|
|
7
|
+
* 2. **Static JSON** — set `static="true"` to bypass SQL and write the
|
|
8
|
+
* parsed body directly to the `datasets` store.
|
|
9
|
+
* 3. **URL** — place an `http://` or `https://` URL in the body to fetch
|
|
10
|
+
* JSON from a remote endpoint and write it to the `datasets` store.
|
|
11
|
+
* Set the `interval` prop (in seconds) to enable periodic re-fetching.
|
|
9
12
|
*/
|
|
10
13
|
export declare class Dataset {
|
|
11
14
|
private element;
|
|
@@ -34,11 +37,42 @@ export declare class Dataset {
|
|
|
34
37
|
* When false, body content is a compressed payload (`<hash>:<base64_gzip>`).
|
|
35
38
|
*/
|
|
36
39
|
raw: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Polling interval in **seconds** for URL mode.
|
|
42
|
+
* When set and the body content is a URL, the component re-fetches
|
|
43
|
+
* data at this interval. Has no effect for SQL, inline JSON or
|
|
44
|
+
* compressed content. Set to `0` or leave unset to disable polling.
|
|
45
|
+
*/
|
|
46
|
+
interval: number;
|
|
37
47
|
private query;
|
|
38
48
|
private lastBodyHash;
|
|
39
|
-
|
|
49
|
+
/** The query text last used to (re)create the SQL view, so we only `CREATE VIEW` when it actually changes. */
|
|
50
|
+
private lastViewQuery;
|
|
40
51
|
private latestResult;
|
|
52
|
+
/** The currently active URL (`null` when not in URL mode). */
|
|
53
|
+
private currentUrl;
|
|
54
|
+
/** Timer ID for the polling interval. */
|
|
55
|
+
private pollTimerId;
|
|
56
|
+
/** AbortController for cancelling in-flight fetch requests. */
|
|
57
|
+
private abortController;
|
|
41
58
|
executeQuery(): void;
|
|
59
|
+
/** Notifies db subscribers and updates the derived `datasetsMeta` store. */
|
|
60
|
+
private publish;
|
|
42
61
|
nameUpdated(): void;
|
|
62
|
+
onIntervalChange(): void;
|
|
63
|
+
disconnectedCallback(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Returns `true` if the text starts with `http://` or `https://`.
|
|
66
|
+
*/
|
|
67
|
+
private isUrl;
|
|
68
|
+
/**
|
|
69
|
+
* Fetches JSON from the given URL and stores the result as the dataset.
|
|
70
|
+
* Cancels any in-flight request before starting a new one.
|
|
71
|
+
*/
|
|
72
|
+
private fetchAndStore;
|
|
73
|
+
/** Stops the polling timer and cancels any in-flight fetch. */
|
|
74
|
+
private clearPolling;
|
|
75
|
+
/** Starts (or restarts) the polling timer if in URL mode with a positive interval. */
|
|
76
|
+
private startPolling;
|
|
43
77
|
render(): any;
|
|
44
78
|
}
|
|
@@ -42,6 +42,11 @@ export declare class Datasource {
|
|
|
42
42
|
/** AbortController for cancelling in-flight fetch requests. */
|
|
43
43
|
private abortController;
|
|
44
44
|
constructor();
|
|
45
|
+
/**
|
|
46
|
+
* Writes the parsed data into the shared alasql database (as a table named
|
|
47
|
+
* after this datasource) and notifies subscribers.
|
|
48
|
+
*/
|
|
49
|
+
private publish;
|
|
45
50
|
onIntervalChange(): void;
|
|
46
51
|
disconnectedCallback(): void;
|
|
47
52
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TableDataRow } from "./utils/model/TableDataRow";
|
|
2
1
|
/**
|
|
3
2
|
* Public-facing wrapper for the IBCS table component.
|
|
4
3
|
*
|
|
@@ -17,7 +16,10 @@ export declare class Table {
|
|
|
17
16
|
private layoutObserver;
|
|
18
17
|
/** Last parent width seen, used to suppress ResizeObserver noise. */
|
|
19
18
|
private _lastScaledParentWidth;
|
|
20
|
-
|
|
19
|
+
/** Active dataset name (the last subscribed dataset to fire `onUpdate`). */
|
|
20
|
+
private datasetName;
|
|
21
|
+
/** Bumped on every data update so Stencil re-renders even when the name is unchanged. */
|
|
22
|
+
private dataVersion;
|
|
21
23
|
private datasetMeta;
|
|
22
24
|
private appliedScaleFactor;
|
|
23
25
|
/**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TableType } from "./utils/model";
|
|
2
2
|
import { TableDrillGroup } from "./utils/model/TableDrillGroup";
|
|
3
|
-
import { TableDataRow } from "./utils/model/TableDataRow";
|
|
4
3
|
import { DataFormat, I18nMode, MeasureType, TableCategoryWidth } from "../../utils/constants";
|
|
5
4
|
import { DataFormatDigits } from "../../utils/model/DataFormatDigits";
|
|
6
5
|
import { Order } from "../../utils/model/Order";
|
|
@@ -16,7 +15,16 @@ import { Order } from "../../utils/model/Order";
|
|
|
16
15
|
export declare class IbcsTable {
|
|
17
16
|
private element;
|
|
18
17
|
private readonly componentStyle;
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Name of the dataset (a table or view in the shared alasql database). The
|
|
20
|
+
* inner `Table` helper queries it directly — no array copy.
|
|
21
|
+
*/
|
|
22
|
+
tableName: string;
|
|
23
|
+
/**
|
|
24
|
+
* Bumped by the outer `bn-table` whenever the dataset's data changes. Triggers
|
|
25
|
+
* a re-render via Stencil's prop-change detection.
|
|
26
|
+
*/
|
|
27
|
+
dataVersion: number;
|
|
20
28
|
tableTitle: string;
|
|
21
29
|
scenarios: string[];
|
|
22
30
|
scenariosDataFormat: DataFormat;
|
|
@@ -45,11 +53,11 @@ export declare class IbcsTable {
|
|
|
45
53
|
private table;
|
|
46
54
|
private componentDataFormatDigits;
|
|
47
55
|
private barChartStyles;
|
|
56
|
+
private stores;
|
|
48
57
|
constructor();
|
|
49
58
|
render(): any;
|
|
50
59
|
componentWillRender(): void;
|
|
51
60
|
private prepareConfig;
|
|
52
|
-
private prepareData;
|
|
53
61
|
/**
|
|
54
62
|
* Prepares bar chart styles from componentStyle store.
|
|
55
63
|
* Uses the same variance styles as bn-chart-time for consistency.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VisualisationRuleSet } from "./model";
|
|
2
2
|
import { TableRow } from "./elements";
|
|
3
3
|
import { TableComponentConfig } from "./model/TableComponentConfig";
|
|
4
|
-
import {
|
|
4
|
+
import { AlaSQLDatabase } from "../../../context/scopedDb";
|
|
5
5
|
/**
|
|
6
6
|
* High-level controller for IBCS table generation.
|
|
7
7
|
*
|
|
@@ -19,14 +19,16 @@ export declare class Table {
|
|
|
19
19
|
private dataSetFactory;
|
|
20
20
|
private i18n;
|
|
21
21
|
private state;
|
|
22
|
-
private
|
|
22
|
+
private db;
|
|
23
|
+
private fromExpr;
|
|
24
|
+
private rowCount;
|
|
23
25
|
private headerRows;
|
|
24
26
|
private bodyRows;
|
|
25
27
|
/**
|
|
26
|
-
* Initialises all Variables for the DataSet, created by the factory
|
|
27
|
-
*
|
|
28
|
+
* Initialises all Variables for the DataSet, created by the factory.
|
|
29
|
+
* Reads data directly from the shared alasql database (named by `tableName`).
|
|
28
30
|
*/
|
|
29
|
-
constructor(ruleSet: VisualisationRuleSet,
|
|
31
|
+
constructor(ruleSet: VisualisationRuleSet, db: AlaSQLDatabase, tableName: string, config: TableComponentConfig);
|
|
30
32
|
/**
|
|
31
33
|
* Init load of translation dictionary map
|
|
32
34
|
* map is used to translate lables in the table
|
|
@@ -52,7 +54,7 @@ export declare class Table {
|
|
|
52
54
|
* @param config
|
|
53
55
|
*/
|
|
54
56
|
setConfig(config: TableComponentConfig): void;
|
|
55
|
-
|
|
57
|
+
setSource(tableName: string, filter: string): void;
|
|
56
58
|
update(): void;
|
|
57
59
|
getHeader(): TableRow[];
|
|
58
60
|
getBody(): TableRow[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TableRow } from "../elements";
|
|
2
2
|
import { TableType } from "../model";
|
|
3
|
-
import { TableDataRow } from "../model/TableDataRow";
|
|
4
3
|
import { TableComponentConfig } from "../model/TableComponentConfig";
|
|
5
4
|
import { SiPrefix } from "../../../../utils/model/SiPrefix";
|
|
5
|
+
import { AlaSQLDatabase } from "../../../../context/scopedDb";
|
|
6
6
|
/**
|
|
7
7
|
* Transforms raw query results into structured TableRow collections for header and body.
|
|
8
8
|
*
|
|
@@ -44,7 +44,7 @@ export declare class TableDataSetFactory {
|
|
|
44
44
|
* eachh row consists of data columns and 'spacer' columns which are needed to seperate
|
|
45
45
|
* the columns correctyl (IBCS style)
|
|
46
46
|
*/
|
|
47
|
-
createBodyRows(config: TableComponentConfig, i18n: Map<string | number, string>,
|
|
47
|
+
createBodyRows(config: TableComponentConfig, i18n: Map<string | number, string>, db: AlaSQLDatabase, fromExpr: string): TableRow[];
|
|
48
48
|
/**
|
|
49
49
|
* Calculate min/max statistics for bar chart columns across all query data.
|
|
50
50
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TableComponentConfig } from "../model/TableComponentConfig";
|
|
2
|
-
import { TableDataRow } from "../model/TableDataRow";
|
|
3
2
|
import { DataQueryResultRow } from "../../../../utils/model/DataQueryResultRow";
|
|
3
|
+
import { AlaSQLDatabase } from "../../../../context/scopedDb";
|
|
4
4
|
/**
|
|
5
5
|
* AlaSQL-based query builder that produces the complete table result set for bn-table.
|
|
6
6
|
*
|
|
@@ -13,6 +13,8 @@ export declare class DataQuery {
|
|
|
13
13
|
private readonly config;
|
|
14
14
|
private hasPartOf;
|
|
15
15
|
private i18n;
|
|
16
|
+
private db;
|
|
17
|
+
private fromExpr;
|
|
16
18
|
constructor(config: TableComponentConfig, i18n: Map<string | number, string>);
|
|
17
19
|
/**
|
|
18
20
|
* Executes the full query pipeline and returns a segmented result set.
|
|
@@ -28,9 +30,11 @@ export declare class DataQuery {
|
|
|
28
30
|
* 8. Calculate REST columns (parent minus drilled children)
|
|
29
31
|
* 9. Divide absolute variances by their denominator to produce relative variances
|
|
30
32
|
*
|
|
33
|
+
* @param db - The shared alasql database.
|
|
34
|
+
* @param fromExpr - SQL FROM-clause expression naming the source table or filtered view.
|
|
31
35
|
* @returns Array of row-group segments; each segment is an array of result rows.
|
|
32
36
|
*/
|
|
33
|
-
execute(
|
|
37
|
+
execute(db: AlaSQLDatabase, fromExpr: string): DataQueryResultRow[][];
|
|
34
38
|
/**
|
|
35
39
|
* Marks aggregated cells as NaN when no source rows contributed to the sum.
|
|
36
40
|
*
|
|
@@ -46,7 +50,7 @@ export declare class DataQuery {
|
|
|
46
50
|
* of its row group sum. Queries the drill subset, then divides each scenario
|
|
47
51
|
* value by the corresponding group sum to produce a percentage.
|
|
48
52
|
*/
|
|
49
|
-
createPartOfDrillRows(scenarios: string, order: [string, string], sumGroupQueries: string[],
|
|
53
|
+
createPartOfDrillRows(scenarios: string, order: [string, string], sumGroupQueries: string[], res: DataQueryResultRow[][]): void;
|
|
50
54
|
/**
|
|
51
55
|
* Generates a REST row that aggregates all data rows beyond the configured limit.
|
|
52
56
|
* Only emitted when a limit is set and the group has more rows than the limit.
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { TableComponentConfig } from "../model/TableComponentConfig";
|
|
2
2
|
/**
|
|
3
|
-
* Manages the GROUP BY column list for DataQuery's SQL statements
|
|
4
|
-
* the `transformOperator` AlaSQL custom function.
|
|
3
|
+
* Manages the GROUP BY column list for DataQuery's SQL statements.
|
|
5
4
|
*
|
|
6
|
-
* `transformOperator`
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The `transformOperator` AlaSQL UDF (which maps `"+"`/`"-"` to +1/-1 for
|
|
6
|
+
* sign-aware SUMs) is registered globally by `scopedDb.ts` when the shared
|
|
7
|
+
* database is created — no per-component registration is needed here.
|
|
9
8
|
*
|
|
10
9
|
* The GROUP BY columns are composed dynamically: always category + categoryIndex,
|
|
11
10
|
* plus operation for OPT types, plus rowGroup/rowGroupIndex when grouping is active.
|
|
@@ -6,6 +6,7 @@ import { OrderAdapter } from "../../../../utils/model/Order";
|
|
|
6
6
|
import { SiPrefix } from "../../../../utils/model/SiPrefix";
|
|
7
7
|
import { TableType } from "./index";
|
|
8
8
|
import { TableDrillGroup, TableDrillGroupAdapter } from "./TableDrillGroup";
|
|
9
|
+
import { AlaSQLDatabase } from "../../../../context/scopedDb";
|
|
9
10
|
/**
|
|
10
11
|
* Configuration for an IBCS table component.
|
|
11
12
|
*
|
|
@@ -59,14 +60,15 @@ export declare class TableComponentConfig {
|
|
|
59
60
|
/**
|
|
60
61
|
* Converts untyped JSON into a validated {@link TableComponentConfig}.
|
|
61
62
|
*
|
|
62
|
-
*
|
|
63
|
+
* Reads from the shared alasql database for measure-scale auto-calculation when `measureScale` is set to "auto".
|
|
63
64
|
*/
|
|
64
65
|
export declare class TableComponentConfigAdapter implements IAdapter<TableComponentConfig> {
|
|
65
66
|
private tableDrillGroupAdapter;
|
|
66
67
|
private stringAdapter;
|
|
67
68
|
private orderAdapter;
|
|
68
|
-
private
|
|
69
|
-
|
|
69
|
+
private db;
|
|
70
|
+
private fromExpr;
|
|
71
|
+
constructor(tableDrillGroupAdapter: TableDrillGroupAdapter, stringAdapter: StringAdapter, orderAdapter: OrderAdapter, db: AlaSQLDatabase, fromExpr: string);
|
|
70
72
|
adapt(data: Record<string, unknown>): TableComponentConfig;
|
|
71
73
|
default(): TableComponentConfig;
|
|
72
74
|
}
|
|
@@ -14,5 +14,7 @@ export declare class EditorCompanion {
|
|
|
14
14
|
getDistinctFromDataSource(dataSourceName: string, key: string): Promise<unknown[]>;
|
|
15
15
|
getDistinctFromDataset(datasetName: string, key: string): Promise<unknown[]>;
|
|
16
16
|
render(): any;
|
|
17
|
+
/** Materialize a table or view from the shared db, returning [] when it doesn't exist yet. */
|
|
18
|
+
private queryRows;
|
|
17
19
|
private distinct;
|
|
18
20
|
}
|