pivotkit-react 0.1.0 → 0.2.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 +143 -1
- package/README.md +48 -298
- package/dist/chunks/chunk-53ZMK4BH.js +177 -0
- package/dist/chunks/{chunk-ILHFIV2P.js → chunk-F6MVUAQD.js} +35 -78
- package/dist/chunks/chunk-LQCWFJBS.js +310 -0
- package/dist/chunks/chunk-OYY4BKIL.js +93 -0
- package/dist/chunks/chunk-QBD4FOBB.js +254 -0
- package/dist/chunks/{chunk-KKJO36W5.js → chunk-X7H7BAVT.js} +243 -324
- package/dist/chunks/unused-texts-YTNJCFFC.js +10 -0
- package/dist/chunks/unused-texts-de-SGOHV4N7.js +6 -0
- package/dist/echarts.js +96 -11
- package/dist/index.js +619 -527
- package/dist/labels.js +13 -4
- package/dist/menu-texts-de.js +6 -0
- package/dist/menus.js +787 -191
- package/dist/styles.css +113 -31
- package/package.json +2 -2
- package/types/chart-layout.d.ts +111 -0
- package/types/chart-types.d.ts +0 -91
- 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/help.d.ts +21 -0
- package/types/icons.d.ts +4 -0
- package/types/labels.d.ts +43 -101
- package/types/lazy-menus.d.ts +16 -4
- package/types/menu-labels-de.d.ts +2 -0
- package/types/menu-labels.d.ts +71 -9
- package/types/menu-ops.d.ts +145 -0
- package/types/menu-texts.d.ts +2 -0
- package/types/menus.d.ts +1 -1
- package/types/names.d.ts +19 -19
- package/types/overflow.d.ts +4 -1
- package/types/popover.d.ts +10 -6
- package/types/section.d.ts +7 -24
- package/types/sections.d.ts +2 -0
- 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 +9 -7
- package/types/toolbar-panels.d.ts +8 -5
- package/types/unused-load.d.ts +23 -0
- package/types/unused-texts-de.d.ts +2 -0
- package/types/unused-texts.d.ts +130 -0
- package/types/unused.d.ts +22 -0
- package/types/use-view-history.d.ts +7 -4
- package/types/view-history.d.ts +23 -6
- package/types/view-ops.d.ts +72 -123
- package/types/view-save.d.ts +76 -0
- package/types/view-store.d.ts +13 -6
- package/dist/chunks/chunk-C32TYSHG.js +0 -441
- package/dist/chunks/chunk-XYP47DJ3.js +0 -123
package/types/names.d.ts
CHANGED
|
@@ -12,6 +12,20 @@ export declare function refLabel(view: any, ref: {
|
|
|
12
12
|
field: string | null;
|
|
13
13
|
agg: string;
|
|
14
14
|
} | null | undefined, labels: import("./labels.js").UiLabels): any;
|
|
15
|
+
/**
|
|
16
|
+
* A sort in words: "Z to A", "Largest Sum of Revenue first", "Custom order".
|
|
17
|
+
* @param {any} view
|
|
18
|
+
* @param {{ by: string, order: string, value?: { field: string | null, agg: string } }} sort
|
|
19
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
20
|
+
*/
|
|
21
|
+
export declare function sortText(view: any, sort: {
|
|
22
|
+
by: string;
|
|
23
|
+
order: string;
|
|
24
|
+
value?: {
|
|
25
|
+
field: string | null;
|
|
26
|
+
agg: string;
|
|
27
|
+
};
|
|
28
|
+
}, labels: import("./labels.js").UiLabels): string;
|
|
15
29
|
/**
|
|
16
30
|
* A value condition in short: "Sum of Revenue > 1,000", "Sum of Revenue between 5 and 8".
|
|
17
31
|
* @param {any} view
|
|
@@ -33,10 +47,11 @@ export declare function groupingName(source: any, unit: any, labels: any, size:
|
|
|
33
47
|
/** The zone a click on a field of the field list puts it in: numbers to Values, the rest to Rows. */
|
|
34
48
|
export declare const quickZone: (type: any) => "rows" | "values";
|
|
35
49
|
/**
|
|
36
|
-
* What a click on a field of the field list does, from its type and the zones it is in:
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
50
|
+
* What a click (or Enter) on a field of the field list does, from its type and the zones it is in:
|
|
51
|
+
* "add" it to its quick zone, "move" it there from Columns or Filters (a field is on one axis only),
|
|
52
|
+
* or nothing when it is in that zone already, as in Excel's field list: a number in Values is not
|
|
53
|
+
* added a second time by a click, only by "Add to Values again" in its menu. `name` is the button's
|
|
54
|
+
* accessible name (the field and where it is), `description` the action in words.
|
|
40
55
|
* @param {string} field
|
|
41
56
|
* @param {string} type
|
|
42
57
|
* @param {string[]} zones the zones the field is in
|
|
@@ -63,18 +78,3 @@ export declare function layoutSummary(entries: Record<string, Array<{
|
|
|
63
78
|
title: string;
|
|
64
79
|
fields: string;
|
|
65
80
|
}>;
|
|
66
|
-
/**
|
|
67
|
-
* What the filter of a field keeps, for its menu: "Filter: 15 of 45", "Filter: contains “abc”",
|
|
68
|
-
* "Filter: Sum of Revenue > 1,000"; null without a filter.
|
|
69
|
-
* @param {any} view
|
|
70
|
-
* @param {string} field
|
|
71
|
-
* @param {{ summary: { shown: number, total: number } | null } | null | undefined} state the chip's state (zones.jsx)
|
|
72
|
-
* @param {import("./labels.js").UiLabels} labels
|
|
73
|
-
* @param {string} locale
|
|
74
|
-
*/
|
|
75
|
-
export declare function filterText(view: any, field: string, state: {
|
|
76
|
-
summary: {
|
|
77
|
-
shown: number;
|
|
78
|
-
total: number;
|
|
79
|
-
} | null;
|
|
80
|
-
} | null | undefined, labels: import("./labels.js").UiLabels, locale: string): string | null;
|
package/types/overflow.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The buttons that move into "More" when the toolbar is too narrow, first to go first: a fixed
|
|
3
3
|
* priority. The order never depends on a button's own state (Layout open or folded), so a click never
|
|
4
|
-
* moves it.
|
|
4
|
+
* moves it. Reset goes first: it is wider than "More", which takes its place. Views goes last: it is
|
|
5
|
+
* where a user saves the report, so it stays wherever one button besides Undo, Redo and Export fits
|
|
6
|
+
* (a report with its field list in a window 1280 px wide). Redo is not in the list: it stays next
|
|
7
|
+
* to Undo, which always stays. (New is in the Views menu, not in the toolbar.)
|
|
5
8
|
*/
|
|
6
9
|
export declare const OVERFLOW_ORDER: readonly string[];
|
|
7
10
|
/**
|
package/types/popover.d.ts
CHANGED
|
@@ -44,10 +44,11 @@ export declare function Popover({ open, anchor, onClose, label, role, align, cla
|
|
|
44
44
|
* @param {{ label: string, icon?: string, text?: React.ReactNode, showText?: boolean, className?: string,
|
|
45
45
|
* role?: "menu" | "dialog", align?: "start" | "end", popoverClass?: string, disabled?: boolean,
|
|
46
46
|
* title?: string, children: (close: () => void) => React.ReactNode, testId?: string, name?: string,
|
|
47
|
-
* buttonRef?: React.RefObject<HTMLButtonElement>, tabIndex?: number, slot?: string, fill?: boolean }} props
|
|
48
|
-
* `tabIndex`: -1 where a list moves the focus itself (the field list)
|
|
47
|
+
* buttonRef?: React.RefObject<HTMLButtonElement>, tabIndex?: number, slot?: string, fill?: boolean, mark?: React.ReactNode }} props
|
|
48
|
+
* `tabIndex`: -1 where a list moves the focus itself (the field list); `mark`: after the text (the
|
|
49
|
+
* dot for unsaved changes on "More")
|
|
49
50
|
*/
|
|
50
|
-
export declare function MenuButton({ label, icon, text, showText, className, role, align, popoverClass, disabled, title, children, testId, buttonRef, name, tabIndex, slot, fill }: {
|
|
51
|
+
export declare function MenuButton({ label, icon, text, showText, className, role, align, popoverClass, disabled, title, children, testId, buttonRef, name, tabIndex, slot, fill, mark }: {
|
|
51
52
|
label: string;
|
|
52
53
|
icon?: string;
|
|
53
54
|
text?: React.ReactNode;
|
|
@@ -65,16 +66,18 @@ export declare function MenuButton({ label, icon, text, showText, className, rol
|
|
|
65
66
|
tabIndex?: number;
|
|
66
67
|
slot?: string;
|
|
67
68
|
fill?: boolean;
|
|
69
|
+
mark?: React.ReactNode;
|
|
68
70
|
}): React.JSX.Element;
|
|
69
71
|
/**
|
|
70
72
|
* One option of a menu or of a chip's settings: one line. `hint` is a short second line that belongs
|
|
71
73
|
* to the option (a date unit's example); `reason` says why a disabled option does nothing and shows
|
|
72
74
|
* only while it is disabled (it is state, not an explanation: those go into an "i").
|
|
73
75
|
* @param {{ onSelect: () => void, icon?: string, checked?: boolean, children: React.ReactNode, hint?: React.ReactNode,
|
|
74
|
-
* reason?: React.ReactNode, inMenu?: boolean, disabled?: boolean, danger?: boolean, tone?: "accent", testId?: string }} props
|
|
75
|
-
* `tone`: "accent" for an option that says what is set (a filter)
|
|
76
|
+
* reason?: React.ReactNode, inMenu?: boolean, disabled?: boolean, danger?: boolean, tone?: "accent", testId?: string, current?: boolean }} props
|
|
77
|
+
* `tone`: "accent" for an option that says what is set (a filter); `current`: the entry shown now
|
|
78
|
+
* (the view loaded), with a check and aria-current
|
|
76
79
|
*/
|
|
77
|
-
export declare function Option({ onSelect, icon, checked, children, hint, reason, inMenu, disabled, danger, tone, testId }: {
|
|
80
|
+
export declare function Option({ onSelect, icon, checked, children, hint, reason, inMenu, disabled, danger, tone, testId, current }: {
|
|
78
81
|
onSelect: () => void;
|
|
79
82
|
icon?: string;
|
|
80
83
|
checked?: boolean;
|
|
@@ -86,4 +89,5 @@ export declare function Option({ onSelect, icon, checked, children, hint, reason
|
|
|
86
89
|
danger?: boolean;
|
|
87
90
|
tone?: "accent";
|
|
88
91
|
testId?: string;
|
|
92
|
+
current?: boolean;
|
|
89
93
|
}): React.JSX.Element;
|
package/types/section.d.ts
CHANGED
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export type Help = {
|
|
3
|
-
/**
|
|
4
|
-
* the "i" of the settings are shown
|
|
5
|
-
*/
|
|
6
|
-
explain: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* whether a section is open
|
|
9
|
-
*/
|
|
10
|
-
isOpen: (id: string) => boolean;
|
|
11
|
-
setOpen: (id: string, open: boolean) => void;
|
|
12
|
-
labels: import("./labels.js").UiLabels | null;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* @typedef {object} Help
|
|
16
|
-
* @property {boolean} explain the "i" of the settings are shown
|
|
17
|
-
* @property {(id: string) => boolean} isOpen whether a section is open
|
|
18
|
-
* @property {(id: string, open: boolean) => void} setOpen
|
|
19
|
-
* @property {import("./labels.js").UiLabels | null} labels
|
|
20
|
-
*/
|
|
21
|
-
/** @type {React.Context<Help>} */
|
|
22
|
-
export declare const HelpContext: React.Context<Help>;
|
|
23
2
|
/**
|
|
24
3
|
* The "i" next to a setting: its explanation (labels.settingInfo[id], loaded with the menus) on
|
|
25
4
|
* hover, focus or tap. Nothing while "Show explanations" is off or the text is missing.
|
|
@@ -31,12 +10,16 @@ export declare function SettingInfo({ id, name }: {
|
|
|
31
10
|
}): React.JSX.Element | null;
|
|
32
11
|
/**
|
|
33
12
|
* A titled group of options. With an `id` of SECTIONS (tips.js) its title is a button that folds it;
|
|
34
|
-
*
|
|
35
|
-
*
|
|
13
|
+
* folded, the title says what the section holds (`state`, muted at its end) and marks a setting that
|
|
14
|
+
* is not the default (`changed`). `info` is the id of an explanation shown as an "i" next to the
|
|
15
|
+
* title.
|
|
16
|
+
* @param {{ title: React.ReactNode, children: React.ReactNode, id?: string, info?: string, state?: string | null, changed?: boolean }} props
|
|
36
17
|
*/
|
|
37
|
-
export declare function Section({ title, children, id, info }: {
|
|
18
|
+
export declare function Section({ title, children, id, info, state, changed }: {
|
|
38
19
|
title: React.ReactNode;
|
|
39
20
|
children: React.ReactNode;
|
|
40
21
|
id?: string;
|
|
41
22
|
info?: string;
|
|
23
|
+
state?: string | null;
|
|
24
|
+
changed?: boolean;
|
|
42
25
|
}): React.JSX.Element;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export type ShareContext = {
|
|
2
|
+
/**
|
|
3
|
+
* the host allows links (shareLink) and the page has an address
|
|
4
|
+
*/
|
|
5
|
+
canLink: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* starts loading pivotkit-core/link, so a copy happens in the click
|
|
8
|
+
*/
|
|
9
|
+
prepare: (() => void) | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* the view shown
|
|
12
|
+
*/
|
|
13
|
+
view: any;
|
|
14
|
+
/**
|
|
15
|
+
* the loaded view's name
|
|
16
|
+
*/
|
|
17
|
+
viewName: string | null;
|
|
18
|
+
sourceId: string | undefined;
|
|
19
|
+
sourceName: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* the `$schema` of the view files (the prop)
|
|
22
|
+
*/
|
|
23
|
+
schemaUrl: string | null | undefined;
|
|
24
|
+
encoded: import("pivotkit-core").Encoded;
|
|
25
|
+
/**
|
|
26
|
+
* the prop: the base of the link
|
|
27
|
+
*/
|
|
28
|
+
shareLink: boolean | string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* the link's parameter in the fragment
|
|
31
|
+
*/
|
|
32
|
+
param: string;
|
|
33
|
+
/**
|
|
34
|
+
* the report's root (copies and downloads start from its document)
|
|
35
|
+
*/
|
|
36
|
+
root: {
|
|
37
|
+
current: HTMLElement | null;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* the host's file name of exports
|
|
41
|
+
*/
|
|
42
|
+
fileName: string | undefined;
|
|
43
|
+
onExport: ((file: any) => unknown) | undefined;
|
|
44
|
+
announce: (text: string, extra?: object) => void;
|
|
45
|
+
limits: object | undefined;
|
|
46
|
+
sources: Array<{
|
|
47
|
+
id: string;
|
|
48
|
+
name?: string;
|
|
49
|
+
}> | undefined;
|
|
50
|
+
onSourceSwitch: ((choice: any) => void) | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* shows a loaded view (a step Undo takes back)
|
|
53
|
+
*/
|
|
54
|
+
applyLoaded: (loaded: import("./share.js").LoadedView) => void;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @typedef {object} ShareContext what the report passes (PivotReport.jsx)
|
|
58
|
+
* @property {boolean} canLink the host allows links (shareLink) and the page has an address
|
|
59
|
+
* @property {(() => void) | undefined} prepare starts loading pivotkit-core/link, so a copy happens in the click
|
|
60
|
+
* @property {any} view the view shown
|
|
61
|
+
* @property {string | null} viewName the loaded view's name
|
|
62
|
+
* @property {string | undefined} sourceId
|
|
63
|
+
* @property {string | undefined} sourceName
|
|
64
|
+
* @property {string | null | undefined} schemaUrl the `$schema` of the view files (the prop)
|
|
65
|
+
* @property {import("pivotkit-core").Encoded} encoded
|
|
66
|
+
* @property {boolean | string | undefined} shareLink the prop: the base of the link
|
|
67
|
+
* @property {string} param the link's parameter in the fragment
|
|
68
|
+
* @property {{ current: HTMLElement | null }} root the report's root (copies and downloads start from its document)
|
|
69
|
+
* @property {string | undefined} fileName the host's file name of exports
|
|
70
|
+
* @property {((file: any) => unknown) | undefined} onExport
|
|
71
|
+
* @property {(text: string, extra?: object) => void} announce
|
|
72
|
+
* @property {object | undefined} limits
|
|
73
|
+
* @property {Array<{ id: string, name?: string }> | undefined} sources
|
|
74
|
+
* @property {((choice: any) => void) | undefined} onSourceSwitch
|
|
75
|
+
* @property {(loaded: import("./share.js").LoadedView) => void} applyLoaded shows a loaded view (a step Undo takes back)
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* The share entries' actions.
|
|
79
|
+
* @param {ShareContext} ctx
|
|
80
|
+
* @param {any} labels with the menus' texts
|
|
81
|
+
*/
|
|
82
|
+
export declare function shareActions(ctx: ShareContext, labels: any): {
|
|
83
|
+
copyLink: () => Promise<void>;
|
|
84
|
+
copyJson: () => Promise<void>;
|
|
85
|
+
download: () => void;
|
|
86
|
+
/**
|
|
87
|
+
* @param {string} text
|
|
88
|
+
* @returns {Promise<string | null | { lines: string[], load: () => void, switchTo?: { name: string, run: () => void } }>}
|
|
89
|
+
* why nothing was loaded, null when it was, or what to ask first (a view for other data)
|
|
90
|
+
*/
|
|
91
|
+
loadText: (text: string) => Promise<string | null | {
|
|
92
|
+
lines: string[];
|
|
93
|
+
load: () => void;
|
|
94
|
+
switchTo?: {
|
|
95
|
+
name: string;
|
|
96
|
+
run: () => void;
|
|
97
|
+
};
|
|
98
|
+
}>;
|
|
99
|
+
};
|
package/types/share.d.ts
CHANGED
|
@@ -51,15 +51,6 @@ export declare function readStoredView(key: string | undefined, storage: Pick<St
|
|
|
51
51
|
export declare function writeStoredView(key: string | undefined, storage: Pick<Storage, "setItem"> | null | undefined, view: object): void;
|
|
52
52
|
/** The characters a view file or pasted JSON may have (pivotkit-core's VIEW_FILE_LIMITS.text). */
|
|
53
53
|
export declare const VIEW_TEXT_MAX: 1000000;
|
|
54
|
-
/**
|
|
55
|
-
* What normalize() left out, in plain words for the person who loaded the view: the fields the data
|
|
56
|
-
* does not have by name, the rest counted. The core's messages stay for developers (onViewChange gets
|
|
57
|
-
* the view only).
|
|
58
|
-
* @param {import("pivotkit-core").Issue[]} issues
|
|
59
|
-
* @param {import("./labels.js").UiLabels} labels
|
|
60
|
-
* @returns {string[]} one line per kind, at most a few
|
|
61
|
-
*/
|
|
62
|
-
export declare function issueLines(issues: import("pivotkit-core").Issue[], labels: import("./labels.js").UiLabels): string[];
|
|
63
54
|
export type LoadedView = {
|
|
64
55
|
/**
|
|
65
56
|
* normalized against the data; null when nothing can be used
|
package/types/table.d.ts
CHANGED
|
@@ -2,12 +2,15 @@ import React from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* @param {{ grid: import("pivotkit-core").Grid, view: any, labels: import("./labels.js").UiLabels,
|
|
4
4
|
* onToggle: (axis: string, path: any[]) => void, onCell: (cell: object) => void, version: unknown, hintId?: string,
|
|
5
|
-
* onRowLabel?: (label: string | null) => void, infoOf?: (field: string) => { description?: string } | undefined, showInfo?: boolean
|
|
5
|
+
* onRowLabel?: (label: string | null) => void, infoOf?: (field: string) => { description?: string } | undefined, showInfo?: boolean,
|
|
6
|
+
* typeOf?: (field: string) => string | undefined, hostOrdered?: (field: string) => boolean, onSort?: (field: string, sort: object | null) => void }} props
|
|
6
7
|
* `onRowLabel`: the whole label of the row of a focused value or a tapped row label while the table
|
|
7
8
|
* is virtual (its labels are cut to one line); null when there is none to show; `infoOf`: the host's
|
|
8
|
-
* description of a field; `showInfo` false: no tooltip for it (the accessible description stays)
|
|
9
|
+
* description of a field; `showInfo` false: no tooltip for it (the accessible description stays);
|
|
10
|
+
* `onSort`: a header was clicked, the field's new sort entry (setSort's argument); `typeOf` the
|
|
11
|
+
* column type of a field (of its source for a grouping), `hostOrdered` whether the host gives the field an order
|
|
9
12
|
*/
|
|
10
|
-
export declare function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version, hintId, onRowLabel, infoOf, showInfo }: {
|
|
13
|
+
export declare function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version, hintId, onRowLabel, infoOf, showInfo, typeOf, hostOrdered, onSort }: {
|
|
11
14
|
grid: import("pivotkit-core").Grid;
|
|
12
15
|
view: any;
|
|
13
16
|
labels: import("./labels.js").UiLabels;
|
|
@@ -20,4 +23,7 @@ export declare function PivotTable({ grid, view, labels, onToggle: toggleGroup,
|
|
|
20
23
|
description?: string;
|
|
21
24
|
} | undefined;
|
|
22
25
|
showInfo?: boolean;
|
|
26
|
+
typeOf?: (field: string) => string | undefined;
|
|
27
|
+
hostOrdered?: (field: string) => boolean;
|
|
28
|
+
onSort?: (field: string, sort: object | null) => void;
|
|
23
29
|
}): React.JSX.Element;
|
package/types/templates.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export type TemplateEntry = {
|
|
|
12
12
|
* its place in the browser store; only for the store's own entries
|
|
13
13
|
*/
|
|
14
14
|
at?: number;
|
|
15
|
+
/**
|
|
16
|
+
* the data a view of the browser store names, when it names one
|
|
17
|
+
*/
|
|
18
|
+
sourceId?: string;
|
|
15
19
|
};
|
|
16
20
|
/**
|
|
17
21
|
* @typedef {object} TemplateEntry an entry of the Views menu
|
|
@@ -20,6 +24,7 @@ export type TemplateEntry = {
|
|
|
20
24
|
* @property {"shared" | "user"} scope
|
|
21
25
|
* @property {boolean} deletable
|
|
22
26
|
* @property {number} [at] its place in the browser store; only for the store's own entries
|
|
27
|
+
* @property {string} [sourceId] the data a view of the browser store names, when it names one
|
|
23
28
|
*/
|
|
24
29
|
/**
|
|
25
30
|
* The entries of the Views menu: the host's templates (an entry with `file` is read as a view file;
|
|
@@ -29,7 +34,7 @@ export type TemplateEntry = {
|
|
|
29
34
|
* marked `deletable` and the host takes the delete (`hostDeletes`). Every name is plain text
|
|
30
35
|
* (plainNames), as a name from a file or the store is.
|
|
31
36
|
* @param {unknown} templates the host's
|
|
32
|
-
* @param {Array<{ name: string, view: Record<string, unknown>, at: number }>} stored
|
|
37
|
+
* @param {Array<{ name: string, view: Record<string, unknown>, at: number, sourceId?: string }>} stored
|
|
33
38
|
* @param {boolean} hostDeletes
|
|
34
39
|
* @returns {TemplateEntry[]}
|
|
35
40
|
*/
|
|
@@ -37,4 +42,5 @@ export declare function templateEntries(templates: unknown, stored: Array<{
|
|
|
37
42
|
name: string;
|
|
38
43
|
view: Record<string, unknown>;
|
|
39
44
|
at: number;
|
|
45
|
+
sourceId?: string;
|
|
40
46
|
}>, hostDeletes: boolean): TemplateEntry[];
|
package/types/tips.d.ts
CHANGED
|
@@ -140,16 +140,16 @@ export declare const SWITCHES: readonly string[];
|
|
|
140
140
|
export declare function fieldsCollapsed(session: boolean | null, forced: unknown, dismissed: readonly string[]): boolean;
|
|
141
141
|
/**
|
|
142
142
|
* The sections of the menus that fold, and whether each is open until the user folds or opens it:
|
|
143
|
-
*
|
|
144
|
-
* as the tips, as "open:<id>" or
|
|
143
|
+
* what a first-time user needs open, the rest folded (a folded section's title says what it holds).
|
|
144
|
+
* The user's choice is kept in the same list (and storage) as the tips, as "open:<id>" or
|
|
145
|
+
* "closed:<id>" where it differs from this default; "Show dismissed tips again" keeps it, "Reset menu
|
|
146
|
+
* sections" (Options → Help) clears it.
|
|
145
147
|
*/
|
|
146
148
|
export declare const SECTIONS: Readonly<{
|
|
147
149
|
summarize: true;
|
|
148
150
|
showAs: true;
|
|
149
151
|
format: false;
|
|
150
152
|
highlight: false;
|
|
151
|
-
name: false;
|
|
152
|
-
valueFilters: false;
|
|
153
153
|
move: false;
|
|
154
154
|
sort: true;
|
|
155
155
|
groupBy: true;
|
|
@@ -157,20 +157,22 @@ export declare const SECTIONS: Readonly<{
|
|
|
157
157
|
topN: true;
|
|
158
158
|
filters: true;
|
|
159
159
|
totals: true;
|
|
160
|
-
folding: true;
|
|
161
160
|
help: true;
|
|
162
161
|
exportDownload: true;
|
|
163
162
|
exportCopy: true;
|
|
163
|
+
thisView: true;
|
|
164
164
|
sharedViews: true;
|
|
165
165
|
myViews: true;
|
|
166
|
-
share:
|
|
166
|
+
share: false;
|
|
167
167
|
chartType: true;
|
|
168
|
-
chartDisplay:
|
|
168
|
+
chartDisplay: false;
|
|
169
169
|
}>;
|
|
170
170
|
/** Whether a section is open: the user's choice in the list, else its default. */
|
|
171
171
|
export declare function sectionOpen(id: any, dismissed: any): any;
|
|
172
172
|
/** The list with a section opened or folded: an entry only where it differs from the default. */
|
|
173
173
|
export declare function withSection(dismissed: any, id: any, open: any): any;
|
|
174
|
+
/** An entry of the list that is a section's state. */
|
|
175
|
+
export declare const isSection: (id: any) => boolean;
|
|
174
176
|
/** Entries "Show dismissed tips again" keeps: the switches and the sections' states. */
|
|
175
177
|
export declare const keptOnReset: (id: any) => boolean;
|
|
176
178
|
/**
|
|
@@ -43,9 +43,10 @@ export declare function LoadCheck({ check, labels, onCancel, close, title, quiet
|
|
|
43
43
|
quiet?: boolean;
|
|
44
44
|
}): React.JSX.Element;
|
|
45
45
|
/**
|
|
46
|
-
* The Views menu: the
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* The Views menu: "This view" (Save the loaded view under its name, or why not; Save as, the name
|
|
47
|
+
* field; New, an empty report), the templates in two groups, "Shared views" (the host's, for
|
|
48
|
+
* everyone) and "My views" (the user's own: the host's or the browser store's), each shown only when
|
|
49
|
+
* it has entries ("My views" also when the user can save), then sharing. An entry loads its view; a deletable one
|
|
49
50
|
* has a delete button, a shared one that is not has the "i" that says who changes shared views, and
|
|
50
51
|
* a user's view offers "Publish as shared view" when the host allows it. Delete and publish ask
|
|
51
52
|
* first, in place; the entry changes only when the host's callback (or the browser store) has
|
|
@@ -78,13 +79,15 @@ export declare function ExportOption({ icon, text, info, onSelect, testId, disab
|
|
|
78
79
|
* The Export menu: the table as a file (Excel, CSV), the chart as an image, and the table on the
|
|
79
80
|
* clipboard (as shown, or its data as JSON). The export module loads when the menu opens, so a copy
|
|
80
81
|
* happens right in the click.
|
|
81
|
-
*
|
|
82
|
+
* An empty report (no field placed) has nothing to export: every entry is off, and says so.
|
|
83
|
+
* @param {{ labels: import("./labels.js").UiLabels, onExport: (kind: string) => void, chartReady: boolean, display: string, empty?: boolean, prepare: () => void, close: () => void }} props
|
|
82
84
|
*/
|
|
83
|
-
export declare function ExportPanel({ labels, onExport, chartReady, display, prepare, close }: {
|
|
85
|
+
export declare function ExportPanel({ labels, onExport, chartReady, display, empty, prepare, close }: {
|
|
84
86
|
labels: import("./labels.js").UiLabels;
|
|
85
87
|
onExport: (kind: string) => void;
|
|
86
88
|
chartReady: boolean;
|
|
87
89
|
display: string;
|
|
90
|
+
empty?: boolean;
|
|
88
91
|
prepare: () => void;
|
|
89
92
|
close: () => void;
|
|
90
93
|
}): React.JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @type {Readonly<Record<string, () => Promise<Partial<import("./unused-texts.js").UnusedTexts>>>>} */
|
|
2
|
+
export declare const UNUSED_TEXTS_OF: Readonly<Record<string, () => Promise<Partial<import("./unused-texts.js").UnusedTexts>>>>;
|
|
3
|
+
export type UnusedLoaded = {
|
|
4
|
+
mod: typeof import("./unused-texts.js");
|
|
5
|
+
lang: Partial<import("./unused-texts.js").UnusedTexts> | null;
|
|
6
|
+
};
|
|
7
|
+
/** The texts of `lang` when they are here, else null. */
|
|
8
|
+
export declare const unusedNow: (lang: any) => UnusedLoaded | null;
|
|
9
|
+
/**
|
|
10
|
+
* The plain-word texts with those of `lang` (null when it has none, or they failed); rejects when the
|
|
11
|
+
* English module fails.
|
|
12
|
+
* @param {string} lang
|
|
13
|
+
* @returns {Promise<UnusedLoaded>}
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadUnused(lang: string): Promise<UnusedLoaded>;
|
|
16
|
+
/**
|
|
17
|
+
* The texts of a language: English, the language's own over it, a host's `unused` labels over both
|
|
18
|
+
* (kept aside by resolveLabels, as the menus' are).
|
|
19
|
+
* @param {UnusedLoaded} loaded
|
|
20
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
21
|
+
* @returns {import("./unused-texts.js").UnusedTexts}
|
|
22
|
+
*/
|
|
23
|
+
export declare function unusedTexts(loaded: UnusedLoaded, labels: import("./labels.js").UiLabels): import("./unused-texts.js").UnusedTexts;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export type UnusedTexts = typeof en;
|
|
2
|
+
/** @typedef {typeof en} UnusedTexts */
|
|
3
|
+
export declare const en: {
|
|
4
|
+
item: string;
|
|
5
|
+
quote: string;
|
|
6
|
+
position: string;
|
|
7
|
+
view: string;
|
|
8
|
+
sections: {
|
|
9
|
+
sort: string;
|
|
10
|
+
derived: string;
|
|
11
|
+
totals: string;
|
|
12
|
+
collapsed: string;
|
|
13
|
+
display: string;
|
|
14
|
+
chart: string;
|
|
15
|
+
formatting: string;
|
|
16
|
+
};
|
|
17
|
+
settings: {
|
|
18
|
+
display: string;
|
|
19
|
+
type: string;
|
|
20
|
+
valueLabels: string;
|
|
21
|
+
legend: string;
|
|
22
|
+
axisLabels: string;
|
|
23
|
+
groupLabels: string;
|
|
24
|
+
labelPosition: string;
|
|
25
|
+
other: string;
|
|
26
|
+
};
|
|
27
|
+
dropped: {
|
|
28
|
+
rows: string;
|
|
29
|
+
cols: string;
|
|
30
|
+
values: string;
|
|
31
|
+
filters: string;
|
|
32
|
+
sort: string;
|
|
33
|
+
derived: string;
|
|
34
|
+
other: string;
|
|
35
|
+
};
|
|
36
|
+
codes: {
|
|
37
|
+
notView: string;
|
|
38
|
+
notJson: string;
|
|
39
|
+
tooLarge: string;
|
|
40
|
+
badVersion: string;
|
|
41
|
+
newerVersion: string;
|
|
42
|
+
noMigration: string;
|
|
43
|
+
unknownKey: string;
|
|
44
|
+
notList: string;
|
|
45
|
+
tooMany: string;
|
|
46
|
+
tooManyItems: string;
|
|
47
|
+
itemType: string;
|
|
48
|
+
unknownField: string;
|
|
49
|
+
unknownFieldHere: string;
|
|
50
|
+
placedTwice: string;
|
|
51
|
+
groupingNoName: string;
|
|
52
|
+
groupingNameTaken: string;
|
|
53
|
+
groupingNoSource: string;
|
|
54
|
+
groupingUnknown: string;
|
|
55
|
+
binsNeedNumber: string;
|
|
56
|
+
groupingNeedsDate: string;
|
|
57
|
+
binSize: string;
|
|
58
|
+
notValueRef: string;
|
|
59
|
+
unknownAggregator: string;
|
|
60
|
+
aggregatorNeedsField: string;
|
|
61
|
+
aggregatorType: string;
|
|
62
|
+
unknownFormat: string;
|
|
63
|
+
badLabel: string;
|
|
64
|
+
unknownShowAs: string;
|
|
65
|
+
showAsNotAdditive: string;
|
|
66
|
+
showAsNotNumber: string;
|
|
67
|
+
unknownConditional: string;
|
|
68
|
+
conditionalNotNumber: string;
|
|
69
|
+
colorScaleColors: string;
|
|
70
|
+
dataBarColor: string;
|
|
71
|
+
unknownFilterType: string;
|
|
72
|
+
filterNoItems: string;
|
|
73
|
+
filterLabelOp: string;
|
|
74
|
+
filterText: string;
|
|
75
|
+
filterNotNumber: string;
|
|
76
|
+
filterCount: string;
|
|
77
|
+
filterValue: string;
|
|
78
|
+
filterValue2: string;
|
|
79
|
+
sortNoItems: string;
|
|
80
|
+
sortedTwice: string;
|
|
81
|
+
badTotals: string;
|
|
82
|
+
collapsedPath: string;
|
|
83
|
+
unknownSetting: string;
|
|
84
|
+
badTitle: string;
|
|
85
|
+
unknownLocale: string;
|
|
86
|
+
unknownTimeZone: string;
|
|
87
|
+
timeZoneMismatch: string;
|
|
88
|
+
};
|
|
89
|
+
other: string;
|
|
90
|
+
};
|
|
91
|
+
export type UnusedContext = {
|
|
92
|
+
labels: import("./labels.js").UiLabels;
|
|
93
|
+
fill: (template: string, values: Record<string, unknown>) => string;
|
|
94
|
+
field: (name: string) => string;
|
|
95
|
+
value: (spec: {
|
|
96
|
+
field: string | null;
|
|
97
|
+
agg: string;
|
|
98
|
+
label: null;
|
|
99
|
+
showAs: null;
|
|
100
|
+
}) => string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* One issue in plain words: what it is about and what happened, the core's message aside.
|
|
104
|
+
* @param {import("pivotkit-core").Issue} issue
|
|
105
|
+
* @param {unknown} raw the view as given to normalize()
|
|
106
|
+
* @param {UnusedTexts} texts unusedTexts() of the report's language (unused-load.js)
|
|
107
|
+
* @param {UnusedContext} ctx
|
|
108
|
+
* @returns {{ pre: string, subject: string, post: string }} the text before the subject, the subject, the text after it
|
|
109
|
+
*/
|
|
110
|
+
export declare function unusedItem(issue: import("pivotkit-core").Issue, raw: unknown, texts: UnusedTexts, ctx: UnusedContext): {
|
|
111
|
+
pre: string;
|
|
112
|
+
subject: string;
|
|
113
|
+
post: string;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The lines of a list of issues: unusedItem() of each, and where two lines about different entries
|
|
117
|
+
* have the same subject (two values both named "Sum of Units"), each with its place ("no. 2 in
|
|
118
|
+
* Values").
|
|
119
|
+
* @param {Array<{ issue: import("pivotkit-core").Issue, raw: unknown }>} notes
|
|
120
|
+
* @param {UnusedTexts} texts
|
|
121
|
+
* @param {UnusedContext} ctx
|
|
122
|
+
*/
|
|
123
|
+
export declare function unusedItems(notes: Array<{
|
|
124
|
+
issue: import("pivotkit-core").Issue;
|
|
125
|
+
raw: unknown;
|
|
126
|
+
}>, texts: UnusedTexts, ctx: UnusedContext): {
|
|
127
|
+
pre: string;
|
|
128
|
+
subject: string;
|
|
129
|
+
post: string;
|
|
130
|
+
}[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type UnusedNote = {
|
|
3
|
+
issue: import("pivotkit-core").Issue;
|
|
4
|
+
raw: unknown;
|
|
5
|
+
} | {
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @param {{ notes: UnusedNote[], notesKey: string, dismissed: boolean, onDismiss: (next: HTMLElement | null) => void,
|
|
10
|
+
* labels: import("./labels.js").UiLabels, locale: string, narrow: boolean, quiet: boolean }} props
|
|
11
|
+
* `quiet`: the status note said it already (a view loaded partly), so the live region stays empty
|
|
12
|
+
*/
|
|
13
|
+
export declare function Unused({ notes, notesKey, dismissed, onDismiss, labels, locale, narrow, quiet }: {
|
|
14
|
+
notes: UnusedNote[];
|
|
15
|
+
notesKey: string;
|
|
16
|
+
dismissed: boolean;
|
|
17
|
+
onDismiss: (next: HTMLElement | null) => void;
|
|
18
|
+
labels: import("./labels.js").UiLabels;
|
|
19
|
+
locale: string;
|
|
20
|
+
narrow: boolean;
|
|
21
|
+
quiet: boolean;
|
|
22
|
+
}): React.JSX.Element;
|
|
@@ -8,9 +8,9 @@ export declare function schemaKeyOf(encoded: import("pivotkit-core").Encoded): s
|
|
|
8
8
|
* onViewChange?: (view: import("pivotkit-core").View) => void, limits: object | undefined, outsideNote: string,
|
|
9
9
|
* orderOf?: (field: string) => unknown[] | undefined }} options `orderOf`: the host's custom order of a
|
|
10
10
|
* field (fieldDefaults.order), applied to every view shown (withHostOrders); keep it stable
|
|
11
|
-
* @returns {{ view: import("pivotkit-core").View, viewKey: string, commit: (next: object, note: string) => boolean,
|
|
11
|
+
* @returns {{ view: import("pivotkit-core").View, viewKey: string, tag: any, setTag: (tag: any) => void, commit: (next: object, note: string, tag?: any) => boolean,
|
|
12
12
|
* undo: () => string | null, redo: () => string | null, reset: (note: string) => void,
|
|
13
|
-
* restore: (view: object) => void, canUndo: boolean, canRedo: boolean, canReset: boolean }}
|
|
13
|
+
* restore: (view: object, tag?: any) => void, keyOf: (view: object) => string, canUndo: boolean, canRedo: boolean, canReset: boolean }}
|
|
14
14
|
*/
|
|
15
15
|
export declare function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outsideNote, orderOf }: {
|
|
16
16
|
encoded: import("pivotkit-core").Encoded;
|
|
@@ -23,11 +23,14 @@ export declare function useViewHistory({ encoded, view, defaultView, onViewChang
|
|
|
23
23
|
}): {
|
|
24
24
|
view: import("pivotkit-core").View;
|
|
25
25
|
viewKey: string;
|
|
26
|
-
|
|
26
|
+
tag: any;
|
|
27
|
+
setTag: (tag: any) => void;
|
|
28
|
+
commit: (next: object, note: string, tag?: any) => boolean;
|
|
27
29
|
undo: () => string | null;
|
|
28
30
|
redo: () => string | null;
|
|
29
31
|
reset: (note: string) => void;
|
|
30
|
-
restore: (view: object) => void;
|
|
32
|
+
restore: (view: object, tag?: any) => void;
|
|
33
|
+
keyOf: (view: object) => string;
|
|
31
34
|
canUndo: boolean;
|
|
32
35
|
canRedo: boolean;
|
|
33
36
|
canReset: boolean;
|