pivotkit-react 0.7.0 → 0.8.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 (55) hide show
  1. package/CHANGELOG.md +167 -1
  2. package/README.md +33 -15
  3. package/dist/chunks/{chunk-JMRTIOX4.js → chunk-2N2UGSIG.js} +7 -0
  4. package/dist/chunks/{chunk-ZK5RVCHP.js → chunk-BHHIZHUE.js} +1 -1
  5. package/dist/chunks/{chunk-YXLANLGL.js → chunk-GUSQWPTH.js} +56 -3
  6. package/dist/chunks/{chunk-E6M57YLL.js → chunk-MU5BTKSY.js} +7 -0
  7. package/dist/chunks/{chunk-TR2HROIK.js → chunk-RNQ32FCN.js} +66 -5
  8. package/dist/chunks/{chunk-XN5HNKJ2.js → chunk-SJCG4I57.js} +98 -33
  9. package/dist/chunks/{chunk-4WZ5F2TJ.js → chunk-VMJMDP7C.js} +371 -32
  10. package/dist/chunks/{unused-texts-Y4R67XSN.js → unused-texts-LRYVWFFN.js} +1 -1
  11. package/dist/chunks/{unused-texts-de-6YVPTNVS.js → unused-texts-de-GB3IWWEM.js} +1 -1
  12. package/dist/echarts.js +426 -35
  13. package/dist/import-ui.js +2 -2
  14. package/dist/index.js +723 -392
  15. package/dist/labels.js +6 -6
  16. package/dist/menu-texts-de.js +1 -1
  17. package/dist/menus.js +1534 -1020
  18. package/dist/styles.css +268 -158
  19. package/package.json +3 -3
  20. package/types/PivotReport.d.ts +6 -0
  21. package/types/add-menu.d.ts +48 -0
  22. package/types/chart-colors.d.ts +8 -0
  23. package/types/chart-decorate.d.ts +66 -3
  24. package/types/chart-legend.d.ts +176 -0
  25. package/types/chart-summary.d.ts +8 -3
  26. package/types/chart-tooltip.d.ts +159 -17
  27. package/types/chart.d.ts +21 -3
  28. package/types/date-context.d.ts +30 -0
  29. package/types/drill-panel.d.ts +4 -2
  30. package/types/echarts.d.ts +7 -3
  31. package/types/export-run.d.ts +7 -14
  32. package/types/export-scope.d.ts +13 -2
  33. package/types/field-info.d.ts +12 -0
  34. package/types/files.d.ts +14 -0
  35. package/types/filter.d.ts +18 -0
  36. package/types/group-context.d.ts +20 -0
  37. package/types/index.d.ts +35 -6
  38. package/types/label-room.d.ts +13 -0
  39. package/types/labels.d.ts +85 -16
  40. package/types/lazy-menus.d.ts +2 -2
  41. package/types/levels.d.ts +16 -7
  42. package/types/menu-labels.d.ts +67 -1
  43. package/types/menu-ops.d.ts +10 -0
  44. package/types/menu-topics.d.ts +110 -21
  45. package/types/menus.d.ts +2 -1
  46. package/types/names.d.ts +32 -3
  47. package/types/overflow.d.ts +18 -30
  48. package/types/rove.d.ts +10 -0
  49. package/types/toolbar-panels.d.ts +34 -10
  50. package/types/unused-texts.d.ts +7 -0
  51. package/types/use-big-result.d.ts +24 -9
  52. package/types/use-export.d.ts +2 -2
  53. package/types/view-ops.d.ts +19 -8
  54. package/types/view-tabs.d.ts +12 -0
  55. package/types/zones.d.ts +41 -9
@@ -1,8 +1,13 @@
1
1
  // src/labels.js
2
- import { GROUPING_NAMES, PivotkitError, REPORT_LABELS } from "pivotkit-core";
2
+ import { GROUPING_NAMES, PLURAL_CATEGORIES, PivotkitError, REPORT_LABELS, ROW_COUNT_TEXTS, pluralForm } from "pivotkit-core";
3
3
  var en = {
4
4
  /** the language of the texts, for the report's lang attribute */
5
5
  lang: "en",
6
+ dateYearsCombined: "{years} combined",
7
+ dateYearOnly: "{years} only",
8
+ dateRangeTitle: "{field}: the data's first and last date, before filters",
9
+ dateRangeData: "Data before filters: {range}",
10
+ dateRangeField: "{field} before filters: {range}",
6
11
  /** the name of the report's region landmark */
7
12
  report: "Pivot report",
8
13
  core: (
@@ -11,10 +16,10 @@ var en = {
11
16
  ),
12
17
  zones: { rows: "Rows", cols: "Columns", values: "Values", filters: "Filters" },
13
18
  zoneHints: {
14
- rows: "Drop fields here to group rows",
15
- cols: "Drop fields here to group columns",
16
- values: "Drop numbers here to sum or count them",
17
- filters: "Drop fields here to filter the whole report"
19
+ rows: "Add or drop a field to group rows",
20
+ cols: "Add or drop a field to group columns",
21
+ values: "Add or drop a number to sum or count it",
22
+ filters: "Add or drop a field to filter the whole report"
18
23
  },
19
24
  fields: "Fields",
20
25
  fieldsHint: "Drag a field into Rows, Columns, Values or Filters, or open its menu.",
@@ -28,6 +33,11 @@ var en = {
28
33
  addAgain: "Add to {zone} again",
29
34
  // a click on a field that is in its zone already: said in the status line
30
35
  alreadyIn: "{field} is already in {zone}",
36
+ // "+ Add" in each zone: its text, and its name and tooltip
37
+ addField: "Add",
38
+ addFieldTo: "Add a field to {zone}",
39
+ // said in the zones' status line after a field from "+ Add" moved there from another zone
40
+ movedFrom: "{field} moved from {from} to {zone}",
31
41
  move: "Move",
32
42
  moveTo: "Move to {zone}",
33
43
  dragHandle: "Drag {field}",
@@ -59,10 +69,12 @@ var en = {
59
69
  // next to Views: the name of the view loaded, and the mark while it has changes not saved
60
70
  unsavedChanges: "Unsaved changes",
61
71
  swap: "Swap rows and columns",
62
- // the zones folded into one line (compact layout), and the toolbar button that does it (pressed: open)
63
- layout: "Layout",
64
- showLayout: "Show field layout",
72
+ // the section of the zones: its heading, and its line under it while open (folded: what is placed,
73
+ // or layoutEmpty)
74
+ zonesTitle: "Fields in the report",
75
+ zonesHint: "Drag fields into Filters, Columns, Rows and Values, or use Add in each one.",
65
76
  layoutEmpty: "No fields placed yet",
77
+ // always at the end of the toolbar: Help first, then the buttons that do not fit
66
78
  more: "More",
67
79
  // the Views menu: the saved views (the host's templates) and sharing
68
80
  views: "Views",
@@ -74,7 +86,11 @@ var en = {
74
86
  emptyDrop: "Drop a file onto the report, or",
75
87
  emptyNoData: "Load data to start",
76
88
  exportLabel: "Export",
77
- options: "Options",
89
+ // the button beside the tabs Table and Chart: the settings of the view shown
90
+ tableSettings: "Table settings",
91
+ chartSettings: "Chart settings",
92
+ // the same button's text on a phone; its name stays the whole one
93
+ settingsShort: "Settings",
78
94
  expand: "Expand {label}",
79
95
  collapse: "Collapse {label}",
80
96
  showAs: "Show as",
@@ -105,7 +121,7 @@ var en = {
105
121
  },
106
122
  // a date grouping's name: "Date by month"; the unit as it reads inside it (unitInName); pivotkit-core's GROUPING_NAMES
107
123
  derivedName: GROUPING_NAMES.en.name,
108
- unitInName: { ...GROUPING_NAMES.en.units },
124
+ unitInName: GROUPING_NAMES.en.units,
109
125
  binsName: GROUPING_NAMES.en.bins,
110
126
  top: "Top",
111
127
  topBadge: "Top {count}",
@@ -121,8 +137,8 @@ var en = {
121
137
  // result
122
138
  emptyTitle: "Build your report in three steps",
123
139
  emptySteps: [
124
- "Drag a field such as a team or region into Rows.",
125
- "Drag a number into Values: it is summed, or counted for text.",
140
+ "Click + Add next to Rows, or drag a field such as a team or region into it.",
141
+ "Add a number to Values the same way: it is summed, or counted for text.",
126
142
  "Add a field to Columns, switch to Chart or export to Excel."
127
143
  ],
128
144
  emptyFields: "The data has no columns.",
@@ -145,8 +161,11 @@ var en = {
145
161
  dismissIssues: "Dismiss",
146
162
  loadingChart: "Loading chart\u2026",
147
163
  noChartData: "Add a value to see a chart.",
148
- // a count in words: one form per Intl.PluralRules category of the language ("one", "other", ...)
149
- rowsCount: { one: "{count} row", other: "{count} rows" },
164
+ // a count in words: one form per Intl.PluralRules category of the language ("one", "other", ...);
165
+ // the row counts are pivotkit-core's, so pivotkit-report's HTML report says the same
166
+ rowsCount: ROW_COUNT_TEXTS.en.rowsCount,
167
+ // a filter left rows out: the rows kept ({shown}) of the data's ({count}, which picks the form)
168
+ rowsFiltered: ROW_COUNT_TEXTS.en.rowsFiltered,
150
169
  tableName: "Pivot table",
151
170
  emptyCell: "No rows",
152
171
  emptyValue: "No value",
@@ -157,8 +176,24 @@ var en = {
157
176
  chartCategories: { one: "{count} category", other: "{count} categories" },
158
177
  chartSeries: { one: "{count} series", other: "{count} series" },
159
178
  chartExtremes: "Highest {max} at {maxAt}; lowest {min} at {minAt}.",
179
+ // the chart's reference lines in its text alternative: "Average 25; Trend from 10 to 40"
180
+ chartLines: "Reference lines: {lines}.",
181
+ chartTrendSpan: "from {from} to {to}",
160
182
  // the last sentence of the chart's text alternative
161
183
  chartTableHint: "Switch to Table to read every value.",
184
+ // the tooltip's last line on stacked bars and areas: the sum of the stack's parts
185
+ chartTotal: "Total",
186
+ // the tooltip's line for the series that do not fit
187
+ chartMore: "+{count} more",
188
+ chartMoreInTotal: "+{count} more (in the total)",
189
+ // said when a click on the legend hides or shows a series (or a slice)
190
+ // the chart's text alternative of a 100 % stack
191
+ chartShares: "Shown as shares of each stack.",
192
+ // the zoom slider by keyboard: its name, and what it shows
193
+ chartZoom: "Zoom window",
194
+ chartZoomWindow: "Categories {from} to {to} of {count}",
195
+ chartHidden: "{name} hidden",
196
+ chartShown: "{name} shown",
162
197
  categories: "categories",
163
198
  close: "Close",
164
199
  // toasts and live region
@@ -354,6 +389,11 @@ var en = {
354
389
  };
355
390
  var de = {
356
391
  lang: "de",
392
+ dateYearsCombined: "{years} zusammengefasst",
393
+ dateYearOnly: "nur {years}",
394
+ dateRangeTitle: "{field}: erstes und letztes Datum der Daten, vor den Filtern",
395
+ dateRangeData: "Daten vor den Filtern: {range}",
396
+ dateRangeField: "{field} vor den Filtern: {range}",
357
397
  report: "Pivot-Bericht",
358
398
  core: (
359
399
  /** @type {import("pivotkit-core").Labels} */
@@ -361,10 +401,10 @@ var de = {
361
401
  ),
362
402
  zones: { rows: "Zeilen", cols: "Spalten", values: "Werte", filters: "Filter" },
363
403
  zoneHints: {
364
- rows: "Felder hierher ziehen, um Zeilen zu gruppieren",
365
- cols: "Felder hierher ziehen, um Spalten zu gruppieren",
366
- values: "Zahlen hierher ziehen, um sie zu summieren oder zu z\xE4hlen",
367
- filters: "Felder hierher ziehen, um den ganzen Bericht zu filtern"
404
+ rows: "Ein Feld hinzuf\xFCgen oder hierher ziehen, um Zeilen zu gruppieren",
405
+ cols: "Ein Feld hinzuf\xFCgen oder hierher ziehen, um Spalten zu gruppieren",
406
+ values: "Eine Zahl hinzuf\xFCgen oder hierher ziehen, um sie zu summieren oder zu z\xE4hlen",
407
+ filters: "Ein Feld hinzuf\xFCgen oder hierher ziehen, um den ganzen Bericht zu filtern"
368
408
  },
369
409
  fields: "Felder",
370
410
  fieldsHint: "Ein Feld in Zeilen, Spalten, Werte oder Filter ziehen oder sein Men\xFC \xF6ffnen.",
@@ -375,6 +415,9 @@ var de = {
375
415
  addTo: "Zu {zone} hinzuf\xFCgen",
376
416
  addAgain: "Noch einmal zu {zone} hinzuf\xFCgen",
377
417
  alreadyIn: "{field} ist bereits in {zone}",
418
+ addField: "Hinzuf\xFCgen",
419
+ addFieldTo: "Ein Feld zu {zone} hinzuf\xFCgen",
420
+ movedFrom: "{field} von {from} nach {zone} verschoben",
378
421
  move: "Verschieben",
379
422
  moveTo: "Nach {zone} verschieben",
380
423
  dragHandle: "{field} ziehen",
@@ -402,8 +445,8 @@ var de = {
402
445
  newAlready: "Der Bericht ist schon leer.",
403
446
  unsavedChanges: "Nicht gespeicherte \xC4nderungen",
404
447
  swap: "Zeilen und Spalten tauschen",
405
- layout: "Anordnung",
406
- showLayout: "Feldanordnung zeigen",
448
+ zonesTitle: "Felder im Bericht",
449
+ zonesHint: "Felder in Filter, Spalten, Zeilen und Werte ziehen oder in jedem Bereich Hinzuf\xFCgen nutzen.",
407
450
  layoutEmpty: "Noch keine Felder angeordnet",
408
451
  more: "Mehr",
409
452
  views: "Ansichten",
@@ -414,7 +457,9 @@ var de = {
414
457
  emptyDrop: "Eine Datei auf den Bericht ziehen, oder",
415
458
  emptyNoData: "Daten laden, um zu beginnen",
416
459
  exportLabel: "Export",
417
- options: "Optionen",
460
+ tableSettings: "Tabelleneinstellungen",
461
+ chartSettings: "Diagrammeinstellungen",
462
+ settingsShort: "Einstellungen",
418
463
  expand: "{label} aufklappen",
419
464
  collapse: "{label} zuklappen",
420
465
  showAs: "Anzeigen als",
@@ -443,7 +488,7 @@ var de = {
443
488
  bin: "Bereiche"
444
489
  },
445
490
  derivedName: GROUPING_NAMES.de.name,
446
- unitInName: { ...GROUPING_NAMES.de.units },
491
+ unitInName: GROUPING_NAMES.de.units,
447
492
  binsName: GROUPING_NAMES.de.bins,
448
493
  top: "Oberste",
449
494
  topBadge: "Top {count}",
@@ -456,8 +501,8 @@ var de = {
456
501
  condition: "Textbedingung",
457
502
  emptyTitle: "Den Bericht in drei Schritten bauen",
458
503
  emptySteps: [
459
- "Ein Feld wie Team oder Region in Zeilen ziehen.",
460
- "Eine Zahl in Werte ziehen: Sie wird summiert, Text wird gez\xE4hlt.",
504
+ "Neben Zeilen auf + Hinzuf\xFCgen klicken oder ein Feld wie Team oder Region hineinziehen.",
505
+ "Eine Zahl genauso zu Werte hinzuf\xFCgen: Sie wird summiert, Text wird gez\xE4hlt.",
461
506
  "Ein Feld in Spalten ziehen, zum Diagramm wechseln oder nach Excel exportieren."
462
507
  ],
463
508
  emptyFields: "Die Daten haben keine Spalten.",
@@ -477,7 +522,8 @@ var de = {
477
522
  dismissIssues: "Ausblenden",
478
523
  loadingChart: "Diagramm wird geladen\u2026",
479
524
  noChartData: "Einen Wert hinzuf\xFCgen, um ein Diagramm zu sehen.",
480
- rowsCount: { one: "{count} Zeile", other: "{count} Zeilen" },
525
+ rowsCount: ROW_COUNT_TEXTS.de.rowsCount,
526
+ rowsFiltered: ROW_COUNT_TEXTS.de.rowsFiltered,
481
527
  tableName: "Pivot-Tabelle",
482
528
  emptyCell: "Keine Zeilen",
483
529
  emptyValue: "Kein Wert",
@@ -487,7 +533,17 @@ var de = {
487
533
  chartCategories: { one: "{count} Kategorie", other: "{count} Kategorien" },
488
534
  chartSeries: { one: "{count} Reihe", other: "{count} Reihen" },
489
535
  chartExtremes: "H\xF6chster Wert {max} bei {maxAt}; niedrigster {min} bei {minAt}.",
536
+ chartLines: "Bezugslinien: {lines}.",
537
+ chartTrendSpan: "von {from} bis {to}",
490
538
  chartTableHint: "Zur Tabelle wechseln, um jeden Wert zu lesen.",
539
+ chartTotal: "Gesamt",
540
+ chartMore: "+{count} weitere",
541
+ chartMoreInTotal: "+{count} weitere (im Gesamtwert)",
542
+ chartShares: "Als Anteile je Stapel dargestellt.",
543
+ chartZoom: "Zoom-Fenster",
544
+ chartZoomWindow: "Kategorien {from} bis {to} von {count}",
545
+ chartHidden: "{name} ausgeblendet",
546
+ chartShown: "{name} eingeblendet",
491
547
  categories: "Kategorien",
492
548
  close: "Schlie\xDFen",
493
549
  toastRemoved: "{field} entfernt",
@@ -687,16 +743,13 @@ function hostFailure(withMessage, withoutMessage, error) {
687
743
  function fill(template, values) {
688
744
  return String(template).replace(/\{(\w+)\}/g, (all, name) => Object.hasOwn(values, name) ? String(values[name]) : all);
689
745
  }
690
- var PLURAL_CATEGORIES = Object.freeze(["zero", "one", "two", "few", "many", "other"]);
691
746
  var isPluralForms = (v) => v !== null && typeof v === "object" && !Array.isArray(v) && Object.hasOwn(v, "other") && Object.keys(v).every((k) => PLURAL_CATEGORIES.includes(k));
692
747
  function plural(forms, count, { lang, locale }) {
693
- let category = "other";
694
- try {
695
- category = new Intl.PluralRules(lang).select(count);
696
- } catch {
697
- }
698
- const form = typeof forms[category] === "string" ? forms[category] : forms.other;
699
- return fill(form ?? "", { count: count.toLocaleString(locale) });
748
+ return fill(pluralForm(forms, count, lang), { count: count.toLocaleString(locale) });
749
+ }
750
+ function rowCount(shown, total, labels, locale) {
751
+ const lang = { lang: labels.lang, locale };
752
+ return shown < total ? fill(plural(labels.rowsFiltered, total, lang), { shown: shown.toLocaleString(locale) }) : plural(labels.rowsCount, total, lang);
700
753
  }
701
754
  var isObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
702
755
  var isTextList = (v) => Array.isArray(v) && v.every((x) => typeof x === "string");
@@ -753,6 +806,16 @@ function withLegacyTips(custom) {
753
806
  }
754
807
  return { ...custom, tips: { ...moved, ...isObject(custom.tips) ? custom.tips : {} } };
755
808
  }
809
+ var REMOVED_LABELS = Object.freeze({ layout: "zonesTitle", showLayout: "zonesTitle", options: "tableSettings", chartDisplay: "chartSettings" });
810
+ function removedLabels(custom) {
811
+ if (!isObject(custom)) {
812
+ return [];
813
+ }
814
+ return Object.keys(
815
+ /** @type {object} */
816
+ custom
817
+ ).filter((k) => Object.hasOwn(REMOVED_LABELS, k)).map((k) => [k, REMOVED_LABELS[k]]);
818
+ }
756
819
  function resolveLabels(locale, custom) {
757
820
  const lang = typeof locale === "string" ? locale.toLowerCase().split(/[-_]/)[0] : "en";
758
821
  const base = Object.hasOwn(LABELS, lang) ? LABELS[lang] : en;
@@ -770,7 +833,9 @@ export {
770
833
  hostFailure,
771
834
  fill,
772
835
  plural,
836
+ rowCount,
773
837
  MENU_TEXTS,
774
838
  mergeLabels,
839
+ removedLabels,
775
840
  resolveLabels
776
841
  };