pivotkit-react 0.1.0 → 0.3.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/CHANGELOG.md +306 -1
- package/README.md +48 -298
- package/dist/chunks/{chunk-ILHFIV2P.js → chunk-32Z33U6S.js} +58 -78
- package/dist/chunks/chunk-7CC4JHDY.js +363 -0
- package/dist/chunks/chunk-APB4NW4O.js +434 -0
- package/dist/chunks/chunk-EM23V5GH.js +183 -0
- package/dist/chunks/{chunk-KKJO36W5.js → chunk-IOPAM4JD.js} +412 -365
- package/dist/chunks/chunk-RWYHJRQO.js +99 -0
- package/dist/chunks/unused-texts-K3VFH65P.js +10 -0
- package/dist/chunks/unused-texts-de-OW4TGIVX.js +6 -0
- package/dist/echarts.js +96 -11
- package/dist/index.js +654 -560
- package/dist/labels.js +13 -4
- package/dist/menu-texts-de.js +6 -0
- package/dist/menus.js +2905 -550
- package/dist/styles.css +738 -216
- package/package.json +2 -2
- package/types/chart-layout.d.ts +111 -0
- package/types/chart-types.d.ts +0 -91
- package/types/chip-menus.d.ts +20 -4
- package/types/dnd.d.ts +8 -4
- package/types/drill-panel.d.ts +5 -22
- package/types/drill-table.d.ts +71 -0
- package/types/drill.d.ts +0 -36
- package/types/filter-level.d.ts +16 -0
- package/types/filter.d.ts +31 -0
- package/types/help.d.ts +14 -0
- package/types/icons.d.ts +4 -0
- package/types/labels.d.ts +114 -101
- package/types/lazy-menus.d.ts +18 -6
- package/types/levels.d.ts +105 -0
- package/types/menu-fields.d.ts +80 -0
- package/types/menu-labels-de.d.ts +2 -0
- package/types/menu-labels.d.ts +270 -13
- package/types/menu-ops.d.ts +286 -0
- package/types/menu-texts.d.ts +2 -0
- package/types/menu-topics.d.ts +293 -0
- package/types/menus.d.ts +2 -2
- package/types/names.d.ts +160 -20
- package/types/overflow.d.ts +4 -1
- package/types/place.d.ts +44 -0
- package/types/popover.d.ts +10 -6
- package/types/section.d.ts +8 -28
- package/types/share-actions.d.ts +99 -0
- package/types/share.d.ts +0 -9
- package/types/table.d.ts +9 -3
- package/types/templates.d.ts +7 -1
- package/types/tips.d.ts +1 -34
- package/types/toolbar-panels.d.ts +20 -10
- package/types/unused-load.d.ts +23 -0
- package/types/unused-texts-de.d.ts +2 -0
- package/types/unused-texts.d.ts +136 -0
- package/types/unused.d.ts +22 -0
- package/types/use-view-history.d.ts +8 -4
- package/types/view-history.d.ts +23 -6
- package/types/view-ops.d.ts +80 -119
- package/types/view-save.d.ts +76 -0
- package/types/view-store.d.ts +13 -6
- package/types/zones.d.ts +5 -4
- package/dist/chunks/chunk-C32TYSHG.js +0 -441
- package/dist/chunks/chunk-XYP47DJ3.js +0 -123
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pivotkit-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "React 18/19 pivot report builder on pivotkit-core: drag-and-drop fields, table and Apache ECharts chart, filters, templates as JSON, undo, Excel and CSV export.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "eizedev <oss@eize.dev>",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@dnd-kit/core": "6.3.1",
|
|
62
62
|
"@dnd-kit/sortable": "10.0.0",
|
|
63
|
-
"pivotkit-core": "^0.
|
|
63
|
+
"pivotkit-core": "^0.3.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"echarts": "6.1.0"
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Room (px) above and below a pie for the labels outside it, for a chart `height` px high: 5 % of the
|
|
3
|
+
* height, at most 24 px. The pie's radius is a share of its box, so in a low box the top and bottom
|
|
4
|
+
* labels would reach past the canvas; a tall box keeps nearly all of its pie.
|
|
5
|
+
* @param {number} height
|
|
6
|
+
*/
|
|
7
|
+
export declare function pieLabelRoom(height: number): number;
|
|
8
|
+
/**
|
|
9
|
+
* The least width (px) of a chart that keeps a legend on its right: the legend's column takes 160 px
|
|
10
|
+
* (pivotkit-core), so a narrower chart (a phone) would squeeze the pie or the plot into a sliver. Below
|
|
11
|
+
* it the legend is drawn at the bottom instead, with the room pivotkit-core gives a bottom legend.
|
|
12
|
+
*/
|
|
13
|
+
export declare const RIGHT_LEGEND_MIN_WIDTH = 480;
|
|
14
|
+
/** Room (px) pivotkit-core gives a legend at the bottom of a chart. */
|
|
15
|
+
export declare const BOTTOM_LEGEND_ROOM = 32;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the numbers written inside a donut's ring fit across it: the ring is the outer less the
|
|
18
|
+
* inner radius, both a share (ECharts' "70%") of half the smaller side of the pie's box. A pie (no
|
|
19
|
+
* inner radius) has room from its centre and always fits.
|
|
20
|
+
* @param {[string | number, string | number]} radius the series' radius, inner and outer
|
|
21
|
+
* @param {{ width: number, height: number }} box the pie's box: the chart less the room around it
|
|
22
|
+
* @param {string[]} texts the labels written on the slices
|
|
23
|
+
*/
|
|
24
|
+
export declare function ringLabelsFit(radius: [string | number, string | number], box: {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}, texts: string[]): boolean;
|
|
28
|
+
/** Width (px) a slanted column name of a heatmap takes at most; a longer one ends in "…". */
|
|
29
|
+
export declare const SLANTED_LABEL_WIDTH = 120;
|
|
30
|
+
/**
|
|
31
|
+
* How a heatmap writes its column names along the x axis of a chart `width` px wide: straight when
|
|
32
|
+
* the longest fits its column, else slanted by 45 degrees and cut at SLANTED_LABEL_WIDTH. Every name is
|
|
33
|
+
* shown (the core sets interval 0); the width of a character is estimated as 0.55 of the font size.
|
|
34
|
+
* @param {string[]} names
|
|
35
|
+
* @param {number} width the chart's width in px
|
|
36
|
+
* @param {number} [fontSize] px, ECharts' default for axis labels
|
|
37
|
+
* @returns {{ rotate: number, width?: number, overflow?: "truncate" }}
|
|
38
|
+
*/
|
|
39
|
+
export declare function columnLabelLayout(names: string[], width: number, fontSize?: number): {
|
|
40
|
+
rotate: number;
|
|
41
|
+
width?: number;
|
|
42
|
+
overflow?: "truncate";
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* True when the cells of a heatmap of `columns` x `rows` in a chart of `width` x `height` px hold their
|
|
46
|
+
* numbers as the chart writes them (`texts`, formatted: "1,234.5", "-12.3%"): the longest, estimated at
|
|
47
|
+
* 0.55 of the font size per character, fits a cell's width with room on both sides, and a line its height.
|
|
48
|
+
* @param {number} columns
|
|
49
|
+
* @param {number} rows
|
|
50
|
+
* @param {number} width
|
|
51
|
+
* @param {number} height
|
|
52
|
+
* @param {string[]} texts
|
|
53
|
+
* @param {number} [fontSize] px, ECharts' default for labels
|
|
54
|
+
*/
|
|
55
|
+
export declare function heatmapCellLabels(columns: number, rows: number, width: number, height: number, texts: string[], fontSize?: number): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Which row names of a heatmap the y axis writes in a chart `height` px high: every one (0) when a line
|
|
58
|
+
* fits each row, else every n-th (ECharts' interval: n - 1 names left out between two shown), so the
|
|
59
|
+
* names never overlap and the first one is always there.
|
|
60
|
+
* @param {number} rows
|
|
61
|
+
* @param {number} height
|
|
62
|
+
*/
|
|
63
|
+
export declare function rowLabelInterval(rows: number, height: number): number;
|
|
64
|
+
/** Width (px) a category label of bars, lines and areas takes at most: a longer one ends in "…" (the tooltip has it whole). */
|
|
65
|
+
export declare const CATEGORY_LABEL_WIDTH = 120;
|
|
66
|
+
/**
|
|
67
|
+
* How the category axis of bars, lines and areas writes its labels (`chart.axisLabels`):
|
|
68
|
+
* - "auto": every label straight when the longest fits its slot, else slanted by 45 degrees while a
|
|
69
|
+
* line fits each slot, else every n-th slanted (`every` > 1, the chart says so in a note);
|
|
70
|
+
* - "all": every label, slanted when they do not fit straight;
|
|
71
|
+
* - "nth": straight, every n-th so they never overlap.
|
|
72
|
+
* Along a vertical axis (horizontal bars) the labels stay straight: every one while a line fits each
|
|
73
|
+
* row, else every n-th. A label is cut at CATEGORY_LABEL_WIDTH; character width estimated at 0.55 of the font size.
|
|
74
|
+
* @param {string[]} names
|
|
75
|
+
* @param {{ width: number, height: number, horizontal?: boolean, mode?: string, fontSize?: number }} box
|
|
76
|
+
* @returns {{ rotate: number, interval: number, every: number, width: number, overflow: "truncate" }}
|
|
77
|
+
*/
|
|
78
|
+
export declare function categoryLabelLayout(names: string[], { width, height, horizontal, mode, fontSize }: {
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
horizontal?: boolean;
|
|
82
|
+
mode?: string;
|
|
83
|
+
fontSize?: number;
|
|
84
|
+
}): {
|
|
85
|
+
rotate: number;
|
|
86
|
+
interval: number;
|
|
87
|
+
every: number;
|
|
88
|
+
width: number;
|
|
89
|
+
overflow: "truncate";
|
|
90
|
+
};
|
|
91
|
+
/** The least room (px) a group label needs along the axis, and the least size of a chart with group labels. */
|
|
92
|
+
export declare const GROUP_LABEL_ROOM: Readonly<{
|
|
93
|
+
along: 56;
|
|
94
|
+
across: 28;
|
|
95
|
+
width: 420;
|
|
96
|
+
height: 260;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Whether "auto" group labels fit a chart of `width` x `height` px with `count` categories whose
|
|
100
|
+
* smallest group has `groupSize` of them: each group's name needs GROUP_LABEL_ROOM.along px under the
|
|
101
|
+
* axis (across: a line per group beside a vertical axis), and the chart itself a least size, or the
|
|
102
|
+
* plot area left over is too small to read.
|
|
103
|
+
* @param {number} count
|
|
104
|
+
* @param {number} groupSize
|
|
105
|
+
* @param {{ width: number, height: number, horizontal?: boolean }} box
|
|
106
|
+
*/
|
|
107
|
+
export declare function groupLabelsFit(count: number, groupSize: number, { width, height, horizontal }: {
|
|
108
|
+
width: number;
|
|
109
|
+
height: number;
|
|
110
|
+
horizontal?: boolean;
|
|
111
|
+
}): boolean;
|
package/types/chart-types.d.ts
CHANGED
|
@@ -59,94 +59,3 @@ export declare function chartPlan(view: {
|
|
|
59
59
|
export declare const MANY_SERIES = 8;
|
|
60
60
|
/** Categories a chart draws at most; the rest are left out with a note. */
|
|
61
61
|
export declare const MAX_CATEGORIES = 50;
|
|
62
|
-
/**
|
|
63
|
-
* Room (px) above and below a pie for the labels outside it, for a chart `height` px high: 5 % of the
|
|
64
|
-
* height, at most 24 px. The pie's radius is a share of its box, so in a low box the top and bottom
|
|
65
|
-
* labels would reach past the canvas; a tall box keeps nearly all of its pie.
|
|
66
|
-
* @param {number} height
|
|
67
|
-
*/
|
|
68
|
-
export declare function pieLabelRoom(height: number): number;
|
|
69
|
-
/** Width (px) a slanted column name of a heatmap takes at most; a longer one ends in "…". */
|
|
70
|
-
export declare const SLANTED_LABEL_WIDTH = 120;
|
|
71
|
-
/**
|
|
72
|
-
* How a heatmap writes its column names along the x axis of a chart `width` px wide: straight when
|
|
73
|
-
* the longest fits its column, else slanted by 45 degrees and cut at SLANTED_LABEL_WIDTH. Every name is
|
|
74
|
-
* shown (the core sets interval 0); the width of a character is estimated as 0.55 of the font size.
|
|
75
|
-
* @param {string[]} names
|
|
76
|
-
* @param {number} width the chart's width in px
|
|
77
|
-
* @param {number} [fontSize] px, ECharts' default for axis labels
|
|
78
|
-
* @returns {{ rotate: number, width?: number, overflow?: "truncate" }}
|
|
79
|
-
*/
|
|
80
|
-
export declare function columnLabelLayout(names: string[], width: number, fontSize?: number): {
|
|
81
|
-
rotate: number;
|
|
82
|
-
width?: number;
|
|
83
|
-
overflow?: "truncate";
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* True when the cells of a heatmap of `columns` x `rows` in a chart of `width` x `height` px hold their
|
|
87
|
-
* numbers as the chart writes them (`texts`, formatted: "1,234.5", "-12.3%"): the longest, estimated at
|
|
88
|
-
* 0.55 of the font size per character, fits a cell's width with room on both sides, and a line its height.
|
|
89
|
-
* @param {number} columns
|
|
90
|
-
* @param {number} rows
|
|
91
|
-
* @param {number} width
|
|
92
|
-
* @param {number} height
|
|
93
|
-
* @param {string[]} texts
|
|
94
|
-
* @param {number} [fontSize] px, ECharts' default for labels
|
|
95
|
-
*/
|
|
96
|
-
export declare function heatmapCellLabels(columns: number, rows: number, width: number, height: number, texts: string[], fontSize?: number): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Which row names of a heatmap the y axis writes in a chart `height` px high: every one (0) when a line
|
|
99
|
-
* fits each row, else every n-th (ECharts' interval: n - 1 names left out between two shown), so the
|
|
100
|
-
* names never overlap and the first one is always there.
|
|
101
|
-
* @param {number} rows
|
|
102
|
-
* @param {number} height
|
|
103
|
-
*/
|
|
104
|
-
export declare function rowLabelInterval(rows: number, height: number): number;
|
|
105
|
-
/** Width (px) a category label of bars, lines and areas takes at most: a longer one ends in "…" (the tooltip has it whole). */
|
|
106
|
-
export declare const CATEGORY_LABEL_WIDTH = 120;
|
|
107
|
-
/**
|
|
108
|
-
* How the category axis of bars, lines and areas writes its labels (`chart.axisLabels`):
|
|
109
|
-
* - "auto": every label straight when the longest fits its slot, else slanted by 45 degrees while a
|
|
110
|
-
* line fits each slot, else every n-th slanted (`every` > 1, the chart says so in a note);
|
|
111
|
-
* - "all": every label, slanted when they do not fit straight;
|
|
112
|
-
* - "nth": straight, every n-th so they never overlap.
|
|
113
|
-
* Along a vertical axis (horizontal bars) the labels stay straight: every one while a line fits each
|
|
114
|
-
* row, else every n-th. A label is cut at CATEGORY_LABEL_WIDTH; character width estimated at 0.55 of the font size.
|
|
115
|
-
* @param {string[]} names
|
|
116
|
-
* @param {{ width: number, height: number, horizontal?: boolean, mode?: string, fontSize?: number }} box
|
|
117
|
-
* @returns {{ rotate: number, interval: number, every: number, width: number, overflow: "truncate" }}
|
|
118
|
-
*/
|
|
119
|
-
export declare function categoryLabelLayout(names: string[], { width, height, horizontal, mode, fontSize }: {
|
|
120
|
-
width: number;
|
|
121
|
-
height: number;
|
|
122
|
-
horizontal?: boolean;
|
|
123
|
-
mode?: string;
|
|
124
|
-
fontSize?: number;
|
|
125
|
-
}): {
|
|
126
|
-
rotate: number;
|
|
127
|
-
interval: number;
|
|
128
|
-
every: number;
|
|
129
|
-
width: number;
|
|
130
|
-
overflow: "truncate";
|
|
131
|
-
};
|
|
132
|
-
/** The least room (px) a group label needs along the axis, and the least size of a chart with group labels. */
|
|
133
|
-
export declare const GROUP_LABEL_ROOM: Readonly<{
|
|
134
|
-
along: 56;
|
|
135
|
-
across: 28;
|
|
136
|
-
width: 420;
|
|
137
|
-
height: 260;
|
|
138
|
-
}>;
|
|
139
|
-
/**
|
|
140
|
-
* Whether "auto" group labels fit a chart of `width` x `height` px with `count` categories whose
|
|
141
|
-
* smallest group has `groupSize` of them: each group's name needs GROUP_LABEL_ROOM.along px under the
|
|
142
|
-
* axis (across: a line per group beside a vertical axis), and the chart itself a least size, or the
|
|
143
|
-
* plot area left over is too small to read.
|
|
144
|
-
* @param {number} count
|
|
145
|
-
* @param {number} groupSize
|
|
146
|
-
* @param {{ width: number, height: number, horizontal?: boolean }} box
|
|
147
|
-
*/
|
|
148
|
-
export declare function groupLabelsFit(count: number, groupSize: number, { width, height, horizontal }: {
|
|
149
|
-
width: number;
|
|
150
|
-
height: number;
|
|
151
|
-
horizontal?: boolean;
|
|
152
|
-
}): boolean;
|
package/types/chip-menus.d.ts
CHANGED
|
@@ -1,31 +1,47 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
/** The menu of a chip on Rows or Columns. */
|
|
3
|
-
export declare function AxisMenu({ view, zone, index, field, types, labels, commit, close,
|
|
4
|
-
chipRef: any;
|
|
3
|
+
export declare function AxisMenu({ view, zone, index, field, types, labels, commit, close, onRemove, defaultsOf, rangeOf, locale, info, state, encoded }: {
|
|
5
4
|
close: any;
|
|
6
5
|
commit: any;
|
|
7
6
|
defaultsOf: any;
|
|
7
|
+
encoded: any;
|
|
8
8
|
field: any;
|
|
9
9
|
index: any;
|
|
10
10
|
info: any;
|
|
11
11
|
labels: any;
|
|
12
12
|
locale: any;
|
|
13
13
|
onRemove: any;
|
|
14
|
-
openFilter: any;
|
|
15
14
|
rangeOf: any;
|
|
16
15
|
state: any;
|
|
17
16
|
types: any;
|
|
18
17
|
view: any;
|
|
19
18
|
zone: any;
|
|
20
19
|
}): React.JSX.Element;
|
|
20
|
+
/** The menu of a chip in Filters (the whole report): the same Filter level, Move to. */
|
|
21
|
+
export declare function FilterMenu({ view, index, field, types, labels, commit, close, onRemove, locale, info, state, encoded }: {
|
|
22
|
+
close: any;
|
|
23
|
+
commit: any;
|
|
24
|
+
encoded: any;
|
|
25
|
+
field: any;
|
|
26
|
+
index: any;
|
|
27
|
+
info: any;
|
|
28
|
+
labels: any;
|
|
29
|
+
locale: any;
|
|
30
|
+
onRemove: any;
|
|
31
|
+
state: any;
|
|
32
|
+
types: any;
|
|
33
|
+
view: any;
|
|
34
|
+
}): React.JSX.Element;
|
|
21
35
|
/** The menu of a value chip. */
|
|
22
|
-
export declare function ValueMenu({ view, index, types, labels, commit, close, onRemove, defaultsOf, info }: {
|
|
36
|
+
export declare function ValueMenu({ view, index, types, labels, commit, close, onRemove, defaultsOf, info, earlier, locale }: {
|
|
23
37
|
close: any;
|
|
24
38
|
commit: any;
|
|
25
39
|
defaultsOf: any;
|
|
40
|
+
earlier: any;
|
|
26
41
|
index: any;
|
|
27
42
|
info: any;
|
|
28
43
|
labels: any;
|
|
44
|
+
locale?: string | undefined;
|
|
29
45
|
onRemove: any;
|
|
30
46
|
types: any;
|
|
31
47
|
view: any;
|
package/types/dnd.d.ts
CHANGED
|
@@ -36,7 +36,9 @@ export declare function PivotDnd({ labels, onDrop, onDragStart, renderOverlay, c
|
|
|
36
36
|
export declare function useDragSource(id: any, source: any, disabled?: boolean): {
|
|
37
37
|
setNodeRef: (element: HTMLElement | null) => void;
|
|
38
38
|
isDragging: boolean;
|
|
39
|
-
itemProps:
|
|
39
|
+
itemProps: {
|
|
40
|
+
[k: string]: (event: any) => void;
|
|
41
|
+
};
|
|
40
42
|
handleProps: {
|
|
41
43
|
role: string;
|
|
42
44
|
tabIndex: number;
|
|
@@ -44,7 +46,7 @@ export declare function useDragSource(id: any, source: any, disabled?: boolean):
|
|
|
44
46
|
'aria-pressed': boolean | undefined;
|
|
45
47
|
'aria-roledescription': string;
|
|
46
48
|
'aria-describedby': string;
|
|
47
|
-
onKeyDown: any;
|
|
49
|
+
onKeyDown: (event: any) => void;
|
|
48
50
|
ref: (element: HTMLElement | null) => void;
|
|
49
51
|
} | {
|
|
50
52
|
role: string;
|
|
@@ -68,7 +70,9 @@ export declare function useChip(id: any, source: any): {
|
|
|
68
70
|
transform?: undefined;
|
|
69
71
|
transition: string | undefined;
|
|
70
72
|
};
|
|
71
|
-
itemProps:
|
|
73
|
+
itemProps: {
|
|
74
|
+
[k: string]: (event: any) => void;
|
|
75
|
+
};
|
|
72
76
|
handleProps: {
|
|
73
77
|
role: string;
|
|
74
78
|
tabIndex: number;
|
|
@@ -76,7 +80,7 @@ export declare function useChip(id: any, source: any): {
|
|
|
76
80
|
'aria-pressed': boolean | undefined;
|
|
77
81
|
'aria-roledescription': string;
|
|
78
82
|
'aria-describedby': string;
|
|
79
|
-
onKeyDown: any;
|
|
83
|
+
onKeyDown: (event: any) => void;
|
|
80
84
|
ref: (element: HTMLElement | null) => void;
|
|
81
85
|
} | {
|
|
82
86
|
role: string;
|
package/types/drill-panel.d.ts
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export type Drill =
|
|
3
|
-
|
|
4
|
-
name: string;
|
|
5
|
-
count: number;
|
|
6
|
-
locale: string;
|
|
7
|
-
indices: ArrayLike<number>;
|
|
8
|
-
formats: Record<string, string>;
|
|
9
|
-
columns: Array<{
|
|
10
|
-
name: string;
|
|
11
|
-
numeric: boolean;
|
|
12
|
-
label?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
}>;
|
|
15
|
-
rows: string[][];
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {{ title: string, name: string, count: number, locale: string, indices: ArrayLike<number>, formats: Record<string, string>,
|
|
19
|
-
* columns: Array<{ name: string, numeric: boolean, label?: string, description?: string }>, rows: string[][] }} Drill
|
|
20
|
-
*/
|
|
2
|
+
export type Drill = import("./drill-table.js").Drill;
|
|
3
|
+
/** @typedef {import("./drill-table.js").Drill} Drill */
|
|
21
4
|
/**
|
|
22
|
-
* @param {{ drill:
|
|
5
|
+
* @param {{ drill: import("./drill-table.js").DrillSource | null, onClose: () => void, labels: import("./labels.js").UiLabels, locale: string,
|
|
23
6
|
* exportContext?: { encoded: import("pivotkit-core").Encoded, onExport?: (file: import("./export-run.js").ExportFile) => unknown,
|
|
24
7
|
* announce: (text: string, extra?: { tone?: "error" }) => void, root: React.RefObject<HTMLElement | null> } }} props
|
|
25
8
|
*/
|
|
26
|
-
export declare function DrillPanel({ drill, onClose, labels, locale, exportContext }: {
|
|
27
|
-
drill:
|
|
9
|
+
export declare function DrillPanel({ drill: source, onClose, labels, locale, exportContext }: {
|
|
10
|
+
drill: import("./drill-table.js").DrillSource | null;
|
|
28
11
|
onClose: () => void;
|
|
29
12
|
labels: import("./labels.js").UiLabels;
|
|
30
13
|
locale: string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type DrillSource = {
|
|
2
|
+
result: import("pivotkit-core").PivotResult;
|
|
3
|
+
rowPath: unknown[];
|
|
4
|
+
colPath: unknown[];
|
|
5
|
+
count: number;
|
|
6
|
+
indices: ArrayLike<number>;
|
|
7
|
+
formatOf: (field: string) => unknown;
|
|
8
|
+
nameOf: (field: string) => string;
|
|
9
|
+
infoOf: (field: string) => {
|
|
10
|
+
description?: string;
|
|
11
|
+
} | null | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type Drill = {
|
|
14
|
+
title: string;
|
|
15
|
+
name: string;
|
|
16
|
+
count: number;
|
|
17
|
+
locale: string;
|
|
18
|
+
indices: ArrayLike<number>;
|
|
19
|
+
formats: Record<string, string>;
|
|
20
|
+
columns: Array<{
|
|
21
|
+
name: string;
|
|
22
|
+
numeric: boolean;
|
|
23
|
+
label?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
}>;
|
|
26
|
+
rows: string[][];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The text of one column's values: a date as the table shows it (its day, with the time when the
|
|
30
|
+
* column has times), a number with `format` (a format of pivotkit-core: "text" shows an identifier
|
|
31
|
+
* as it is, "40072") or else in the locale with up to 6 decimals, yes/no with the labels' words.
|
|
32
|
+
* @param {import("pivotkit-core").Column} column
|
|
33
|
+
* @param {{ locale: string, labels: import("pivotkit-core").Labels, format?: unknown }} options
|
|
34
|
+
* @returns {{ text: (value: unknown) => string, numeric: boolean }}
|
|
35
|
+
*/
|
|
36
|
+
export declare function columnText(column: import("pivotkit-core").Column, { locale, labels, format }: {
|
|
37
|
+
locale: string;
|
|
38
|
+
labels: import("pivotkit-core").Labels;
|
|
39
|
+
format?: unknown;
|
|
40
|
+
}): {
|
|
41
|
+
text: (value: unknown) => string;
|
|
42
|
+
numeric: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The rows of the drill-down panel as text, from the encoded columns: one entry per column (its name,
|
|
46
|
+
* whether it is right-aligned as a number) and per row the texts; a blank value is "".
|
|
47
|
+
* @param {import("pivotkit-core").Encoded} encoded
|
|
48
|
+
* @param {ArrayLike<number>} indices positions of the rows in the data (drillRows)
|
|
49
|
+
* @param {{ locale: string, labels: import("pivotkit-core").Labels, formatOf?: (column: string) => unknown }} options
|
|
50
|
+
* `formatOf`: the host's format for a column's values (fieldDefaults)
|
|
51
|
+
* @returns {{ columns: Array<{ name: string, numeric: boolean }>, rows: string[][] }}
|
|
52
|
+
*/
|
|
53
|
+
export declare function drillTable(encoded: import("pivotkit-core").Encoded, indices: ArrayLike<number>, { locale, labels, formatOf }: {
|
|
54
|
+
locale: string;
|
|
55
|
+
labels: import("pivotkit-core").Labels;
|
|
56
|
+
formatOf?: (column: string) => unknown;
|
|
57
|
+
}): {
|
|
58
|
+
columns: Array<{
|
|
59
|
+
name: string;
|
|
60
|
+
numeric: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
rows: string[][];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The panel's contents for a clicked value: its title, its table, and the formats the panel's exports
|
|
66
|
+
* use (pivotkit-core's rows exporters write them as the table shows them).
|
|
67
|
+
* @param {DrillSource} source
|
|
68
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
69
|
+
* @returns {Drill}
|
|
70
|
+
*/
|
|
71
|
+
export declare function drillOf({ result, rowPath, colPath, count, indices, formatOf, nameOf, infoOf }: DrillSource, labels: import("./labels.js").UiLabels): Drill;
|
package/types/drill.d.ts
CHANGED
|
@@ -24,39 +24,3 @@ export declare function drillRows(result: import("pivotkit-core").PivotResult, {
|
|
|
24
24
|
rows: object[];
|
|
25
25
|
indices: Int32Array;
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
28
|
-
* The text of one column's values: a date as the table shows it (its day, with the time when the
|
|
29
|
-
* column has times), a number with `format` (a format of pivotkit-core: "text" shows an identifier
|
|
30
|
-
* as it is, "40072") or else in the locale with up to 6 decimals, yes/no with the labels' words.
|
|
31
|
-
* @param {import("pivotkit-core").Column} column
|
|
32
|
-
* @param {{ locale: string, labels: import("pivotkit-core").Labels, format?: unknown }} options
|
|
33
|
-
* @returns {{ text: (value: unknown) => string, numeric: boolean }}
|
|
34
|
-
*/
|
|
35
|
-
export declare function columnText(column: import("pivotkit-core").Column, { locale, labels, format }: {
|
|
36
|
-
locale: string;
|
|
37
|
-
labels: import("pivotkit-core").Labels;
|
|
38
|
-
format?: unknown;
|
|
39
|
-
}): {
|
|
40
|
-
text: (value: unknown) => string;
|
|
41
|
-
numeric: boolean;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* The rows of the drill-down panel as text, from the encoded columns: one entry per column (its name,
|
|
45
|
-
* whether it is right-aligned as a number) and per row the texts; a blank value is "".
|
|
46
|
-
* @param {import("pivotkit-core").Encoded} encoded
|
|
47
|
-
* @param {ArrayLike<number>} indices positions of the rows in the data (drillRows)
|
|
48
|
-
* @param {{ locale: string, labels: import("pivotkit-core").Labels, formatOf?: (column: string) => unknown }} options
|
|
49
|
-
* `formatOf`: the host's format for a column's values (fieldDefaults)
|
|
50
|
-
* @returns {{ columns: Array<{ name: string, numeric: boolean }>, rows: string[][] }}
|
|
51
|
-
*/
|
|
52
|
-
export declare function drillTable(encoded: import("pivotkit-core").Encoded, indices: ArrayLike<number>, { locale, labels, formatOf }: {
|
|
53
|
-
locale: string;
|
|
54
|
-
labels: import("pivotkit-core").Labels;
|
|
55
|
-
formatOf?: (column: string) => unknown;
|
|
56
|
-
}): {
|
|
57
|
-
columns: Array<{
|
|
58
|
-
name: string;
|
|
59
|
-
numeric: boolean;
|
|
60
|
-
}>;
|
|
61
|
-
rows: string[][];
|
|
62
|
-
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The Filter level. `hint` "conditions": opened from the search on a rule, with the rules open and
|
|
4
|
+
* the focus on the first one.
|
|
5
|
+
*/
|
|
6
|
+
export declare function FilterLevel({ view, field, encoded, types, labels, locale, commit, back, hint }: {
|
|
7
|
+
back: any;
|
|
8
|
+
commit: any;
|
|
9
|
+
encoded: any;
|
|
10
|
+
field: any;
|
|
11
|
+
hint: any;
|
|
12
|
+
labels: any;
|
|
13
|
+
locale: any;
|
|
14
|
+
types: any;
|
|
15
|
+
view: any;
|
|
16
|
+
}): React.JSX.Element | null;
|
package/types/filter.d.ts
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
/** Values listed at once; the search finds the others. */
|
|
3
3
|
export declare const FILTER_LIST_MAX = 300;
|
|
4
|
+
/** A value as a key of the set of values picked. */
|
|
5
|
+
export declare const keyOf: (v: any) => string;
|
|
6
|
+
/**
|
|
7
|
+
* The values of a field to pick from: a search, Select all and Select none (of what the search
|
|
8
|
+
* shows), and, in a part that scrolls (`children` after them), each value with its row count and
|
|
9
|
+
* "Only". `selected` holds the keys (keyOf) of the values picked; `onChange` gets the next set. The
|
|
10
|
+
* filter popover keeps it as a draft until Apply, the Filter level of a chip menu applies it at once.
|
|
11
|
+
* With `tail`, the items a rule leaves out (`isOut`) are taken out of the list and handed to `render`
|
|
12
|
+
* with the row function, for a folded group at the end of the list (the Filter level; `searching`
|
|
13
|
+
* says whether a search is on, which shows them); the group's markup is the caller's.
|
|
14
|
+
* @param {{ items: Array<{ value: unknown, label: string, count: number, kept?: boolean }>, selected: Set<string>, onChange: (next: Set<string>) => void,
|
|
15
|
+
* labels: any, locale: string, autoFocus?: boolean, tail?: { isOut: (item: any) => boolean, render: (out: any[], row: (item: any) => React.ReactNode, searching: boolean) => React.ReactNode }, children?: React.ReactNode }} props
|
|
16
|
+
*/
|
|
17
|
+
export declare function ValueList({ items, selected, onChange, labels, locale, autoFocus, tail, children }: {
|
|
18
|
+
items: Array<{
|
|
19
|
+
value: unknown;
|
|
20
|
+
label: string;
|
|
21
|
+
count: number;
|
|
22
|
+
kept?: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
selected: Set<string>;
|
|
25
|
+
onChange: (next: Set<string>) => void;
|
|
26
|
+
labels: any;
|
|
27
|
+
locale: string;
|
|
28
|
+
autoFocus?: boolean;
|
|
29
|
+
tail?: {
|
|
30
|
+
isOut: (item: any) => boolean;
|
|
31
|
+
render: (out: any[], row: (item: any) => React.ReactNode, searching: boolean) => React.ReactNode;
|
|
32
|
+
};
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
}): React.JSX.Element;
|
|
4
35
|
/**
|
|
5
36
|
* @param {{ target: { field: string, anchor: HTMLElement, base?: object } | null, onClose: () => void, view: object,
|
|
6
37
|
* encoded: import("pivotkit-core").Encoded, locale: string, labels: import("./labels.js").UiLabels, commit: (v: object, note?: any) => void }} props
|
package/types/help.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Help = {
|
|
2
|
+
/**
|
|
3
|
+
* the "i" of the settings are shown
|
|
4
|
+
*/
|
|
5
|
+
explain: boolean;
|
|
6
|
+
labels: import("./labels.js").UiLabels | null;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {object} Help
|
|
10
|
+
* @property {boolean} explain the "i" of the settings are shown
|
|
11
|
+
* @property {import("./labels.js").UiLabels | null} labels
|
|
12
|
+
*/
|
|
13
|
+
/** @type {import("react").Context<Help>} */
|
|
14
|
+
export declare const HelpContext: import("react").Context<Help>;
|
package/types/icons.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ declare const PATHS: {
|
|
|
9
9
|
x: string;
|
|
10
10
|
chevronDown: string;
|
|
11
11
|
chevronRight: string;
|
|
12
|
+
arrowUp: string;
|
|
13
|
+
arrowDown: string;
|
|
12
14
|
undo: string;
|
|
13
15
|
redo: string;
|
|
14
16
|
reset: string;
|
|
@@ -39,8 +41,10 @@ declare const PATHS: {
|
|
|
39
41
|
cols: string;
|
|
40
42
|
sigma: string;
|
|
41
43
|
info: string;
|
|
44
|
+
warn: string;
|
|
42
45
|
image: string;
|
|
43
46
|
file: string;
|
|
47
|
+
newFile: string;
|
|
44
48
|
swap: string;
|
|
45
49
|
top: string;
|
|
46
50
|
link: string;
|