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.
Files changed (61) hide show
  1. package/CHANGELOG.md +306 -1
  2. package/README.md +48 -298
  3. package/dist/chunks/{chunk-ILHFIV2P.js → chunk-32Z33U6S.js} +58 -78
  4. package/dist/chunks/chunk-7CC4JHDY.js +363 -0
  5. package/dist/chunks/chunk-APB4NW4O.js +434 -0
  6. package/dist/chunks/chunk-EM23V5GH.js +183 -0
  7. package/dist/chunks/{chunk-KKJO36W5.js → chunk-IOPAM4JD.js} +412 -365
  8. package/dist/chunks/chunk-RWYHJRQO.js +99 -0
  9. package/dist/chunks/unused-texts-K3VFH65P.js +10 -0
  10. package/dist/chunks/unused-texts-de-OW4TGIVX.js +6 -0
  11. package/dist/echarts.js +96 -11
  12. package/dist/index.js +654 -560
  13. package/dist/labels.js +13 -4
  14. package/dist/menu-texts-de.js +6 -0
  15. package/dist/menus.js +2905 -550
  16. package/dist/styles.css +738 -216
  17. package/package.json +2 -2
  18. package/types/chart-layout.d.ts +111 -0
  19. package/types/chart-types.d.ts +0 -91
  20. package/types/chip-menus.d.ts +20 -4
  21. package/types/dnd.d.ts +8 -4
  22. package/types/drill-panel.d.ts +5 -22
  23. package/types/drill-table.d.ts +71 -0
  24. package/types/drill.d.ts +0 -36
  25. package/types/filter-level.d.ts +16 -0
  26. package/types/filter.d.ts +31 -0
  27. package/types/help.d.ts +14 -0
  28. package/types/icons.d.ts +4 -0
  29. package/types/labels.d.ts +114 -101
  30. package/types/lazy-menus.d.ts +18 -6
  31. package/types/levels.d.ts +105 -0
  32. package/types/menu-fields.d.ts +80 -0
  33. package/types/menu-labels-de.d.ts +2 -0
  34. package/types/menu-labels.d.ts +270 -13
  35. package/types/menu-ops.d.ts +286 -0
  36. package/types/menu-texts.d.ts +2 -0
  37. package/types/menu-topics.d.ts +293 -0
  38. package/types/menus.d.ts +2 -2
  39. package/types/names.d.ts +160 -20
  40. package/types/overflow.d.ts +4 -1
  41. package/types/place.d.ts +44 -0
  42. package/types/popover.d.ts +10 -6
  43. package/types/section.d.ts +8 -28
  44. package/types/share-actions.d.ts +99 -0
  45. package/types/share.d.ts +0 -9
  46. package/types/table.d.ts +9 -3
  47. package/types/templates.d.ts +7 -1
  48. package/types/tips.d.ts +1 -34
  49. package/types/toolbar-panels.d.ts +20 -10
  50. package/types/unused-load.d.ts +23 -0
  51. package/types/unused-texts-de.d.ts +2 -0
  52. package/types/unused-texts.d.ts +136 -0
  53. package/types/unused.d.ts +22 -0
  54. package/types/use-view-history.d.ts +8 -4
  55. package/types/view-history.d.ts +23 -6
  56. package/types/view-ops.d.ts +80 -119
  57. package/types/view-save.d.ts +76 -0
  58. package/types/view-store.d.ts +13 -6
  59. package/types/zones.d.ts +5 -4
  60. package/dist/chunks/chunk-C32TYSHG.js +0 -441
  61. package/dist/chunks/chunk-XYP47DJ3.js +0 -123
package/types/labels.d.ts CHANGED
@@ -1,8 +1,12 @@
1
- export type UiLabels = typeof en & import("./menu-labels.js").MenuTexts;
1
+ export type UiLabels = typeof en & import("./menu-labels.js").MenuTexts & {
2
+ unused?: import("./unused-texts.js").UnusedTexts;
3
+ };
2
4
  /**
3
5
  * Every text of the UI: these and the menus' (menu-labels.js, loaded with the menus; a type import
4
6
  * only, so they stay out of the first load).
5
- * @typedef {typeof en & import("./menu-labels.js").MenuTexts} UiLabels
7
+ * @typedef {typeof en & import("./menu-labels.js").MenuTexts & { unused?: import("./unused-texts.js").UnusedTexts }} UiLabels
8
+ * `unused`: the texts of a view's unused parts (unused-texts.js), loaded when a view has such parts;
9
+ * a host's are kept aside as the menus' are
6
10
  */
7
11
  export declare const en: {
8
12
  /** the language of the texts, for the report's lang attribute */
@@ -29,6 +33,7 @@ export declare const en: {
29
33
  noFieldMatch: string;
30
34
  fieldMenu: string;
31
35
  addTo: string;
36
+ addAgain: string;
32
37
  alreadyIn: string;
33
38
  move: string;
34
39
  moveTo: string;
@@ -66,6 +71,7 @@ export declare const en: {
66
71
  redo: string;
67
72
  reset: string;
68
73
  resetHint: string;
74
+ unsavedChanges: string;
69
75
  swap: string;
70
76
  layout: string;
71
77
  showLayout: string;
@@ -74,11 +80,6 @@ export declare const en: {
74
80
  views: string;
75
81
  exportLabel: string;
76
82
  options: string;
77
- totals: string;
78
- grandTotalRow: string;
79
- grandTotalColumn: string;
80
- rowSubtotals: string;
81
- colSubtotals: string;
82
83
  expand: string;
83
84
  collapse: string;
84
85
  showAs: string;
@@ -89,6 +90,10 @@ export declare const en: {
89
90
  sortCustomDesc: string;
90
91
  sortValueDesc: string;
91
92
  sortValueAsc: string;
93
+ headerSort: string;
94
+ headerSortDesc: string;
95
+ headerSortAsc: string;
96
+ headerSorted: string;
92
97
  units: {
93
98
  year: string;
94
99
  yearQuarter: string;
@@ -124,16 +129,10 @@ export declare const en: {
124
129
  filter: string;
125
130
  filtered: string;
126
131
  filterSummary: string;
132
+ /** a text the user typed or a name, quoted as the language quotes: a text condition, field names */
133
+ quote: string;
127
134
  filterTitle: string;
128
135
  condition: string;
129
- labelOps: {
130
- equals: string;
131
- notEquals: string;
132
- contains: string;
133
- notContains: string;
134
- beginsWith: string;
135
- endsWith: string;
136
- };
137
136
  emptyTitle: string;
138
137
  emptySteps: string[];
139
138
  emptyFields: string;
@@ -146,7 +145,16 @@ export declare const en: {
146
145
  tooMuchWork: string;
147
146
  zoneFull: string;
148
147
  viewTrimmed: string;
149
- issues: string;
148
+ unusedParts: {
149
+ one: string;
150
+ other: string;
151
+ };
152
+ unusedPath: string;
153
+ unusedMore: {
154
+ one: string;
155
+ other: string;
156
+ };
157
+ unusedFewer: string;
150
158
  dismissIssues: string;
151
159
  loadingChart: string;
152
160
  noChartData: string;
@@ -176,7 +184,7 @@ export declare const en: {
176
184
  toastUndone: string;
177
185
  toastRedone: string;
178
186
  toastReset: string;
179
- toastExported: string;
187
+ newEmpty: string;
180
188
  toastLoaded: string;
181
189
  toastExportFailed: string;
182
190
  steps: {
@@ -197,6 +205,7 @@ export declare const en: {
197
205
  swap: string;
198
206
  template: string;
199
207
  reset: string;
208
+ new: string;
200
209
  outside: string;
201
210
  viewLoaded: string;
202
211
  chartDisplay: string;
@@ -241,16 +250,6 @@ export declare const en: {
241
250
  };
242
251
  dismissTip: string;
243
252
  tipsTitle: string;
244
- shortcuts: {
245
- undo: string;
246
- redo: string;
247
- move: string;
248
- open: string;
249
- drag: string;
250
- close: string;
251
- fields: string;
252
- fieldMenu: string;
253
- };
254
253
  skipToToolbar: string;
255
254
  aboutField: string;
256
255
  learnMore: string;
@@ -273,13 +272,8 @@ export declare const en: {
273
272
  loadingMenu: string;
274
273
  menuFailed: string;
275
274
  tryAgain: string;
276
- chartDisplay: string;
277
275
  axisEvery: string;
278
276
  clearText: string;
279
- toastLinkCopied: string;
280
- toastJsonCopied: string;
281
- toastCopyFailed: string;
282
- toastLinkTooLong: string;
283
277
  toastViewLoaded: string;
284
278
  toastViewLoadedPartly: string;
285
279
  toastLinkOpened: string;
@@ -290,9 +284,6 @@ export declare const en: {
290
284
  loadCheckMissing: string;
291
285
  loadCheckChanged: string;
292
286
  linkCheckTitle: string;
293
- viewMissingFields: string;
294
- viewOtherIssue: string;
295
- viewOtherIssues: string;
296
287
  viewFailed: {
297
288
  empty: string;
298
289
  tooLarge: string;
@@ -302,36 +293,54 @@ export declare const en: {
302
293
  badLink: string;
303
294
  file: string;
304
295
  };
305
- filterIs: string;
306
296
  valueConditions: {
307
297
  compare: string;
308
298
  between: string;
309
299
  notBetween: string;
310
300
  };
301
+ countOfRows: string;
302
+ labelOps: {
303
+ equals: string;
304
+ notEquals: string;
305
+ contains: string;
306
+ notContains: string;
307
+ beginsWith: string;
308
+ endsWith: string;
309
+ };
310
+ relative: {
311
+ year: string;
312
+ years: string;
313
+ month: string;
314
+ months: string;
315
+ day: string;
316
+ days: string;
317
+ };
318
+ withRange: string;
319
+ relativeTo: string;
320
+ withShare: string;
321
+ noData: {
322
+ one: string;
323
+ other: string;
324
+ };
325
+ compareShort: {
326
+ "=": string;
327
+ "!=": string;
328
+ ">": string;
329
+ ">=": string;
330
+ "<": string;
331
+ "<=": string;
332
+ between: string;
333
+ notBetween: string;
334
+ };
311
335
  zoneInfo: {
312
336
  rows: string;
313
337
  cols: string;
314
338
  values: string;
315
339
  filters: string;
316
340
  };
317
- expandNothing: string;
318
- collapseNeedsRows: string;
319
- needsRowField: string;
320
- needsColField: string;
321
- needsRowFields: string;
322
- needsColFields: string;
323
341
  enlarge: string;
324
342
  reduce: string;
325
343
  fullScreen: string;
326
- collapseAllDone: string;
327
- groupsCollapsed: {
328
- one: string;
329
- other: string;
330
- };
331
- groupsExpanded: {
332
- one: string;
333
- other: string;
334
- };
335
344
  };
336
345
  export declare const de: {
337
346
  lang: string;
@@ -356,6 +365,7 @@ export declare const de: {
356
365
  noFieldMatch: string;
357
366
  fieldMenu: string;
358
367
  addTo: string;
368
+ addAgain: string;
359
369
  alreadyIn: string;
360
370
  move: string;
361
371
  moveTo: string;
@@ -393,6 +403,7 @@ export declare const de: {
393
403
  redo: string;
394
404
  reset: string;
395
405
  resetHint: string;
406
+ unsavedChanges: string;
396
407
  swap: string;
397
408
  layout: string;
398
409
  showLayout: string;
@@ -401,11 +412,6 @@ export declare const de: {
401
412
  views: string;
402
413
  exportLabel: string;
403
414
  options: string;
404
- totals: string;
405
- grandTotalRow: string;
406
- grandTotalColumn: string;
407
- rowSubtotals: string;
408
- colSubtotals: string;
409
415
  expand: string;
410
416
  collapse: string;
411
417
  showAs: string;
@@ -416,6 +422,10 @@ export declare const de: {
416
422
  sortCustomDesc: string;
417
423
  sortValueDesc: string;
418
424
  sortValueAsc: string;
425
+ headerSort: string;
426
+ headerSortDesc: string;
427
+ headerSortAsc: string;
428
+ headerSorted: string;
419
429
  units: {
420
430
  year: string;
421
431
  yearQuarter: string;
@@ -451,16 +461,9 @@ export declare const de: {
451
461
  filter: string;
452
462
  filtered: string;
453
463
  filterSummary: string;
464
+ quote: string;
454
465
  filterTitle: string;
455
466
  condition: string;
456
- labelOps: {
457
- equals: string;
458
- notEquals: string;
459
- contains: string;
460
- notContains: string;
461
- beginsWith: string;
462
- endsWith: string;
463
- };
464
467
  emptyTitle: string;
465
468
  emptySteps: string[];
466
469
  emptyFields: string;
@@ -473,7 +476,16 @@ export declare const de: {
473
476
  tooMuchWork: string;
474
477
  zoneFull: string;
475
478
  viewTrimmed: string;
476
- issues: string;
479
+ unusedParts: {
480
+ one: string;
481
+ other: string;
482
+ };
483
+ unusedPath: string;
484
+ unusedMore: {
485
+ one: string;
486
+ other: string;
487
+ };
488
+ unusedFewer: string;
477
489
  dismissIssues: string;
478
490
  loadingChart: string;
479
491
  noChartData: string;
@@ -503,7 +515,7 @@ export declare const de: {
503
515
  toastUndone: string;
504
516
  toastRedone: string;
505
517
  toastReset: string;
506
- toastExported: string;
518
+ newEmpty: string;
507
519
  toastLoaded: string;
508
520
  toastExportFailed: string;
509
521
  steps: {
@@ -524,6 +536,7 @@ export declare const de: {
524
536
  swap: string;
525
537
  template: string;
526
538
  reset: string;
539
+ new: string;
527
540
  outside: string;
528
541
  viewLoaded: string;
529
542
  chartDisplay: string;
@@ -568,16 +581,6 @@ export declare const de: {
568
581
  };
569
582
  dismissTip: string;
570
583
  tipsTitle: string;
571
- shortcuts: {
572
- undo: string;
573
- redo: string;
574
- move: string;
575
- open: string;
576
- drag: string;
577
- close: string;
578
- fields: string;
579
- fieldMenu: string;
580
- };
581
584
  skipToToolbar: string;
582
585
  aboutField: string;
583
586
  learnMore: string;
@@ -600,13 +603,8 @@ export declare const de: {
600
603
  loadingMenu: string;
601
604
  menuFailed: string;
602
605
  tryAgain: string;
603
- chartDisplay: string;
604
606
  axisEvery: string;
605
607
  clearText: string;
606
- toastLinkCopied: string;
607
- toastJsonCopied: string;
608
- toastCopyFailed: string;
609
- toastLinkTooLong: string;
610
608
  toastViewLoaded: string;
611
609
  toastViewLoadedPartly: string;
612
610
  toastLinkOpened: string;
@@ -617,9 +615,6 @@ export declare const de: {
617
615
  loadCheckMissing: string;
618
616
  loadCheckChanged: string;
619
617
  linkCheckTitle: string;
620
- viewMissingFields: string;
621
- viewOtherIssue: string;
622
- viewOtherIssues: string;
623
618
  viewFailed: {
624
619
  empty: string;
625
620
  tooLarge: string;
@@ -629,38 +624,56 @@ export declare const de: {
629
624
  badLink: string;
630
625
  file: string;
631
626
  };
632
- filterIs: string;
633
627
  valueConditions: {
634
628
  compare: string;
635
629
  between: string;
636
630
  notBetween: string;
637
631
  };
632
+ countOfRows: string;
633
+ labelOps: {
634
+ equals: string;
635
+ notEquals: string;
636
+ contains: string;
637
+ notContains: string;
638
+ beginsWith: string;
639
+ endsWith: string;
640
+ };
641
+ relative: {
642
+ year: string;
643
+ years: string;
644
+ month: string;
645
+ months: string;
646
+ day: string;
647
+ days: string;
648
+ };
649
+ withRange: string;
650
+ relativeTo: string;
651
+ withShare: string;
652
+ noData: {
653
+ one: string;
654
+ other: string;
655
+ };
656
+ compareShort: {
657
+ "=": string;
658
+ "!=": string;
659
+ ">": string;
660
+ ">=": string;
661
+ "<": string;
662
+ "<=": string;
663
+ between: string;
664
+ notBetween: string;
665
+ };
638
666
  zoneInfo: {
639
667
  rows: string;
640
668
  cols: string;
641
669
  values: string;
642
670
  filters: string;
643
671
  };
644
- expandNothing: string;
645
- collapseNeedsRows: string;
646
- needsRowField: string;
647
- needsColField: string;
648
- needsRowFields: string;
649
- needsColFields: string;
650
672
  enlarge: string;
651
673
  reduce: string;
652
674
  fullScreen: string;
653
- collapseAllDone: string;
654
- groupsCollapsed: {
655
- one: string;
656
- other: string;
657
- };
658
- groupsExpanded: {
659
- one: string;
660
- other: string;
661
- };
662
675
  };
663
- /** @type {Readonly<{ en: typeof en, de: typeof en }>} the texts of the first load; the menus' are MENU_LABELS (menu-labels.js) */
676
+ /** @type {Readonly<{ en: typeof en, de: typeof en }>} the texts of the first load; the menus' are in menu-labels.js (English) and menu-labels-<lang>.js (menu-texts.js) */
664
677
  export declare const LABELS: Readonly<{
665
678
  en: typeof en;
666
679
  de: typeof en;
@@ -1,16 +1,28 @@
1
1
  import React from "react";
2
- /** The menus' panels, imported once; a failed import is forgotten, so the next call tries again. */
3
- export declare function loadMenus(): Promise<typeof import("./menus.js")>;
4
- /** The menus' module at once when it is loaded, else null. */
5
- export declare const menusNow: () => typeof import("./menus.js") | null;
2
+ /** Calls `listener` whenever a language's texts arrived or failed; returns the unsubscribe. */
3
+ export declare function onMenuTexts(listener: any): () => undefined;
4
+ /**
5
+ * The menus' panels, imported once, with the menus' texts of `lang` (added to menus.js's). A failed
6
+ * import of the panels is forgotten and rejects, so the next call tries again; texts that fail leave
7
+ * English standing in (the panels resolve), and the next call tries them again.
8
+ * @param {string} [lang] the report's language (labels.lang)
9
+ * @returns {Promise<typeof import("./menus.js")>}
10
+ */
11
+ export declare function loadMenus(lang?: string): Promise<typeof import("./menus.js")>;
12
+ /**
13
+ * The menus' module at once when it is loaded with the texts of `lang` (or they failed: English
14
+ * stands in), else null; without `lang` the module as soon as it is loaded.
15
+ * @param {string} [lang]
16
+ */
17
+ export declare const menusNow: (lang?: string) => typeof import("./menus.js") | null;
6
18
  /**
7
19
  * One panel of menus.js with its props.
8
- * @param {{ name: "AxisMenu" | "ValueMenu" | "ChartTypePanel" | "OptionsPanel" | "ViewsPanel" | "ExportPanel" | "LoadCheck" | "FilterPopover" | "DrillPanel", loadingText?: string, props: Record<string, any> }} props
20
+ * @param {{ name: "AxisMenu" | "FilterMenu" | "ValueMenu" | "ChartTypePanel" | "OptionsPanel" | "ViewsPanel" | "ExportPanel" | "LoadCheck" | "FilterPopover" | "DrillPanel", loadingText?: string, props: Record<string, any> }} props
9
21
  * `loadingText`: shown while loading; without it nothing is (a popover or panel of its own).
10
22
  * `props.labels` gives the texts of a failed load
11
23
  */
12
24
  export declare function MenuPanel({ name, loadingText, props }: {
13
- name: "AxisMenu" | "ValueMenu" | "ChartTypePanel" | "OptionsPanel" | "ViewsPanel" | "ExportPanel" | "LoadCheck" | "FilterPopover" | "DrillPanel";
25
+ name: "AxisMenu" | "FilterMenu" | "ValueMenu" | "ChartTypePanel" | "OptionsPanel" | "ViewsPanel" | "ExportPanel" | "LoadCheck" | "FilterPopover" | "DrillPanel";
14
26
  loadingText?: string;
15
27
  props: Record<string, any>;
16
28
  }): React.JSX.Element;
@@ -0,0 +1,105 @@
1
+ import React from "react";
2
+ /** The button that opened the popover around `el` (MenuButton's aria-controls names it). */
3
+ export declare function openerOf(el: any): HTMLElement | null;
4
+ /**
5
+ * Tab in a menu leaves it: the focus goes to its button first, so the browser's Tab moves on from
6
+ * there to what follows it, and the menu closes.
7
+ * @param {KeyboardEvent | React.KeyboardEvent} e
8
+ * @param {() => void} close
9
+ */
10
+ export declare function tabLeaves(e: KeyboardEvent | React.KeyboardEvent, close: () => void): boolean;
11
+ /**
12
+ * An ARIA menu: one Tab stop (the item focused last, else the one marked `data-pk-start`, else the
13
+ * first), the arrow keys, Home and End, type-ahead; left and right move inside a group of choices
14
+ * side by side (`data-pk-seg`). `onKey` runs first and may take a key (return true).
15
+ * @param {{ label?: string, labelledBy?: string, className?: string, close: () => void, children: React.ReactNode, testId?: string }} props
16
+ */
17
+ export declare function MenuList({ label, labelledBy, className, close, children, testId }: {
18
+ label?: string;
19
+ labelledBy?: string;
20
+ className?: string;
21
+ close: () => void;
22
+ children: React.ReactNode;
23
+ testId?: string;
24
+ }): React.JSX.Element;
25
+ /**
26
+ * One item of a menu: a choice (`checked` set: menuitemradio, or menuitemcheckbox with `checkbox`)
27
+ * or an action. `hint` stands on its right (a format's example, a date unit's).
28
+ * @param {{ id: string, text: React.ReactNode, onSelect: () => void, checked?: boolean, checkbox?: boolean,
29
+ * hint?: string, icon?: string, danger?: boolean, testId?: string, start?: boolean, plain?: string,
30
+ * label?: string, className?: string, disabled?: boolean, reason?: string, haspopup?: "menu" | "dialog", level?: string,
31
+ * description?: string | null, current?: boolean, children?: React.ReactNode }} props
32
+ * `plain`: the text type-ahead matches; `start`: takes Tab first; `level`: the topic it opens;
33
+ * `description`: an explanation a screen reader reads with it (the "i" next to it shows it);
34
+ * `current`: the entry shown now (the view loaded), with a check and aria-current
35
+ */
36
+ export declare function MenuItem({ id, text, onSelect, checked, checkbox, hint, icon, danger, testId, start, plain, label, className, disabled, reason, haspopup, level, description, current, children }: {
37
+ id: string;
38
+ text: React.ReactNode;
39
+ onSelect: () => void;
40
+ checked?: boolean;
41
+ checkbox?: boolean;
42
+ hint?: string;
43
+ icon?: string;
44
+ danger?: boolean;
45
+ testId?: string;
46
+ start?: boolean;
47
+ plain?: string;
48
+ label?: string;
49
+ className?: string;
50
+ disabled?: boolean;
51
+ reason?: string;
52
+ haspopup?: "menu" | "dialog";
53
+ level?: string;
54
+ description?: string | null;
55
+ current?: boolean;
56
+ children?: React.ReactNode;
57
+ }): React.JSX.Element;
58
+ /**
59
+ * A menu in levels.
60
+ * @param {{ name: string, labels: any, topics: import("./menu-topics.js").Topic[], close: () => void,
61
+ * onPick: (choice: import("./menu-topics.js").Choice) => void, panel: (id: string, back: (focus?: string) => void, hint?: string) => React.ReactNode,
62
+ * head?: React.ReactNode, foot?: React.ReactNode, search?: boolean, locale?: string, focusAgain?: unknown }} props
63
+ * `onPick`: applies a choice (the menu then goes back to its first level, unless the choice closes
64
+ * it); `panel`: the form of a "panel" topic, with `back` (one level back, the focus where the level
65
+ * was opened from, or `focus`); `foot`: items after the topics (Remove field); `focusAgain`: when it
66
+ * changes, the focus goes once more where the last step sent it (that element may come later)
67
+ */
68
+ export declare function LevelMenu({ name, labels, topics, close, onPick, panel, head, foot, search, locale, focusAgain }: {
69
+ name: string;
70
+ labels: any;
71
+ topics: import("./menu-topics.js").Topic[];
72
+ close: () => void;
73
+ onPick: (choice: import("./menu-topics.js").Choice) => void;
74
+ panel: (id: string, back: (focus?: string) => void, hint?: string) => React.ReactNode;
75
+ head?: React.ReactNode;
76
+ foot?: React.ReactNode;
77
+ search?: boolean;
78
+ locale?: string;
79
+ focusAgain?: unknown;
80
+ }): React.JSX.Element;
81
+ /**
82
+ * Runs the last function handed to `later` a moment after the last call (the typing stopped); `now`
83
+ * runs it at once, `cancel` drops it.
84
+ * @param {number} [wait] ms
85
+ */
86
+ export declare function useLater(wait?: number): {
87
+ later: (/** @type {() => void} */ fn: () => void) => void;
88
+ now: () => void;
89
+ cancel: () => void;
90
+ };
91
+ /**
92
+ * A value the user types that applies a moment after the typing stops (`apply` with the text), at
93
+ * once on Enter or when the field is left; Escape gives the text it had back. Returns the text and
94
+ * what the field's handlers call.
95
+ * @param {string} applied the text that applies now
96
+ * @param {(text: string) => void} apply
97
+ * @param {number} [wait] ms; 0: only on Enter and when the field is left (a name)
98
+ */
99
+ export declare function useAppliedText(applied: string, apply: (text: string) => void, wait?: number): {
100
+ text: string;
101
+ set: (/** @type {string} */ value: string) => void;
102
+ flush: () => void;
103
+ /** Escape: back to the text that applies; true when there was something to give back. */
104
+ restore: () => boolean;
105
+ };
@@ -0,0 +1,80 @@
1
+ import React from "react";
2
+ /**
3
+ * A number typed into a menu, read in the report's locale (numbers.js). `kind` says what it must be:
4
+ * "number" any number, "size" above 0, "count" a whole number of 1 or more. The problem shows while
5
+ * the text is not such a number, and for an empty required field once Apply was pressed; `max`: the
6
+ * largest count, a larger one says so.
7
+ * @param {string} text
8
+ * @param {{ kind?: "number" | "size" | "count", required?: boolean, tried?: boolean, max?: number, labels: any, locale: string }} options
9
+ * @returns {{ value: number | null, problem: string | null }}
10
+ */
11
+ export declare function readNumber(text: string, { kind, required, tried, max, labels, locale }: {
12
+ kind?: "number" | "size" | "count";
13
+ required?: boolean;
14
+ tried?: boolean;
15
+ max?: number;
16
+ labels: any;
17
+ locale: string;
18
+ }): {
19
+ value: number | null;
20
+ problem: string | null;
21
+ };
22
+ /**
23
+ * The text field of a number: a text input for the locale's own way of writing numbers (a number
24
+ * input would read "1.000,5" by the browser's rules, not the report's), its problem under it.
25
+ * @param {{ value: string, onChange: (text: string) => void, problem: string | null, label: string,
26
+ * testId: string, className?: string, shown?: string, shownClass?: string, onKeyDown?: (e: React.KeyboardEvent) => void,
27
+ * onBlur?: () => void, onFocus?: () => void, autoFocus?: boolean }} props
28
+ */
29
+ export declare function NumberField({ value, onChange, problem, label, testId, className, shown, shownClass, onKeyDown, onBlur, onFocus, autoFocus }: {
30
+ value: string;
31
+ onChange: (text: string) => void;
32
+ problem: string | null;
33
+ label: string;
34
+ testId: string;
35
+ className?: string;
36
+ shown?: string;
37
+ shownClass?: string;
38
+ onKeyDown?: (e: React.KeyboardEvent) => void;
39
+ onBlur?: () => void;
40
+ onFocus?: () => void;
41
+ autoFocus?: boolean;
42
+ }): React.JSX.Element;
43
+ /**
44
+ * The keys of a field that applies what is typed: Enter applies now; Escape gives back what applies,
45
+ * or, when nothing was changed, goes back a level.
46
+ * @param {{ now: () => void, restore: () => boolean, back: () => void }} actions
47
+ */
48
+ export declare const fieldKeys: ({ now, restore, back }: {
49
+ now: () => void;
50
+ restore: () => boolean;
51
+ back: () => void;
52
+ }) => (/** @type {React.KeyboardEvent} */ e: React.KeyboardEvent) => void;
53
+ /**
54
+ * The measure a top N or a value condition goes by: a select when the view has several values that
55
+ * give numbers, else the one name. `index` is the position in `choices`.
56
+ * @param {{ choices: Array<{ field: string | null, agg: string }>, names: string[], index: number,
57
+ * onChange: (index: number) => void, label: string, prefix?: string, testId: string }} props
58
+ */
59
+ export declare function MeasurePick({ choices, names, index, onChange, label, prefix, testId }: {
60
+ choices: Array<{
61
+ field: string | null;
62
+ agg: string;
63
+ }>;
64
+ names: string[];
65
+ index: number;
66
+ onChange: (index: number) => void;
67
+ label: string;
68
+ prefix?: string;
69
+ testId: string;
70
+ }): React.JSX.Element;
71
+ /** The index of a reference in the choices; the first (the default) when it is not there. */
72
+ export declare const choiceIndex: (choices: any, ref: any) => number;
73
+ /** The measures a filter of a field can go by, with the one it goes by now, and their names. */
74
+ export declare function measuresOf(view: any, types: any, labels: any, ref: any): {
75
+ choices: {
76
+ field: string | null;
77
+ agg: string;
78
+ }[];
79
+ names: any[];
80
+ };
@@ -0,0 +1,2 @@
1
+ /** @type {import("./menu-labels.js").MenuTexts} */
2
+ export declare const de: import("./menu-labels.js").MenuTexts;