@bino-bi/bn-template-engine 1.0.0-next.30 → 1.0.0-next.32
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-64803a42.entry.js → p-14d021be.entry.js} +1 -1
- package/dist/bn-template-engine/p-225cd474.entry.js +1 -0
- package/dist/bn-template-engine/p-58b10778.entry.js +1 -0
- package/dist/bn-template-engine/{p-40ba7f43.entry.js → p-7d475277.entry.js} +1 -1
- package/dist/bn-template-engine/p-9f3cbc5f.entry.js +1 -0
- package/dist/bn-template-engine/p-BNCLKXjM.js +1 -0
- package/dist/bn-template-engine/{p-B8AjeKja.js → p-BTbeDWM9.js} +1 -1
- package/dist/bn-template-engine/{p-Z2rUaSh_.js → p-BjR3nkhl.js} +1 -1
- package/dist/bn-template-engine/p-CHZ50kEY.js +1 -0
- package/dist/bn-template-engine/p-CJfJQT0m.js +1 -0
- package/dist/bn-template-engine/p-ce39e111.entry.js +1 -0
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +191 -68
- package/dist/cjs/bn-grid.cjs.entry.js +465 -34
- package/dist/cjs/bn-image.cjs.entry.js +2 -2
- package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
- package/dist/cjs/bn-ruleset.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/loader.cjs.js +1 -1
- package/dist/cjs/{diagnostics-C4Ggts3w.js → localFrame-P5SDUOto.js} +90 -1
- package/dist/cjs/{withBodyObserver-BK4idxqG.js → withBodyObserver-B1_hmuUz.js} +1 -1
- package/dist/cjs/{withHasError-CqvcS23z.js → withHasError-3kR2tdhJ.js} +4 -0
- package/dist/cjs/{withStyled-70D4Isgt.js → withStyled-Ds3e64Nz.js} +1 -1
- package/dist/cjs/{withTranslation-C6Pye2CM.js → withTranslation-Cjvvs3gL.js} +2 -2
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +32 -2
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +32 -2
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +3 -1
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +32 -2
- package/dist/collection/components/bn-chart-structure/bn-chart-structure-renderer/bn-chart-structure-renderer.js +1 -1
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +33 -2
- package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +1 -1
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +33 -2
- package/dist/collection/components/bn-grid/bn-grid.js +454 -26
- package/dist/collection/components/bn-grid/utils/cellLayout.js +111 -0
- package/dist/collection/components/bn-table/bn-table.js +39 -2
- package/dist/collection/stores/componentStyles.js +4 -0
- package/dist/collection/utils/layoutState/baseline.js +67 -0
- package/dist/collection/utils/layoutState/index.js +2 -0
- package/dist/collection/utils/layoutState/localFrame.js +87 -0
- package/dist/collection/utils/layoutState/svgChartElements.js +6 -2
- package/dist/collection/utils/xy/XYFrame.js +3 -1
- package/dist/components/bn-annotation-layer.js +1 -1
- package/dist/components/bn-annotation-list.js +1 -1
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body.js +1 -1
- package/dist/components/bn-card.js +1 -1
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.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-footer.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-message.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-ruleset.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-0gehv1XG.js +1 -0
- package/dist/components/{p-Bs-YxJEt.js → p-8a2-IS-y.js} +1 -1
- package/dist/components/p-B2jqpOF9.js +1 -0
- package/dist/components/{p-BWBHlztH.js → p-BPJsmv3o.js} +1 -1
- package/dist/components/{p-BXrPfAvP.js → p-BVtD8O36.js} +1 -1
- package/dist/components/p-BcOud3dQ.js +1 -0
- package/dist/components/{p-DsOaqeTN.js → p-BoUkFdpu.js} +1 -1
- package/dist/components/p-BohXdw3-.js +1 -0
- package/dist/components/p-C6XrNN2m.js +1 -0
- package/dist/components/{p-Dm55bMs2.js → p-CDoSPw-I.js} +1 -1
- package/dist/components/p-CMCnX0iM.js +1 -0
- package/dist/components/{p-Ds_BSK8v.js → p-ClGOhg6P.js} +1 -1
- package/dist/components/p-CujsXn-l.js +1 -0
- package/dist/components/{p-Ba9PUiBp.js → p-D4FY_yoG.js} +1 -1
- package/dist/components/{p-DIyUaSBg.js → p-D6cWoDk1.js} +1 -1
- package/dist/components/p-D7X69xMg.js +1 -0
- package/dist/components/{p-B1nL0yOa.js → p-DSkyHSIL.js} +1 -1
- package/dist/components/{p-BSV_vyqs.js → p-De82WP7z.js} +1 -1
- package/dist/components/p-DyO09Jk6.js +1 -0
- package/dist/components/{p-WzaayhTX.js → p-Ku08TQL1.js} +1 -1
- package/dist/components/p-t4xPltK2.js +1 -0
- package/dist/components/{p-ey23VlID.js → p-yH-XxIy9.js} +1 -1
- package/dist/components/{p-X9hpquOX.js → p-z56_ZQ42.js} +1 -1
- package/dist/components/{p-B7uwck1J.js → p-zf8cTH63.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +140 -17
- package/dist/esm/bn-grid.entry.js +456 -25
- package/dist/esm/bn-image.entry.js +2 -2
- package/dist/esm/bn-internationalization.entry.js +2 -2
- package/dist/esm/bn-ruleset.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/loader.js +1 -1
- package/dist/esm/{diagnostics-Cyqy1zDT.js → localFrame-IW84cmdb.js} +90 -2
- package/dist/esm/{withBodyObserver-JcRB9OPQ.js → withBodyObserver-CAnnvrE_.js} +1 -1
- package/dist/esm/{withHasError-l3cMN-oP.js → withHasError-Cj_MzZ8Q.js} +4 -0
- package/dist/esm/{withStyled-DGOiR00Q.js → withStyled-B-cbWCe2.js} +1 -1
- package/dist/esm/{withTranslation-BpO8BC5B.js → withTranslation-_8q-7Y9C.js} +2 -2
- package/dist/schemas/theme.schema.json +14 -0
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +6 -1
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +6 -1
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +6 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +6 -1
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +6 -1
- package/dist/types/components/bn-grid/bn-grid.d.ts +79 -3
- package/dist/types/components/bn-grid/utils/cellLayout.d.ts +47 -0
- package/dist/types/components/bn-table/bn-table.d.ts +8 -1
- package/dist/types/components.d.ts +94 -7
- package/dist/types/stores/componentStyles.d.ts +6 -0
- package/dist/types/utils/layoutState/baseline.d.ts +17 -0
- package/dist/types/utils/layoutState/index.d.ts +2 -0
- package/dist/types/utils/layoutState/localFrame.d.ts +17 -0
- package/dist/types/utils/layoutState/svgChartElements.d.ts +3 -1
- package/dist/types/utils/layoutState/types.d.ts +12 -2
- package/package.json +1 -1
- package/dist/bn-template-engine/p-132ad556.entry.js +0 -1
- package/dist/bn-template-engine/p-17d71782.entry.js +0 -1
- package/dist/bn-template-engine/p-467871f3.entry.js +0 -1
- package/dist/bn-template-engine/p-CrT83eO4.js +0 -1
- package/dist/bn-template-engine/p-D_DzKxRV.js +0 -1
- package/dist/bn-template-engine/p-c41c0a1b.entry.js +0 -1
- package/dist/bn-template-engine/p-yc69rwuH.js +0 -1
- package/dist/components/p-BDS_jiow.js +0 -1
- package/dist/components/p-BIIDTtcR.js +0 -1
- package/dist/components/p-BVKLCz2k.js +0 -1
- package/dist/components/p-CkW23yp2.js +0 -1
- package/dist/components/p-DUHp_9X-.js +0 -1
- package/dist/components/p-Dq1AzGKX.js +0 -1
- package/dist/components/p-U3zkcEJZ.js +0 -1
- package/dist/components/p-jbp6YiHf.js +0 -1
|
@@ -3,13 +3,29 @@ import { ComponentLayoutState, LayoutStateOptions } from "../../utils/layoutStat
|
|
|
3
3
|
* CSS Grid layout container with optional row/column headers.
|
|
4
4
|
*
|
|
5
5
|
* Child components are placed into named slots (`row-col` convention).
|
|
6
|
-
* Supports configurable borders, title, and header visibility.
|
|
6
|
+
* Supports configurable borders, title, and header visibility. Cells can
|
|
7
|
+
* have equal sizes, a caption, and aligned content; `baseline` lines up the
|
|
8
|
+
* axes of charts (and the header of tables) in a row or column.
|
|
7
9
|
*/
|
|
8
10
|
export declare class Grid {
|
|
9
11
|
private element;
|
|
10
12
|
private gridConfig;
|
|
13
|
+
private resolvedHeight;
|
|
14
|
+
private resolvedWidth;
|
|
15
|
+
private resolvedVertical;
|
|
16
|
+
private resolvedHorizontal;
|
|
17
|
+
private captions;
|
|
18
|
+
/** Per slot: how far the baseline pass moved the content. */
|
|
19
|
+
private offsets;
|
|
11
20
|
private readonly errors;
|
|
12
21
|
private readonly componentStyle;
|
|
22
|
+
private readonly holdStatus;
|
|
23
|
+
private resizeObserver?;
|
|
24
|
+
private mutationObserver?;
|
|
25
|
+
private observed;
|
|
26
|
+
private scheduled;
|
|
27
|
+
private run;
|
|
28
|
+
private adjustments;
|
|
13
29
|
/**
|
|
14
30
|
* Name of the component style to use (the `name` of a
|
|
15
31
|
* `<bn-component-style>`). Its values go on top of the default style.
|
|
@@ -61,12 +77,64 @@ export declare class Grid {
|
|
|
61
77
|
* Gap between cells. Accepts CSS values (e.g., '0px', '8px').
|
|
62
78
|
*/
|
|
63
79
|
cellGap: string;
|
|
80
|
+
/**
|
|
81
|
+
* Height of the data rows: `auto` (default) sizes each row to its content,
|
|
82
|
+
* `equal` gives every data row the height of the tallest one.
|
|
83
|
+
*/
|
|
84
|
+
cellHeight: string;
|
|
85
|
+
validateCellHeight(newValue: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Width of the data columns: `auto` (default) sizes each column to its
|
|
88
|
+
* content, `equal` makes the grid as wide as its container and gives every
|
|
89
|
+
* data column the same share of it.
|
|
90
|
+
*/
|
|
91
|
+
cellWidth: string;
|
|
92
|
+
validateCellWidth(newValue: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* Vertical position of the content in a cell: `top` (default), `center`,
|
|
95
|
+
* `bottom`, or `baseline`. `baseline` lines up the components of a row on
|
|
96
|
+
* their baseline (the axis of a chart, the bottom of a table header); a
|
|
97
|
+
* component without one goes to the bottom.
|
|
98
|
+
*/
|
|
99
|
+
cellVerticalAlign: string;
|
|
100
|
+
validateCellVerticalAlign(newValue: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Horizontal position of the content in a cell: `left` (default),
|
|
103
|
+
* `center`, `right`, or `baseline`. `baseline` lines up the components of
|
|
104
|
+
* a column on their baseline (the vertical axis of a chart, the first value
|
|
105
|
+
* column of a table); a component without one stays left.
|
|
106
|
+
*/
|
|
107
|
+
cellHorizontalAlign: string;
|
|
108
|
+
validateCellHorizontalAlign(newValue: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* JSON object from slot name to a caption, drawn top left in the cell above
|
|
111
|
+
* its content: '{"0-0": "Berlin", "0-1": "Cologne"}'. Alignment moves the
|
|
112
|
+
* content, never the caption. The style section `bn-grid` sets its font.
|
|
113
|
+
*/
|
|
114
|
+
cellCaptions: string;
|
|
115
|
+
validateCellCaptions(newValue: string): void;
|
|
64
116
|
constructor();
|
|
117
|
+
connectedCallback(): void;
|
|
118
|
+
disconnectedCallback(): void;
|
|
119
|
+
/** Captions, headers, gap or style can move a cell without resizing its component. */
|
|
120
|
+
componentDidRender(): void;
|
|
121
|
+
private validateChoice;
|
|
122
|
+
private isBaselineMode;
|
|
123
|
+
/**
|
|
124
|
+
* Aligns the baselines after the next paint. The grid counts as working
|
|
125
|
+
* until then, so a printer does not print a half-aligned grid.
|
|
126
|
+
*/
|
|
127
|
+
private readonly schedule;
|
|
128
|
+
/** The first visual component in a slot, or the slotted element itself. */
|
|
129
|
+
private visualIn;
|
|
130
|
+
private align;
|
|
131
|
+
/** A chart redraws inside its shadow roots, where the host and a mutation observer on it see nothing. */
|
|
132
|
+
private observe;
|
|
65
133
|
/**
|
|
66
134
|
* Lazily generates this grid's layout state: host box (context- and
|
|
67
135
|
* component-relative, CSS px), the grid region and row/column counts. With
|
|
68
|
-
* `detail: "full"` the title, every header
|
|
69
|
-
* slot name) is listed with its geometry.
|
|
136
|
+
* `detail: "full"` the title, every header, every data cell and every
|
|
137
|
+
* caption (with its slot name) is listed with its geometry.
|
|
70
138
|
*
|
|
71
139
|
* @param options - `{ detail: "summary" | "full" }`, default `"summary"`
|
|
72
140
|
*/
|
|
@@ -85,6 +153,14 @@ export declare class Grid {
|
|
|
85
153
|
private renderTitle;
|
|
86
154
|
private renderColumnHeaders;
|
|
87
155
|
private renderDataCells;
|
|
156
|
+
/** Flex column only when the content is not at the default top left: a block cell stays a block. */
|
|
157
|
+
private cellAlignStyle;
|
|
158
|
+
/**
|
|
159
|
+
* The caption, then the slot in a wrapper: auto margins move the wrapper
|
|
160
|
+
* below the caption (the caption stays at the top), and padding or a margin
|
|
161
|
+
* moves it onto the baseline. Without alignment the wrapper is a plain block.
|
|
162
|
+
*/
|
|
163
|
+
private renderCellContent;
|
|
88
164
|
private getFontStyles;
|
|
89
165
|
render(): any;
|
|
90
166
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cell size and alignment for bn-grid: the accepted values, their CSS, and
|
|
3
|
+
* the offsets that line up the baselines of the components in a row or column.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CELL_SIZES: readonly ["auto", "equal"];
|
|
6
|
+
export declare const VERTICAL_ALIGNS: readonly ["top", "center", "bottom", "baseline"];
|
|
7
|
+
export declare const HORIZONTAL_ALIGNS: readonly ["left", "center", "right", "baseline"];
|
|
8
|
+
export type CellSize = (typeof CELL_SIZES)[number];
|
|
9
|
+
export type VerticalAlign = (typeof VERTICAL_ALIGNS)[number];
|
|
10
|
+
export type HorizontalAlign = (typeof HORIZONTAL_ALIGNS)[number];
|
|
11
|
+
/** justify-content of a flex column cell. Baseline cells start at the top and are padded down. */
|
|
12
|
+
export declare const JUSTIFY: Record<VerticalAlign, string>;
|
|
13
|
+
/**
|
|
14
|
+
* align-items of a flex column cell. `left` stretches: a chart measures the
|
|
15
|
+
* width of its wrapper, and flex-start would shrink that wrapper.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ALIGN: Record<HorizontalAlign, string>;
|
|
18
|
+
/** Parses `cell-captions`: a JSON object from slot name to caption text. `undefined` when invalid. */
|
|
19
|
+
export declare function parseCaptions(json: string | undefined): Record<string, string> | undefined;
|
|
20
|
+
/** One cell as the baseline pass sees it, in the grid's layout px. */
|
|
21
|
+
export interface BaselineCell {
|
|
22
|
+
slot: string;
|
|
23
|
+
row: number;
|
|
24
|
+
column: number;
|
|
25
|
+
/** Baseline of the component in the cell, with the current offsets applied. */
|
|
26
|
+
y?: number;
|
|
27
|
+
x?: number;
|
|
28
|
+
/** Offsets applied now. */
|
|
29
|
+
top: number;
|
|
30
|
+
left: number;
|
|
31
|
+
}
|
|
32
|
+
/** Where a cell's content goes: padded down/right, or at the bottom when it has no baseline. */
|
|
33
|
+
export interface CellOffset {
|
|
34
|
+
top?: number;
|
|
35
|
+
left?: number;
|
|
36
|
+
/** Space kept free on the right, so every component of a column has the same width and stays in its cell. */
|
|
37
|
+
right?: number;
|
|
38
|
+
bottom?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Offsets that put every baseline of a row on the lowest one, and every
|
|
42
|
+
* baseline of a column on the rightmost one. A cell without a baseline on an
|
|
43
|
+
* axis goes to the bottom (vertical) or stays left (horizontal).
|
|
44
|
+
*/
|
|
45
|
+
export declare function baselineOffsets(cells: BaselineCell[], vertical: boolean, horizontal: boolean): Record<string, CellOffset>;
|
|
46
|
+
/** Two offset maps place every cell within half a px of each other. */
|
|
47
|
+
export declare function sameOffsets(a: Record<string, CellOffset>, b: Record<string, CellOffset>): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentLayoutState, LayoutStateOptions } from "../../utils/layoutState";
|
|
1
|
+
import { ComponentLayoutState, LayoutStateOptions, Baseline } from "../../utils/layoutState";
|
|
2
2
|
/**
|
|
3
3
|
* Public-facing wrapper for the IBCS table component.
|
|
4
4
|
*
|
|
@@ -484,6 +484,13 @@ export declare class Table {
|
|
|
484
484
|
*/
|
|
485
485
|
private handleAutoScalingReport;
|
|
486
486
|
getDataStructure(): any;
|
|
487
|
+
/**
|
|
488
|
+
* The line this table wants to be aligned on, in CSS px from the host's
|
|
489
|
+
* top-left corner: `y` is the bottom of the header, `x` the left edge of
|
|
490
|
+
* the first value column. Empty before the table has drawn.
|
|
491
|
+
*/
|
|
492
|
+
getBaseline(): Promise<Baseline>;
|
|
493
|
+
private readBaseline;
|
|
487
494
|
/**
|
|
488
495
|
* Lazily generates this table's layout state: host box (context- and
|
|
489
496
|
* component-relative, CSS px), header/body regions, row/column/cell counts,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* It contains typing information for all components that exist in this project.
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
-
import { CellElement, ComponentLayoutState, EdgeElement, GridCellElement, LabelElement, LayoutElement, LayoutState, LayoutStateOptions, NodeElement, Origins, TableRowInfo } from "./utils/layoutState";
|
|
8
|
+
import { Baseline, CellElement, ComponentLayoutState, EdgeElement, GridCellElement, LabelElement, LayoutElement, LayoutState, LayoutStateOptions, NodeElement, Origins, TableRowInfo } from "./utils/layoutState";
|
|
9
9
|
import { AxisConfig, FacetConfig, IsoConfig, LabelConfig, LegendConfig, ShareConfig, SizeConfig } from "./utils/xy/model/AxisConfig";
|
|
10
10
|
import { GroupLevel, PointLevel } from "./utils/xy/model/XYChartDataRow";
|
|
11
11
|
import { XYChartStyle } from "./utils/xy/model/XYChartStyle";
|
|
@@ -34,7 +34,7 @@ import { MeasureEntry } from "./components/bn-title/bn-title-renderer/utils/mode
|
|
|
34
34
|
import { TimePeriod } from "./components/bn-title/bn-title-renderer/utils/model/TimePeriod";
|
|
35
35
|
import { LayoutDirection } from "./components/bn-tree/utils/TreeLayout";
|
|
36
36
|
import { EdgeStyleType } from "./components/bn-tree/utils/EdgeRenderer";
|
|
37
|
-
export { CellElement, ComponentLayoutState, EdgeElement, GridCellElement, LabelElement, LayoutElement, LayoutState, LayoutStateOptions, NodeElement, Origins, TableRowInfo } from "./utils/layoutState";
|
|
37
|
+
export { Baseline, CellElement, ComponentLayoutState, EdgeElement, GridCellElement, LabelElement, LayoutElement, LayoutState, LayoutStateOptions, NodeElement, Origins, TableRowInfo } from "./utils/layoutState";
|
|
38
38
|
export { AxisConfig, FacetConfig, IsoConfig, LabelConfig, LegendConfig, ShareConfig, SizeConfig } from "./utils/xy/model/AxisConfig";
|
|
39
39
|
export { GroupLevel, PointLevel } from "./utils/xy/model/XYChartDataRow";
|
|
40
40
|
export { XYChartStyle } from "./utils/xy/model/XYChartStyle";
|
|
@@ -169,6 +169,10 @@ export namespace Components {
|
|
|
169
169
|
* @default ""
|
|
170
170
|
*/
|
|
171
171
|
"filter": string;
|
|
172
|
+
/**
|
|
173
|
+
* The line this chart wants to be aligned on, in CSS px from the host's top-left corner. `y` is the x axis (the bottom of the plot frame), `x` the y axis (its left edge), of the first panel when faceted. Empty before the chart has drawn.
|
|
174
|
+
*/
|
|
175
|
+
"getBaseline": () => Promise<Baseline>;
|
|
172
176
|
/**
|
|
173
177
|
* Lazily generates this chart's layout state: host box (context- and component-relative, CSS px), the canvas region, point count and diagnostics. With `detail: "full"` the rendered marks and labels are listed with their geometry (tag-classified - XY marks carry no ids).
|
|
174
178
|
* @param options - `{ detail: "summary" | "full" }`, default `"summary"`
|
|
@@ -350,6 +354,10 @@ export namespace Components {
|
|
|
350
354
|
* @default ""
|
|
351
355
|
*/
|
|
352
356
|
"filter": string;
|
|
357
|
+
/**
|
|
358
|
+
* The line this chart wants to be aligned on, in CSS px from the host's top-left corner. The vertical zero line gives `x` and its top end `y`. Empty before the chart has drawn.
|
|
359
|
+
*/
|
|
360
|
+
"getBaseline": () => Promise<Baseline>;
|
|
353
361
|
/**
|
|
354
362
|
* Lazily generates this chart's layout state: host box (context- and component-relative, CSS px), the canvas region and diagnostics. With `detail: "full"` the rendered marks and labels are listed with their geometry (tag-classified - bullet marks carry no ids).
|
|
355
363
|
* @param options - `{ detail: "summary" | "full" }`, default `"summary"`
|
|
@@ -520,6 +528,10 @@ export namespace Components {
|
|
|
520
528
|
* @default ""
|
|
521
529
|
*/
|
|
522
530
|
"filter": string;
|
|
531
|
+
/**
|
|
532
|
+
* The line this chart wants to be aligned on, in CSS px from the host's top-left corner. `y` is the x axis (the bottom of the plot frame), `x` the y axis (its left edge), of the first panel when faceted. Empty before the chart has drawn.
|
|
533
|
+
*/
|
|
534
|
+
"getBaseline": () => Promise<Baseline>;
|
|
523
535
|
/**
|
|
524
536
|
* Lazily generates this chart's layout state: host box (context- and component-relative, CSS px), the canvas region, point count and diagnostics. With `detail: "full"` the rendered marks and labels are listed with their geometry (tag-classified - XY marks carry no ids).
|
|
525
537
|
* @param options - `{ detail: "summary" | "full" }`, default `"summary"`
|
|
@@ -678,6 +690,10 @@ export namespace Components {
|
|
|
678
690
|
* @default ""
|
|
679
691
|
*/
|
|
680
692
|
"filter": string;
|
|
693
|
+
/**
|
|
694
|
+
* The line this chart wants to be aligned on, in CSS px from the host's top-left corner. The vertical value axis of the base segment gives `x` and its top end `y`. Empty before the chart has drawn.
|
|
695
|
+
*/
|
|
696
|
+
"getBaseline": () => Promise<Baseline>;
|
|
681
697
|
/**
|
|
682
698
|
* Lazily generates this chart's layout state: host box (context- and component-relative, CSS px), one `canvas:<segment>` region per rendered segment (base + variances), metadata (scenarios, bar count), diagnostics and resolved scaling. With `detail: "full"` every bar, label and axis of every segment is listed with its geometry.
|
|
683
699
|
* @param options - `{ detail: "summary" | "full" }`, default `"summary"`
|
|
@@ -904,6 +920,10 @@ export namespace Components {
|
|
|
904
920
|
* @default ""
|
|
905
921
|
*/
|
|
906
922
|
"filter": string;
|
|
923
|
+
/**
|
|
924
|
+
* The line this chart wants to be aligned on, in CSS px from the host's top-left corner. A horizontal axis line gives `y` and its left end `x`. The category axis of the base segment sits at zero, so negative bars hang below it. Empty before the chart has drawn.
|
|
925
|
+
*/
|
|
926
|
+
"getBaseline": () => Promise<Baseline>;
|
|
907
927
|
/**
|
|
908
928
|
* Lazily generates this chart's layout state: host box (context- and component-relative, CSS px), one `canvas:<segment>` region per rendered segment (base + variances), metadata (scenarios, bar count), diagnostics and resolved scaling. With `detail: "full"` every bar, label and axis of every segment is listed with its geometry.
|
|
909
929
|
* @param options - `{ detail: "summary" | "full" }`, default `"summary"`
|
|
@@ -1233,14 +1253,41 @@ export namespace Components {
|
|
|
1233
1253
|
/**
|
|
1234
1254
|
* CSS Grid layout container with optional row/column headers.
|
|
1235
1255
|
* Child components are placed into named slots (`row-col` convention).
|
|
1236
|
-
* Supports configurable borders, title, and header visibility.
|
|
1256
|
+
* Supports configurable borders, title, and header visibility. Cells can
|
|
1257
|
+
* have equal sizes, a caption, and aligned content; `baseline` lines up the
|
|
1258
|
+
* axes of charts (and the header of tables) in a row or column.
|
|
1237
1259
|
*/
|
|
1238
1260
|
interface BnGrid {
|
|
1261
|
+
/**
|
|
1262
|
+
* JSON object from slot name to a caption, drawn top left in the cell above its content: '{"0-0": "Berlin", "0-1": "Cologne"}'. Alignment moves the content, never the caption. The style section `bn-grid` sets its font.
|
|
1263
|
+
* @default ""
|
|
1264
|
+
*/
|
|
1265
|
+
"cellCaptions": string;
|
|
1239
1266
|
/**
|
|
1240
1267
|
* Gap between cells. Accepts CSS values (e.g., '0px', '8px').
|
|
1241
1268
|
* @default "0px"
|
|
1242
1269
|
*/
|
|
1243
1270
|
"cellGap": string;
|
|
1271
|
+
/**
|
|
1272
|
+
* Height of the data rows: `auto` (default) sizes each row to its content, `equal` gives every data row the height of the tallest one.
|
|
1273
|
+
* @default "auto"
|
|
1274
|
+
*/
|
|
1275
|
+
"cellHeight": string;
|
|
1276
|
+
/**
|
|
1277
|
+
* Horizontal position of the content in a cell: `left` (default), `center`, `right`, or `baseline`. `baseline` lines up the components of a column on their baseline (the vertical axis of a chart, the first value column of a table); a component without one stays left.
|
|
1278
|
+
* @default "left"
|
|
1279
|
+
*/
|
|
1280
|
+
"cellHorizontalAlign": string;
|
|
1281
|
+
/**
|
|
1282
|
+
* Vertical position of the content in a cell: `top` (default), `center`, `bottom`, or `baseline`. `baseline` lines up the components of a row on their baseline (the axis of a chart, the bottom of a table header); a component without one goes to the bottom.
|
|
1283
|
+
* @default "top"
|
|
1284
|
+
*/
|
|
1285
|
+
"cellVerticalAlign": string;
|
|
1286
|
+
/**
|
|
1287
|
+
* Width of the data columns: `auto` (default) sizes each column to its content, `equal` makes the grid as wide as its container and gives every data column the same share of it.
|
|
1288
|
+
* @default "auto"
|
|
1289
|
+
*/
|
|
1290
|
+
"cellWidth": string;
|
|
1244
1291
|
/**
|
|
1245
1292
|
* Title displayed at top-left of the grid.
|
|
1246
1293
|
* @default ""
|
|
@@ -1252,7 +1299,7 @@ export namespace Components {
|
|
|
1252
1299
|
*/
|
|
1253
1300
|
"columnHeaders": string;
|
|
1254
1301
|
/**
|
|
1255
|
-
* Lazily generates this grid's layout state: host box (context- and component-relative, CSS px), the grid region and row/column counts. With `detail: "full"` the title, every header
|
|
1302
|
+
* Lazily generates this grid's layout state: host box (context- and component-relative, CSS px), the grid region and row/column counts. With `detail: "full"` the title, every header, every data cell and every caption (with its slot name) is listed with its geometry.
|
|
1256
1303
|
* @param options - `{ detail: "summary" | "full" }`, default `"summary"`
|
|
1257
1304
|
*/
|
|
1258
1305
|
"getLayoutState": (options?: LayoutStateOptions) => Promise<ComponentLayoutState>;
|
|
@@ -1668,6 +1715,10 @@ export namespace Components {
|
|
|
1668
1715
|
* @default ""
|
|
1669
1716
|
*/
|
|
1670
1717
|
"filter": string;
|
|
1718
|
+
/**
|
|
1719
|
+
* The line this table wants to be aligned on, in CSS px from the host's top-left corner: `y` is the bottom of the header, `x` the left edge of the first value column. Empty before the table has drawn.
|
|
1720
|
+
*/
|
|
1721
|
+
"getBaseline": () => Promise<Baseline>;
|
|
1671
1722
|
/**
|
|
1672
1723
|
* Lazily generates this table's layout state: host box (context- and component-relative, CSS px), header/body regions, row/column/cell counts, diagnostics and resolved scaling. With `detail: "full"` every cell is listed with its geometry, model value, column key and in-cell bar chart.
|
|
1673
1724
|
* @param options - `{ detail: "summary" | "full" }`, default `"summary"`
|
|
@@ -2358,7 +2409,9 @@ declare global {
|
|
|
2358
2409
|
/**
|
|
2359
2410
|
* CSS Grid layout container with optional row/column headers.
|
|
2360
2411
|
* Child components are placed into named slots (`row-col` convention).
|
|
2361
|
-
* Supports configurable borders, title, and header visibility.
|
|
2412
|
+
* Supports configurable borders, title, and header visibility. Cells can
|
|
2413
|
+
* have equal sizes, a caption, and aligned content; `baseline` lines up the
|
|
2414
|
+
* axes of charts (and the header of tables) in a row or column.
|
|
2362
2415
|
*/
|
|
2363
2416
|
interface HTMLBnGridElement extends Components.BnGrid, HTMLStencilElement {
|
|
2364
2417
|
}
|
|
@@ -3273,14 +3326,41 @@ declare namespace LocalJSX {
|
|
|
3273
3326
|
/**
|
|
3274
3327
|
* CSS Grid layout container with optional row/column headers.
|
|
3275
3328
|
* Child components are placed into named slots (`row-col` convention).
|
|
3276
|
-
* Supports configurable borders, title, and header visibility.
|
|
3329
|
+
* Supports configurable borders, title, and header visibility. Cells can
|
|
3330
|
+
* have equal sizes, a caption, and aligned content; `baseline` lines up the
|
|
3331
|
+
* axes of charts (and the header of tables) in a row or column.
|
|
3277
3332
|
*/
|
|
3278
3333
|
interface BnGrid {
|
|
3334
|
+
/**
|
|
3335
|
+
* JSON object from slot name to a caption, drawn top left in the cell above its content: '{"0-0": "Berlin", "0-1": "Cologne"}'. Alignment moves the content, never the caption. The style section `bn-grid` sets its font.
|
|
3336
|
+
* @default ""
|
|
3337
|
+
*/
|
|
3338
|
+
"cellCaptions"?: string;
|
|
3279
3339
|
/**
|
|
3280
3340
|
* Gap between cells. Accepts CSS values (e.g., '0px', '8px').
|
|
3281
3341
|
* @default "0px"
|
|
3282
3342
|
*/
|
|
3283
3343
|
"cellGap"?: string;
|
|
3344
|
+
/**
|
|
3345
|
+
* Height of the data rows: `auto` (default) sizes each row to its content, `equal` gives every data row the height of the tallest one.
|
|
3346
|
+
* @default "auto"
|
|
3347
|
+
*/
|
|
3348
|
+
"cellHeight"?: string;
|
|
3349
|
+
/**
|
|
3350
|
+
* Horizontal position of the content in a cell: `left` (default), `center`, `right`, or `baseline`. `baseline` lines up the components of a column on their baseline (the vertical axis of a chart, the first value column of a table); a component without one stays left.
|
|
3351
|
+
* @default "left"
|
|
3352
|
+
*/
|
|
3353
|
+
"cellHorizontalAlign"?: string;
|
|
3354
|
+
/**
|
|
3355
|
+
* Vertical position of the content in a cell: `top` (default), `center`, `bottom`, or `baseline`. `baseline` lines up the components of a row on their baseline (the axis of a chart, the bottom of a table header); a component without one goes to the bottom.
|
|
3356
|
+
* @default "top"
|
|
3357
|
+
*/
|
|
3358
|
+
"cellVerticalAlign"?: string;
|
|
3359
|
+
/**
|
|
3360
|
+
* Width of the data columns: `auto` (default) sizes each column to its content, `equal` makes the grid as wide as its container and gives every data column the same share of it.
|
|
3361
|
+
* @default "auto"
|
|
3362
|
+
*/
|
|
3363
|
+
"cellWidth"?: string;
|
|
3284
3364
|
/**
|
|
3285
3365
|
* Title displayed at top-left of the grid.
|
|
3286
3366
|
* @default ""
|
|
@@ -4151,6 +4231,11 @@ declare namespace LocalJSX {
|
|
|
4151
4231
|
"showBorders": boolean;
|
|
4152
4232
|
"rowHeaderWidth": string;
|
|
4153
4233
|
"cellGap": string;
|
|
4234
|
+
"cellHeight": string;
|
|
4235
|
+
"cellWidth": string;
|
|
4236
|
+
"cellVerticalAlign": string;
|
|
4237
|
+
"cellHorizontalAlign": string;
|
|
4238
|
+
"cellCaptions": string;
|
|
4154
4239
|
}
|
|
4155
4240
|
interface BnImageAttributes {
|
|
4156
4241
|
"selectedStyle": string;
|
|
@@ -4502,7 +4587,9 @@ declare module "@stencil/core" {
|
|
|
4502
4587
|
/**
|
|
4503
4588
|
* CSS Grid layout container with optional row/column headers.
|
|
4504
4589
|
* Child components are placed into named slots (`row-col` convention).
|
|
4505
|
-
* Supports configurable borders, title, and header visibility.
|
|
4590
|
+
* Supports configurable borders, title, and header visibility. Cells can
|
|
4591
|
+
* have equal sizes, a caption, and aligned content; `baseline` lines up the
|
|
4592
|
+
* axes of charts (and the header of tables) in a row or column.
|
|
4506
4593
|
*/
|
|
4507
4594
|
"bn-grid": LocalJSX.IntrinsicElements["bn-grid"] & JSXBase.HTMLAttributes<HTMLBnGridElement>;
|
|
4508
4595
|
"bn-image": LocalJSX.IntrinsicElements["bn-image"] & JSXBase.HTMLAttributes<HTMLBnImageElement>;
|
|
@@ -30,6 +30,12 @@ export interface GridStyle {
|
|
|
30
30
|
borderColor: string;
|
|
31
31
|
borderWidth: number;
|
|
32
32
|
cellPadding: number;
|
|
33
|
+
/** Cell caption (`cell-captions`): font size in px. */
|
|
34
|
+
captionFontSize: number;
|
|
35
|
+
captionFontWeight: string;
|
|
36
|
+
captionColor: string;
|
|
37
|
+
/** Space below a cell caption, in px. */
|
|
38
|
+
captionGap: number;
|
|
33
39
|
}
|
|
34
40
|
/** Top-level style object grouping global defaults and per-component overrides. */
|
|
35
41
|
export interface Style {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Baseline } from "./types";
|
|
2
|
+
/** Marks the element a chart wants to be aligned on, where its markup has no other stable hook. */
|
|
3
|
+
export declare const BASELINE_ATTRIBUTE = "data-bn-baseline";
|
|
4
|
+
/**
|
|
5
|
+
* Baseline of a chart segment SVG, in the layout px of `host`: the first
|
|
6
|
+
* marked frame or axis line, else the first line of the `#axis` group. `{}`
|
|
7
|
+
* when there is none, for example before the chart has drawn.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readSvgBaseline(svgRoot: ParentNode, host: Element): Baseline;
|
|
10
|
+
/** Baseline of the first `innerTag` renderer in a chart facade (the base segment, in DOM order). */
|
|
11
|
+
export declare function readChartBaseline(host: HTMLElement, innerTag: string): Baseline;
|
|
12
|
+
/**
|
|
13
|
+
* Baseline of a rendered `<table>`, in the layout px of `host`: y is the
|
|
14
|
+
* bottom of the header, x the left edge of the first value column (the cell
|
|
15
|
+
* after the category column of the last header row, else of the first body row).
|
|
16
|
+
*/
|
|
17
|
+
export declare function readTableBaseline(table: Element | null | undefined, host: Element): Baseline;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LayoutRect } from "./types";
|
|
2
|
+
type ViewportRect = {
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
/** Maps viewport boxes into the layout px of an element (origin at its top-left corner). */
|
|
9
|
+
export interface LocalFrame {
|
|
10
|
+
toLocal(rect: ViewportRect): LayoutRect;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The layout frame of an element, also on a turned or scaled page. A
|
|
14
|
+
* viewport box is axis-aligned there, so it maps to the box its corners span.
|
|
15
|
+
*/
|
|
16
|
+
export declare function localFrameOf(el: Element): LocalFrame;
|
|
17
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Origins } from "./geometry";
|
|
2
|
-
import { ComponentLayoutState, EmContext, LayoutElement, LayoutRegion } from "./types";
|
|
2
|
+
import { Baseline, ComponentLayoutState, EmContext, LayoutElement, LayoutRegion } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* Walks one time/structure chart segment SVG (`svg#drawCanvas`) and classifies
|
|
5
5
|
* its rendered elements by the chart's stable group-id conventions:
|
|
@@ -17,6 +17,8 @@ export interface ChartFacadeLayout {
|
|
|
17
17
|
elements?: LayoutElement[];
|
|
18
18
|
/** Category/bar count of the base segment. */
|
|
19
19
|
barCount: number;
|
|
20
|
+
/** Baseline of the base segment's axis line. */
|
|
21
|
+
baseline: Baseline;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Walks a chart facade's inner segment components (one per base/variance
|
|
@@ -164,12 +164,12 @@ export interface EdgeElement extends LayoutElementBase {
|
|
|
164
164
|
path?: string;
|
|
165
165
|
}
|
|
166
166
|
export interface GridCellElement extends LayoutElementBase {
|
|
167
|
-
kind: "gridCell" | "gridHeader" | "gridTitle";
|
|
167
|
+
kind: "gridCell" | "gridHeader" | "gridTitle" | "gridCaption";
|
|
168
168
|
rowId?: string;
|
|
169
169
|
columnId?: string;
|
|
170
170
|
/** Slot name for data cells. */
|
|
171
171
|
slot?: string;
|
|
172
|
-
/** Header
|
|
172
|
+
/** Header, title or caption text. */
|
|
173
173
|
label?: string;
|
|
174
174
|
}
|
|
175
175
|
export type LayoutElement = BarElement | LabelElement | AxisElement | PointElement | CellElement | NodeElement | EdgeElement | GridCellElement;
|
|
@@ -212,6 +212,14 @@ export interface ComponentMetadata {
|
|
|
212
212
|
measureScale?: string;
|
|
213
213
|
hasNoData?: boolean;
|
|
214
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* The line a component wants to be aligned on, in CSS px from the component
|
|
217
|
+
* host's top-left corner. A missing coordinate means no baseline on that axis.
|
|
218
|
+
*/
|
|
219
|
+
export interface Baseline {
|
|
220
|
+
x?: number;
|
|
221
|
+
y?: number;
|
|
222
|
+
}
|
|
215
223
|
export interface ComponentLayoutState {
|
|
216
224
|
version: typeof LAYOUT_STATE_VERSION;
|
|
217
225
|
tag: string;
|
|
@@ -226,6 +234,8 @@ export interface ComponentLayoutState {
|
|
|
226
234
|
/** Parsed `has-error` items of the component. */
|
|
227
235
|
diagnostics: LayoutDiagnosticItem[];
|
|
228
236
|
scaling?: ScalingInfo;
|
|
237
|
+
/** Charts and bn-table: see their `getBaseline()`. */
|
|
238
|
+
baseline?: Baseline;
|
|
229
239
|
/** Present only with `detail: "full"` on rich components. */
|
|
230
240
|
elements?: LayoutElement[];
|
|
231
241
|
/** Present only with `detail: "full"` on bn-table. */
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,a as e,g as r}from"./p-CCZcKl0Q.js";import{LAYOUT_STATE_VERSION as o}from"./index.esm.js";import{o as s,r as n,m as d,a as l}from"./p-D_DzKxRV.js";import{w as a,a as h}from"./p-yc69rwuH.js";import{w as u,a as c}from"./p-Z2rUaSh_.js";function g(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,r,o;return"string"==typeof t?{label:t,id:String(i)}:"object"==typeof t&&null!==t?{label:null!==(r=null!==(e=t.label)&&void 0!==e?e:t.name)&&void 0!==r?r:String(i),id:null!==(o=t.id)&&void 0!==o?o:String(i)}:{label:String(t),id:String(i)}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function v(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);if(!Array.isArray(i))return["Headers must be an array"];const e=[],r=new Set;return i.forEach(((t,i)=>{"object"==typeof t&&null!==t&&void 0!==t.id&&("string"!=typeof t.id?e.push(`Header[${i}]: 'id' must be a string`):r.has(t.id)?e.push(`Header[${i}]: duplicate id '${t.id}'`):r.add(t.id),void 0!==t.label&&"string"!=typeof t.label&&e.push(`Header[${i}]: 'label' must be a string`))})),e}catch(t){return console.error("validateHeadersJson: failed to parse JSON",t),["Invalid JSON structure"]}}const f=class{validateRowHeaders(t){const i="ERR_rowHeaders",e=v(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:`row-headers: ${e.join("; ")}`}):this.errors.remove(i),this.updateGridConfig()}validateColumnHeaders(t){const i="ERR_columnHeaders",e=v(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:`column-headers: ${e.join("; ")}`}):this.errors.remove(i),this.updateGridConfig()}constructor(i){t(this,i),this.gridConfig={rows:[],columns:[]},this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders=!0,this.showColumnHeaders=!0,this.showBorders=!0,this.rowHeaderWidth="auto",this.cellGap="0px",u(this),a(this),this.errors=h(this),this.componentStyle=c(this)}async getLayoutState(t){var i,e,r,a;const h=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",u=s(this.element),c=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),{rows:g,columns:v}=this.gridConfig,f={version:o,tag:this.element.localName,id:l(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:d(this.element,u),em:{fontSizePx:c,appliedScaleFactor:1},regions:[],metadata:{title:this.chartTitle||void 0,rowCount:g.length,columnCount:v.length,cellCount:g.length*v.length},diagnostics:n(this.element)},p=null===(r=this.element.shadowRoot)||void 0===r?void 0:r.querySelector(".grid-container");if(p&&f.regions.push({id:"grid",rect:d(p,u)}),"full"!==h||!p)return f;const m=[],b=t=>m.push(t),y=p.querySelector(".grid-title");return y&&b({kind:"gridTitle",label:(null===(a=y.textContent)||void 0===a?void 0:a.trim())||void 0,rect:d(y,u)}),p.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,r;b({kind:"gridHeader",columnId:null===(e=v[i])||void 0===e?void 0:e.id,label:(null===(r=t.textContent)||void 0===r?void 0:r.trim())||void 0,rect:d(t,u)})})),p.querySelectorAll(".grid-header-row").forEach(((t,i)=>{var e,r;b({kind:"gridHeader",rowId:null===(e=g[i])||void 0===e?void 0:e.id,label:(null===(r=t.textContent)||void 0===r?void 0:r.trim())||void 0,rect:d(t,u)})})),p.querySelectorAll(".grid-cell").forEach(((t,i)=>{var e,r,o,s;b({kind:"gridCell",rowId:v.length>0?null===(e=g[Math.floor(i/v.length)])||void 0===e?void 0:e.id:void 0,columnId:v.length>0?null===(r=v[i%v.length])||void 0===r?void 0:r.id:void 0,slot:null!==(s=null===(o=t.querySelector("slot"))||void 0===o?void 0:o.getAttribute("name"))&&void 0!==s?s:void 0,rect:d(t,u)})})),f.elements=m,f}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders)}updateGridConfig(){var t;this.gridConfig=(t=this.columnHeaders,{rows:g(this.rowHeaders),columns:g(t)})}shouldShowRowHeaders(){return this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return this.showBorders}getGridTemplateColumns(){const t=[];this.shouldShowRowHeaders()&&t.push(this.rowHeaderWidth);const i=this.gridConfig.columns.length||1;for(let e=0;e<i;e++)t.push("auto");return t.join(" ")}getGridTemplateRows(){const t=[];this.chartTitle&&t.push("auto"),this.shouldShowColumnHeaders()&&t.push("auto");const i=this.gridConfig.rows.length||1;for(let e=0;e<i;e++)t.push("auto");return t.join(" ")}renderTitle(){if(!this.chartTitle)return null;const t=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return i("div",{class:"grid-title",style:{"grid-column":`1 / span ${t}`,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const t=this.getGridStyle(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,o=this.chartTitle?2:1;return this.gridConfig.columns.map(((s,n)=>{const d=n>0;return i("div",{key:`col-header-${s.id}`,class:"grid-header grid-header-col",style:{"grid-column":String(r+n),"grid-row":String(o),"border-left":d?e:"none",padding:`${t.cellPadding}px`,"padding-left":d?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},s.label)}))}renderDataCells(){const t=this.getGridStyle(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,o=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,s=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((n,d)=>{if(this.shouldShowRowHeaders()){const r=d>0;s.push(i("div",{key:`row-header-${n.id}`,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":String(o+d),"border-top":r?e:"none",padding:`${t.cellPadding}px`,"padding-top":r?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},n.label))}this.gridConfig.columns.forEach(((l,a)=>{const h=function(t,i){return`${t.id}-${i.id}`}(n,l),u=a>0,c=d>0;s.push(i("div",{key:`cell-${h}`,class:"grid-cell",style:{"grid-column":String(r+a),"grid-row":String(o+d),"border-left":u?e:"none","border-top":c?e:"none","padding-left":u?`${t.cellPadding+4}px`:"0","padding-top":c?`${t.cellPadding+4}px`:"0"}},i("slot",{name:h})))}))})),s}getFontStyles(){return this.componentStyle((t=>{var i,e,r,o;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(r=t.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(o=t.global)||void 0===o?void 0:o.fontBackgroundColor)||"#ffffff"}}))}render(){const t={display:"inline-grid","grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap};return i(e,{key:"866de326e2061abf7412529359321353c1bf39d8",style:this.getFontStyles()},i("div",{key:"e3f6e16ecf4ae07f947fb35d1a10c16fddefd994",class:"grid-container",style:t},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),i("slot",{key:"8300412918e5d35ebfcaabdb4aa1ca05e4242707"}))}get element(){return r(this)}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}]}}};f.style=':host{display:inline-block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}';export{f as bn_grid}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s,a as i,g as o}from"./p-CCZcKl0Q.js";import{w as n,a as r}from"./p-Z2rUaSh_.js";import{w as e,a,g as l}from"./p-yc69rwuH.js";const h=class{constructor(s){t(this,s),n(this),e(this),this.errors=a(this),this.componentStyle=r(this)}connectedCallback(){this.stores=l(this.element)}getFontStyles(){return this.componentStyle((t=>{var s,i,o,n;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(o=t.global)||void 0===o?void 0:o.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}prepareAssetUrl(t){if(null==t||""===t)return"";const s=this.stores.assets.state;return t.startsWith("asset:")?s[t.substring(6)]:s[t]||t}render(){return s(i,{key:"b303581057c183cc27eb13cfdc389c6b008e9172",style:this.getFontStyles()},null!=this.source&&""!==this.source?s("img",{src:this.prepareAssetUrl(this.source)}):"")}get element(){return o(this)}};h.style=":host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}";export{h as bn_image}
|