pivotkit-react 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +306 -1
- package/README.md +48 -298
- package/dist/chunks/{chunk-ILHFIV2P.js → chunk-32Z33U6S.js} +58 -78
- package/dist/chunks/chunk-7CC4JHDY.js +363 -0
- package/dist/chunks/chunk-APB4NW4O.js +434 -0
- package/dist/chunks/chunk-EM23V5GH.js +183 -0
- package/dist/chunks/{chunk-KKJO36W5.js → chunk-IOPAM4JD.js} +412 -365
- package/dist/chunks/chunk-RWYHJRQO.js +99 -0
- package/dist/chunks/unused-texts-K3VFH65P.js +10 -0
- package/dist/chunks/unused-texts-de-OW4TGIVX.js +6 -0
- package/dist/echarts.js +96 -11
- package/dist/index.js +654 -560
- package/dist/labels.js +13 -4
- package/dist/menu-texts-de.js +6 -0
- package/dist/menus.js +2905 -550
- package/dist/styles.css +738 -216
- package/package.json +2 -2
- package/types/chart-layout.d.ts +111 -0
- package/types/chart-types.d.ts +0 -91
- package/types/chip-menus.d.ts +20 -4
- package/types/dnd.d.ts +8 -4
- package/types/drill-panel.d.ts +5 -22
- package/types/drill-table.d.ts +71 -0
- package/types/drill.d.ts +0 -36
- package/types/filter-level.d.ts +16 -0
- package/types/filter.d.ts +31 -0
- package/types/help.d.ts +14 -0
- package/types/icons.d.ts +4 -0
- package/types/labels.d.ts +114 -101
- package/types/lazy-menus.d.ts +18 -6
- package/types/levels.d.ts +105 -0
- package/types/menu-fields.d.ts +80 -0
- package/types/menu-labels-de.d.ts +2 -0
- package/types/menu-labels.d.ts +270 -13
- package/types/menu-ops.d.ts +286 -0
- package/types/menu-texts.d.ts +2 -0
- package/types/menu-topics.d.ts +293 -0
- package/types/menus.d.ts +2 -2
- package/types/names.d.ts +160 -20
- package/types/overflow.d.ts +4 -1
- package/types/place.d.ts +44 -0
- package/types/popover.d.ts +10 -6
- package/types/section.d.ts +8 -28
- package/types/share-actions.d.ts +99 -0
- package/types/share.d.ts +0 -9
- package/types/table.d.ts +9 -3
- package/types/templates.d.ts +7 -1
- package/types/tips.d.ts +1 -34
- package/types/toolbar-panels.d.ts +20 -10
- package/types/unused-load.d.ts +23 -0
- package/types/unused-texts-de.d.ts +2 -0
- package/types/unused-texts.d.ts +136 -0
- package/types/unused.d.ts +22 -0
- package/types/use-view-history.d.ts +8 -4
- package/types/view-history.d.ts +23 -6
- package/types/view-ops.d.ts +80 -119
- package/types/view-save.d.ts +76 -0
- package/types/view-store.d.ts +13 -6
- package/types/zones.d.ts +5 -4
- package/dist/chunks/chunk-C32TYSHG.js +0 -441
- package/dist/chunks/chunk-XYP47DJ3.js +0 -123
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
export type Choice = {
|
|
2
|
+
id: string;
|
|
3
|
+
text: string;
|
|
4
|
+
change?: () => {
|
|
5
|
+
view: any;
|
|
6
|
+
note: any;
|
|
7
|
+
} | null;
|
|
8
|
+
run?: () => void;
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
hint?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
closes?: boolean;
|
|
13
|
+
checkbox?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
reason?: string;
|
|
16
|
+
info?: string;
|
|
17
|
+
keywords?: string;
|
|
18
|
+
open?: string;
|
|
19
|
+
backTo?: string;
|
|
20
|
+
actions?: Array<Choice & {
|
|
21
|
+
label: string;
|
|
22
|
+
}>;
|
|
23
|
+
current?: boolean;
|
|
24
|
+
testId?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
};
|
|
27
|
+
export type Topic = {
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
kind: "segmented" | "inline" | "menu" | "panel";
|
|
31
|
+
groups?: Array<{
|
|
32
|
+
title?: string;
|
|
33
|
+
choices: Choice[];
|
|
34
|
+
}>;
|
|
35
|
+
state?: string | null;
|
|
36
|
+
changed?: boolean;
|
|
37
|
+
icon?: string;
|
|
38
|
+
titled?: boolean;
|
|
39
|
+
heading?: string;
|
|
40
|
+
info?: string;
|
|
41
|
+
hidden?: boolean;
|
|
42
|
+
levelTitle?: string;
|
|
43
|
+
note?: string | null;
|
|
44
|
+
noteId?: string;
|
|
45
|
+
keywords?: string;
|
|
46
|
+
searchExtra?: Array<{
|
|
47
|
+
id: string;
|
|
48
|
+
text: string;
|
|
49
|
+
focus?: string;
|
|
50
|
+
choice?: Choice;
|
|
51
|
+
}>;
|
|
52
|
+
searchFor?: (query: string) => Array<{
|
|
53
|
+
id: string;
|
|
54
|
+
text: string;
|
|
55
|
+
focus?: string;
|
|
56
|
+
choice: Choice;
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* One choice of a topic: a menu item. `change` gives the next view and the history's note, or `run`
|
|
61
|
+
* does what it does; `closes`: the menu closes after it (the chip it belongs to is replaced, or moves
|
|
62
|
+
* away). `checkbox`: a switch (`checked` on or off) instead of one of several; `disabled` with the
|
|
63
|
+
* `reason`; `info`: the id of its explanation (labels.settingInfo). `open`: the id of a topic whose
|
|
64
|
+
* level it opens (after `run`; Back puts the focus on `backTo`, else on the choice), instead of applying; `actions`: an entry's own actions next to it
|
|
65
|
+
* (choices themselves, drawn as icon buttons with `label`); `current`: the entry shown now.
|
|
66
|
+
* @typedef {{ id: string, text: string, change?: () => { view: any, note: any } | null, run?: () => void, checked?: boolean,
|
|
67
|
+
* hint?: string, icon?: string, closes?: boolean, checkbox?: boolean, disabled?: boolean, reason?: string, info?: string,
|
|
68
|
+
* keywords?: string, open?: string, backTo?: string, actions?: Array<Choice & { label: string }>, current?: boolean, testId?: string, label?: string }} Choice
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* One topic of a menu. `kind`: "segmented" its choices on the first level side by side, "inline" one
|
|
72
|
+
* below the other (`titled`: under its title), "menu" a row that opens a level with its choices,
|
|
73
|
+
* "panel" a row that opens a level with a form (the menu's component draws it, by the topic's id).
|
|
74
|
+
* `state` is what is set, in short, on the row's right; `changed` marks a setting that is not the
|
|
75
|
+
* default; `info` the id of an explanation next to the level's title. `hidden`: a level a choice
|
|
76
|
+
* opens, with no row of its own (`levelTitle` its title); `note`: a line under its choices;
|
|
77
|
+
* `heading`: a group heading above a "menu" or "panel" row on the first level, as an inline topic's title.
|
|
78
|
+
* @typedef {{ id: string, title: string, kind: "segmented" | "inline" | "menu" | "panel",
|
|
79
|
+
* groups?: Array<{ title?: string, choices: Choice[] }>, state?: string | null, changed?: boolean,
|
|
80
|
+
* icon?: string, titled?: boolean, heading?: string, info?: string, hidden?: boolean, levelTitle?: string, note?: string | null, noteId?: string,
|
|
81
|
+
* keywords?: string, searchExtra?: Array<{ id: string, text: string, focus?: string, choice?: Choice }>,
|
|
82
|
+
* searchFor?: (query: string) => Array<{ id: string, text: string, focus?: string, choice: Choice }> }} Topic
|
|
83
|
+
* `keywords`: more words the search finds the topic's entries by (a choice's own `keywords` put it
|
|
84
|
+
* first among the hits for them); `searchExtra`: more entries of a panel topic (a part of its level,
|
|
85
|
+
* or a quick choice of it); `searchFor`: entries made from what is typed ("last 3 years", "from 2022").
|
|
86
|
+
*/
|
|
87
|
+
/** The formats the value menu offers first, and those under "More formats"; any other format of a view still works. */
|
|
88
|
+
export declare const FORMAT_CHOICES: readonly string[];
|
|
89
|
+
export declare const MORE_FORMATS: readonly string[];
|
|
90
|
+
/** The quick choices of Top items, besides Off and a count of one's own. */
|
|
91
|
+
export declare const TOP_COUNTS: readonly number[];
|
|
92
|
+
/**
|
|
93
|
+
* The topics of a field's menu on Rows or Columns: sort by label (side by side), sort by a value,
|
|
94
|
+
* Filter, the grouping of a date or a number, Top items, Move to.
|
|
95
|
+
* @param {{ view: any, zone: string, index: number, field: string, types: Map<string, string>,
|
|
96
|
+
* labels: any, locale: string, state?: any, defaultsOf?: (field: string) => any, encoded?: any }} input
|
|
97
|
+
* `state`: the chip's state (zones.jsx), for the filter's "3 of 12"; `encoded`: the data, for the
|
|
98
|
+
* search's quick choices of a date field
|
|
99
|
+
* @returns {Topic[]}
|
|
100
|
+
*/
|
|
101
|
+
export declare function axisTopics({ view, zone, index, field, types, labels, locale, state, defaultsOf, encoded }: {
|
|
102
|
+
view: any;
|
|
103
|
+
zone: string;
|
|
104
|
+
index: number;
|
|
105
|
+
field: string;
|
|
106
|
+
types: Map<string, string>;
|
|
107
|
+
labels: any;
|
|
108
|
+
locale: string;
|
|
109
|
+
state?: any;
|
|
110
|
+
defaultsOf?: (field: string) => any;
|
|
111
|
+
encoded?: any;
|
|
112
|
+
}): Topic[];
|
|
113
|
+
/**
|
|
114
|
+
* The Filter topic of a field's menu: its state in words ("last 5 years (2022–2026)", "3 of 12"), the
|
|
115
|
+
* rules found by their names (they open the level on them), and from what is typed in the search,
|
|
116
|
+
* for a date field: the quick choices with that count ("Last 3 years (2024–2026)") and, for a grouping
|
|
117
|
+
* by year, a year compared ("From 2022"), applied at once.
|
|
118
|
+
* @param {{ view: any, field: string, labels: any, locale: string, state?: any, encoded?: any }} input
|
|
119
|
+
* @returns {Topic}
|
|
120
|
+
*/
|
|
121
|
+
export declare function filterTopic({ view, field, labels, locale, state, encoded }: {
|
|
122
|
+
view: any;
|
|
123
|
+
field: string;
|
|
124
|
+
labels: any;
|
|
125
|
+
locale: string;
|
|
126
|
+
state?: any;
|
|
127
|
+
encoded?: any;
|
|
128
|
+
}): Topic;
|
|
129
|
+
/**
|
|
130
|
+
* The topics of a field's menu in Filters (the whole report): Filter, Move to.
|
|
131
|
+
* @param {{ view: any, index: number, field: string, types: Map<string, string>, labels: any, locale: string, state?: any, encoded?: any }} input
|
|
132
|
+
* @returns {Topic[]}
|
|
133
|
+
*/
|
|
134
|
+
export declare function filterZoneTopics({ view, index, field, types, labels, locale, state, encoded }: {
|
|
135
|
+
view: any;
|
|
136
|
+
index: number;
|
|
137
|
+
field: string;
|
|
138
|
+
types: Map<string, string>;
|
|
139
|
+
labels: any;
|
|
140
|
+
locale: string;
|
|
141
|
+
state?: any;
|
|
142
|
+
encoded?: any;
|
|
143
|
+
}): Topic[];
|
|
144
|
+
/**
|
|
145
|
+
* A Top items filter in words: "Top 10 by Sum of Revenue", "Bottom 3 by Count".
|
|
146
|
+
* @param {any} view
|
|
147
|
+
* @param {{ count: number, bottom?: boolean, by?: { field: string | null, agg: string } }} top
|
|
148
|
+
*/
|
|
149
|
+
export declare function topText(view: any, top: {
|
|
150
|
+
count: number;
|
|
151
|
+
bottom?: boolean;
|
|
152
|
+
by?: {
|
|
153
|
+
field: string | null;
|
|
154
|
+
agg: string;
|
|
155
|
+
};
|
|
156
|
+
}, labels: any, locale: any): string;
|
|
157
|
+
/**
|
|
158
|
+
* A format in words: its own label, a number with other decimals ("Number, 1 decimal"), else the
|
|
159
|
+
* label of its kind ("Currency" for currency:USD), else its name.
|
|
160
|
+
* @param {string} format
|
|
161
|
+
*/
|
|
162
|
+
export declare function formatLabel(format: string, labels: any, locale: any): any;
|
|
163
|
+
/**
|
|
164
|
+
* The topics of a value's menu: Summarize by, Show as, Number format (each a level), Highlight (side
|
|
165
|
+
* by side), Name, Move to. A value whose result is no number has no Show as, format or highlight.
|
|
166
|
+
* @param {{ view: any, index: number, types: Map<string, string>, labels: any, locale: string, defaultsOf?: (field: string) => any,
|
|
167
|
+
* earlier?: () => any[] }} input `earlier`: the history's views before this one, oldest first
|
|
168
|
+
* @returns {Topic[]}
|
|
169
|
+
*/
|
|
170
|
+
export declare function valueTopics({ view, index, types, labels, locale, defaultsOf, earlier }: {
|
|
171
|
+
view: any;
|
|
172
|
+
index: number;
|
|
173
|
+
types: Map<string, string>;
|
|
174
|
+
labels: any;
|
|
175
|
+
locale: string;
|
|
176
|
+
defaultsOf?: (field: string) => any;
|
|
177
|
+
earlier?: () => any[];
|
|
178
|
+
}): Topic[];
|
|
179
|
+
/**
|
|
180
|
+
* The topics of the Options menu: the totals (each a switch; one that would change nothing in this
|
|
181
|
+
* view is off, with the reason), Expand all and Collapse all (each only when it changes something,
|
|
182
|
+
* else with the reason), and help: Show tips, Show explanations, Show dismissed tips again, and the
|
|
183
|
+
* keyboard shortcuts (a level). What each does is the report's (`act`).
|
|
184
|
+
* @param {{ view: any, labels: any, folding: { canExpand: boolean, canCollapse: boolean, why: { expand?: string | null, collapse?: string | null } },
|
|
185
|
+
* tips: { controls: boolean, on: boolean, canReset: boolean }, explanations?: { on: boolean } | null,
|
|
186
|
+
* act: { total: (key: string, on: boolean) => void, expand: () => void, collapse: () => void, tipsOn: (on: boolean) => void,
|
|
187
|
+
* resetTips: () => void, explain: (on: boolean) => void } }} input
|
|
188
|
+
* @returns {Topic[]}
|
|
189
|
+
*/
|
|
190
|
+
export declare function optionTopics({ view, labels, folding, tips, explanations, act }: {
|
|
191
|
+
view: any;
|
|
192
|
+
labels: any;
|
|
193
|
+
folding: {
|
|
194
|
+
canExpand: boolean;
|
|
195
|
+
canCollapse: boolean;
|
|
196
|
+
why: {
|
|
197
|
+
expand?: string | null;
|
|
198
|
+
collapse?: string | null;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
tips: {
|
|
202
|
+
controls: boolean;
|
|
203
|
+
on: boolean;
|
|
204
|
+
canReset: boolean;
|
|
205
|
+
};
|
|
206
|
+
explanations?: {
|
|
207
|
+
on: boolean;
|
|
208
|
+
} | null;
|
|
209
|
+
act: {
|
|
210
|
+
total: (key: string, on: boolean) => void;
|
|
211
|
+
expand: () => void;
|
|
212
|
+
collapse: () => void;
|
|
213
|
+
tipsOn: (on: boolean) => void;
|
|
214
|
+
resetTips: () => void;
|
|
215
|
+
explain: (on: boolean) => void;
|
|
216
|
+
};
|
|
217
|
+
}): Topic[];
|
|
218
|
+
/**
|
|
219
|
+
* The ids of the Views menu's entries: by their group, their name and how often the name came
|
|
220
|
+
* before in that group, so an entry keeps its id when one before it is deleted, and two entries of
|
|
221
|
+
* one name are told apart.
|
|
222
|
+
* @param {Array<{ scope: string, name: string }>} templates
|
|
223
|
+
*/
|
|
224
|
+
export declare function entryIds(templates: Array<{
|
|
225
|
+
scope: string;
|
|
226
|
+
name: string;
|
|
227
|
+
}>): string[];
|
|
228
|
+
/**
|
|
229
|
+
* The entry the focus goes to once the entry at `place` of a group is deleted: the next one, else
|
|
230
|
+
* the one before it; undefined when it was the only one.
|
|
231
|
+
* @template T
|
|
232
|
+
* @param {T[]} list
|
|
233
|
+
* @param {number} place
|
|
234
|
+
*/
|
|
235
|
+
export declare const afterDelete: <T>(list: T[], place: number) => T;
|
|
236
|
+
export type SearchEntry = {
|
|
237
|
+
id: string;
|
|
238
|
+
text: string;
|
|
239
|
+
path: string;
|
|
240
|
+
topic: Topic;
|
|
241
|
+
choice?: Choice;
|
|
242
|
+
focus?: string;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* One entry of a menu's search: a choice of a topic (with the path to it), or a topic's level
|
|
246
|
+
* (`focus`: the part of it to show and focus).
|
|
247
|
+
* @typedef {{ id: string, text: string, path: string, topic: Topic, choice?: Choice, focus?: string }} SearchEntry
|
|
248
|
+
*/
|
|
249
|
+
/**
|
|
250
|
+
* Every entry of a menu, for its search: each choice with the titles above it as its path ("Number
|
|
251
|
+
* format › More formats"), each panel as an entry that opens it, and the entries a topic makes from
|
|
252
|
+
* what is typed (`query`).
|
|
253
|
+
* @param {Topic[]} topics
|
|
254
|
+
* @param {string} [query]
|
|
255
|
+
* @returns {SearchEntry[]}
|
|
256
|
+
*/
|
|
257
|
+
export declare function searchEntries(topics: Topic[], query?: string): SearchEntry[];
|
|
258
|
+
/** At most this many hits show. */
|
|
259
|
+
export declare const SEARCH_HITS = 8;
|
|
260
|
+
/**
|
|
261
|
+
* The entries every word of `query` is found in (its text or its path), at most SEARCH_HITS; those
|
|
262
|
+
* whose text starts with the query first.
|
|
263
|
+
* @param {SearchEntry[]} entries
|
|
264
|
+
* @param {string} query
|
|
265
|
+
* @param {string} [locale]
|
|
266
|
+
* @returns {SearchEntry[]}
|
|
267
|
+
*/
|
|
268
|
+
export declare function searchHits(entries: SearchEntry[], query: string, locale?: string): SearchEntry[];
|
|
269
|
+
/**
|
|
270
|
+
* A row's accessible name: "Filter, 3 of 12, changed" (`changedWord`: ", changed").
|
|
271
|
+
* @param {string} title
|
|
272
|
+
* @param {string | null | undefined} state
|
|
273
|
+
* @param {boolean | undefined} changed
|
|
274
|
+
* @param {string} changedWord
|
|
275
|
+
*/
|
|
276
|
+
export declare const rowName: (title: string, state: string | null | undefined, changed: boolean | undefined, changedWord: string) => string;
|
|
277
|
+
/**
|
|
278
|
+
* Where the focus goes in a list of `count` items from `at` for a key (ArrowDown, ArrowUp, Home,
|
|
279
|
+
* End), around the ends; null for another key.
|
|
280
|
+
* @param {string} key
|
|
281
|
+
* @param {number} at -1 when no item has the focus
|
|
282
|
+
* @param {number} count
|
|
283
|
+
*/
|
|
284
|
+
export declare function stepIndex(key: string, at: number, count: number): number | null;
|
|
285
|
+
/**
|
|
286
|
+
* Type-ahead: the next item after `at` whose text starts with `typed` (the letters typed in a short
|
|
287
|
+
* while), around the end; null when none does.
|
|
288
|
+
* @param {string[]} texts
|
|
289
|
+
* @param {number} at
|
|
290
|
+
* @param {string} typed
|
|
291
|
+
* @param {string} [locale]
|
|
292
|
+
*/
|
|
293
|
+
export declare function typeAheadIndex(texts: string[], at: number, typed: string, locale?: string): number | null;
|
package/types/menus.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { AxisMenu, ValueMenu } from "./chip-menus.jsx";
|
|
1
|
+
export { AxisMenu, FilterMenu, ValueMenu } from "./chip-menus.jsx";
|
|
2
2
|
export { ChartTypePanel, ExportPanel, LoadCheck, OptionsPanel, ViewsPanel } from "./toolbar-panels.jsx";
|
|
3
3
|
export { FilterPopover } from "./filter.jsx";
|
|
4
4
|
export { DrillPanel } from "./drill-panel.jsx";
|
|
5
|
-
export { menuLabels } from "./menu-labels.js";
|
|
5
|
+
export { addMenuTexts, hasMenuTexts, menuLabels } from "./menu-labels.js";
|
|
6
6
|
export { storedViews } from "./view-store.js";
|
|
7
7
|
export { prepareExporters, runExport } from "./export-run.js";
|
package/types/names.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export declare function valueLabel(spec: any, labels: any): any;
|
|
|
3
3
|
/**
|
|
4
4
|
* The name of a measure a sort, a top N or a value condition goes by ({ field, agg }): the name of the
|
|
5
5
|
* view's value for it ("Sum of Revenue", or the name the user gave it), without a "show as"
|
|
6
|
-
* calculation, since the raw result is what is compared
|
|
6
|
+
* calculation, since the raw result is what is compared; the row count the view does not show is
|
|
7
|
+
* "Count of rows".
|
|
7
8
|
* @param {any} view
|
|
8
9
|
* @param {{ field: string | null, agg: string } | null | undefined} ref
|
|
9
10
|
* @param {import("./labels.js").UiLabels} labels
|
|
@@ -12,6 +13,20 @@ export declare function refLabel(view: any, ref: {
|
|
|
12
13
|
field: string | null;
|
|
13
14
|
agg: string;
|
|
14
15
|
} | null | undefined, labels: import("./labels.js").UiLabels): any;
|
|
16
|
+
/**
|
|
17
|
+
* A sort in words: "Z to A", "Largest Sum of Revenue first", "Custom order".
|
|
18
|
+
* @param {any} view
|
|
19
|
+
* @param {{ by: string, order: string, value?: { field: string | null, agg: string } }} sort
|
|
20
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
21
|
+
*/
|
|
22
|
+
export declare function sortText(view: any, sort: {
|
|
23
|
+
by: string;
|
|
24
|
+
order: string;
|
|
25
|
+
value?: {
|
|
26
|
+
field: string | null;
|
|
27
|
+
agg: string;
|
|
28
|
+
};
|
|
29
|
+
}, labels: import("./labels.js").UiLabels): string;
|
|
15
30
|
/**
|
|
16
31
|
* A value condition in short: "Sum of Revenue > 1,000", "Sum of Revenue between 5 and 8".
|
|
17
32
|
* @param {any} view
|
|
@@ -28,15 +43,155 @@ export declare function valueConditionText(view: any, f: {
|
|
|
28
43
|
value: number;
|
|
29
44
|
value2?: number;
|
|
30
45
|
}, labels: import("./labels.js").UiLabels, locale: string): string;
|
|
46
|
+
/** A calendar day ("2022-03-01") as the locale writes a date. */
|
|
47
|
+
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. */
|
|
49
|
+
export declare const isoDay: (ms: any) => string;
|
|
50
|
+
/**
|
|
51
|
+
* The days a relative filter keeps, both included (pivotkit-core's relativeDateRange): counted back
|
|
52
|
+
* from today (`now`, default the current time) or, with `anchor: "latest"`, from the data's latest
|
|
53
|
+
* date (`latest`, wall-clock ms); null without one then, or for a range that leaves what a Date holds.
|
|
54
|
+
* @param {{ unit: string, count: number, anchor?: string }} f a `relative` filter
|
|
55
|
+
* @param {string} timeZone the data's
|
|
56
|
+
* @param {Date | number | string} [now]
|
|
57
|
+
* @param {number | null} [latest]
|
|
58
|
+
* @returns {{ from: string, to: string } | null}
|
|
59
|
+
*/
|
|
60
|
+
export declare const relativeDays: (f: {
|
|
61
|
+
unit: string;
|
|
62
|
+
count: number;
|
|
63
|
+
anchor?: string;
|
|
64
|
+
}, timeZone: string, now?: Date | number | string, latest?: number | null) => {
|
|
65
|
+
from: string;
|
|
66
|
+
to: string;
|
|
67
|
+
} | null;
|
|
68
|
+
/**
|
|
69
|
+
* A range of days as the unit writes it: "2022–2026" for years, "Dec 2025–Nov 2026" for months, dates
|
|
70
|
+
* for days; one period alone ("2026").
|
|
71
|
+
* @param {{ from: string, to: string }} range ISO days, both included
|
|
72
|
+
* @param {string} unit
|
|
73
|
+
* @param {string} locale
|
|
74
|
+
*/
|
|
75
|
+
export declare function periodText(range: {
|
|
76
|
+
from: string;
|
|
77
|
+
to: string;
|
|
78
|
+
}, unit: string, locale: string): any;
|
|
79
|
+
/**
|
|
80
|
+
* The days a relative date range keeps, as the unit writes them: "2022–2026" for years, "Dec
|
|
81
|
+
* 2025–Nov 2026" for months, dates for days; one period alone ("2026"); "" for no range.
|
|
82
|
+
* @param {{ unit: string, count: number, anchor?: string }} f a `relative` filter
|
|
83
|
+
* @param {string} locale
|
|
84
|
+
* @param {string} timeZone the data's
|
|
85
|
+
* @param {Date | number | string} [now] today, default the current time
|
|
86
|
+
* @param {number | null} [latest] the data's latest date (wall-clock ms), for anchor "latest"
|
|
87
|
+
*/
|
|
88
|
+
export declare function rangeText(f: {
|
|
89
|
+
unit: string;
|
|
90
|
+
count: number;
|
|
91
|
+
anchor?: string;
|
|
92
|
+
}, locale: string, timeZone: string, now?: Date | number | string, latest?: number | null): any;
|
|
93
|
+
/**
|
|
94
|
+
* The data's share of a range: which of its days have data and which have none. Null when the data
|
|
95
|
+
* cover the whole range; `none` when they cover none of it; else the days with data (`data`) and
|
|
96
|
+
* the parts without, as years when whole years have no data ("2026"), else as the unit writes them.
|
|
97
|
+
* @param {{ from: string, to: string }} range ISO days
|
|
98
|
+
* @param {string} unit
|
|
99
|
+
* @param {{ min: number, max: number }} span the data's first and last date (wall-clock ms)
|
|
100
|
+
* @param {string} locale
|
|
101
|
+
* @returns {{ none: true } | { none: false, data: string, missing: string[], count: number } | null} `count`: how many
|
|
102
|
+
* periods have no data, for the words ("2026 has no data", "2021–2022 have no data")
|
|
103
|
+
*/
|
|
104
|
+
export declare function rangeShare(range: {
|
|
105
|
+
from: string;
|
|
106
|
+
to: string;
|
|
107
|
+
}, unit: string, span: {
|
|
108
|
+
min: number;
|
|
109
|
+
max: number;
|
|
110
|
+
}, locale: string): {
|
|
111
|
+
none: true;
|
|
112
|
+
} | {
|
|
113
|
+
none: false;
|
|
114
|
+
data: string;
|
|
115
|
+
missing: string[];
|
|
116
|
+
count: number;
|
|
117
|
+
} | null;
|
|
118
|
+
/**
|
|
119
|
+
* A relative date range in short, with the days it keeps: "last 5 years (2022–2026)", "this year
|
|
120
|
+
* (2026)". With the data's span, the data's share of them: "last 2 years (2025; 2026 has no data)",
|
|
121
|
+
* "this year (2026 has no data)". Anchored at the data's latest date: "last 12 months to Dec 2025",
|
|
122
|
+
* its days only when the data do not cover them all.
|
|
123
|
+
* @param {{ unit: string, count: number, anchor?: string }} f a `relative` filter
|
|
124
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
125
|
+
* @param {string} locale
|
|
126
|
+
* @param {string} timeZone the data's
|
|
127
|
+
* @param {Date | number | string} [now] today, default the current time
|
|
128
|
+
* @param {{ min: number, max: number } | null} [span] the data's first and last date (wall-clock ms)
|
|
129
|
+
*/
|
|
130
|
+
export declare function relativeText(f: {
|
|
131
|
+
unit: string;
|
|
132
|
+
count: number;
|
|
133
|
+
anchor?: string;
|
|
134
|
+
}, labels: import("./labels.js").UiLabels, locale: string, timeZone: string, now?: Date | number | string, span?: {
|
|
135
|
+
min: number;
|
|
136
|
+
max: number;
|
|
137
|
+
} | null): string;
|
|
138
|
+
/**
|
|
139
|
+
* The years two calendar days bound as whole years (Jan 1 to Dec 31), or null: the days a comparison
|
|
140
|
+
* on a date grouping's source dates gets from Years combined.
|
|
141
|
+
* @returns {[string, string] | null}
|
|
142
|
+
*/
|
|
143
|
+
export declare function wholeYears(from: any, to: any): [string, string] | null;
|
|
144
|
+
/**
|
|
145
|
+
* A comparison of the item itself in short: "from 2022", "2022 to 2024" for a date or a date
|
|
146
|
+
* grouping, "≥ 10" for a number. `labelOf` gives an item's label (a grouping's "Mar 2025").
|
|
147
|
+
* @param {{ op: string, value: number | string, value2?: number | string }} f a `compare` filter
|
|
148
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
149
|
+
* @param {string} locale
|
|
150
|
+
* @param {{ date: boolean, labelOf?: (value: number) => string | undefined }} kind
|
|
151
|
+
*/
|
|
152
|
+
export declare function compareText(f: {
|
|
153
|
+
op: string;
|
|
154
|
+
value: number | string;
|
|
155
|
+
value2?: number | string;
|
|
156
|
+
}, labels: import("./labels.js").UiLabels, locale: string, { date, labelOf }: {
|
|
157
|
+
date: boolean;
|
|
158
|
+
labelOf?: (value: number) => string | undefined;
|
|
159
|
+
}): string;
|
|
160
|
+
/**
|
|
161
|
+
* A rule on a field's items in short, as its chip and its menu say it: "last 5 years (2022–2026)",
|
|
162
|
+
* "from 2022", "contains “an”".
|
|
163
|
+
* @param {{ type: string, op?: string, value?: any, value2?: any, unit?: string, count?: number }} f a `relative`, `compare` or `label` filter
|
|
164
|
+
* @param {import("./labels.js").UiLabels} labels
|
|
165
|
+
* @param {string} locale
|
|
166
|
+
* @param {{ timeZone: string, date: boolean, labelOf?: (value: number) => string | undefined, span?: { min: number, max: number } | null }} kind
|
|
167
|
+
* `span`: the data's first and last date, for the data's share of a relative range
|
|
168
|
+
*/
|
|
169
|
+
export declare function itemRuleText(f: {
|
|
170
|
+
type: string;
|
|
171
|
+
op?: string;
|
|
172
|
+
value?: any;
|
|
173
|
+
value2?: any;
|
|
174
|
+
unit?: string;
|
|
175
|
+
count?: number;
|
|
176
|
+
}, labels: import("./labels.js").UiLabels, locale: string, { timeZone, date, labelOf, span }: {
|
|
177
|
+
timeZone: string;
|
|
178
|
+
date: boolean;
|
|
179
|
+
labelOf?: (value: number) => string | undefined;
|
|
180
|
+
span?: {
|
|
181
|
+
min: number;
|
|
182
|
+
max: number;
|
|
183
|
+
} | null;
|
|
184
|
+
}): string;
|
|
31
185
|
/** The name of a derived field for a grouping, in the labels' language: "Date by month", "Amount (by 100)". */
|
|
32
186
|
export declare function groupingName(source: any, unit: any, labels: any, size: any): string;
|
|
33
187
|
/** The zone a click on a field of the field list puts it in: numbers to Values, the rest to Rows. */
|
|
34
188
|
export declare const quickZone: (type: any) => "rows" | "values";
|
|
35
189
|
/**
|
|
36
|
-
* What a click on a field of the field list does, from its type and the zones it is in:
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
190
|
+
* What a click (or Enter) on a field of the field list does, from its type and the zones it is in:
|
|
191
|
+
* "add" it to its quick zone, "move" it there from Columns or Filters (a field is on one axis only),
|
|
192
|
+
* or nothing when it is in that zone already, as in Excel's field list: a number in Values is not
|
|
193
|
+
* added a second time by a click, only by "Add to Values again" in its menu. `name` is the button's
|
|
194
|
+
* accessible name (the field and where it is), `description` the action in words.
|
|
40
195
|
* @param {string} field
|
|
41
196
|
* @param {string} type
|
|
42
197
|
* @param {string[]} zones the zones the field is in
|
|
@@ -63,18 +218,3 @@ export declare function layoutSummary(entries: Record<string, Array<{
|
|
|
63
218
|
title: string;
|
|
64
219
|
fields: string;
|
|
65
220
|
}>;
|
|
66
|
-
/**
|
|
67
|
-
* What the filter of a field keeps, for its menu: "Filter: 15 of 45", "Filter: contains “abc”",
|
|
68
|
-
* "Filter: Sum of Revenue > 1,000"; null without a filter.
|
|
69
|
-
* @param {any} view
|
|
70
|
-
* @param {string} field
|
|
71
|
-
* @param {{ summary: { shown: number, total: number } | null } | null | undefined} state the chip's state (zones.jsx)
|
|
72
|
-
* @param {import("./labels.js").UiLabels} labels
|
|
73
|
-
* @param {string} locale
|
|
74
|
-
*/
|
|
75
|
-
export declare function filterText(view: any, field: string, state: {
|
|
76
|
-
summary: {
|
|
77
|
-
shown: number;
|
|
78
|
-
total: number;
|
|
79
|
-
} | null;
|
|
80
|
-
} | null | undefined, labels: import("./labels.js").UiLabels, locale: string): string | null;
|
package/types/overflow.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The buttons that move into "More" when the toolbar is too narrow, first to go first: a fixed
|
|
3
3
|
* priority. The order never depends on a button's own state (Layout open or folded), so a click never
|
|
4
|
-
* moves it.
|
|
4
|
+
* moves it. Reset goes first: it is wider than "More", which takes its place. Views goes last: it is
|
|
5
|
+
* where a user saves the report, so it stays wherever one button besides Undo, Redo and Export fits
|
|
6
|
+
* (a report with its field list in a window 1280 px wide). Redo is not in the list: it stays next
|
|
7
|
+
* to Undo, which always stays. (New is in the Views menu, not in the toolbar.)
|
|
5
8
|
*/
|
|
6
9
|
export declare const OVERFLOW_ORDER: readonly string[];
|
|
7
10
|
/**
|
package/types/place.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The room a fixed popover has: the window without its scroll bars (the root's client box). A classic
|
|
3
|
+
* scroll bar (Windows, 17 px) is part of innerWidth but not of the area fixed elements are laid out
|
|
4
|
+
* in; placed against innerWidth, a popover at the right edge would reach under the scroll bar.
|
|
5
|
+
* @param {Document} doc
|
|
6
|
+
* @returns {{ width: number, height: number }}
|
|
7
|
+
*/
|
|
8
|
+
export declare function viewportOf(doc: Document): {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
1
12
|
/**
|
|
2
13
|
* @param {{ top: number, bottom: number, left: number, right: number }} anchor getBoundingClientRect()
|
|
3
14
|
* @param {{ width: number, height: number }} size the popover's size
|
|
@@ -25,6 +36,39 @@ export declare function placePopover(anchor: {
|
|
|
25
36
|
maxHeight: number;
|
|
26
37
|
side: "below" | "above";
|
|
27
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* A popover whose content changes while it is open (a menu's level in place of its first level) stays
|
|
41
|
+
* where it was: on its side, with its top below the anchor, its new content scrolling inside, instead
|
|
42
|
+
* of jumping above the anchor or over it. Only while the anchor has not moved, and only when that side
|
|
43
|
+
* has room enough (KEEP_ROOM, or the content's height); else `next`, placed anew.
|
|
44
|
+
* @param {{ top: number, side: "below" | "above", anchorTop: number } | null} last the last place, with the anchor's top then
|
|
45
|
+
* @param {{ top: number, left: number, maxHeight: number, side: "below" | "above" }} next placePopover's
|
|
46
|
+
* @param {{ top: number, bottom: number }} anchor
|
|
47
|
+
* @param {{ height: number }} size
|
|
48
|
+
* @param {{ height: number }} viewport
|
|
49
|
+
*/
|
|
50
|
+
export declare function keepPlace(last: {
|
|
51
|
+
top: number;
|
|
52
|
+
side: "below" | "above";
|
|
53
|
+
anchorTop: number;
|
|
54
|
+
} | null, next: {
|
|
55
|
+
top: number;
|
|
56
|
+
left: number;
|
|
57
|
+
maxHeight: number;
|
|
58
|
+
side: "below" | "above";
|
|
59
|
+
}, anchor: {
|
|
60
|
+
top: number;
|
|
61
|
+
bottom: number;
|
|
62
|
+
}, size: {
|
|
63
|
+
height: number;
|
|
64
|
+
}, viewport: {
|
|
65
|
+
height: number;
|
|
66
|
+
}): {
|
|
67
|
+
top: number;
|
|
68
|
+
left: number;
|
|
69
|
+
maxHeight: number;
|
|
70
|
+
side: "below" | "above";
|
|
71
|
+
};
|
|
28
72
|
/**
|
|
29
73
|
* A place in viewport coordinates as the top and left of a fixed element whose containing block
|
|
30
74
|
* starts at `origin` (the viewport rect of a fixed probe at 0, 0: { top: 0, left: 0 } without a
|
package/types/popover.d.ts
CHANGED
|
@@ -44,10 +44,11 @@ export declare function Popover({ open, anchor, onClose, label, role, align, cla
|
|
|
44
44
|
* @param {{ label: string, icon?: string, text?: React.ReactNode, showText?: boolean, className?: string,
|
|
45
45
|
* role?: "menu" | "dialog", align?: "start" | "end", popoverClass?: string, disabled?: boolean,
|
|
46
46
|
* title?: string, children: (close: () => void) => React.ReactNode, testId?: string, name?: string,
|
|
47
|
-
* buttonRef?: React.RefObject<HTMLButtonElement>, tabIndex?: number, slot?: string, fill?: boolean }} props
|
|
48
|
-
* `tabIndex`: -1 where a list moves the focus itself (the field list)
|
|
47
|
+
* buttonRef?: React.RefObject<HTMLButtonElement>, tabIndex?: number, slot?: string, fill?: boolean, mark?: React.ReactNode }} props
|
|
48
|
+
* `tabIndex`: -1 where a list moves the focus itself (the field list); `mark`: after the text (the
|
|
49
|
+
* dot for unsaved changes on "More")
|
|
49
50
|
*/
|
|
50
|
-
export declare function MenuButton({ label, icon, text, showText, className, role, align, popoverClass, disabled, title, children, testId, buttonRef, name, tabIndex, slot, fill }: {
|
|
51
|
+
export declare function MenuButton({ label, icon, text, showText, className, role, align, popoverClass, disabled, title, children, testId, buttonRef, name, tabIndex, slot, fill, mark }: {
|
|
51
52
|
label: string;
|
|
52
53
|
icon?: string;
|
|
53
54
|
text?: React.ReactNode;
|
|
@@ -65,16 +66,18 @@ export declare function MenuButton({ label, icon, text, showText, className, rol
|
|
|
65
66
|
tabIndex?: number;
|
|
66
67
|
slot?: string;
|
|
67
68
|
fill?: boolean;
|
|
69
|
+
mark?: React.ReactNode;
|
|
68
70
|
}): React.JSX.Element;
|
|
69
71
|
/**
|
|
70
72
|
* One option of a menu or of a chip's settings: one line. `hint` is a short second line that belongs
|
|
71
73
|
* to the option (a date unit's example); `reason` says why a disabled option does nothing and shows
|
|
72
74
|
* only while it is disabled (it is state, not an explanation: those go into an "i").
|
|
73
75
|
* @param {{ onSelect: () => void, icon?: string, checked?: boolean, children: React.ReactNode, hint?: React.ReactNode,
|
|
74
|
-
* reason?: React.ReactNode, inMenu?: boolean, disabled?: boolean, danger?: boolean, tone?: "accent", testId?: string }} props
|
|
75
|
-
* `tone`: "accent" for an option that says what is set (a filter)
|
|
76
|
+
* reason?: React.ReactNode, inMenu?: boolean, disabled?: boolean, danger?: boolean, tone?: "accent", testId?: string, current?: boolean }} props
|
|
77
|
+
* `tone`: "accent" for an option that says what is set (a filter); `current`: the entry shown now
|
|
78
|
+
* (the view loaded), with a check and aria-current
|
|
76
79
|
*/
|
|
77
|
-
export declare function Option({ onSelect, icon, checked, children, hint, reason, inMenu, disabled, danger, tone, testId }: {
|
|
80
|
+
export declare function Option({ onSelect, icon, checked, children, hint, reason, inMenu, disabled, danger, tone, testId, current }: {
|
|
78
81
|
onSelect: () => void;
|
|
79
82
|
icon?: string;
|
|
80
83
|
checked?: boolean;
|
|
@@ -86,4 +89,5 @@ export declare function Option({ onSelect, icon, checked, children, hint, reason
|
|
|
86
89
|
danger?: boolean;
|
|
87
90
|
tone?: "accent";
|
|
88
91
|
testId?: string;
|
|
92
|
+
current?: boolean;
|
|
89
93
|
}): React.JSX.Element;
|
package/types/section.d.ts
CHANGED
|
@@ -1,42 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export type Help = {
|
|
3
|
-
/**
|
|
4
|
-
* the "i" of the settings are shown
|
|
5
|
-
*/
|
|
6
|
-
explain: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* whether a section is open
|
|
9
|
-
*/
|
|
10
|
-
isOpen: (id: string) => boolean;
|
|
11
|
-
setOpen: (id: string, open: boolean) => void;
|
|
12
|
-
labels: import("./labels.js").UiLabels | null;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* @typedef {object} Help
|
|
16
|
-
* @property {boolean} explain the "i" of the settings are shown
|
|
17
|
-
* @property {(id: string) => boolean} isOpen whether a section is open
|
|
18
|
-
* @property {(id: string, open: boolean) => void} setOpen
|
|
19
|
-
* @property {import("./labels.js").UiLabels | null} labels
|
|
20
|
-
*/
|
|
21
|
-
/** @type {React.Context<Help>} */
|
|
22
|
-
export declare const HelpContext: React.Context<Help>;
|
|
23
2
|
/**
|
|
24
3
|
* The "i" next to a setting: its explanation (labels.settingInfo[id], loaded with the menus) on
|
|
25
4
|
* hover, focus or tap. Nothing while "Show explanations" is off or the text is missing.
|
|
26
|
-
* @param {{ id: string, name: string }} props `name`: the setting's name, for the button's name
|
|
5
|
+
* @param {{ id: string, name: string, tabIndex?: number }} props `name`: the setting's name, for the button's name;
|
|
6
|
+
* `tabIndex` -1 next to a menu's item (the item has the text as its description)
|
|
27
7
|
*/
|
|
28
|
-
export declare function SettingInfo({ id, name }: {
|
|
8
|
+
export declare function SettingInfo({ id, name, tabIndex }: {
|
|
29
9
|
id: string;
|
|
30
10
|
name: string;
|
|
11
|
+
tabIndex?: number;
|
|
31
12
|
}): React.JSX.Element | null;
|
|
32
13
|
/**
|
|
33
|
-
* A titled group of
|
|
34
|
-
*
|
|
35
|
-
* @param {{ title: React.ReactNode, children: React.ReactNode,
|
|
14
|
+
* A titled group of a menu's entries (the Export menus, the chart type), with `info`, the id of an
|
|
15
|
+
* explanation shown as an "i" next to the title.
|
|
16
|
+
* @param {{ title: React.ReactNode, children: React.ReactNode, info?: string }} props
|
|
36
17
|
*/
|
|
37
|
-
export declare function Section({ title, children,
|
|
18
|
+
export declare function Section({ title, children, info }: {
|
|
38
19
|
title: React.ReactNode;
|
|
39
20
|
children: React.ReactNode;
|
|
40
|
-
id?: string;
|
|
41
21
|
info?: string;
|
|
42
22
|
}): React.JSX.Element;
|