pivotkit-react 0.3.0 → 0.4.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 +121 -1
- package/README.md +1 -1
- package/dist/chunks/{chunk-32Z33U6S.js → chunk-6MDAL3IO.js} +28 -3
- package/dist/chunks/{chunk-APB4NW4O.js → chunk-LEN5RPBM.js} +3 -6
- package/dist/chunks/{chunk-7CC4JHDY.js → chunk-WB4GKWFQ.js} +1 -4
- package/dist/chunks/chunk-XN55BQ4M.js +618 -0
- package/dist/chunks/{chunk-IOPAM4JD.js → chunk-YITKWZ4L.js} +48 -492
- package/dist/chunks/chunk-ZYEYZSYL.js +187 -0
- package/dist/import-ui.js +769 -0
- package/dist/import-worker.js +20 -0
- package/dist/index.js +599 -175
- package/dist/labels.js +14 -10
- package/dist/menu-texts-de.js +1 -1
- package/dist/menus.js +132 -68
- package/dist/styles.css +116 -8
- package/package.json +3 -2
- 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/field-info.d.ts +32 -0
- package/types/import-host.d.ts +53 -0
- package/types/import-labels.d.ts +360 -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 +56 -4
- package/types/labels.d.ts +26 -2
- 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/menu-labels.d.ts +0 -3
- package/types/menu-topics.d.ts +2 -4
- package/types/menus.d.ts +1 -0
- package/types/overflow.d.ts +29 -17
- package/types/popover.d.ts +47 -5
- package/types/section.d.ts +2 -2
- package/types/toasts.d.ts +1 -1
- package/types/toolbar-panels.d.ts +6 -5
- package/types/unused-keep.d.ts +20 -0
- package/types/unused.d.ts +1 -0
- package/types/use-view-history.d.ts +12 -4
- package/types/virtual.d.ts +15 -0
package/dist/styles.css
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
--pk-radius: 10px;
|
|
8
8
|
--pk-radius-sm: 7px;
|
|
9
9
|
--pk-row-h: 2.45em;
|
|
10
|
-
--pk-panel-w:
|
|
10
|
+
--pk-panel-w: 288px;
|
|
11
11
|
--pk-rail-w: 40px;
|
|
12
12
|
--pk-duration: 180ms;
|
|
13
13
|
--pk-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
14
|
+
--pk-layer-z: 50;
|
|
14
15
|
--pk-heat-low: #eaf1fb;
|
|
15
16
|
--pk-heat-high: #2a78d6;
|
|
16
17
|
--pk-scale-low: #f8696b;
|
|
@@ -159,6 +160,7 @@
|
|
|
159
160
|
margin: -1px;
|
|
160
161
|
overflow: hidden;
|
|
161
162
|
clip: rect(0, 0, 0, 0);
|
|
163
|
+
clip-path: inset(50%);
|
|
162
164
|
white-space: nowrap;
|
|
163
165
|
border: 0;
|
|
164
166
|
}
|
|
@@ -207,14 +209,15 @@
|
|
|
207
209
|
box-shadow var(--pk-duration),
|
|
208
210
|
transform var(--pk-duration);
|
|
209
211
|
}
|
|
210
|
-
.pk-btn:hover:not(:disabled) {
|
|
212
|
+
.pk-btn:hover:not(:disabled, .pk-off) {
|
|
211
213
|
background: var(--pk-surface-3);
|
|
212
214
|
border-color: var(--pk-border-strong);
|
|
213
215
|
}
|
|
214
|
-
.pk-btn:active:not(:disabled) {
|
|
216
|
+
.pk-btn:active:not(:disabled, .pk-off) {
|
|
215
217
|
transform: translateY(1px);
|
|
216
218
|
}
|
|
217
|
-
.pk-btn:disabled
|
|
219
|
+
.pk-btn:disabled,
|
|
220
|
+
.pk-btn.pk-off {
|
|
218
221
|
opacity: 0.45;
|
|
219
222
|
cursor: default;
|
|
220
223
|
}
|
|
@@ -319,7 +322,7 @@
|
|
|
319
322
|
min-height: 0;
|
|
320
323
|
}
|
|
321
324
|
.pk-root[data-pk-size=medium] .pk-layout {
|
|
322
|
-
grid-template-columns: min(var(--pk-panel-w),
|
|
325
|
+
grid-template-columns: min(var(--pk-panel-w), 284px) minmax(0, 1fr);
|
|
323
326
|
}
|
|
324
327
|
.pk-root[data-pk-fields] .pk-layout {
|
|
325
328
|
grid-template-columns: var(--pk-rail-w) minmax(0, 1fr);
|
|
@@ -502,10 +505,17 @@
|
|
|
502
505
|
line-clamp: 2;
|
|
503
506
|
width: 100%;
|
|
504
507
|
overflow: hidden;
|
|
505
|
-
overflow-wrap: anywhere;
|
|
506
508
|
white-space: normal;
|
|
507
509
|
line-height: 1.3;
|
|
508
510
|
}
|
|
511
|
+
.pk-field-title .pk-word {
|
|
512
|
+
display: inline-block;
|
|
513
|
+
max-width: 100%;
|
|
514
|
+
overflow: hidden;
|
|
515
|
+
text-overflow: ellipsis;
|
|
516
|
+
white-space: nowrap;
|
|
517
|
+
vertical-align: top;
|
|
518
|
+
}
|
|
509
519
|
.pk-placed .pk-field-name {
|
|
510
520
|
font-weight: 600;
|
|
511
521
|
}
|
|
@@ -523,6 +533,7 @@
|
|
|
523
533
|
color: var(--pk-accent);
|
|
524
534
|
}
|
|
525
535
|
.pk-field-menu {
|
|
536
|
+
width: var(--pk-target);
|
|
526
537
|
opacity: 0.6;
|
|
527
538
|
}
|
|
528
539
|
.pk-field:hover .pk-field-menu,
|
|
@@ -869,11 +880,16 @@
|
|
|
869
880
|
position: absolute;
|
|
870
881
|
inset: 0;
|
|
871
882
|
pointer-events: none;
|
|
872
|
-
z-index:
|
|
883
|
+
z-index: var(--pk-layer-z);
|
|
873
884
|
}
|
|
874
885
|
.pk-layer > * {
|
|
875
886
|
pointer-events: auto;
|
|
876
887
|
}
|
|
888
|
+
.pk-layer > [popover] {
|
|
889
|
+
inset: auto;
|
|
890
|
+
margin: 0;
|
|
891
|
+
height: auto;
|
|
892
|
+
}
|
|
877
893
|
.pk-layer > .pk-origin {
|
|
878
894
|
position: fixed;
|
|
879
895
|
top: 0;
|
|
@@ -958,6 +974,11 @@
|
|
|
958
974
|
}
|
|
959
975
|
.pk-layer > .pk-scrim {
|
|
960
976
|
position: fixed;
|
|
977
|
+
inset: 0;
|
|
978
|
+
width: auto;
|
|
979
|
+
height: auto;
|
|
980
|
+
padding: 0;
|
|
981
|
+
border: 0;
|
|
961
982
|
}
|
|
962
983
|
.pk-section {
|
|
963
984
|
display: flex;
|
|
@@ -965,11 +986,21 @@
|
|
|
965
986
|
gap: 1px;
|
|
966
987
|
padding: 4px 0;
|
|
967
988
|
}
|
|
968
|
-
.pk-section
|
|
989
|
+
.pk-section:not(:first-child) {
|
|
969
990
|
border-top: 1px solid var(--pk-border);
|
|
970
991
|
margin-top: 2px;
|
|
971
992
|
padding-top: 6px;
|
|
972
993
|
}
|
|
994
|
+
.pk-subsection {
|
|
995
|
+
display: flex;
|
|
996
|
+
flex-direction: column;
|
|
997
|
+
gap: 1px;
|
|
998
|
+
}
|
|
999
|
+
.pk-subsection + .pk-subsection {
|
|
1000
|
+
border-top: 1px dashed var(--pk-border);
|
|
1001
|
+
margin-top: 4px;
|
|
1002
|
+
padding-top: 4px;
|
|
1003
|
+
}
|
|
973
1004
|
.pk-section-head {
|
|
974
1005
|
display: flex;
|
|
975
1006
|
align-items: center;
|
|
@@ -1067,6 +1098,7 @@
|
|
|
1067
1098
|
.pk-inline-form input[type=number],
|
|
1068
1099
|
.pk-inline-form select,
|
|
1069
1100
|
.pk-condition select,
|
|
1101
|
+
.pk-import select,
|
|
1070
1102
|
.pk-condition input {
|
|
1071
1103
|
flex: 1;
|
|
1072
1104
|
min-width: 6em;
|
|
@@ -1912,6 +1944,7 @@
|
|
|
1912
1944
|
color: var(--pk-danger);
|
|
1913
1945
|
}
|
|
1914
1946
|
.pk-table-wrap {
|
|
1947
|
+
position: relative;
|
|
1915
1948
|
flex: 1;
|
|
1916
1949
|
min-width: 0;
|
|
1917
1950
|
overflow: auto;
|
|
@@ -2457,6 +2490,9 @@
|
|
|
2457
2490
|
max-width: min(320px, calc(100vw - 16px));
|
|
2458
2491
|
padding: 8px 10px;
|
|
2459
2492
|
}
|
|
2493
|
+
.pk-popover.pk-sheet.pk-info-pop {
|
|
2494
|
+
max-width: none;
|
|
2495
|
+
}
|
|
2460
2496
|
.pk-field-desc {
|
|
2461
2497
|
margin: 0;
|
|
2462
2498
|
font-size: var(--pk-small);
|
|
@@ -2967,3 +3003,75 @@
|
|
|
2967
3003
|
right: calc(50% - var(--pk-target-touch) / 2);
|
|
2968
3004
|
}
|
|
2969
3005
|
}
|
|
3006
|
+
.pk-layer > .pk-drop {
|
|
3007
|
+
position: fixed;
|
|
3008
|
+
display: grid;
|
|
3009
|
+
place-items: center;
|
|
3010
|
+
border: 0;
|
|
3011
|
+
border-radius: var(--pk-radius);
|
|
3012
|
+
background: var(--pk-scrim);
|
|
3013
|
+
box-shadow: inset 0 0 0 3px var(--pk-accent);
|
|
3014
|
+
pointer-events: none;
|
|
3015
|
+
}
|
|
3016
|
+
.pk-drop > div,
|
|
3017
|
+
.pk-drop-zone {
|
|
3018
|
+
display: flex;
|
|
3019
|
+
flex-direction: column;
|
|
3020
|
+
align-items: center;
|
|
3021
|
+
gap: 6px;
|
|
3022
|
+
padding: 16px 24px;
|
|
3023
|
+
border: 2px dashed var(--pk-accent);
|
|
3024
|
+
border-radius: var(--pk-radius);
|
|
3025
|
+
background: var(--pk-surface-raised);
|
|
3026
|
+
}
|
|
3027
|
+
.pk-layer > .pk-import {
|
|
3028
|
+
position: fixed;
|
|
3029
|
+
inset: 0;
|
|
3030
|
+
display: flex;
|
|
3031
|
+
flex-direction: column;
|
|
3032
|
+
width: min(900px, calc(100vw - 24px));
|
|
3033
|
+
height: fit-content;
|
|
3034
|
+
max-height: calc(100dvh - 24px);
|
|
3035
|
+
margin: auto;
|
|
3036
|
+
padding: 0;
|
|
3037
|
+
overflow: hidden;
|
|
3038
|
+
border: 1px solid var(--pk-border);
|
|
3039
|
+
border-radius: var(--pk-radius);
|
|
3040
|
+
background: var(--pk-surface-raised);
|
|
3041
|
+
color: var(--pk-text);
|
|
3042
|
+
box-shadow: var(--pk-shadow-lg);
|
|
3043
|
+
}
|
|
3044
|
+
.pk-import-body {
|
|
3045
|
+
display: flex;
|
|
3046
|
+
flex-direction: column;
|
|
3047
|
+
gap: 12px;
|
|
3048
|
+
min-height: 0;
|
|
3049
|
+
padding: 12px 16px;
|
|
3050
|
+
overflow: auto;
|
|
3051
|
+
}
|
|
3052
|
+
.pk-import-body > * {
|
|
3053
|
+
flex: none;
|
|
3054
|
+
}
|
|
3055
|
+
.pk-import progress {
|
|
3056
|
+
width: 100%;
|
|
3057
|
+
accent-color: var(--pk-accent);
|
|
3058
|
+
}
|
|
3059
|
+
.pk-import th select {
|
|
3060
|
+
display: block;
|
|
3061
|
+
width: 100%;
|
|
3062
|
+
min-width: 7.5em;
|
|
3063
|
+
margin-top: 4px;
|
|
3064
|
+
}
|
|
3065
|
+
.pk-import > .pk-popover-foot {
|
|
3066
|
+
padding: 12px 16px;
|
|
3067
|
+
border-top: 1px solid var(--pk-border);
|
|
3068
|
+
}
|
|
3069
|
+
.pk-source {
|
|
3070
|
+
display: inline-flex;
|
|
3071
|
+
align-items: center;
|
|
3072
|
+
gap: 0.4em;
|
|
3073
|
+
}
|
|
3074
|
+
.pk-data-menu p {
|
|
3075
|
+
padding: 0 8px;
|
|
3076
|
+
overflow-wrap: anywhere;
|
|
3077
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pivotkit-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React 18/19 pivot report builder on pivotkit-core: drag-and-drop fields, table and Apache ECharts chart, filters, templates as JSON, undo, Excel and CSV export.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "eizedev <oss@eize.dev>",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"types": "./types/all-labels.d.ts",
|
|
35
35
|
"default": "./dist/labels.js"
|
|
36
36
|
},
|
|
37
|
+
"./import-worker": "./dist/import-worker.js",
|
|
37
38
|
"./styles.css": "./dist/styles.css",
|
|
38
39
|
"./package.json": "./package.json"
|
|
39
40
|
},
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"dependencies": {
|
|
61
62
|
"@dnd-kit/core": "6.3.1",
|
|
62
63
|
"@dnd-kit/sortable": "10.0.0",
|
|
63
|
-
"pivotkit-core": "^0.
|
|
64
|
+
"pivotkit-core": "^0.4.0"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"echarts": "6.1.0"
|
|
@@ -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/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;
|
|
@@ -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;
|