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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pivotkit-react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "React 18/19 pivot report builder on pivotkit-core: drag-and-drop fields, table and Apache ECharts chart, filters,
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "React 18/19 pivot report builder on pivotkit-core: drag-and-drop fields, table and Apache ECharts chart, filters, views as JSON files, undo, Excel and CSV export.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "eizedev <oss@eize.dev>",
|
|
7
7
|
"homepage": "https://pivotkit.eize.dev",
|
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
"reporting",
|
|
19
19
|
"drag-and-drop",
|
|
20
20
|
"echarts",
|
|
21
|
-
"self-service-bi"
|
|
21
|
+
"self-service-bi",
|
|
22
|
+
"pivot-grid",
|
|
23
|
+
"pivottable",
|
|
24
|
+
"excel-export"
|
|
22
25
|
],
|
|
23
26
|
"type": "module",
|
|
24
27
|
"sideEffects": [
|
|
@@ -34,6 +37,7 @@
|
|
|
34
37
|
"types": "./types/all-labels.d.ts",
|
|
35
38
|
"default": "./dist/labels.js"
|
|
36
39
|
},
|
|
40
|
+
"./import-worker": "./dist/import-worker.js",
|
|
37
41
|
"./styles.css": "./dist/styles.css",
|
|
38
42
|
"./package.json": "./package.json"
|
|
39
43
|
},
|
|
@@ -60,7 +64,8 @@
|
|
|
60
64
|
"dependencies": {
|
|
61
65
|
"@dnd-kit/core": "6.3.1",
|
|
62
66
|
"@dnd-kit/sortable": "10.0.0",
|
|
63
|
-
"pivotkit-core": "^0.
|
|
67
|
+
"pivotkit-core": "^0.5.0",
|
|
68
|
+
"pivotkit-report": "^0.1.0"
|
|
64
69
|
},
|
|
65
70
|
"devDependencies": {
|
|
66
71
|
"echarts": "6.1.0"
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mark styles on top of the core's option: rounded bar ends, 2 px lines, tooltips in the theme, built
|
|
3
|
-
* as DOM nodes (chart-tooltip.js) so a strict Content-Security-Policy allows them.
|
|
4
2
|
* @param {any} option
|
|
5
|
-
* @param {
|
|
3
|
+
* @param {{ getPropertyValue(name: string): string }} style the report's tokens (chartStyle)
|
|
6
4
|
* @param {number} [height] the chart's height in px, for the room around a pie
|
|
7
5
|
* @param {Document} [doc] the chart's document, for the tooltip's nodes
|
|
8
6
|
* @param {number} [width] the chart's width in px, for the column names of a heatmap and the category axis
|
|
@@ -10,7 +8,33 @@
|
|
|
10
8
|
* tooltip's title when the axis writes them shorter) and the view's chart.axisLabels
|
|
11
9
|
* @returns {any} the option; `axisEvery` (not ECharts') is n when the category axis writes every n-th label
|
|
12
10
|
*/
|
|
13
|
-
export declare function decorate(option: any, style:
|
|
11
|
+
export declare function decorate(option: any, style: {
|
|
12
|
+
getPropertyValue(name: string): string;
|
|
13
|
+
}, height?: number, doc?: Document, width?: number, extra?: {
|
|
14
14
|
categoryNames?: string[];
|
|
15
15
|
axisLabels?: string;
|
|
16
16
|
}): any;
|
|
17
|
+
/**
|
|
18
|
+
* The tokens the chart reads as lengths in px (chartThemeFrom, decorateOption): the title's and the
|
|
19
|
+
* other text's size, the marks' corners. A computed custom property keeps the calc(), max() and em it
|
|
20
|
+
* was written with, so the report resolves them first.
|
|
21
|
+
*/
|
|
22
|
+
export declare const LENGTH_TOKENS: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Tokens that are lengths, in px as the report resolves them (em of its font): a probe inside the root
|
|
25
|
+
* takes each one as its margin. A token not set, or not a length CSS takes (a keyword: its margin would
|
|
26
|
+
* be 0), is left out, so the chart keeps its default.
|
|
27
|
+
* @param {HTMLElement} root the report's root
|
|
28
|
+
* @param {readonly string[]} [names]
|
|
29
|
+
* @returns {Record<string, string>} "16px" per token
|
|
30
|
+
*/
|
|
31
|
+
export declare function tokenLengths(root: HTMLElement, names?: readonly string[]): Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* The report's computed style with its length tokens in px: what chartThemeFrom and pivotkit-core's
|
|
34
|
+
* decorateOption read.
|
|
35
|
+
* @param {HTMLElement} root
|
|
36
|
+
* @returns {{ getPropertyValue(name: string): string }}
|
|
37
|
+
*/
|
|
38
|
+
export declare function chartStyle(root: HTMLElement): {
|
|
39
|
+
getPropertyValue(name: string): string;
|
|
40
|
+
};
|
package/types/chart-types.d.ts
CHANGED
|
@@ -27,10 +27,8 @@ export declare function chartTypeOf(chart: {
|
|
|
27
27
|
horizontal?: boolean;
|
|
28
28
|
}): string;
|
|
29
29
|
/**
|
|
30
|
-
* What the chart draws for a view
|
|
31
|
-
*
|
|
32
|
-
* columns swapped for the chart alone (`swap`), so the dates run along the axis and the table keeps
|
|
33
|
-
* its layout; else bars (pivotkit-core's autoChartType decides).
|
|
30
|
+
* What the chart draws for a view: pivotkit-core's chartPlan (the same on the screen, in an SVG and a
|
|
31
|
+
* printed report) with the picker entry drawn.
|
|
34
32
|
* @param {{ rows: string[], cols: string[], derived: any[], chart: { type: string, stacked?: boolean, horizontal?: boolean } }} view
|
|
35
33
|
* @param {import("pivotkit-core").Encoded} encoded
|
|
36
34
|
* @returns {{ name: string, auto: boolean, swap: boolean, chart: { type: string, stacked: boolean, horizontal: boolean } }}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** Data steps kept for Undo and Redo together: each may hold a whole data set. */
|
|
2
|
+
export declare const DATA_STEPS = 3;
|
|
3
|
+
export type DataStep = {
|
|
4
|
+
/**
|
|
5
|
+
* the data shown before the step: the loaded file's (an object of the report's), or null for the host's
|
|
6
|
+
*/
|
|
7
|
+
data: any;
|
|
8
|
+
/**
|
|
9
|
+
* the view history it had
|
|
10
|
+
*/
|
|
11
|
+
history: import("./view-history.js").HistoryState;
|
|
12
|
+
/**
|
|
13
|
+
* what the step did ("tickets.csv loaded"), for "Undone: …"
|
|
14
|
+
*/
|
|
15
|
+
note: string;
|
|
16
|
+
};
|
|
17
|
+
export type DataSteps = {
|
|
18
|
+
past: DataStep[];
|
|
19
|
+
future: DataStep[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {object} DataStep
|
|
23
|
+
* @property {any} data the data shown before the step: the loaded file's (an object of the report's), or null for the host's
|
|
24
|
+
* @property {import("./view-history.js").HistoryState} history the view history it had
|
|
25
|
+
* @property {string} note what the step did ("tickets.csv loaded"), for "Undone: …"
|
|
26
|
+
*
|
|
27
|
+
* @typedef {{ past: DataStep[], future: DataStep[] }} DataSteps
|
|
28
|
+
*/
|
|
29
|
+
/** No data steps. */
|
|
30
|
+
export declare const NO_DATA_STEPS: Readonly<{
|
|
31
|
+
past: readonly never[];
|
|
32
|
+
future: readonly never[];
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* A new data step: the data shown before it, with its history, goes into the past; what was undone
|
|
36
|
+
* goes, and so does that history's own redo (a new step). The oldest step goes past DATA_STEPS (Undo
|
|
37
|
+
* and Redo only move steps between past and future, so the sum never grows there).
|
|
38
|
+
* @param {DataSteps} steps
|
|
39
|
+
* @param {{ data: any, history: import("./view-history.js").HistoryState }} before
|
|
40
|
+
* @param {string} note
|
|
41
|
+
* @returns {DataSteps}
|
|
42
|
+
*/
|
|
43
|
+
export declare function pushData(steps: DataSteps, before: {
|
|
44
|
+
data: any;
|
|
45
|
+
history: import("./view-history.js").HistoryState;
|
|
46
|
+
}, note: string): DataSteps;
|
|
47
|
+
/**
|
|
48
|
+
* One data step back: the data and history to show, and the steps with the data shown now (and its
|
|
49
|
+
* history as it is, with its redo) kept for Redo. Null when there is none.
|
|
50
|
+
* @param {DataSteps} steps
|
|
51
|
+
* @param {{ data: any, history: import("./view-history.js").HistoryState }} now
|
|
52
|
+
* @returns {{ steps: DataSteps, step: DataStep } | null}
|
|
53
|
+
*/
|
|
54
|
+
export declare function undoData(steps: DataSteps, now: {
|
|
55
|
+
data: any;
|
|
56
|
+
history: import("./view-history.js").HistoryState;
|
|
57
|
+
}): {
|
|
58
|
+
steps: DataSteps;
|
|
59
|
+
step: DataStep;
|
|
60
|
+
} | null;
|
|
61
|
+
/**
|
|
62
|
+
* One data step forward again; null when nothing was undone.
|
|
63
|
+
* @param {DataSteps} steps
|
|
64
|
+
* @param {{ data: any, history: import("./view-history.js").HistoryState }} now
|
|
65
|
+
* @returns {{ steps: DataSteps, step: DataStep } | null}
|
|
66
|
+
*/
|
|
67
|
+
export declare function redoData(steps: DataSteps, now: {
|
|
68
|
+
data: any;
|
|
69
|
+
history: import("./view-history.js").HistoryState;
|
|
70
|
+
}): {
|
|
71
|
+
steps: DataSteps;
|
|
72
|
+
step: DataStep;
|
|
73
|
+
} | null;
|
|
74
|
+
/**
|
|
75
|
+
* The steps without what was undone: a new step of the view drops the data steps undone before it.
|
|
76
|
+
* @param {DataSteps} steps
|
|
77
|
+
* @returns {DataSteps}
|
|
78
|
+
*/
|
|
79
|
+
export declare const withoutFuture: (steps: DataSteps) => DataSteps;
|
|
80
|
+
/**
|
|
81
|
+
* The history the host's data had when it was left last (for "Back to original data": its view comes
|
|
82
|
+
* back), or null when no step holds it.
|
|
83
|
+
* @param {DataSteps} steps
|
|
84
|
+
*/
|
|
85
|
+
export declare function hostHistory(steps: DataSteps): import("./view-history.js").HistoryState | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Reports (storageKeys) whose loaded file is kept at once: each may hold a few whole data sets. */
|
|
2
|
+
export declare const KEPT_REPORTS = 4;
|
|
3
|
+
export type KeptData = {
|
|
4
|
+
/**
|
|
5
|
+
* the host's data the file was loaded over (hostIdentity)
|
|
6
|
+
*/
|
|
7
|
+
host: string;
|
|
8
|
+
/**
|
|
9
|
+
* the file's data shown
|
|
10
|
+
*/
|
|
11
|
+
imported: import("./import-steps.js").ShownData;
|
|
12
|
+
steps: import("./data-history.js").DataSteps;
|
|
13
|
+
/**
|
|
14
|
+
* the view history of the file's data
|
|
15
|
+
*/
|
|
16
|
+
history: import("./view-history.js").HistoryState;
|
|
17
|
+
/**
|
|
18
|
+
* the saved views as loaded or saved (unsaved changes)
|
|
19
|
+
*/
|
|
20
|
+
savedKeys: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The identity of the host's data for an entry: its `dataKey` when it gives one, else its columns
|
|
24
|
+
* (names and types), with its `source` id either way. Rows are not compared: a host that renders its
|
|
25
|
+
* data again with more rows still shows the file, as a mounted report does.
|
|
26
|
+
* @param {{ dataKey: string | number | undefined, sourceId: string | undefined, schemaKey: string }} host
|
|
27
|
+
*/
|
|
28
|
+
export declare const hostIdentity: ({ dataKey, sourceId, schemaKey }: {
|
|
29
|
+
dataKey: string | number | undefined;
|
|
30
|
+
sourceId: string | undefined;
|
|
31
|
+
schemaKey: string;
|
|
32
|
+
}) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Keeps the report's state under its key, as the latest written.
|
|
35
|
+
* @param {string} key
|
|
36
|
+
* @param {KeptData} entry
|
|
37
|
+
*/
|
|
38
|
+
export declare function keepData(key: string, entry: KeptData): void;
|
|
39
|
+
/**
|
|
40
|
+
* Lets the entry of a key go.
|
|
41
|
+
* @param {string} key
|
|
42
|
+
*/
|
|
43
|
+
export declare function forgetData(key: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* The entry kept under a key for a report mounted over the host's data `host`; null when there is
|
|
46
|
+
* none, or when it was made over other data. Reads only: the report lets an entry go in an effect.
|
|
47
|
+
* @param {string} key
|
|
48
|
+
* @param {string} host
|
|
49
|
+
* @returns {KeptData | null}
|
|
50
|
+
*/
|
|
51
|
+
export declare function keptData(key: string, host: string): KeptData | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @param {{ api: import("./import-host.jsx").ImportApi & { load: () => Promise<unknown> }, close: () => void, labels: any }} props
|
|
4
|
+
*/
|
|
5
|
+
export declare function DataMenu({ api, close, labels }: {
|
|
6
|
+
api: import("./import-host.jsx").ImportApi & {
|
|
7
|
+
load: () => Promise<unknown>;
|
|
8
|
+
};
|
|
9
|
+
close: () => void;
|
|
10
|
+
labels: any;
|
|
11
|
+
}): React.JSX.Element;
|
package/types/dom.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The prefix of the names of a report's form fields (PivotReport sets one per report instance, after
|
|
3
|
+
* mounting: React's useId is unique inside one React root only, and two web components are two roots).
|
|
4
|
+
*/
|
|
5
|
+
export declare const FormNameContext: import("react").Context<string>;
|
|
6
|
+
/**
|
|
7
|
+
* A name for a form field (input, select, textarea) of this report: browsers autofill and restore by
|
|
8
|
+
* name, and list a field without a name or id as a problem of the page. A component with several
|
|
9
|
+
* fields adds a suffix of its own to it (`${name}-op`); a group of radios or checkboxes shares one.
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
export declare function useFormName(): string;
|
|
13
|
+
/** Elements that can take the focus (by Tab or not: tabStops says which Tab stops at). */
|
|
2
14
|
export declare const FOCUSABLE = "button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex='-1'])";
|
|
3
15
|
/**
|
|
4
16
|
* The document or shadow root a node is in.
|
|
@@ -19,13 +31,33 @@ export declare function activeIn(node: Node | null | undefined): Element | null;
|
|
|
19
31
|
*/
|
|
20
32
|
export declare function eventWithin(event: Event, elements: Array<Element | null | undefined>): boolean;
|
|
21
33
|
/**
|
|
22
|
-
* The
|
|
23
|
-
*
|
|
34
|
+
* The stops Tab makes in a container, in order - the one definition of a Tab stop in the report:
|
|
35
|
+
* what can take the focus (FOCUSABLE) with a tabindex of 0 or more (a roving list's other items are
|
|
36
|
+
* -1), shown (a box, not visibility: hidden) and not inert, and of a group of radios the checked one
|
|
37
|
+
* (else its first), as the browser steps.
|
|
38
|
+
* @param {Element | ShadowRoot} container
|
|
24
39
|
* @returns {HTMLElement[]}
|
|
25
40
|
*/
|
|
26
|
-
export declare function
|
|
41
|
+
export declare function tabStops(container: Element | ShadowRoot): HTMLElement[];
|
|
42
|
+
/**
|
|
43
|
+
* The stop Tab goes to from an element of the page or its shadow root, popovers left out (the one it
|
|
44
|
+
* leaves closes); null at the end of the root.
|
|
45
|
+
* @param {HTMLElement} el
|
|
46
|
+
* @returns {HTMLElement | null}
|
|
47
|
+
*/
|
|
48
|
+
export declare function stopAfter(el: HTMLElement): HTMLElement | null;
|
|
49
|
+
/**
|
|
50
|
+
* Tab and Shift+Tab inside a popover: moves the focus to the next (or previous) stop inside and
|
|
51
|
+
* returns "moved", or returns "out" when the focus is at the last (first) stop, for the caller to
|
|
52
|
+
* decide; null for any other key, a Tab taken already, or a focus outside the container.
|
|
53
|
+
* @param {KeyboardEvent | React.KeyboardEvent} event
|
|
54
|
+
* @param {Element | null} container
|
|
55
|
+
* @returns {"moved" | "out" | null}
|
|
56
|
+
*/
|
|
57
|
+
export declare function tabWithin(event: KeyboardEvent | React.KeyboardEvent, container: Element | null): "moved" | "out" | null;
|
|
27
58
|
/**
|
|
28
|
-
* Keeps Tab and Shift+Tab inside a container: from the last
|
|
59
|
+
* Keeps Tab and Shift+Tab inside a container (a modal layer): to its next stop, from the last to the
|
|
60
|
+
* first and back, a focus outside it to its first (last) stop. A Tab taken already is left alone.
|
|
29
61
|
* @param {KeyboardEvent | React.KeyboardEvent} event
|
|
30
62
|
* @param {Element | null} container
|
|
31
63
|
*/
|
|
@@ -38,8 +70,9 @@ export declare function trapTab(event: KeyboardEvent | React.KeyboardEvent, cont
|
|
|
38
70
|
*/
|
|
39
71
|
export declare function useEscapeLayer(open: boolean, onClose: () => void): void;
|
|
40
72
|
/**
|
|
41
|
-
* A modal layer (drill-down, field drawer, bottom sheet): focus moves into it when it opens
|
|
42
|
-
* to where it was when it closes; Tab stays inside
|
|
73
|
+
* A modal layer (drill-down, field drawer, bottom sheet): focus moves into it when it opens (unless a
|
|
74
|
+
* control inside has it by then) and back to where it was when it closes; Tab stays inside
|
|
75
|
+
* (`onKeyDown`); Escape closes it.
|
|
43
76
|
* @param {React.RefObject<HTMLElement | null>} ref
|
|
44
77
|
* @param {boolean} open
|
|
45
78
|
* @param {() => void} onClose
|
package/types/echarts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { init } from "echarts/core";
|
|
2
2
|
export { init };
|
|
3
3
|
export { cleanChartOptions, mergeChartOptions } from "./chart-options.js";
|
|
4
|
-
export { decorate } from "./chart-decorate.js";
|
|
4
|
+
export { LENGTH_TOKENS, chartStyle, decorate, tokenLengths } from "./chart-decorate.js";
|
package/types/export-run.d.ts
CHANGED
|
@@ -32,6 +32,34 @@ export declare function copyOut(text: string, { type, container, onExport, ...fi
|
|
|
32
32
|
container: HTMLElement | null;
|
|
33
33
|
onExport?: (file: ExportFile) => unknown;
|
|
34
34
|
}): Promise<"copied" | "kept" | "blocked">;
|
|
35
|
+
/**
|
|
36
|
+
* A CSS colour as "#rrggbb", or null: through a canvas's fillStyle, which writes an opaque sRGB colour
|
|
37
|
+
* that way whatever syntax it was given (a name, rgb(), hsl()). A text that is no colour is refused
|
|
38
|
+
* first (a canvas would keep the colour it had).
|
|
39
|
+
* @param {string} text
|
|
40
|
+
* @param {{ fillStyle: unknown } | null} ctx a 2D context
|
|
41
|
+
* @param {(text: string) => boolean} [supports] whether the text is a colour
|
|
42
|
+
*/
|
|
43
|
+
export declare function hexColor(text: string, ctx: {
|
|
44
|
+
fillStyle: unknown;
|
|
45
|
+
} | null, supports?: (text: string) => boolean): string | null;
|
|
46
|
+
/** The tokens of a workbook's colours: its colour scale (--pk-scale-mid only when a host sets it) and data bars. */
|
|
47
|
+
export declare const XLSX_TOKENS: readonly string[];
|
|
48
|
+
/**
|
|
49
|
+
* The colours of the theme the workbook gets for a conditional format whose view names none, as the
|
|
50
|
+
* report resolves its tokens (pivotkit-core's chartThemeFrom): the colour scale (--pk-scale-low, the
|
|
51
|
+
* host's --pk-scale-mid, -high) and the data bars (--pk-chart-1). Each one missing or not a colour
|
|
52
|
+
* stays pivotkit-core's default; a middle colour that is none is left out.
|
|
53
|
+
* @param {{ getPropertyValue(name: string): string }} style the report's light tokens
|
|
54
|
+
* @param {(text: string) => string | null} toHex
|
|
55
|
+
* @returns {{ colorScale?: string[], dataBar?: string }}
|
|
56
|
+
*/
|
|
57
|
+
export declare function xlsxThemeOf(style: {
|
|
58
|
+
getPropertyValue(name: string): string;
|
|
59
|
+
}, toHex: (text: string) => string | null): {
|
|
60
|
+
colorScale?: string[];
|
|
61
|
+
dataBar?: string;
|
|
62
|
+
};
|
|
35
63
|
export type ExportContext = {
|
|
36
64
|
fileName: string;
|
|
37
65
|
result: import("pivotkit-core").PivotResult | null;
|
|
@@ -44,16 +72,22 @@ export type ExportContext = {
|
|
|
44
72
|
tone?: "error";
|
|
45
73
|
}) => void;
|
|
46
74
|
onExport?: (file: ExportFile) => unknown;
|
|
75
|
+
title?: string | null;
|
|
76
|
+
source?: string | null;
|
|
77
|
+
loadECharts?: () => Promise<any>;
|
|
47
78
|
};
|
|
48
79
|
/**
|
|
49
80
|
* @typedef {{ fileName: string, result: import("pivotkit-core").PivotResult | null, locale: string,
|
|
50
81
|
* labels: import("./labels.js").UiLabels, limits: object | undefined, root: React.RefObject<HTMLElement | null>,
|
|
51
82
|
* chartRef: React.RefObject<any>, announce: (text: string, extra?: { tone?: "error" }) => void,
|
|
52
|
-
* onExport?: (file: ExportFile) => unknown }} ExportContext
|
|
83
|
+
* onExport?: (file: ExportFile) => unknown, title?: string | null, source?: string | null, loadECharts?: () => Promise<any> }} ExportContext
|
|
84
|
+
* `title`: the report's title in an HTML report (the loaded view's name); `source`: the data's name;
|
|
85
|
+
* `loadECharts`: chart.jsx's loader of dist/echarts.js (passed in: a module of the menus that
|
|
86
|
+
* imported chart.jsx would move it out of the first load into a shared chunk)
|
|
53
87
|
*/
|
|
54
88
|
/**
|
|
55
89
|
* One export of the Export menu.
|
|
56
|
-
* @param {"xlsx" | "csv" | "png" | "copy-table" | "copy-json"} kind
|
|
90
|
+
* @param {"xlsx" | "csv" | "png" | "html" | "svg" | "print" | "copy-table" | "copy-json"} kind
|
|
57
91
|
* @param {ExportContext} context
|
|
58
92
|
*/
|
|
59
|
-
export declare function runExport(kind: "xlsx" | "csv" | "png" | "copy-table" | "copy-json", { fileName, result, locale, labels, limits, root, chartRef, announce, onExport }: ExportContext): Promise<void>;
|
|
93
|
+
export declare function runExport(kind: "xlsx" | "csv" | "png" | "html" | "svg" | "print" | "copy-table" | "copy-json", { fileName, result, locale, labels, limits, root, chartRef, announce, onExport, title, source, loadECharts }: ExportContext): Promise<void>;
|
package/types/field-info.d.ts
CHANGED
|
@@ -32,3 +32,35 @@ export declare function typesOf(fieldDefaults: unknown): Record<string, string>
|
|
|
32
32
|
* @param {FieldInfo | undefined} info
|
|
33
33
|
*/
|
|
34
34
|
export declare function fieldMatches(field: string, query: string, info: FieldInfo | undefined): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether a field's name says it is an identifier: its last word is ID, Nr, No, Number, Key or "#",
|
|
37
|
+
* in any case. Words are split at a space, "_", "-", ".", "/", ":", a change from a small letter to
|
|
38
|
+
* a capital ("CustomerId", "CustomerID") and from a letter to a digit; a "#" is a word of its own
|
|
39
|
+
* ("Serial#" as "Serial #"). Before the last word is read, a part in parentheses at the end ("ID
|
|
40
|
+
* (Asset)") and digits at the end ("userID2") are left out. "Paid", "PAID" and "UUID" are one word,
|
|
41
|
+
* not one ending in "id"; "Number of items" ends in "items".
|
|
42
|
+
* @param {string} name
|
|
43
|
+
*/
|
|
44
|
+
export declare function isIdentifierName(name: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether a column is an identifier: a number column of whole numbers whose name says so
|
|
47
|
+
* (isIdentifierName). That every value is another is no sign: a count per row is too.
|
|
48
|
+
* @param {{ name: string, type: string, dict: ArrayLike<unknown>, derived?: boolean } | undefined} column
|
|
49
|
+
*/
|
|
50
|
+
export declare function isIdentifier(column: {
|
|
51
|
+
name: string;
|
|
52
|
+
type: string;
|
|
53
|
+
dict: ArrayLike<unknown>;
|
|
54
|
+
derived?: boolean;
|
|
55
|
+
} | undefined): any;
|
|
56
|
+
/**
|
|
57
|
+
* The settings of a field: the host's (fieldDefaults, matched case-insensitively like column names),
|
|
58
|
+
* and for an identifier the host says nothing about how to count or show (no `agg`, `format` or
|
|
59
|
+
* `drillFormat`): counted when it is added as a value, and its numbers shown as they are in the
|
|
60
|
+
* drill-down (27000, not 27,000). A host overrides it with any of the three.
|
|
61
|
+
* @param {unknown} fieldDefaults
|
|
62
|
+
* @param {string} field
|
|
63
|
+
* @param {Parameters<typeof isIdentifier>[0]} column the field's column (encoded.column(field))
|
|
64
|
+
* @returns {import("./index.js").FieldDefaults | undefined}
|
|
65
|
+
*/
|
|
66
|
+
export declare function fieldDefaultsFor(fieldDefaults: unknown, field: string, column: Parameters<typeof isIdentifier>[0]): import("./index.js").FieldDefaults | undefined;
|
package/types/filter.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare function ValueList({ items, selected, onChange, labels, locale, a
|
|
|
35
35
|
/**
|
|
36
36
|
* @param {{ target: { field: string, anchor: HTMLElement, base?: object } | null, onClose: () => void, view: object,
|
|
37
37
|
* encoded: import("pivotkit-core").Encoded, locale: string, labels: import("./labels.js").UiLabels, commit: (v: object, note?: any) => void }} props
|
|
38
|
-
* `target.base`: the draft view of a field that is not
|
|
38
|
+
* `target.base`: the draft view of a field that is not in Filters yet (it goes there on Apply)
|
|
39
39
|
*/
|
|
40
40
|
export declare function FilterPopover({ target, onClose, view, encoded, locale, labels, commit }: {
|
|
41
41
|
target: {
|
package/types/icons.d.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type ImportApi = import("./import-steps.js").ImportContext & {
|
|
3
|
+
job: {
|
|
4
|
+
file: File;
|
|
5
|
+
n: number;
|
|
6
|
+
} | null;
|
|
7
|
+
setJob: React.Dispatch<React.SetStateAction<{
|
|
8
|
+
file: File;
|
|
9
|
+
n: number;
|
|
10
|
+
} | null>>;
|
|
11
|
+
dismiss?: (id: number) => void;
|
|
12
|
+
dragging: boolean;
|
|
13
|
+
encoded: import("pivotkit-core").Encoded;
|
|
14
|
+
sourceName: string | undefined;
|
|
15
|
+
plugins: any[];
|
|
16
|
+
worker?: () => Worker;
|
|
17
|
+
limits?: object;
|
|
18
|
+
timeZone?: string;
|
|
19
|
+
box: () => DOMRect | undefined;
|
|
20
|
+
pick: () => void;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Files picked or dropped: one opens its preview, more than one is said to be too many. The error
|
|
24
|
+
* notes of earlier files go.
|
|
25
|
+
* @param {ImportApi} api
|
|
26
|
+
* @param {File[]} files
|
|
27
|
+
*/
|
|
28
|
+
export declare function startFiles(api: ImportApi, files: File[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Opens the browser's file picker: the report's hidden file input.
|
|
31
|
+
* @param {HTMLInputElement | null} input
|
|
32
|
+
*/
|
|
33
|
+
export declare function pickFile(input: HTMLInputElement | null): void;
|
|
34
|
+
/**
|
|
35
|
+
* The file input, the overlay while a file is dragged over the report, the dialog of the file read.
|
|
36
|
+
* @param {{ api: ImportApi, input: React.MutableRefObject<HTMLInputElement | null> }} props
|
|
37
|
+
*/
|
|
38
|
+
export declare function ImportLayer({ api, input }: {
|
|
39
|
+
api: ImportApi;
|
|
40
|
+
input: React.MutableRefObject<HTMLInputElement | null>;
|
|
41
|
+
}): React.JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* The Data menu's panel.
|
|
44
|
+
* @param {{ api: ImportApi, close: () => void }} props
|
|
45
|
+
*/
|
|
46
|
+
export declare function DataMenuPanel({ api, close }: {
|
|
47
|
+
api: ImportApi;
|
|
48
|
+
close: () => void;
|
|
49
|
+
}): React.JSX.Element;
|
|
50
|
+
/** Under the result while a file's data is shown. @param {{ api: ImportApi }} props */
|
|
51
|
+
export declare function SourceLine({ api }: {
|
|
52
|
+
api: ImportApi;
|
|
53
|
+
}): React.JSX.Element | null;
|