graphein 0.20.0 → 0.22.0
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/animation/animate.d.ts +6 -1
- package/dist/animation/animate.d.ts.map +1 -1
- package/dist/animation/animate.js +2 -2
- package/dist/animation/animate.js.map +2 -2
- package/dist/animation/env.d.ts +5 -0
- package/dist/animation/env.d.ts.map +1 -1
- package/dist/animation/env.js +4 -0
- package/dist/animation/env.js.map +2 -2
- package/dist/animation/index.d.ts +1 -0
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/animation/index.js +1 -0
- package/dist/animation/index.js.map +2 -2
- package/dist/animation/stagger.d.ts +13 -0
- package/dist/animation/stagger.d.ts.map +1 -0
- package/dist/animation/stagger.js +13 -0
- package/dist/animation/stagger.js.map +7 -0
- package/dist/axes/draw.d.ts +5 -1
- package/dist/axes/draw.d.ts.map +1 -1
- package/dist/axes/draw.js +13 -1
- package/dist/axes/draw.js.map +2 -2
- package/dist/axes/morph.d.ts +111 -0
- package/dist/axes/morph.d.ts.map +1 -0
- package/dist/axes/morph.js +207 -0
- package/dist/axes/morph.js.map +7 -0
- package/dist/axes/overlay.d.ts.map +1 -1
- package/dist/axes/overlay.js +88 -25
- package/dist/axes/overlay.js.map +2 -2
- package/dist/axes/text.d.ts +2 -0
- package/dist/axes/text.d.ts.map +1 -1
- package/dist/axes/text.js +1 -0
- package/dist/axes/text.js.map +2 -2
- package/dist/axes/tickLabels.d.ts +2 -0
- package/dist/axes/tickLabels.d.ts.map +1 -1
- package/dist/axes/tickLabels.js +2 -2
- package/dist/axes/tickLabels.js.map +2 -2
- package/dist/charts/annotations.d.ts +9 -3
- package/dist/charts/annotations.d.ts.map +1 -1
- package/dist/charts/annotations.js +82 -27
- package/dist/charts/annotations.js.map +2 -2
- package/dist/charts/area.d.ts +37 -1
- package/dist/charts/area.d.ts.map +1 -1
- package/dist/charts/area.js +35 -17
- package/dist/charts/area.js.map +2 -2
- package/dist/charts/bar.d.ts +53 -0
- package/dist/charts/bar.d.ts.map +1 -1
- package/dist/charts/bar.js +117 -83
- package/dist/charts/bar.js.map +2 -2
- package/dist/charts/box.d.ts +31 -0
- package/dist/charts/box.d.ts.map +1 -1
- package/dist/charts/box.js +93 -70
- package/dist/charts/box.js.map +2 -2
- package/dist/charts/bubbleMap.d.ts +20 -0
- package/dist/charts/bubbleMap.d.ts.map +1 -0
- package/dist/charts/bubbleMap.js +951 -0
- package/dist/charts/bubbleMap.js.map +7 -0
- package/dist/charts/bullet.d.ts.map +1 -1
- package/dist/charts/bullet.js +69 -51
- package/dist/charts/bullet.js.map +2 -2
- package/dist/charts/calendarHeatmap.d.ts.map +1 -1
- package/dist/charts/calendarHeatmap.js +56 -19
- package/dist/charts/calendarHeatmap.js.map +2 -2
- package/dist/charts/candlestick.d.ts +40 -0
- package/dist/charts/candlestick.d.ts.map +1 -0
- package/dist/charts/candlestick.js +325 -0
- package/dist/charts/candlestick.js.map +7 -0
- package/dist/charts/choropleth.d.ts.map +1 -1
- package/dist/charts/choropleth.js +46 -67
- package/dist/charts/choropleth.js.map +2 -2
- package/dist/charts/combo.d.ts.map +1 -1
- package/dist/charts/combo.js +127 -27
- package/dist/charts/combo.js.map +3 -3
- package/dist/charts/dumbbell.d.ts.map +1 -1
- package/dist/charts/dumbbell.js +100 -31
- package/dist/charts/dumbbell.js.map +2 -2
- package/dist/charts/funnel.d.ts.map +1 -1
- package/dist/charts/funnel.js +93 -28
- package/dist/charts/funnel.js.map +3 -3
- package/dist/charts/gantt.d.ts +22 -0
- package/dist/charts/gantt.d.ts.map +1 -0
- package/dist/charts/gantt.js +564 -0
- package/dist/charts/gantt.js.map +7 -0
- package/dist/charts/gauge.d.ts.map +1 -1
- package/dist/charts/gauge.js +30 -4
- package/dist/charts/gauge.js.map +2 -2
- package/dist/charts/geo.d.ts +87 -0
- package/dist/charts/geo.d.ts.map +1 -0
- package/dist/charts/geo.js +140 -0
- package/dist/charts/geo.js.map +7 -0
- package/dist/charts/geometry.d.ts +20 -0
- package/dist/charts/geometry.d.ts.map +1 -0
- package/dist/charts/geometry.js +25 -0
- package/dist/charts/geometry.js.map +7 -0
- package/dist/charts/heatmap.d.ts.map +1 -1
- package/dist/charts/heatmap.js +58 -49
- package/dist/charts/heatmap.js.map +2 -2
- package/dist/charts/histogram.d.ts +1 -1
- package/dist/charts/histogram.d.ts.map +1 -1
- package/dist/charts/histogram.js +49 -31
- package/dist/charts/histogram.js.map +2 -2
- package/dist/charts/index.d.ts +35 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/index.js +12 -0
- package/dist/charts/index.js.map +2 -2
- package/dist/charts/legibility.d.ts +38 -0
- package/dist/charts/legibility.d.ts.map +1 -0
- package/dist/charts/legibility.js +72 -0
- package/dist/charts/legibility.js.map +7 -0
- package/dist/charts/line.d.ts +39 -1
- package/dist/charts/line.d.ts.map +1 -1
- package/dist/charts/line.js +48 -16
- package/dist/charts/line.js.map +2 -2
- package/dist/charts/matrix.d.ts +2 -1
- package/dist/charts/matrix.d.ts.map +1 -1
- package/dist/charts/matrix.js +481 -319
- package/dist/charts/matrix.js.map +3 -3
- package/dist/charts/morphFrame.d.ts +83 -0
- package/dist/charts/morphFrame.d.ts.map +1 -0
- package/dist/charts/morphFrame.js +128 -0
- package/dist/charts/morphFrame.js.map +7 -0
- package/dist/charts/pie.d.ts.map +1 -1
- package/dist/charts/pie.js +89 -26
- package/dist/charts/pie.js.map +2 -2
- package/dist/charts/pieState.d.ts +27 -0
- package/dist/charts/pieState.d.ts.map +1 -0
- package/dist/charts/pieState.js +55 -0
- package/dist/charts/pieState.js.map +7 -0
- package/dist/charts/radar.d.ts +62 -0
- package/dist/charts/radar.d.ts.map +1 -0
- package/dist/charts/radar.js +912 -0
- package/dist/charts/radar.js.map +7 -0
- package/dist/charts/radialBar.d.ts +60 -0
- package/dist/charts/radialBar.d.ts.map +1 -0
- package/dist/charts/radialBar.js +708 -0
- package/dist/charts/radialBar.js.map +7 -0
- package/dist/charts/sankey.d.ts.map +1 -1
- package/dist/charts/sankey.js +223 -57
- package/dist/charts/sankey.js.map +3 -3
- package/dist/charts/scatter.d.ts +31 -0
- package/dist/charts/scatter.d.ts.map +1 -1
- package/dist/charts/scatter.js +48 -12
- package/dist/charts/scatter.js.map +2 -2
- package/dist/charts/slope.d.ts.map +1 -1
- package/dist/charts/slope.js +55 -3
- package/dist/charts/slope.js.map +2 -2
- package/dist/charts/sunburst.d.ts +14 -0
- package/dist/charts/sunburst.d.ts.map +1 -0
- package/dist/charts/sunburst.js +885 -0
- package/dist/charts/sunburst.js.map +7 -0
- package/dist/charts/table.d.ts +2 -1
- package/dist/charts/table.d.ts.map +1 -1
- package/dist/charts/table.js +214 -224
- package/dist/charts/table.js.map +3 -3
- package/dist/charts/tableView/canvas.d.ts +16 -1
- package/dist/charts/tableView/canvas.d.ts.map +1 -1
- package/dist/charts/tableView/canvas.js +361 -252
- package/dist/charts/tableView/canvas.js.map +3 -3
- package/dist/charts/tableView/conditional.d.ts +66 -40
- package/dist/charts/tableView/conditional.d.ts.map +1 -1
- package/dist/charts/tableView/conditional.js +163 -256
- package/dist/charts/tableView/conditional.js.map +3 -3
- package/dist/charts/tableView/dom.d.ts +26 -2
- package/dist/charts/tableView/dom.d.ts.map +1 -1
- package/dist/charts/tableView/dom.js +609 -269
- package/dist/charts/tableView/dom.js.map +3 -3
- package/dist/charts/tableView/layout.d.ts +22 -0
- package/dist/charts/tableView/layout.d.ts.map +1 -0
- package/dist/charts/tableView/layout.js +246 -0
- package/dist/charts/tableView/layout.js.map +7 -0
- package/dist/charts/tableView/sketch.d.ts +3 -2
- package/dist/charts/tableView/sketch.d.ts.map +1 -1
- package/dist/charts/tableView/sketch.js +2 -2
- package/dist/charts/tableView/sketch.js.map +2 -2
- package/dist/charts/tableView/sketchBar.d.ts +7 -0
- package/dist/charts/tableView/sketchBar.d.ts.map +1 -0
- package/dist/charts/tableView/sketchBar.js +32 -0
- package/dist/charts/tableView/sketchBar.js.map +7 -0
- package/dist/charts/tableView/sort.d.ts +9 -0
- package/dist/charts/tableView/sort.d.ts.map +1 -0
- package/dist/charts/tableView/sort.js +70 -0
- package/dist/charts/tableView/sort.js.map +7 -0
- package/dist/charts/tableView/sparkline.d.ts +30 -0
- package/dist/charts/tableView/sparkline.d.ts.map +1 -0
- package/dist/charts/tableView/sparkline.js +63 -0
- package/dist/charts/tableView/sparkline.js.map +7 -0
- package/dist/charts/tableView/style.d.ts +67 -0
- package/dist/charts/tableView/style.d.ts.map +1 -0
- package/dist/charts/tableView/style.js +131 -0
- package/dist/charts/tableView/style.js.map +7 -0
- package/dist/charts/tableView/types.d.ts +69 -46
- package/dist/charts/tableView/types.d.ts.map +1 -1
- package/dist/charts/tableView/types.js +22 -87
- package/dist/charts/tableView/types.js.map +2 -2
- package/dist/charts/tableView.d.ts +10 -5
- package/dist/charts/tableView.d.ts.map +1 -1
- package/dist/charts/tableView.js +12 -8
- package/dist/charts/tableView.js.map +2 -2
- package/dist/charts/treemap.d.ts.map +1 -1
- package/dist/charts/treemap.js +177 -68
- package/dist/charts/treemap.js.map +3 -3
- package/dist/charts/trendline.d.ts +13 -5
- package/dist/charts/trendline.d.ts.map +1 -1
- package/dist/charts/trendline.js +205 -56
- package/dist/charts/trendline.js.map +2 -2
- package/dist/charts/waterfall.d.ts.map +1 -1
- package/dist/charts/waterfall.js +76 -5
- package/dist/charts/waterfall.js.map +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interaction/cartesian.d.ts +4 -1
- package/dist/interaction/cartesian.d.ts.map +1 -1
- package/dist/interaction/cartesian.js +104 -34
- package/dist/interaction/cartesian.js.map +2 -2
- package/dist/interaction/controller.d.ts +29 -1
- package/dist/interaction/controller.d.ts.map +1 -1
- package/dist/interaction/controller.js +131 -8
- package/dist/interaction/controller.js.map +2 -2
- package/dist/interaction/focus.d.ts +23 -0
- package/dist/interaction/focus.d.ts.map +1 -0
- package/dist/interaction/focus.js +65 -0
- package/dist/interaction/focus.js.map +7 -0
- package/dist/interaction/tooltip.d.ts +6 -0
- package/dist/interaction/tooltip.d.ts.map +1 -1
- package/dist/interaction/tooltip.js +41 -16
- package/dist/interaction/tooltip.js.map +2 -2
- package/dist/interaction/types.d.ts +19 -0
- package/dist/interaction/types.d.ts.map +1 -1
- package/dist/interaction/veil.d.ts +25 -0
- package/dist/interaction/veil.d.ts.map +1 -0
- package/dist/interaction/veil.js +35 -0
- package/dist/interaction/veil.js.map +7 -0
- package/dist/pivot/pivot.d.ts +18 -0
- package/dist/pivot/pivot.d.ts.map +1 -1
- package/dist/pivot/pivot.js +46 -34
- package/dist/pivot/pivot.js.map +2 -2
- package/dist/render/chromeMotion.d.ts +65 -0
- package/dist/render/chromeMotion.d.ts.map +1 -0
- package/dist/render/chromeMotion.js +79 -0
- package/dist/render/chromeMotion.js.map +7 -0
- package/dist/render/pathSample.d.ts +24 -0
- package/dist/render/pathSample.d.ts.map +1 -0
- package/dist/render/pathSample.js +76 -0
- package/dist/render/pathSample.js.map +7 -0
- package/dist/render/transient.d.ts +18 -0
- package/dist/render/transient.d.ts.map +1 -0
- package/dist/render/transient.js +19 -0
- package/dist/render/transient.js.map +7 -0
- package/dist/runtime/candlestick.d.ts +112 -0
- package/dist/runtime/candlestick.d.ts.map +1 -0
- package/dist/runtime/candlestick.js +531 -0
- package/dist/runtime/candlestick.js.map +7 -0
- package/dist/runtime/cartesian.d.ts +14 -3
- package/dist/runtime/cartesian.d.ts.map +1 -1
- package/dist/runtime/cartesian.js.map +2 -2
- package/dist/runtime/chartAnimation.d.ts +54 -7
- package/dist/runtime/chartAnimation.d.ts.map +1 -1
- package/dist/runtime/chartAnimation.js +146 -28
- package/dist/runtime/chartAnimation.js.map +2 -2
- package/dist/runtime/chartRuntime.d.ts +42 -0
- package/dist/runtime/chartRuntime.d.ts.map +1 -1
- package/dist/runtime/chartRuntime.js +196 -30
- package/dist/runtime/chartRuntime.js.map +2 -2
- package/dist/runtime/dashboardDom.d.ts.map +1 -1
- package/dist/runtime/dashboardDom.js +45 -0
- package/dist/runtime/dashboardDom.js.map +2 -2
- package/dist/runtime/facet.d.ts +1 -1
- package/dist/runtime/facet.d.ts.map +1 -1
- package/dist/runtime/gantt.d.ts +137 -0
- package/dist/runtime/gantt.d.ts.map +1 -0
- package/dist/runtime/gantt.js +647 -0
- package/dist/runtime/gantt.js.map +7 -0
- package/dist/runtime/morph.d.ts +33 -0
- package/dist/runtime/morph.d.ts.map +1 -0
- package/dist/runtime/morph.js +332 -0
- package/dist/runtime/morph.js.map +7 -0
- package/dist/runtime/radar.d.ts +75 -0
- package/dist/runtime/radar.d.ts.map +1 -0
- package/dist/runtime/radar.js +201 -0
- package/dist/runtime/radar.js.map +7 -0
- package/dist/runtime/radialBar.d.ts +81 -0
- package/dist/runtime/radialBar.d.ts.map +1 -0
- package/dist/runtime/radialBar.js +125 -0
- package/dist/runtime/radialBar.js.map +7 -0
- package/dist/runtime/report/constants.d.ts +2 -2
- package/dist/runtime/report/constants.d.ts.map +1 -1
- package/dist/runtime/runtimeShared.d.ts +3 -3
- package/dist/runtime/runtimeShared.d.ts.map +1 -1
- package/dist/runtime/sunburst.d.ts +74 -0
- package/dist/runtime/sunburst.d.ts.map +1 -0
- package/dist/runtime/sunburst.js +150 -0
- package/dist/runtime/sunburst.js.map +7 -0
- package/dist/runtime/wire.d.ts.map +1 -1
- package/dist/runtime/wire.js +3 -1
- package/dist/runtime/wire.js.map +2 -2
- package/dist/shape/arc.d.ts +15 -2
- package/dist/shape/arc.d.ts.map +1 -1
- package/dist/shape/arc.js +204 -32
- package/dist/shape/arc.js.map +2 -2
- package/dist/spec/chartDefinitions.d.ts +6 -0
- package/dist/spec/chartDefinitions.d.ts.map +1 -1
- package/dist/spec/chartDefinitions.js +7 -1
- package/dist/spec/chartDefinitions.js.map +2 -2
- package/dist/spec/templates.d.ts.map +1 -1
- package/dist/spec/templates.js +177 -2
- package/dist/spec/templates.js.map +2 -2
- package/dist/spec/types.d.ts +258 -6
- package/dist/spec/types.d.ts.map +1 -1
- package/dist/spec/types.js +6 -0
- package/dist/spec/types.js.map +2 -2
- package/dist/spec/validate/charts.js +147 -15
- package/dist/spec/validate/charts.js.map +2 -2
- package/dist/spec/validate/common.d.ts +6 -0
- package/dist/spec/validate/common.d.ts.map +1 -1
- package/dist/spec/validate/overlays.js +2 -2
- package/dist/spec/validate/overlays.js.map +2 -2
- package/dist/spec/validate.data.d.ts.map +1 -1
- package/dist/spec/validate.data.js +8 -3
- package/dist/spec/validate.data.js.map +2 -2
- package/package.json +1 -1
|
@@ -4,18 +4,27 @@ import type { ThemeTokens } from '../../theme/index.js';
|
|
|
4
4
|
import type { FieldType, Rect } from '../../types.js';
|
|
5
5
|
import type { EvidenceLedger, DataRepresentation } from '../../render/evidence.js';
|
|
6
6
|
import type { LabelLedger } from '../../render/labelLedger.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const DEFAULT_BODY_ROW_HEIGHT = 30;
|
|
10
|
-
export declare const FILL_EPS = 0.5;
|
|
7
|
+
import type { ColumnFormatter } from './conditional.js';
|
|
8
|
+
import type { TableDensity, TableGridlines } from './style.js';
|
|
11
9
|
/** A wobbly, asymmetric border-radius that reads as a hand-drawn frame. */
|
|
12
10
|
export declare const SKETCH_BORDER_RADIUS = "14px 6px 16px 7px / 7px 15px 6px 14px";
|
|
11
|
+
/** Line-chart, filled-area, or column sparkline drawn from a cell's numeric array. */
|
|
12
|
+
export interface ViewSparkline {
|
|
13
|
+
type: 'line' | 'area' | 'bar';
|
|
14
|
+
color?: string;
|
|
15
|
+
/** Shared column scale (comparable magnitudes) or per-row scale (shape only). */
|
|
16
|
+
domain: [number, number] | 'row';
|
|
17
|
+
}
|
|
13
18
|
export interface ViewColumn {
|
|
19
|
+
/** Field key used to read values (not necessarily unique). */
|
|
14
20
|
key: string;
|
|
21
|
+
/** Unique column identity (sort state, DOM classes). Defaults to the key. */
|
|
22
|
+
id?: string;
|
|
15
23
|
title: string;
|
|
16
24
|
align: 'left' | 'center' | 'right';
|
|
17
25
|
format?: string;
|
|
18
26
|
type?: FieldType;
|
|
27
|
+
/** Fixed width in CSS px. */
|
|
19
28
|
width?: number;
|
|
20
29
|
conditionalFormat?: ConditionalFormat;
|
|
21
30
|
isMeasure?: boolean;
|
|
@@ -25,6 +34,14 @@ export interface ViewColumn {
|
|
|
25
34
|
sortable?: boolean;
|
|
26
35
|
wrap?: boolean;
|
|
27
36
|
group?: string;
|
|
37
|
+
/** Draw the cell's numeric array as a sparkline instead of text. */
|
|
38
|
+
sparkline?: ViewSparkline;
|
|
39
|
+
/** Stepped hierarchy column of a matrix (indent + expand/collapse). */
|
|
40
|
+
rowHeader?: boolean;
|
|
41
|
+
/** A grand-total / subtotal value column of a matrix. */
|
|
42
|
+
total?: boolean;
|
|
43
|
+
/** Draws a separator before this column (column-group boundary). */
|
|
44
|
+
groupStart?: boolean;
|
|
28
45
|
}
|
|
29
46
|
export interface HeaderCell {
|
|
30
47
|
title: string;
|
|
@@ -33,71 +50,77 @@ export interface HeaderCell {
|
|
|
33
50
|
align?: 'left' | 'center' | 'right';
|
|
34
51
|
colIndex?: number;
|
|
35
52
|
}
|
|
53
|
+
export interface ViewCell {
|
|
54
|
+
value: unknown;
|
|
55
|
+
raw: number | string | null;
|
|
56
|
+
/** Free text (labels) rather than a value to format. */
|
|
57
|
+
label?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export type RowKind = 'leaf' | 'group' | 'subtotal' | 'grandtotal';
|
|
60
|
+
export interface ViewRowInfo {
|
|
61
|
+
kind: RowKind;
|
|
62
|
+
/** Hierarchy level for stepped row headers. */
|
|
63
|
+
depth: number;
|
|
64
|
+
expandable?: boolean;
|
|
65
|
+
expanded?: boolean;
|
|
66
|
+
/** Accessible name of the row (row-header text). */
|
|
67
|
+
label?: string;
|
|
68
|
+
}
|
|
36
69
|
export interface VisibleRange {
|
|
37
70
|
start: number;
|
|
38
71
|
end: number;
|
|
39
72
|
rowHeight: number;
|
|
40
73
|
}
|
|
41
|
-
|
|
42
|
-
|
|
74
|
+
/** What both the DOM and canvas table renderers consume. */
|
|
75
|
+
export interface TableViewInput {
|
|
43
76
|
tokens: ThemeTokens;
|
|
44
77
|
rect: Rect;
|
|
45
78
|
columns: ViewColumn[];
|
|
46
79
|
rowCount: number;
|
|
47
|
-
getCell(rowIndex: number, colIndex: number):
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
rowHeaderSpan?: number;
|
|
80
|
+
getCell(rowIndex: number, colIndex: number): ViewCell;
|
|
81
|
+
rowInfo?(rowIndex: number): ViewRowInfo;
|
|
82
|
+
/** Rows matching an active highlight are tinted. */
|
|
83
|
+
highlighted?(rowIndex: number): boolean;
|
|
84
|
+
/** Leading columns pinned while scrolling horizontally (the matrix row header). */
|
|
85
|
+
frozenColumns?: number;
|
|
54
86
|
striped?: boolean;
|
|
55
|
-
stickyHeader?: boolean;
|
|
56
|
-
onSort?(colIndex: number): void;
|
|
57
|
-
sortState?: {
|
|
58
|
-
col: number;
|
|
59
|
-
dir: 'asc' | 'desc';
|
|
60
|
-
};
|
|
61
87
|
conditionalDomains?: Array<[number, number] | null>;
|
|
88
|
+
/** Precompiled per-column formatters; built from `conditionalDomains` when omitted. */
|
|
89
|
+
formatters?: Array<ColumnFormatter | null>;
|
|
90
|
+
/** Conditional formats apply to these row kinds only (default: leaf rows). */
|
|
91
|
+
formatKinds?: readonly RowKind[];
|
|
92
|
+
/** Per-row formatter override (a matrix scales each hierarchy level separately); null leaves the row plain. */
|
|
93
|
+
rowFormatters?(rowIndex: number): ReadonlyArray<ColumnFormatter | null> | null;
|
|
94
|
+
/** Known [min, max] numeric extremes per column for width measurement. */
|
|
95
|
+
extremes?: Array<[number, number] | null>;
|
|
62
96
|
headerRows?: HeaderCell[][];
|
|
63
97
|
footerRow?: {
|
|
64
|
-
cells:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
98
|
+
cells: ViewCell[];
|
|
99
|
+
kind?: 'total' | 'grandtotal';
|
|
100
|
+
};
|
|
101
|
+
density?: TableDensity;
|
|
102
|
+
gridlines?: TableGridlines;
|
|
103
|
+
sortState?: {
|
|
104
|
+
col: number;
|
|
105
|
+
dir: 'asc' | 'desc';
|
|
69
106
|
};
|
|
70
|
-
|
|
71
|
-
visibleRange?: VisibleRange;
|
|
72
|
-
/** Render hand-drawn chrome (wobbly frame, grid, and data bars) for sketch
|
|
73
|
-
* mode. Carries the resolved rough style (roughness/bowing/seed/...) or null. */
|
|
107
|
+
/** Hand-drawn chrome (wobbly frame, grid, and data bars) or null. */
|
|
74
108
|
sketch?: ResolvedSketch | null;
|
|
75
|
-
/**
|
|
109
|
+
/** Column pixel widths, filled in by the renderer. */
|
|
76
110
|
widths?: number[];
|
|
77
111
|
evidence?: EvidenceLedger;
|
|
78
112
|
labels?: LabelLedger;
|
|
79
113
|
dataRepresentation?: DataRepresentation;
|
|
80
114
|
sourceRepresentedRows?: number;
|
|
81
|
-
refreshEvidence?: () => void;
|
|
82
115
|
}
|
|
83
|
-
export type CanvasTableOptions = Omit<BuildTableOptions, 'container' | 'onSort'> & {
|
|
84
|
-
ctx: CanvasRenderingContext2D;
|
|
85
|
-
clippedCue?: boolean;
|
|
86
|
-
};
|
|
87
116
|
export declare function formatCellValue(value: unknown, column: Pick<ViewColumn, 'format'>): string;
|
|
88
117
|
export declare function formatDisplayValue(value: unknown, column: Pick<ViewColumn, 'format' | 'prefix' | 'suffix' | 'negativeStyle'>): string;
|
|
89
|
-
|
|
90
|
-
export declare function
|
|
91
|
-
export declare function
|
|
92
|
-
export declare function
|
|
93
|
-
|
|
94
|
-
headerHeight: number;
|
|
95
|
-
padding: string;
|
|
96
|
-
paddingX: number;
|
|
97
|
-
};
|
|
98
|
-
export declare function normalizedHeaderRows(opts: Pick<BuildTableOptions, 'headerRows' | 'columns'>): HeaderCell[][];
|
|
99
|
-
export declare function defaultColumnWidth(column: ViewColumn): number;
|
|
100
|
-
export declare function leftOffset(opts: BuildTableOptions, colIndex: number): number;
|
|
118
|
+
/** Display text of a cell: labels verbatim, values through the column format. */
|
|
119
|
+
export declare function cellText(cell: ViewCell, column: ViewColumn): string;
|
|
120
|
+
export declare function defaultRowInfo(): ViewRowInfo;
|
|
121
|
+
export declare function normalizedHeaderRows(opts: Pick<TableViewInput, 'headerRows' | 'columns'>): HeaderCell[][];
|
|
122
|
+
export declare function columnId(column: ViewColumn, index: number): string;
|
|
101
123
|
export declare function clampInt(value: number, min: number, max: number): number;
|
|
124
|
+
export declare function sumWidths(widths: readonly number[], start?: number, end?: number): number;
|
|
102
125
|
export declare function setStyles(styleable: HTMLElement, styles: Record<string, string>): void;
|
|
103
126
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/charts/tableView/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/charts/tableView/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa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const MIN_COL_WIDTH = 72;
|
|
4
|
-
const DEFAULT_BODY_ROW_HEIGHT = 30;
|
|
5
|
-
const FILL_EPS = 0.5;
|
|
6
2
|
const SKETCH_BORDER_RADIUS = "14px 6px 16px 7px / 7px 15px 6px 14px";
|
|
7
3
|
function formatCellValue(value, column) {
|
|
8
4
|
return formatValue(value, column.format);
|
|
9
5
|
}
|
|
10
6
|
function formatDisplayValue(value, column) {
|
|
7
|
+
if (value == null || value === "") return "";
|
|
11
8
|
const raw = typeof value === "number" ? value : Number(value);
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const wrapped = negative && (column.negativeStyle === "parens" || column.negativeStyle === "parens-red") ? `(${formatted})` : formatted;
|
|
16
|
-
return `${column.prefix ?? ""}${wrapped}${column.suffix ?? ""}`;
|
|
9
|
+
const parens = (column.negativeStyle === "parens" || column.negativeStyle === "parens-red") && Number.isFinite(raw) && raw < 0 && typeof value !== "boolean";
|
|
10
|
+
const formatted = formatCellValue(parens ? Math.abs(raw) : value, column);
|
|
11
|
+
return `${column.prefix ?? ""}${parens ? `(${formatted})` : formatted}${column.suffix ?? ""}`;
|
|
17
12
|
}
|
|
18
|
-
function
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
let max = -Infinity;
|
|
23
|
-
for (const value of values) {
|
|
24
|
-
if (value == null || !Number.isFinite(value)) continue;
|
|
25
|
-
if (value < min) min = value;
|
|
26
|
-
if (value > max) max = value;
|
|
27
|
-
}
|
|
28
|
-
return min === Infinity ? null : [min, max];
|
|
29
|
-
}
|
|
30
|
-
function computeFittedWidths(columns, available, minimum = MIN_COL_WIDTH) {
|
|
31
|
-
const natural = columns.map((column) => column.width ?? defaultColumnWidth(column));
|
|
32
|
-
const naturalTotal = natural.reduce((sum, w) => sum + w, 0) || 1;
|
|
33
|
-
if (available <= FILL_EPS) return natural;
|
|
34
|
-
if (naturalTotal <= available) {
|
|
35
|
-
const extra = available - naturalTotal;
|
|
36
|
-
return natural.map((w) => w + extra * (w / naturalTotal));
|
|
37
|
-
}
|
|
38
|
-
const widths = natural.slice();
|
|
39
|
-
for (let pass = 0; pass < columns.length; pass += 1) {
|
|
40
|
-
const total = widths.reduce((sum, w) => sum + w, 0);
|
|
41
|
-
if (total <= available + FILL_EPS) break;
|
|
42
|
-
let flexTotal = 0;
|
|
43
|
-
let fixedTotal = 0;
|
|
44
|
-
for (const w of widths) {
|
|
45
|
-
if (w > minimum + FILL_EPS) flexTotal += w;
|
|
46
|
-
else fixedTotal += w;
|
|
47
|
-
}
|
|
48
|
-
if (flexTotal <= 0) break;
|
|
49
|
-
const targetFlex = available - fixedTotal;
|
|
50
|
-
const factor = targetFlex <= 0 ? 0 : targetFlex / flexTotal;
|
|
51
|
-
for (let i = 0; i < widths.length; i += 1) {
|
|
52
|
-
if (widths[i] > minimum + FILL_EPS) {
|
|
53
|
-
widths[i] = Math.max(minimum, widths[i] * factor);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return widths;
|
|
13
|
+
function cellText(cell, column) {
|
|
14
|
+
if (cell.label) return cell.value == null ? "" : String(cell.value);
|
|
15
|
+
if (Array.isArray(cell.value) && column.sparkline) return "";
|
|
16
|
+
return formatDisplayValue(cell.value, column);
|
|
58
17
|
}
|
|
59
|
-
function
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
function densityMetrics(density) {
|
|
63
|
-
if (density === "comfortable") return { rowHeight: 36, headerHeight: 36, padding: "8px 12px", paddingX: 12 };
|
|
64
|
-
if (density === "compact") return { rowHeight: 24, headerHeight: 28, padding: "3px 8px", paddingX: 8 };
|
|
65
|
-
return { rowHeight: DEFAULT_BODY_ROW_HEIGHT, headerHeight: HEADER_ROW_HEIGHT, padding: "6px 10px", paddingX: 10 };
|
|
18
|
+
function defaultRowInfo() {
|
|
19
|
+
return { kind: "leaf", depth: 0 };
|
|
66
20
|
}
|
|
67
21
|
function normalizedHeaderRows(opts) {
|
|
68
22
|
if (opts.headerRows) return opts.headerRows;
|
|
69
|
-
return [
|
|
70
|
-
opts.columns.map((column, colIndex) => ({
|
|
71
|
-
title: column.title,
|
|
72
|
-
align: column.align,
|
|
73
|
-
colIndex
|
|
74
|
-
}))
|
|
75
|
-
];
|
|
76
|
-
}
|
|
77
|
-
function defaultColumnWidth(column) {
|
|
78
|
-
if (column.width) return column.width;
|
|
79
|
-
if (column.isMeasure || column.align === "right") return 112;
|
|
80
|
-
if (column.type === "temporal") return 132;
|
|
81
|
-
return 148;
|
|
23
|
+
return [opts.columns.map((column, colIndex) => ({ title: column.title, align: column.align, colIndex }))];
|
|
82
24
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
let left = 0;
|
|
86
|
-
for (let i = 0; i < colIndex; i += 1) left += widths[i] ?? 0;
|
|
87
|
-
return left;
|
|
25
|
+
function columnId(column, index) {
|
|
26
|
+
return column.id ?? `${column.key}#${index}`;
|
|
88
27
|
}
|
|
89
28
|
function clampInt(value, min, max) {
|
|
90
29
|
return Math.max(min, Math.min(max, Math.floor(value)));
|
|
91
30
|
}
|
|
31
|
+
function sumWidths(widths, start = 0, end = widths.length) {
|
|
32
|
+
let total = 0;
|
|
33
|
+
for (let i = start; i < end; i++) total += widths[i] ?? 0;
|
|
34
|
+
return total;
|
|
35
|
+
}
|
|
92
36
|
function setStyles(styleable, styles) {
|
|
93
37
|
for (const [key, value] of Object.entries(styles)) {
|
|
94
|
-
styleable.style.setProperty(
|
|
38
|
+
styleable.style.setProperty(key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`), value);
|
|
95
39
|
}
|
|
96
40
|
}
|
|
97
|
-
function kebab(key) {
|
|
98
|
-
return key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
99
|
-
}
|
|
100
41
|
export {
|
|
101
|
-
DEFAULT_BODY_ROW_HEIGHT,
|
|
102
|
-
FILL_EPS,
|
|
103
|
-
HEADER_ROW_HEIGHT,
|
|
104
|
-
MIN_COL_WIDTH,
|
|
105
42
|
SKETCH_BORDER_RADIUS,
|
|
43
|
+
cellText,
|
|
106
44
|
clampInt,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
densityMetrics,
|
|
45
|
+
columnId,
|
|
46
|
+
defaultRowInfo,
|
|
110
47
|
formatCellValue,
|
|
111
48
|
formatDisplayValue,
|
|
112
|
-
leftOffset,
|
|
113
49
|
normalizedHeaderRows,
|
|
114
|
-
resolveConditionalDomain,
|
|
115
50
|
setStyles,
|
|
116
51
|
sumWidths
|
|
117
52
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/charts/tableView/types.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ConditionalFormat } from '../../spec/types';\nimport type { ResolvedSketch } from '../../spec/sketch';\nimport type { ThemeTokens } from '../../theme';\nimport type { FieldType, Rect } from '../../types';\nimport { formatValue } from '../../format';\nimport type { EvidenceLedger, DataRepresentation } from '../../render/evidence';\nimport type { LabelLedger } from '../../render/labelLedger';\
|
|
5
|
-
"mappings": "AAIA,SAAS,mBAAmB;
|
|
4
|
+
"sourcesContent": ["import type { ConditionalFormat } from '../../spec/types';\nimport type { ResolvedSketch } from '../../spec/sketch';\nimport type { ThemeTokens } from '../../theme';\nimport type { FieldType, Rect } from '../../types';\nimport { formatValue } from '../../format';\nimport type { EvidenceLedger, DataRepresentation } from '../../render/evidence';\nimport type { LabelLedger } from '../../render/labelLedger';\nimport type { ColumnFormatter } from './conditional';\nimport type { TableDensity, TableGridlines } from './style';\n\n/** A wobbly, asymmetric border-radius that reads as a hand-drawn frame. */\nexport const SKETCH_BORDER_RADIUS = '14px 6px 16px 7px / 7px 15px 6px 14px';\n\n/** Line-chart, filled-area, or column sparkline drawn from a cell's numeric array. */\nexport interface ViewSparkline {\n type: 'line' | 'area' | 'bar';\n color?: string;\n /** Shared column scale (comparable magnitudes) or per-row scale (shape only). */\n domain: [number, number] | 'row';\n}\n\nexport interface ViewColumn {\n /** Field key used to read values (not necessarily unique). */\n key: string;\n /** Unique column identity (sort state, DOM classes). Defaults to the key. */\n id?: string;\n title: string;\n align: 'left' | 'center' | 'right';\n format?: string;\n type?: FieldType;\n /** Fixed width in CSS px. */\n width?: number;\n conditionalFormat?: ConditionalFormat;\n isMeasure?: boolean;\n prefix?: string;\n suffix?: string;\n negativeStyle?: 'sign' | 'parens' | 'red' | 'parens-red';\n sortable?: boolean;\n wrap?: boolean;\n group?: string;\n /** Draw the cell's numeric array as a sparkline instead of text. */\n sparkline?: ViewSparkline;\n /** Stepped hierarchy column of a matrix (indent + expand/collapse). */\n rowHeader?: boolean;\n /** A grand-total / subtotal value column of a matrix. */\n total?: boolean;\n /** Draws a separator before this column (column-group boundary). */\n groupStart?: boolean;\n}\n\nexport interface HeaderCell {\n title: string;\n colSpan?: number;\n rowSpan?: number;\n align?: 'left' | 'center' | 'right';\n colIndex?: number;\n}\n\nexport interface ViewCell {\n value: unknown;\n raw: number | string | null;\n /** Free text (labels) rather than a value to format. */\n label?: boolean;\n}\n\nexport type RowKind = 'leaf' | 'group' | 'subtotal' | 'grandtotal';\n\nexport interface ViewRowInfo {\n kind: RowKind;\n /** Hierarchy level for stepped row headers. */\n depth: number;\n expandable?: boolean;\n expanded?: boolean;\n /** Accessible name of the row (row-header text). */\n label?: string;\n}\n\nexport interface VisibleRange {\n start: number;\n end: number;\n rowHeight: number;\n}\n\n/** What both the DOM and canvas table renderers consume. */\nexport interface TableViewInput {\n tokens: ThemeTokens;\n rect: Rect;\n columns: ViewColumn[];\n rowCount: number;\n getCell(rowIndex: number, colIndex: number): ViewCell;\n rowInfo?(rowIndex: number): ViewRowInfo;\n /** Rows matching an active highlight are tinted. */\n highlighted?(rowIndex: number): boolean;\n /** Leading columns pinned while scrolling horizontally (the matrix row header). */\n frozenColumns?: number;\n striped?: boolean;\n conditionalDomains?: Array<[number, number] | null>;\n /** Precompiled per-column formatters; built from `conditionalDomains` when omitted. */\n formatters?: Array<ColumnFormatter | null>;\n /** Conditional formats apply to these row kinds only (default: leaf rows). */\n formatKinds?: readonly RowKind[];\n /** Per-row formatter override (a matrix scales each hierarchy level separately); null leaves the row plain. */\n rowFormatters?(rowIndex: number): ReadonlyArray<ColumnFormatter | null> | null;\n /** Known [min, max] numeric extremes per column for width measurement. */\n extremes?: Array<[number, number] | null>;\n headerRows?: HeaderCell[][];\n footerRow?: { cells: ViewCell[]; kind?: 'total' | 'grandtotal' };\n density?: TableDensity;\n gridlines?: TableGridlines;\n sortState?: { col: number; dir: 'asc' | 'desc' };\n /** Hand-drawn chrome (wobbly frame, grid, and data bars) or null. */\n sketch?: ResolvedSketch | null;\n /** Column pixel widths, filled in by the renderer. */\n widths?: number[];\n evidence?: EvidenceLedger;\n labels?: LabelLedger;\n dataRepresentation?: DataRepresentation;\n sourceRepresentedRows?: number;\n}\n\nexport function formatCellValue(value: unknown, column: Pick<ViewColumn, 'format'>): string {\n return formatValue(value, column.format);\n}\n\nexport function formatDisplayValue(\n value: unknown,\n column: Pick<ViewColumn, 'format' | 'prefix' | 'suffix' | 'negativeStyle'>,\n): string {\n if (value == null || value === '') return '';\n const raw = typeof value === 'number' ? value : Number(value);\n const parens = (column.negativeStyle === 'parens' || column.negativeStyle === 'parens-red') &&\n Number.isFinite(raw) && raw < 0 && typeof value !== 'boolean';\n const formatted = formatCellValue(parens ? Math.abs(raw) : value, column);\n return `${column.prefix ?? ''}${parens ? `(${formatted})` : formatted}${column.suffix ?? ''}`;\n}\n\n/** Display text of a cell: labels verbatim, values through the column format. */\nexport function cellText(cell: ViewCell, column: ViewColumn): string {\n if (cell.label) return cell.value == null ? '' : String(cell.value);\n if (Array.isArray(cell.value) && column.sparkline) return '';\n return formatDisplayValue(cell.value, column);\n}\n\nexport function defaultRowInfo(): ViewRowInfo {\n return { kind: 'leaf', depth: 0 };\n}\n\nexport function normalizedHeaderRows(opts: Pick<TableViewInput, 'headerRows' | 'columns'>): HeaderCell[][] {\n if (opts.headerRows) return opts.headerRows;\n return [opts.columns.map((column, colIndex) => ({ title: column.title, align: column.align, colIndex }))];\n}\n\nexport function columnId(column: ViewColumn, index: number): string {\n return column.id ?? `${column.key}#${index}`;\n}\n\nexport function clampInt(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, Math.floor(value)));\n}\n\nexport function sumWidths(widths: readonly number[], start = 0, end = widths.length): number {\n let total = 0;\n for (let i = start; i < end; i++) total += widths[i] ?? 0;\n return total;\n}\n\nexport function setStyles(styleable: HTMLElement, styles: Record<string, string>): void {\n for (const [key, value] of Object.entries(styles)) {\n styleable.style.setProperty(key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`), value);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAIA,SAAS,mBAAmB;AAOrB,MAAM,uBAAuB;AA6G7B,SAAS,gBAAgB,OAAgB,QAA4C;AAC1F,SAAO,YAAY,OAAO,OAAO,MAAM;AACzC;AAEO,SAAS,mBACd,OACA,QACQ;AACR,MAAI,SAAS,QAAQ,UAAU,GAAI,QAAO;AAC1C,QAAM,MAAM,OAAO,UAAU,WAAW,QAAQ,OAAO,KAAK;AAC5D,QAAM,UAAU,OAAO,kBAAkB,YAAY,OAAO,kBAAkB,iBAC5E,OAAO,SAAS,GAAG,KAAK,MAAM,KAAK,OAAO,UAAU;AACtD,QAAM,YAAY,gBAAgB,SAAS,KAAK,IAAI,GAAG,IAAI,OAAO,MAAM;AACxE,SAAO,GAAG,OAAO,UAAU,EAAE,GAAG,SAAS,IAAI,SAAS,MAAM,SAAS,GAAG,OAAO,UAAU,EAAE;AAC7F;AAGO,SAAS,SAAS,MAAgB,QAA4B;AACnE,MAAI,KAAK,MAAO,QAAO,KAAK,SAAS,OAAO,KAAK,OAAO,KAAK,KAAK;AAClE,MAAI,MAAM,QAAQ,KAAK,KAAK,KAAK,OAAO,UAAW,QAAO;AAC1D,SAAO,mBAAmB,KAAK,OAAO,MAAM;AAC9C;AAEO,SAAS,iBAA8B;AAC5C,SAAO,EAAE,MAAM,QAAQ,OAAO,EAAE;AAClC;AAEO,SAAS,qBAAqB,MAAsE;AACzG,MAAI,KAAK,WAAY,QAAO,KAAK;AACjC,SAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,QAAQ,cAAc,EAAE,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,SAAS,EAAE,CAAC;AAC1G;AAEO,SAAS,SAAS,QAAoB,OAAuB;AAClE,SAAO,OAAO,MAAM,GAAG,OAAO,GAAG,IAAI,KAAK;AAC5C;AAEO,SAAS,SAAS,OAAe,KAAa,KAAqB;AACxE,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM,KAAK,CAAC,CAAC;AACvD;AAEO,SAAS,UAAU,QAA2B,QAAQ,GAAG,MAAM,OAAO,QAAgB;AAC3F,MAAI,QAAQ;AACZ,WAAS,IAAI,OAAO,IAAI,KAAK,IAAK,UAAS,OAAO,CAAC,KAAK;AACxD,SAAO;AACT;AAEO,SAAS,UAAU,WAAwB,QAAsC;AACtF,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,cAAU,MAAM,YAAY,IAAI,QAAQ,UAAU,CAAC,MAAM,IAAI,EAAE,YAAY,CAAC,EAAE,GAAG,KAAK;AAAA,EACxF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { mountTable, RENDER_ALL_CELLS } from './tableView/dom.js';
|
|
2
|
+
export type { DomTableOptions, DomTableView } from './tableView/dom.js';
|
|
2
3
|
export { paintTableCanvas } from './tableView/canvas.js';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export type {
|
|
6
|
-
export
|
|
4
|
+
export type { CanvasTableOptions } from './tableView/canvas.js';
|
|
5
|
+
export { buildColumnFormatter, resolveConditionalDomain } from './tableView/conditional.js';
|
|
6
|
+
export type { CellPaint, ColumnFormatter } from './tableView/conditional.js';
|
|
7
|
+
export { cellText, formatCellValue, formatDisplayValue } from './tableView/types.js';
|
|
8
|
+
export type { HeaderCell, RowKind, TableViewInput, ViewCell, ViewColumn, ViewRowInfo, ViewSparkline } from './tableView/types.js';
|
|
9
|
+
export { densityMetrics, resolveTableStyle } from './tableView/style.js';
|
|
10
|
+
export type { TableDensity, TableGridlines } from './tableView/style.js';
|
|
11
|
+
export { sortRowIndices } from './tableView/sort.js';
|
|
7
12
|
//# sourceMappingURL=tableView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableView.d.ts","sourceRoot":"","sources":["../../src/charts/tableView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"tableView.d.ts","sourceRoot":"","sources":["../../src/charts/tableView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACzF,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAClF,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC/H,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/charts/tableView.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mountTable, RENDER_ALL_CELLS } from "./tableView/dom.js";
|
|
2
2
|
import { paintTableCanvas } from "./tableView/canvas.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { buildColumnFormatter, resolveConditionalDomain } from "./tableView/conditional.js";
|
|
4
|
+
import { cellText, formatCellValue, formatDisplayValue } from "./tableView/types.js";
|
|
5
|
+
import { densityMetrics, resolveTableStyle } from "./tableView/style.js";
|
|
6
|
+
import { sortRowIndices } from "./tableView/sort.js";
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
RENDER_ALL_CELLS,
|
|
9
|
+
buildColumnFormatter,
|
|
10
|
+
cellText,
|
|
9
11
|
densityMetrics,
|
|
10
12
|
formatCellValue,
|
|
11
13
|
formatDisplayValue,
|
|
12
|
-
|
|
14
|
+
mountTable,
|
|
13
15
|
paintTableCanvas,
|
|
14
|
-
resolveConditionalDomain
|
|
16
|
+
resolveConditionalDomain,
|
|
17
|
+
resolveTableStyle,
|
|
18
|
+
sortRowIndices
|
|
15
19
|
};
|
|
16
20
|
//# sourceMappingURL=tableView.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/charts/tableView.ts"],
|
|
4
|
-
"sourcesContent": ["export {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["export { mountTable, RENDER_ALL_CELLS } from './tableView/dom';\nexport type { DomTableOptions, DomTableView } from './tableView/dom';\nexport { paintTableCanvas } from './tableView/canvas';\nexport type { CanvasTableOptions } from './tableView/canvas';\nexport { buildColumnFormatter, resolveConditionalDomain } from './tableView/conditional';\nexport type { CellPaint, ColumnFormatter } from './tableView/conditional';\nexport { cellText, formatCellValue, formatDisplayValue } from './tableView/types';\nexport type { HeaderCell, RowKind, TableViewInput, ViewCell, ViewColumn, ViewRowInfo, ViewSparkline } from './tableView/types';\nexport { densityMetrics, resolveTableStyle } from './tableView/style';\nexport type { TableDensity, TableGridlines } from './tableView/style';\nexport { sortRowIndices } from './tableView/sort';\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,wBAAwB;AAE7C,SAAS,wBAAwB;AAEjC,SAAS,sBAAsB,gCAAgC;AAE/D,SAAS,UAAU,iBAAiB,0BAA0B;AAE9D,SAAS,gBAAgB,yBAAyB;AAElD,SAAS,sBAAsB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treemap.d.ts","sourceRoot":"","sources":["../../src/charts/treemap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"treemap.d.ts","sourceRoot":"","sources":["../../src/charts/treemap.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAmB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAS,IAAI,EAAQ,IAAI,EAAE,MAAM,UAAU,CAAC;AAIxD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB;IAClF,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,IAAI,CAAC;CACZ;AA8GD,0FAA0F;AAC1F,wBAAgB,aAAa,CAAC,CAAC,SAAS,kBAAkB,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAkCnH;AA2fD,wBAAgB,WAAW,CACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,aAAa,GACtB,gBAAgB,GAAG,IAAI,CAoDzB"}
|