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
|
@@ -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
|
@@ -138,40 +138,7 @@ export declare const SWITCHES: readonly string[];
|
|
|
138
138
|
* @param {readonly string[]} dismissed
|
|
139
139
|
*/
|
|
140
140
|
export declare function fieldsCollapsed(session: boolean | null, forced: unknown, dismissed: readonly string[]): boolean;
|
|
141
|
-
/**
|
|
142
|
-
* The sections of the menus that fold, and whether each is open until the user folds or opens it:
|
|
143
|
-
* the frequent ones open, the rest folded. The user's choice is kept in the same list (and storage)
|
|
144
|
-
* as the tips, as "open:<id>" or "closed:<id>" where it differs from this default.
|
|
145
|
-
*/
|
|
146
|
-
export declare const SECTIONS: Readonly<{
|
|
147
|
-
summarize: true;
|
|
148
|
-
showAs: true;
|
|
149
|
-
format: false;
|
|
150
|
-
highlight: false;
|
|
151
|
-
name: false;
|
|
152
|
-
valueFilters: false;
|
|
153
|
-
move: false;
|
|
154
|
-
sort: true;
|
|
155
|
-
groupBy: true;
|
|
156
|
-
bins: true;
|
|
157
|
-
topN: true;
|
|
158
|
-
filters: true;
|
|
159
|
-
totals: true;
|
|
160
|
-
folding: true;
|
|
161
|
-
help: true;
|
|
162
|
-
exportDownload: true;
|
|
163
|
-
exportCopy: true;
|
|
164
|
-
sharedViews: true;
|
|
165
|
-
myViews: true;
|
|
166
|
-
share: true;
|
|
167
|
-
chartType: true;
|
|
168
|
-
chartDisplay: true;
|
|
169
|
-
}>;
|
|
170
|
-
/** Whether a section is open: the user's choice in the list, else its default. */
|
|
171
|
-
export declare function sectionOpen(id: any, dismissed: any): any;
|
|
172
|
-
/** The list with a section opened or folded: an entry only where it differs from the default. */
|
|
173
|
-
export declare function withSection(dismissed: any, id: any, open: any): any;
|
|
174
|
-
/** Entries "Show dismissed tips again" keeps: the switches and the sections' states. */
|
|
141
|
+
/** Entries "Show dismissed tips again" keeps: the switches. */
|
|
175
142
|
export declare const keptOnReset: (id: any) => boolean;
|
|
176
143
|
/**
|
|
177
144
|
* Whether one kind of "i" shows: the host's "on" or "off" forces it (and the user's switch leaves it
|
|
@@ -8,6 +8,11 @@ export declare function ChartTypePanel({ view, plan, labels, onChart, onDisplay,
|
|
|
8
8
|
plan: any;
|
|
9
9
|
view: any;
|
|
10
10
|
}): React.JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* The Options menu (topics in menu-topics.js): the totals, Expand all and Collapse all, help with the
|
|
13
|
+
* keyboard shortcuts as a level. A switch or an action applies at once and the menu stays open (the
|
|
14
|
+
* report behind it shows the change); Expand all and Collapse all close it.
|
|
15
|
+
*/
|
|
11
16
|
export declare function OptionsPanel({ view, labels, onTotal, onExpand, onCollapse, close, tips, mod, folding, help }: {
|
|
12
17
|
close: any;
|
|
13
18
|
folding: any;
|
|
@@ -43,14 +48,17 @@ export declare function LoadCheck({ check, labels, onCancel, close, title, quiet
|
|
|
43
48
|
quiet?: boolean;
|
|
44
49
|
}): React.JSX.Element;
|
|
45
50
|
/**
|
|
46
|
-
* The Views menu: the
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* has
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* The Views menu in levels: its first level is the list to scan - "This view" (Save the loaded view
|
|
52
|
+
* under its name, or why not; Save as…; New, an empty report), "Shared views" (the host's, for
|
|
53
|
+
* everyone) and "My views" (the user's own: the host's or the browser store's), each shown only when
|
|
54
|
+
* it has entries ("My views" also when the user can save), then Share. Save as…, Share (copy a link
|
|
55
|
+
* or the JSON, download, load a view) and the questions before a change open levels of their own. An
|
|
56
|
+
* entry loads its view; a deletable one has Delete next to it, a user's view Publish when the host
|
|
57
|
+
* allows it, a shared one that is not deletable the "i" that says who changes shared views. Delete,
|
|
58
|
+
* publish and Save over a shared view ask first, in a level; the entry changes only when the host's
|
|
59
|
+
* callback (or the browser store) has finished, and the focus goes back to the entry in that place
|
|
60
|
+
* (the next one after a delete). Names need not be unique: every entry is shown, keyed by its group,
|
|
61
|
+
* its name and how often the name came before.
|
|
54
62
|
* @param {{ templates: import("./templates.js").TemplateEntry[], labels: any, onLoad: (t: any) => void, actions: any, close: () => void, share?: any }} props
|
|
55
63
|
*/
|
|
56
64
|
export declare function ViewsPanel({ templates, labels, onLoad, actions, close, share }: {
|
|
@@ -78,13 +86,15 @@ export declare function ExportOption({ icon, text, info, onSelect, testId, disab
|
|
|
78
86
|
* The Export menu: the table as a file (Excel, CSV), the chart as an image, and the table on the
|
|
79
87
|
* clipboard (as shown, or its data as JSON). The export module loads when the menu opens, so a copy
|
|
80
88
|
* happens right in the click.
|
|
81
|
-
*
|
|
89
|
+
* An empty report (no field placed) has nothing to export: every entry is off, and says so.
|
|
90
|
+
* @param {{ labels: import("./labels.js").UiLabels, onExport: (kind: string) => void, chartReady: boolean, display: string, empty?: boolean, prepare: () => void, close: () => void }} props
|
|
82
91
|
*/
|
|
83
|
-
export declare function ExportPanel({ labels, onExport, chartReady, display, prepare, close }: {
|
|
92
|
+
export declare function ExportPanel({ labels, onExport, chartReady, display, empty, prepare, close }: {
|
|
84
93
|
labels: import("./labels.js").UiLabels;
|
|
85
94
|
onExport: (kind: string) => void;
|
|
86
95
|
chartReady: boolean;
|
|
87
96
|
display: string;
|
|
97
|
+
empty?: boolean;
|
|
88
98
|
prepare: () => void;
|
|
89
99
|
close: () => void;
|
|
90
100
|
}): 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,136 @@
|
|
|
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
|
+
filterCompareField: string;
|
|
80
|
+
filterCompareValue: string;
|
|
81
|
+
filterRelativeField: string;
|
|
82
|
+
filterRelativeUnit: string;
|
|
83
|
+
filterRelativeCount: string;
|
|
84
|
+
filterRelativeAnchor: string;
|
|
85
|
+
sortNoItems: string;
|
|
86
|
+
sortedTwice: string;
|
|
87
|
+
badTotals: string;
|
|
88
|
+
collapsedPath: string;
|
|
89
|
+
unknownSetting: string;
|
|
90
|
+
badTitle: string;
|
|
91
|
+
unknownLocale: string;
|
|
92
|
+
unknownTimeZone: string;
|
|
93
|
+
timeZoneMismatch: string;
|
|
94
|
+
};
|
|
95
|
+
other: string;
|
|
96
|
+
};
|
|
97
|
+
export type UnusedContext = {
|
|
98
|
+
labels: import("./labels.js").UiLabels;
|
|
99
|
+
fill: (template: string, values: Record<string, unknown>) => string;
|
|
100
|
+
field: (name: string) => string;
|
|
101
|
+
value: (spec: {
|
|
102
|
+
field: string | null;
|
|
103
|
+
agg: string;
|
|
104
|
+
label: null;
|
|
105
|
+
showAs: null;
|
|
106
|
+
}) => string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* One issue in plain words: what it is about and what happened, the core's message aside.
|
|
110
|
+
* @param {import("pivotkit-core").Issue} issue
|
|
111
|
+
* @param {unknown} raw the view as given to normalize()
|
|
112
|
+
* @param {UnusedTexts} texts unusedTexts() of the report's language (unused-load.js)
|
|
113
|
+
* @param {UnusedContext} ctx
|
|
114
|
+
* @returns {{ pre: string, subject: string, post: string }} the text before the subject, the subject, the text after it
|
|
115
|
+
*/
|
|
116
|
+
export declare function unusedItem(issue: import("pivotkit-core").Issue, raw: unknown, texts: UnusedTexts, ctx: UnusedContext): {
|
|
117
|
+
pre: string;
|
|
118
|
+
subject: string;
|
|
119
|
+
post: string;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* The lines of a list of issues: unusedItem() of each, and where two lines about different entries
|
|
123
|
+
* have the same subject (two values both named "Sum of Units"), each with its place ("no. 2 in
|
|
124
|
+
* Values").
|
|
125
|
+
* @param {Array<{ issue: import("pivotkit-core").Issue, raw: unknown }>} notes
|
|
126
|
+
* @param {UnusedTexts} texts
|
|
127
|
+
* @param {UnusedContext} ctx
|
|
128
|
+
*/
|
|
129
|
+
export declare function unusedItems(notes: Array<{
|
|
130
|
+
issue: import("pivotkit-core").Issue;
|
|
131
|
+
raw: unknown;
|
|
132
|
+
}>, texts: UnusedTexts, ctx: UnusedContext): {
|
|
133
|
+
pre: string;
|
|
134
|
+
subject: string;
|
|
135
|
+
post: string;
|
|
136
|
+
}[];
|
|
@@ -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, earlier: () => any[], 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,15 @@ 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;
|
|
34
|
+
earlier: () => any[];
|
|
31
35
|
canUndo: boolean;
|
|
32
36
|
canRedo: boolean;
|
|
33
37
|
canReset: boolean;
|
package/types/view-history.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The saved view a step's tag names, for the data shown now: none when it was loaded for another
|
|
3
|
+
* source (one with the same columns keeps the history, not the name).
|
|
4
|
+
* @param {any} tag
|
|
5
|
+
* @param {string | undefined} sourceId
|
|
6
|
+
*/
|
|
7
|
+
export declare const tagFor: (tag: any, sourceId: string | undefined) => any;
|
|
1
8
|
/** Steps kept for undo. */
|
|
2
9
|
export declare const HISTORY_LIMIT = 100;
|
|
3
10
|
export type HistoryState = {
|
|
@@ -19,6 +26,7 @@ export type HistoryState = {
|
|
|
19
26
|
past: Array<{
|
|
20
27
|
view: string;
|
|
21
28
|
note: string;
|
|
29
|
+
tag: any;
|
|
22
30
|
}>;
|
|
23
31
|
/**
|
|
24
32
|
* views undone, newest undo last
|
|
@@ -26,23 +34,30 @@ export type HistoryState = {
|
|
|
26
34
|
future: Array<{
|
|
27
35
|
view: string;
|
|
28
36
|
note: string;
|
|
37
|
+
tag: any;
|
|
29
38
|
}>;
|
|
39
|
+
/**
|
|
40
|
+
* the saved view `present` is (an object), or null
|
|
41
|
+
*/
|
|
42
|
+
tag: any;
|
|
30
43
|
};
|
|
31
44
|
/**
|
|
32
45
|
* @typedef {object} HistoryState
|
|
33
46
|
* @property {string} schema the schema the views were normalized against
|
|
34
47
|
* @property {string} start the start view, the target of reset
|
|
35
48
|
* @property {string} present the view the history is at
|
|
36
|
-
* @property {Array<{ view: string, note: string }>} past older views, each with the note of the step that left it
|
|
37
|
-
* @property {Array<{ view: string, note: string }>} future views undone, newest undo last
|
|
49
|
+
* @property {Array<{ view: string, note: string, tag: any }>} past older views, each with the note of the step that left it
|
|
50
|
+
* @property {Array<{ view: string, note: string, tag: any }>} future views undone, newest undo last
|
|
51
|
+
* @property {any} tag the saved view `present` is (an object), or null
|
|
38
52
|
*/
|
|
39
53
|
/**
|
|
40
54
|
* @param {string} schema
|
|
41
55
|
* @param {string} start JSON of the start view
|
|
42
56
|
* @param {string} [current] JSON of the view shown now, default the start
|
|
57
|
+
* @param {any} [tag] the saved view it is
|
|
43
58
|
* @returns {HistoryState}
|
|
44
59
|
*/
|
|
45
|
-
export declare function createState(schema: string, start: string, current?: string): HistoryState;
|
|
60
|
+
export declare function createState(schema: string, start: string, current?: string, tag?: any): HistoryState;
|
|
46
61
|
/**
|
|
47
62
|
* The state a step works on: a new history when the schema changed, and the view the report shows
|
|
48
63
|
* recorded first when it differs from the history (a controlled host passed another view).
|
|
@@ -56,13 +71,15 @@ export declare function settle(state: HistoryState, at: {
|
|
|
56
71
|
outside: string;
|
|
57
72
|
}): HistoryState;
|
|
58
73
|
/**
|
|
59
|
-
* A new step; an unchanged view is none
|
|
74
|
+
* A new step; an unchanged view is none (only its tag changes, when another is given). Clears the
|
|
75
|
+
* steps that were undone.
|
|
60
76
|
* @param {HistoryState} state
|
|
61
77
|
* @param {string} view JSON
|
|
62
78
|
* @param {string} note
|
|
79
|
+
* @param {any} [tag] the saved view the step shows; default the tag of the view before
|
|
63
80
|
* @returns {HistoryState}
|
|
64
81
|
*/
|
|
65
|
-
export declare function record(state: HistoryState, view: string, note: string): HistoryState;
|
|
82
|
+
export declare function record(state: HistoryState, view: string, note: string, tag?: any): HistoryState;
|
|
66
83
|
/**
|
|
67
84
|
* One step back; `note` says what was undone (null when there was nothing to undo).
|
|
68
85
|
* @param {HistoryState} state
|
|
@@ -82,7 +99,7 @@ export declare function redo(state: HistoryState): {
|
|
|
82
99
|
note: string | null;
|
|
83
100
|
};
|
|
84
101
|
/**
|
|
85
|
-
* Back to the start view, as one step that can be undone.
|
|
102
|
+
* Back to the start view, as one step that can be undone; the start is no saved view (tag null).
|
|
86
103
|
* @param {HistoryState} state
|
|
87
104
|
* @param {string} note
|
|
88
105
|
*/
|