pivotkit-react 0.2.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +164 -1
  2. package/README.md +1 -1
  3. package/dist/chunks/{chunk-F6MVUAQD.js → chunk-32Z33U6S.js} +23 -0
  4. package/dist/chunks/{chunk-QBD4FOBB.js → chunk-7CC4JHDY.js} +123 -14
  5. package/dist/chunks/{chunk-LQCWFJBS.js → chunk-APB4NW4O.js} +146 -22
  6. package/dist/chunks/{chunk-53ZMK4BH.js → chunk-EM23V5GH.js} +6 -0
  7. package/dist/chunks/{chunk-X7H7BAVT.js → chunk-IOPAM4JD.js} +307 -179
  8. package/dist/chunks/{chunk-OYY4BKIL.js → chunk-RWYHJRQO.js} +6 -0
  9. package/dist/chunks/{unused-texts-YTNJCFFC.js → unused-texts-K3VFH65P.js} +1 -1
  10. package/dist/chunks/{unused-texts-de-SGOHV4N7.js → unused-texts-de-OW4TGIVX.js} +1 -1
  11. package/dist/index.js +58 -56
  12. package/dist/labels.js +5 -5
  13. package/dist/menu-texts-de.js +1 -1
  14. package/dist/menus.js +2429 -670
  15. package/dist/styles.css +557 -117
  16. package/package.json +2 -2
  17. package/types/chip-menus.d.ts +20 -4
  18. package/types/dnd.d.ts +8 -4
  19. package/types/filter-level.d.ts +16 -0
  20. package/types/filter.d.ts +31 -0
  21. package/types/help.d.ts +0 -7
  22. package/types/labels.d.ts +71 -0
  23. package/types/lazy-menus.d.ts +2 -2
  24. package/types/levels.d.ts +105 -0
  25. package/types/menu-fields.d.ts +80 -0
  26. package/types/menu-labels.d.ts +214 -19
  27. package/types/menu-ops.d.ts +150 -9
  28. package/types/menu-topics.d.ts +293 -0
  29. package/types/menus.d.ts +1 -1
  30. package/types/names.d.ts +141 -1
  31. package/types/place.d.ts +44 -0
  32. package/types/section.d.ts +8 -11
  33. package/types/tips.d.ts +1 -36
  34. package/types/toolbar-panels.d.ts +15 -8
  35. package/types/unused-texts.d.ts +6 -0
  36. package/types/use-view-history.d.ts +2 -1
  37. package/types/view-ops.d.ts +12 -0
  38. package/types/zones.d.ts +5 -4
  39. package/types/sections.d.ts +0 -2
@@ -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,4 +1,4 @@
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";
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
@@ -42,6 +43,145 @@ export declare function valueConditionText(view: any, f: {
42
43
  value: number;
43
44
  value2?: number;
44
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;
45
185
  /** The name of a derived field for a grouping, in the labels' language: "Date by month", "Amount (by 100)". */
46
186
  export declare function groupingName(source: any, unit: any, labels: any, size: any): string;
47
187
  /** The zone a click on a field of the field list puts it in: numbers to Values, the rest to Rows. */
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
@@ -2,24 +2,21 @@ import React from "react";
2
2
  /**
3
3
  * The "i" next to a setting: its explanation (labels.settingInfo[id], loaded with the menus) on
4
4
  * hover, focus or tap. Nothing while "Show explanations" is off or the text is missing.
5
- * @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)
6
7
  */
7
- export declare function SettingInfo({ id, name }: {
8
+ export declare function SettingInfo({ id, name, tabIndex }: {
8
9
  id: string;
9
10
  name: string;
11
+ tabIndex?: number;
10
12
  }): React.JSX.Element | null;
11
13
  /**
12
- * A titled group of options. With an `id` of SECTIONS (tips.js) its title is a button that folds it;
13
- * folded, the title says what the section holds (`state`, muted at its end) and marks a setting that
14
- * is not the default (`changed`). `info` is the id of an explanation shown as an "i" next to the
15
- * title.
16
- * @param {{ title: React.ReactNode, children: React.ReactNode, id?: string, info?: string, state?: string | null, changed?: boolean }} props
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
17
17
  */
18
- export declare function Section({ title, children, id, info, state, changed }: {
18
+ export declare function Section({ title, children, info }: {
19
19
  title: React.ReactNode;
20
20
  children: React.ReactNode;
21
- id?: string;
22
21
  info?: string;
23
- state?: string | null;
24
- changed?: boolean;
25
22
  }): React.JSX.Element;
package/types/tips.d.ts CHANGED
@@ -138,42 +138,7 @@ export declare const SWITCHES: readonly string[];
138
138
  * @param {readonly string[]} dismissed
139
139
  */
140
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. */
141
+ /** Entries "Show dismissed tips again" keeps: the switches. */
177
142
  export declare const keptOnReset: (id: any) => boolean;
178
143
  /**
179
144
  * Whether one kind of "i" shows: the host's "on" or "off" forces it (and the user's switch leaves it
@@ -8,6 +8,11 @@ export declare function ChartTypePanel({ view, plan, labels, onChart, onDisplay,
8
8
  plan: any;
9
9
  view: any;
10
10
  }): React.JSX.Element;
11
+ /**
12
+ * The Options menu (topics in menu-topics.js): the totals, Expand all and Collapse all, help with the
13
+ * keyboard shortcuts as a level. A switch or an action applies at once and the menu stays open (the
14
+ * report behind it shows the change); Expand all and Collapse all close it.
15
+ */
11
16
  export declare function OptionsPanel({ view, labels, onTotal, onExpand, onCollapse, close, tips, mod, folding, help }: {
12
17
  close: any;
13
18
  folding: any;
@@ -43,15 +48,17 @@ export declare function LoadCheck({ check, labels, onCancel, close, title, quiet
43
48
  quiet?: boolean;
44
49
  }): React.JSX.Element;
45
50
  /**
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
51
+ * The Views menu in levels: its first level is the list to scan - "This view" (Save the loaded view
52
+ * under its name, or why not; Save as…; New, an empty report), "Shared views" (the host's, for
48
53
  * 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.
54
+ * it has entries ("My views" also when the user can save), then Share. Save as…, Share (copy a link
55
+ * or the JSON, download, load a view) and the questions before a change open levels of their own. An
56
+ * entry loads its view; a deletable one has Delete next to it, a user's view Publish when the host
57
+ * allows it, a shared one that is not deletable the "i" that says who changes shared views. Delete,
58
+ * publish and Save over a shared view ask first, in a level; the entry changes only when the host's
59
+ * callback (or the browser store) has finished, and the focus goes back to the entry in that place
60
+ * (the next one after a delete). Names need not be unique: every entry is shown, keyed by its group,
61
+ * its name and how often the name came before.
55
62
  * @param {{ templates: import("./templates.js").TemplateEntry[], labels: any, onLoad: (t: any) => void, actions: any, close: () => void, share?: any }} props
56
63
  */
57
64
  export declare function ViewsPanel({ templates, labels, onLoad, actions, close, share }: {
@@ -76,6 +76,12 @@ export declare const en: {
76
76
  filterCount: string;
77
77
  filterValue: string;
78
78
  filterValue2: string;
79
+ filterCompareField: string;
80
+ filterCompareValue: string;
81
+ filterRelativeField: string;
82
+ filterRelativeUnit: string;
83
+ filterRelativeCount: string;
84
+ filterRelativeAnchor: string;
79
85
  sortNoItems: string;
80
86
  sortedTwice: string;
81
87
  badTotals: string;
@@ -10,7 +10,7 @@ export declare function schemaKeyOf(encoded: import("pivotkit-core").Encoded): s
10
10
  * field (fieldDefaults.order), applied to every view shown (withHostOrders); keep it stable
11
11
  * @returns {{ view: import("pivotkit-core").View, viewKey: string, tag: any, setTag: (tag: any) => void, commit: (next: object, note: string, tag?: any) => boolean,
12
12
  * undo: () => string | null, redo: () => string | null, reset: (note: string) => void,
13
- * restore: (view: object, tag?: any) => void, keyOf: (view: object) => string, canUndo: boolean, canRedo: boolean, canReset: boolean }}
13
+ * restore: (view: object, tag?: any) => void, keyOf: (view: object) => string, earlier: () => any[], canUndo: boolean, canRedo: boolean, canReset: boolean }}
14
14
  */
15
15
  export declare function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outsideNote, orderOf }: {
16
16
  encoded: import("pivotkit-core").Encoded;
@@ -31,6 +31,7 @@ export declare function useViewHistory({ encoded, view, defaultView, onViewChang
31
31
  reset: (note: string) => void;
32
32
  restore: (view: object, tag?: any) => void;
33
33
  keyOf: (view: object) => string;
34
+ earlier: () => any[];
34
35
  canUndo: boolean;
35
36
  canRedo: boolean;
36
37
  canReset: boolean;