pivotkit-react 0.6.0 → 0.6.1
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 +69 -1
- package/dist/chunks/{chunk-2RAVX4DO.js → chunk-3LDE2GPG.js} +57 -33
- package/dist/chunks/{chunk-RIOSIYGC.js → chunk-JOWAEZAD.js} +6 -4
- package/dist/chunks/{chunk-7LERNGUW.js → chunk-ZK5RVCHP.js} +14 -2
- package/dist/import-ui.js +13 -24
- package/dist/index.js +11 -7
- package/dist/labels.js +1 -1
- package/dist/menus.js +216 -56
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/types/drill-export.d.ts +3 -2
- package/types/drill-panel.d.ts +4 -2
- package/types/export-run.d.ts +4 -3
- package/types/export-scope.d.ts +47 -0
- package/types/import-host.d.ts +8 -5
- package/types/import-labels.d.ts +14 -3
- package/types/import-run.d.ts +0 -8
- package/types/import-ui.d.ts +5 -2
- package/types/index.d.ts +14 -8
- package/types/menu-fields.d.ts +9 -0
- package/types/menu-ops.d.ts +23 -0
- package/types/names.d.ts +22 -8
- package/types/toolbar-panels.d.ts +7 -2
- package/types/view-history.d.ts +15 -0
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pivotkit-react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
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>",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@dnd-kit/core": "6.3.1",
|
|
66
66
|
"@dnd-kit/sortable": "10.0.0",
|
|
67
|
-
"pivotkit-core": "^0.6.
|
|
68
|
-
"pivotkit-report": "^0.2.
|
|
67
|
+
"pivotkit-core": "^0.6.1",
|
|
68
|
+
"pivotkit-report": "^0.2.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"echarts": "6.1.0"
|
package/types/drill-export.d.ts
CHANGED
|
@@ -15,11 +15,11 @@ export declare function rowsText({ shown, count }: {
|
|
|
15
15
|
* @param {DrillExportKind} kind
|
|
16
16
|
* @param {{ drill: { name: string, count: number, locale: string, indices: ArrayLike<number>, formats: Record<string, string>,
|
|
17
17
|
* columns: Array<{ name: string, label?: string }>, rows: string[][] },
|
|
18
|
-
* encoded: import("pivotkit-core").Encoded, labels: import("./labels.js").UiLabels,
|
|
18
|
+
* encoded: import("pivotkit-core").Encoded, labels: import("./labels.js").UiLabels, columns?: string[],
|
|
19
19
|
* onExport?: (file: import("./export-run.js").ExportFile) => unknown,
|
|
20
20
|
* announce: (text: string, extra?: { tone?: "error" }) => void, root: HTMLElement | null }} context
|
|
21
21
|
*/
|
|
22
|
-
export declare function exportDrill(kind: DrillExportKind, { drill, encoded, labels, onExport, announce, root }: {
|
|
22
|
+
export declare function exportDrill(kind: DrillExportKind, { drill, encoded, labels, columns, onExport, announce, root }: {
|
|
23
23
|
drill: {
|
|
24
24
|
name: string;
|
|
25
25
|
count: number;
|
|
@@ -34,6 +34,7 @@ export declare function exportDrill(kind: DrillExportKind, { drill, encoded, lab
|
|
|
34
34
|
};
|
|
35
35
|
encoded: import("pivotkit-core").Encoded;
|
|
36
36
|
labels: import("./labels.js").UiLabels;
|
|
37
|
+
columns?: string[];
|
|
37
38
|
onExport?: (file: import("./export-run.js").ExportFile) => unknown;
|
|
38
39
|
announce: (text: string, extra?: {
|
|
39
40
|
tone?: "error";
|
package/types/drill-panel.d.ts
CHANGED
|
@@ -4,9 +4,10 @@ export type Drill = import("./drill-table.js").Drill;
|
|
|
4
4
|
/**
|
|
5
5
|
* @param {{ drill: import("./drill-table.js").DrillSource | null, onClose: () => void, labels: import("./labels.js").UiLabels, locale: string,
|
|
6
6
|
* exportContext?: { encoded: import("pivotkit-core").Encoded, onExport?: (file: import("./export-run.js").ExportFile) => unknown,
|
|
7
|
-
* announce: (text: string, extra?: { tone?: "error" }) => void, root: React.RefObject<HTMLElement | null
|
|
7
|
+
* announce: (text: string, extra?: { tone?: "error" }) => void, root: React.RefObject<HTMLElement | null>, exportData?: unknown } }} props
|
|
8
|
+
* `exportContext`: the panel's exports; the host's exportData `{ columns }` keeps them to those (#259)
|
|
8
9
|
*/
|
|
9
|
-
export declare function DrillPanel({ drill: source, onClose, labels, locale, exportContext }: {
|
|
10
|
+
export declare function DrillPanel({ drill: source, onClose, labels, locale, exportContext: context }: {
|
|
10
11
|
drill: import("./drill-table.js").DrillSource | null;
|
|
11
12
|
onClose: () => void;
|
|
12
13
|
labels: import("./labels.js").UiLabels;
|
|
@@ -18,5 +19,6 @@ export declare function DrillPanel({ drill: source, onClose, labels, locale, exp
|
|
|
18
19
|
tone?: "error";
|
|
19
20
|
}) => void;
|
|
20
21
|
root: React.RefObject<HTMLElement | null>;
|
|
22
|
+
exportData?: unknown;
|
|
21
23
|
};
|
|
22
24
|
}): React.JSX.Element | null;
|
package/types/export-run.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export type ExportContext = {
|
|
|
64
64
|
fileName: string;
|
|
65
65
|
result: import("pivotkit-core").PivotResult | null;
|
|
66
66
|
encoded?: import("pivotkit-core").Encoded | null;
|
|
67
|
-
exportData?:
|
|
67
|
+
exportData?: unknown;
|
|
68
68
|
locale: string;
|
|
69
69
|
labels: import("./labels.js").UiLabels;
|
|
70
70
|
limits: object | undefined;
|
|
@@ -79,13 +79,14 @@ export type ExportContext = {
|
|
|
79
79
|
loadECharts?: () => Promise<any>;
|
|
80
80
|
};
|
|
81
81
|
/**
|
|
82
|
-
* @typedef {{ fileName: string, result: import("pivotkit-core").PivotResult | null, encoded?: import("pivotkit-core").Encoded | null, exportData?:
|
|
82
|
+
* @typedef {{ fileName: string, result: import("pivotkit-core").PivotResult | null, encoded?: import("pivotkit-core").Encoded | null, exportData?: unknown, locale: string,
|
|
83
83
|
* labels: import("./labels.js").UiLabels, limits: object | undefined, root: React.RefObject<HTMLElement | null>,
|
|
84
84
|
* chartRef: React.RefObject<any>, announce: (text: string, extra?: { tone?: "error" }) => void,
|
|
85
85
|
* onExport?: (file: ExportFile) => unknown, title?: string | null, source?: string | null, loadECharts?: () => Promise<any> }} ExportContext
|
|
86
86
|
* `title`: the report's title in an HTML report (the loaded view's name); `source`: the data's name;
|
|
87
87
|
* `encoded`: the data shown (the host's or a loaded file's), which the source data exports, only
|
|
88
|
-
* with `exportData` (
|
|
88
|
+
* with the host's `exportData` (read by export-scope.js: the menu hides it otherwise, and no other
|
|
89
|
+
* way reaches it; `{ columns }`: only those);
|
|
89
90
|
* `loadECharts`: chart.jsx's loader of dist/echarts.js (passed in: a module of the menus that
|
|
90
91
|
* imported chart.jsx would move it out of the first load into a shared chunk)
|
|
91
92
|
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type ExportDataOption = boolean | {
|
|
2
|
+
columns?: string[];
|
|
3
|
+
};
|
|
4
|
+
export type DataExport = {
|
|
5
|
+
source: boolean;
|
|
6
|
+
columns?: string[];
|
|
7
|
+
unknown: string[];
|
|
8
|
+
notList?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {boolean | { columns?: string[] }} ExportDataOption
|
|
12
|
+
* @typedef {{ source: boolean, columns?: string[], unknown: string[], notList?: boolean }} DataExport
|
|
13
|
+
* `source`: Source data is offered; `columns`: the host's columns as the data names them (only
|
|
14
|
+
* these, in this order, in Source data and in the drill-down's exports); `unknown`: names the host
|
|
15
|
+
* gave that no column of the data has; `notList`: `columns` was given but is no list
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The host's `exportData` against the data's own columns (not the derived fields a view adds):
|
|
19
|
+
* - off (false, absent, or a shape it does not know): no Source data; the drill-down's exports as
|
|
20
|
+
* they are, every column;
|
|
21
|
+
* - `{ columns }` that is no list (`"Region"`, a function): both off, as an empty list, so a mistake
|
|
22
|
+
* hands out nothing;
|
|
23
|
+
* - true or `{}`: Source data with every column;
|
|
24
|
+
* - `{ columns }`: Source data and the drill-down's exports with those columns only, matched
|
|
25
|
+
* case-insensitively, each once; none that matches (or an empty list): no Source data, and the
|
|
26
|
+
* drill-down's exports go too, since they would hold no column.
|
|
27
|
+
* @param {unknown} exportData
|
|
28
|
+
* @param {string[]} names the data's columns, without derived fields
|
|
29
|
+
* @returns {DataExport}
|
|
30
|
+
*/
|
|
31
|
+
export declare function dataExportOf(exportData: unknown, names: string[]): DataExport;
|
|
32
|
+
/**
|
|
33
|
+
* The places of the wanted columns among `names`, in the wanted order, matched case-insensitively as
|
|
34
|
+
* pivotkit-core's exporters match them; a name not there is left out, each column once.
|
|
35
|
+
* @param {string[]} names
|
|
36
|
+
* @param {string[] | undefined} wanted undefined: every column, in its order
|
|
37
|
+
* @returns {number[]}
|
|
38
|
+
*/
|
|
39
|
+
export declare function pickColumns(names: string[], wanted: string[] | undefined): number[];
|
|
40
|
+
/**
|
|
41
|
+
* dataExportOf against the data shown (its columns without derived fields), with the host's names
|
|
42
|
+
* that match nothing said once in the console.
|
|
43
|
+
* @param {unknown} exportData
|
|
44
|
+
* @param {import("pivotkit-core").Encoded | null | undefined} encoded
|
|
45
|
+
* @returns {DataExport}
|
|
46
|
+
*/
|
|
47
|
+
export declare function dataExportFor(exportData: unknown, encoded: import("pivotkit-core").Encoded | null | undefined): DataExport;
|
package/types/import-host.d.ts
CHANGED
|
@@ -19,7 +19,8 @@ export type ImportJob = {
|
|
|
19
19
|
n: number;
|
|
20
20
|
sheet?: string;
|
|
21
21
|
auto?: boolean;
|
|
22
|
-
|
|
22
|
+
view?: string;
|
|
23
|
+
done?: (loaded: boolean, refused?: boolean, other?: boolean) => void;
|
|
23
24
|
};
|
|
24
25
|
/**
|
|
25
26
|
* Files picked or dropped: one opens its preview, more than one is said to be too many. The error
|
|
@@ -31,13 +32,15 @@ export declare function startFiles(api: ImportApi, files: File[]): void;
|
|
|
31
32
|
/**
|
|
32
33
|
* Reads another sheet of the file shown and loads it at once (a saved view made on that sheet was
|
|
33
34
|
* opened, sheet-views.js): the dialog shows the progress and has Cancel, a sheet that cannot be read
|
|
34
|
-
* says why there. `done` is told whether the sheet was loaded (Cancel, a failure
|
|
35
|
-
* are not).
|
|
35
|
+
* says why there. `done` is told whether the sheet was loaded (Cancel, a failure, a host's refusal and
|
|
36
|
+
* another sheet picked in the preview are not).
|
|
36
37
|
* @param {ImportApi} api
|
|
37
38
|
* @param {string} sheet
|
|
38
|
-
* @param {
|
|
39
|
+
* @param {string} view the name of the view that needs the sheet, for the dialog
|
|
40
|
+
* @param {(loaded: boolean, refused?: boolean, other?: boolean) => void} done `refused`: the host
|
|
41
|
+
* refused it (onDataLoad); `other`: another sheet was picked in the preview and loaded
|
|
39
42
|
*/
|
|
40
|
-
export declare function loadSheet(api: ImportApi, sheet: string, done: (loaded: boolean, refused?: boolean) => void): void;
|
|
43
|
+
export declare function loadSheet(api: ImportApi, sheet: string, view: string, done: (loaded: boolean, refused?: boolean, other?: boolean) => void): void;
|
|
41
44
|
/**
|
|
42
45
|
* A view that names a sheet (sheet-views.js: sheetPlan): another sheet of the workbook shown is read
|
|
43
46
|
* first (loadSheet), and `then` runs once its data is shown (the report's `afterData`); a sheet the
|
package/types/import-labels.d.ts
CHANGED
|
@@ -65,10 +65,13 @@ export declare const en: {
|
|
|
65
65
|
archiveEntries: string;
|
|
66
66
|
unpackedBytes: string;
|
|
67
67
|
};
|
|
68
|
+
workbookCells: string;
|
|
68
69
|
sourceLine: string;
|
|
69
70
|
sourceSheet: string;
|
|
70
71
|
sheetMissing: string;
|
|
71
72
|
sheetRefused: string;
|
|
73
|
+
sheetForView: string;
|
|
74
|
+
sheetOther: string;
|
|
72
75
|
notes: {
|
|
73
76
|
ENCODING: string;
|
|
74
77
|
SEPARATOR: string;
|
|
@@ -192,10 +195,13 @@ export declare const IMPORT_TEXTS: Readonly<{
|
|
|
192
195
|
archiveEntries: string;
|
|
193
196
|
unpackedBytes: string;
|
|
194
197
|
};
|
|
198
|
+
workbookCells: string;
|
|
195
199
|
sourceLine: string;
|
|
196
200
|
sourceSheet: string;
|
|
197
201
|
sheetMissing: string;
|
|
198
202
|
sheetRefused: string;
|
|
203
|
+
sheetForView: string;
|
|
204
|
+
sheetOther: string;
|
|
199
205
|
notes: {
|
|
200
206
|
ENCODING: string;
|
|
201
207
|
SEPARATOR: string;
|
|
@@ -313,10 +319,13 @@ export declare const IMPORT_TEXTS: Readonly<{
|
|
|
313
319
|
archiveEntries: string;
|
|
314
320
|
unpackedBytes: string;
|
|
315
321
|
};
|
|
322
|
+
workbookCells: string;
|
|
316
323
|
sourceLine: string;
|
|
317
324
|
sourceSheet: string;
|
|
318
325
|
sheetMissing: string;
|
|
319
326
|
sheetRefused: string;
|
|
327
|
+
sheetForView: string;
|
|
328
|
+
sheetOther: string;
|
|
320
329
|
notes: {
|
|
321
330
|
ENCODING: string;
|
|
322
331
|
SEPARATOR: string;
|
|
@@ -393,9 +402,11 @@ export declare function noteText(note: {
|
|
|
393
402
|
}): string;
|
|
394
403
|
/**
|
|
395
404
|
* Why a file could not be read, after "{name} could not be loaded:", which names the file: a limit of
|
|
396
|
-
* pivotkit-core (`LIMIT_EXCEEDED` with a limit this version has words for
|
|
397
|
-
*
|
|
398
|
-
*
|
|
405
|
+
* pivotkit-core (`LIMIT_EXCEEDED` with a limit this version has words for; `importCells` reached
|
|
406
|
+
* by a workbook's shared strings and formats, as `details.what` says, in the words of
|
|
407
|
+
* `workbookCells`) in the report's language with its key (`limits.rows`, whose words fit
|
|
408
|
+
* `importLimits` too), else the reader's own English message without the file's name in front
|
|
409
|
+
* (`"name": ` of `fileError`, `"name" ` of `limitError`).
|
|
399
410
|
* @param {unknown} error
|
|
400
411
|
* @param {string} name the file's name
|
|
401
412
|
* @param {ImportTexts} texts
|
package/types/import-run.d.ts
CHANGED
|
@@ -14,14 +14,6 @@ export declare function acceptOf(plugins: readonly any[]): string;
|
|
|
14
14
|
export declare const formatsOf: (plugins: readonly any[], names?: Record<string, string>) => any[];
|
|
15
15
|
/** How long a worker may take to say it is ready before the page reads the file itself (ms). */
|
|
16
16
|
export declare const WORKER_READY_MS = 10000;
|
|
17
|
-
/**
|
|
18
|
-
* A reader's table as the import UI uses it: what checkTable of pivotkit-core does not ask for, but
|
|
19
|
-
* retype and the preview need, filled in from what is there (a plugin may return the minimal shape),
|
|
20
|
-
* and notes that are no `{ code, params }` left out.
|
|
21
|
-
* @param {any} table
|
|
22
|
-
* @returns {import("pivotkit-core/import").ImportTable}
|
|
23
|
-
*/
|
|
24
|
-
export declare function completeTable(table: any): import("pivotkit-core/import").ImportTable;
|
|
25
17
|
export type ImportRead = {
|
|
26
18
|
/**
|
|
27
19
|
* the host's reader plugins
|
package/types/import-ui.d.ts
CHANGED
|
@@ -96,8 +96,10 @@ export type LoadedData = {
|
|
|
96
96
|
* the focus moves in, Tab stays inside, Escape cancels, the focus goes back to where it was. A file
|
|
97
97
|
* that cannot be read closes it with a note; the report's data stays. A job with `sheet` starts on that
|
|
98
98
|
* sheet (a name); with `auto` it loads as soon as the sheet is read, without waiting for "Load data"
|
|
99
|
-
* (a saved view opened on another sheet of the file shown: the person asked for that sheet already)
|
|
100
|
-
*
|
|
99
|
+
* (a saved view opened on another sheet of the file shown: the person asked for that sheet already),
|
|
100
|
+
* unless the reader has notes about it or it has no rows: then the preview stays, as for a file, and
|
|
101
|
+
* says which view needs that sheet (`view`); another sheet picked there never loads by itself.
|
|
102
|
+
* @param {{ job: { file: File, n: number, sheet?: string, auto?: boolean, view?: string }, labels: any, locale: string, plugins: any[], worker?: () => Worker,
|
|
101
103
|
* limits?: object, timeZone?: string, onApply: (data: LoadedData) => void, onClose: () => void,
|
|
102
104
|
* announce: (text: string, extra?: { tone?: "error" }) => void }} props
|
|
103
105
|
*/
|
|
@@ -107,6 +109,7 @@ export declare function ImportDialog({ job, labels, locale, plugins, worker, lim
|
|
|
107
109
|
n: number;
|
|
108
110
|
sheet?: string;
|
|
109
111
|
auto?: boolean;
|
|
112
|
+
view?: string;
|
|
110
113
|
};
|
|
111
114
|
labels: any;
|
|
112
115
|
locale: string;
|
package/types/index.d.ts
CHANGED
|
@@ -274,11 +274,15 @@ export type PivotReportProps = {
|
|
|
274
274
|
*/
|
|
275
275
|
onExport?: (file: ExportFile) => unknown;
|
|
276
276
|
/**
|
|
277
|
-
* the Export menu's "Source data": every row
|
|
278
|
-
* data shown, as a CSV or JSON file, for the user's own analysis or the command line.
|
|
279
|
-
*
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
* the Export menu's "Source data": every row
|
|
278
|
+
* of the data shown, as a CSV or JSON file, for the user's own analysis or the command line.
|
|
279
|
+
* `true`: every column; `{ columns }`: only these, in this order, which the drill-down panel's
|
|
280
|
+
* copies and files keep to as well (none left: both off). Default false: the rows may hold more
|
|
281
|
+
* than the report shows (docs/security.md)
|
|
282
|
+
*/
|
|
283
|
+
exportData?: boolean | {
|
|
284
|
+
columns?: string[];
|
|
285
|
+
};
|
|
282
286
|
/**
|
|
283
287
|
* the tips above the result: "on" (default), "off"
|
|
284
288
|
* (none, and no switch in Options), or the ids of the tips allowed (an array, or a comma-separated text)
|
|
@@ -563,9 +567,11 @@ export type TipDismiss = {
|
|
|
563
567
|
* @property {(file: ExportFile) => unknown} [onExport] every exported file before its download, and
|
|
564
568
|
* every copy before it goes on the clipboard; returning false skips the download or the copy (the
|
|
565
569
|
* host keeps the file or the text, for example to upload it)
|
|
566
|
-
* @property {boolean} [exportData] the Export menu's "Source data": every row
|
|
567
|
-
* data shown, as a CSV or JSON file, for the user's own analysis or the command line.
|
|
568
|
-
*
|
|
570
|
+
* @property {boolean | { columns?: string[] }} [exportData] the Export menu's "Source data": every row
|
|
571
|
+
* of the data shown, as a CSV or JSON file, for the user's own analysis or the command line.
|
|
572
|
+
* `true`: every column; `{ columns }`: only these, in this order, which the drill-down panel's
|
|
573
|
+
* copies and files keep to as well (none left: both off). Default false: the rows may hold more
|
|
574
|
+
* than the report shows (docs/security.md)
|
|
569
575
|
* @property {"on" | "off" | string | string[]} [tips] the tips above the result: "on" (default), "off"
|
|
570
576
|
* (none, and no switch in Options), or the ids of the tips allowed (an array, or a comma-separated text)
|
|
571
577
|
* @property {string} [storageKey] remembers dismissed tips in localStorage under this key (one per
|
package/types/menu-fields.d.ts
CHANGED
|
@@ -40,6 +40,15 @@ export declare function NumberField({ value, onChange, problem, label, testId, c
|
|
|
40
40
|
onFocus?: () => void;
|
|
41
41
|
autoFocus?: boolean;
|
|
42
42
|
}): React.JSX.Element;
|
|
43
|
+
/**
|
|
44
|
+
* A menu's radio button, focused by a click: WebKit on macOS picks a radio on a click without focusing
|
|
45
|
+
* it, so the focus would land elsewhere after a pick (#148, #203).
|
|
46
|
+
* @param {React.InputHTMLAttributes<HTMLInputElement> & { "data-testid"?: string, "data-autofocus"?: string }} props
|
|
47
|
+
*/
|
|
48
|
+
export declare function Radio(props: React.InputHTMLAttributes<HTMLInputElement> & {
|
|
49
|
+
"data-testid"?: string;
|
|
50
|
+
"data-autofocus"?: string;
|
|
51
|
+
}): React.JSX.Element;
|
|
43
52
|
/**
|
|
44
53
|
* The keys of a field that applies what is typed: Enter applies now; Escape gives back what applies,
|
|
45
54
|
* or, when nothing was changed, goes back a level.
|
package/types/menu-ops.d.ts
CHANGED
|
@@ -407,3 +407,26 @@ export declare function rowsInRange(range: {
|
|
|
407
407
|
from: string | null;
|
|
408
408
|
to: string;
|
|
409
409
|
}, dict: ArrayLike<unknown>, counts: ArrayLike<number>): number;
|
|
410
|
+
/**
|
|
411
|
+
* The years Years combined keeps, in the Filter level's summary: "2024–2025 combined" for years in a
|
|
412
|
+
* row (all of them, or a run), else listed; "2026 only" for one; each year as the table writes it.
|
|
413
|
+
* @param {number[]} on the years kept, ascending
|
|
414
|
+
* @param {number[]} all the years of the data
|
|
415
|
+
* @param {any} labels
|
|
416
|
+
* @param {string} locale
|
|
417
|
+
*/
|
|
418
|
+
export declare function combinedYearsText(on: number[], all: number[], labels: any, locale: string): string;
|
|
419
|
+
/** Whether the day of `a` (an ISO day or minute) is on or before the day of `b`, by their ms. */
|
|
420
|
+
export declare const dayOnOrBefore: (a: any, b: any) => boolean;
|
|
421
|
+
/**
|
|
422
|
+
* An ISO day (or minute) as an `<input type="date">` holds it: the year with four or more digits and
|
|
423
|
+
* no sign ("10000-01-01" of "+010000-01-01"); "" for a year before 1, which the field cannot hold.
|
|
424
|
+
* @param {string} iso
|
|
425
|
+
*/
|
|
426
|
+
export declare const dateInputValue: (iso: string) => string;
|
|
427
|
+
/**
|
|
428
|
+
* What an `<input type="date">` holds as an ISO day ("+010000-01-01" of "10000-01-01"), or null while
|
|
429
|
+
* it is no whole day of a year from 1 that a Date holds.
|
|
430
|
+
* @param {string} text
|
|
431
|
+
*/
|
|
432
|
+
export declare function dateFromInput(text: string): string | null;
|
package/types/names.d.ts
CHANGED
|
@@ -43,9 +43,22 @@ export declare function valueConditionText(view: any, f: {
|
|
|
43
43
|
value: number;
|
|
44
44
|
value2?: number;
|
|
45
45
|
}, labels: import("./labels.js").UiLabels, locale: string): any;
|
|
46
|
-
/**
|
|
46
|
+
/** Wall-clock ms of an ISO day (or of a minute's day). */
|
|
47
|
+
export declare const dayMs: (iso: any) => number;
|
|
48
|
+
/** The year of an ISO day: 2026 of "2026-03-01", -1 of "-000001-01-11". */
|
|
49
|
+
export declare const yearOf: (iso: any) => number;
|
|
50
|
+
/** A year as an ISO day writes it: "0002", "2026", "-000001", "+010000". */
|
|
51
|
+
export declare const isoYear: (y: any) => string;
|
|
52
|
+
/**
|
|
53
|
+
* A year as the table writes it (pivotkit-core's year grouping): "2026", before 1 AD with its era
|
|
54
|
+
* ("2 BC", "2 v. Chr."), always in the Gregorian calendar.
|
|
55
|
+
* @param {number} y astronomical: 0 is 1 BC
|
|
56
|
+
* @param {string} locale
|
|
57
|
+
*/
|
|
58
|
+
export declare const yearText: (y: number, locale: string) => string;
|
|
59
|
+
/** A calendar day ("2022-03-01") as the locale writes a date, a year before 1 AD with its era (pivotkit-core's `date` format). */
|
|
47
60
|
export declare const dayText: (iso: any, locale: any) => string;
|
|
48
|
-
/** A calendar day of wall-clock ms ("2022-03-01"), as a date column holds dates. */
|
|
61
|
+
/** A calendar day of wall-clock ms ("2022-03-01", "-000001-01-11"), as a date column holds dates. */
|
|
49
62
|
export declare const isoDay: (ms: any) => string;
|
|
50
63
|
/**
|
|
51
64
|
* The days a relative filter keeps, both included (pivotkit-core's relativeDateRange): counted back
|
|
@@ -95,7 +108,7 @@ export declare const plainRange: (f: {
|
|
|
95
108
|
export declare function periodText(range: {
|
|
96
109
|
from: string;
|
|
97
110
|
to: string;
|
|
98
|
-
}, unit: string, locale: string):
|
|
111
|
+
}, unit: string, locale: string): string;
|
|
99
112
|
/**
|
|
100
113
|
* The days a relative date range keeps, as the unit writes them: "2022–2026" for years, "Dec
|
|
101
114
|
* 2025–Nov 2026" for months, dates for days; one period alone ("2026"); "" for no range.
|
|
@@ -109,7 +122,7 @@ export declare function rangeText(f: {
|
|
|
109
122
|
unit: string;
|
|
110
123
|
count: number;
|
|
111
124
|
anchor?: string;
|
|
112
|
-
}, locale: string, timeZone: string, now?: Date | number | string, latest?: number | null):
|
|
125
|
+
}, locale: string, timeZone: string, now?: Date | number | string, latest?: number | null): string;
|
|
113
126
|
/**
|
|
114
127
|
* The data's share of a range: which of its days have data and which have none. Null when the data
|
|
115
128
|
* cover the whole range; `none` when they cover none of it; else the days with data (`data`) and
|
|
@@ -160,11 +173,12 @@ export declare function relativeText(f: {
|
|
|
160
173
|
max: number;
|
|
161
174
|
} | null, weekStart?: number): any;
|
|
162
175
|
/**
|
|
163
|
-
* The years two calendar days bound as whole years (Jan 1 to Dec 31
|
|
164
|
-
* on a date grouping's source
|
|
165
|
-
*
|
|
176
|
+
* The years two calendar days bound as whole years (Jan 1 to Dec 31; in the first and last year a
|
|
177
|
+
* Date holds, its first and last day), or null: the days a comparison on a date grouping's source
|
|
178
|
+
* dates gets from Years combined.
|
|
179
|
+
* @returns {[number, number] | null}
|
|
166
180
|
*/
|
|
167
|
-
export declare function wholeYears(from: any, to: any): [
|
|
181
|
+
export declare function wholeYears(from: any, to: any): [number, number] | null;
|
|
168
182
|
/**
|
|
169
183
|
* A comparison of the item itself in short: "from 2022", "2022 to 2024" for a date or a date
|
|
170
184
|
* grouping, "≥ 10" for a number. `labelOf` gives an item's label (a grouping's "Mar 2025").
|
|
@@ -90,7 +90,9 @@ export declare function ExportOption({ icon, text, info, onSelect, testId, disab
|
|
|
90
90
|
* CSV or JSON, apart from the table's exports so the two are not taken for each other. The export module loads when the menu opens, so a copy happens right in
|
|
91
91
|
* the click. An empty report (no field placed) has no table to export: those entries are off, and say
|
|
92
92
|
* so; the source data is there all the same. The chart's images are off while the table is shown.
|
|
93
|
-
*
|
|
93
|
+
* `dataExport`: the host's exportData with the data shown, read by export-scope.js (#259).
|
|
94
|
+
* @param {{ labels: import("./labels.js").UiLabels, onExport: (kind: string) => void, chartReady: boolean, display: string, empty?: boolean,
|
|
95
|
+
* dataExport?: { exportData: unknown, encoded: import("pivotkit-core").Encoded | null }, prepare: () => void, close: () => void }} props
|
|
94
96
|
*/
|
|
95
97
|
export declare function ExportPanel({ labels, onExport, chartReady, display, empty, dataExport, prepare, close }: {
|
|
96
98
|
labels: import("./labels.js").UiLabels;
|
|
@@ -98,7 +100,10 @@ export declare function ExportPanel({ labels, onExport, chartReady, display, emp
|
|
|
98
100
|
chartReady: boolean;
|
|
99
101
|
display: string;
|
|
100
102
|
empty?: boolean;
|
|
101
|
-
dataExport?:
|
|
103
|
+
dataExport?: {
|
|
104
|
+
exportData: unknown;
|
|
105
|
+
encoded: import("pivotkit-core").Encoded | null;
|
|
106
|
+
};
|
|
102
107
|
prepare: () => void;
|
|
103
108
|
close: () => void;
|
|
104
109
|
}): React.JSX.Element;
|
package/types/view-history.d.ts
CHANGED
|
@@ -7,6 +7,21 @@
|
|
|
7
7
|
export declare const tagFor: (tag: any, sourceId: string | undefined) => any;
|
|
8
8
|
/** Steps kept for undo. */
|
|
9
9
|
export declare const HISTORY_LIMIT = 100;
|
|
10
|
+
/**
|
|
11
|
+
* The views told to a controlled host (onViewChange) that it has not passed back yet, with `view`
|
|
12
|
+
* added: at most HISTORY_LIMIT, the newest kept, so a host that never passes them back does not make
|
|
13
|
+
* the list grow with every change (#204).
|
|
14
|
+
* @param {string[]} pending
|
|
15
|
+
* @param {string} view
|
|
16
|
+
*/
|
|
17
|
+
export declare const told: (pending: string[], view: string) => string[];
|
|
18
|
+
/**
|
|
19
|
+
* What still waits once the host passes `view`: the views told after it (a host that answers late,
|
|
20
|
+
* #141), or none when it was not told (a change of the host's own).
|
|
21
|
+
* @param {string[]} pending
|
|
22
|
+
* @param {string} view
|
|
23
|
+
*/
|
|
24
|
+
export declare function answered(pending: string[], view: string): string[];
|
|
10
25
|
export type HistoryState = {
|
|
11
26
|
/**
|
|
12
27
|
* the schema the views were normalized against
|