pivotkit-react 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,73 @@ All notable changes to `pivotkit-react` are documented in this file. The format
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.6.1] - 2026-11-14
10
+
11
+ ### Added
12
+
13
+ - `exportData={{ columns: [...] }}`: Source data and the drill-down's copies and files hold only
14
+ those columns, in that order (matched case-insensitively, derived fields never). A name the data
15
+ lacks is left out and said once in the console; with no column left, or `columns` that is no list
16
+ (said once too), Source data and the drill-down's Export menu are off; an `exportData` of another
17
+ shape is off, as `false` ([#259](https://github.com/eizedev/pivotkit/issues/259)).
18
+
19
+ ### Changed
20
+
21
+ - Source data as CSV is built in pieces of whole lines (pivotkit-core's `dataToCsvParts`), so the
22
+ browser holds about twice the file's size while it is made, not about five times
23
+ ([#260](https://github.com/eizedev/pivotkit/issues/260)).
24
+
25
+ ### Fixed
26
+
27
+ - Filter level: Years combined (its year buttons, "The table shows … only" and the summary) writes a
28
+ year before 1 AD as the table does ("5 BC", not "-4"); the reference date's field shows and takes a
29
+ day after 9999 ("+010000-01-01" was cut off and could not be typed), and whether a quick choice
30
+ reaches the data compares days, not their text, for years with a sign
31
+ ([#351](https://github.com/eizedev/pivotkit/issues/351)).
32
+ - An open menu no longer moves when its own content is scrolled: a click on a control reached by
33
+ scrolling (Rolling under More choices of a date's quick choices) could land beside it when the
34
+ menu was placed again between the press and the release. A menu whose content grew while it was
35
+ already as tall as its room is placed again in the next frame instead
36
+ ([#222](https://github.com/eizedev/pivotkit/issues/222)).
37
+ - A workbook whose shared strings and formats reach `limits.importCells` is said as "more than …
38
+ different texts and formats" (`labels.dataImport.workbookCells`), chosen by the reader's
39
+ `details.what`, not as "values (rows x columns)", which stays for a table's own extent
40
+ ([#325](https://github.com/eizedev/pivotkit/issues/325)).
41
+ - Filter level: a rule's × clicked while its value still waits to apply (a moment after typing)
42
+ takes the rule away; before, the field's blur applied the value and the click was lost. What waits
43
+ in a removed row applies nothing ([#320](https://github.com/eizedev/pivotkit/issues/320)).
44
+ - Filter level: emptying the value of a rule on the item or on its total takes the rule off, as
45
+ emptying the text of a rule on the name does; its row stays, says "Applies once it is complete."
46
+ and applies again with the next value, in its place among the rules. Before, the field looked empty
47
+ while the previous rule kept filtering ([#244](https://github.com/eizedev/pivotkit/issues/244)).
48
+ - Filter level: a rule added while the text or number of a new rule still waits to apply is a row of
49
+ its own; the comparison and the value chosen next no longer change the first rule. The add buttons
50
+ keep the focus in the field until the click, and a new row not yet complete stays in its place when
51
+ another one is added ([#245](https://github.com/eizedev/pivotkit/issues/245)).
52
+ - Filter level: a click on a date's quick choice (All, This, Last, …) focuses it in Safari too, as
53
+ Top items' choices do; both use one radio button that takes the focus on a click
54
+ ([#203](https://github.com/eizedev/pivotkit/issues/203)).
55
+ - A saved view that reads another sheet of the loaded workbook no longer loads that sheet unseen when
56
+ the reader has notes on it (a used range, values not read, columns renamed): the preview stays
57
+ open with the notes and a line naming the view that needs the sheet, and **Load data** loads the
58
+ sheet and opens the view. Another sheet picked in that preview does not load by itself, and loaded
59
+ it does not open the view; a note says so
60
+ ([#274](https://github.com/eizedev/pivotkit/issues/274)). Browser tests cover Cancel, a host's
61
+ refusal, another file dropped during the read and a sheet without rows
62
+ ([#277](https://github.com/eizedev/pivotkit/issues/277)).
63
+ - A controlled report whose host does not pass its views back (it rejects or ignores
64
+ `onViewChange`) keeps at most 100 of the views it told the host waiting, the newest ones, instead
65
+ of one more with every change ([#204](https://github.com/eizedev/pivotkit/issues/204)).
66
+ - The dashed rule between the parts of a menu's group (the chart's Display: Value labels, Legend,
67
+ Title) uses `--pk-rule`, 3:1 against the menu as the rule between groups, instead of `--pk-border`
68
+ (about 1.3:1) ([#205](https://github.com/eizedev/pivotkit/issues/205)).
69
+ - The filter's texts and Years combined read and write years before 0 and after 9999 (signed ISO
70
+ days), compare such days in time order, and write years before 1 AD as the table does ("2 BC");
71
+ Years combined keeps the first and last year a `Date` holds as far as it holds
72
+ ([#349](https://github.com/eizedev/pivotkit/issues/349)).
73
+ - The import UI takes a plugin's table as pivotkit-core's `readFile` completes it; its own
74
+ `completeTable` is gone ([#130](https://github.com/eizedev/pivotkit/issues/130)).
75
+
9
76
  ## [0.6.0] - 2026-11-14
10
77
 
11
78
  ### Upgrading from 0.5
@@ -982,7 +1049,8 @@ First release.
982
1049
  weather (Open-Meteo), countries (World Bank), earthquakes (USGS), Nobel laureates and the release
983
1050
  cycles of software products (endoflife.date).
984
1051
 
985
- [Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.6.0...HEAD
1052
+ [Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.6.1...HEAD
1053
+ [0.6.1]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.6.0...pivotkit-react@0.6.1
986
1054
  [0.6.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.5.0...pivotkit-react@0.6.0
987
1055
  [0.5.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.4.0...pivotkit-react@0.5.0
988
1056
  [0.4.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.3.0...pivotkit-react@0.4.0
@@ -3,7 +3,7 @@ import {
3
3
  Popover,
4
4
  onTheWay,
5
5
  useFormName
6
- } from "./chunk-RIOSIYGC.js";
6
+ } from "./chunk-JOWAEZAD.js";
7
7
  import {
8
8
  fill,
9
9
  plural
@@ -435,7 +435,7 @@ function isEmptyView(view) {
435
435
  }
436
436
 
437
437
  // src/names.js
438
- import { fieldLabel, relativeDateRange } from "pivotkit-core";
438
+ import { MAX_DATE_MS, fieldLabel, formatter, relativeDateRange } from "pivotkit-core";
439
439
  var withNot = (f, text, labels) => hiddenNot(f) ? fill(labels.notRule, { rule: text }) : text;
440
440
  function valueLabel(spec, labels) {
441
441
  if (spec.label) {
@@ -485,9 +485,25 @@ function valueConditionText(view, f, labels, locale) {
485
485
  }
486
486
  return withNot(f, fill(labels.valueConditions.compare, { value, op: Object.hasOwn(OP_SIGNS, op) ? OP_SIGNS[op] : op, number: number(f.value) }), labels);
487
487
  }
488
- var dayText = (iso, locale) => (/* @__PURE__ */ new Date(`${iso}T00:00Z`)).toLocaleDateString(locale, { dateStyle: "medium", timeZone: "UTC" });
489
- var isoDay = (ms) => new Date(ms).toISOString().slice(0, 10);
490
- var dayAfter = (iso, n = 1) => isoDay(Date.parse(`${iso}T00:00Z`) + n * 864e5);
488
+ var dayPart = (iso) => iso.split("T")[0];
489
+ var dayMs = (iso) => Date.parse(`${dayPart(iso)}T00:00Z`);
490
+ var yearOf = (iso) => Number(iso.slice(0, iso.indexOf("-", 1)));
491
+ var monthOf = (iso) => Number(dayPart(iso).slice(-5, -3));
492
+ var isoYear = (y) => y >= 0 && y <= 9999 ? String(y).padStart(4, "0") : `${y < 0 ? "-" : "+"}${String(Math.abs(y)).padStart(6, "0")}`;
493
+ var midYear = (y) => {
494
+ const d = /* @__PURE__ */ new Date(0);
495
+ d.setUTCFullYear(y, 6, 1);
496
+ return d;
497
+ };
498
+ var yearText = (y, locale) => y >= 1 ? String(y) : midYear(y).toLocaleDateString(locale, { year: "numeric", era: "short", calendar: "gregory", timeZone: "UTC" });
499
+ var monthText = (iso, locale) => {
500
+ const y = yearOf(iso);
501
+ const at = Math.max(dayMs(`${isoYear(y)}-${String(monthOf(iso)).padStart(2, "0")}-01`) || -MAX_DATE_MS, -MAX_DATE_MS);
502
+ return new Date(at).toLocaleDateString(locale, { month: "short", year: "numeric", timeZone: "UTC", ...y < 1 ? { era: "short" } : {} });
503
+ };
504
+ var dayText = (iso, locale) => formatter("date", { locale })(dayMs(iso));
505
+ var isoDay = (ms) => new Date(ms).toISOString().split("T")[0];
506
+ var dayAfter = (iso, n = 1) => isoDay(dayMs(iso) + n * 864e5);
491
507
  function relativeDays(f, timeZone, now, latest, more = {}) {
492
508
  const range = datesOf(f, timeZone, now, latest, more);
493
509
  return range && range.from !== null ? { from: range.from, to: range.to } : null;
@@ -495,61 +511,63 @@ function relativeDays(f, timeZone, now, latest, more = {}) {
495
511
  var datesOf = (f, timeZone, now, latest, more = {}) => relativeDateRange(f.unit, f.count ?? 1, { timeZone, now, anchor: f.anchor, latest: latest ?? void 0, first: more.first ?? void 0, direction: f.direction, calendar: f.calendar, includeCurrent: f.includeCurrent, weekStart: more.weekStart });
496
512
  var plainRange = (f) => ["last", "this"].includes(f.direction ?? "last") && f.calendar !== false && (f.anchor === void 0 || f.anchor === "today" || f.anchor === "latest") && ["year", "quarter", "month", "week", "day"].includes(f.unit);
497
513
  function periodText(range, unit, locale) {
498
- const month = (iso) => (/* @__PURE__ */ new Date(`${iso.slice(0, 10)}T00:00Z`)).toLocaleDateString(locale, { month: "short", year: "numeric", timeZone: "UTC" });
499
- const quarter = (iso) => `Q${Math.floor((Number(iso.slice(5, 7)) - 1) / 3) + 1} ${iso.slice(0, 4)}`;
500
- const text = unit === "year" ? (iso) => iso.slice(0, 4) : unit === "quarter" ? quarter : unit === "month" ? month : (iso) => dayText(iso.slice(0, 10), locale);
514
+ const year = (iso) => yearText(yearOf(iso), locale);
515
+ const quarter = (iso) => `Q${Math.floor((monthOf(iso) - 1) / 3) + 1} ${year(iso)}`;
516
+ const text = unit === "year" ? year : unit === "quarter" ? quarter : unit === "month" ? (iso) => monthText(iso, locale) : (iso) => dayText(dayPart(iso), locale);
501
517
  const [from, to] = [text(range.from), text(range.to)];
502
518
  return from === to ? from : `${from}\u2013${to}`;
503
519
  }
504
520
  function rangeShare(range, unit, span, locale) {
505
521
  const grain = unit === "quarter" ? "month" : unit === "week" ? "day" : unit;
506
- range = { from: range.from.slice(0, 10), to: range.to.slice(0, 10) };
522
+ range = { from: dayPart(range.from), to: dayPart(range.to) };
507
523
  const [first, last] = [periodStart(isoDay(span.min), grain), periodEnd(isoDay(span.max), grain)];
508
- if (first <= range.from && last >= range.to) {
524
+ if (dayMs(first) <= dayMs(range.from) && dayMs(last) >= dayMs(range.to)) {
509
525
  return null;
510
526
  }
511
- const from = range.from > first ? range.from : first;
512
- const to = range.to < last ? range.to : last;
513
- if (from > to) {
527
+ const from = dayMs(range.from) > dayMs(first) ? range.from : first;
528
+ const to = dayMs(range.to) < dayMs(last) ? range.to : last;
529
+ if (dayMs(from) > dayMs(to)) {
514
530
  return { none: true };
515
531
  }
516
532
  const missing = [];
517
533
  let count = 0;
518
534
  const part = (a, b, dataYear) => {
519
535
  const years = [];
520
- const [ya, yb] = [Number(a.slice(0, 4)), Number(b.slice(0, 4))];
536
+ const [ya, yb] = [yearOf(a), yearOf(b)];
521
537
  for (let y = ya; y <= yb; y++) {
522
538
  if (y !== dataYear) {
523
539
  years.push(y);
524
540
  }
525
541
  }
526
542
  if (years.length) {
527
- missing.push(years.length === 1 ? String(years[0]) : `${years[0]}\u2013${years[years.length - 1]}`);
543
+ missing.push(years.length === 1 ? yearText(years[0], locale) : `${yearText(years[0], locale)}\u2013${yearText(years[years.length - 1], locale)}`);
528
544
  count += years.length;
529
545
  }
530
546
  if (ya <= dataYear && dataYear <= yb) {
531
- const yearFrom = `${String(dataYear).padStart(4, "0")}-01-01`;
532
- const yearTo = `${String(dataYear).padStart(4, "0")}-12-31`;
533
- const rest = { from: a > yearFrom ? a : yearFrom, to: b < yearTo ? b : yearTo };
547
+ const yearFrom = `${isoYear(dataYear)}-01-01`;
548
+ const yearTo = `${isoYear(dataYear)}-12-31`;
549
+ const rest = { from: dayMs(a) > dayMs(yearFrom) ? a : yearFrom, to: dayMs(b) < dayMs(yearTo) ? b : yearTo };
534
550
  missing.push(periodText(rest, unit, locale));
535
551
  count += periodText({ from: rest.from, to: rest.from }, unit, locale) === periodText({ from: rest.to, to: rest.to }, unit, locale) ? 1 : 2;
536
552
  }
537
553
  };
538
- if (range.from < first) {
539
- part(range.from, dayAfter(first, -1), Number(first.slice(0, 4)));
554
+ if (dayMs(range.from) < dayMs(first)) {
555
+ part(range.from, dayAfter(first, -1), yearOf(first));
540
556
  }
541
- if (range.to > last) {
542
- part(dayAfter(last), range.to, Number(last.slice(0, 4)));
557
+ if (dayMs(range.to) > dayMs(last)) {
558
+ part(dayAfter(last), range.to, yearOf(last));
543
559
  }
544
560
  return { none: false, data: periodText({ from, to }, unit, locale), missing, count };
545
561
  }
546
- var periodStart = (iso, unit) => unit === "year" ? `${iso.slice(0, 4)}-01-01` : unit === "month" ? `${iso.slice(0, 7)}-01` : iso;
562
+ var periodStart = (iso, unit) => unit === "year" ? `${isoYear(yearOf(iso))}-01-01` : unit === "month" ? `${iso.slice(0, -3)}-01` : iso;
547
563
  function periodEnd(iso, unit) {
548
564
  if (unit === "day") {
549
565
  return iso;
550
566
  }
551
- const [y, m] = [Number(iso.slice(0, 4)), Number(iso.slice(5, 7))];
552
- return isoDay(unit === "year" ? Date.UTC(y, 11, 31) : Date.UTC(y, m, 0));
567
+ const [y, m] = [yearOf(iso), monthOf(iso)];
568
+ const end = /* @__PURE__ */ new Date(0);
569
+ end.setUTCFullYear(y, unit === "year" ? 11 : m, unit === "year" ? 31 : 0);
570
+ return isoDay(Math.min(end.getTime(), MAX_DATE_MS) || MAX_DATE_MS);
553
571
  }
554
572
  function relativeText(f, labels, locale, timeZone, now, span, weekStart) {
555
573
  if (!plainRange(f)) {
@@ -608,26 +626,28 @@ function otherRangeText(f, labels, locale, timeZone, now, span, weekStart) {
608
626
  }
609
627
  function precisionText(iso, precision, locale) {
610
628
  if (precision === "year" || precision === "quarter" || precision === "month") {
611
- const at = /* @__PURE__ */ new Date(`${iso.slice(0, 10)}T00:00Z`);
612
629
  if (precision === "month") {
613
- return at.toLocaleDateString(locale, { month: "short", year: "numeric", timeZone: "UTC" });
630
+ return monthText(iso, locale);
614
631
  }
615
- return precision === "year" ? iso.slice(0, iso.length - 6) : `Q${Math.floor(at.getUTCMonth() / 3) + 1} ${iso.slice(0, iso.length - 6)}`;
632
+ const year = yearText(yearOf(iso), locale);
633
+ return precision === "year" ? year : `Q${Math.floor((monthOf(iso) - 1) / 3) + 1} ${year}`;
616
634
  }
617
635
  return pointText(iso, locale);
618
636
  }
619
- var pointText = (iso, locale) => iso.length > 10 ? (/* @__PURE__ */ new Date(`${iso.slice(0, 16)}Z`)).toLocaleString(locale, { dateStyle: "medium", timeStyle: "short", timeZone: "UTC" }) : dayText(iso, locale);
637
+ var pointText = (iso, locale) => iso.includes("T") ? formatter("datetime", { locale })(Date.parse(`${iso}Z`)) : dayText(iso, locale);
620
638
  function wholeYears(from, to) {
621
- const whole = typeof from === "string" && typeof to === "string" && /^\d{4}-01-01$/.test(from) && /^\d{4}-12-31$/.test(to);
622
- return whole ? [from.slice(0, 4), to.slice(0, 4)] : null;
639
+ const day = /^(?:\d{4}|[+-]\d{6})-\d{2}-\d{2}$/;
640
+ const whole = typeof from === "string" && typeof to === "string" && day.test(from) && day.test(to) && (from.endsWith("-01-01") || from === isoDay(-MAX_DATE_MS)) && (to.endsWith("-12-31") || to === isoDay(MAX_DATE_MS));
641
+ return whole ? [yearOf(from), yearOf(to)] : null;
623
642
  }
624
643
  function compareText(f, labels, locale, { date, labelOf }) {
625
644
  const shown = (v) => typeof v === "string" ? precisionText(v, f.precision, locale) : labelOf?.(v) ?? (date ? String(v) : v.toLocaleString(locale, { maximumFractionDigits: 6 }));
626
645
  const forms = labels.compareShort;
627
646
  const op = ruleOp(f);
628
647
  if (op === "between" || op === "notBetween") {
629
- const [from, to] = f.value2 !== void 0 && f.value2 < f.value ? [f.value2, f.value] : [f.value, f.value2];
630
- const years = wholeYears(from, to);
648
+ const order = (v) => typeof v === "string" ? dayMs(v) : v;
649
+ const [from, to] = f.value2 !== void 0 && order(f.value2) < order(f.value) ? [f.value2, f.value] : [f.value, f.value2];
650
+ const years = wholeYears(from, to)?.map((y) => yearText(y, locale));
631
651
  if (years) {
632
652
  return years[0] === years[1] ? fill(forms[op === "between" ? "=" : "!="], { value: years[0] }) : fill(forms[op], { from: years[0], to: years[1] });
633
653
  }
@@ -1480,6 +1500,10 @@ export {
1480
1500
  refLabel,
1481
1501
  sortText,
1482
1502
  valueConditionText,
1503
+ dayMs,
1504
+ yearOf,
1505
+ isoYear,
1506
+ yearText,
1483
1507
  dayText,
1484
1508
  isoDay,
1485
1509
  relativeDays,
@@ -383,6 +383,7 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
383
383
  return void 0;
384
384
  }
385
385
  let last = null;
386
+ let placedHeight = -1;
386
387
  const place = () => {
387
388
  const el2 = ref.current;
388
389
  const a = anchor.current;
@@ -390,7 +391,7 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
390
391
  return;
391
392
  }
392
393
  const r = a.getBoundingClientRect();
393
- const size2 = { width: el2.offsetWidth, height: el2.scrollHeight };
394
+ const size2 = { width: el2.offsetWidth, height: placedHeight = el2.scrollHeight };
394
395
  const viewport = viewportOf(el2.ownerDocument);
395
396
  const place2 = keepPlace(last, placePopover(r, size2, viewport, align, { fill }), r, size2, viewport);
396
397
  last = { top: place2.top, side: place2.side, anchorTop: r.top };
@@ -407,7 +408,7 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
407
408
  let rect = anchor.current?.getBoundingClientRect();
408
409
  const follow = () => {
409
410
  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
+ if (next && rect && (next.x !== rect.x || next.y !== rect.y || next.width !== rect.width || next.height !== rect.height) || ref.current?.scrollHeight !== placedHeight) {
411
412
  place();
412
413
  }
413
414
  rect = next;
@@ -416,13 +417,14 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
416
417
  if (!sheet) {
417
418
  frame = requestAnimationFrame(follow);
418
419
  }
420
+ const onScroll = (e) => e.target instanceof Node && ref.current?.contains(e.target) || place();
419
421
  window.addEventListener("resize", place);
420
- window.addEventListener("scroll", place, true);
422
+ window.addEventListener("scroll", onScroll, true);
421
423
  return () => {
422
424
  cancelAnimationFrame(frame);
423
425
  ro?.disconnect();
424
426
  window.removeEventListener("resize", place);
425
- window.removeEventListener("scroll", place, true);
427
+ window.removeEventListener("scroll", onScroll, true);
426
428
  };
427
429
  }, [open, anchor, align, sheet, layer, fill]);
428
430
  useEscapeLayer(open, onClose);
@@ -47,12 +47,18 @@ var en = {
47
47
  overLimit: "it has more than {max} {what} ({key}): load a smaller extract of it, or a host can raise this limit",
48
48
  // the limits a reader stops a file at (archiveEntries and unpackedBytes: pivotkit-xlsx's ZIP checks)
49
49
  limitWhat: { rows: "rows", columns: "columns", fileBytes: "bytes", importCells: "values (rows x columns)", archiveEntries: "parts in its ZIP directory", unpackedBytes: "bytes unpacked" },
50
+ // importCells reached by a workbook's shared strings and formats (pivotkit-xlsx's details.what),
51
+ // not by its rows x columns
52
+ workbookCells: "different texts and formats",
50
53
  sourceLine: "{name}, only in this browser",
51
54
  sourceSheet: "{name}, sheet \u201C{sheet}\u201D, only in this browser",
52
55
  // a saved view made on a workbook's sheet that the workbook loaded now does not have (it loads on the sheet shown)
53
56
  sheetMissing: "\u201C{name}\u201D was made for the sheet \u201C{sheet}\u201D, which {file} does not have.",
54
57
  // the host refused the sheet a saved view was made on (onDataLoad): the view is not opened
55
58
  sheetRefused: "\u201C{name}\u201D was not opened: the sheet \u201C{sheet}\u201D was not loaded.",
59
+ // the preview of a sheet a saved view needs: which view and sheet; another sheet loaded there does not open the view
60
+ sheetForView: "Opening \u201C{name}\u201D needs the sheet \u201C{sheet}\u201D.",
61
+ sheetOther: "\u201C{name}\u201D was not opened: it was made for the sheet \u201C{sheet}\u201D.",
56
62
  notes: {
57
63
  ENCODING: "Read as {encoding}.",
58
64
  SEPARATOR: "Values separated by {name}.",
@@ -113,10 +119,13 @@ var de = {
113
119
  refused: "{name} wurde nicht geladen: {message}",
114
120
  overLimit: "sie hat mehr als {max} {what} ({key}): eine kleinere Auswahl daraus laden, oder eine Anwendung kann diese Grenze anheben",
115
121
  limitWhat: { rows: "Zeilen", columns: "Spalten", fileBytes: "Bytes", importCells: "Werte (Zeilen x Spalten)", archiveEntries: "Teile in ihrem ZIP-Verzeichnis", unpackedBytes: "entpackte Bytes" },
122
+ workbookCells: "verschiedene Texte und Formate",
116
123
  sourceLine: "{name}, nur in diesem Browser",
117
124
  sourceSheet: "{name}, Blatt \u201E{sheet}\u201C, nur in diesem Browser",
118
125
  sheetMissing: "\u201E{name}\u201C wurde f\xFCr das Blatt \u201E{sheet}\u201C gemacht, das {file} nicht hat.",
119
126
  sheetRefused: "\u201E{name}\u201C wurde nicht ge\xF6ffnet: das Blatt \u201E{sheet}\u201C wurde nicht geladen.",
127
+ sheetForView: "Zum \xD6ffnen von \u201E{name}\u201C wird das Blatt \u201E{sheet}\u201C gebraucht.",
128
+ sheetOther: "\u201E{name}\u201C wurde nicht ge\xF6ffnet: es wurde f\xFCr das Blatt \u201E{sheet}\u201C gemacht.",
120
129
  notes: {
121
130
  ENCODING: "Gelesen als {encoding}.",
122
131
  SEPARATOR: "Werte getrennt durch {name}.",
@@ -198,10 +207,13 @@ function errorText(error, name, texts, where) {
198
207
  );
199
208
  const d = e && typeof e === "object" && e.code === "LIMIT_EXCEEDED" && e.details && typeof e.details === "object" ? e.details : null;
200
209
  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: (
210
+ const counted = typeof d.what === "string" ? d.what : "";
211
+ const strings = d.limit === "importCells" && /shared strings/i.test(counted);
212
+ const what = strings ? texts.workbookCells : (
202
213
  /** @type {any} */
203
214
  texts.limitWhat[d.limit]
204
- ), key: `limits.${d.limit}` });
215
+ );
216
+ return fill(texts.overLimit, { max: d.max.toLocaleString(where.locale), what, key: `limits.${d.limit}` });
205
217
  }
206
218
  const text = messageOf(error);
207
219
  for (const prefix of [`"${name}": `, `"${name}" `]) {
package/dist/import-ui.js CHANGED
@@ -10,12 +10,12 @@ import {
10
10
  useFormName,
11
11
  useModal,
12
12
  useTopLayer
13
- } from "./chunks/chunk-RIOSIYGC.js";
13
+ } from "./chunks/chunk-JOWAEZAD.js";
14
14
  import {
15
15
  errorText,
16
16
  importLabels,
17
17
  noteText
18
- } from "./chunks/chunk-7LERNGUW.js";
18
+ } from "./chunks/chunk-ZK5RVCHP.js";
19
19
  import {
20
20
  fill,
21
21
  messageOf,
@@ -47,18 +47,6 @@ function acceptOf(plugins) {
47
47
  }
48
48
  var formatsOf = (plugins, names = {}) => [...plugins, ...BUILT_IN_READERS].map((p) => typeof p?.name === "string" && Object.hasOwn(names, p.name) ? names[p.name] : typeof p?.label === "string" ? p.label.trim().slice(0, 100) : "").filter((t, i, all) => t && all.indexOf(t) === i);
49
49
  var WORKER_READY_MS = 1e4;
50
- function completeTable(table) {
51
- const n = table.data[0]?.length ?? 0;
52
- const same = (list) => Array.isArray(list) && list.length === table.columns.length;
53
- return {
54
- ...table,
55
- rowCount: Number.isInteger(table.rowCount) && table.rowCount >= 0 ? table.rowCount : n,
56
- raw: same(table.raw) && table.raw.every((c) => Array.isArray(c) && c.length === n) ? table.raw : table.data,
57
- detected: same(table.detected) ? table.detected : table.types,
58
- hints: table.hints && typeof table.hints === "object" ? table.hints : { decimal: ".", dateOrder: "dmy" },
59
- notes: table.notes.filter((x) => x && typeof x.code === "string").map((x) => ({ code: x.code, params: x.params && typeof x.params === "object" ? x.params : {}, message: String(x.message ?? x.code) }))
60
- };
61
- }
62
50
  var isTable = (t) => t !== null && typeof t === "object" && Array.isArray(t.columns) && Array.isArray(t.types) && Array.isArray(t.data) && Array.isArray(t.notes);
63
51
  var aborted = (signal) => signal?.reason ?? new DOMException("The read was cancelled", "AbortError");
64
52
  var UNAVAILABLE = /* @__PURE__ */ Symbol("worker unavailable");
@@ -141,11 +129,11 @@ async function readImport(file, { plugins = [], worker, sheet, locale, limits, s
141
129
  if (worker && reader && BUILT_IN_READERS.includes(reader)) {
142
130
  const table = await inWorker(worker, file, plain, signal, onProgress, readyMs);
143
131
  if (table !== UNAVAILABLE) {
144
- return completeTable(table);
132
+ return table;
145
133
  }
146
134
  }
147
135
  signal?.throwIfAborted();
148
- return completeTable(await readFile(file, { ...plain, plugins, signal, onProgress }));
136
+ return readFile(file, { ...plain, plugins, signal, onProgress });
149
137
  }
150
138
  async function sheetsOf(file, { plugins = [], limits, signal } = {}) {
151
139
  const reader = readerFor(file, plugins);
@@ -404,7 +392,7 @@ function ImportDialog({ job, labels, locale, plugins, worker, limits, timeZone,
404
392
  };
405
393
  const autoDone = useRef(false);
406
394
  useEffect(() => {
407
- if (job.auto && ready && shown && shown.rowCount > 0 && !typed.error && !autoDone.current) {
395
+ if (job.auto && sheet === job.sheet && ready && shown && shown.rowCount > 0 && !typed.error && shown.notes.every((n) => n.code === "SHEET") && !autoDone.current) {
408
396
  autoDone.current = true;
409
397
  void apply();
410
398
  }
@@ -425,7 +413,7 @@ function ImportDialog({ job, labels, locale, plugins, worker, limits, timeZone,
425
413
  const percent = progress && progress.total > 0 ? Math.min(100, Math.round(progress.done / progress.total * 100)) : null;
426
414
  const meta = shown && !reading ? `${plural(t.rows, shown.rowCount, where)} \xB7 ${plural(t.columns, shown.columns.length, where)} \xB7 ${sizeText(file.size, locale)}` : sizeText(file.size, locale);
427
415
  return createPortal(
428
- /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { ref: scrim, ...inTop, className: "pk-scrim pk-import-scrim", "aria-hidden": "true" }), /* @__PURE__ */ React.createElement("div", { ref: box, ...inTop, className: "pk-import", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, "aria-describedby": shown && shown.notes.length ? `${metaId} ${notesId}` : metaId, "aria-busy": reading || void 0, tabIndex: -1, onKeyDown, "data-testid": "import-dialog" }, /* @__PURE__ */ React.createElement("div", { className: "pk-drill-head" }, /* @__PURE__ */ React.createElement("div", { className: "pk-drill-heading" }, /* @__PURE__ */ React.createElement("h2", { id: titleId }, fill(t.previewTitle, { name })), /* @__PURE__ */ React.createElement("p", { id: metaId, className: "pk-hint", role: "status", "data-testid": "import-meta" }, meta))), /* @__PURE__ */ React.createElement("div", { className: "pk-import-body" }, sheets.length > 1 ? /* @__PURE__ */ React.createElement("label", { className: "pk-inline-form" }, t.sheet, /* @__PURE__ */ React.createElement("select", { name: `${formName}-sheet`, value: sheetIndex, onChange: (e) => {
416
+ /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { ref: scrim, ...inTop, className: "pk-scrim pk-import-scrim", "aria-hidden": "true" }), /* @__PURE__ */ React.createElement("div", { ref: box, ...inTop, className: "pk-import", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, "aria-describedby": shown && shown.notes.length ? `${metaId} ${notesId}` : metaId, "aria-busy": reading || void 0, tabIndex: -1, onKeyDown, "data-testid": "import-dialog" }, /* @__PURE__ */ React.createElement("div", { className: "pk-drill-head" }, /* @__PURE__ */ React.createElement("div", { className: "pk-drill-heading" }, /* @__PURE__ */ React.createElement("h2", { id: titleId }, fill(t.previewTitle, { name })), /* @__PURE__ */ React.createElement("p", { id: metaId, className: "pk-hint", role: "status", "data-testid": "import-meta" }, meta))), /* @__PURE__ */ React.createElement("div", { className: "pk-import-body" }, job.view && job.sheet ? /* @__PURE__ */ React.createElement("p", { className: "pk-hint", "data-testid": "import-for-view" }, fill(t.sheetForView, { name: job.view, sheet: job.sheet })) : null, sheets.length > 1 ? /* @__PURE__ */ React.createElement("label", { className: "pk-inline-form" }, t.sheet, /* @__PURE__ */ React.createElement("select", { name: `${formName}-sheet`, value: sheetIndex, onChange: (e) => {
429
417
  setProgress(null);
430
418
  setError(null);
431
419
  setFailed(null);
@@ -571,14 +559,14 @@ function startFiles(api, files) {
571
559
  sayError(api, importLabels(api.labels).dropOne);
572
560
  }
573
561
  }
574
- function loadSheet(api, sheet, done) {
562
+ function loadSheet(api, sheet, view, done) {
575
563
  const file = api.imported?.blob;
576
564
  if (!file) {
577
565
  done(false);
578
566
  return;
579
567
  }
580
568
  closeErrors(api);
581
- api.setJob({ file, n: ++jobs, sheet, auto: true, done });
569
+ api.setJob({ file, n: ++jobs, sheet, auto: true, view, done });
582
570
  }
583
571
  function openOnSheet(api, made, name, then) {
584
572
  const shown = api.imported;
@@ -586,10 +574,10 @@ function openOnSheet(api, made, name, then) {
586
574
  const t = importLabels(api.labels);
587
575
  if (plan.kind === "switch") {
588
576
  api.afterData(null);
589
- loadSheet(api, plan.sheet, (loaded, refused) => {
577
+ loadSheet(api, plan.sheet, name, (loaded, refused, other) => {
590
578
  api.afterData(loaded ? then : null);
591
- if (refused) {
592
- sayError(api, fill(t.sheetRefused, { name, sheet: plan.sheet }));
579
+ if (refused || other) {
580
+ sayError(api, fill(refused ? t.sheetRefused : t.sheetOther, { name, sheet: plan.sheet }));
593
581
  }
594
582
  });
595
583
  } else if (plan.kind === "missing") {
@@ -645,7 +633,8 @@ function ImportLayer({ api, input }) {
645
633
  onApply: (loaded) => {
646
634
  const ok = loadData(api, loaded);
647
635
  api.setJob((j) => j === job ? null : j);
648
- job.done?.(ok, !ok);
636
+ const asked = job.sheet === void 0 || loaded.sheet === job.sheet;
637
+ job.done?.(ok && asked, !ok, ok && !asked);
649
638
  }
650
639
  }
651
640
  ) : null);
package/dist/index.js CHANGED
@@ -76,7 +76,7 @@ import {
76
76
  writeItem,
77
77
  writeStoredView,
78
78
  zoneOverLimit
79
- } from "./chunks/chunk-2RAVX4DO.js";
79
+ } from "./chunks/chunk-3LDE2GPG.js";
80
80
  import {
81
81
  FormNameContext,
82
82
  Group,
@@ -92,7 +92,7 @@ import {
92
92
  tabStops,
93
93
  useIsoLayoutEffect,
94
94
  useModal
95
- } from "./chunks/chunk-RIOSIYGC.js";
95
+ } from "./chunks/chunk-JOWAEZAD.js";
96
96
  import {
97
97
  MENU_TEXTS,
98
98
  errorText,
@@ -2148,6 +2148,11 @@ import { emptyView, normalize } from "pivotkit-core";
2148
2148
  // src/view-history.js
2149
2149
  var tagFor = (tag, sourceId) => tag && tag.sourceId === sourceId ? tag : null;
2150
2150
  var HISTORY_LIMIT = 100;
2151
+ var told = (pending3, view) => [...pending3, view].slice(-HISTORY_LIMIT);
2152
+ function answered(pending3, view) {
2153
+ const index = pending3.indexOf(view);
2154
+ return index < 0 ? [] : pending3.slice(index + 1);
2155
+ }
2151
2156
  function createState(schema, start, current = start, tag = null) {
2152
2157
  return { schema, start, present: current, past: [], future: [], tag };
2153
2158
  }
@@ -2211,8 +2216,7 @@ function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outs
2211
2216
  const [echo, setEcho] = useState9(() => ({ over: viewKey, pending: initialState ? [initialState.present] : [] }));
2212
2217
  let pending3 = echo.pending;
2213
2218
  if (viewKey !== echo.over) {
2214
- const index = viewKey === null ? -1 : pending3.indexOf(json(JSON.parse(viewKey)));
2215
- pending3 = index < 0 ? [] : pending3.slice(index + 1);
2219
+ pending3 = viewKey === null ? [] : answered(pending3, json(JSON.parse(viewKey)));
2216
2220
  setEcho({ over: viewKey, pending: pending3 });
2217
2221
  }
2218
2222
  const shown = useMemo6(() => {
@@ -2231,7 +2235,7 @@ function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outs
2231
2235
  (next) => {
2232
2236
  setState(next);
2233
2237
  if (viewKey !== null) {
2234
- setEcho((previous) => ({ over: viewKey, pending: [...previous.over === viewKey ? previous.pending : pending3, next.present] }));
2238
+ setEcho((previous) => ({ over: viewKey, pending: told(previous.over === viewKey ? previous.pending : pending3, next.present) }));
2235
2239
  }
2236
2240
  onViewChange?.(JSON.parse(next.present));
2237
2241
  },
@@ -3874,7 +3878,7 @@ function Report(props) {
3874
3878
  templateActions,
3875
3879
  onExport: doExport,
3876
3880
  prepareExport: prepareExporters,
3877
- dataExport: exportData,
3881
+ dataExport: { exportData, encoded },
3878
3882
  chartReady: view.display === "chart" && chartReady,
3879
3883
  empty,
3880
3884
  onShowFields: () => setDrawer(true),
@@ -3956,7 +3960,7 @@ function Report(props) {
3956
3960
  },
3957
3961
  onPoint: (p) => openCell({ rowPath: plan.swap ? p.colPath : p.rowPath, colPath: plan.swap ? p.rowPath : p.colPath, value: p.value, valueIndex: p.valueIndex, text: String(p.value ?? "") })
3958
3962
  }
3959
- ) : gridState.grid ? /* @__PURE__ */ React12.createElement(PivotTable, { grid: gridState.grid, view, labels, version: history.viewKey, hintId: view.values.length ? hintId : void 0, onRowLabel: setRowLabel, infoOf, showInfo: fieldSwitch.on, typeOf, hostOrdered, onSort: sortFromHeader, onToggle: (axis, path) => commit(toggleCollapsed(view, axis, path), { step: "collapse" }), onCell: (cell) => openCell(cell) }) : null), /* @__PURE__ */ React12.createElement("div", { className: "pk-status" }, /* @__PURE__ */ React12.createElement("span", { "data-testid": "row-count" }, result ? plural(labels.rowsCount, result.rows.length, { lang: labels.lang, locale }) : ""), importMod ? /* @__PURE__ */ React12.createElement(importMod.SourceLine, { api }) : null, rowLabel && showTable ? /* @__PURE__ */ React12.createElement("span", { className: "pk-row-label", "data-testid": "row-label" }, fill(labels.rowLabel, { label: rowLabel })) : null), /* @__PURE__ */ React12.createElement("div", { className: "pk-toast-dock" }, /* @__PURE__ */ React12.createElement(Toasts, { toasts, dismiss, pause, closeLabel: labels.close }))), drill ? /* @__PURE__ */ React12.createElement(MenuPanel, { name: "DrillPanel", props: { drill, onClose: () => setDrill(null), labels, locale, exportContext: { encoded, onExport, announce, root } } }) : null),
3963
+ ) : gridState.grid ? /* @__PURE__ */ React12.createElement(PivotTable, { grid: gridState.grid, view, labels, version: history.viewKey, hintId: view.values.length ? hintId : void 0, onRowLabel: setRowLabel, infoOf, showInfo: fieldSwitch.on, typeOf, hostOrdered, onSort: sortFromHeader, onToggle: (axis, path) => commit(toggleCollapsed(view, axis, path), { step: "collapse" }), onCell: (cell) => openCell(cell) }) : null), /* @__PURE__ */ React12.createElement("div", { className: "pk-status" }, /* @__PURE__ */ React12.createElement("span", { "data-testid": "row-count" }, result ? plural(labels.rowsCount, result.rows.length, { lang: labels.lang, locale }) : ""), importMod ? /* @__PURE__ */ React12.createElement(importMod.SourceLine, { api }) : null, rowLabel && showTable ? /* @__PURE__ */ React12.createElement("span", { className: "pk-row-label", "data-testid": "row-label" }, fill(labels.rowLabel, { label: rowLabel })) : null), /* @__PURE__ */ React12.createElement("div", { className: "pk-toast-dock" }, /* @__PURE__ */ React12.createElement(Toasts, { toasts, dismiss, pause, closeLabel: labels.close }))), drill ? /* @__PURE__ */ React12.createElement(MenuPanel, { name: "DrillPanel", props: { drill, onClose: () => setDrill(null), labels, locale, exportContext: { encoded, onExport, announce, root, exportData } } }) : null),
3960
3964
  filterTarget ? /* @__PURE__ */ React12.createElement(MenuPanel, { name: "FilterPopover", props: { target: filterTarget, onClose: closeFilter, view, encoded, locale, labels, commit } }) : null
3961
3965
  ), allowImport && importMod ? /* @__PURE__ */ React12.createElement(importMod.ImportLayer, { api, input: fileInput }) : null, /* @__PURE__ */ React12.createElement("div", { className: "pk-layer", ref: setLayer }, /* @__PURE__ */ React12.createElement("span", { className: "pk-origin", "aria-hidden": "true" })))))
3962
3966
  );
package/dist/labels.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  de as de2,
15
15
  en as en2
16
- } from "./chunks/chunk-7LERNGUW.js";
16
+ } from "./chunks/chunk-ZK5RVCHP.js";
17
17
  import {
18
18
  LABELS
19
19
  } from "./chunks/chunk-XN5HNKJ2.js";