pivotkit-react 0.6.0 → 0.7.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.
- package/CHANGELOG.md +114 -1
- package/dist/chunks/{chunk-2RAVX4DO.js → chunk-4WZ5F2TJ.js} +57 -33
- package/dist/chunks/{chunk-RIOSIYGC.js → chunk-JAOOFDNR.js} +27 -5
- package/dist/chunks/{chunk-7LERNGUW.js → chunk-ZK5RVCHP.js} +14 -2
- package/dist/chunks/{report-run-BZBFOMPF.js → report-run-HU4WPOB7.js} +3 -1
- package/dist/import-ui.js +13 -24
- package/dist/index.js +61 -54
- package/dist/labels.js +1 -1
- package/dist/menus.js +388 -151
- package/dist/styles.css +4 -1
- package/package.json +8 -4
- package/styles.css.d.ts +3 -0
- package/types/drill-export.d.ts +3 -2
- package/types/drill-panel.d.ts +4 -2
- package/types/export-run.d.ts +16 -3
- package/types/export-scope.d.ts +47 -0
- package/types/import-host.d.ts +8 -5
- package/types/import-labels.d.ts +14 -3
- package/types/import-run.d.ts +0 -8
- package/types/import-ui.d.ts +5 -2
- package/types/index.d.ts +14 -8
- package/types/menu-fields.d.ts +9 -0
- package/types/menu-ops.d.ts +23 -0
- package/types/menus.d.ts +1 -1
- package/types/names.d.ts +22 -8
- package/types/print-frame.d.ts +32 -3
- package/types/report-run.d.ts +5 -0
- package/types/theme-tokens.d.ts +17 -0
- package/types/toolbar-panels.d.ts +15 -6
- package/types/use-export.d.ts +8 -4
- package/types/view-history.d.ts +15 -0
- package/types/light-tokens.d.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,117 @@ All notable changes to `pivotkit-react` are documented in this file. The format
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.7.0] - 2026-11-16
|
|
10
|
+
|
|
11
|
+
### Upgrading from 0.6
|
|
12
|
+
|
|
13
|
+
What a host checks; the [upgrade page](https://pivotkit.eize.dev/getting-started/upgrading/#from-0-6-1) has the details.
|
|
14
|
+
|
|
15
|
+
- Export → HTML report carries the host's dark colours too. On a dark screen a colour scale's middle
|
|
16
|
+
colour (`--pk-scale-mid`) is the one your dark theme sets, not the light one; without it the cells
|
|
17
|
+
run halfway between the dark low and high colours ([upgrading](https://pivotkit.eize.dev/getting-started/upgrading/#dark-mid-colour)).
|
|
18
|
+
- A field's Filter level shows its rules in a single column as wide as the menu, in every browser.
|
|
19
|
+
Tests or screenshots of that form take the new layout.
|
|
20
|
+
- pivotkit-core moves to `^0.7.0` and pivotkit-report to `^0.3.0` with it.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Depends on `pivotkit-core` `^0.7.0` (was `^0.6.1`) and `pivotkit-report` `^0.3.0` (was `^0.2.1`): a host
|
|
25
|
+
that also lists pivotkit-core updates both together, or it gets two copies.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- The rules in a field's Filter level show in the WebKit of Playwright 1.65 (build 2388): the rule
|
|
30
|
+
list stacked in a wrapping column got no size there, so a new rule's row and its value field could
|
|
31
|
+
not be seen or used. The rules form is a single column as wide as the menu, each row with room for
|
|
32
|
+
its value, in every browser. Whether a Safari release shows the same fault was not checked
|
|
33
|
+
([#474](https://github.com/eizedev/pivotkit/issues/474)).
|
|
34
|
+
- Export → HTML report carries the host's dark colours too (pivotkit-report's `darkTokens`), read
|
|
35
|
+
from the report's dark theme whichever theme it shows: a reader on a dark screen sees the host's
|
|
36
|
+
dark design, not pivotkit's default dark colours. Paper and a print stay light. The report's
|
|
37
|
+
`--pk-scale-mid` on a dark screen is the one your dark theme resolves (pivotkit-report no longer
|
|
38
|
+
takes the light one there) ([#385](https://github.com/eizedev/pivotkit/issues/385)).
|
|
39
|
+
- Print or save as PDF opens the print dialog in the click itself: the Export menu makes the print
|
|
40
|
+
frame ready when it opens, and the report's modules load when Print is pointed at or focused. A
|
|
41
|
+
page hidden while it printed (it gets no animation frame) did not print at all. Safari still asks
|
|
42
|
+
"This webpage is trying to print" after a cancelled print dialog: that is Safari's own rule
|
|
43
|
+
([print or save as PDF](https://pivotkit.eize.dev/use/export/)) ([#210](https://github.com/eizedev/pivotkit/issues/210)).
|
|
44
|
+
- A second click on a menu's button closes the menu in Safari and other WebKit browsers, as in the
|
|
45
|
+
others: the toolbar's menus (Export, Views, Data, Start over, More) and a field's chip menu. WebKit
|
|
46
|
+
does not focus a clicked button, so the press moved the focus out of the menu, which closed it,
|
|
47
|
+
and the click opened it again ([#393](https://github.com/eizedev/pivotkit/issues/393)).
|
|
48
|
+
- `import "pivotkit-react/styles.css"` compiles in a strict TypeScript project without a bundler's
|
|
49
|
+
CSS types: the stylesheet ships its own declaration (`styles.css.d.ts`, the `types` condition of
|
|
50
|
+
its export); TypeScript answered TS2882 before
|
|
51
|
+
([#165](https://github.com/eizedev/pivotkit/issues/165)).
|
|
52
|
+
|
|
53
|
+
## [0.6.1] - 2026-11-14
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- `exportData={{ columns: [...] }}`: Source data and the drill-down's copies and files hold only
|
|
58
|
+
those columns, in that order (matched case-insensitively, derived fields never). A name the data
|
|
59
|
+
lacks is left out and said once in the console; with no column left, or `columns` that is no list
|
|
60
|
+
(said once too), Source data and the drill-down's Export menu are off; an `exportData` of another
|
|
61
|
+
shape is off, as `false` ([#259](https://github.com/eizedev/pivotkit/issues/259)).
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- Source data as CSV is built in pieces of whole lines (pivotkit-core's `dataToCsvParts`), so the
|
|
66
|
+
browser holds about twice the file's size while it is made, not about five times
|
|
67
|
+
([#260](https://github.com/eizedev/pivotkit/issues/260)).
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- Filter level: Years combined (its year buttons, "The table shows … only" and the summary) writes a
|
|
72
|
+
year before 1 AD as the table does ("5 BC", not "-4"); the reference date's field shows and takes a
|
|
73
|
+
day after 9999 ("+010000-01-01" was cut off and could not be typed), and whether a quick choice
|
|
74
|
+
reaches the data compares days, not their text, for years with a sign
|
|
75
|
+
([#351](https://github.com/eizedev/pivotkit/issues/351)).
|
|
76
|
+
- An open menu no longer moves when its own content is scrolled: a click on a control reached by
|
|
77
|
+
scrolling (Rolling under More choices of a date's quick choices) could land beside it when the
|
|
78
|
+
menu was placed again between the press and the release. A menu whose content grew while it was
|
|
79
|
+
already as tall as its room is placed again in the next frame instead
|
|
80
|
+
([#222](https://github.com/eizedev/pivotkit/issues/222)).
|
|
81
|
+
- A workbook whose shared strings and formats reach `limits.importCells` is said as "more than …
|
|
82
|
+
different texts and formats" (`labels.dataImport.workbookCells`), chosen by the reader's
|
|
83
|
+
`details.what`, not as "values (rows x columns)", which stays for a table's own extent
|
|
84
|
+
([#325](https://github.com/eizedev/pivotkit/issues/325)).
|
|
85
|
+
- Filter level: a rule's × clicked while its value still waits to apply (a moment after typing)
|
|
86
|
+
takes the rule away; before, the field's blur applied the value and the click was lost. What waits
|
|
87
|
+
in a removed row applies nothing ([#320](https://github.com/eizedev/pivotkit/issues/320)).
|
|
88
|
+
- Filter level: emptying the value of a rule on the item or on its total takes the rule off, as
|
|
89
|
+
emptying the text of a rule on the name does; its row stays, says "Applies once it is complete."
|
|
90
|
+
and applies again with the next value, in its place among the rules. Before, the field looked empty
|
|
91
|
+
while the previous rule kept filtering ([#244](https://github.com/eizedev/pivotkit/issues/244)).
|
|
92
|
+
- Filter level: a rule added while the text or number of a new rule still waits to apply is a row of
|
|
93
|
+
its own; the comparison and the value chosen next no longer change the first rule. The add buttons
|
|
94
|
+
keep the focus in the field until the click, and a new row not yet complete stays in its place when
|
|
95
|
+
another one is added ([#245](https://github.com/eizedev/pivotkit/issues/245)).
|
|
96
|
+
- Filter level: a click on a date's quick choice (All, This, Last, …) focuses it in Safari too, as
|
|
97
|
+
Top items' choices do; both use one radio button that takes the focus on a click
|
|
98
|
+
([#203](https://github.com/eizedev/pivotkit/issues/203)).
|
|
99
|
+
- A saved view that reads another sheet of the loaded workbook no longer loads that sheet unseen when
|
|
100
|
+
the reader has notes on it (a used range, values not read, columns renamed): the preview stays
|
|
101
|
+
open with the notes and a line naming the view that needs the sheet, and **Load data** loads the
|
|
102
|
+
sheet and opens the view. Another sheet picked in that preview does not load by itself, and loaded
|
|
103
|
+
it does not open the view; a note says so
|
|
104
|
+
([#274](https://github.com/eizedev/pivotkit/issues/274)). Browser tests cover Cancel, a host's
|
|
105
|
+
refusal, another file dropped during the read and a sheet without rows
|
|
106
|
+
([#277](https://github.com/eizedev/pivotkit/issues/277)).
|
|
107
|
+
- A controlled report whose host does not pass its views back (it rejects or ignores
|
|
108
|
+
`onViewChange`) keeps at most 100 of the views it told the host waiting, the newest ones, instead
|
|
109
|
+
of one more with every change ([#204](https://github.com/eizedev/pivotkit/issues/204)).
|
|
110
|
+
- The dashed rule between the parts of a menu's group (the chart's Display: Value labels, Legend,
|
|
111
|
+
Title) uses `--pk-rule`, 3:1 against the menu as the rule between groups, instead of `--pk-border`
|
|
112
|
+
(about 1.3:1) ([#205](https://github.com/eizedev/pivotkit/issues/205)).
|
|
113
|
+
- The filter's texts and Years combined read and write years before 0 and after 9999 (signed ISO
|
|
114
|
+
days), compare such days in time order, and write years before 1 AD as the table does ("2 BC");
|
|
115
|
+
Years combined keeps the first and last year a `Date` holds as far as it holds
|
|
116
|
+
([#349](https://github.com/eizedev/pivotkit/issues/349)).
|
|
117
|
+
- The import UI takes a plugin's table as pivotkit-core's `readFile` completes it; its own
|
|
118
|
+
`completeTable` is gone ([#130](https://github.com/eizedev/pivotkit/issues/130)).
|
|
119
|
+
|
|
9
120
|
## [0.6.0] - 2026-11-14
|
|
10
121
|
|
|
11
122
|
### Upgrading from 0.5
|
|
@@ -982,7 +1093,9 @@ First release.
|
|
|
982
1093
|
weather (Open-Meteo), countries (World Bank), earthquakes (USGS), Nobel laureates and the release
|
|
983
1094
|
cycles of software products (endoflife.date).
|
|
984
1095
|
|
|
985
|
-
[Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.
|
|
1096
|
+
[Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.7.0...HEAD
|
|
1097
|
+
[0.7.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.6.1...pivotkit-react@0.7.0
|
|
1098
|
+
[0.6.1]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.6.0...pivotkit-react@0.6.1
|
|
986
1099
|
[0.6.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.5.0...pivotkit-react@0.6.0
|
|
987
1100
|
[0.5.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.4.0...pivotkit-react@0.5.0
|
|
988
1101
|
[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-
|
|
6
|
+
} from "./chunk-JAOOFDNR.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
|
|
489
|
-
var
|
|
490
|
-
var
|
|
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
|
|
499
|
-
const quarter = (iso) => `Q${Math.floor((
|
|
500
|
-
const text = unit === "year" ?
|
|
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
|
|
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] = [
|
|
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 ?
|
|
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 = `${
|
|
532
|
-
const yearTo = `${
|
|
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),
|
|
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,
|
|
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
|
|
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] = [
|
|
552
|
-
|
|
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
|
|
630
|
+
return monthText(iso, locale);
|
|
614
631
|
}
|
|
615
|
-
|
|
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.
|
|
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
|
|
622
|
-
|
|
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
|
|
630
|
-
const
|
|
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,
|
|
@@ -302,6 +302,7 @@ function onTheWay(anchor, popover, point) {
|
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
// src/popover.jsx
|
|
305
|
+
var PRESS_MS = 1e3;
|
|
305
306
|
var LayerContext = createContext2({ layer: (
|
|
306
307
|
/** @type {HTMLElement | null} */
|
|
307
308
|
null
|
|
@@ -383,6 +384,7 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
|
|
|
383
384
|
return void 0;
|
|
384
385
|
}
|
|
385
386
|
let last = null;
|
|
387
|
+
let placedHeight = -1;
|
|
386
388
|
const place = () => {
|
|
387
389
|
const el2 = ref.current;
|
|
388
390
|
const a = anchor.current;
|
|
@@ -390,7 +392,7 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
|
|
|
390
392
|
return;
|
|
391
393
|
}
|
|
392
394
|
const r = a.getBoundingClientRect();
|
|
393
|
-
const size2 = { width: el2.offsetWidth, height: el2.scrollHeight };
|
|
395
|
+
const size2 = { width: el2.offsetWidth, height: placedHeight = el2.scrollHeight };
|
|
394
396
|
const viewport = viewportOf(el2.ownerDocument);
|
|
395
397
|
const place2 = keepPlace(last, placePopover(r, size2, viewport, align, { fill }), r, size2, viewport);
|
|
396
398
|
last = { top: place2.top, side: place2.side, anchorTop: r.top };
|
|
@@ -407,7 +409,7 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
|
|
|
407
409
|
let rect = anchor.current?.getBoundingClientRect();
|
|
408
410
|
const follow = () => {
|
|
409
411
|
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)) {
|
|
412
|
+
if (next && rect && (next.x !== rect.x || next.y !== rect.y || next.width !== rect.width || next.height !== rect.height) || ref.current?.scrollHeight !== placedHeight) {
|
|
411
413
|
place();
|
|
412
414
|
}
|
|
413
415
|
rect = next;
|
|
@@ -416,16 +418,19 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
|
|
|
416
418
|
if (!sheet) {
|
|
417
419
|
frame = requestAnimationFrame(follow);
|
|
418
420
|
}
|
|
421
|
+
const onScroll = (e) => e.target instanceof Node && ref.current?.contains(e.target) || place();
|
|
419
422
|
window.addEventListener("resize", place);
|
|
420
|
-
window.addEventListener("scroll",
|
|
423
|
+
window.addEventListener("scroll", onScroll, true);
|
|
421
424
|
return () => {
|
|
422
425
|
cancelAnimationFrame(frame);
|
|
423
426
|
ro?.disconnect();
|
|
424
427
|
window.removeEventListener("resize", place);
|
|
425
|
-
window.removeEventListener("scroll",
|
|
428
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
426
429
|
};
|
|
427
430
|
}, [open, anchor, align, sheet, layer, fill]);
|
|
428
431
|
useEscapeLayer(open, onClose);
|
|
432
|
+
const pressedAt = useRef2(0);
|
|
433
|
+
const pressedAway = (to) => pressedAt.current > 0 && performance.now() - pressedAt.current < PRESS_MS && Boolean(anchor.current && to.contains(anchor.current));
|
|
429
434
|
const closeRef = useRef2(onClose);
|
|
430
435
|
useEffect3(() => {
|
|
431
436
|
closeRef.current = onClose;
|
|
@@ -444,12 +449,24 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
|
|
|
444
449
|
first?.focus({ preventScroll: true });
|
|
445
450
|
});
|
|
446
451
|
const onDown = (e) => {
|
|
452
|
+
pressedAt.current = eventWithin(e, [anchor.current]) ? performance.now() : 0;
|
|
447
453
|
if (!eventWithin(e, [el, anchor.current]) && !e.composedPath().some((n) => n instanceof Element && n !== el && n.getAttribute("data-pk-parent") === elId)) {
|
|
448
454
|
closeRef.current();
|
|
449
455
|
}
|
|
450
456
|
};
|
|
457
|
+
const onUp = () => {
|
|
458
|
+
if (pressedAt.current) pressedAt.current = performance.now();
|
|
459
|
+
};
|
|
460
|
+
const onPressEnd = () => {
|
|
461
|
+
pressedAt.current = 0;
|
|
462
|
+
};
|
|
451
463
|
const doc = el?.ownerDocument ?? document;
|
|
464
|
+
const win = doc.defaultView;
|
|
452
465
|
doc.addEventListener("pointerdown", onDown, true);
|
|
466
|
+
doc.addEventListener("pointerup", onUp, true);
|
|
467
|
+
doc.addEventListener("click", onPressEnd, true);
|
|
468
|
+
doc.addEventListener("pointercancel", onPressEnd, true);
|
|
469
|
+
win?.addEventListener("blur", onPressEnd);
|
|
453
470
|
const onWheel = (e) => {
|
|
454
471
|
if (el && !e.ctrlKey && !wheelScrollsInside(e.composedPath(), el, e.deltaX, e.deltaY)) {
|
|
455
472
|
e.preventDefault();
|
|
@@ -460,6 +477,11 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
|
|
|
460
477
|
return () => {
|
|
461
478
|
cancelAnimationFrame(t);
|
|
462
479
|
doc.removeEventListener("pointerdown", onDown, true);
|
|
480
|
+
doc.removeEventListener("pointerup", onUp, true);
|
|
481
|
+
doc.removeEventListener("click", onPressEnd, true);
|
|
482
|
+
doc.removeEventListener("pointercancel", onPressEnd, true);
|
|
483
|
+
win?.removeEventListener("blur", onPressEnd);
|
|
484
|
+
pressedAt.current = 0;
|
|
463
485
|
el?.removeEventListener("wheel", onWheel);
|
|
464
486
|
const now = activeIn(button);
|
|
465
487
|
if (button && button.isConnected && (!now || now === doc.body || el?.contains(now) || !now.isConnected)) {
|
|
@@ -526,7 +548,7 @@ function Popover({ open, anchor, onClose, label, role = "dialog", align = "start
|
|
|
526
548
|
/** @type {Node | null} */
|
|
527
549
|
e.relatedTarget
|
|
528
550
|
);
|
|
529
|
-
if (to && !ref.current?.contains(to) && !anchor.current?.contains(to) && !(to instanceof Element && [...to.ownerDocument.querySelectorAll(".pk-popover")].some((p) => p.contains(to) && within(p)))) {
|
|
551
|
+
if (to && !pressedAway(to) && !ref.current?.contains(to) && !anchor.current?.contains(to) && !(to instanceof Element && [...to.ownerDocument.querySelectorAll(".pk-popover")].some((p) => p.contains(to) && within(p)))) {
|
|
530
552
|
onClose();
|
|
531
553
|
}
|
|
532
554
|
};
|
|
@@ -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
|
-
|
|
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
|
-
)
|
|
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}" `]) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// src/report-run.js
|
|
2
2
|
import { use as register } from "echarts/core";
|
|
3
3
|
import { SVGRenderer } from "echarts/renderers";
|
|
4
|
-
import { LIGHT_TOKENS, SHAPE_TOKENS, SIZE_TOKENS, WEIGHT_TOKENS, render } from "pivotkit-report";
|
|
4
|
+
import { DARK_TOKENS, LIGHT_TOKENS, SHAPE_TOKENS, SIZE_TOKENS, WEIGHT_TOKENS, render } from "pivotkit-report";
|
|
5
5
|
register([SVGRenderer]);
|
|
6
6
|
var REPORT_TOKENS = Object.freeze([...Object.keys(WEIGHT_TOKENS), ...Object.keys(SHAPE_TOKENS), ...Object.keys(LIGHT_TOKENS), "--pk-scale-mid"]);
|
|
7
|
+
var REPORT_DARK_TOKENS = Object.freeze([...Object.keys(DARK_TOKENS), "--pk-scale-mid"]);
|
|
7
8
|
var REPORT_LENGTHS = Object.freeze(Object.keys(SIZE_TOKENS));
|
|
8
9
|
export {
|
|
10
|
+
REPORT_DARK_TOKENS,
|
|
9
11
|
REPORT_LENGTHS,
|
|
10
12
|
REPORT_TOKENS,
|
|
11
13
|
render
|
package/dist/import-ui.js
CHANGED
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
useFormName,
|
|
11
11
|
useModal,
|
|
12
12
|
useTopLayer
|
|
13
|
-
} from "./chunks/chunk-
|
|
13
|
+
} from "./chunks/chunk-JAOOFDNR.js";
|
|
14
14
|
import {
|
|
15
15
|
errorText,
|
|
16
16
|
importLabels,
|
|
17
17
|
noteText
|
|
18
|
-
} from "./chunks/chunk-
|
|
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
|
|
132
|
+
return table;
|
|
145
133
|
}
|
|
146
134
|
}
|
|
147
135
|
signal?.throwIfAborted();
|
|
148
|
-
return
|
|
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.
|
|
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);
|