pivotkit-react 0.4.0 → 0.6.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 (59) hide show
  1. package/CHANGELOG.md +267 -1
  2. package/README.md +5 -2
  3. package/dist/chunks/{chunk-YITKWZ4L.js → chunk-2RAVX4DO.js} +604 -505
  4. package/dist/chunks/{chunk-ZYEYZSYL.js → chunk-7LERNGUW.js} +36 -2
  5. package/dist/chunks/{chunk-EM23V5GH.js → chunk-E6M57YLL.js} +19 -8
  6. package/dist/chunks/{chunk-RWYHJRQO.js → chunk-JMRTIOX4.js} +17 -7
  7. package/dist/chunks/{chunk-XN55BQ4M.js → chunk-RIOSIYGC.js} +54 -7
  8. package/dist/chunks/{chunk-LEN5RPBM.js → chunk-TR2HROIK.js} +43 -7
  9. package/dist/chunks/chunk-W2KIPREL.js +36 -0
  10. package/dist/chunks/{chunk-6MDAL3IO.js → chunk-XN5HNKJ2.js} +88 -101
  11. package/dist/chunks/{chunk-WB4GKWFQ.js → chunk-YXLANLGL.js} +34 -6
  12. package/dist/chunks/report-run-BZBFOMPF.js +12 -0
  13. package/dist/chunks/{unused-texts-K3VFH65P.js → unused-texts-Y4R67XSN.js} +1 -1
  14. package/dist/chunks/{unused-texts-de-OW4TGIVX.js → unused-texts-de-6YVPTNVS.js} +1 -1
  15. package/dist/echarts.js +38 -156
  16. package/dist/import-ui.js +69 -168
  17. package/dist/index.js +160 -102
  18. package/dist/labels.js +6 -6
  19. package/dist/menu-texts-de.js +1 -1
  20. package/dist/menus.js +778 -277
  21. package/dist/styles.css +207 -93
  22. package/package.json +8 -4
  23. package/types/chart-decorate.d.ts +28 -4
  24. package/types/chart-types.d.ts +2 -4
  25. package/types/echarts.d.ts +1 -1
  26. package/types/export-run.d.ts +42 -4
  27. package/types/field-info.d.ts +3 -10
  28. package/types/filter.d.ts +1 -1
  29. package/types/icons.d.ts +1 -0
  30. package/types/import-host.d.ts +34 -8
  31. package/types/import-labels.d.ts +47 -0
  32. package/types/import-limits.d.ts +6 -0
  33. package/types/import-module.d.ts +1 -1
  34. package/types/import-steps.d.ts +8 -0
  35. package/types/import-ui.d.ts +18 -4
  36. package/types/index.d.ts +76 -17
  37. package/types/labels.d.ts +200 -24
  38. package/types/light-tokens.d.ts +16 -0
  39. package/types/menu-labels.d.ts +43 -14
  40. package/types/menu-ops.d.ts +166 -43
  41. package/types/menu-topics.d.ts +7 -4
  42. package/types/names.d.ts +47 -19
  43. package/types/place.d.ts +24 -0
  44. package/types/print-frame.d.ts +24 -0
  45. package/types/report-run.d.ts +14 -0
  46. package/types/share-actions.d.ts +17 -3
  47. package/types/share.d.ts +13 -17
  48. package/types/sheet-views.d.ts +60 -0
  49. package/types/templates.d.ts +21 -1
  50. package/types/theme.d.ts +2 -16
  51. package/types/tips.d.ts +5 -0
  52. package/types/toolbar-panels.d.ts +9 -6
  53. package/types/unused-texts.d.ts +13 -3
  54. package/types/use-export.d.ts +2 -2
  55. package/types/view-ops.d.ts +65 -6
  56. package/types/view-save.d.ts +10 -6
  57. package/types/view-store.d.ts +21 -11
  58. package/types/chart-layout.d.ts +0 -111
  59. package/types/import-source.d.ts +0 -32
@@ -2,8 +2,9 @@ import {
2
2
  MENU_TEXTS,
3
3
  fill,
4
4
  mergeLabels,
5
+ messageOf,
5
6
  plural
6
- } from "./chunk-6MDAL3IO.js";
7
+ } from "./chunk-XN5HNKJ2.js";
7
8
 
8
9
  // src/import-labels.js
9
10
  var en = {
@@ -42,8 +43,16 @@ var en = {
42
43
  originalShown: "The original data is shown",
43
44
  failed: "{name} could not be loaded: {message}",
44
45
  refused: "{name} was not loaded: {message}",
46
+ // a limit of pivotkit-core the file is over; {key} the limit's key, as the reader names it
47
+ overLimit: "it has more than {max} {what} ({key}): load a smaller extract of it, or a host can raise this limit",
48
+ // the limits a reader stops a file at (archiveEntries and unpackedBytes: pivotkit-xlsx's ZIP checks)
49
+ limitWhat: { rows: "rows", columns: "columns", fileBytes: "bytes", importCells: "values (rows x columns)", archiveEntries: "parts in its ZIP directory", unpackedBytes: "bytes unpacked" },
45
50
  sourceLine: "{name}, only in this browser",
46
51
  sourceSheet: "{name}, sheet \u201C{sheet}\u201D, only in this browser",
52
+ // a saved view made on a workbook's sheet that the workbook loaded now does not have (it loads on the sheet shown)
53
+ sheetMissing: "\u201C{name}\u201D was made for the sheet \u201C{sheet}\u201D, which {file} does not have.",
54
+ // the host refused the sheet a saved view was made on (onDataLoad): the view is not opened
55
+ sheetRefused: "\u201C{name}\u201D was not opened: the sheet \u201C{sheet}\u201D was not loaded.",
47
56
  notes: {
48
57
  ENCODING: "Read as {encoding}.",
49
58
  SEPARATOR: "Values separated by {name}.",
@@ -102,8 +111,12 @@ var de = {
102
111
  originalShown: "Die Originaldaten werden gezeigt",
103
112
  failed: "{name} konnte nicht geladen werden: {message}",
104
113
  refused: "{name} wurde nicht geladen: {message}",
114
+ overLimit: "sie hat mehr als {max} {what} ({key}): eine kleinere Auswahl daraus laden, oder eine Anwendung kann diese Grenze anheben",
115
+ limitWhat: { rows: "Zeilen", columns: "Spalten", fileBytes: "Bytes", importCells: "Werte (Zeilen x Spalten)", archiveEntries: "Teile in ihrem ZIP-Verzeichnis", unpackedBytes: "entpackte Bytes" },
105
116
  sourceLine: "{name}, nur in diesem Browser",
106
117
  sourceSheet: "{name}, Blatt \u201E{sheet}\u201C, nur in diesem Browser",
118
+ sheetMissing: "\u201E{name}\u201C wurde f\xFCr das Blatt \u201E{sheet}\u201C gemacht, das {file} nicht hat.",
119
+ sheetRefused: "\u201E{name}\u201C wurde nicht ge\xF6ffnet: das Blatt \u201E{sheet}\u201C wurde nicht geladen.",
107
120
  notes: {
108
121
  ENCODING: "Gelesen als {encoding}.",
109
122
  SEPARATOR: "Werte getrennt durch {name}.",
@@ -178,10 +191,31 @@ function noteText(note, texts, where) {
178
191
  }
179
192
  return fill(typeof form === "string" ? form : plural(form, Number(p.count) || 0, where), values);
180
193
  }
194
+ function errorText(error, name, texts, where) {
195
+ const e = (
196
+ /** @type {any} */
197
+ error
198
+ );
199
+ const d = e && typeof e === "object" && e.code === "LIMIT_EXCEEDED" && e.details && typeof e.details === "object" ? e.details : null;
200
+ if (d && typeof d.limit === "string" && Object.hasOwn(texts.limitWhat, d.limit) && typeof d.max === "number") {
201
+ return fill(texts.overLimit, { max: d.max.toLocaleString(where.locale), what: (
202
+ /** @type {any} */
203
+ texts.limitWhat[d.limit]
204
+ ), key: `limits.${d.limit}` });
205
+ }
206
+ const text = messageOf(error);
207
+ for (const prefix of [`"${name}": `, `"${name}" `]) {
208
+ if (text.startsWith(prefix)) {
209
+ return text.slice(prefix.length);
210
+ }
211
+ }
212
+ return text;
213
+ }
181
214
 
182
215
  export {
183
216
  en,
184
217
  de,
185
218
  importLabels,
186
- noteText
219
+ noteText,
220
+ errorText
187
221
  };
@@ -50,6 +50,8 @@ var en = {
50
50
  tooMany: "more than {max} entries - only the first {max} are used",
51
51
  tooManyItems: "more than {max} items - only the first {max} are used",
52
52
  itemType: "the item \u201C{value}\u201D does not fit a {type} field - it is left out",
53
+ itemTooLong: "an item is longer than {max} characters - it is left out",
54
+ itemCase: "the data has no item \u201C{value}\u201D, but \u201C{suggestion}\u201D - the filter keeps the item as written",
53
55
  unknownField: "the data has no field \u201C{field}\u201D - {dropped}",
54
56
  // the same, when the line is about that field itself (Rows, Columns, a filter or a sort)
55
57
  unknownFieldHere: "the data has no field of this name - {dropped}",
@@ -76,18 +78,25 @@ var en = {
76
78
  dataBarColor: "the bar colour is not a colour - the default colour is used",
77
79
  unknownFilterType: "the filter type \u201C{value}\u201D is unknown - this filter is left out",
78
80
  filterNoItems: "the filter lists no items - it is left out",
79
- filterLabelOp: "the text condition \u201C{value}\u201D is unknown - this filter is left out",
80
- filterText: "the text condition has no text - this filter is left out",
81
+ filterFieldType: "a filter of the type \u201C{value}\u201D does not work on \u201C{field}\u201D ({type}) - this filter is left out",
82
+ filterTextOp: "the text condition \u201C{value}\u201D is unknown - this filter is left out",
83
+ filterMatch: "the text matching is unknown - case and spaces are ignored",
84
+ filterNot: "\u201Cnot\u201D must be true or false - the filter is not inverted",
85
+ filterBlanks: "what happens to blank items is unknown (\u201C{value}\u201D) - blank items are left out",
86
+ blanksUnspecified: "the filter does not say what happens to blank items - they are left out",
87
+ filterEmpty: "the filter lists no items and keeps no blanks - it keeps nothing",
88
+ filterText: "the text condition has no text, or more than {max} characters - this filter is left out",
81
89
  filterNotNumber: "{agg} gives no number to filter by - this filter is left out",
90
+ filterTies: "the ties \u201C{value}\u201D are unknown (first or all) - the first in the data are kept",
91
+ filterPrecision: "the precision \u201C{value}\u201D is unknown or not for this field (year, quarter, month, day or hour of a date) - days are compared",
82
92
  filterCount: "Top needs a whole number from 1 to {max} - this filter is left out",
83
93
  filterValue: "the condition needs a comparison and a number - this filter is left out",
84
94
  filterValue2: "\u201C{value}\u201D needs a second number - this filter is left out",
85
- filterCompareField: "only numbers and dates can be compared - this filter is left out",
86
95
  filterCompareValue: "the comparison needs an operator and a number or a date (2022-03-01) that fits the field - this filter is left out",
87
- filterRelativeField: "a range like \u201Clast 5 years\u201D needs a date field - this filter is left out",
88
- filterRelativeUnit: "the unit \u201C{value}\u201D is unknown (years, months or days) - this filter is left out",
96
+ filterRelativeDirection: "the direction \u201C{value}\u201D is unknown (last, next, this or before) - this filter is left out",
97
+ filterRelativeUnit: "the unit \u201C{value}\u201D is unknown (hours, days, weeks, months, quarters or years) - this filter is left out",
89
98
  filterRelativeCount: "the range needs a whole number from 1 to {max} - this filter is left out",
90
- filterRelativeAnchor: "the range can count back from \u201Ctoday\u201D or from \u201Clatest\u201D (the latest record), not from \u201C{value}\u201D - this filter is left out",
99
+ filterRelativeAnchor: "the range can count from \u201Ctoday\u201D, \u201Clatest\u201D (the latest record), \u201Cfirst\u201D (the first record) or a date, not from \u201C{value}\u201D - this filter is left out",
91
100
  sortNoItems: "the custom order lists no items - the usual order is used",
92
101
  sortedTwice: "the field is sorted twice - only its first sort is used",
93
102
  badTotals: "the totals cannot be read - the usual totals are shown",
@@ -96,7 +105,8 @@ var en = {
96
105
  badTitle: "the title is empty or longer than {max} characters - the chart has no title",
97
106
  unknownLocale: "the language \u201C{value}\u201D is unknown - the report's language is used",
98
107
  unknownTimeZone: "the time zone \u201C{value}\u201D is unknown - the data's time zone is used",
99
- timeZoneMismatch: "the view was made for the time zone {value}, the data is in {zone} - times are read in {zone}"
108
+ timeZoneMismatch: "the view was made for the time zone {value}, the data is in {zone} - times are read in {zone}",
109
+ tooManyIssues: "{value} more problems are not listed - fix the ones above and load the view again to see them"
100
110
  },
101
111
  // a problem this version has no text for (a newer pivotkit-core)
102
112
  other: "this part could not be used - it is left out"
@@ -119,7 +129,7 @@ function valueName(entry, ctx) {
119
129
  }
120
130
  function subjectOf(issue, raw, texts, ctx) {
121
131
  if (issue.code === "unknownKey") {
122
- return ctx.fill(texts.quote, { key: issue.path });
132
+ return ctx.fill(texts.quote, { key: issue.path.split(".").pop() ?? issue.path });
123
133
  }
124
134
  const m = ENTRY.exec(issue.path);
125
135
  if (m) {
@@ -153,6 +163,7 @@ function unusedItem(issue, raw, texts, ctx) {
153
163
  type: typeof params.type === "string" ? own(labels.types, params.type) ?? params.type : "",
154
164
  max: typeof params.max === "number" ? params.max.toLocaleString(labels.lang) : "",
155
165
  zone: params.zone ?? "",
166
+ suggestion: params.suggestion ?? "",
156
167
  message: issue.message
157
168
  };
158
169
  const [before, after = ""] = texts.item.split("{subject}");
@@ -44,6 +44,8 @@ var de = {
44
44
  tooMany: "mehr als {max} Eintr\xE4ge - nur die ersten {max} werden verwendet",
45
45
  tooManyItems: "mehr als {max} Eintr\xE4ge - nur die ersten {max} werden verwendet",
46
46
  itemType: "der Eintrag \u201E{value}\u201C passt nicht zu einem Feld vom Typ {type} - er wird weggelassen",
47
+ itemTooLong: "ein Eintrag ist l\xE4nger als {max} Zeichen - er wird weggelassen",
48
+ itemCase: "die Daten haben keinen Eintrag \u201E{value}\u201C, aber \u201E{suggestion}\u201C - der Filter beh\xE4lt den Eintrag, wie er geschrieben ist",
47
49
  unknownField: "die Daten haben kein Feld \u201E{field}\u201C - {dropped}",
48
50
  unknownFieldHere: "die Daten haben kein Feld mit diesem Namen - {dropped}",
49
51
  placedTwice: "das Feld steht zweimal in Zeilen oder Spalten - nur sein erster Platz gilt",
@@ -69,18 +71,25 @@ var de = {
69
71
  dataBarColor: "die Balkenfarbe ist keine Farbe - die Standardfarbe wird verwendet",
70
72
  unknownFilterType: "die Filterart \u201E{value}\u201C ist unbekannt - dieser Filter wird weggelassen",
71
73
  filterNoItems: "der Filter nennt keine Eintr\xE4ge - er wird weggelassen",
72
- filterLabelOp: "die Textbedingung \u201E{value}\u201C ist unbekannt - dieser Filter wird weggelassen",
73
- filterText: "die Textbedingung hat keinen Text - dieser Filter wird weggelassen",
74
+ filterFieldType: "ein Filter vom Typ \u201E{value}\u201C funktioniert nicht mit \u201E{field}\u201C ({type}) - dieser Filter wird weggelassen",
75
+ filterTextOp: "die Textbedingung \u201E{value}\u201C ist unbekannt - dieser Filter wird weggelassen",
76
+ filterMatch: "der Textvergleich ist unbekannt - Gro\xDF- und Kleinschreibung und Leerzeichen z\xE4hlen nicht",
77
+ filterNot: "\u201Enot\u201C muss true oder false sein - der Filter wird nicht umgekehrt",
78
+ filterBlanks: "was mit leeren Eintr\xE4gen geschieht, ist unbekannt (\u201E{value}\u201C) - leere Eintr\xE4ge werden weggelassen",
79
+ blanksUnspecified: "der Filter sagt nicht, was mit leeren Eintr\xE4gen geschieht - sie werden weggelassen",
80
+ filterEmpty: "der Filter nennt keine Eintr\xE4ge und beh\xE4lt keine leeren - er beh\xE4lt nichts",
81
+ filterText: "die Textbedingung hat keinen Text oder mehr als {max} Zeichen - dieser Filter wird weggelassen",
74
82
  filterNotNumber: "{agg} ergibt keine Zahl zum Filtern - dieser Filter wird weggelassen",
83
+ filterTies: "die Gleichst\xE4nde \u201E{value}\u201C sind unbekannt (first oder all) - die ersten in den Daten werden behalten",
84
+ filterPrecision: "die Genauigkeit \u201E{value}\u201C ist unbekannt oder passt nicht zum Feld (Jahr, Quartal, Monat, Tag oder Stunde eines Datums) - Tage werden verglichen",
75
85
  filterCount: "\u201EOberste\u201C braucht eine ganze Zahl von 1 bis {max} - dieser Filter wird weggelassen",
76
86
  filterValue: "die Bedingung braucht einen Vergleich und eine Zahl - dieser Filter wird weggelassen",
77
87
  filterValue2: "\u201E{value}\u201C braucht eine zweite Zahl - dieser Filter wird weggelassen",
78
- filterCompareField: "nur Zahlen und Daten lassen sich vergleichen - dieser Filter wird weggelassen",
79
88
  filterCompareValue: "der Vergleich braucht einen Operator und eine Zahl oder ein Datum (2022-03-01), das zum Feld passt - dieser Filter wird weggelassen",
80
- filterRelativeField: "ein Zeitraum wie \u201Eletzte 5 Jahre\u201C braucht ein Datumsfeld - dieser Filter wird weggelassen",
81
- filterRelativeUnit: "die Einheit \u201E{value}\u201C ist unbekannt (Jahre, Monate oder Tage) - dieser Filter wird weggelassen",
89
+ filterRelativeDirection: "die Richtung \u201E{value}\u201C ist unbekannt (last, next, this oder before) - dieser Filter wird weggelassen",
90
+ filterRelativeUnit: "die Einheit \u201E{value}\u201C ist unbekannt (Stunden, Tage, Wochen, Monate, Quartale oder Jahre) - dieser Filter wird weggelassen",
82
91
  filterRelativeCount: "der Zeitraum braucht eine ganze Zahl von 1 bis {max} - dieser Filter wird weggelassen",
83
- filterRelativeAnchor: "der Zeitraum kann ab \u201Etoday\u201C (heute) oder \u201Elatest\u201C (dem letzten Datensatz) zur\xFCckz\xE4hlen, nicht ab \u201E{value}\u201C - dieser Filter wird weggelassen",
92
+ filterRelativeAnchor: "der Zeitraum kann ab \u201Etoday\u201C (heute), \u201Elatest\u201C (letzter Eintrag), \u201Efirst\u201C (erster Eintrag) oder einem Datum z\xE4hlen, nicht ab \u201E{value}\u201C - dieser Filter wird weggelassen",
84
93
  sortNoItems: "die eigene Reihenfolge nennt keine Eintr\xE4ge - die \xFCbliche Reihenfolge gilt",
85
94
  sortedTwice: "das Feld wird zweimal sortiert - nur seine erste Sortierung gilt",
86
95
  badTotals: "die Summen lassen sich nicht lesen - die \xFCblichen Summen werden gezeigt",
@@ -89,7 +98,8 @@ var de = {
89
98
  badTitle: "der Titel ist leer oder l\xE4nger als {max} Zeichen - das Diagramm hat keinen Titel",
90
99
  unknownLocale: "die Sprache \u201E{value}\u201C ist unbekannt - die Sprache des Berichts gilt",
91
100
  unknownTimeZone: "die Zeitzone \u201E{value}\u201C ist unbekannt - die Zeitzone der Daten gilt",
92
- timeZoneMismatch: "die Ansicht wurde f\xFCr die Zeitzone {value} gemacht, die Daten sind in {zone} - Zeiten gelten in {zone}"
101
+ timeZoneMismatch: "die Ansicht wurde f\xFCr die Zeitzone {value} gemacht, die Daten sind in {zone} - Zeiten gelten in {zone}",
102
+ tooManyIssues: "{value} weitere Probleme sind nicht aufgef\xFChrt - beheben Sie die obigen und laden Sie die Ansicht erneut, um sie zu sehen"
93
103
  },
94
104
  other: "dieser Teil konnte nicht verwendet werden - er wird weggelassen"
95
105
  };
@@ -204,6 +204,7 @@ var PATHS = {
204
204
  warn: "M12 4 2.8 20h18.4ZM12 10v4.5M12 17.5h.01",
205
205
  image: "M4 5h16v14H4zM4 16l5-5 4 4 3-3 4 4M15 9h.01",
206
206
  file: "M6 3h8l4 4v14H6zM14 3v4h4",
207
+ print: "M7 9V3h10v6M7 17H5a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-2M7 14h10v7H7z",
207
208
  newFile: "M6 3h8l4 4v14H6zM14 3v4h4M12 11v6M9 14h6",
208
209
  swap: "M7 4 3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",
209
210
  top: "M4 20v-6h5v6M9 20V8h6v12M15 20v-9h5v9M3 20h18",
@@ -270,6 +271,35 @@ function keepPlace(last, next, anchor, size, viewport) {
270
271
  function fromOrigin(place, origin) {
271
272
  return { ...place, top: place.top - origin.top, left: place.left - origin.left };
272
273
  }
274
+ function onTheWay(anchor, popover, point) {
275
+ if (!point) {
276
+ return false;
277
+ }
278
+ const corners = [anchor, popover].flatMap((r) => [
279
+ [r.left, r.top],
280
+ [r.right, r.top],
281
+ [r.right, r.bottom],
282
+ [r.left, r.bottom]
283
+ ]).sort((a, b) => a[0] - b[0] || a[1] - b[1]);
284
+ const cross = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
285
+ const half = (points) => {
286
+ const out = [];
287
+ for (const p2 of points) {
288
+ while (out.length >= 2 && cross(out[out.length - 2], out[out.length - 1], p2) <= 0) {
289
+ out.pop();
290
+ }
291
+ out.push(p2);
292
+ }
293
+ out.pop();
294
+ return out;
295
+ };
296
+ const hull = [...half(corners), ...half([...corners].reverse())];
297
+ if (hull.length < 3) {
298
+ return false;
299
+ }
300
+ const p = [point.x, point.y];
301
+ return hull.every((a, k) => cross(a, hull[(k + 1) % hull.length], p) >= 0);
302
+ }
273
303
 
274
304
  // src/popover.jsx
275
305
  var LayerContext = createContext2({ layer: (
@@ -341,7 +371,7 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
341
371
  /** @type {HTMLDivElement | null} */
342
372
  null
343
373
  );
344
- const [top] = useState(() => !passive && hasTopLayer());
374
+ const [top] = useState(() => hasTopLayer() && (!passive || Boolean(anchor.current?.closest?.(".pk-popover")?.hasAttribute("popover"))));
345
375
  const inTopLayer = (
346
376
  /** @type {any} */
347
377
  top ? { popover: "manual" } : {}
@@ -373,9 +403,23 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
373
403
  if (ro && el) {
374
404
  ro.observe(el);
375
405
  }
406
+ let frame = 0;
407
+ let rect = anchor.current?.getBoundingClientRect();
408
+ const follow = () => {
409
+ const next = anchor.current?.getBoundingClientRect();
410
+ if (next && rect && (next.x !== rect.x || next.y !== rect.y || next.width !== rect.width || next.height !== rect.height)) {
411
+ place();
412
+ }
413
+ rect = next;
414
+ frame = requestAnimationFrame(follow);
415
+ };
416
+ if (!sheet) {
417
+ frame = requestAnimationFrame(follow);
418
+ }
376
419
  window.addEventListener("resize", place);
377
420
  window.addEventListener("scroll", place, true);
378
421
  return () => {
422
+ cancelAnimationFrame(frame);
379
423
  ro?.disconnect();
380
424
  window.removeEventListener("resize", place);
381
425
  window.removeEventListener("scroll", place, true);
@@ -391,12 +435,14 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
391
435
  return void 0;
392
436
  }
393
437
  const el = ref.current;
394
- const shown = (o) => o.getClientRects().length > 0;
395
- const first = el?.querySelector("[data-autofocus]") ?? [...el?.querySelectorAll(OPTION) ?? []].find(shown) ?? [...el?.querySelectorAll(FOCUSABLE) ?? []].find((o) => shown(o) && !o.classList.contains("pk-info")) ?? (el?.querySelector("[data-pk-option]") ? el : null);
396
- const t = requestAnimationFrame(() => (
397
- /** @type {HTMLElement | null} */
398
- first?.focus({ preventScroll: true })
399
- ));
438
+ const t = requestAnimationFrame(() => {
439
+ if (!el?.isConnected) return;
440
+ const now = activeIn(el);
441
+ if (now && now !== el && (el.contains(now) || now.closest(".pk-popover")?.getAttribute("data-pk-parent") === elId)) return;
442
+ const shown = (o) => o.getClientRects().length > 0;
443
+ const first = el.querySelector("[data-autofocus]") ?? [...el.querySelectorAll(OPTION)].find(shown) ?? [...el.querySelectorAll(FOCUSABLE)].find((o) => shown(o) && !o.classList.contains("pk-info")) ?? (el.querySelector("[data-pk-option]") ? el : null);
444
+ first?.focus({ preventScroll: true });
445
+ });
400
446
  const onDown = (e) => {
401
447
  if (!eventWithin(e, [el, anchor.current]) && !e.composedPath().some((n) => n instanceof Element && n !== el && n.getAttribute("data-pk-parent") === elId)) {
402
448
  closeRef.current();
@@ -607,6 +653,7 @@ export {
607
653
  Icon,
608
654
  TYPE_ICON,
609
655
  ZONE_ICON,
656
+ onTheWay,
610
657
  useIsoLayoutEffect,
611
658
  LayerContext,
612
659
  hasTopLayer,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MENU_TEXTS,
3
3
  mergeLabels
4
- } from "./chunk-6MDAL3IO.js";
4
+ } from "./chunk-XN5HNKJ2.js";
5
5
 
6
6
  // src/menu-labels.js
7
7
  var en = {
@@ -10,12 +10,16 @@ var en = {
10
10
  settingInfo: {
11
11
  grandTotalRow: "A last row with the total of every column.",
12
12
  grandTotalColumn: "A last column with the total of every row.",
13
- rowSubtotals: "With two or more fields in Rows: a total row under each group of the outer field.",
14
- colSubtotals: "With two or more fields in Columns: a total column after each group of the outer field.",
13
+ rowSubtotals: "With two or more fields in Rows: a subtotal row (\u201CNorth Total\u201D) under each group of the outer field that has more than one item.",
14
+ colSubtotals: "With two or more fields in Columns: a subtotal column (\u201CNorth Total\u201D) after each group of the outer field that has more than one item.",
15
15
  along: "The direction the calculation walks: Rows goes down the rows of each column, Columns across the columns of each row. A running total adds up along it, a difference compares with the item before it.",
16
16
  showAs: "Shows each value as a share, a difference, a running total or a rank instead of the number itself. For percentages, a tip above the result says what 100% is.",
17
17
  exportXlsx: "Every number with all its decimals, formats kept, ready to calculate with.",
18
- exportCsv: "Percentages and calculations as the table shows them, as plain text.",
18
+ exportCsv: "The table as it is shown, with its totals and its percentages, as plain text. Not the rows behind it: that is Source data, below.",
19
+ exportHtml: "A page with the table as it is shown, the chart when the chart is shown, and the filters: opens in any browser, prints well.",
20
+ exportPrint: "The same report in the browser's print dialog: print it, or pick Save as PDF there.",
21
+ exportDataCsv: "All the original rows behind the report, before grouping, filters and totals, with every field. For your own analysis, or to build this report again elsewhere with its view (Views \u2192 Download view). Excel set to a comma decimal: open it with Data \u2192 From Text/CSV.",
22
+ exportDataJson: "The same rows as JSON, for a program: numbers as numbers, text as text, a blank as null.",
19
23
  copyTable: "The table as it is shown, headers and totals included: tab-separated, pastes into Excel or Google Sheets as columns.",
20
24
  copyDataJson: "The table's numbers with their labels as JSON, for a program. Not the view itself: that is Views \u2192 Copy view as JSON.",
21
25
  drillCopy: "The rows as the panel shows them, with a header row: tab-separated, pastes into Excel or Google Sheets as columns.",
@@ -95,13 +99,27 @@ var en = {
95
99
  // the Filter level of a date field: its quick choices ("Last [5] years" around the number typed),
96
100
  // each with the data's share and the rows it keeps, the ones not offered, the reference date
97
101
  quickTitle: "Quick choices",
98
- quickCount: { year: "Number of years", month: "Number of months", day: "Number of days" },
99
- quickLast: { year: { one: "Last {count} year", other: "Last {count} years" }, month: { one: "Last {count} month", other: "Last {count} months" }, day: { one: "Last {count} day", other: "Last {count} days" } },
102
+ quickCount: { year: "Number of years", quarter: "Number of quarters", month: "Number of months", week: "Number of weeks", day: "Number of days" },
100
103
  quickRows: "{rows} rows",
101
104
  quickHidden: { one: "{choices} is not offered: the data end {latest}.", other: "{choices} are not offered: the data end {latest}." },
105
+ // under the choice that is set: whether its periods take the current one ("Last 3 months" with November)
106
+ quickCurrent: { year: "Include the current year", quarter: "Include the current quarter", month: "Include the current month", week: "Include the current week", day: "Include today" },
107
+ // the rare choices, folded: Next N, Before the last N, rolling periods
108
+ quickMore: "More choices",
109
+ quickRolling: "Rolling instead of whole calendar periods",
110
+ // the names of the unit selects, after their choice: "Unit of “Last …”"; This's select picks the period
111
+ quickUnitOf: "Unit of \u201C{choice} \u2026\u201D",
112
+ quickThisUnit: "Current period",
102
113
  anchorLabel: "Counted back from",
103
114
  anchorToday: "today ({date})",
104
115
  anchorLatest: "the latest record ({date})",
116
+ anchorFirst: "the first record ({date})",
117
+ anchorDate: "a date\u2026",
118
+ anchorDay: "The date counted from",
119
+ // the date field without a whole date: the range keeps the one before
120
+ anchorDayIncomplete: "Enter a whole date; the ranges still count from {date}.",
121
+ // under a choice whose current period has no data (the data end before it)
122
+ anchorUseLatest: "Count back from the latest record ({date}) instead",
105
123
  quickLine: "Quick choice: {text}",
106
124
  changeAbove: "change it above",
107
125
  // a cyclic grouping ("month of the year") combines the years: the ones ticked
@@ -158,7 +176,10 @@ var en = {
158
176
  ruleUnits: { year: { one: "year", other: "years" }, month: { one: "month", other: "months" }, day: { one: "day", other: "days" } },
159
177
  // a rule on the total, as a sentence: "Product items whose / Count of Cycle / is greater than / 3"
160
178
  ruleWhose: "{field} items whose total",
179
+ ruleFixed: "Kept as the view has it; the rules here cannot change it yet.",
161
180
  blanksOut: "Blank items are not kept.",
181
+ // under the rules on the items: the field's blank items kept with them
182
+ rulesBlanks: { one: "Also keep items without a value ({rows} row)", other: "Also keep items without a value ({rows} rows)" },
162
183
  ruleUnit: "Unit",
163
184
  moveLeft: "Move left",
164
185
  moveRight: "Move right",
@@ -180,6 +201,8 @@ var en = {
180
201
  storeTooLarge: "the views would take more than {max} characters",
181
202
  storeRefused: "this browser did not keep it (storage blocked or full)",
182
203
  storeChanged: "the views were changed in another tab; open the menu again",
204
+ // next to a saved view made on a workbook's sheet, while a workbook is shown
205
+ viewSheet: "Sheet \u201C{sheet}\u201D",
183
206
  // what a save, a delete or a publish in the Views menu came to; "Rejected": the host refused
184
207
  // without saying why (a rejected promise without a message)
185
208
  toastSaved: "View \u201C{name}\u201D saved",
@@ -276,6 +299,10 @@ var en = {
276
299
  topCount: "Count",
277
300
  bottom: "Bottom",
278
301
  topBy: "by",
302
+ topTies: "Also show items with the same value as the last one",
303
+ // under it: how many items the top shows (the field first on its axis), else that a group can show more
304
+ topShown: { one: "{count} item shown", other: "{count} items shown" },
305
+ topTiesGroups: "A group can show more than {count} items.",
279
306
  searchValues: "Search values",
280
307
  selectAll: "Select all",
281
308
  selectNone: "Select none",
@@ -289,15 +316,23 @@ var en = {
289
316
  exportDownload: "Download",
290
317
  exportCopy: "Copy",
291
318
  exportXlsx: "Excel workbook (.xlsx)",
292
- exportCsv: "CSV file (.csv)",
319
+ exportCsv: "Table as CSV (.csv)",
293
320
  exportPng: "Chart image (.png)",
321
+ exportSvg: "Chart image (.svg)",
322
+ exportHtml: "HTML report (.html)",
323
+ exportPrintGroup: "Print",
324
+ exportPrint: "Print or save as PDF\u2026",
294
325
  exportPngNeedsChart: "Switch to Chart first.",
295
326
  exportNeedsField: "Add a field first.",
327
+ exportDataGroup: "Source data",
328
+ exportDataCsv: "All rows as CSV (.csv)",
329
+ exportDataJson: "All rows as JSON (.json)",
296
330
  copyTable: "Copy table",
297
331
  copyDataJson: "Copy data as JSON",
298
332
  toastTableCopied: "Table copied: tab-separated, pastes into Excel or Google Sheets as columns",
299
333
  toastDataCopied: "Data copied as JSON",
300
334
  toastCopyBlocked: "This page does not allow copying. Download a file instead.",
335
+ toastPrintBlocked: "This page does not allow printing the report. Download the HTML report instead.",
301
336
  // drill-down
302
337
  drillTitle: "Rows behind this value",
303
338
  drillCount: { one: "{count} row", other: "{count} rows" },
@@ -385,6 +420,7 @@ var en = {
385
420
  needsColField: "Needs a field in Columns.",
386
421
  needsRowFields: "Needs two or more fields in Rows.",
387
422
  needsColFields: "Needs two or more fields in Columns.",
423
+ needsValue: "Needs a field in Values.",
388
424
  expandNothing: "Nothing is collapsed.",
389
425
  collapseNeedsRows: "Needs two or more fields in Rows.",
390
426
  collapseAllDone: "Every group is collapsed already.",
@@ -0,0 +1,36 @@
1
+ // src/sheet-views.js
2
+ var FILE_ID = /^([^]*)#[0-9a-f]{16}$/;
3
+ function fileOfId(id) {
4
+ const m = typeof id === "string" ? FILE_ID.exec(id) : null;
5
+ return m ? m[1] : null;
6
+ }
7
+ function sheetOfSource(source) {
8
+ const sheet = source && typeof source === "object" ? (
9
+ /** @type {any} */
10
+ source.params?.sheet
11
+ ) : void 0;
12
+ return typeof sheet === "string" && sheet ? sheet : null;
13
+ }
14
+ function listedFor(entry, shown) {
15
+ if (!entry.sourceId || !shown.id || entry.sourceId === shown.id) {
16
+ return true;
17
+ }
18
+ return Boolean(entry.sheet && shown.sheet && fileOfId(entry.sourceId) !== null && fileOfId(entry.sourceId) === fileOfId(shown.id));
19
+ }
20
+ function sheetPlan(view, shown) {
21
+ const sheet = view.sheet;
22
+ if (!sheet || !shown.sheet || sheet === shown.sheet) {
23
+ return { kind: "none" };
24
+ }
25
+ const file = fileOfId(view.id);
26
+ if (file === null || file !== fileOfId(shown.id)) {
27
+ return { kind: "none" };
28
+ }
29
+ return { kind: shown.sheets.includes(sheet) ? "switch" : "missing", sheet };
30
+ }
31
+
32
+ export {
33
+ sheetOfSource,
34
+ listedFor,
35
+ sheetPlan
36
+ };