pivotkit-react 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +442 -0
- package/LICENSE +21 -0
- package/README.md +77 -2
- package/dist/chunks/chunk-53ZMK4BH.js +177 -0
- package/dist/chunks/chunk-F6MVUAQD.js +741 -0
- package/dist/chunks/chunk-LQCWFJBS.js +310 -0
- package/dist/chunks/chunk-OYY4BKIL.js +93 -0
- package/dist/chunks/chunk-QBD4FOBB.js +254 -0
- package/dist/chunks/chunk-X7H7BAVT.js +1752 -0
- package/dist/chunks/unused-texts-YTNJCFFC.js +10 -0
- package/dist/chunks/unused-texts-de-SGOHV4N7.js +6 -0
- package/dist/echarts.js +347 -0
- package/dist/index.js +3482 -0
- package/dist/labels.js +21 -0
- package/dist/menu-texts-de.js +6 -0
- package/dist/menus.js +1681 -0
- package/dist/styles.css +2529 -0
- package/package.json +70 -4
- package/types/PivotReport.d.ts +20 -0
- package/types/all-labels.d.ts +5 -0
- package/types/chart-decorate.d.ts +16 -0
- package/types/chart-layout.d.ts +111 -0
- package/types/chart-options.d.ts +23 -0
- package/types/chart-summary.d.ts +12 -0
- package/types/chart-tooltip.d.ts +38 -0
- package/types/chart-types.d.ts +61 -0
- package/types/chart.d.ts +39 -0
- package/types/chip-menus.d.ts +32 -0
- package/types/clear-input.d.ts +20 -0
- package/types/dnd-moves.d.ts +45 -0
- package/types/dnd.d.ts +101 -0
- package/types/dom.d.ts +52 -0
- package/types/drill-export.d.ts +42 -0
- package/types/drill-panel.d.ts +22 -0
- package/types/drill-table.d.ts +71 -0
- package/types/drill.d.ts +26 -0
- package/types/echarts.d.ts +4 -0
- package/types/export-run.d.ts +59 -0
- package/types/field-info.d.ts +34 -0
- package/types/fields.d.ts +32 -0
- package/types/files.d.ts +27 -0
- package/types/filter.d.ts +21 -0
- package/types/help.d.ts +21 -0
- package/types/icons.d.ts +80 -0
- package/types/index.d.ts +536 -0
- package/types/info.d.ts +34 -0
- package/types/iso.d.ts +2 -0
- package/types/labels.d.ts +663 -0
- package/types/lazy-menus.d.ts +28 -0
- package/types/menu-labels-de.d.ts +2 -0
- package/types/menu-labels.d.ts +317 -0
- package/types/menu-ops.d.ts +145 -0
- package/types/menu-texts.d.ts +2 -0
- package/types/menus.d.ts +7 -0
- package/types/names.d.ts +80 -0
- package/types/numbers.d.ts +13 -0
- package/types/overflow.d.ts +62 -0
- package/types/place.d.ts +43 -0
- package/types/popover.d.ts +93 -0
- package/types/rove.d.ts +20 -0
- package/types/section.d.ts +25 -0
- package/types/sections.d.ts +2 -0
- package/types/share-actions.d.ts +99 -0
- package/types/share.d.ts +114 -0
- package/types/skeleton.d.ts +9 -0
- package/types/storage.d.ts +24 -0
- package/types/table.d.ts +29 -0
- package/types/templates.d.ts +46 -0
- package/types/theme.d.ts +24 -0
- package/types/tip-list.d.ts +20 -0
- package/types/tips.d.ts +300 -0
- package/types/toasts.d.ts +26 -0
- package/types/toolbar-panels.d.ts +93 -0
- package/types/toolbar.d.ts +5 -0
- package/types/unused-load.d.ts +23 -0
- package/types/unused-texts-de.d.ts +2 -0
- package/types/unused-texts.d.ts +130 -0
- package/types/unused.d.ts +22 -0
- package/types/use-big-result.d.ts +29 -0
- package/types/use-export.d.ts +7 -0
- package/types/use-theme.d.ts +11 -0
- package/types/use-view-history.d.ts +37 -0
- package/types/version.d.ts +2 -0
- package/types/view-history.d.ts +106 -0
- package/types/view-ops.d.ts +293 -0
- package/types/view-save.d.ts +76 -0
- package/types/view-store.d.ts +59 -0
- package/types/virtual.d.ts +44 -0
- package/types/zones.d.ts +42 -0
package/types/tips.d.ts
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/** Tips shown at a time: one, the most important; the next waits until it is followed or dismissed. */
|
|
2
|
+
export declare const TIP_LIMIT = 1;
|
|
3
|
+
/** When the tips show; each number is documented in the React reference (tips). */
|
|
4
|
+
export declare const TIP_THRESHOLDS: Readonly<{
|
|
5
|
+
/** columns of an ungrouped date on Columns from which grouping it is suggested */
|
|
6
|
+
dateColumns: 12;
|
|
7
|
+
/** rows of an ungrouped date on Rows from which grouping it is suggested */
|
|
8
|
+
dateRows: 60;
|
|
9
|
+
/** columns from which swapping rows and columns is suggested (when there are fewer rows) */
|
|
10
|
+
manyColumns: 20;
|
|
11
|
+
/** changes of the view in this session after which saving it as a template is suggested */
|
|
12
|
+
changesBeforeSave: 5;
|
|
13
|
+
/** changes after the first drag during which the Undo and menu tip stays */
|
|
14
|
+
afterDragChanges: 3;
|
|
15
|
+
/** slices from which a pie or a donut suggests bars: a circle reads well up to about 7 parts */
|
|
16
|
+
pieSlices: 7;
|
|
17
|
+
}>;
|
|
18
|
+
export type TipContext = {
|
|
19
|
+
/**
|
|
20
|
+
* the normalized view
|
|
21
|
+
*/
|
|
22
|
+
view: any;
|
|
23
|
+
/**
|
|
24
|
+
* nothing placed
|
|
25
|
+
*/
|
|
26
|
+
empty: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* the result cannot be shown (an error is shown instead)
|
|
29
|
+
*/
|
|
30
|
+
failed: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* the type of a field's source column
|
|
33
|
+
*/
|
|
34
|
+
typeOf: (field: string) => string;
|
|
35
|
+
encoded: import("pivotkit-core").Encoded;
|
|
36
|
+
/**
|
|
37
|
+
* display names (labels.core.fields)
|
|
38
|
+
*/
|
|
39
|
+
fields?: Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* rows of the innermost row field (1 without row fields)
|
|
42
|
+
*/
|
|
43
|
+
rowLeaves: number;
|
|
44
|
+
/**
|
|
45
|
+
* columns of the innermost column field (1 without column fields)
|
|
46
|
+
*/
|
|
47
|
+
colLeaves: number;
|
|
48
|
+
/**
|
|
49
|
+
* source rows left after the filters
|
|
50
|
+
*/
|
|
51
|
+
matched: number;
|
|
52
|
+
/**
|
|
53
|
+
* source rows of the data
|
|
54
|
+
*/
|
|
55
|
+
dataRows: number;
|
|
56
|
+
/**
|
|
57
|
+
* the chart's series, when the chart shows
|
|
58
|
+
*/
|
|
59
|
+
series: {
|
|
60
|
+
series: any[];
|
|
61
|
+
categories: any[];
|
|
62
|
+
categoryCount: number;
|
|
63
|
+
} | null;
|
|
64
|
+
/**
|
|
65
|
+
* the table (with cells) is on screen
|
|
66
|
+
*/
|
|
67
|
+
tableShown: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* a value was opened once
|
|
70
|
+
*/
|
|
71
|
+
drilled: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* changes of the view in this session
|
|
74
|
+
*/
|
|
75
|
+
changes: number;
|
|
76
|
+
/**
|
|
77
|
+
* `changes` when the first drag ended, null before
|
|
78
|
+
*/
|
|
79
|
+
dragAt: number | null;
|
|
80
|
+
/**
|
|
81
|
+
* the host lets the user save templates
|
|
82
|
+
*/
|
|
83
|
+
canSave: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* `changes` when the view was last saved (0: not saved in this session)
|
|
86
|
+
*/
|
|
87
|
+
savedAt: number;
|
|
88
|
+
/**
|
|
89
|
+
* what the chart draws
|
|
90
|
+
* (chart-types.js chartPlan): the type, whether the data chose it, rows and columns swapped for it
|
|
91
|
+
*/
|
|
92
|
+
chartPlan: {
|
|
93
|
+
name: string;
|
|
94
|
+
auto: boolean;
|
|
95
|
+
swap: boolean;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export type TipEntry = {
|
|
99
|
+
id: string;
|
|
100
|
+
/**
|
|
101
|
+
* null: not now; else the
|
|
102
|
+
* placeholders of its text (and `action` data)
|
|
103
|
+
*/
|
|
104
|
+
when: (ctx: TipContext) => Record<string, any> | null;
|
|
105
|
+
/**
|
|
106
|
+
* the action of its button: a key of labels.tipActions and of PivotReport's actions
|
|
107
|
+
*/
|
|
108
|
+
action?: string;
|
|
109
|
+
/**
|
|
110
|
+
* a notice: always shown, not dismissible, outside the tips' limit
|
|
111
|
+
*/
|
|
112
|
+
kind?: "notice";
|
|
113
|
+
icon?: string;
|
|
114
|
+
};
|
|
115
|
+
/** @type {readonly TipEntry[]} the tips, most important first: that is the order they show in */
|
|
116
|
+
export declare const TIPS: readonly TipEntry[];
|
|
117
|
+
/** Every tip id, for a host's `tips` list and for stored dismissals. */
|
|
118
|
+
export declare const TIP_IDS: readonly string[];
|
|
119
|
+
/** The notices: shown whenever they hold, whatever the tips settings are. */
|
|
120
|
+
export declare const NOTICE_IDS: readonly string[];
|
|
121
|
+
/** The dismissal that switches every tip off ("Show tips" in Options). */
|
|
122
|
+
export declare const ALL_TIPS = "*";
|
|
123
|
+
/**
|
|
124
|
+
* The other switch of Options → Help, "Show explanations", kept in the same list (and storage) as the
|
|
125
|
+
* tips: off, it hides every "i" - of the settings, of the zones and of the field descriptions -
|
|
126
|
+
* except those a host forces on (the props settingInfo, zoneInfo and fieldInfo).
|
|
127
|
+
*/
|
|
128
|
+
export declare const NO_EXPLANATIONS = "-explanations";
|
|
129
|
+
/** The field list collapsed to a rail by the user (a wide or medium report), kept in the same list. */
|
|
130
|
+
export declare const FIELDS_COLLAPSED = "-fields";
|
|
131
|
+
/** Entries of the list that are switches, not dismissed tips: "Show dismissed tips again" keeps them. */
|
|
132
|
+
export declare const SWITCHES: readonly string[];
|
|
133
|
+
/**
|
|
134
|
+
* Whether the field list is collapsed: the user's choice in this session, else the host's
|
|
135
|
+
* `fieldList` ("open" or "collapsed"), else what the user chose before (the list).
|
|
136
|
+
* @param {boolean | null} session
|
|
137
|
+
* @param {unknown} forced
|
|
138
|
+
* @param {readonly string[]} dismissed
|
|
139
|
+
*/
|
|
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
|
+
* what a first-time user needs open, the rest folded (a folded section's title says what it holds).
|
|
144
|
+
* The user's choice is kept in the same list (and storage) as the tips, as "open:<id>" or
|
|
145
|
+
* "closed:<id>" where it differs from this default; "Show dismissed tips again" keeps it, "Reset menu
|
|
146
|
+
* sections" (Options → Help) clears it.
|
|
147
|
+
*/
|
|
148
|
+
export declare const SECTIONS: Readonly<{
|
|
149
|
+
summarize: true;
|
|
150
|
+
showAs: true;
|
|
151
|
+
format: false;
|
|
152
|
+
highlight: false;
|
|
153
|
+
move: false;
|
|
154
|
+
sort: true;
|
|
155
|
+
groupBy: true;
|
|
156
|
+
bins: true;
|
|
157
|
+
topN: true;
|
|
158
|
+
filters: true;
|
|
159
|
+
totals: true;
|
|
160
|
+
help: true;
|
|
161
|
+
exportDownload: true;
|
|
162
|
+
exportCopy: true;
|
|
163
|
+
thisView: true;
|
|
164
|
+
sharedViews: true;
|
|
165
|
+
myViews: true;
|
|
166
|
+
share: false;
|
|
167
|
+
chartType: true;
|
|
168
|
+
chartDisplay: false;
|
|
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
|
+
/** An entry of the list that is a section's state. */
|
|
175
|
+
export declare const isSection: (id: any) => boolean;
|
|
176
|
+
/** Entries "Show dismissed tips again" keeps: the switches and the sections' states. */
|
|
177
|
+
export declare const keptOnReset: (id: any) => boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Whether one kind of "i" shows: the host's "on" or "off" forces it (and the user's switch leaves it
|
|
180
|
+
* alone), else the user's "Show explanations" in the list, on by default.
|
|
181
|
+
* @param {unknown} forced the host's prop (settingInfo, zoneInfo or fieldInfo)
|
|
182
|
+
* @param {readonly string[]} dismissed
|
|
183
|
+
* @param {string} [off] the switch's entry, NO_EXPLANATIONS
|
|
184
|
+
* @returns {{ on: boolean, user: boolean }} `user`: the user's switch decides
|
|
185
|
+
*/
|
|
186
|
+
export declare function helpSwitch(forced: unknown, dismissed: readonly string[], off?: string): {
|
|
187
|
+
on: boolean;
|
|
188
|
+
user: boolean;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* The keyboard shortcuts of the help section in Options: the keys (with "Mod" for Ctrl or ⌘) and
|
|
192
|
+
* the key of their text in labels.shortcuts.
|
|
193
|
+
*/
|
|
194
|
+
export declare const SHORTCUTS: readonly {
|
|
195
|
+
keys: string[];
|
|
196
|
+
text: string;
|
|
197
|
+
}[];
|
|
198
|
+
/**
|
|
199
|
+
* What the conditions read, from the report's state. Pure.
|
|
200
|
+
* @param {{ view: any, result: import("pivotkit-core").PivotResult | null, encoded: import("pivotkit-core").Encoded,
|
|
201
|
+
* failed: boolean, empty: boolean, typeOf: (field: string) => string, fields?: Record<string, string>,
|
|
202
|
+
* series?: TipContext["series"], tableShown?: boolean, drilled?: boolean, changes?: number, dragAt?: number | null, canSave?: boolean,
|
|
203
|
+
* savedAt?: number, chartPlan?: TipContext["chartPlan"] }} state
|
|
204
|
+
* @returns {TipContext}
|
|
205
|
+
*/
|
|
206
|
+
export declare function tipContext({ view, result, encoded, failed, empty, typeOf, fields, series, tableShown, drilled, changes, dragAt, canSave, savedAt, chartPlan }: {
|
|
207
|
+
view: any;
|
|
208
|
+
result: import("pivotkit-core").PivotResult | null;
|
|
209
|
+
encoded: import("pivotkit-core").Encoded;
|
|
210
|
+
failed: boolean;
|
|
211
|
+
empty: boolean;
|
|
212
|
+
typeOf: (field: string) => string;
|
|
213
|
+
fields?: Record<string, string>;
|
|
214
|
+
series?: TipContext["series"];
|
|
215
|
+
tableShown?: boolean;
|
|
216
|
+
drilled?: boolean;
|
|
217
|
+
changes?: number;
|
|
218
|
+
dragAt?: number | null;
|
|
219
|
+
canSave?: boolean;
|
|
220
|
+
savedAt?: number;
|
|
221
|
+
chartPlan?: TipContext["chartPlan"];
|
|
222
|
+
}): TipContext;
|
|
223
|
+
/**
|
|
224
|
+
* What to show now, the most important first: every notice whose condition holds, then the tips
|
|
225
|
+
* whose condition holds, allowed by the host and not dismissed, at most `limit` of them.
|
|
226
|
+
* @param {TipContext} ctx
|
|
227
|
+
* @param {{ allowed: "on" | "off" | readonly string[], dismissed: ReadonlySet<string> | readonly string[], limit?: number }} options
|
|
228
|
+
* @returns {Array<{ id: string, params: Record<string, any>, entry: TipEntry }>}
|
|
229
|
+
*/
|
|
230
|
+
export declare function activeTips(ctx: TipContext, { allowed, dismissed, limit }: {
|
|
231
|
+
allowed: "on" | "off" | readonly string[];
|
|
232
|
+
dismissed: ReadonlySet<string> | readonly string[];
|
|
233
|
+
limit?: number;
|
|
234
|
+
}): Array<{
|
|
235
|
+
id: string;
|
|
236
|
+
params: Record<string, any>;
|
|
237
|
+
entry: TipEntry;
|
|
238
|
+
}>;
|
|
239
|
+
/**
|
|
240
|
+
* The text of a tip in the labels' language; numbers in the locale.
|
|
241
|
+
* @param {string} id
|
|
242
|
+
* @param {Record<string, any>} params
|
|
243
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
244
|
+
* @param {string} locale
|
|
245
|
+
*/
|
|
246
|
+
export declare function tipText(id: string, params: Record<string, any>, labels: import("./labels.js").UiLabels, locale: string): any;
|
|
247
|
+
/**
|
|
248
|
+
* The text of a tip's button.
|
|
249
|
+
* @param {TipEntry} entry
|
|
250
|
+
* @param {Record<string, any>} params
|
|
251
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
252
|
+
*/
|
|
253
|
+
export declare function tipActionText(entry: TipEntry, params: Record<string, any>, labels: import("./labels.js").UiLabels): string;
|
|
254
|
+
/**
|
|
255
|
+
* A host's `tips` prop or attribute: "on" (default), "off", or the ids it allows (an array, or a
|
|
256
|
+
* comma-separated text); unknown ids are left out.
|
|
257
|
+
* @param {unknown} value
|
|
258
|
+
* @returns {"on" | "off" | string[]}
|
|
259
|
+
*/
|
|
260
|
+
export declare function allowedTips(value: unknown): "on" | "off" | string[];
|
|
261
|
+
/** Dismissed ids from anywhere (storage, a host): known ids and the switches only, once each. */
|
|
262
|
+
export declare function cleanDismissed(value: any): any[];
|
|
263
|
+
/** The localStorage key of a report's tips: one per `storageKey`, so two reports never share one. */
|
|
264
|
+
export declare const storageName: (key: any) => string;
|
|
265
|
+
/**
|
|
266
|
+
* The stored text of a report's dismissed tips, or null (no key, no storage, blocked). A text, so a
|
|
267
|
+
* React store snapshot of it compares by value.
|
|
268
|
+
* @param {string | undefined} key
|
|
269
|
+
* @param {Pick<Storage, "getItem"> | null | undefined} storage
|
|
270
|
+
* @returns {string | null}
|
|
271
|
+
*/
|
|
272
|
+
export declare function readStored(key: string | undefined, storage: Pick<Storage, "getItem"> | null | undefined): string | null;
|
|
273
|
+
/** The dismissed ids of a stored text: [] for nothing or broken JSON. @param {string | null} raw */
|
|
274
|
+
export declare function parseStored(raw: string | null): any[];
|
|
275
|
+
/**
|
|
276
|
+
* The dismissed tips stored for a report, or [] (no key, no storage, blocked, broken JSON).
|
|
277
|
+
* @param {string | undefined} key
|
|
278
|
+
* @param {Pick<Storage, "getItem"> | null | undefined} storage
|
|
279
|
+
*/
|
|
280
|
+
export declare function readDismissed(key: string | undefined, storage: Pick<Storage, "getItem"> | null | undefined): any[];
|
|
281
|
+
/**
|
|
282
|
+
* Listens to the stored tips of a key: a write in this page (writeDismissed) or in another tab of
|
|
283
|
+
* the same site. For useSyncExternalStore, so the report reads the storage only after hydration (its
|
|
284
|
+
* server snapshot is "nothing stored").
|
|
285
|
+
* @param {string | undefined} key
|
|
286
|
+
* @param {() => void} callback
|
|
287
|
+
* @returns {() => void} stops listening
|
|
288
|
+
*/
|
|
289
|
+
export declare function subscribeStored(key: string | undefined, callback: () => void): () => void;
|
|
290
|
+
/**
|
|
291
|
+
* Stores the dismissed tips of a report and tells the reports of the page that use the key; nothing
|
|
292
|
+
* without a key or storage, and quietly when the browser refuses (private mode, quota): the tips stay
|
|
293
|
+
* dismissed until the page is loaded again.
|
|
294
|
+
* @param {string | undefined} key
|
|
295
|
+
* @param {Pick<Storage, "setItem" | "removeItem"> | null | undefined} storage
|
|
296
|
+
* @param {readonly string[]} dismissed
|
|
297
|
+
*/
|
|
298
|
+
export declare function writeDismissed(key: string | undefined, storage: Pick<Storage, "setItem" | "removeItem"> | null | undefined, dismissed: readonly string[]): void;
|
|
299
|
+
/** The Filters zone fields, kept with empty filters, and every other filter gone: "Remove filter". */
|
|
300
|
+
export declare function withoutFilters(view: any): any;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/** How long a note stays, in milliseconds. */
|
|
3
|
+
export declare const SHOWN_MS = 6000;
|
|
4
|
+
export type Toast = {
|
|
5
|
+
id: number;
|
|
6
|
+
text: string;
|
|
7
|
+
action?: {
|
|
8
|
+
label: string;
|
|
9
|
+
run: () => void;
|
|
10
|
+
};
|
|
11
|
+
tone?: "error";
|
|
12
|
+
};
|
|
13
|
+
/** @typedef {{ id: number, text: string, action?: { label: string, run: () => void }, tone?: "error" }} Toast */
|
|
14
|
+
export declare function useToasts(): {
|
|
15
|
+
toasts: Toast[];
|
|
16
|
+
push: (toast: Omit<Toast, "id">) => void;
|
|
17
|
+
dismiss: (id: any) => void;
|
|
18
|
+
pause: (on: any, list: any) => void;
|
|
19
|
+
};
|
|
20
|
+
/** @param {{ toasts: Toast[], dismiss: (id: number) => void, pause: (on: boolean, list: Toast[]) => void, closeLabel: string }} props */
|
|
21
|
+
export declare function Toasts({ toasts, dismiss, pause, closeLabel }: {
|
|
22
|
+
toasts: Toast[];
|
|
23
|
+
dismiss: (id: number) => void;
|
|
24
|
+
pause: (on: boolean, list: Toast[]) => void;
|
|
25
|
+
closeLabel: string;
|
|
26
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/** The chart type menu: the types (a pick closes it) and how the chart is drawn. */
|
|
3
|
+
export declare function ChartTypePanel({ view, plan, labels, onChart, onDisplay, close }: {
|
|
4
|
+
close: any;
|
|
5
|
+
labels: any;
|
|
6
|
+
onChart: any;
|
|
7
|
+
onDisplay: any;
|
|
8
|
+
plan: any;
|
|
9
|
+
view: any;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
export declare function OptionsPanel({ view, labels, onTotal, onExpand, onCollapse, close, tips, mod, folding, help }: {
|
|
12
|
+
close: any;
|
|
13
|
+
folding: any;
|
|
14
|
+
help: any;
|
|
15
|
+
labels: any;
|
|
16
|
+
mod: any;
|
|
17
|
+
onCollapse: any;
|
|
18
|
+
onExpand: any;
|
|
19
|
+
onTotal: any;
|
|
20
|
+
tips: any;
|
|
21
|
+
view: any;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* Before a view for other data is applied: what does not fit, and the choices (load it anyway, let
|
|
25
|
+
* the host switch to its data and load it there, or cancel). Names from the file are text only. It
|
|
26
|
+
* takes the focus when it appears (it replaces the form the focus was in), unless `quiet` (a link at
|
|
27
|
+
* the page's load: the focus stays where the page put it).
|
|
28
|
+
* @param {{ check: { lines: string[], load: () => void, switchTo?: { name: string, run: () => void } }, labels: any, onCancel: () => void, close: () => void, title?: string, quiet?: boolean }} props
|
|
29
|
+
*/
|
|
30
|
+
export declare function LoadCheck({ check, labels, onCancel, close, title, quiet }: {
|
|
31
|
+
check: {
|
|
32
|
+
lines: string[];
|
|
33
|
+
load: () => void;
|
|
34
|
+
switchTo?: {
|
|
35
|
+
name: string;
|
|
36
|
+
run: () => void;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
labels: any;
|
|
40
|
+
onCancel: () => void;
|
|
41
|
+
close: () => void;
|
|
42
|
+
title?: string;
|
|
43
|
+
quiet?: boolean;
|
|
44
|
+
}): React.JSX.Element;
|
|
45
|
+
/**
|
|
46
|
+
* The Views menu: "This view" (Save the loaded view under its name, or why not; Save as, the name
|
|
47
|
+
* field; New, an empty report), the templates in two groups, "Shared views" (the host's, for
|
|
48
|
+
* everyone) and "My views" (the user's own: the host's or the browser store's), each shown only when
|
|
49
|
+
* it has entries ("My views" also when the user can save), then sharing. An entry loads its view; a deletable one
|
|
50
|
+
* has a delete button, a shared one that is not has the "i" that says who changes shared views, and
|
|
51
|
+
* a user's view offers "Publish as shared view" when the host allows it. Delete and publish ask
|
|
52
|
+
* first, in place; the entry changes only when the host's callback (or the browser store) has
|
|
53
|
+
* finished, and the focus goes back to the entry in that place. Names need not be unique: every
|
|
54
|
+
* entry is shown, keyed and confirmed by its place in the list.
|
|
55
|
+
* @param {{ templates: import("./templates.js").TemplateEntry[], labels: any, onLoad: (t: any) => void, actions: any, close: () => void, share?: any }} props
|
|
56
|
+
*/
|
|
57
|
+
export declare function ViewsPanel({ templates, labels, onLoad, actions, close, share }: {
|
|
58
|
+
templates: import("./templates.js").TemplateEntry[];
|
|
59
|
+
labels: any;
|
|
60
|
+
onLoad: (t: any) => void;
|
|
61
|
+
actions: any;
|
|
62
|
+
close: () => void;
|
|
63
|
+
share?: any;
|
|
64
|
+
}): React.JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* One entry of an export menu: the option and, when it needs explaining, its "i".
|
|
67
|
+
* @param {{ icon: string, text: string, info?: string, onSelect: () => void, testId: string, disabled?: boolean, reason?: string }} props
|
|
68
|
+
*/
|
|
69
|
+
export declare function ExportOption({ icon, text, info, onSelect, testId, disabled, reason }: {
|
|
70
|
+
icon: string;
|
|
71
|
+
text: string;
|
|
72
|
+
info?: string;
|
|
73
|
+
onSelect: () => void;
|
|
74
|
+
testId: string;
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
reason?: string;
|
|
77
|
+
}): React.JSX.Element;
|
|
78
|
+
/**
|
|
79
|
+
* The Export menu: the table as a file (Excel, CSV), the chart as an image, and the table on the
|
|
80
|
+
* clipboard (as shown, or its data as JSON). The export module loads when the menu opens, so a copy
|
|
81
|
+
* happens right in the click.
|
|
82
|
+
* An empty report (no field placed) has nothing to export: every entry is off, and says so.
|
|
83
|
+
* @param {{ labels: import("./labels.js").UiLabels, onExport: (kind: string) => void, chartReady: boolean, display: string, empty?: boolean, prepare: () => void, close: () => void }} props
|
|
84
|
+
*/
|
|
85
|
+
export declare function ExportPanel({ labels, onExport, chartReady, display, empty, prepare, close }: {
|
|
86
|
+
labels: import("./labels.js").UiLabels;
|
|
87
|
+
onExport: (kind: string) => void;
|
|
88
|
+
chartReady: boolean;
|
|
89
|
+
display: string;
|
|
90
|
+
empty?: boolean;
|
|
91
|
+
prepare: () => void;
|
|
92
|
+
close: () => void;
|
|
93
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @type {Readonly<Record<string, () => Promise<Partial<import("./unused-texts.js").UnusedTexts>>>>} */
|
|
2
|
+
export declare const UNUSED_TEXTS_OF: Readonly<Record<string, () => Promise<Partial<import("./unused-texts.js").UnusedTexts>>>>;
|
|
3
|
+
export type UnusedLoaded = {
|
|
4
|
+
mod: typeof import("./unused-texts.js");
|
|
5
|
+
lang: Partial<import("./unused-texts.js").UnusedTexts> | null;
|
|
6
|
+
};
|
|
7
|
+
/** The texts of `lang` when they are here, else null. */
|
|
8
|
+
export declare const unusedNow: (lang: any) => UnusedLoaded | null;
|
|
9
|
+
/**
|
|
10
|
+
* The plain-word texts with those of `lang` (null when it has none, or they failed); rejects when the
|
|
11
|
+
* English module fails.
|
|
12
|
+
* @param {string} lang
|
|
13
|
+
* @returns {Promise<UnusedLoaded>}
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadUnused(lang: string): Promise<UnusedLoaded>;
|
|
16
|
+
/**
|
|
17
|
+
* The texts of a language: English, the language's own over it, a host's `unused` labels over both
|
|
18
|
+
* (kept aside by resolveLabels, as the menus' are).
|
|
19
|
+
* @param {UnusedLoaded} loaded
|
|
20
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
21
|
+
* @returns {import("./unused-texts.js").UnusedTexts}
|
|
22
|
+
*/
|
|
23
|
+
export declare function unusedTexts(loaded: UnusedLoaded, labels: import("./labels.js").UiLabels): import("./unused-texts.js").UnusedTexts;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export type UnusedTexts = typeof en;
|
|
2
|
+
/** @typedef {typeof en} UnusedTexts */
|
|
3
|
+
export declare const en: {
|
|
4
|
+
item: string;
|
|
5
|
+
quote: string;
|
|
6
|
+
position: string;
|
|
7
|
+
view: string;
|
|
8
|
+
sections: {
|
|
9
|
+
sort: string;
|
|
10
|
+
derived: string;
|
|
11
|
+
totals: string;
|
|
12
|
+
collapsed: string;
|
|
13
|
+
display: string;
|
|
14
|
+
chart: string;
|
|
15
|
+
formatting: string;
|
|
16
|
+
};
|
|
17
|
+
settings: {
|
|
18
|
+
display: string;
|
|
19
|
+
type: string;
|
|
20
|
+
valueLabels: string;
|
|
21
|
+
legend: string;
|
|
22
|
+
axisLabels: string;
|
|
23
|
+
groupLabels: string;
|
|
24
|
+
labelPosition: string;
|
|
25
|
+
other: string;
|
|
26
|
+
};
|
|
27
|
+
dropped: {
|
|
28
|
+
rows: string;
|
|
29
|
+
cols: string;
|
|
30
|
+
values: string;
|
|
31
|
+
filters: string;
|
|
32
|
+
sort: string;
|
|
33
|
+
derived: string;
|
|
34
|
+
other: string;
|
|
35
|
+
};
|
|
36
|
+
codes: {
|
|
37
|
+
notView: string;
|
|
38
|
+
notJson: string;
|
|
39
|
+
tooLarge: string;
|
|
40
|
+
badVersion: string;
|
|
41
|
+
newerVersion: string;
|
|
42
|
+
noMigration: string;
|
|
43
|
+
unknownKey: string;
|
|
44
|
+
notList: string;
|
|
45
|
+
tooMany: string;
|
|
46
|
+
tooManyItems: string;
|
|
47
|
+
itemType: string;
|
|
48
|
+
unknownField: string;
|
|
49
|
+
unknownFieldHere: string;
|
|
50
|
+
placedTwice: string;
|
|
51
|
+
groupingNoName: string;
|
|
52
|
+
groupingNameTaken: string;
|
|
53
|
+
groupingNoSource: string;
|
|
54
|
+
groupingUnknown: string;
|
|
55
|
+
binsNeedNumber: string;
|
|
56
|
+
groupingNeedsDate: string;
|
|
57
|
+
binSize: string;
|
|
58
|
+
notValueRef: string;
|
|
59
|
+
unknownAggregator: string;
|
|
60
|
+
aggregatorNeedsField: string;
|
|
61
|
+
aggregatorType: string;
|
|
62
|
+
unknownFormat: string;
|
|
63
|
+
badLabel: string;
|
|
64
|
+
unknownShowAs: string;
|
|
65
|
+
showAsNotAdditive: string;
|
|
66
|
+
showAsNotNumber: string;
|
|
67
|
+
unknownConditional: string;
|
|
68
|
+
conditionalNotNumber: string;
|
|
69
|
+
colorScaleColors: string;
|
|
70
|
+
dataBarColor: string;
|
|
71
|
+
unknownFilterType: string;
|
|
72
|
+
filterNoItems: string;
|
|
73
|
+
filterLabelOp: string;
|
|
74
|
+
filterText: string;
|
|
75
|
+
filterNotNumber: string;
|
|
76
|
+
filterCount: string;
|
|
77
|
+
filterValue: string;
|
|
78
|
+
filterValue2: string;
|
|
79
|
+
sortNoItems: string;
|
|
80
|
+
sortedTwice: string;
|
|
81
|
+
badTotals: string;
|
|
82
|
+
collapsedPath: string;
|
|
83
|
+
unknownSetting: string;
|
|
84
|
+
badTitle: string;
|
|
85
|
+
unknownLocale: string;
|
|
86
|
+
unknownTimeZone: string;
|
|
87
|
+
timeZoneMismatch: string;
|
|
88
|
+
};
|
|
89
|
+
other: string;
|
|
90
|
+
};
|
|
91
|
+
export type UnusedContext = {
|
|
92
|
+
labels: import("./labels.js").UiLabels;
|
|
93
|
+
fill: (template: string, values: Record<string, unknown>) => string;
|
|
94
|
+
field: (name: string) => string;
|
|
95
|
+
value: (spec: {
|
|
96
|
+
field: string | null;
|
|
97
|
+
agg: string;
|
|
98
|
+
label: null;
|
|
99
|
+
showAs: null;
|
|
100
|
+
}) => string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* One issue in plain words: what it is about and what happened, the core's message aside.
|
|
104
|
+
* @param {import("pivotkit-core").Issue} issue
|
|
105
|
+
* @param {unknown} raw the view as given to normalize()
|
|
106
|
+
* @param {UnusedTexts} texts unusedTexts() of the report's language (unused-load.js)
|
|
107
|
+
* @param {UnusedContext} ctx
|
|
108
|
+
* @returns {{ pre: string, subject: string, post: string }} the text before the subject, the subject, the text after it
|
|
109
|
+
*/
|
|
110
|
+
export declare function unusedItem(issue: import("pivotkit-core").Issue, raw: unknown, texts: UnusedTexts, ctx: UnusedContext): {
|
|
111
|
+
pre: string;
|
|
112
|
+
subject: string;
|
|
113
|
+
post: string;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The lines of a list of issues: unusedItem() of each, and where two lines about different entries
|
|
117
|
+
* have the same subject (two values both named "Sum of Units"), each with its place ("no. 2 in
|
|
118
|
+
* Values").
|
|
119
|
+
* @param {Array<{ issue: import("pivotkit-core").Issue, raw: unknown }>} notes
|
|
120
|
+
* @param {UnusedTexts} texts
|
|
121
|
+
* @param {UnusedContext} ctx
|
|
122
|
+
*/
|
|
123
|
+
export declare function unusedItems(notes: Array<{
|
|
124
|
+
issue: import("pivotkit-core").Issue;
|
|
125
|
+
raw: unknown;
|
|
126
|
+
}>, texts: UnusedTexts, ctx: UnusedContext): {
|
|
127
|
+
pre: string;
|
|
128
|
+
subject: string;
|
|
129
|
+
post: string;
|
|
130
|
+
}[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type UnusedNote = {
|
|
3
|
+
issue: import("pivotkit-core").Issue;
|
|
4
|
+
raw: unknown;
|
|
5
|
+
} | {
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @param {{ notes: UnusedNote[], notesKey: string, dismissed: boolean, onDismiss: (next: HTMLElement | null) => void,
|
|
10
|
+
* labels: import("./labels.js").UiLabels, locale: string, narrow: boolean, quiet: boolean }} props
|
|
11
|
+
* `quiet`: the status note said it already (a view loaded partly), so the live region stays empty
|
|
12
|
+
*/
|
|
13
|
+
export declare function Unused({ notes, notesKey, dismissed, onDismiss, labels, locale, narrow, quiet }: {
|
|
14
|
+
notes: UnusedNote[];
|
|
15
|
+
notesKey: string;
|
|
16
|
+
dismissed: boolean;
|
|
17
|
+
onDismiss: (next: HTMLElement | null) => void;
|
|
18
|
+
labels: import("./labels.js").UiLabels;
|
|
19
|
+
locale: string;
|
|
20
|
+
narrow: boolean;
|
|
21
|
+
quiet: boolean;
|
|
22
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The report's Enlarge and Full screen states and their toggles.
|
|
3
|
+
* @param {React.RefObject<HTMLElement | null>} root
|
|
4
|
+
*/
|
|
5
|
+
export declare function useBigResult(root: React.RefObject<HTMLElement | null>): {
|
|
6
|
+
enlarged: boolean;
|
|
7
|
+
setEnlarged: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
8
|
+
toggleEnlarged: () => void;
|
|
9
|
+
full: boolean;
|
|
10
|
+
fullOk: boolean;
|
|
11
|
+
toggleFull: () => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The least height of the report's root (its inline min-height): what its toolbar, zones,
|
|
15
|
+
* tips, the result's own least height (CSS min-height) and the status line need. A host box that is
|
|
16
|
+
* higher changes nothing; a lower one lets the report grow past it, so the page scrolls. Measured
|
|
17
|
+
* after every render and when the report's size changes. The ref holds the last value (`need`, 0:
|
|
18
|
+
* none) and what the report needs with its zones open (`open`), so a box too low for the open zones
|
|
19
|
+
* folds them (PivotReport) instead of growing, and they stay folded until the box has room.
|
|
20
|
+
* @param {React.RefObject<HTMLElement | null>} root
|
|
21
|
+
* @param {React.RefObject<HTMLElement | null>} main the column with the toolbar, the zones and the result
|
|
22
|
+
* @param {boolean} grow the report may grow past its box (else only `open` is measured, for folding)
|
|
23
|
+
* @returns {React.MutableRefObject<{ need: number, open: number, grow: boolean }>}
|
|
24
|
+
*/
|
|
25
|
+
export declare function useFitHeight(root: React.RefObject<HTMLElement | null>, main: React.RefObject<HTMLElement | null>, grow: boolean): React.MutableRefObject<{
|
|
26
|
+
need: number;
|
|
27
|
+
open: number;
|
|
28
|
+
grow: boolean;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("./export-run.js").ExportContext} context
|
|
3
|
+
* @returns {(kind: "xlsx" | "csv" | "png" | "copy-table" | "copy-json") => Promise<void>}
|
|
4
|
+
*/
|
|
5
|
+
export declare function useExport(context: import("./export-run.js").ExportContext): (kind: "xlsx" | "csv" | "png" | "copy-table" | "copy-json") => Promise<void>;
|
|
6
|
+
/** Starts loading the export module when a menu that copies opens: a copy right in the click is allowed everywhere. */
|
|
7
|
+
export declare const prepareExporters: () => undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data-theme of the nearest element above `el` that has one, crossing shadow roots.
|
|
3
|
+
* @param {Element | null} el
|
|
4
|
+
*/
|
|
5
|
+
export declare function hostTheme(el: Element | null): string | null;
|
|
6
|
+
/**
|
|
7
|
+
* @param {"auto" | "light" | "dark" | undefined} wanted
|
|
8
|
+
* @param {React.RefObject<HTMLElement | null>} ref the report's root element
|
|
9
|
+
* @returns {"light" | "dark"}
|
|
10
|
+
*/
|
|
11
|
+
export declare function useResolvedTheme(wanted: "auto" | "light" | "dark" | undefined, ref: React.RefObject<HTMLElement | null>): "light" | "dark";
|