pivotkit-react 0.3.0 → 0.5.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 +339 -1
- package/README.md +2 -2
- package/dist/chunks/{chunk-IOPAM4JD.js → chunk-2AT72SLA.js} +635 -980
- package/dist/chunks/chunk-3E4NB5RZ.js +215 -0
- package/dist/chunks/{chunk-32Z33U6S.js → chunk-3WUGQPWV.js} +106 -9
- package/dist/chunks/{chunk-7CC4JHDY.js → chunk-4RS72AAA.js} +27 -8
- package/dist/chunks/{chunk-EM23V5GH.js → chunk-E6M57YLL.js} +19 -8
- package/dist/chunks/{chunk-RWYHJRQO.js → chunk-JMRTIOX4.js} +17 -7
- package/dist/chunks/chunk-RIOSIYGC.js +665 -0
- package/dist/chunks/{chunk-APB4NW4O.js → chunk-U5Q5I2D5.js} +36 -10
- package/dist/chunks/report-run-BZBFOMPF.js +12 -0
- package/dist/chunks/{unused-texts-K3VFH65P.js → unused-texts-Y4R67XSN.js} +1 -1
- package/dist/chunks/{unused-texts-de-OW4TGIVX.js → unused-texts-de-6YVPTNVS.js} +1 -1
- package/dist/echarts.js +38 -156
- package/dist/import-ui.js +765 -0
- package/dist/import-worker.js +20 -0
- package/dist/index.js +683 -244
- package/dist/labels.js +14 -10
- package/dist/menu-texts-de.js +1 -1
- package/dist/menus.js +768 -299
- package/dist/styles.css +322 -100
- package/package.json +9 -4
- package/types/chart-decorate.d.ts +28 -4
- package/types/chart-types.d.ts +2 -4
- package/types/data-history.d.ts +85 -0
- package/types/data-keep.d.ts +51 -0
- package/types/data-menu.d.ts +11 -0
- package/types/dom.d.ts +40 -7
- package/types/echarts.d.ts +1 -1
- package/types/export-run.d.ts +37 -3
- package/types/field-info.d.ts +32 -0
- package/types/filter.d.ts +1 -1
- package/types/icons.d.ts +1 -0
- package/types/import-host.d.ts +53 -0
- package/types/import-labels.d.ts +401 -0
- package/types/import-limits.d.ts +6 -0
- package/types/import-module.d.ts +2 -0
- package/types/import-run.d.ts +73 -0
- package/types/import-source.d.ts +32 -0
- package/types/import-steps.d.ts +121 -0
- package/types/import-ui.d.ts +108 -0
- package/types/import-worker.d.ts +1 -0
- package/types/index.d.ts +81 -11
- package/types/labels.d.ts +224 -4
- package/types/lazy-import.d.ts +4 -0
- package/types/lazy-menus.d.ts +2 -2
- package/types/levels.d.ts +3 -2
- package/types/light-tokens.d.ts +16 -0
- package/types/menu-labels.d.ts +37 -17
- package/types/menu-ops.d.ts +161 -40
- package/types/menu-topics.d.ts +9 -8
- package/types/menus.d.ts +1 -0
- package/types/names.d.ts +47 -19
- package/types/overflow.d.ts +29 -17
- package/types/place.d.ts +24 -0
- package/types/popover.d.ts +47 -5
- package/types/print-frame.d.ts +24 -0
- package/types/report-run.d.ts +14 -0
- package/types/section.d.ts +2 -2
- package/types/share-actions.d.ts +3 -3
- package/types/share.d.ts +13 -17
- package/types/theme.d.ts +2 -16
- package/types/tips.d.ts +5 -0
- package/types/toasts.d.ts +1 -1
- package/types/toolbar-panels.d.ts +11 -9
- package/types/unused-keep.d.ts +20 -0
- package/types/unused-texts.d.ts +13 -3
- package/types/unused.d.ts +1 -0
- package/types/use-export.d.ts +2 -2
- package/types/use-view-history.d.ts +12 -4
- package/types/view-ops.d.ts +65 -6
- package/types/virtual.d.ts +15 -0
- package/types/chart-layout.d.ts +0 -111
package/types/overflow.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The buttons that move into "More" when the toolbar is too narrow, first to go first: a fixed
|
|
3
|
-
* priority. The order never depends on a button's own state (Layout open or folded
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* priority. The order never depends on a button's own state (Layout open or folded, the chart type
|
|
4
|
+
* picked: its room is its longest type's), so a click never moves it. Layout goes first. Start over
|
|
5
|
+
* and Views go last: Start over holds New, which must be as easy to find as Reset, and Views is where
|
|
6
|
+
* a user saves the report. "data" is the place of a Data button (loading data):
|
|
7
|
+
* a toolbar without one leaves it out and pays nothing for it. Redo is not in the list: it stays next
|
|
8
|
+
* to Undo, which always stays, as do Table | Chart and Export.
|
|
8
9
|
*/
|
|
9
10
|
export declare const OVERFLOW_ORDER: readonly string[];
|
|
10
11
|
/**
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
12
|
+
* The groups of "More", in order, each with a rule between it and the one before: starting over (its
|
|
13
|
+
* two actions as entries of their own), the report's layout and settings, data, the saved views. A
|
|
14
|
+
* group without an entry in More is not shown.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MORE_GROUPS: readonly (readonly string[])[];
|
|
17
|
+
/**
|
|
18
|
+
* The room (em of the toolbar's font) each part of the toolbar takes, the gap after it included: the
|
|
19
|
+
* estimate where the browser cannot measure (a server render, no canvas), with the longer of the
|
|
20
|
+
* built-in languages' texts. The browser measures (toolbarRoom).
|
|
15
21
|
*/
|
|
16
22
|
export declare const TOOLBAR_ROOM: Readonly<{
|
|
17
23
|
fields: 6.4;
|
|
@@ -20,20 +26,22 @@ export declare const TOOLBAR_ROOM: Readonly<{
|
|
|
20
26
|
sep: 1;
|
|
21
27
|
undo: 8.75;
|
|
22
28
|
redo: 9.15;
|
|
23
|
-
|
|
29
|
+
startOver: 10.9;
|
|
24
30
|
layout: 8.4;
|
|
25
31
|
options: 8.75;
|
|
32
|
+
data: 7.4;
|
|
26
33
|
views: 9.1;
|
|
27
34
|
export: 7.5;
|
|
28
35
|
more: 7.2;
|
|
29
36
|
}>;
|
|
30
37
|
/**
|
|
31
|
-
* Every text each part of the toolbar can show
|
|
32
|
-
* the
|
|
33
|
-
*
|
|
38
|
+
* Every text each part of the toolbar can show with the report's labels: a list of texts per part
|
|
39
|
+
* (the chart type: every type's name, so picking one never moves a button); for `display`
|
|
40
|
+
* (Table | Chart) the pair.
|
|
41
|
+
* @param {any} labels
|
|
34
42
|
* @returns {Record<string, string[]> & { display: string[][] }}
|
|
35
43
|
*/
|
|
36
|
-
export declare function toolbarTexts(
|
|
44
|
+
export declare function toolbarTexts(labels: any): Record<string, string[]> & {
|
|
37
45
|
display: string[][];
|
|
38
46
|
};
|
|
39
47
|
/**
|
|
@@ -53,10 +61,14 @@ export declare function toolbarRoom(texts: ReturnType<typeof toolbarTexts>, meas
|
|
|
53
61
|
gap: number;
|
|
54
62
|
}): Record<string, number>;
|
|
55
63
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
64
|
+
* The entries of OVERFLOW_ORDER that go into "More" in a toolbar `width` wide: first as few as the
|
|
65
|
+
* order allows (the first ones go until the rest fits, with "More"), then every one of them that the
|
|
66
|
+
* room left still holds comes back, the last in the order first. A button moves only when the room
|
|
67
|
+
* left really cannot hold it.
|
|
58
68
|
* @param {number} width in the unit of `room` (em for TOOLBAR_ROOM, px for toolbarRoom)
|
|
59
69
|
* @param {boolean} narrow the report is narrow: the Fields button is there too
|
|
70
|
+
* @param {ReadonlyArray<string>} present the entries of OVERFLOW_ORDER this toolbar has
|
|
60
71
|
* @param {Readonly<Record<string, number>>} [room]
|
|
72
|
+
* @returns {string[]} in the order of OVERFLOW_ORDER
|
|
61
73
|
*/
|
|
62
|
-
export declare function
|
|
74
|
+
export declare function overflowHidden(width: number, narrow: boolean, present: ReadonlyArray<string>, room?: Readonly<Record<string, number>>): string[];
|
package/types/place.d.ts
CHANGED
|
@@ -85,3 +85,27 @@ export declare function fromOrigin<T extends {
|
|
|
85
85
|
top: number;
|
|
86
86
|
left: number;
|
|
87
87
|
}): T;
|
|
88
|
+
/**
|
|
89
|
+
* Whether a point is on the way from an anchor to its popover: inside the smallest convex shape that
|
|
90
|
+
* holds both boxes (their convex hull). A pointer moving in a straight line from anywhere on the one
|
|
91
|
+
* to anywhere on the other stays inside it, also where the popover is moved aside to stay in the
|
|
92
|
+
* window and the way runs beside the anchor first, and in the gap between them. A hover tip stays
|
|
93
|
+
* while the pointer is there (info.jsx), whatever time the move takes.
|
|
94
|
+
* @param {{ top: number, bottom: number, left: number, right: number }} anchor getBoundingClientRect()
|
|
95
|
+
* @param {{ top: number, bottom: number, left: number, right: number }} popover getBoundingClientRect()
|
|
96
|
+
* @param {{ x: number, y: number } | null} point client coordinates
|
|
97
|
+
*/
|
|
98
|
+
export declare function onTheWay(anchor: {
|
|
99
|
+
top: number;
|
|
100
|
+
bottom: number;
|
|
101
|
+
left: number;
|
|
102
|
+
right: number;
|
|
103
|
+
}, popover: {
|
|
104
|
+
top: number;
|
|
105
|
+
bottom: number;
|
|
106
|
+
left: number;
|
|
107
|
+
right: number;
|
|
108
|
+
}, point: {
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
} | null): boolean;
|
package/types/popover.d.ts
CHANGED
|
@@ -4,6 +4,21 @@ export declare const LayerContext: React.Context<{
|
|
|
4
4
|
layer: HTMLElement | null;
|
|
5
5
|
size: string;
|
|
6
6
|
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the browser has the Popover API, so a popover goes into the top layer. Read when a popover
|
|
9
|
+
* opens (a page may load a polyfill or lack the API; a server has no HTMLElement).
|
|
10
|
+
*/
|
|
11
|
+
export declare const hasTopLayer: () => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Shows elements in the top layer while a popover is open, in order (the scrim, then the sheet above
|
|
14
|
+
* it); a popover opened later from this one is shown later, so it is above. Hidden again when it
|
|
15
|
+
* closes (an element removed from the page has left the top layer by itself).
|
|
16
|
+
* @param {boolean} open
|
|
17
|
+
* @param {Array<React.RefObject<HTMLElement | null>>} refs
|
|
18
|
+
* @param {unknown} key what re-shows them (the sheet's scrim coming or going)
|
|
19
|
+
* @param {unknown} layer the report's layer: the elements are there only once it is
|
|
20
|
+
*/
|
|
21
|
+
export declare function useTopLayer(open: boolean, refs: Array<React.RefObject<HTMLElement | null>>, key: unknown, layer: unknown): void;
|
|
7
22
|
/**
|
|
8
23
|
* Whether a wheel turn inside a popover may scroll something there: an element on its way from the
|
|
9
24
|
* target up to the popover that scrolls in that direction and is not at its end. Else the popover
|
|
@@ -44,11 +59,13 @@ export declare function Popover({ open, anchor, onClose, label, role, align, cla
|
|
|
44
59
|
* @param {{ label: string, icon?: string, text?: React.ReactNode, showText?: boolean, className?: string,
|
|
45
60
|
* role?: "menu" | "dialog", align?: "start" | "end", popoverClass?: string, disabled?: boolean,
|
|
46
61
|
* title?: string, children: (close: () => void) => React.ReactNode, testId?: string, name?: string,
|
|
47
|
-
* buttonRef?: React.RefObject<HTMLButtonElement>, tabIndex?: number, slot?: string, fill?: boolean, mark?: React.ReactNode }} props
|
|
62
|
+
* buttonRef?: React.RefObject<HTMLButtonElement>, tabIndex?: number, slot?: string, fill?: boolean, mark?: React.ReactNode, arrowOpens?: boolean, off?: string }} props
|
|
48
63
|
* `tabIndex`: -1 where a list moves the focus itself (the field list); `mark`: after the text (the
|
|
49
|
-
* dot for unsaved changes on "More")
|
|
64
|
+
* dot for unsaved changes on "More"); `arrowOpens`: the down arrow opens it (a toolbar's menu);
|
|
65
|
+
* `off`: why it opens nothing now (every entry of its menu is off): it stays focusable
|
|
66
|
+
* (aria-disabled) with the reason as its description and tooltip
|
|
50
67
|
*/
|
|
51
|
-
export declare function MenuButton({ label, icon, text, showText, className, role, align, popoverClass, disabled, title, children, testId, buttonRef, name, tabIndex, slot, fill, mark }: {
|
|
68
|
+
export declare function MenuButton({ label, icon, text, showText, className, role, align, popoverClass, disabled, title, children, testId, buttonRef, name, tabIndex, slot, fill, mark, arrowOpens, off }: {
|
|
52
69
|
label: string;
|
|
53
70
|
icon?: string;
|
|
54
71
|
text?: React.ReactNode;
|
|
@@ -67,20 +84,45 @@ export declare function MenuButton({ label, icon, text, showText, className, rol
|
|
|
67
84
|
slot?: string;
|
|
68
85
|
fill?: boolean;
|
|
69
86
|
mark?: React.ReactNode;
|
|
87
|
+
arrowOpens?: boolean;
|
|
88
|
+
off?: string;
|
|
89
|
+
}): React.JSX.Element;
|
|
90
|
+
/**
|
|
91
|
+
* A group of a menu's entries, the one way every menu draws its groups (the toolbar's menus, More,
|
|
92
|
+
* a chip menu's levels; section.jsx's Section adds the "i"): its title in bold above it, a rule
|
|
93
|
+
* between it and what comes before (styles.css: .pk-section), none above the first. In a dialog the
|
|
94
|
+
* group is the whole block, named by its title. In an ARIA menu (`menu`) the block is presentational
|
|
95
|
+
* and the group holds only the items, as a menu may own groups of items but no other text; a group
|
|
96
|
+
* without a title (More) is named by `label`.
|
|
97
|
+
* @param {{ title?: React.ReactNode, label?: string, menu?: boolean, head?: React.ReactNode, after?: React.ReactNode, children: React.ReactNode, testId?: string, titleTestId?: string }} props
|
|
98
|
+
* `head`: next to the title (an "i"); `after`: under the entries, inside the block (a note);
|
|
99
|
+
* `testId`: the group's, `titleTestId`: the title's
|
|
100
|
+
*/
|
|
101
|
+
export declare function Group({ title, label, menu, head, after, children, testId, titleTestId }: {
|
|
102
|
+
title?: React.ReactNode;
|
|
103
|
+
label?: string;
|
|
104
|
+
menu?: boolean;
|
|
105
|
+
head?: React.ReactNode;
|
|
106
|
+
after?: React.ReactNode;
|
|
107
|
+
children: React.ReactNode;
|
|
108
|
+
testId?: string;
|
|
109
|
+
titleTestId?: string;
|
|
70
110
|
}): React.JSX.Element;
|
|
71
111
|
/**
|
|
72
112
|
* One option of a menu or of a chip's settings: one line. `hint` is a short second line that belongs
|
|
73
113
|
* to the option (a date unit's example); `reason` says why a disabled option does nothing and shows
|
|
74
114
|
* only while it is disabled (it is state, not an explanation: those go into an "i").
|
|
75
|
-
* @param {{ onSelect: () => void, icon?: string, checked?: boolean, children: React.ReactNode, hint?: React.ReactNode,
|
|
115
|
+
* @param {{ onSelect: () => void, icon?: string, checked?: boolean, checkbox?: boolean, children: React.ReactNode, hint?: React.ReactNode,
|
|
76
116
|
* reason?: React.ReactNode, inMenu?: boolean, disabled?: boolean, danger?: boolean, tone?: "accent", testId?: string, current?: boolean }} props
|
|
117
|
+
* `checkbox`: a toggle of its own in a menu (menuitemcheckbox), not one of a set of choices;
|
|
77
118
|
* `tone`: "accent" for an option that says what is set (a filter); `current`: the entry shown now
|
|
78
119
|
* (the view loaded), with a check and aria-current
|
|
79
120
|
*/
|
|
80
|
-
export declare function Option({ onSelect, icon, checked, children, hint, reason, inMenu, disabled, danger, tone, testId, current }: {
|
|
121
|
+
export declare function Option({ onSelect, icon, checked, checkbox, children, hint, reason, inMenu, disabled, danger, tone, testId, current }: {
|
|
81
122
|
onSelect: () => void;
|
|
82
123
|
icon?: string;
|
|
83
124
|
checked?: boolean;
|
|
125
|
+
checkbox?: boolean;
|
|
84
126
|
children: React.ReactNode;
|
|
85
127
|
hint?: React.ReactNode;
|
|
86
128
|
reason?: React.ReactNode;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** How long the frame may take to load before printing is given up as blocked (ms). */
|
|
2
|
+
export declare const PRINT_LOAD_TIMEOUT = 5000;
|
|
3
|
+
/**
|
|
4
|
+
* The parts of a report's HTML for the frame: its stylesheet, language, title and body nodes. The
|
|
5
|
+
* stylesheet is cut out of the text before it is parsed (a <style> parsed on a page with a strict
|
|
6
|
+
* policy is reported as a violation, also in a document of DOMParser); meta elements and scripts are
|
|
7
|
+
* left out (the frame is filled as DOM).
|
|
8
|
+
* @param {string} html
|
|
9
|
+
* @param {DOMParser} parser
|
|
10
|
+
*/
|
|
11
|
+
export declare function printParts(html: string, parser: DOMParser): {
|
|
12
|
+
css: string;
|
|
13
|
+
lang: string;
|
|
14
|
+
dir: string;
|
|
15
|
+
title: string;
|
|
16
|
+
body: HTMLElement;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Prints the report's HTML from a hidden frame in `container`.
|
|
20
|
+
* @param {string} html pivotkit-report's HTML (format "html", chartEmbed "inline")
|
|
21
|
+
* @param {HTMLElement} container the report's root
|
|
22
|
+
* @returns {Promise<boolean>} false when the frame could not be used (blocked by the page)
|
|
23
|
+
*/
|
|
24
|
+
export declare function printHtml(html: string, container: HTMLElement): Promise<boolean>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { render } from "pivotkit-report";
|
|
2
|
+
export { render };
|
|
3
|
+
/**
|
|
4
|
+
* The tokens of an HTML report and an SVG, as the report's light theme resolves them (export-run.js):
|
|
5
|
+
* pivotkit-report's colours, font weights and corners, and a host's middle colour of a colour scale.
|
|
6
|
+
* The chart's lengths in px come from the chart's module (LENGTH_TOKENS).
|
|
7
|
+
*/
|
|
8
|
+
export declare const REPORT_TOKENS: readonly string[];
|
|
9
|
+
/**
|
|
10
|
+
* The HTML report's font sizes, in px as the report resolves them (export-run.js): its text and
|
|
11
|
+
* secondary text, so the file's text is the size the screen's is, and a host's title and print sizes
|
|
12
|
+
* where it sets them (pivotkit-report's own defaults else).
|
|
13
|
+
*/
|
|
14
|
+
export declare const REPORT_LENGTHS: readonly string[];
|
package/types/section.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export declare function SettingInfo({ id, name, tabIndex }: {
|
|
|
11
11
|
tabIndex?: number;
|
|
12
12
|
}): React.JSX.Element | null;
|
|
13
13
|
/**
|
|
14
|
-
* A titled group of a menu's entries (the Export menus, the chart type), with
|
|
15
|
-
* explanation shown as an "i" next to the title.
|
|
14
|
+
* A titled group of a menu's entries (the Export menus, the chart type): popover.jsx's Group, with
|
|
15
|
+
* `info`, the id of an explanation shown as an "i" next to the title.
|
|
16
16
|
* @param {{ title: React.ReactNode, children: React.ReactNode, info?: string }} props
|
|
17
17
|
*/
|
|
18
18
|
export declare function Section({ title, children, info }: {
|
package/types/share-actions.d.ts
CHANGED
|
@@ -27,9 +27,9 @@ export type ShareContext = {
|
|
|
27
27
|
*/
|
|
28
28
|
shareLink: boolean | string | undefined;
|
|
29
29
|
/**
|
|
30
|
-
* the
|
|
30
|
+
* the report's key in the fragment (its storageKey): "pivot-<key>", else "pivot"
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
linkKey: string | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* the report's root (copies and downloads start from its document)
|
|
35
35
|
*/
|
|
@@ -64,7 +64,7 @@ export type ShareContext = {
|
|
|
64
64
|
* @property {string | null | undefined} schemaUrl the `$schema` of the view files (the prop)
|
|
65
65
|
* @property {import("pivotkit-core").Encoded} encoded
|
|
66
66
|
* @property {boolean | string | undefined} shareLink the prop: the base of the link
|
|
67
|
-
* @property {string}
|
|
67
|
+
* @property {string | undefined} linkKey the report's key in the fragment (its storageKey): "pivot-<key>", else "pivot"
|
|
68
68
|
* @property {{ current: HTMLElement | null }} root the report's root (copies and downloads start from its document)
|
|
69
69
|
* @property {string | undefined} fileName the host's file name of exports
|
|
70
70
|
* @property {((file: any) => unknown) | undefined} onExport
|
package/types/share.d.ts
CHANGED
|
@@ -3,28 +3,21 @@ export declare function loadLink(): Promise<typeof import("pivotkit-core/link")>
|
|
|
3
3
|
/** The link module when it is loaded already, else null (see loadLink). */
|
|
4
4
|
export declare const linkNow: () => typeof import("pivotkit-core/link") | null;
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export declare function linkParam(storageKey: string | undefined): string;
|
|
11
|
-
/**
|
|
12
|
-
* The encoded view of a fragment ("#pivot=1.abc&pivot-sales=1.def") under a name, or null. The
|
|
13
|
-
* fragment is read as it is, not as form data, so a hash route next to it ("#/reports/a?tab=2&pivot=...")
|
|
14
|
-
* does not matter.
|
|
6
|
+
* The link text of a report's entry in a fragment ("#pivot=1.abc&pivot-sales=1.def"), or null:
|
|
7
|
+
* pivotkit-core's linkFragment. `key` is the report's storageKey: its entry is "pivot-<key>", else
|
|
8
|
+
* "pivot". The fragment is read as it is, so a hash route next to it does not matter.
|
|
15
9
|
* @param {string} hash location.hash, with or without "#"
|
|
16
|
-
* @param {string}
|
|
10
|
+
* @param {string | undefined} key
|
|
17
11
|
*/
|
|
18
|
-
export declare
|
|
12
|
+
export declare const readLinkParam: (hash: string, key: string | undefined) => string | null;
|
|
19
13
|
/**
|
|
20
|
-
* A URL with the
|
|
21
|
-
* removed
|
|
22
|
-
* an anchor) stays byte for byte.
|
|
14
|
+
* A URL with the report's link text in its fragment (pivotkit-core's withLinkFragment): only that
|
|
15
|
+
* entry is added, replaced or removed (null), the rest of the fragment stays byte for byte.
|
|
23
16
|
* @param {string} url
|
|
24
|
-
* @param {string}
|
|
25
|
-
* @param {string | null} encoded
|
|
17
|
+
* @param {string | undefined} key the report's storageKey
|
|
18
|
+
* @param {string | null} encoded
|
|
26
19
|
*/
|
|
27
|
-
export declare
|
|
20
|
+
export declare const withLinkParam: (url: string, key: string | undefined, encoded: string | null) => string;
|
|
28
21
|
/**
|
|
29
22
|
* The address a shared link points to: the host's base URL as given, or for `true` the page's own
|
|
30
23
|
* address without its query (it may hold tokens or ids the host did not mean to share) and with its
|
|
@@ -84,6 +77,9 @@ export declare function viewFromText(text: string, encoded: import("pivotkit-cor
|
|
|
84
77
|
/**
|
|
85
78
|
* A view from a parsed object (a link's) or a text, read as a view file and normalized against the
|
|
86
79
|
* data; `file.compatible` says how it fits (the same source by `options.sourceId`, its fields there).
|
|
80
|
+
* Every view that comes in this way (a link, a file, pasted JSON, the tab's stored view) comes from
|
|
81
|
+
* outside the host's code: it is normalized with pivotkit-core's outsideLimits() over the host's
|
|
82
|
+
* `options.limits` (at most 50 filters, or the host's lower value).
|
|
87
83
|
* @param {unknown} input
|
|
88
84
|
* @param {import("pivotkit-core").Encoded} encoded
|
|
89
85
|
* @param {{ limits?: object, sourceId?: string }} [options]
|
package/types/theme.d.ts
CHANGED
|
@@ -6,19 +6,5 @@
|
|
|
6
6
|
* @returns {"light" | "dark"}
|
|
7
7
|
*/
|
|
8
8
|
export declare function resolveTheme(wanted: "auto" | "light" | "dark" | undefined, htmlTheme: string | null | undefined, prefersDark: boolean): "light" | "dark";
|
|
9
|
-
/**
|
|
10
|
-
export
|
|
11
|
-
/**
|
|
12
|
-
* The ECharts theme of pivotkit-core's toEChartsOption from the computed style of the report's root.
|
|
13
|
-
* @param {{ getPropertyValue(name: string): string }} style getComputedStyle(root)
|
|
14
|
-
*/
|
|
15
|
-
export declare function chartThemeFrom(style: {
|
|
16
|
-
getPropertyValue(name: string): string;
|
|
17
|
-
}): {
|
|
18
|
-
colors: any[];
|
|
19
|
-
textColor: string | undefined;
|
|
20
|
-
axisColor: string | undefined;
|
|
21
|
-
gridColor: string | undefined;
|
|
22
|
-
fontFamily: string | undefined;
|
|
23
|
-
backgroundColor: string;
|
|
24
|
-
};
|
|
9
|
+
/** The chart's colours from the --pk-* tokens: pivotkit-core's, the same for an SVG and a printed report. */
|
|
10
|
+
export { CHART_COLORS, chartThemeFrom } from "pivotkit-core";
|
package/types/tips.d.ts
CHANGED
|
@@ -45,6 +45,11 @@ export type TipContext = {
|
|
|
45
45
|
* columns of the innermost column field (1 without column fields)
|
|
46
46
|
*/
|
|
47
47
|
colLeaves: number;
|
|
48
|
+
/**
|
|
49
|
+
* a column group with more than one child is expanded, so a
|
|
50
|
+
* column subtotal shows when column subtotals are on (core's layout.js draws none for one child)
|
|
51
|
+
*/
|
|
52
|
+
colSubtotalShown: boolean;
|
|
48
53
|
/**
|
|
49
54
|
* source rows left after the filters
|
|
50
55
|
*/
|
package/types/toasts.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type Toast = {
|
|
|
13
13
|
/** @typedef {{ id: number, text: string, action?: { label: string, run: () => void }, tone?: "error" }} Toast */
|
|
14
14
|
export declare function useToasts(): {
|
|
15
15
|
toasts: Toast[];
|
|
16
|
-
push: (toast: Omit<Toast, "id">) =>
|
|
16
|
+
push: (toast: Omit<Toast, "id">) => number;
|
|
17
17
|
dismiss: (id: any) => void;
|
|
18
18
|
pause: (on: any, list: any) => void;
|
|
19
19
|
};
|
|
@@ -48,11 +48,12 @@ export declare function LoadCheck({ check, labels, onCancel, close, title, quiet
|
|
|
48
48
|
quiet?: boolean;
|
|
49
49
|
}): React.JSX.Element;
|
|
50
50
|
/**
|
|
51
|
-
* The Views menu in levels:
|
|
52
|
-
* under its name, or why not; Save as
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
51
|
+
* The Views menu in levels: what persists, as one list to scan in groups - "This view" (Save the
|
|
52
|
+
* loaded view under its name, or why not; Save as…), "Shared views" (the host's, for everyone) and
|
|
53
|
+
* "My views" (the user's own: the host's or the browser store's), each shown only when it has entries
|
|
54
|
+
* ("My views" also when the user can save), then "Share this view" (copy a link or the JSON, download
|
|
55
|
+
* the view file, open one). Save as…, Open view file… and the questions before a change open levels
|
|
56
|
+
* of their own. (Starting over, New and Reset, is the toolbar's Start over.) An
|
|
56
57
|
* entry loads its view; a deletable one has Delete next to it, a user's view Publish when the host
|
|
57
58
|
* allows it, a shared one that is not deletable the "i" that says who changes shared views. Delete,
|
|
58
59
|
* publish and Save over a shared view ask first, in a level; the entry changes only when the host's
|
|
@@ -83,10 +84,11 @@ export declare function ExportOption({ icon, text, info, onSelect, testId, disab
|
|
|
83
84
|
reason?: string;
|
|
84
85
|
}): React.JSX.Element;
|
|
85
86
|
/**
|
|
86
|
-
* The Export menu: the table as a file (Excel, CSV), the chart as an image,
|
|
87
|
-
*
|
|
88
|
-
* happens right in the click.
|
|
89
|
-
* An empty report (no field placed) has nothing to export: every entry is off, and says so
|
|
87
|
+
* The Export menu: the table as a file (Excel, CSV), the chart as an image (PNG, SVG), an HTML report,
|
|
88
|
+
* printing (or saving as PDF from the print dialog), and the table on the clipboard (as shown, or its
|
|
89
|
+
* data as JSON). The export module loads when the menu opens, so a copy happens right in the click.
|
|
90
|
+
* An empty report (no field placed) has nothing to export: every entry is off, and says so; the chart's
|
|
91
|
+
* images are off while the table is shown.
|
|
90
92
|
* @param {{ labels: import("./labels.js").UiLabels, onExport: (kind: string) => void, chartReady: boolean, display: string, empty?: boolean, prepare: () => void, close: () => void }} props
|
|
91
93
|
*/
|
|
92
94
|
export declare function ExportPanel({ labels, onExport, chartReady, display, empty, prepare, close }: {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of a view a path names, as JSON: a value of Values by its field and aggregator (its
|
|
3
|
+
* place may differ from the place in the view as given, which may have had entries that were
|
|
4
|
+
* dropped), a setting of an object section (chart.legend), else the whole section (rows, filters), or
|
|
5
|
+
* the whole view for a path that names none ("" for a view that could not be read at all).
|
|
6
|
+
* @param {string | undefined} path an issue's path in the view as given
|
|
7
|
+
* @param {unknown} raw the view as given (a file's, a link's, the host's), before normalize()
|
|
8
|
+
* @param {Record<string, any>} view a normalized view
|
|
9
|
+
* @returns {string | undefined}
|
|
10
|
+
*/
|
|
11
|
+
export declare function partOf(path: string | undefined, raw: unknown, view: Record<string, any>): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Whether a line of the warning still applies to the view shown: the part of the view it names is
|
|
14
|
+
* as it was in the view loaded (both normalized). A line without a path (a text) names its zone in
|
|
15
|
+
* `path`, or nothing (it stays).
|
|
16
|
+
* @param {import("./unused.jsx").UnusedNote} note
|
|
17
|
+
* @param {Record<string, any> | null} loaded the view as loaded, normalized; null: every line stays
|
|
18
|
+
* @param {Record<string, any>} shown the view shown, normalized
|
|
19
|
+
*/
|
|
20
|
+
export declare function stillApplies(note: import("./unused.jsx").UnusedNote, loaded: Record<string, any> | null, shown: Record<string, any>): boolean;
|
package/types/unused-texts.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ export declare const en: {
|
|
|
45
45
|
tooMany: string;
|
|
46
46
|
tooManyItems: string;
|
|
47
47
|
itemType: string;
|
|
48
|
+
itemTooLong: string;
|
|
49
|
+
itemCase: string;
|
|
48
50
|
unknownField: string;
|
|
49
51
|
unknownFieldHere: string;
|
|
50
52
|
placedTwice: string;
|
|
@@ -70,15 +72,22 @@ export declare const en: {
|
|
|
70
72
|
dataBarColor: string;
|
|
71
73
|
unknownFilterType: string;
|
|
72
74
|
filterNoItems: string;
|
|
73
|
-
|
|
75
|
+
filterFieldType: string;
|
|
76
|
+
filterTextOp: string;
|
|
77
|
+
filterMatch: string;
|
|
78
|
+
filterNot: string;
|
|
79
|
+
filterBlanks: string;
|
|
80
|
+
blanksUnspecified: string;
|
|
81
|
+
filterEmpty: string;
|
|
74
82
|
filterText: string;
|
|
75
83
|
filterNotNumber: string;
|
|
84
|
+
filterTies: string;
|
|
85
|
+
filterPrecision: string;
|
|
76
86
|
filterCount: string;
|
|
77
87
|
filterValue: string;
|
|
78
88
|
filterValue2: string;
|
|
79
|
-
filterCompareField: string;
|
|
80
89
|
filterCompareValue: string;
|
|
81
|
-
|
|
90
|
+
filterRelativeDirection: string;
|
|
82
91
|
filterRelativeUnit: string;
|
|
83
92
|
filterRelativeCount: string;
|
|
84
93
|
filterRelativeAnchor: string;
|
|
@@ -91,6 +100,7 @@ export declare const en: {
|
|
|
91
100
|
unknownLocale: string;
|
|
92
101
|
unknownTimeZone: string;
|
|
93
102
|
timeZoneMismatch: string;
|
|
103
|
+
tooManyIssues: string;
|
|
94
104
|
};
|
|
95
105
|
other: string;
|
|
96
106
|
};
|
package/types/unused.d.ts
CHANGED
package/types/use-export.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {import("./export-run.js").ExportContext} context
|
|
3
|
-
* @returns {(kind: "xlsx" | "csv" | "png" | "copy-table" | "copy-json") => Promise<void>}
|
|
3
|
+
* @returns {(kind: "xlsx" | "csv" | "png" | "html" | "svg" | "print" | "copy-table" | "copy-json") => Promise<void>}
|
|
4
4
|
*/
|
|
5
|
-
export declare function useExport(context: import("./export-run.js").ExportContext): (kind: "xlsx" | "csv" | "png" | "copy-table" | "copy-json") => Promise<void>;
|
|
5
|
+
export declare function useExport(context: import("./export-run.js").ExportContext): (kind: "xlsx" | "csv" | "png" | "html" | "svg" | "print" | "copy-table" | "copy-json") => Promise<void>;
|
|
6
6
|
/** Starts loading the export module when a menu that copies opens: a copy right in the click is allowed everywhere. */
|
|
7
7
|
export declare const prepareExporters: () => undefined;
|
|
@@ -6,13 +6,16 @@ export declare function schemaKeyOf(encoded: import("pivotkit-core").Encoded): s
|
|
|
6
6
|
/**
|
|
7
7
|
* @param {{ encoded: import("pivotkit-core").Encoded, view: object | undefined, defaultView: object | undefined,
|
|
8
8
|
* onViewChange?: (view: import("pivotkit-core").View) => void, limits: object | undefined, outsideNote: string,
|
|
9
|
-
* orderOf?: (field: string) => unknown[] | undefined
|
|
10
|
-
*
|
|
9
|
+
* orderOf?: (field: string) => unknown[] | undefined, dataKey?: string | number,
|
|
10
|
+
* initial?: import("./view-history.js").HistoryState | null }} options `orderOf`: the host's custom order of a
|
|
11
|
+
* field (fieldDefaults.order), applied to every view shown (withHostOrders); keep it stable. `initial`:
|
|
12
|
+
* the history to start on (read on the first render only)
|
|
11
13
|
* @returns {{ view: import("pivotkit-core").View, viewKey: string, tag: any, setTag: (tag: any) => void, commit: (next: object, note: string, tag?: any) => boolean,
|
|
12
14
|
* undo: () => string | null, redo: () => string | null, reset: (note: string) => void,
|
|
13
|
-
* restore: (view: object, tag?: any) => void, keyOf: (view: object) => string, earlier: () => any[], canUndo: boolean, canRedo: boolean, canReset: boolean
|
|
15
|
+
* restore: (view: object, tag?: any) => void, keyOf: (view: object) => string, earlier: () => any[], canUndo: boolean, canRedo: boolean, canReset: boolean, startEmpty: boolean,
|
|
16
|
+
* snapshot: () => import("./view-history.js").HistoryState, replace: (state: import("./view-history.js").HistoryState) => void }}
|
|
14
17
|
*/
|
|
15
|
-
export declare function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outsideNote, orderOf }: {
|
|
18
|
+
export declare function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outsideNote, orderOf, dataKey, initial: initialState }: {
|
|
16
19
|
encoded: import("pivotkit-core").Encoded;
|
|
17
20
|
view: object | undefined;
|
|
18
21
|
defaultView: object | undefined;
|
|
@@ -20,6 +23,8 @@ export declare function useViewHistory({ encoded, view, defaultView, onViewChang
|
|
|
20
23
|
limits: object | undefined;
|
|
21
24
|
outsideNote: string;
|
|
22
25
|
orderOf?: (field: string) => unknown[] | undefined;
|
|
26
|
+
dataKey?: string | number;
|
|
27
|
+
initial?: import("./view-history.js").HistoryState | null;
|
|
23
28
|
}): {
|
|
24
29
|
view: import("pivotkit-core").View;
|
|
25
30
|
viewKey: string;
|
|
@@ -35,4 +40,7 @@ export declare function useViewHistory({ encoded, view, defaultView, onViewChang
|
|
|
35
40
|
canUndo: boolean;
|
|
36
41
|
canRedo: boolean;
|
|
37
42
|
canReset: boolean;
|
|
43
|
+
startEmpty: boolean;
|
|
44
|
+
snapshot: () => import("./view-history.js").HistoryState;
|
|
45
|
+
replace: (state: import("./view-history.js").HistoryState) => void;
|
|
38
46
|
};
|
package/types/view-ops.d.ts
CHANGED
|
@@ -1,8 +1,70 @@
|
|
|
1
|
+
import { swapAxes } from "pivotkit-core";
|
|
1
2
|
export type Zone = "rows" | "cols" | "values" | "filters";
|
|
2
3
|
/** @typedef {"rows" | "cols" | "values" | "filters"} Zone */
|
|
3
4
|
export declare const ZONES: readonly Zone[];
|
|
4
5
|
export declare const clone: (view: any) => any;
|
|
6
|
+
/** The operators of the menus' rules: on an item's name, on an item or its total. */
|
|
7
|
+
export declare const RULE_OPS: Readonly<{
|
|
8
|
+
text: readonly string[];
|
|
9
|
+
compare: readonly string[];
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* A filter's operator as the menus name it: its own, or with `not` its negation ("!=", "notBetween",
|
|
13
|
+
* "notContains", "notBeginsWith"). A `not` the menus have no word for (a loaded view's "not greater
|
|
14
|
+
* than") is hiddenNot().
|
|
15
|
+
* @param {{ op?: string, not?: boolean }} f
|
|
16
|
+
*/
|
|
17
|
+
export declare const ruleOp: (f: {
|
|
18
|
+
op?: string;
|
|
19
|
+
not?: boolean;
|
|
20
|
+
}) => any;
|
|
21
|
+
/** Whether a filter's `not` has no word in the menus (ruleOp gives the operator without it). */
|
|
22
|
+
export declare const hiddenNot: (f: any) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* A menu's operator as version 2 writes it: `{ op, not }` ("notBetween" is between with not).
|
|
25
|
+
* @param {string} menuOp
|
|
26
|
+
*/
|
|
27
|
+
export declare function opOf(menuOp: string): {
|
|
28
|
+
op: string;
|
|
29
|
+
not: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The pick of a field: the values not ticked dropped (null is the blank), so values that appear in
|
|
33
|
+
* newer data are shown, as in Excel.
|
|
34
|
+
* @param {string} field
|
|
35
|
+
* @param {unknown[]} excluded
|
|
36
|
+
*/
|
|
37
|
+
export declare const pickFilter: (field: string, excluded: unknown[]) => {
|
|
38
|
+
field: string;
|
|
39
|
+
type: string;
|
|
40
|
+
items: ({} | undefined)[];
|
|
41
|
+
not: boolean;
|
|
42
|
+
blanks: string;
|
|
43
|
+
};
|
|
44
|
+
/** The pick of a field that drops nothing: a field in the Filters zone without a filter holds it. */
|
|
45
|
+
export declare const emptyPick: (field: any) => {
|
|
46
|
+
field: string;
|
|
47
|
+
type: string;
|
|
48
|
+
items: ({} | undefined)[];
|
|
49
|
+
not: boolean;
|
|
50
|
+
blanks: string;
|
|
51
|
+
};
|
|
52
|
+
/** Whether a filter is a field's pick (an item list, ticked in the menus). */
|
|
53
|
+
export declare const isPick: (f: any) => boolean;
|
|
54
|
+
/** Whether a pick drops nothing (emptyPick). */
|
|
55
|
+
export declare const isEmptyPick: (f: any) => boolean;
|
|
5
56
|
export declare const same: (a: any, b: any) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The items of a picker whose label holds what was typed: as text filters compare (pivotkit-core's
|
|
59
|
+
* foldText), so case and runs of whitespace, a no-break space among them, do not matter.
|
|
60
|
+
* @param {Array<{ label: string } & Record<string, any>>} items
|
|
61
|
+
* @param {string} query
|
|
62
|
+
*/
|
|
63
|
+
export declare function searchItems(items: Array<{
|
|
64
|
+
label: string;
|
|
65
|
+
} & Record<string, any>>, query: string): ({
|
|
66
|
+
label: string;
|
|
67
|
+
} & Record<string, any>)[];
|
|
6
68
|
/** The fields shown in the Filters zone: filtered fields that are on no axis, once each. */
|
|
7
69
|
export declare function filterZoneFields(view: any): any[];
|
|
8
70
|
/** The axis a field is on, or null. */
|
|
@@ -235,7 +297,7 @@ export declare function nextHeaderSort(view: any, target: {
|
|
|
235
297
|
} | null;
|
|
236
298
|
/** Filters of one type of a field. */
|
|
237
299
|
export declare function filtersOf(view: any, field: any, types: any): any;
|
|
238
|
-
/** The values
|
|
300
|
+
/** The values a field's picks let through, from the field's values (null is the blank); all of them without a pick. */
|
|
239
301
|
export declare function selectedItems(view: any, field: any, all: any): any;
|
|
240
302
|
/**
|
|
241
303
|
* True when a value gives a number for each cell, so it can be shown as a share, formatted, highlighted,
|
|
@@ -296,10 +358,7 @@ export declare function setChartDisplay(view: any, patch: {
|
|
|
296
358
|
title?: string | null;
|
|
297
359
|
smooth?: boolean;
|
|
298
360
|
}): any;
|
|
299
|
-
/**
|
|
300
|
-
|
|
301
|
-
* ("running total along Rows") goes along the other one, so it still runs along the same fields.
|
|
302
|
-
*/
|
|
303
|
-
export declare function swapAxes(view: any): any;
|
|
361
|
+
/** Rows and Columns swapped (pivotkit-core's swapAxes): the chart's swap, the zones' Swap button. */
|
|
362
|
+
export { swapAxes };
|
|
304
363
|
/** True when nothing is placed: the UI shows its first steps. */
|
|
305
364
|
export declare function isEmptyView(view: any): boolean;
|