pivotkit-react 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +306 -1
- package/README.md +48 -298
- package/dist/chunks/{chunk-ILHFIV2P.js → chunk-32Z33U6S.js} +58 -78
- package/dist/chunks/chunk-7CC4JHDY.js +363 -0
- package/dist/chunks/chunk-APB4NW4O.js +434 -0
- package/dist/chunks/chunk-EM23V5GH.js +183 -0
- package/dist/chunks/{chunk-KKJO36W5.js → chunk-IOPAM4JD.js} +412 -365
- package/dist/chunks/chunk-RWYHJRQO.js +99 -0
- package/dist/chunks/unused-texts-K3VFH65P.js +10 -0
- package/dist/chunks/unused-texts-de-OW4TGIVX.js +6 -0
- package/dist/echarts.js +96 -11
- package/dist/index.js +654 -560
- package/dist/labels.js +13 -4
- package/dist/menu-texts-de.js +6 -0
- package/dist/menus.js +2905 -550
- package/dist/styles.css +738 -216
- package/package.json +2 -2
- package/types/chart-layout.d.ts +111 -0
- package/types/chart-types.d.ts +0 -91
- package/types/chip-menus.d.ts +20 -4
- package/types/dnd.d.ts +8 -4
- package/types/drill-panel.d.ts +5 -22
- package/types/drill-table.d.ts +71 -0
- package/types/drill.d.ts +0 -36
- package/types/filter-level.d.ts +16 -0
- package/types/filter.d.ts +31 -0
- package/types/help.d.ts +14 -0
- package/types/icons.d.ts +4 -0
- package/types/labels.d.ts +114 -101
- package/types/lazy-menus.d.ts +18 -6
- package/types/levels.d.ts +105 -0
- package/types/menu-fields.d.ts +80 -0
- package/types/menu-labels-de.d.ts +2 -0
- package/types/menu-labels.d.ts +270 -13
- package/types/menu-ops.d.ts +286 -0
- package/types/menu-texts.d.ts +2 -0
- package/types/menu-topics.d.ts +293 -0
- package/types/menus.d.ts +2 -2
- package/types/names.d.ts +160 -20
- package/types/overflow.d.ts +4 -1
- package/types/place.d.ts +44 -0
- package/types/popover.d.ts +10 -6
- package/types/section.d.ts +8 -28
- package/types/share-actions.d.ts +99 -0
- package/types/share.d.ts +0 -9
- package/types/table.d.ts +9 -3
- package/types/templates.d.ts +7 -1
- package/types/tips.d.ts +1 -34
- package/types/toolbar-panels.d.ts +20 -10
- package/types/unused-load.d.ts +23 -0
- package/types/unused-texts-de.d.ts +2 -0
- package/types/unused-texts.d.ts +136 -0
- package/types/unused.d.ts +22 -0
- package/types/use-view-history.d.ts +8 -4
- package/types/view-history.d.ts +23 -6
- package/types/view-ops.d.ts +80 -119
- package/types/view-save.d.ts +76 -0
- package/types/view-store.d.ts +13 -6
- package/types/zones.d.ts +5 -4
- package/dist/chunks/chunk-C32TYSHG.js +0 -441
- package/dist/chunks/chunk-XYP47DJ3.js +0 -123
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ALL_TIPS,
|
|
3
|
+
CHART_TYPES,
|
|
3
4
|
ClearInput,
|
|
4
5
|
DRILL_LIMIT,
|
|
5
6
|
FIELDS_COLLAPSED,
|
|
@@ -7,6 +8,7 @@ import {
|
|
|
7
8
|
Icon,
|
|
8
9
|
InfoButton,
|
|
9
10
|
LayerContext,
|
|
11
|
+
MAX_CATEGORIES,
|
|
10
12
|
MenuButton,
|
|
11
13
|
NO_EXPLANATIONS,
|
|
12
14
|
Option,
|
|
@@ -18,40 +20,51 @@ import {
|
|
|
18
20
|
activeTips,
|
|
19
21
|
addField,
|
|
20
22
|
allowedTips,
|
|
23
|
+
chartPlan,
|
|
24
|
+
chartTypeOf,
|
|
21
25
|
cleanDismissed,
|
|
22
|
-
|
|
26
|
+
dateSpan,
|
|
23
27
|
drillRows,
|
|
24
|
-
drillTable,
|
|
25
28
|
fieldAction,
|
|
26
29
|
fieldsCollapsed,
|
|
27
30
|
filterZoneFields,
|
|
28
31
|
filtersOf,
|
|
29
32
|
groupField,
|
|
30
33
|
groupingName,
|
|
34
|
+
headerSortState,
|
|
35
|
+
headerSortTarget,
|
|
31
36
|
helpSwitch,
|
|
32
37
|
isEmptyView,
|
|
38
|
+
itemRuleText,
|
|
33
39
|
keptOnReset,
|
|
34
40
|
layoutSummary,
|
|
41
|
+
linkNow,
|
|
42
|
+
linkParam,
|
|
43
|
+
loadCheck,
|
|
44
|
+
loadLink,
|
|
35
45
|
localStore,
|
|
36
46
|
moveField,
|
|
47
|
+
nextHeaderSort,
|
|
37
48
|
numberRange,
|
|
38
49
|
parseStored,
|
|
39
50
|
readItem,
|
|
51
|
+
readLinkParam,
|
|
40
52
|
readStored,
|
|
53
|
+
readStoredView,
|
|
41
54
|
refLabel,
|
|
42
55
|
removeAt,
|
|
43
56
|
rootOf,
|
|
44
57
|
rowFolding,
|
|
45
|
-
safeFileName,
|
|
46
|
-
saveBlob,
|
|
47
|
-
sectionOpen,
|
|
48
58
|
selectedItems,
|
|
49
59
|
setChart,
|
|
50
60
|
setChartDisplay,
|
|
51
61
|
setCollapsed,
|
|
52
62
|
setDisplay,
|
|
63
|
+
setSort,
|
|
53
64
|
setTotal,
|
|
65
|
+
shareBase,
|
|
54
66
|
sortOf,
|
|
67
|
+
sortText,
|
|
55
68
|
sourceOf,
|
|
56
69
|
subscribeItem,
|
|
57
70
|
subscribeStored,
|
|
@@ -64,31 +77,28 @@ import {
|
|
|
64
77
|
useModal,
|
|
65
78
|
valueConditionText,
|
|
66
79
|
valueLabel,
|
|
80
|
+
viewFromObject,
|
|
67
81
|
withHostOrders,
|
|
68
|
-
withSection,
|
|
69
82
|
withoutFilters,
|
|
70
83
|
writeDismissed,
|
|
71
84
|
writeItem,
|
|
85
|
+
writeStoredView,
|
|
72
86
|
zoneOverLimit
|
|
73
|
-
} from "./chunks/chunk-
|
|
74
|
-
import {
|
|
75
|
-
CHART_TYPES,
|
|
76
|
-
MAX_CATEGORIES,
|
|
77
|
-
chartPlan,
|
|
78
|
-
chartTypeOf
|
|
79
|
-
} from "./chunks/chunk-XYP47DJ3.js";
|
|
87
|
+
} from "./chunks/chunk-IOPAM4JD.js";
|
|
80
88
|
import {
|
|
81
89
|
LABELS,
|
|
90
|
+
MENU_TEXTS,
|
|
82
91
|
errorText,
|
|
83
92
|
fill,
|
|
93
|
+
mergeLabels,
|
|
84
94
|
messageOf,
|
|
85
95
|
plural,
|
|
86
96
|
resolveLabels
|
|
87
|
-
} from "./chunks/chunk-
|
|
97
|
+
} from "./chunks/chunk-32Z33U6S.js";
|
|
88
98
|
|
|
89
99
|
// src/PivotReport.jsx
|
|
90
|
-
import
|
|
91
|
-
import { computePivot, encode,
|
|
100
|
+
import React12, { useCallback as useCallback9, useEffect as useEffect11, useId as useId4, useMemo as useMemo8, useRef as useRef11, useState as useState12, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
101
|
+
import { computePivot, emptyView as emptyView2, encode, fieldLabel as fieldLabel5, normalize as normalize2, suggestDateUnit, toGrid, toSeries, viewFields } from "pivotkit-core";
|
|
92
102
|
|
|
93
103
|
// src/chart.jsx
|
|
94
104
|
import React, { useEffect, useId, useRef, useState } from "react";
|
|
@@ -430,18 +440,27 @@ function PivotDnd({ labels, onDrop, onDragStart, renderOverlay, children }) {
|
|
|
430
440
|
/* @__PURE__ */ React2.createElement(DragOverlay, { dropAnimation: reduced ? null : { duration: 160, easing: "cubic-bezier(.2,.8,.2,1)" }, zIndex: 1e3 }, active ? renderOverlay(active) : null)
|
|
431
441
|
);
|
|
432
442
|
}
|
|
433
|
-
function
|
|
434
|
-
|
|
435
|
-
|
|
443
|
+
function ownEventsOnly(listener) {
|
|
444
|
+
return (event) => {
|
|
445
|
+
if (event.currentTarget instanceof Node && event.target instanceof Node && !event.currentTarget.contains(event.target)) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
listener(event);
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function split(listeners2) {
|
|
452
|
+
const own2 = Object.fromEntries(Object.entries(listeners2 ?? {}).map(([name, listener]) => [name, ownEventsOnly(listener)]));
|
|
453
|
+
const { onKeyDown, ...pointer } = own2;
|
|
454
|
+
return { pointer, keyboard: listeners2?.onKeyDown ? { onKeyDown } : {} };
|
|
436
455
|
}
|
|
437
456
|
function useDragSource(id, source, disabled = false) {
|
|
438
|
-
const { setNodeRef, setActivatorNodeRef, attributes, listeners, isDragging } = useDraggable({ id, data: source, disabled });
|
|
439
|
-
const { pointer, keyboard } = split(
|
|
457
|
+
const { setNodeRef, setActivatorNodeRef, attributes, listeners: listeners2, isDragging } = useDraggable({ id, data: source, disabled });
|
|
458
|
+
const { pointer, keyboard } = split(listeners2);
|
|
440
459
|
return { setNodeRef, isDragging, itemProps: pointer, handleProps: { ref: setActivatorNodeRef, ...attributes, ...keyboard } };
|
|
441
460
|
}
|
|
442
461
|
function useChip(id, source) {
|
|
443
|
-
const { setNodeRef, setActivatorNodeRef, attributes, listeners, isDragging, transform, transition } = useSortable({ id, data: source });
|
|
444
|
-
const { pointer, keyboard } = split(
|
|
462
|
+
const { setNodeRef, setActivatorNodeRef, attributes, listeners: listeners2, isDragging, transform, transition } = useSortable({ id, data: source });
|
|
463
|
+
const { pointer, keyboard } = split(listeners2);
|
|
445
464
|
const style = transform ? { transform: `translate3d(${Math.round(transform.x)}px, ${Math.round(transform.y)}px, 0)`, transition } : { transition };
|
|
446
465
|
return { setNodeRef, isDragging, style, itemProps: pointer, handleProps: { ref: setActivatorNodeRef, ...attributes, ...keyboard } };
|
|
447
466
|
}
|
|
@@ -625,7 +644,7 @@ function FieldItem({ field, labels, zones, onAdd, onNote, onFilter, name, info,
|
|
|
625
644
|
onAdd(field.name, zone);
|
|
626
645
|
}
|
|
627
646
|
},
|
|
628
|
-
fill(labels.addTo, { zone: labels.zones[zone] })
|
|
647
|
+
fill(zone === "values" && zones.includes("values") ? labels.addAgain : labels.addTo, { zone: labels.zones[zone] })
|
|
629
648
|
)), zones.length === 0 && onFilter ? /* @__PURE__ */ React3.createElement(
|
|
630
649
|
Option,
|
|
631
650
|
{
|
|
@@ -768,9 +787,22 @@ function FieldPanel({ fields, placed, labels, onAdd, onNote, onFilter, drawer, o
|
|
|
768
787
|
|
|
769
788
|
// src/lazy-menus.jsx
|
|
770
789
|
import React4, { useEffect as useEffect3, useRef as useRef3, useState as useState4 } from "react";
|
|
790
|
+
|
|
791
|
+
// src/menu-texts.js
|
|
792
|
+
var MENU_TEXTS_OF = Object.freeze({ de: () => import("./menu-texts-de.js").then((m) => m.de) });
|
|
793
|
+
|
|
794
|
+
// src/lazy-menus.jsx
|
|
771
795
|
var pending = null;
|
|
772
796
|
var loaded = null;
|
|
773
|
-
|
|
797
|
+
var textsPending = /* @__PURE__ */ new Map();
|
|
798
|
+
var textsFailed = /* @__PURE__ */ new Set();
|
|
799
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
800
|
+
function onMenuTexts(listener) {
|
|
801
|
+
listeners.add(listener);
|
|
802
|
+
return () => void listeners.delete(listener);
|
|
803
|
+
}
|
|
804
|
+
var wantsTexts = (lang) => Object.hasOwn(MENU_TEXTS_OF, lang) && !loaded?.hasMenuTexts(lang);
|
|
805
|
+
function loadMenus(lang = "en") {
|
|
774
806
|
pending ??= import("./menus.js").then(
|
|
775
807
|
(m) => {
|
|
776
808
|
loaded = m;
|
|
@@ -781,9 +813,38 @@ function loadMenus() {
|
|
|
781
813
|
throw error;
|
|
782
814
|
}
|
|
783
815
|
);
|
|
784
|
-
|
|
816
|
+
const menus = pending;
|
|
817
|
+
if (!wantsTexts(lang)) {
|
|
818
|
+
return menus;
|
|
819
|
+
}
|
|
820
|
+
let texts = textsPending.get(lang);
|
|
821
|
+
if (!texts) {
|
|
822
|
+
const done = () => listeners.forEach((f) => f());
|
|
823
|
+
texts = Promise.all([menus, MENU_TEXTS_OF[lang]()]).then(
|
|
824
|
+
([m, t]) => {
|
|
825
|
+
m.addMenuTexts(lang, t);
|
|
826
|
+
textsFailed.delete(lang);
|
|
827
|
+
done();
|
|
828
|
+
},
|
|
829
|
+
() => {
|
|
830
|
+
textsPending.delete(lang);
|
|
831
|
+
textsFailed.add(lang);
|
|
832
|
+
done();
|
|
833
|
+
}
|
|
834
|
+
);
|
|
835
|
+
textsPending.set(lang, texts);
|
|
836
|
+
}
|
|
837
|
+
return texts.then(() => menus);
|
|
838
|
+
}
|
|
839
|
+
var menusNow = (lang = "en") => loaded && (!wantsTexts(lang) || textsFailed.has(lang)) ? loaded : null;
|
|
840
|
+
function Loading({ text }) {
|
|
841
|
+
const [say, setSay] = useState4(false);
|
|
842
|
+
useEffect3(() => {
|
|
843
|
+
const t = setTimeout(() => setSay(true), 0);
|
|
844
|
+
return () => clearTimeout(t);
|
|
845
|
+
}, []);
|
|
846
|
+
return /* @__PURE__ */ React4.createElement("p", { className: "pk-hint pk-menu-loading", role: "status" }, say ? text : null);
|
|
785
847
|
}
|
|
786
|
-
var menusNow = () => loaded;
|
|
787
848
|
function focusFirst(el) {
|
|
788
849
|
const popover = el.closest(".pk-popover");
|
|
789
850
|
const now = activeIn(el);
|
|
@@ -796,7 +857,19 @@ function focusFirst(el) {
|
|
|
796
857
|
}
|
|
797
858
|
}
|
|
798
859
|
function MenuPanel({ name, loadingText, props }) {
|
|
799
|
-
const
|
|
860
|
+
const labels = props.labels;
|
|
861
|
+
const lang = labels?.lang;
|
|
862
|
+
const [, setLoads] = useState4(0);
|
|
863
|
+
useEffect3(() => onMenuTexts(() => setLoads((n) => n + 1)), []);
|
|
864
|
+
const mod = menusNow(lang);
|
|
865
|
+
const current = mod && labels ? mod.menuLabels(labels) : null;
|
|
866
|
+
const [kept, setKept] = useState4(
|
|
867
|
+
/** @type {any} */
|
|
868
|
+
null
|
|
869
|
+
);
|
|
870
|
+
if (current && current !== kept) {
|
|
871
|
+
setKept(current);
|
|
872
|
+
}
|
|
800
873
|
const [failed, setFailed] = useState4(false);
|
|
801
874
|
const [attempt, setAttempt] = useState4(0);
|
|
802
875
|
const box = useRef3(
|
|
@@ -804,17 +877,22 @@ function MenuPanel({ name, loadingText, props }) {
|
|
|
804
877
|
null
|
|
805
878
|
);
|
|
806
879
|
const late = useRef3(false);
|
|
880
|
+
const tried = useRef3(
|
|
881
|
+
/** @type {string | undefined | null} */
|
|
882
|
+
null
|
|
883
|
+
);
|
|
807
884
|
useEffect3(() => {
|
|
808
|
-
if (mod) {
|
|
885
|
+
if (mod && (!wantsTexts(lang) || tried.current === lang)) {
|
|
809
886
|
return void 0;
|
|
810
887
|
}
|
|
811
|
-
|
|
888
|
+
tried.current = lang;
|
|
889
|
+
late.current = !mod;
|
|
812
890
|
let live = true;
|
|
813
|
-
loadMenus().then(
|
|
814
|
-
(
|
|
891
|
+
loadMenus(lang).then(
|
|
892
|
+
() => {
|
|
815
893
|
if (live) {
|
|
816
894
|
setFailed(false);
|
|
817
|
-
|
|
895
|
+
setLoads((n) => n + 1);
|
|
818
896
|
}
|
|
819
897
|
},
|
|
820
898
|
() => {
|
|
@@ -826,20 +904,20 @@ function MenuPanel({ name, loadingText, props }) {
|
|
|
826
904
|
return () => {
|
|
827
905
|
live = false;
|
|
828
906
|
};
|
|
829
|
-
}, [mod, attempt]);
|
|
907
|
+
}, [mod, attempt, lang]);
|
|
830
908
|
useEffect3(() => {
|
|
831
909
|
if (box.current && (mod && late.current || failed)) {
|
|
832
910
|
focusFirst(box.current);
|
|
833
911
|
}
|
|
834
912
|
}, [mod, failed]);
|
|
835
|
-
const
|
|
913
|
+
const shown = mod ?? (kept ? menusNow() : null);
|
|
914
|
+
const Panel = shown ? (
|
|
836
915
|
/** @type {any} */
|
|
837
|
-
|
|
916
|
+
shown[name]
|
|
838
917
|
) : null;
|
|
839
|
-
const labels = props.labels;
|
|
840
918
|
return /* @__PURE__ */ React4.createElement("div", { className: "pk-menu-panel", ref: box }, Panel ? (
|
|
841
919
|
// the menus' own texts (menu-labels.js) come with them, under the report's labels
|
|
842
|
-
/* @__PURE__ */ React4.createElement(Panel, { ...props, labels:
|
|
920
|
+
/* @__PURE__ */ React4.createElement(Panel, { ...props, labels: current ?? kept ?? labels })
|
|
843
921
|
) : failed && labels ? /* @__PURE__ */ React4.createElement("div", { className: "pk-menu-failed", role: "alert", "data-testid": "menu-failed" }, /* @__PURE__ */ React4.createElement("p", null, labels.menuFailed), /* @__PURE__ */ React4.createElement(
|
|
844
922
|
"button",
|
|
845
923
|
{
|
|
@@ -853,145 +931,7 @@ function MenuPanel({ name, loadingText, props }) {
|
|
|
853
931
|
}
|
|
854
932
|
},
|
|
855
933
|
labels.tryAgain
|
|
856
|
-
)) : loadingText ? /* @__PURE__ */ React4.createElement(
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
// src/share.js
|
|
860
|
-
import { VIEW_FILE_LIMITS, fromViewFile, normalize } from "pivotkit-core";
|
|
861
|
-
var linkModule = null;
|
|
862
|
-
var linkLoaded = null;
|
|
863
|
-
function loadLink() {
|
|
864
|
-
linkModule ??= import("pivotkit-core/link").then((m) => {
|
|
865
|
-
linkLoaded = m;
|
|
866
|
-
return m;
|
|
867
|
-
});
|
|
868
|
-
return linkModule;
|
|
869
|
-
}
|
|
870
|
-
var linkNow = () => linkLoaded;
|
|
871
|
-
function linkParam(storageKey) {
|
|
872
|
-
return storageKey ? `pivot-${storageKey}` : "pivot";
|
|
873
|
-
}
|
|
874
|
-
var entries = (fragment) => fragment ? fragment.split("&") : [];
|
|
875
|
-
var isEntry = (entry, param) => entry.startsWith(`${encodeURIComponent(param)}=`);
|
|
876
|
-
function readLinkParam(hash, param) {
|
|
877
|
-
const text = typeof hash === "string" ? hash.replace(/^#/, "") : "";
|
|
878
|
-
const entry = entries(text).find((e) => isEntry(e, param));
|
|
879
|
-
const value = entry ? entry.slice(encodeURIComponent(param).length + 1) : "";
|
|
880
|
-
return value ? value : null;
|
|
881
|
-
}
|
|
882
|
-
function withLinkParam(url, param, encoded) {
|
|
883
|
-
const at = url.indexOf("#");
|
|
884
|
-
const base = at === -1 ? url : url.slice(0, at);
|
|
885
|
-
const kept = entries(at === -1 ? "" : url.slice(at + 1)).filter((e) => !isEntry(e, param));
|
|
886
|
-
const next = encoded ? [...kept, `${encodeURIComponent(param)}=${encoded}`] : kept;
|
|
887
|
-
return next.length ? `${base}#${next.join("&")}` : base;
|
|
888
|
-
}
|
|
889
|
-
function shareBase(shareLink, here2) {
|
|
890
|
-
if (shareLink === true) {
|
|
891
|
-
if (!here2) {
|
|
892
|
-
return null;
|
|
893
|
-
}
|
|
894
|
-
try {
|
|
895
|
-
const url = new URL(here2);
|
|
896
|
-
return `${url.origin}${url.pathname}${url.hash}`;
|
|
897
|
-
} catch {
|
|
898
|
-
return null;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
return typeof shareLink === "string" && shareLink.trim() ? shareLink.trim() : null;
|
|
902
|
-
}
|
|
903
|
-
var viewStorageName = (key) => `pivotkit:view:${key ?? ""}`;
|
|
904
|
-
function readStoredView(key, storage) {
|
|
905
|
-
if (!storage) {
|
|
906
|
-
return null;
|
|
907
|
-
}
|
|
908
|
-
try {
|
|
909
|
-
return storage.getItem(viewStorageName(key));
|
|
910
|
-
} catch {
|
|
911
|
-
return null;
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
function writeStoredView(key, storage, view) {
|
|
915
|
-
if (!storage) {
|
|
916
|
-
return;
|
|
917
|
-
}
|
|
918
|
-
try {
|
|
919
|
-
storage.setItem(viewStorageName(key), JSON.stringify(view));
|
|
920
|
-
} catch {
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
var VIEW_TEXT_MAX = VIEW_FILE_LIMITS.text;
|
|
924
|
-
var quoteNames = (names) => {
|
|
925
|
-
const shown = names.slice(0, 5).map((n) => `\u201C${n.length > 60 ? `${n.slice(0, 59)}\u2026` : n}\u201D`).join(", ");
|
|
926
|
-
return names.length > 5 ? `${shown} \u2026` : shown;
|
|
927
|
-
};
|
|
928
|
-
var fieldOf = (message) => /^unknown field (".*")$/.exec(message)?.[1];
|
|
929
|
-
function issueLines(issues, labels) {
|
|
930
|
-
const missing = [];
|
|
931
|
-
let other = 0;
|
|
932
|
-
for (const issue of issues) {
|
|
933
|
-
if (issue.message === "unknown key") {
|
|
934
|
-
continue;
|
|
935
|
-
}
|
|
936
|
-
const quoted = fieldOf(issue.message);
|
|
937
|
-
let name;
|
|
938
|
-
try {
|
|
939
|
-
name = quoted ? JSON.parse(quoted) : null;
|
|
940
|
-
} catch {
|
|
941
|
-
name = null;
|
|
942
|
-
}
|
|
943
|
-
if (typeof name === "string") {
|
|
944
|
-
if (!missing.includes(name)) {
|
|
945
|
-
missing.push(name);
|
|
946
|
-
}
|
|
947
|
-
} else {
|
|
948
|
-
other += 1;
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
const lines = [];
|
|
952
|
-
if (missing.length) {
|
|
953
|
-
lines.push(fill(labels.viewMissingFields, { fields: quoteNames(missing) }));
|
|
954
|
-
}
|
|
955
|
-
if (other) {
|
|
956
|
-
lines.push(fill(other === 1 ? labels.viewOtherIssue : labels.viewOtherIssues, { count: other }));
|
|
957
|
-
}
|
|
958
|
-
return lines;
|
|
959
|
-
}
|
|
960
|
-
var FAILED = Object.freeze({ newerFormat: "newer", newerView: "newer" });
|
|
961
|
-
function viewFromText(text, encoded, options = {}) {
|
|
962
|
-
return viewFromObject(text, encoded, options);
|
|
963
|
-
}
|
|
964
|
-
function viewFromObject(input, encoded, options = {}) {
|
|
965
|
-
const file = fromViewFile(input, { data: encoded, sourceId: options.sourceId });
|
|
966
|
-
if (file.failed || !file.view) {
|
|
967
|
-
const failed = file.failed ?? "notView";
|
|
968
|
-
return { view: null, issues: file.issues, failed: Object.hasOwn(FAILED, failed) ? FAILED[failed] : failed, file };
|
|
969
|
-
}
|
|
970
|
-
const { view, issues } = normalize(file.view, encoded, options.limits ? { limits: options.limits } : void 0);
|
|
971
|
-
if (issues.some((i) => i.path === "version")) {
|
|
972
|
-
return { view: null, issues, failed: "newer", file };
|
|
973
|
-
}
|
|
974
|
-
return { view, issues, failed: null, file };
|
|
975
|
-
}
|
|
976
|
-
function loadCheck(loaded2, labels, sources = []) {
|
|
977
|
-
const fit = loaded2.file?.compatible;
|
|
978
|
-
if (!loaded2.view || !fit || fit.ok) {
|
|
979
|
-
return null;
|
|
980
|
-
}
|
|
981
|
-
const lines = [];
|
|
982
|
-
const fileSource = loaded2.file?.source;
|
|
983
|
-
const target = fit.source === "other" && fileSource?.id ? sources.find((s) => s && s.id === fileSource.id) : void 0;
|
|
984
|
-
if (fit.source === "other") {
|
|
985
|
-
const name = target?.name || fileSource?.name || fileSource?.id;
|
|
986
|
-
lines.push(name ? fill(labels.loadCheckSource, { source: name }) : labels.loadCheckOtherSource);
|
|
987
|
-
}
|
|
988
|
-
if (fit.missing.length) {
|
|
989
|
-
lines.push(fill(labels.loadCheckMissing, { fields: quoteNames(fit.missing) }));
|
|
990
|
-
}
|
|
991
|
-
if (fit.changed.length) {
|
|
992
|
-
lines.push(fill(labels.loadCheckChanged, { fields: quoteNames(fit.changed.map((c) => c.name)) }));
|
|
993
|
-
}
|
|
994
|
-
return { lines, switchTo: target ? { id: target.id, name: target.name || target.id } : null };
|
|
934
|
+
)) : loadingText ? /* @__PURE__ */ React4.createElement(Loading, { text: loadingText }) : null);
|
|
995
935
|
}
|
|
996
936
|
|
|
997
937
|
// src/skeleton.jsx
|
|
@@ -1004,6 +944,7 @@ function Skeleton({ text, full = false }) {
|
|
|
1004
944
|
|
|
1005
945
|
// src/table.jsx
|
|
1006
946
|
import React6, { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
947
|
+
import { fieldLabel as fieldLabel2 } from "pivotkit-core";
|
|
1007
948
|
|
|
1008
949
|
// src/virtual.js
|
|
1009
950
|
var VIRTUAL_FROM = 300;
|
|
@@ -1084,16 +1025,16 @@ function firstValueCell(grid) {
|
|
|
1084
1025
|
}
|
|
1085
1026
|
return null;
|
|
1086
1027
|
}
|
|
1087
|
-
function DraggableHeader({ cell, source, children, className, style, colSpan, rowSpan, scope, description, tooltip = true }) {
|
|
1028
|
+
function DraggableHeader({ cell, source, children, className, style, colSpan, rowSpan, scope, description, tooltip = true, sort }) {
|
|
1088
1029
|
const { setNodeRef, isDragging, itemProps } = useDragSource(`table:${source.zone}:${source.index}:${source.field ?? ""}`, source);
|
|
1089
|
-
return /* @__PURE__ */ React6.createElement("th", { ref: setNodeRef, ...itemProps, className: `${className} pk-draggable${isDragging ? " pk-dragging" : ""}`, style, colSpan, rowSpan, scope, "data-kind": cell.kind, title: tooltip ? description : void 0, "aria-description": description }, children, /* @__PURE__ */ React6.createElement(Icon, { name: "grip", size: 12, className: "pk-th-grip" }));
|
|
1030
|
+
return /* @__PURE__ */ React6.createElement("th", { ref: setNodeRef, ...itemProps, className: `${className} pk-draggable${isDragging ? " pk-dragging" : ""}`, style, colSpan, rowSpan, scope, "data-kind": cell.kind, title: tooltip ? description : void 0, "aria-description": description, "aria-sort": sort ?? void 0 }, children, /* @__PURE__ */ React6.createElement(Icon, { name: "grip", size: 12, className: "pk-th-grip" }));
|
|
1090
1031
|
}
|
|
1091
1032
|
var toggleKey = (axis, path) => `${axis}:${JSON.stringify(path)}`;
|
|
1092
1033
|
function Toggle({ toggle, text, labels, onToggle }) {
|
|
1093
1034
|
const name = fill(toggle.collapsed ? labels.expand : labels.collapse, { label: text });
|
|
1094
1035
|
return /* @__PURE__ */ React6.createElement("button", { type: "button", className: `pk-toggle${toggle.collapsed ? "" : " pk-open"}`, "aria-expanded": !toggle.collapsed, "aria-label": name, title: name, "data-pk-toggle": toggleKey(toggle.axis, toggle.path), onClick: () => onToggle(toggle.axis, toggle.path) }, /* @__PURE__ */ React6.createElement(Icon, { name: "chevronRight", size: 16 }));
|
|
1095
1036
|
}
|
|
1096
|
-
function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version, hintId, onRowLabel, infoOf, showInfo = true }) {
|
|
1037
|
+
function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version, hintId, onRowLabel, infoOf, showInfo = true, typeOf = () => void 0, hostOrdered = () => false, onSort }) {
|
|
1097
1038
|
const wrap = useRef4(
|
|
1098
1039
|
/** @type {HTMLDivElement | null} */
|
|
1099
1040
|
null
|
|
@@ -1121,6 +1062,7 @@ function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version
|
|
|
1121
1062
|
null
|
|
1122
1063
|
);
|
|
1123
1064
|
const focusNext = useRef4(false);
|
|
1065
|
+
const [sortNote, setSortNote] = useState5("");
|
|
1124
1066
|
const focusToggle = useRef4(
|
|
1125
1067
|
/** @type {string | null} */
|
|
1126
1068
|
null
|
|
@@ -1269,23 +1211,41 @@ function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version
|
|
|
1269
1211
|
}
|
|
1270
1212
|
}
|
|
1271
1213
|
};
|
|
1214
|
+
const sortButton = (cell, target) => {
|
|
1215
|
+
const state = headerSortState(view, target);
|
|
1216
|
+
const next = nextHeaderSort(view, target, hostOrdered(target.field));
|
|
1217
|
+
const field = fieldLabel2(target.field, labels.core);
|
|
1218
|
+
const words = (s) => sortText(view, s ?? { by: hostOrdered(target.field) ? "custom" : "label", order: "asc" }, labels);
|
|
1219
|
+
const down = state.chosen ? state.order === "descending" : next?.order === "desc";
|
|
1220
|
+
const click = () => {
|
|
1221
|
+
onSort?.(target.field, next);
|
|
1222
|
+
setSortNote(fill(labels.headerSorted, { field, order: words(next) }));
|
|
1223
|
+
};
|
|
1224
|
+
return {
|
|
1225
|
+
// aria-sort only on the header whose sort was chosen (a custom order too): one at a time (WAI-ARIA APG)
|
|
1226
|
+
sort: state.chosen || state.order === "other" ? state.order : null,
|
|
1227
|
+
content: /* @__PURE__ */ React6.createElement("button", { type: "button", className: `pk-th-sort${state.chosen ? " pk-sorted" : ""}`, title: target.ref && next ? fill(next.order === "desc" ? labels.headerSortDesc : labels.headerSortAsc, { value: refLabel(view, target.ref, labels) }) : fill(labels.headerSort, { field, order: words(next) }), onClick: click }, /* @__PURE__ */ React6.createElement("span", { className: "pk-th-text" }, cell.text), /* @__PURE__ */ React6.createElement(Icon, { name: down ? "arrowDown" : "arrowUp", size: 14, className: "pk-th-arrow" }))
|
|
1228
|
+
};
|
|
1229
|
+
};
|
|
1272
1230
|
const stickyStyle = (col, extra) => col < grid.rowHeaderColumns && lefts[col] !== void 0 ? { left: lefts[col], ...extra } : extra;
|
|
1273
1231
|
const headerCell = (cell, r, c) => {
|
|
1274
1232
|
const top = { top: tops[r] ?? r * rowHeight };
|
|
1275
1233
|
const sticky = c < grid.rowHeaderColumns;
|
|
1276
1234
|
const className = `pk-th pk-${cell.kind}${totalClass(cell.total)}${sticky ? " pk-sticky" : ""}`;
|
|
1277
|
-
const
|
|
1235
|
+
const target = onSort && r === grid.headerRows - 1 ? headerSortTarget(view, cell, typeOf) : null;
|
|
1236
|
+
const sorting = target ? sortButton(cell, target) : null;
|
|
1237
|
+
const content = /* @__PURE__ */ React6.createElement("span", { className: "pk-th-content" }, cell.toggle ? /* @__PURE__ */ React6.createElement(Toggle, { toggle: cell.toggle, text: cell.text, labels, onToggle }) : null, sorting ? sorting.content : /* @__PURE__ */ React6.createElement("span", { className: "pk-th-text" }, cell.text));
|
|
1278
1238
|
const props = { className, style: stickyStyle(c, top), colSpan: cell.colSpan, rowSpan: cell.rowSpan, scope: cell.kind === "colHeader" ? "col" : void 0 };
|
|
1279
1239
|
if (cell.kind === "corner" && !cell.field && !cell.text) {
|
|
1280
1240
|
return /* @__PURE__ */ React6.createElement("td", { key: c, className: `${className} pk-blank`, style: props.style, colSpan: cell.colSpan, rowSpan: cell.rowSpan });
|
|
1281
1241
|
}
|
|
1282
1242
|
if (cell.kind === "corner" && cell.field) {
|
|
1283
1243
|
const zone = view.rows.includes(cell.field) ? "rows" : "cols";
|
|
1284
|
-
return /* @__PURE__ */ React6.createElement(DraggableHeader, { key: c, ...props, cell, source: { kind: "table", field: cell.field, zone, index: view[zone].indexOf(cell.field), label: cell.text }, description: infoOf?.(cell.field)?.description, tooltip: showInfo }, content);
|
|
1244
|
+
return /* @__PURE__ */ React6.createElement(DraggableHeader, { key: c, ...props, cell, source: { kind: "table", field: cell.field, zone, index: view[zone].indexOf(cell.field), label: cell.text }, description: infoOf?.(cell.field)?.description, tooltip: showInfo, sort: sorting?.sort }, content);
|
|
1285
1245
|
}
|
|
1286
1246
|
if (cell.kind === "colHeader" && cell.valueIndex !== void 0 && r === grid.headerRows - 1) {
|
|
1287
1247
|
const spec = view.values[cell.valueIndex];
|
|
1288
|
-
return /* @__PURE__ */ React6.createElement(DraggableHeader, { key: c, ...props, cell, source: { kind: "table", field: spec?.field ?? null, zone: "values", index: cell.valueIndex, label: cell.text }, description: spec?.field ? infoOf?.(spec.field)?.description : void 0, tooltip: showInfo }, content);
|
|
1248
|
+
return /* @__PURE__ */ React6.createElement(DraggableHeader, { key: c, ...props, cell, source: { kind: "table", field: spec?.field ?? null, zone: "values", index: cell.valueIndex, label: cell.text }, description: spec?.field ? infoOf?.(spec.field)?.description : void 0, tooltip: showInfo, sort: sorting?.sort }, content);
|
|
1289
1249
|
}
|
|
1290
1250
|
return /* @__PURE__ */ React6.createElement("th", { key: c, ...props }, content);
|
|
1291
1251
|
};
|
|
@@ -1317,7 +1277,7 @@ function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version
|
|
|
1317
1277
|
);
|
|
1318
1278
|
};
|
|
1319
1279
|
const columns = grid.columnCount;
|
|
1320
|
-
return /* @__PURE__ */ React6.createElement("div", { className: "pk-table-wrap", ref: wrap, onScroll: virtual ? onScroll : void 0, onBlur: virtual ? onBlur : void 0, "data-testid": "pivot-table" }, /* @__PURE__ */ React6.createElement("table", { ref: table, className: `pk-table${virtual ? " pk-virtual" : ""}`, style: (
|
|
1280
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "pk-table-wrap", ref: wrap, onScroll: virtual ? onScroll : void 0, onBlur: virtual ? onBlur : void 0, "data-testid": "pivot-table" }, onSort ? /* @__PURE__ */ React6.createElement("span", { className: "pk-sr", role: "status", "data-testid": "sort-status" }, sortNote) : null, /* @__PURE__ */ React6.createElement("table", { ref: table, className: `pk-table${virtual ? " pk-virtual" : ""}`, style: (
|
|
1321
1281
|
/** @type {any} */
|
|
1322
1282
|
{ "--pk-row-cols": grid.rowHeaderColumns }
|
|
1323
1283
|
), onKeyDown, "aria-rowcount": grid.rows.length, "aria-label": labels.tableName, "aria-describedby": hintId }, /* @__PURE__ */ React6.createElement("thead", null, grid.rows.slice(0, grid.headerRows).map((row, r) => /* @__PURE__ */ React6.createElement("tr", { key: r }, row.map((cell, c) => cell ? headerCell(cell, r, c) : null)))), /* @__PURE__ */ React6.createElement("tbody", null, win.padTop > 0 ? /* @__PURE__ */ React6.createElement("tr", { className: "pk-spacer", "aria-hidden": "true", style: { height: win.padTop } }, /* @__PURE__ */ React6.createElement("td", { colSpan: columns })) : null, rows.map(({ index, cells }) => /* @__PURE__ */ React6.createElement("tr", { key: index, "data-r": index, "aria-rowindex": grid.headerRows + index + 1, className: totalClass(grid.bodyRows[index]?.total).trim() || void 0 }, cells.map((c) => bodyCell(c, index)))), win.padBottom > 0 ? /* @__PURE__ */ React6.createElement("tr", { className: "pk-spacer", "aria-hidden": "true", style: { height: win.padBottom } }, /* @__PURE__ */ React6.createElement("td", { colSpan: columns })) : null)));
|
|
@@ -1401,7 +1361,7 @@ function Toasts({ toasts, dismiss, pause, closeLabel }) {
|
|
|
1401
1361
|
}
|
|
1402
1362
|
|
|
1403
1363
|
// src/templates.js
|
|
1404
|
-
import { fieldDefaultsFromSchema as fieldDefaultsFromSchema2, fromViewFile
|
|
1364
|
+
import { fieldDefaultsFromSchema as fieldDefaultsFromSchema2, fromViewFile } from "pivotkit-core";
|
|
1405
1365
|
var warnedScope = false;
|
|
1406
1366
|
function plainNames(names) {
|
|
1407
1367
|
const properties = {};
|
|
@@ -1418,7 +1378,7 @@ function templateEntries(templates, stored, hostDeletes) {
|
|
|
1418
1378
|
}
|
|
1419
1379
|
let { name, view } = t;
|
|
1420
1380
|
if (t.file !== void 0 && t.file !== null) {
|
|
1421
|
-
const read =
|
|
1381
|
+
const read = fromViewFile(t.file);
|
|
1422
1382
|
view = read.view;
|
|
1423
1383
|
name = typeof name === "string" && name ? name : read.name;
|
|
1424
1384
|
}
|
|
@@ -1435,7 +1395,7 @@ function templateEntries(templates, stored, hostDeletes) {
|
|
|
1435
1395
|
const all = [...out, ...stored.map((t) => ({ name: t.name, view: t.view, scope: (
|
|
1436
1396
|
/** @type {const} */
|
|
1437
1397
|
"user"
|
|
1438
|
-
), deletable: true, at: t.at }))];
|
|
1398
|
+
), deletable: true, at: t.at, ...t.sourceId ? { sourceId: t.sourceId } : {} }))];
|
|
1439
1399
|
const names = plainNames(all.map((t) => t.name));
|
|
1440
1400
|
return all.flatMap((t, i) => names[i] ? [{ ...t, name: (
|
|
1441
1401
|
/** @type {string} */
|
|
@@ -1487,11 +1447,118 @@ function Tips({ tips, labels, onDismiss, onAction, focusFallback }) {
|
|
|
1487
1447
|
)))) : null, /* @__PURE__ */ React8.createElement("div", { className: "pk-sr", "aria-live": "polite", "data-testid": "tips-live" }, tips.map((t) => /* @__PURE__ */ React8.createElement("p", { key: t.id }, t.text))));
|
|
1488
1448
|
}
|
|
1489
1449
|
|
|
1450
|
+
// src/unused.jsx
|
|
1451
|
+
import React9, { useEffect as useEffect7, useMemo as useMemo4, useRef as useRef7, useState as useState7 } from "react";
|
|
1452
|
+
import { fieldLabel as fieldLabel3 } from "pivotkit-core";
|
|
1453
|
+
|
|
1454
|
+
// src/unused-load.js
|
|
1455
|
+
var UNUSED_TEXTS_OF = Object.freeze({ de: () => import("./chunks/unused-texts-de-OW4TGIVX.js").then((m) => m.de) });
|
|
1456
|
+
var pending2 = /* @__PURE__ */ new Map();
|
|
1457
|
+
var loaded2 = /* @__PURE__ */ new Map();
|
|
1458
|
+
var unusedNow = (lang) => loaded2.get(lang) ?? null;
|
|
1459
|
+
function loadUnused(lang) {
|
|
1460
|
+
let p = pending2.get(lang);
|
|
1461
|
+
if (!p) {
|
|
1462
|
+
const own2 = Object.hasOwn(UNUSED_TEXTS_OF, lang) ? UNUSED_TEXTS_OF[lang]().catch(() => null) : null;
|
|
1463
|
+
p = Promise.all([import("./chunks/unused-texts-K3VFH65P.js"), own2]).then(
|
|
1464
|
+
([mod, texts]) => {
|
|
1465
|
+
const out = { mod, lang: texts };
|
|
1466
|
+
loaded2.set(lang, out);
|
|
1467
|
+
return out;
|
|
1468
|
+
},
|
|
1469
|
+
(error) => {
|
|
1470
|
+
pending2.delete(lang);
|
|
1471
|
+
throw error;
|
|
1472
|
+
}
|
|
1473
|
+
);
|
|
1474
|
+
pending2.set(lang, p);
|
|
1475
|
+
}
|
|
1476
|
+
return p;
|
|
1477
|
+
}
|
|
1478
|
+
function unusedTexts(loaded3, labels) {
|
|
1479
|
+
const host = (
|
|
1480
|
+
/** @type {any} */
|
|
1481
|
+
labels[MENU_TEXTS]
|
|
1482
|
+
);
|
|
1483
|
+
return mergeLabels(mergeLabels(loaded3.mod.en, loaded3.lang), host && typeof host === "object" ? host.unused : void 0);
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
// src/unused.jsx
|
|
1487
|
+
var FIRST = { narrow: 2, wide: 3 };
|
|
1488
|
+
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1489
|
+
function Unused({ notes, notesKey, dismissed, onDismiss, labels, locale, narrow, quiet }) {
|
|
1490
|
+
const lang = labels.lang;
|
|
1491
|
+
const show = notes.length > 0 && !dismissed;
|
|
1492
|
+
const [folded, setFolded] = useState7(
|
|
1493
|
+
/** @type {string | null} */
|
|
1494
|
+
null
|
|
1495
|
+
);
|
|
1496
|
+
const [all, setAll] = useState7(
|
|
1497
|
+
/** @type {string | null} */
|
|
1498
|
+
null
|
|
1499
|
+
);
|
|
1500
|
+
const [got, setGot] = useState7(
|
|
1501
|
+
/** @type {{ lang: string, value: import("./unused-load.js").UnusedLoaded } | null} */
|
|
1502
|
+
null
|
|
1503
|
+
);
|
|
1504
|
+
const box = useRef7(
|
|
1505
|
+
/** @type {HTMLDivElement | null} */
|
|
1506
|
+
null
|
|
1507
|
+
);
|
|
1508
|
+
const now = got?.lang === lang ? got.value : unusedNow(lang);
|
|
1509
|
+
const issues = useMemo4(() => (
|
|
1510
|
+
/** @type {Array<{ issue: import("pivotkit-core").Issue, raw: unknown }>} */
|
|
1511
|
+
notes.filter((n) => "issue" in n)
|
|
1512
|
+
), [notes]);
|
|
1513
|
+
const wanted = show && issues.length > 0;
|
|
1514
|
+
useEffect7(() => {
|
|
1515
|
+
if (!wanted || now) {
|
|
1516
|
+
return void 0;
|
|
1517
|
+
}
|
|
1518
|
+
let live = true;
|
|
1519
|
+
loadUnused(lang).then(
|
|
1520
|
+
(value) => live && setGot({ lang, value }),
|
|
1521
|
+
// the core's messages stay; the next view with unused parts tries again
|
|
1522
|
+
() => void 0
|
|
1523
|
+
);
|
|
1524
|
+
return () => {
|
|
1525
|
+
live = false;
|
|
1526
|
+
};
|
|
1527
|
+
}, [wanted, now, lang, notesKey]);
|
|
1528
|
+
const plain = useMemo4(() => {
|
|
1529
|
+
if (!now || !wanted) {
|
|
1530
|
+
return null;
|
|
1531
|
+
}
|
|
1532
|
+
const ctx = { labels, fill, field: (name) => fieldLabel3(name, labels.core), value: (spec) => valueLabel(spec, labels) };
|
|
1533
|
+
return now.mod.unusedItems(issues, unusedTexts(now, labels), ctx);
|
|
1534
|
+
}, [now, wanted, issues, labels]);
|
|
1535
|
+
const title = plural(labels.unusedParts, notes.length, { lang, locale });
|
|
1536
|
+
const first = FIRST[narrow ? "narrow" : "wide"];
|
|
1537
|
+
const cut = all !== notesKey && notes.length > first + 1 ? first : notes.length;
|
|
1538
|
+
const dismiss = () => {
|
|
1539
|
+
const el = box.current;
|
|
1540
|
+
const root = el?.closest(".pk-root");
|
|
1541
|
+
const next = el && root ? [...root.querySelectorAll(FOCUSABLE)].find((c) => !el.contains(c) && el.compareDocumentPosition(c) & Node.DOCUMENT_POSITION_FOLLOWING) : null;
|
|
1542
|
+
onDismiss(
|
|
1543
|
+
/** @type {HTMLElement | null} */
|
|
1544
|
+
next ?? null
|
|
1545
|
+
);
|
|
1546
|
+
};
|
|
1547
|
+
const lineOf = new Map(plain ? issues.map((n, i) => [n, plain[i]]) : []);
|
|
1548
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, show ? /* @__PURE__ */ React9.createElement("div", { className: "pk-note pk-issues", "data-testid": "view-issues", ref: box }, /* @__PURE__ */ React9.createElement(Icon, { name: "warn", size: 16 }), /* @__PURE__ */ React9.createElement("details", { open: folded !== notesKey, onToggle: (e) => setFolded(e.currentTarget.open ? null : notesKey) }, /* @__PURE__ */ React9.createElement("summary", { "data-testid": "unused-title" }, title), /* @__PURE__ */ React9.createElement("ul", null, notes.slice(0, cut).map((n, i) => {
|
|
1549
|
+
if (!("issue" in n)) {
|
|
1550
|
+
return /* @__PURE__ */ React9.createElement("li", { key: i }, n.text);
|
|
1551
|
+
}
|
|
1552
|
+
const line = lineOf.get(n);
|
|
1553
|
+
return /* @__PURE__ */ React9.createElement("li", { key: i, "data-testid": "unused-item" }, line ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, line.pre, /* @__PURE__ */ React9.createElement("strong", null, line.subject), line.post) : n.issue.message, n.issue.path || line ? /* @__PURE__ */ React9.createElement("small", { className: "pk-issues-path", "data-testid": "unused-path" }, labels.unusedPath, " ", /* @__PURE__ */ React9.createElement("code", null, n.issue.path), line ? ` \xB7 ${n.issue.message}` : null) : null);
|
|
1554
|
+
})), notes.length > first + 1 ? /* @__PURE__ */ React9.createElement("button", { type: "button", className: "pk-btn pk-small-btn pk-issues-more", onClick: () => setAll(all === notesKey ? null : notesKey), "data-testid": "unused-more" }, cut < notes.length ? plural(labels.unusedMore, notes.length - cut, { lang, locale }) : labels.unusedFewer) : null), /* @__PURE__ */ React9.createElement("button", { type: "button", className: "pk-icon-btn pk-issues-x", "aria-label": labels.dismissIssues, title: labels.dismissIssues, onClick: dismiss, "data-testid": "dismiss-issues" }, /* @__PURE__ */ React9.createElement(Icon, { name: "x", size: 14 }))) : null, /* @__PURE__ */ React9.createElement("div", { className: "pk-sr", "aria-live": "polite", "data-testid": "unused-live" }, show && !quiet ? title : null));
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1490
1557
|
// src/toolbar.jsx
|
|
1491
|
-
import
|
|
1558
|
+
import React10, { useCallback as useCallback4, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef8, useState as useState8 } from "react";
|
|
1492
1559
|
|
|
1493
1560
|
// src/overflow.js
|
|
1494
|
-
var OVERFLOW_ORDER = Object.freeze(["reset", "layout", "
|
|
1561
|
+
var OVERFLOW_ORDER = Object.freeze(["reset", "layout", "options", "chartType", "views"]);
|
|
1495
1562
|
var TOOLBAR_ROOM = Object.freeze({
|
|
1496
1563
|
// measured in Chromium at the playground's font: the longer of English and German with the gap
|
|
1497
1564
|
// after it, plus 2 %; a wider font still fits, as useOverflow measures as well
|
|
@@ -1558,7 +1625,7 @@ function overflowLevel(width, narrow, room = TOOLBAR_ROOM) {
|
|
|
1558
1625
|
|
|
1559
1626
|
// src/toolbar.jsx
|
|
1560
1627
|
function TextButton({ icon, label, onClick, disabled, testId, shortcut }) {
|
|
1561
|
-
return /* @__PURE__ */
|
|
1628
|
+
return /* @__PURE__ */ React10.createElement("button", { type: "button", className: "pk-btn", onClick, disabled, title: shortcut ? `${label} (${shortcut})` : void 0, "aria-keyshortcuts": shortcut ? shortcut.replace("\u2318", "Meta+").replace("\u21E7", "Shift+") : void 0, "data-testid": testId }, /* @__PURE__ */ React10.createElement(Icon, { name: icon }), /* @__PURE__ */ React10.createElement("span", { className: "pk-btn-text" }, label));
|
|
1562
1629
|
}
|
|
1563
1630
|
var measuring;
|
|
1564
1631
|
var fontOf = (style) => `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;
|
|
@@ -1610,10 +1677,10 @@ function measuredRoom(el, texts) {
|
|
|
1610
1677
|
return toolbarRoom(texts, measure, chrome);
|
|
1611
1678
|
}
|
|
1612
1679
|
function useOverflow(ref, key, narrow, max, texts) {
|
|
1613
|
-
const [level, setLevel] =
|
|
1614
|
-
const [measure, setMeasure] =
|
|
1615
|
-
const [lastKey, setLastKey] =
|
|
1616
|
-
const latest =
|
|
1680
|
+
const [level, setLevel] = useState8(0);
|
|
1681
|
+
const [measure, setMeasure] = useState8(0);
|
|
1682
|
+
const [lastKey, setLastKey] = useState8(key);
|
|
1683
|
+
const latest = useRef8(texts);
|
|
1617
1684
|
useIsoLayoutEffect(() => {
|
|
1618
1685
|
latest.current = texts;
|
|
1619
1686
|
});
|
|
@@ -1659,26 +1726,26 @@ function useOverflow(ref, key, narrow, max, texts) {
|
|
|
1659
1726
|
return level;
|
|
1660
1727
|
}
|
|
1661
1728
|
function Toolbar(props) {
|
|
1662
|
-
const { view, labels, size, canUndo, canRedo, canReset, onUndo, onRedo, onReset, onDisplay, onChart, onChartDisplay, onTotal, onExpand, onCollapse, folding, templates, onLoadTemplate, templateActions, onExport, chartReady, onShowFields, layoutFolded, onLayout, zonesId, share } = props;
|
|
1729
|
+
const { view, labels, size, canUndo, canRedo, canReset, onUndo, onRedo, onReset, loadedView, empty, onDisplay, onChart, onChartDisplay, onTotal, onExpand, onCollapse, folding, templates, onLoadTemplate, templateActions, onExport, chartReady, onShowFields, layoutFolded, onLayout, zonesId, share } = props;
|
|
1663
1730
|
const tips = { controls: props.tipsControls, on: props.tipsOn, onOn: props.onTipsOn, canReset: props.canResetTips, onReset: props.onResetTips };
|
|
1664
|
-
const bar =
|
|
1731
|
+
const bar = useRef8(
|
|
1665
1732
|
/** @type {HTMLDivElement | null} */
|
|
1666
1733
|
null
|
|
1667
1734
|
);
|
|
1668
|
-
const more =
|
|
1735
|
+
const more = useRef8(
|
|
1669
1736
|
/** @type {HTMLButtonElement | null} */
|
|
1670
1737
|
null
|
|
1671
1738
|
);
|
|
1672
|
-
const viewsButton =
|
|
1739
|
+
const viewsButton = useRef8(
|
|
1673
1740
|
/** @type {HTMLButtonElement | null} */
|
|
1674
1741
|
null
|
|
1675
1742
|
);
|
|
1676
|
-
const [panel, setPanel] =
|
|
1743
|
+
const [panel, setPanel] = useState8(
|
|
1677
1744
|
/** @type {"options" | "views" | "chartType" | null} */
|
|
1678
1745
|
null
|
|
1679
1746
|
);
|
|
1680
1747
|
const order = OVERFLOW_ORDER;
|
|
1681
|
-
const texts =
|
|
1748
|
+
const texts = useMemo5(() => toolbarTexts([LABELS.en, LABELS.de, labels]), [labels]);
|
|
1682
1749
|
const level = useOverflow(bar, `${labels.lang}:${labels.undo}:${size}`, size === "narrow", order.length, texts);
|
|
1683
1750
|
const hidden = new Set(order.slice(0, level));
|
|
1684
1751
|
if (panel && !hidden.has(panel)) {
|
|
@@ -1686,8 +1753,8 @@ function Toolbar(props) {
|
|
|
1686
1753
|
}
|
|
1687
1754
|
const closePanel = useCallback4(() => setPanel(null), []);
|
|
1688
1755
|
const request = props.viewsRequest ?? 0;
|
|
1689
|
-
const [seenRequest, setSeenRequest] =
|
|
1690
|
-
const [clickFor, setClickFor] =
|
|
1756
|
+
const [seenRequest, setSeenRequest] = useState8(request);
|
|
1757
|
+
const [clickFor, setClickFor] = useState8(0);
|
|
1691
1758
|
if (request !== seenRequest) {
|
|
1692
1759
|
setSeenRequest(request);
|
|
1693
1760
|
if (hidden.has("views")) {
|
|
@@ -1696,7 +1763,7 @@ function Toolbar(props) {
|
|
|
1696
1763
|
setClickFor(request);
|
|
1697
1764
|
}
|
|
1698
1765
|
}
|
|
1699
|
-
|
|
1766
|
+
useEffect8(() => {
|
|
1700
1767
|
const button = viewsButton.current;
|
|
1701
1768
|
if (clickFor > 0 && button && button.getAttribute("aria-expanded") !== "true") {
|
|
1702
1769
|
button.click();
|
|
@@ -1709,23 +1776,23 @@ function Toolbar(props) {
|
|
|
1709
1776
|
const chartTypeText = fill(labels.chartTypeIs, { type: labels.chartTypes[preset] });
|
|
1710
1777
|
const panels = {
|
|
1711
1778
|
// the panels load with the chip menus (menus.js), on demand
|
|
1712
|
-
options: (close) => /* @__PURE__ */
|
|
1713
|
-
views: (close) => /* @__PURE__ */
|
|
1714
|
-
chartType: (close) => /* @__PURE__ */
|
|
1779
|
+
options: (close) => /* @__PURE__ */ React10.createElement(MenuPanel, { name: "OptionsPanel", loadingText: labels.loadingMenu, props: { view, labels, onTotal, onExpand, onCollapse, close, tips, mod, folding, help: props.help } }),
|
|
1780
|
+
views: (close) => /* @__PURE__ */ React10.createElement(MenuPanel, { name: "ViewsPanel", loadingText: labels.loadingMenu, props: { templates, labels, onLoad: onLoadTemplate, actions: templateActions, close, share } }),
|
|
1781
|
+
chartType: (close) => /* @__PURE__ */ React10.createElement(MenuPanel, { name: "ChartTypePanel", loadingText: labels.loadingMenu, props: { view, plan, labels, onChart, onDisplay: onChartDisplay, close } })
|
|
1715
1782
|
};
|
|
1716
1783
|
const actions = {
|
|
1717
1784
|
chartType: {
|
|
1718
1785
|
place: "chart",
|
|
1719
|
-
button: () => /* @__PURE__ */
|
|
1720
|
-
entry: (close) => /* @__PURE__ */
|
|
1786
|
+
button: () => /* @__PURE__ */ React10.createElement(MenuButton, { key: "chartType", label: chartTypeText, name: chartTypeText, title: chartTypeText, icon: drawnIcon, text: labels.chartTypes[preset], role: "dialog", testId: "chart-type", popoverClass: "pk-chart-menu" }, panels.chartType),
|
|
1787
|
+
entry: (close) => /* @__PURE__ */ React10.createElement(Option, { key: "chartType", inMenu: true, icon: drawnIcon, onSelect: () => {
|
|
1721
1788
|
close();
|
|
1722
1789
|
setPanel("chartType");
|
|
1723
1790
|
}, testId: "more-chart-type" }, `${chartTypeText}\u2026`)
|
|
1724
1791
|
},
|
|
1725
1792
|
reset: {
|
|
1726
1793
|
place: "history",
|
|
1727
|
-
button: () => /* @__PURE__ */
|
|
1728
|
-
entry: (close) => /* @__PURE__ */
|
|
1794
|
+
button: () => /* @__PURE__ */ React10.createElement(TextButton, { key: "reset", icon: "reset", label: labels.reset, onClick: onReset, disabled: !canReset, testId: "reset" }),
|
|
1795
|
+
entry: (close) => /* @__PURE__ */ React10.createElement(Option, { key: "reset", inMenu: true, icon: "reset", disabled: !canReset, onSelect: () => {
|
|
1729
1796
|
close();
|
|
1730
1797
|
onReset();
|
|
1731
1798
|
}, testId: "more-reset" }, labels.reset)
|
|
@@ -1733,24 +1800,24 @@ function Toolbar(props) {
|
|
|
1733
1800
|
layout: {
|
|
1734
1801
|
place: "end",
|
|
1735
1802
|
// a toggle of the zones: the same text, open or folded; aria-pressed says which
|
|
1736
|
-
button: () => /* @__PURE__ */
|
|
1737
|
-
entry: (close) => /* @__PURE__ */
|
|
1803
|
+
button: () => /* @__PURE__ */ React10.createElement("button", { key: "layout", type: "button", className: "pk-btn pk-pressable", onClick: onLayout, "aria-pressed": !layoutFolded, "aria-controls": zonesId, title: labels.showLayout, "data-testid": "layout" }, /* @__PURE__ */ React10.createElement(Icon, { name: "layout" }), /* @__PURE__ */ React10.createElement("span", { className: "pk-btn-text" }, labels.layout)),
|
|
1804
|
+
entry: (close) => /* @__PURE__ */ React10.createElement(Option, { key: "layout", inMenu: true, icon: "layout", checked: !layoutFolded, onSelect: () => {
|
|
1738
1805
|
close();
|
|
1739
1806
|
onLayout();
|
|
1740
1807
|
}, testId: "more-layout" }, labels.layout)
|
|
1741
1808
|
},
|
|
1742
1809
|
options: {
|
|
1743
1810
|
place: "end",
|
|
1744
|
-
button: () => /* @__PURE__ */
|
|
1745
|
-
entry: (close) => /* @__PURE__ */
|
|
1811
|
+
button: () => /* @__PURE__ */ React10.createElement(MenuButton, { key: "options", label: labels.options, icon: "sliders", text: labels.options, role: "dialog", align: "end", testId: "options" }, panels.options),
|
|
1812
|
+
entry: (close) => /* @__PURE__ */ React10.createElement(Option, { key: "options", inMenu: true, icon: "sliders", onSelect: () => {
|
|
1746
1813
|
close();
|
|
1747
1814
|
setPanel("options");
|
|
1748
1815
|
}, testId: "more-options" }, `${labels.options}\u2026`)
|
|
1749
1816
|
},
|
|
1750
1817
|
views: {
|
|
1751
1818
|
place: "end",
|
|
1752
|
-
button: () => /* @__PURE__ */
|
|
1753
|
-
entry: (close) => /* @__PURE__ */
|
|
1819
|
+
button: () => /* @__PURE__ */ React10.createElement(MenuButton, { key: "views", label: labels.views, icon: "bookmark", text: labels.views, role: "dialog", align: "end", testId: "views", buttonRef: viewsButton }, panels.views),
|
|
1820
|
+
entry: (close) => /* @__PURE__ */ React10.createElement(Option, { key: "views", inMenu: true, icon: "bookmark", onSelect: () => {
|
|
1754
1821
|
close();
|
|
1755
1822
|
setPanel("views");
|
|
1756
1823
|
}, testId: "more-views" }, `${labels.views}\u2026`)
|
|
@@ -1758,17 +1825,36 @@ function Toolbar(props) {
|
|
|
1758
1825
|
};
|
|
1759
1826
|
const ORDER = Object.keys(actions);
|
|
1760
1827
|
const buttons = (place) => ORDER.filter((id) => actions[id].place === place && !hidden.has(id)).map((id) => actions[id].button());
|
|
1761
|
-
|
|
1828
|
+
const changedMark = (testId) => /* @__PURE__ */ React10.createElement("span", { className: "pk-view-changed", "data-testid": testId }, /* @__PURE__ */ React10.createElement("span", { className: "pk-sr" }, labels.unsavedChanges));
|
|
1829
|
+
const name = loadedView ? /* @__PURE__ */ React10.createElement(
|
|
1830
|
+
"button",
|
|
1831
|
+
{
|
|
1832
|
+
key: "name",
|
|
1833
|
+
type: "button",
|
|
1834
|
+
className: "pk-view-name",
|
|
1835
|
+
"aria-haspopup": "dialog",
|
|
1836
|
+
title: loadedView.changed ? `${loadedView.name} (${labels.unsavedChanges})` : loadedView.name,
|
|
1837
|
+
onClick: () => hidden.has("views") ? setPanel("views") : viewsButton.current?.click(),
|
|
1838
|
+
"data-testid": "view-name"
|
|
1839
|
+
},
|
|
1840
|
+
/* @__PURE__ */ React10.createElement("span", { className: "pk-view-name-text" }, loadedView.name),
|
|
1841
|
+
loadedView.changed ? changedMark("view-changed") : null
|
|
1842
|
+
) : null;
|
|
1843
|
+
const end = buttons("end");
|
|
1844
|
+
const at = hidden.has("views") ? end.length : end.length - 1;
|
|
1845
|
+
const wrap = level >= order.length;
|
|
1846
|
+
return /* @__PURE__ */ React10.createElement("div", { className: `pk-toolbar${wrap ? " pk-wrap" : ""}`, role: "toolbar", "aria-label": labels.toolbar, ref: bar, "data-overflow": level }, size === "narrow" ? /* @__PURE__ */ React10.createElement("button", { type: "button", className: "pk-btn", onClick: onShowFields, "data-testid": "show-fields", "data-pk-opener": "fields" }, /* @__PURE__ */ React10.createElement(Icon, { name: "panel" }), /* @__PURE__ */ React10.createElement("span", { className: "pk-btn-text" }, labels.showFields)) : null, /* @__PURE__ */ React10.createElement("div", { className: "pk-segmented", role: "group", "aria-label": labels.view }, /* @__PURE__ */ React10.createElement("button", { type: "button", "aria-pressed": view.display === "table", onClick: () => onDisplay("table"), "data-testid": "show-table" }, /* @__PURE__ */ React10.createElement(Icon, { name: "table" }), /* @__PURE__ */ React10.createElement("span", null, labels.table)), /* @__PURE__ */ React10.createElement("button", { type: "button", "aria-pressed": view.display === "chart", onClick: () => onDisplay("chart"), "data-testid": "show-chart" }, /* @__PURE__ */ React10.createElement(Icon, { name: (
|
|
1762
1847
|
/** @type {any} */
|
|
1763
1848
|
drawnIcon
|
|
1764
|
-
) }), /* @__PURE__ */
|
|
1849
|
+
) }), /* @__PURE__ */ React10.createElement("span", null, labels.chart))), buttons("chart"), /* @__PURE__ */ React10.createElement("span", { className: "pk-sep", "aria-hidden": "true" }), /* @__PURE__ */ React10.createElement("span", { className: "pk-toolbar-pair" }, /* @__PURE__ */ React10.createElement(TextButton, { icon: "undo", label: labels.undo, onClick: onUndo, disabled: !canUndo, testId: "undo", shortcut: `${mod}Z` }), /* @__PURE__ */ React10.createElement(TextButton, { icon: "redo", label: labels.redo, onClick: onRedo, disabled: !canRedo, testId: "redo", shortcut: `${mod}\u21E7Z` })), buttons("history"), /* @__PURE__ */ React10.createElement("span", { className: "pk-grow" }), end.slice(0, at), wrap ? null : name, end.slice(at), /* @__PURE__ */ React10.createElement(MenuButton, { label: labels.exportLabel, icon: "download", text: labels.exportLabel, role: "dialog", align: "end", testId: "export" }, (close) => /* @__PURE__ */ React10.createElement(MenuPanel, { name: "ExportPanel", loadingText: labels.loadingMenu, props: { labels, onExport, chartReady, display: view.display, empty, prepare: props.prepareExport, close } })), level > 0 ? /* @__PURE__ */ React10.createElement(MenuButton, { label: labels.more, icon: "more", text: labels.more, align: "end", testId: "more", buttonRef: more, mark: hidden.has("views") && loadedView?.changed ? changedMark("more-changed") : null }, (close) => ORDER.filter((id) => hidden.has(id)).map((id) => actions[id].entry(close))) : null, wrap ? name : null, panel ? /* @__PURE__ */ React10.createElement(Popover, { open: true, anchor: more, onClose: closePanel, label: panel === "chartType" ? chartTypeText : panel === "views" ? labels.views : labels.options, role: "dialog", align: "end", className: panel === "chartType" ? "pk-chart-menu" : void 0 }, panels[panel](closePanel)) : null);
|
|
1765
1850
|
}
|
|
1766
1851
|
|
|
1767
1852
|
// src/use-export.js
|
|
1768
1853
|
function useExport(context) {
|
|
1769
1854
|
return async (kind) => {
|
|
1770
1855
|
try {
|
|
1771
|
-
const
|
|
1856
|
+
const lang = context.labels.lang;
|
|
1857
|
+
const menus = menusNow(lang) ?? await loadMenus(lang);
|
|
1772
1858
|
await menus.runExport(kind, context);
|
|
1773
1859
|
} catch (e) {
|
|
1774
1860
|
context.announce(fill(context.labels.toastExportFailed, { message: messageOf(e) }), { tone: "error" });
|
|
@@ -1823,13 +1909,14 @@ function useResolvedTheme(wanted, ref) {
|
|
|
1823
1909
|
}
|
|
1824
1910
|
|
|
1825
1911
|
// src/use-view-history.js
|
|
1826
|
-
import { useCallback as useCallback6, useMemo as
|
|
1827
|
-
import { emptyView, normalize
|
|
1912
|
+
import { useCallback as useCallback6, useMemo as useMemo6, useState as useState9 } from "react";
|
|
1913
|
+
import { emptyView, normalize } from "pivotkit-core";
|
|
1828
1914
|
|
|
1829
1915
|
// src/view-history.js
|
|
1916
|
+
var tagFor = (tag, sourceId) => tag && tag.sourceId === sourceId ? tag : null;
|
|
1830
1917
|
var HISTORY_LIMIT = 100;
|
|
1831
|
-
function createState(schema, start, current = start) {
|
|
1832
|
-
return { schema, start, present: current, past: [], future: [] };
|
|
1918
|
+
function createState(schema, start, current = start, tag = null) {
|
|
1919
|
+
return { schema, start, present: current, past: [], future: [], tag };
|
|
1833
1920
|
}
|
|
1834
1921
|
function settle(state, at) {
|
|
1835
1922
|
let s = state.schema === at.schema ? state : createState(at.schema, at.start, at.shown);
|
|
@@ -1838,12 +1925,12 @@ function settle(state, at) {
|
|
|
1838
1925
|
}
|
|
1839
1926
|
return s;
|
|
1840
1927
|
}
|
|
1841
|
-
function record(state, view, note) {
|
|
1928
|
+
function record(state, view, note, tag = state.tag) {
|
|
1842
1929
|
if (view === state.present) {
|
|
1843
|
-
return state;
|
|
1930
|
+
return tag === state.tag ? state : { ...state, tag };
|
|
1844
1931
|
}
|
|
1845
|
-
const past = [...state.past, { view: state.present, note }].slice(-HISTORY_LIMIT);
|
|
1846
|
-
return { ...state, present: view, past, future: [] };
|
|
1932
|
+
const past = [...state.past, { view: state.present, note, tag: state.tag }].slice(-HISTORY_LIMIT);
|
|
1933
|
+
return { ...state, present: view, past, future: [], tag };
|
|
1847
1934
|
}
|
|
1848
1935
|
function undo(state) {
|
|
1849
1936
|
const last = state.past[state.past.length - 1];
|
|
@@ -1851,7 +1938,7 @@ function undo(state) {
|
|
|
1851
1938
|
return { state, note: null };
|
|
1852
1939
|
}
|
|
1853
1940
|
return {
|
|
1854
|
-
state: { ...state, present: last.view, past: state.past.slice(0, -1), future: [...state.future, { view: state.present, note: last.note }] },
|
|
1941
|
+
state: { ...state, present: last.view, tag: last.tag, past: state.past.slice(0, -1), future: [...state.future, { view: state.present, note: last.note, tag: state.tag }] },
|
|
1855
1942
|
note: last.note
|
|
1856
1943
|
};
|
|
1857
1944
|
}
|
|
@@ -1861,12 +1948,12 @@ function redo(state) {
|
|
|
1861
1948
|
return { state, note: null };
|
|
1862
1949
|
}
|
|
1863
1950
|
return {
|
|
1864
|
-
state: { ...state, present: next.view, future: state.future.slice(0, -1), past: [...state.past, { view: state.present, note: next.note }] },
|
|
1951
|
+
state: { ...state, present: next.view, tag: next.tag, future: state.future.slice(0, -1), past: [...state.past, { view: state.present, note: next.note, tag: state.tag }] },
|
|
1865
1952
|
note: next.note
|
|
1866
1953
|
};
|
|
1867
1954
|
}
|
|
1868
1955
|
function reset(state, note) {
|
|
1869
|
-
return record(state, state.start, note);
|
|
1956
|
+
return record(state, state.start, note, null);
|
|
1870
1957
|
}
|
|
1871
1958
|
|
|
1872
1959
|
// src/use-view-history.js
|
|
@@ -1875,30 +1962,30 @@ function schemaKeyOf(encoded) {
|
|
|
1875
1962
|
}
|
|
1876
1963
|
function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outsideNote, orderOf }) {
|
|
1877
1964
|
const controlled = view !== void 0;
|
|
1878
|
-
const schema =
|
|
1965
|
+
const schema = useMemo6(() => schemaKeyOf(encoded), [encoded]);
|
|
1879
1966
|
const json = useCallback6(
|
|
1880
1967
|
(v) => {
|
|
1881
|
-
const normalized =
|
|
1968
|
+
const normalized = normalize(v ?? emptyView(), encoded, { limits }).view;
|
|
1882
1969
|
const ordered = orderOf ? withHostOrders(normalized, orderOf) : normalized;
|
|
1883
|
-
return JSON.stringify(ordered === normalized ? normalized :
|
|
1970
|
+
return JSON.stringify(ordered === normalized ? normalized : normalize(ordered, encoded, { limits }).view);
|
|
1884
1971
|
},
|
|
1885
1972
|
[encoded, limits, orderOf]
|
|
1886
1973
|
);
|
|
1887
|
-
const [initial] =
|
|
1888
|
-
const start =
|
|
1889
|
-
const [state, setState] =
|
|
1974
|
+
const [initial] = useState9(() => (controlled ? view : defaultView) ?? null);
|
|
1975
|
+
const start = useMemo6(() => json(initial), [json, initial]);
|
|
1976
|
+
const [state, setState] = useState9(() => createState(schema, start));
|
|
1890
1977
|
const viewKey = controlled ? JSON.stringify(view) : null;
|
|
1891
|
-
const shown =
|
|
1978
|
+
const shown = useMemo6(() => {
|
|
1892
1979
|
if (viewKey !== null) {
|
|
1893
1980
|
return json(JSON.parse(viewKey));
|
|
1894
1981
|
}
|
|
1895
1982
|
return state.schema === schema ? state.present : json(JSON.parse(state.present));
|
|
1896
1983
|
}, [viewKey, json, state, schema]);
|
|
1897
|
-
const current =
|
|
1984
|
+
const current = useMemo6(() => (
|
|
1898
1985
|
/** @type {import("pivotkit-core").View} */
|
|
1899
1986
|
JSON.parse(shown)
|
|
1900
1987
|
), [shown]);
|
|
1901
|
-
const live =
|
|
1988
|
+
const live = useMemo6(() => settle(state, { schema, start, shown, outside: outsideNote }), [state, schema, start, shown, outsideNote]);
|
|
1902
1989
|
const apply = useCallback6(
|
|
1903
1990
|
(next) => {
|
|
1904
1991
|
setState(next);
|
|
@@ -1907,9 +1994,12 @@ function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outs
|
|
|
1907
1994
|
[onViewChange]
|
|
1908
1995
|
);
|
|
1909
1996
|
const commit = useCallback6(
|
|
1910
|
-
(next, note) => {
|
|
1911
|
-
const s = record(live, json(next), note);
|
|
1912
|
-
if (s === live) {
|
|
1997
|
+
(next, note, tag) => {
|
|
1998
|
+
const s = record(live, json(next), note, tag === void 0 ? live.tag : tag);
|
|
1999
|
+
if (s.present === live.present) {
|
|
2000
|
+
if (s !== live) {
|
|
2001
|
+
setState(s);
|
|
2002
|
+
}
|
|
1913
2003
|
return false;
|
|
1914
2004
|
}
|
|
1915
2005
|
apply(s);
|
|
@@ -1917,6 +2007,7 @@ function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outs
|
|
|
1917
2007
|
},
|
|
1918
2008
|
[live, json, apply]
|
|
1919
2009
|
);
|
|
2010
|
+
const setTag = useCallback6((tag) => setState((s) => ({ ...s, tag })), []);
|
|
1920
2011
|
const undo2 = useCallback6(() => {
|
|
1921
2012
|
const { state: s, note } = undo(live);
|
|
1922
2013
|
if (note !== null) {
|
|
@@ -1934,34 +2025,37 @@ function useViewHistory({ encoded, view, defaultView, onViewChange, limits, outs
|
|
|
1934
2025
|
const reset2 = useCallback6(
|
|
1935
2026
|
(note) => {
|
|
1936
2027
|
const s = reset(live, note);
|
|
1937
|
-
if (s !== live) {
|
|
2028
|
+
if (s.present !== live.present) {
|
|
1938
2029
|
apply(s);
|
|
2030
|
+
} else if (s !== live) {
|
|
2031
|
+
setState(s);
|
|
1939
2032
|
}
|
|
1940
2033
|
},
|
|
1941
2034
|
[live, apply]
|
|
1942
2035
|
);
|
|
1943
|
-
const restore = useCallback6((next) => apply(createState(schema, start, json(next))), [schema, start, json, apply]);
|
|
2036
|
+
const restore = useCallback6((next, tag = null) => apply(createState(schema, start, json(next), tag)), [schema, start, json, apply]);
|
|
2037
|
+
const earlier = useCallback6(() => live.past.map((p) => JSON.parse(p.view)), [live.past]);
|
|
1944
2038
|
const canUndo = live.past.length > 0;
|
|
1945
2039
|
const canRedo = live.future.length > 0;
|
|
1946
2040
|
const canReset = live.present !== live.start;
|
|
1947
|
-
return
|
|
1948
|
-
() => ({ view: current, viewKey: shown, commit, undo: undo2, redo: redo2, reset: reset2, restore, canUndo, canRedo, canReset }),
|
|
1949
|
-
[current, shown, commit, undo2, redo2, reset2, restore, canUndo, canRedo, canReset]
|
|
2041
|
+
return useMemo6(
|
|
2042
|
+
() => ({ view: current, viewKey: shown, tag: live.tag, setTag, commit, undo: undo2, redo: redo2, reset: reset2, restore, keyOf: json, earlier, canUndo, canRedo, canReset }),
|
|
2043
|
+
[current, shown, live.tag, setTag, commit, undo2, redo2, reset2, restore, json, earlier, canUndo, canRedo, canReset]
|
|
1950
2044
|
);
|
|
1951
2045
|
}
|
|
1952
2046
|
|
|
1953
2047
|
// src/use-big-result.js
|
|
1954
|
-
import { useCallback as useCallback7, useEffect as
|
|
2048
|
+
import { useCallback as useCallback7, useEffect as useEffect9, useRef as useRef9, useState as useState10, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
1955
2049
|
function fullScreenSupported() {
|
|
1956
2050
|
return typeof document !== "undefined" && Boolean(document.fullscreenEnabled) && typeof HTMLElement !== "undefined" && typeof HTMLElement.prototype.requestFullscreen === "function";
|
|
1957
2051
|
}
|
|
1958
2052
|
var never = () => () => {
|
|
1959
2053
|
};
|
|
1960
2054
|
function useBigResult(root) {
|
|
1961
|
-
const [enlarged, setEnlarged] =
|
|
1962
|
-
const [full, setFull] =
|
|
2055
|
+
const [enlarged, setEnlarged] = useState10(false);
|
|
2056
|
+
const [full, setFull] = useState10(false);
|
|
1963
2057
|
const fullOk = useSyncExternalStore2(never, fullScreenSupported, () => false);
|
|
1964
|
-
|
|
2058
|
+
useEffect9(() => {
|
|
1965
2059
|
const el = root.current;
|
|
1966
2060
|
if (!el) {
|
|
1967
2061
|
return void 0;
|
|
@@ -1992,7 +2086,7 @@ function useBigResult(root) {
|
|
|
1992
2086
|
return { enlarged, setEnlarged, toggleEnlarged, full, fullOk, toggleFull };
|
|
1993
2087
|
}
|
|
1994
2088
|
function useFitHeight(root, main, grow) {
|
|
1995
|
-
const fit =
|
|
2089
|
+
const fit = useRef9({ need: 0, open: 0, grow });
|
|
1996
2090
|
useIsoLayoutEffect(() => {
|
|
1997
2091
|
fit.current.grow = grow;
|
|
1998
2092
|
measureFit(root.current, main.current, fit);
|
|
@@ -2035,26 +2129,25 @@ function measureFit(el, m, fit) {
|
|
|
2035
2129
|
}
|
|
2036
2130
|
}
|
|
2037
2131
|
|
|
2038
|
-
// src/version.js
|
|
2039
|
-
var VERSION = true ? "0.1.0" : "0.0.0-source";
|
|
2040
|
-
|
|
2041
2132
|
// src/zones.jsx
|
|
2042
|
-
import
|
|
2043
|
-
import { fieldItems, fieldLabel as
|
|
2044
|
-
function fieldState(view, field, encoded, locale) {
|
|
2133
|
+
import React11, { useCallback as useCallback8, useEffect as useEffect10, useMemo as useMemo7, useRef as useRef10, useState as useState11 } from "react";
|
|
2134
|
+
import { fieldItems, fieldLabel as fieldLabel4 } from "pivotkit-core";
|
|
2135
|
+
function fieldState(view, field, encoded, locale, labels, sourceType) {
|
|
2045
2136
|
const items = filtersOf(view, field, ["include", "exclude"]).filter((f) => f.type === "include" || f.items.length > 0);
|
|
2137
|
+
const compared = filtersOf(view, field, ["compare"]);
|
|
2138
|
+
const info = items.length || compared.length ? fieldItems(encoded, field, { view, locale }) : null;
|
|
2046
2139
|
let summary = null;
|
|
2047
|
-
if (items.length) {
|
|
2048
|
-
const
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2140
|
+
if (items.length && info) {
|
|
2141
|
+
const all = info.items.map((i) => i.value);
|
|
2142
|
+
summary = { shown: selectedItems(view, field, all).length, total: all.length };
|
|
2143
|
+
}
|
|
2144
|
+
const labelOf = (v) => info?.items.find((i) => i.value === v)?.label;
|
|
2145
|
+
const date = sourceType === "date";
|
|
2146
|
+
const span = date ? dateSpan(encoded, sourceOf(view, field)) : null;
|
|
2147
|
+
const rules = filtersOf(view, field, ["relative", "compare", "label"]).map((f) => itemRuleText(f, labels, locale, { timeZone: encoded.timeZone, date, labelOf, span }));
|
|
2054
2148
|
const top = filtersOf(view, field, ["top"])[0] ?? null;
|
|
2055
2149
|
const condition = filtersOf(view, field, ["value"])[0] ?? null;
|
|
2056
|
-
|
|
2057
|
-
return { summary, top, condition, other, sort: sortOf(view, field) };
|
|
2150
|
+
return { summary, rules, top, condition, sort: sortOf(view, field) };
|
|
2058
2151
|
}
|
|
2059
2152
|
function stateWords(state, view, labels, locale) {
|
|
2060
2153
|
if (!state) {
|
|
@@ -2063,9 +2156,8 @@ function stateWords(state, view, labels, locale) {
|
|
|
2063
2156
|
const words = [];
|
|
2064
2157
|
if (state.summary) {
|
|
2065
2158
|
words.push(`${labels.stateFiltered} ${fill(labels.filterSummary, { shown: state.summary.shown.toLocaleString(locale), total: state.summary.total.toLocaleString(locale) })}`);
|
|
2066
|
-
} else if (state.other) {
|
|
2067
|
-
words.push(labels.stateFiltered);
|
|
2068
2159
|
}
|
|
2160
|
+
words.push(...state.rules);
|
|
2069
2161
|
if (state.top) {
|
|
2070
2162
|
words.push(fill(state.top.bottom ? labels.bottomBadge : labels.topBadge, { count: state.top.count.toLocaleString(locale) }));
|
|
2071
2163
|
}
|
|
@@ -2073,9 +2165,7 @@ function stateWords(state, view, labels, locale) {
|
|
|
2073
2165
|
words.push(valueConditionText(view, state.condition, labels, locale));
|
|
2074
2166
|
}
|
|
2075
2167
|
if (state.sort) {
|
|
2076
|
-
|
|
2077
|
-
const order = state.sort.by === "value" ? fill(desc ? labels.sortValueDesc : labels.sortValueAsc, { value: refLabel(view, state.sort.value, labels) }) : state.sort.by === "custom" ? desc ? labels.sortCustomDesc : labels.sortCustom : desc ? labels.sortLabelDesc : labels.sortLabelAsc;
|
|
2078
|
-
words.push(fill(labels.stateSorted, { order }));
|
|
2168
|
+
words.push(fill(labels.stateSorted, { order: sortText(view, state.sort, labels) }));
|
|
2079
2169
|
}
|
|
2080
2170
|
return words.join(", ");
|
|
2081
2171
|
}
|
|
@@ -2084,93 +2174,87 @@ function Badges({ state, view, labels, locale }) {
|
|
|
2084
2174
|
if (state.summary) {
|
|
2085
2175
|
const text = fill(labels.filterSummary, { shown: state.summary.shown.toLocaleString(locale), total: state.summary.total.toLocaleString(locale) });
|
|
2086
2176
|
parts.push(
|
|
2087
|
-
/* @__PURE__ */
|
|
2177
|
+
/* @__PURE__ */ React11.createElement("span", { key: "filter", className: "pk-chip-badge pk-badge-text", "aria-hidden": "true" }, /* @__PURE__ */ React11.createElement(Icon, { name: "filter", size: 12 }), text)
|
|
2178
|
+
);
|
|
2179
|
+
}
|
|
2180
|
+
if (state.rules.length) {
|
|
2181
|
+
const more = state.rules.length - 1;
|
|
2182
|
+
parts.push(
|
|
2183
|
+
/* @__PURE__ */ React11.createElement("span", { key: "rules", className: "pk-chip-badge pk-badge-text pk-badge-condition", "data-testid": "rule-badge", "aria-hidden": "true" }, state.summary ? null : /* @__PURE__ */ React11.createElement(Icon, { name: "filter", size: 12 }), /* @__PURE__ */ React11.createElement("span", { className: "pk-badge-cut" }, state.rules[0]), more ? /* @__PURE__ */ React11.createElement("span", null, ` +${more.toLocaleString(locale)}`) : null)
|
|
2088
2184
|
);
|
|
2089
|
-
} else if (state.other) {
|
|
2090
|
-
parts.push(/* @__PURE__ */ React10.createElement(Icon, { key: "filter", name: "filter", size: 12, className: "pk-chip-badge" }));
|
|
2091
2185
|
}
|
|
2092
2186
|
if (state.top) {
|
|
2093
2187
|
const text = fill(state.top.bottom ? labels.bottomBadge : labels.topBadge, { count: state.top.count.toLocaleString(locale) });
|
|
2094
2188
|
parts.push(
|
|
2095
|
-
/* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ React11.createElement("span", { key: "top", className: "pk-chip-badge pk-badge-text", "data-testid": "top-badge", "aria-hidden": "true" }, /* @__PURE__ */ React11.createElement(Icon, { name: "top", size: 12 }), text)
|
|
2096
2190
|
);
|
|
2097
2191
|
}
|
|
2098
2192
|
if (state.condition) {
|
|
2099
2193
|
const text = valueConditionText(view, state.condition, labels, locale);
|
|
2100
2194
|
parts.push(
|
|
2101
|
-
/* @__PURE__ */
|
|
2195
|
+
/* @__PURE__ */ React11.createElement("span", { key: "condition", className: "pk-chip-badge pk-badge-text pk-badge-condition", "data-testid": "condition-badge", "aria-hidden": "true" }, /* @__PURE__ */ React11.createElement(Icon, { name: "filter", size: 12 }), /* @__PURE__ */ React11.createElement("span", { className: "pk-badge-cut" }, text))
|
|
2102
2196
|
);
|
|
2103
2197
|
}
|
|
2104
2198
|
if (state.sort) {
|
|
2105
2199
|
const desc = state.sort.order === "desc";
|
|
2106
|
-
parts.push(/* @__PURE__ */
|
|
2200
|
+
parts.push(/* @__PURE__ */ React11.createElement(Icon, { key: "sort", name: desc ? "sortDesc" : "sortAsc", size: 12, className: "pk-chip-badge" }));
|
|
2107
2201
|
}
|
|
2108
|
-
|
|
2109
|
-
return null;
|
|
2110
|
-
}
|
|
2111
|
-
return /* @__PURE__ */ React10.createElement("span", { className: "pk-badges-inline", "aria-hidden": "true" }, parts);
|
|
2202
|
+
return parts.length ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, parts) : null;
|
|
2112
2203
|
}
|
|
2113
|
-
function Chip({ id, zone, index, count, field, text, typeName, view, types, labels, commit,
|
|
2204
|
+
function Chip({ id, zone, index, count, field, text, typeName, view, types, labels, commit, onRemove, state, locale, defaultsOf, earlier, rangeOf, info, showInfo, encoded }) {
|
|
2114
2205
|
const { setNodeRef, isDragging, style, itemProps, handleProps } = useChip(id, { kind: "chip", zone, index, count, field, label: text, type: typeName });
|
|
2115
|
-
const
|
|
2116
|
-
/** @type {HTMLElement | null} */
|
|
2117
|
-
null
|
|
2118
|
-
);
|
|
2119
|
-
const ref = (el) => {
|
|
2120
|
-
chipRef.current = el;
|
|
2121
|
-
setNodeRef(el);
|
|
2122
|
-
};
|
|
2123
|
-
const badges = state ? /* @__PURE__ */ React10.createElement(Badges, { state, view, labels, locale }) : null;
|
|
2206
|
+
const badges = state ? /* @__PURE__ */ React11.createElement(Badges, { state, view, labels, locale }) : null;
|
|
2124
2207
|
const words = stateWords(state, view, labels, locale);
|
|
2125
2208
|
const name = words ? `${text}, ${words}` : void 0;
|
|
2126
2209
|
const remove = () => onRemove(zone, index, text);
|
|
2127
|
-
return /* @__PURE__ */
|
|
2210
|
+
return /* @__PURE__ */ React11.createElement("li", { ref: setNodeRef, style, className: `pk-chip pk-chip-${zone}${isDragging ? " pk-dragging" : ""}`, ...itemProps, "data-chip": text }, /* @__PURE__ */ React11.createElement("span", { className: "pk-handle", ...handleProps, "aria-label": fill(labels.dragHandle, { field: text }) }, /* @__PURE__ */ React11.createElement(Icon, { name: "grip", size: 16 })), /* @__PURE__ */ React11.createElement("span", { className: `pk-type pk-type-${typeName}`, "aria-hidden": "true" }, /* @__PURE__ */ React11.createElement(Icon, { name: (
|
|
2128
2211
|
/** @type {any} */
|
|
2129
2212
|
TYPE_ICON[typeName] ?? "text"
|
|
2130
|
-
), size: 13 })),
|
|
2213
|
+
), size: 13 })), /* @__PURE__ */ React11.createElement(
|
|
2131
2214
|
MenuButton,
|
|
2132
2215
|
{
|
|
2133
2216
|
label: fill(labels.fieldMenu, { field: text }),
|
|
2134
|
-
text: /* @__PURE__ */
|
|
2217
|
+
text: /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("span", { className: "pk-chip-name" }, text), badges),
|
|
2135
2218
|
className: "pk-chip-label",
|
|
2136
2219
|
name,
|
|
2220
|
+
title: name ?? text,
|
|
2137
2221
|
role: "dialog",
|
|
2138
2222
|
popoverClass: "pk-chip-menu",
|
|
2139
2223
|
fill: true,
|
|
2140
2224
|
testId: `chip-menu-${text}`
|
|
2141
2225
|
},
|
|
2142
|
-
(close) => zone === "values" ? /* @__PURE__ */
|
|
2143
|
-
), info && showInfo ? /* @__PURE__ */
|
|
2226
|
+
(close) => zone === "values" ? /* @__PURE__ */ React11.createElement(MenuPanel, { name: "ValueMenu", loadingText: labels.loadingMenu, props: { view, index, types, labels, commit, close, onRemove: remove, defaultsOf, info, locale, earlier } }) : zone === "filters" ? /* @__PURE__ */ React11.createElement(MenuPanel, { name: "FilterMenu", loadingText: labels.loadingMenu, props: { view, index, field, types, labels, commit, close, onRemove: remove, locale, info, state, encoded } }) : /* @__PURE__ */ React11.createElement(MenuPanel, { name: "AxisMenu", loadingText: labels.loadingMenu, props: { view, zone, index, field, types, labels, commit, close, onRemove: remove, defaultsOf, rangeOf, locale, info, state, encoded } })
|
|
2227
|
+
), info && showInfo ? /* @__PURE__ */ React11.createElement(InfoButton, { info, name: fieldLabel4(sourceOf(view, field), labels.core), labels, className: "pk-chip-info" }) : null, /* @__PURE__ */ React11.createElement("button", { type: "button", className: "pk-chip-x", onClick: remove, "aria-label": fill(labels.removeField, { field: text }), title: fill(labels.removeField, { field: text }) }, /* @__PURE__ */ React11.createElement(Icon, { name: "x", size: 14 })));
|
|
2144
2228
|
}
|
|
2145
|
-
function Zone({ zone, entries
|
|
2146
|
-
const count =
|
|
2229
|
+
function Zone({ zone, entries, labels, children, action, explain }) {
|
|
2230
|
+
const count = entries.length;
|
|
2147
2231
|
const { setNodeRef, isOver } = useDropTarget(`zone:${zone}`, { kind: "zone", zone, count });
|
|
2148
2232
|
const active = useActiveDrag();
|
|
2149
2233
|
const dragging = Boolean(active);
|
|
2150
|
-
const [flash, setFlash] =
|
|
2151
|
-
const [prev, setPrev] =
|
|
2234
|
+
const [flash, setFlash] = useState11(false);
|
|
2235
|
+
const [prev, setPrev] = useState11(count);
|
|
2152
2236
|
if (count !== prev) {
|
|
2153
2237
|
setPrev(count);
|
|
2154
2238
|
if (count > prev) {
|
|
2155
2239
|
setFlash(true);
|
|
2156
2240
|
}
|
|
2157
2241
|
}
|
|
2158
|
-
|
|
2242
|
+
useEffect10(() => {
|
|
2159
2243
|
if (!flash) {
|
|
2160
2244
|
return void 0;
|
|
2161
2245
|
}
|
|
2162
2246
|
const t = setTimeout(() => setFlash(false), 600);
|
|
2163
2247
|
return () => clearTimeout(t);
|
|
2164
2248
|
}, [flash]);
|
|
2165
|
-
return /* @__PURE__ */
|
|
2249
|
+
return /* @__PURE__ */ React11.createElement("section", { ref: setNodeRef, tabIndex: -1, className: `pk-zone pk-zone-${zone}${isOver ? " pk-over" : ""}${dragging ? " pk-dropping" : ""}${flash ? " pk-flash" : ""}`, "aria-label": labels.zones[zone], "data-zone": zone }, /* @__PURE__ */ React11.createElement("div", { className: "pk-zone-head" }, /* @__PURE__ */ React11.createElement("h3", { className: "pk-zone-title" }, /* @__PURE__ */ React11.createElement(Icon, { name: (
|
|
2166
2250
|
/** @type {any} */
|
|
2167
2251
|
ZONE_ICON[zone]
|
|
2168
|
-
), size: 14 }), labels.zones[zone]), explain ? /* @__PURE__ */
|
|
2252
|
+
), size: 14 }), labels.zones[zone]), explain ? /* @__PURE__ */ React11.createElement(InfoButton, { info: { description: labels.zoneInfo[zone] }, name: labels.zones[zone], labels, className: "pk-zone-info", testId: `zone-info-${zone}` }) : null, /* @__PURE__ */ React11.createElement("span", { className: "pk-grow" }), action), /* @__PURE__ */ React11.createElement(ChipList, { ids: entries.map((e) => e.id) }, /* @__PURE__ */ React11.createElement("ul", { className: "pk-chips" }, children, count === 0 ? /* @__PURE__ */ React11.createElement("li", { className: "pk-zone-hint" }, labels.zoneHints[zone]) : null)));
|
|
2169
2253
|
}
|
|
2170
2254
|
function zoneEntries(view, types, labels) {
|
|
2171
2255
|
const typeOf = (f) => types.get(String(sourceOf(view, f)).toLowerCase()) ?? "string";
|
|
2172
2256
|
const seen = /* @__PURE__ */ new Map();
|
|
2173
|
-
const text = (f) =>
|
|
2257
|
+
const text = (f) => fieldLabel4(f, labels.core);
|
|
2174
2258
|
const axis = (zone) => view[zone].map((f, i) => ({ id: `chip:${zone}:${f}`, field: f, text: text(f), type: typeOf(f), index: i }));
|
|
2175
2259
|
return {
|
|
2176
2260
|
filters: filterZoneFields(view).map((f, i) => ({ id: `chip:filters:${f}`, field: f, text: text(f), type: typeOf(f), index: i })),
|
|
@@ -2183,35 +2267,35 @@ function zoneEntries(view, types, labels) {
|
|
|
2183
2267
|
})
|
|
2184
2268
|
};
|
|
2185
2269
|
}
|
|
2186
|
-
function ZoneSummary({ entries
|
|
2187
|
-
const parts = layoutSummary(
|
|
2270
|
+
function ZoneSummary({ entries, labels, id, onShow, buttonRef }) {
|
|
2271
|
+
const parts = layoutSummary(entries, labels);
|
|
2188
2272
|
const text = parts.length ? parts.map((p) => `${p.title}: ${p.fields}`).join(" \xB7 ") : labels.layoutEmpty;
|
|
2189
|
-
return /* @__PURE__ */
|
|
2273
|
+
return /* @__PURE__ */ React11.createElement("button", { ref: buttonRef, type: "button", id, className: "pk-zones-summary", "aria-expanded": "false", "aria-label": `${labels.showLayout}: ${text}`, title: labels.showLayout, onClick: onShow, "data-testid": "layout-summary" }, /* @__PURE__ */ React11.createElement(Icon, { name: "chevronRight", size: 16 }), /* @__PURE__ */ React11.createElement("span", { className: "pk-zones-summary-text" }, parts.length ? parts.map((p, i) => /* @__PURE__ */ React11.createElement(React11.Fragment, { key: p.zone }, i ? /* @__PURE__ */ React11.createElement("span", { "aria-hidden": "true" }, " \xB7 ") : null, /* @__PURE__ */ React11.createElement("span", { className: "pk-zones-summary-zone" }, p.title, ":"), " ", p.fields)) : labels.layoutEmpty));
|
|
2190
2274
|
}
|
|
2191
|
-
function Zones({ view, types, labels, commit,
|
|
2192
|
-
const
|
|
2275
|
+
function Zones({ view, types, labels, commit, earlier, encoded, locale, onSwap, id, folded, onShow, defaultsOf, infoOf, explain = false, showInfo = true }) {
|
|
2276
|
+
const entries = useMemo7(() => zoneEntries(view, types, labels), [view, types, labels]);
|
|
2193
2277
|
const dragging = Boolean(useActiveDrag());
|
|
2194
|
-
const showing =
|
|
2195
|
-
const focusInside =
|
|
2196
|
-
const summary =
|
|
2278
|
+
const showing = useRef10(false);
|
|
2279
|
+
const focusInside = useRef10(false);
|
|
2280
|
+
const summary = useRef10(
|
|
2197
2281
|
/** @type {HTMLButtonElement | null} */
|
|
2198
2282
|
null
|
|
2199
2283
|
);
|
|
2200
|
-
const states =
|
|
2284
|
+
const states = useMemo7(() => {
|
|
2201
2285
|
const map = /* @__PURE__ */ new Map();
|
|
2202
2286
|
for (const zone of ["filters", "cols", "rows"]) {
|
|
2203
|
-
for (const e of
|
|
2204
|
-
map.set(e.field, fieldState(view, e.field, encoded, locale));
|
|
2287
|
+
for (const e of entries[zone]) {
|
|
2288
|
+
map.set(e.field, fieldState(view, e.field, encoded, locale, labels, e.type));
|
|
2205
2289
|
}
|
|
2206
2290
|
}
|
|
2207
2291
|
return map;
|
|
2208
|
-
}, [
|
|
2292
|
+
}, [entries, view, encoded, locale, labels]);
|
|
2209
2293
|
const rangeOf = useCallback8((field) => numberRange(encoded, field), [encoded]);
|
|
2210
|
-
const root =
|
|
2294
|
+
const root = useRef10(
|
|
2211
2295
|
/** @type {HTMLDivElement | null} */
|
|
2212
2296
|
null
|
|
2213
2297
|
);
|
|
2214
|
-
const focusAfter =
|
|
2298
|
+
const focusAfter = useRef10(
|
|
2215
2299
|
/** @type {{ zone: string, index: number } | null} */
|
|
2216
2300
|
null
|
|
2217
2301
|
);
|
|
@@ -2219,7 +2303,7 @@ function Zones({ view, types, labels, commit, openFilter, encoded, locale, onSwa
|
|
|
2219
2303
|
focusAfter.current = { zone, index };
|
|
2220
2304
|
commit(removeAt(view, zone, index), { step: "removed", field: text, removed: true });
|
|
2221
2305
|
};
|
|
2222
|
-
|
|
2306
|
+
useEffect10(() => {
|
|
2223
2307
|
const at = focusAfter.current;
|
|
2224
2308
|
if (!at || !root.current) {
|
|
2225
2309
|
return;
|
|
@@ -2233,7 +2317,7 @@ function Zones({ view, types, labels, commit, openFilter, encoded, locale, onSwa
|
|
|
2233
2317
|
);
|
|
2234
2318
|
target?.focus({ preventScroll: true });
|
|
2235
2319
|
});
|
|
2236
|
-
|
|
2320
|
+
useEffect10(() => {
|
|
2237
2321
|
if (showing.current && !folded) {
|
|
2238
2322
|
showing.current = false;
|
|
2239
2323
|
root.current?.querySelector("[data-zone]")?.focus({ preventScroll: true });
|
|
@@ -2244,10 +2328,10 @@ function Zones({ view, types, labels, commit, openFilter, encoded, locale, onSwa
|
|
|
2244
2328
|
}
|
|
2245
2329
|
}, [folded]);
|
|
2246
2330
|
if (folded && !dragging) {
|
|
2247
|
-
return /* @__PURE__ */
|
|
2331
|
+
return /* @__PURE__ */ React11.createElement(
|
|
2248
2332
|
ZoneSummary,
|
|
2249
2333
|
{
|
|
2250
|
-
entries
|
|
2334
|
+
entries,
|
|
2251
2335
|
labels,
|
|
2252
2336
|
id,
|
|
2253
2337
|
buttonRef: summary,
|
|
@@ -2258,7 +2342,7 @@ function Zones({ view, types, labels, commit, openFilter, encoded, locale, onSwa
|
|
|
2258
2342
|
}
|
|
2259
2343
|
);
|
|
2260
2344
|
}
|
|
2261
|
-
return /* @__PURE__ */
|
|
2345
|
+
return /* @__PURE__ */ React11.createElement(
|
|
2262
2346
|
"div",
|
|
2263
2347
|
{
|
|
2264
2348
|
className: "pk-zones",
|
|
@@ -2276,27 +2360,27 @@ function Zones({ view, types, labels, commit, openFilter, encoded, locale, onSwa
|
|
|
2276
2360
|
}
|
|
2277
2361
|
}
|
|
2278
2362
|
},
|
|
2279
|
-
ZONES.map((zone) => /* @__PURE__ */
|
|
2363
|
+
ZONES.map((zone) => /* @__PURE__ */ React11.createElement(
|
|
2280
2364
|
Zone,
|
|
2281
2365
|
{
|
|
2282
2366
|
key: zone,
|
|
2283
2367
|
zone,
|
|
2284
|
-
entries:
|
|
2368
|
+
entries: entries[zone],
|
|
2285
2369
|
labels,
|
|
2286
2370
|
explain,
|
|
2287
2371
|
action: zone === "cols" ? (
|
|
2288
2372
|
// the text goes when the zone is too narrow (styles.css): the title keeps it as a tooltip
|
|
2289
|
-
/* @__PURE__ */
|
|
2373
|
+
/* @__PURE__ */ React11.createElement("button", { type: "button", className: "pk-link pk-swap", onClick: onSwap, disabled: view.rows.length + view.cols.length === 0, "data-testid": "swap", title: labels.swap }, /* @__PURE__ */ React11.createElement(Icon, { name: "swap", size: 14 }), /* @__PURE__ */ React11.createElement("span", { className: "pk-btn-text" }, labels.swap))
|
|
2290
2374
|
) : null
|
|
2291
2375
|
},
|
|
2292
|
-
|
|
2376
|
+
entries[zone].map((e) => /* @__PURE__ */ React11.createElement(
|
|
2293
2377
|
Chip,
|
|
2294
2378
|
{
|
|
2295
2379
|
key: e.id,
|
|
2296
2380
|
id: e.id,
|
|
2297
2381
|
zone,
|
|
2298
2382
|
index: e.index,
|
|
2299
|
-
count:
|
|
2383
|
+
count: entries[zone].length,
|
|
2300
2384
|
field: e.field,
|
|
2301
2385
|
text: e.text,
|
|
2302
2386
|
typeName: e.type,
|
|
@@ -2304,14 +2388,15 @@ function Zones({ view, types, labels, commit, openFilter, encoded, locale, onSwa
|
|
|
2304
2388
|
types,
|
|
2305
2389
|
labels,
|
|
2306
2390
|
commit,
|
|
2307
|
-
openFilter,
|
|
2308
2391
|
onRemove,
|
|
2309
2392
|
state: zone === "values" ? null : states.get(e.field),
|
|
2310
2393
|
locale,
|
|
2311
2394
|
defaultsOf,
|
|
2395
|
+
earlier,
|
|
2312
2396
|
rangeOf,
|
|
2313
2397
|
info: e.field ? infoOf?.(e.field) : void 0,
|
|
2314
|
-
showInfo
|
|
2398
|
+
showInfo,
|
|
2399
|
+
encoded
|
|
2315
2400
|
}
|
|
2316
2401
|
))
|
|
2317
2402
|
))
|
|
@@ -2319,6 +2404,7 @@ function Zones({ view, types, labels, commit, openFilter, encoded, locale, onSwa
|
|
|
2319
2404
|
}
|
|
2320
2405
|
|
|
2321
2406
|
// src/PivotReport.jsx
|
|
2407
|
+
var savedKeyOf = (t) => JSON.stringify([t.scope, t.store, t.storeSource ?? null, t.sourceId ?? null, t.name]);
|
|
2322
2408
|
function sizeOf(width) {
|
|
2323
2409
|
return width < 640 ? "narrow" : width < 1024 ? "medium" : "wide";
|
|
2324
2410
|
}
|
|
@@ -2337,21 +2423,6 @@ function measured(name, fn) {
|
|
|
2337
2423
|
}
|
|
2338
2424
|
return out;
|
|
2339
2425
|
}
|
|
2340
|
-
function pathTitle(result, rowPath, colPath, labels) {
|
|
2341
|
-
const parts = [];
|
|
2342
|
-
const items = [];
|
|
2343
|
-
const add = (axis, fields, path) => {
|
|
2344
|
-
const node = findNode(result, axis, path);
|
|
2345
|
-
for (let n = node; n && n.parent; n = n.parent) {
|
|
2346
|
-
const item = result.label(axis, n, labels.core);
|
|
2347
|
-
parts.unshift(`${fieldLabel3(fields[n.depth - 1], labels.core)}: ${item}`);
|
|
2348
|
-
items.unshift(item);
|
|
2349
|
-
}
|
|
2350
|
-
};
|
|
2351
|
-
add("cols", result.colFields, colPath);
|
|
2352
|
-
add("rows", result.rowFields, rowPath);
|
|
2353
|
-
return { title: parts.length ? parts.join(" \xB7 ") : labels.core.grandTotal, name: items.length ? items.join(" \u2013 ") : labels.core.grandTotal };
|
|
2354
|
-
}
|
|
2355
2426
|
function outerPaths(result) {
|
|
2356
2427
|
const depth = result.rowFields.length;
|
|
2357
2428
|
const out = [];
|
|
@@ -2389,11 +2460,12 @@ function optionsKey(options) {
|
|
|
2389
2460
|
}
|
|
2390
2461
|
var here = () => typeof location !== "undefined" ? { href: location.href, hash: location.hash } : void 0;
|
|
2391
2462
|
var DEFER_ROWS = 1e4;
|
|
2463
|
+
var unusedNotes = (issues, raw) => issues.filter((i) => (i.code ?? (i.message === "unknown key" ? "unknownKey" : "")) !== "unknownKey" || !["name", "description"].includes(i.path)).map((issue) => ({ issue, raw }));
|
|
2392
2464
|
function PivotReport(props) {
|
|
2393
2465
|
const { loading: loading2 = false, data, encoded } = props;
|
|
2394
|
-
const [deferred, setDeferred] =
|
|
2395
|
-
const [started, setStarted] =
|
|
2396
|
-
|
|
2466
|
+
const [deferred, setDeferred] = useState12(() => !encoded && Array.isArray(data) && data.length > DEFER_ROWS);
|
|
2467
|
+
const [started, setStarted] = useState12(false);
|
|
2468
|
+
useEffect11(() => {
|
|
2397
2469
|
if (!deferred) {
|
|
2398
2470
|
return void 0;
|
|
2399
2471
|
}
|
|
@@ -2411,19 +2483,19 @@ function PivotReport(props) {
|
|
|
2411
2483
|
setStarted(true);
|
|
2412
2484
|
}
|
|
2413
2485
|
if (waiting && !started) {
|
|
2414
|
-
return /* @__PURE__ */
|
|
2486
|
+
return /* @__PURE__ */ React12.createElement(WaitingReport, { ...props });
|
|
2415
2487
|
}
|
|
2416
|
-
return /* @__PURE__ */
|
|
2488
|
+
return /* @__PURE__ */ React12.createElement(Report, { ...props });
|
|
2417
2489
|
}
|
|
2418
2490
|
function WaitingReport({ locale = "en-US", labels: customLabels, theme = "auto", height = 640, className, label }) {
|
|
2419
|
-
const root =
|
|
2491
|
+
const root = useRef11(
|
|
2420
2492
|
/** @type {HTMLDivElement | null} */
|
|
2421
2493
|
null
|
|
2422
2494
|
);
|
|
2423
2495
|
const labelsKey = JSON.stringify(customLabels ?? null);
|
|
2424
|
-
const labels =
|
|
2496
|
+
const labels = useMemo8(() => resolveLabels(locale, JSON.parse(labelsKey)), [locale, labelsKey]);
|
|
2425
2497
|
const themeName = useResolvedTheme(theme, root);
|
|
2426
|
-
return /* @__PURE__ */
|
|
2498
|
+
return /* @__PURE__ */ React12.createElement("div", { ref: root, className: `pk-root${className ? ` ${className}` : ""}`, "data-pk-theme": themeName, lang: labels.lang, role: "region", "aria-label": label || labels.report, style: { height } }, /* @__PURE__ */ React12.createElement(Skeleton, { full: true, text: labels.loadingReport }));
|
|
2427
2499
|
}
|
|
2428
2500
|
function defaultsFor(fieldDefaults, field) {
|
|
2429
2501
|
if (!fieldDefaults || typeof fieldDefaults !== "object") {
|
|
@@ -2433,7 +2505,7 @@ function defaultsFor(fieldDefaults, field) {
|
|
|
2433
2505
|
return key === void 0 ? void 0 : fieldDefaults[key];
|
|
2434
2506
|
}
|
|
2435
2507
|
function EmptyState({ labels, templates, onTemplate }) {
|
|
2436
|
-
return /* @__PURE__ */
|
|
2508
|
+
return /* @__PURE__ */ React12.createElement("div", { className: "pk-empty", "data-testid": "empty-state" }, /* @__PURE__ */ React12.createElement("div", { className: "pk-empty-art", "aria-hidden": "true" }, /* @__PURE__ */ React12.createElement("span", { className: "pk-empty-chip pk-c1" }), /* @__PURE__ */ React12.createElement("span", { className: "pk-empty-chip pk-c2" }), /* @__PURE__ */ React12.createElement("span", { className: "pk-empty-chip pk-c3" })), /* @__PURE__ */ React12.createElement("h2", null, labels.emptyTitle), /* @__PURE__ */ React12.createElement("ol", { className: "pk-steps" }, labels.emptySteps.map((s, i) => /* @__PURE__ */ React12.createElement("li", { key: i }, /* @__PURE__ */ React12.createElement("span", { className: "pk-step-n", "aria-hidden": "true" }, i + 1), /* @__PURE__ */ React12.createElement("span", null, s)))), templates.length ? /* @__PURE__ */ React12.createElement("div", { className: "pk-empty-actions" }, templates.slice(0, 3).map((t, i) => /* @__PURE__ */ React12.createElement("button", { key: `${i}:${t.name}`, type: "button", className: "pk-btn", onClick: () => onTemplate(t) }, /* @__PURE__ */ React12.createElement(Icon, { name: "sparkle" }), /* @__PURE__ */ React12.createElement("span", { className: "pk-btn-text" }, fill(labels.tryView, { name: t.name }))))) : null);
|
|
2437
2509
|
}
|
|
2438
2510
|
function Report(props) {
|
|
2439
2511
|
const {
|
|
@@ -2486,69 +2558,73 @@ function Report(props) {
|
|
|
2486
2558
|
const sourceName = typeof sourceProp?.name === "string" && sourceProp.name ? sourceProp.name : void 0;
|
|
2487
2559
|
const labelsKey = JSON.stringify(customLabels ?? null);
|
|
2488
2560
|
const defaultsKey = JSON.stringify(fieldDefaults ?? null);
|
|
2489
|
-
const info =
|
|
2490
|
-
const baseLabels =
|
|
2561
|
+
const info = useMemo8(() => fieldInfoOf(JSON.parse(defaultsKey)), [defaultsKey]);
|
|
2562
|
+
const baseLabels = useMemo8(() => resolveLabels(locale, JSON.parse(labelsKey)), [locale, labelsKey]);
|
|
2491
2563
|
const typesKey = JSON.stringify(typesOf(fieldDefaults));
|
|
2492
2564
|
const limitsKey = JSON.stringify(limitsProp ?? null);
|
|
2493
|
-
const limits =
|
|
2494
|
-
const root =
|
|
2565
|
+
const limits = useMemo8(() => JSON.parse(limitsKey) ?? void 0, [limitsKey]);
|
|
2566
|
+
const root = useRef11(
|
|
2495
2567
|
/** @type {HTMLDivElement | null} */
|
|
2496
2568
|
null
|
|
2497
2569
|
);
|
|
2498
2570
|
const themeName = useResolvedTheme(theme, root);
|
|
2499
|
-
const [layer, setLayer] =
|
|
2571
|
+
const [layer, setLayer] = useState12(
|
|
2500
2572
|
/** @type {HTMLElement | null} */
|
|
2501
2573
|
null
|
|
2502
2574
|
);
|
|
2503
|
-
const [size, setSize] =
|
|
2504
|
-
const [measuredShort, setMeasuredShort] =
|
|
2505
|
-
const [short, setShort] =
|
|
2506
|
-
const [folded, setFolded] =
|
|
2575
|
+
const [size, setSize] = useState12("wide");
|
|
2576
|
+
const [measuredShort, setMeasuredShort] = useState12(false);
|
|
2577
|
+
const [short, setShort] = useState12(false);
|
|
2578
|
+
const [folded, setFolded] = useState12(
|
|
2507
2579
|
/** @type {boolean | null} */
|
|
2508
2580
|
null
|
|
2509
2581
|
);
|
|
2510
2582
|
const layoutFolded = folded ?? short;
|
|
2511
2583
|
const zonesId = useId4();
|
|
2512
|
-
const [drawer, setDrawer] =
|
|
2513
|
-
const [filterTarget, setFilterTarget] =
|
|
2584
|
+
const [drawer, setDrawer] = useState12(false);
|
|
2585
|
+
const [filterTarget, setFilterTarget] = useState12(
|
|
2514
2586
|
/** @type {{ field: string, anchor: HTMLElement, base?: object } | null} */
|
|
2515
2587
|
null
|
|
2516
2588
|
);
|
|
2517
|
-
const [drill, setDrill] =
|
|
2518
|
-
/** @type {import("./drill-
|
|
2589
|
+
const [drill, setDrill] = useState12(
|
|
2590
|
+
/** @type {import("./drill-table.js").DrillSource | null} */
|
|
2519
2591
|
null
|
|
2520
2592
|
);
|
|
2521
|
-
const [hinted, setHinted] =
|
|
2522
|
-
const changesRef =
|
|
2523
|
-
const [changes, setChanges] =
|
|
2524
|
-
const [dragAt, setDragAt] =
|
|
2593
|
+
const [hinted, setHinted] = useState12(false);
|
|
2594
|
+
const changesRef = useRef11(0);
|
|
2595
|
+
const [changes, setChanges] = useState12(0);
|
|
2596
|
+
const [dragAt, setDragAt] = useState12(
|
|
2525
2597
|
/** @type {number | null} */
|
|
2526
2598
|
null
|
|
2527
2599
|
);
|
|
2528
|
-
const [savedAt, setSavedAt] =
|
|
2529
|
-
const [menus, setMenus] =
|
|
2600
|
+
const [savedAt, setSavedAt] = useState12(0);
|
|
2601
|
+
const [menus, setMenus] = useState12(
|
|
2530
2602
|
/** @type {typeof import("./menus.js") | null} */
|
|
2531
2603
|
null
|
|
2532
2604
|
);
|
|
2533
|
-
const [
|
|
2534
|
-
|
|
2535
|
-
|
|
2605
|
+
const [, setTexts] = useState12(0);
|
|
2606
|
+
useEffect11(() => onMenuTexts(() => setTexts((n) => n + 1)), []);
|
|
2607
|
+
const [viewsRequest, setViewsRequest] = useState12(0);
|
|
2608
|
+
const [leftOut, setLeftOut] = useState12(
|
|
2609
|
+
/** @type {import("./unused.jsx").UnusedNote[]} */
|
|
2536
2610
|
[]
|
|
2537
2611
|
);
|
|
2538
|
-
const [issuesDismissed, setIssuesDismissed] =
|
|
2612
|
+
const [issuesDismissed, setIssuesDismissed] = useState12(
|
|
2539
2613
|
/** @type {string | null} */
|
|
2540
2614
|
null
|
|
2541
2615
|
);
|
|
2542
|
-
const [
|
|
2543
|
-
|
|
2544
|
-
|
|
2616
|
+
const [loads, setLoads] = useState12(0);
|
|
2617
|
+
const [unusedSaid, setUnusedSaid] = useState12(false);
|
|
2618
|
+
const [savedKeys, setSavedKeys] = useState12(
|
|
2619
|
+
/** @type {Record<string, string>} */
|
|
2620
|
+
{}
|
|
2545
2621
|
);
|
|
2546
|
-
const [rowLabel, setRowLabel] =
|
|
2622
|
+
const [rowLabel, setRowLabel] = useState12(
|
|
2547
2623
|
/** @type {string | null} */
|
|
2548
2624
|
null
|
|
2549
2625
|
);
|
|
2550
|
-
const chartRef =
|
|
2551
|
-
const [chartReady, setChartReady] =
|
|
2626
|
+
const chartRef = useRef11(null);
|
|
2627
|
+
const [chartReady, setChartReady] = useState12(false);
|
|
2552
2628
|
const hintId = useId4();
|
|
2553
2629
|
const closeFilter = useCallback9(() => setFilterTarget(null), []);
|
|
2554
2630
|
const { toasts, push, dismiss, pause } = useToasts();
|
|
@@ -2558,7 +2634,7 @@ function Report(props) {
|
|
|
2558
2634
|
[push]
|
|
2559
2635
|
);
|
|
2560
2636
|
const dataIdentity = dataKey !== void 0 ? dataKey : data;
|
|
2561
|
-
const source =
|
|
2637
|
+
const source = useMemo8(() => {
|
|
2562
2638
|
try {
|
|
2563
2639
|
const types2 = JSON.parse(typesKey);
|
|
2564
2640
|
const enc = encodedProp ?? measured("encode", () => encode(
|
|
@@ -2573,14 +2649,14 @@ function Report(props) {
|
|
|
2573
2649
|
}, [encodedProp, dataIdentity, timeZone, limits, typesKey]);
|
|
2574
2650
|
const encoded = source.encoded;
|
|
2575
2651
|
const fieldNamesKey = encoded.schema.fields.map((f) => f.name).join("\0");
|
|
2576
|
-
const labels =
|
|
2652
|
+
const labels = useMemo8(() => {
|
|
2577
2653
|
const fields2 = displayNames(info, fieldNamesKey ? fieldNamesKey.split("\0") : []);
|
|
2578
2654
|
return fields2 ? { ...baseLabels, core: { ...baseLabels.core, fields: fields2 } } : baseLabels;
|
|
2579
2655
|
}, [baseLabels, info, fieldNamesKey]);
|
|
2580
2656
|
const ordersKey = JSON.stringify(
|
|
2581
2657
|
fieldDefaults && typeof fieldDefaults === "object" ? Object.entries(fieldDefaults).filter(([, d]) => d && Array.isArray(d.order) && d.order.length > 0).map(([field, d]) => [field, d.order]) : []
|
|
2582
2658
|
);
|
|
2583
|
-
const orderOf =
|
|
2659
|
+
const orderOf = useMemo8(() => {
|
|
2584
2660
|
const orders = (
|
|
2585
2661
|
/** @type {[string, unknown[]][]} */
|
|
2586
2662
|
JSON.parse(ordersKey)
|
|
@@ -2592,8 +2668,11 @@ function Report(props) {
|
|
|
2592
2668
|
}, [ordersKey]);
|
|
2593
2669
|
const history = useViewHistory({ encoded, view: viewProp, defaultView, onViewChange, limits, outsideNote: labels.steps.outside, orderOf });
|
|
2594
2670
|
const view = history.view;
|
|
2671
|
+
const loadedView = tagFor(history.tag, sourceId);
|
|
2672
|
+
const viewName = loadedView?.name ?? null;
|
|
2673
|
+
const unsaved = Boolean(loadedView) && savedKeys[savedKeyOf(loadedView)] !== history.viewKey;
|
|
2595
2674
|
const chartOptionsKey = optionsKey(chartOptions);
|
|
2596
|
-
const stableChartOptions =
|
|
2675
|
+
const stableChartOptions = useMemo8(() => chartOptions, [chartOptionsKey]);
|
|
2597
2676
|
const stepText = useCallback9(
|
|
2598
2677
|
(note) => {
|
|
2599
2678
|
const template = Object.hasOwn(labels.steps, note.step) ? labels.steps[note.step] : labels.steps.change;
|
|
@@ -2619,8 +2698,8 @@ function Report(props) {
|
|
|
2619
2698
|
announce(fill(labels.toastRedone, { step: note }));
|
|
2620
2699
|
}
|
|
2621
2700
|
}, [history, labels, announce]);
|
|
2622
|
-
const undoLater =
|
|
2623
|
-
|
|
2701
|
+
const undoLater = useRef11(undo2);
|
|
2702
|
+
useEffect11(() => {
|
|
2624
2703
|
undoLater.current = undo2;
|
|
2625
2704
|
});
|
|
2626
2705
|
const reset2 = useCallback9(() => {
|
|
@@ -2628,19 +2707,19 @@ function Report(props) {
|
|
|
2628
2707
|
announce(labels.toastReset);
|
|
2629
2708
|
}, [history, labels, announce]);
|
|
2630
2709
|
const param = linkParam(storageKey);
|
|
2631
|
-
const [opening, setOpening] =
|
|
2632
|
-
const appliedLink =
|
|
2710
|
+
const [opening, setOpening] = useState12(false);
|
|
2711
|
+
const appliedLink = useRef11(
|
|
2633
2712
|
/** @type {string | null} */
|
|
2634
2713
|
null
|
|
2635
2714
|
);
|
|
2636
|
-
const latest =
|
|
2715
|
+
const latest = useRef11({ history, encoded, limits, labels, announce, commit: (
|
|
2637
2716
|
/** @type {any} */
|
|
2638
2717
|
null
|
|
2639
2718
|
), sourceId, loaded: (
|
|
2640
2719
|
/** @type {any} */
|
|
2641
2720
|
null
|
|
2642
2721
|
), sources, onSourceSwitch });
|
|
2643
|
-
const [linkCheck, setLinkCheck] =
|
|
2722
|
+
const [linkCheck, setLinkCheck] = useState12(
|
|
2644
2723
|
/** @type {null | { lines: string[], quiet: boolean, load: () => void, switchTo?: { name: string, run: () => void } }} */
|
|
2645
2724
|
null
|
|
2646
2725
|
);
|
|
@@ -2650,23 +2729,23 @@ function Report(props) {
|
|
|
2650
2729
|
const apply = (m) => {
|
|
2651
2730
|
const { history: h, encoded: enc, limits: lim, labels: l, announce: say, sourceId: id, loaded: done, sources: list, onSourceSwitch: switchTo } = latest.current;
|
|
2652
2731
|
const decoded = m.decodeViewLink(text);
|
|
2653
|
-
const
|
|
2654
|
-
if (!
|
|
2655
|
-
say(
|
|
2732
|
+
const loaded3 = decoded.view ? viewFromObject(decoded.view, enc, { limits: lim, sourceId: id }) : null;
|
|
2733
|
+
if (!loaded3 || !loaded3.view) {
|
|
2734
|
+
say(loaded3?.failed === "newer" ? l.viewFailed.newer : l.viewFailed.badLink, { tone: "error" });
|
|
2656
2735
|
return;
|
|
2657
2736
|
}
|
|
2658
2737
|
const open = () => {
|
|
2659
2738
|
if (asStep) {
|
|
2660
|
-
done(
|
|
2739
|
+
done(loaded3, { link: true });
|
|
2661
2740
|
} else {
|
|
2662
2741
|
h.restore(
|
|
2663
2742
|
/** @type {object} */
|
|
2664
|
-
|
|
2743
|
+
loaded3.view
|
|
2665
2744
|
);
|
|
2666
|
-
done(
|
|
2745
|
+
done(loaded3, { link: true, restored: true });
|
|
2667
2746
|
}
|
|
2668
2747
|
};
|
|
2669
|
-
const check = loadCheck(
|
|
2748
|
+
const check = loadCheck(loaded3, l, Array.isArray(list) ? list : []);
|
|
2670
2749
|
if (!check) {
|
|
2671
2750
|
open();
|
|
2672
2751
|
return;
|
|
@@ -2678,8 +2757,8 @@ function Report(props) {
|
|
|
2678
2757
|
load: open,
|
|
2679
2758
|
switchTo: target && typeof switchTo === "function" ? { name: target.name, run: () => switchTo({ source: { id: target.id, name: target.name }, view: (
|
|
2680
2759
|
/** @type {Record<string, unknown>} */
|
|
2681
|
-
|
|
2682
|
-
), name:
|
|
2760
|
+
loaded3.file?.view ?? loaded3.view
|
|
2761
|
+
), name: loaded3.file?.name || void 0 }) } : void 0
|
|
2683
2762
|
});
|
|
2684
2763
|
};
|
|
2685
2764
|
if (now) {
|
|
@@ -2707,16 +2786,16 @@ function Report(props) {
|
|
|
2707
2786
|
const raw = readStoredView(storageKey, sessionStore());
|
|
2708
2787
|
if (raw) {
|
|
2709
2788
|
try {
|
|
2710
|
-
const
|
|
2711
|
-
if (
|
|
2712
|
-
history.restore(
|
|
2789
|
+
const loaded3 = viewFromObject(JSON.parse(raw), encoded, { limits });
|
|
2790
|
+
if (loaded3.view) {
|
|
2791
|
+
history.restore(loaded3.view);
|
|
2713
2792
|
}
|
|
2714
2793
|
} catch {
|
|
2715
2794
|
}
|
|
2716
2795
|
}
|
|
2717
2796
|
}
|
|
2718
2797
|
}, []);
|
|
2719
|
-
|
|
2798
|
+
useEffect11(() => {
|
|
2720
2799
|
if (!shareLink || typeof window === "undefined") {
|
|
2721
2800
|
return void 0;
|
|
2722
2801
|
}
|
|
@@ -2729,20 +2808,20 @@ function Report(props) {
|
|
|
2729
2808
|
window.addEventListener("hashchange", onHash);
|
|
2730
2809
|
return () => window.removeEventListener("hashchange", onHash);
|
|
2731
2810
|
}, [shareLink, param, openLink]);
|
|
2732
|
-
|
|
2811
|
+
useEffect11(() => {
|
|
2733
2812
|
if (persistView === "session") {
|
|
2734
2813
|
writeStoredView(storageKey, sessionStore(), JSON.parse(history.viewKey));
|
|
2735
2814
|
}
|
|
2736
2815
|
}, [persistView, storageKey, history.viewKey]);
|
|
2737
2816
|
const commit = useCallback9(
|
|
2738
|
-
/** @param {object} next @param {{ step: string, removed?: boolean, field?: string, zone?: string, name?: string, display?: string, type?: string }} [note] */
|
|
2739
|
-
(next, note = { step: "change" }) => {
|
|
2817
|
+
/** @param {object} next @param {{ step: string, removed?: boolean, field?: string, zone?: string, name?: string, display?: string, type?: string }} [note] @param {any} [tag] the saved view it is (history.tag) */
|
|
2818
|
+
(next, note = { step: "change" }, tag = void 0) => {
|
|
2740
2819
|
const over = note.step === "template" ? null : zoneOverLimit(next, limits);
|
|
2741
2820
|
if (over) {
|
|
2742
2821
|
announce(fill(labels.zoneFull, { zone: labels.zones[over.zone], max: over.max.toLocaleString(locale) }), { tone: "error" });
|
|
2743
2822
|
return;
|
|
2744
2823
|
}
|
|
2745
|
-
const changed = history.commit(next, stepText(note));
|
|
2824
|
+
const changed = history.commit(next, stepText(note), tag);
|
|
2746
2825
|
if (changed) {
|
|
2747
2826
|
changesRef.current += 1;
|
|
2748
2827
|
setChanges(changesRef.current);
|
|
@@ -2754,28 +2833,36 @@ function Report(props) {
|
|
|
2754
2833
|
},
|
|
2755
2834
|
[history, stepText, labels, announce, limits, locale]
|
|
2756
2835
|
);
|
|
2836
|
+
const remember = useCallback9((tag, key) => setSavedKeys((all) => ({ ...all, [savedKeyOf(tag)]: key })), []);
|
|
2757
2837
|
const applyLoaded = useCallback9(
|
|
2758
2838
|
/** @param {import("./share.js").LoadedView} loaded @param {{ link?: boolean, restored?: boolean }} [how] */
|
|
2759
|
-
(
|
|
2760
|
-
if (!
|
|
2839
|
+
(loaded3, { link = false, restored = false } = {}) => {
|
|
2840
|
+
if (!loaded3.view) {
|
|
2761
2841
|
return;
|
|
2762
2842
|
}
|
|
2763
|
-
|
|
2764
|
-
|
|
2843
|
+
const tag = loaded3.file?.name ? { name: loaded3.file.name, scope: null, store: false, sourceId: latest.current.sourceId } : null;
|
|
2844
|
+
if (tag) {
|
|
2845
|
+
remember(tag, latest.current.history.keyOf(loaded3.view));
|
|
2765
2846
|
}
|
|
2766
|
-
|
|
2767
|
-
|
|
2847
|
+
if (restored) {
|
|
2848
|
+
latest.current.history.setTag(tag);
|
|
2849
|
+
} else {
|
|
2850
|
+
commit(loaded3.view, { step: "viewLoaded" }, tag);
|
|
2851
|
+
}
|
|
2852
|
+
const notes2 = unusedNotes(loaded3.issues, loaded3.file?.view);
|
|
2853
|
+
setLeftOut(notes2);
|
|
2768
2854
|
setIssuesDismissed(null);
|
|
2769
|
-
|
|
2770
|
-
|
|
2855
|
+
setLoads((x) => x + 1);
|
|
2856
|
+
setUnusedSaid(notes2.length > 0);
|
|
2857
|
+
const text = link ? notes2.length ? labels.toastLinkOpenedPartly : labels.toastLinkOpened : notes2.length ? labels.toastViewLoadedPartly : labels.toastViewLoaded;
|
|
2771
2858
|
announce(text, restored ? void 0 : { action: { label: labels.undo, run: () => undoLater.current() } });
|
|
2772
2859
|
},
|
|
2773
|
-
[commit, labels, announce]
|
|
2860
|
+
[commit, labels, announce, remember]
|
|
2774
2861
|
);
|
|
2775
|
-
|
|
2862
|
+
useEffect11(() => {
|
|
2776
2863
|
latest.current = { history, encoded, limits, labels, announce, commit, sourceId, loaded: applyLoaded, sources, onSourceSwitch };
|
|
2777
2864
|
});
|
|
2778
|
-
const computed =
|
|
2865
|
+
const computed = useMemo8(() => {
|
|
2779
2866
|
try {
|
|
2780
2867
|
return { result: measured("computePivot", () => computePivot(encoded, view, { locale, limits })), error: null };
|
|
2781
2868
|
} catch (error2) {
|
|
@@ -2783,8 +2870,8 @@ function Report(props) {
|
|
|
2783
2870
|
}
|
|
2784
2871
|
}, [encoded, view, locale, limits]);
|
|
2785
2872
|
const result = computed.result;
|
|
2786
|
-
const plan =
|
|
2787
|
-
const chartComputed =
|
|
2873
|
+
const plan = useMemo8(() => chartPlan(view, encoded), [view, encoded]);
|
|
2874
|
+
const chartComputed = useMemo8(() => {
|
|
2788
2875
|
if (!plan.swap || view.display !== "chart" || !result) {
|
|
2789
2876
|
return computed;
|
|
2790
2877
|
}
|
|
@@ -2796,7 +2883,7 @@ function Report(props) {
|
|
|
2796
2883
|
}, [plan.swap, view, encoded, locale, limits, computed, result]);
|
|
2797
2884
|
const chartResult = chartComputed.result;
|
|
2798
2885
|
const empty = isEmptyView(view);
|
|
2799
|
-
const gridState =
|
|
2886
|
+
const gridState = useMemo8(() => {
|
|
2800
2887
|
if (!result || view.display !== "table" || empty) {
|
|
2801
2888
|
return { grid: null, error: null };
|
|
2802
2889
|
}
|
|
@@ -2808,9 +2895,11 @@ function Report(props) {
|
|
|
2808
2895
|
}, [result, view.display, empty, locale, labels, limits]);
|
|
2809
2896
|
const error = source.error ?? computed.error ?? gridState.error ?? (view.display === "chart" ? chartComputed.error : null);
|
|
2810
2897
|
const fields = encoded.schema.fields;
|
|
2811
|
-
const types =
|
|
2898
|
+
const types = useMemo8(() => new Map(viewFields(view, encoded).map((f) => [f.name.toLowerCase(), f.type])), [view, encoded]);
|
|
2812
2899
|
const typeOf = useCallback9((field) => types.get(sourceOf(view, field ?? "").toLowerCase()) ?? "string", [types, view]);
|
|
2813
|
-
const nameOf = useCallback9((field) =>
|
|
2900
|
+
const nameOf = useCallback9((field) => fieldLabel5(field, labels.core), [labels]);
|
|
2901
|
+
const hostOrdered = useCallback9((field) => sourceOf(view, field) === field && (orderOf?.(field)?.length ?? 0) > 0, [view, orderOf]);
|
|
2902
|
+
const sortFromHeader = useCallback9((field, sort) => commit(setSort(view, field, sort), { step: "sort", field: nameOf(field) }), [view, commit, nameOf]);
|
|
2814
2903
|
const infoOf = useCallback9(
|
|
2815
2904
|
(field) => {
|
|
2816
2905
|
if (!field || info.size === 0) {
|
|
@@ -2821,7 +2910,7 @@ function Report(props) {
|
|
|
2821
2910
|
},
|
|
2822
2911
|
[info, view]
|
|
2823
2912
|
);
|
|
2824
|
-
const placed =
|
|
2913
|
+
const placed = useMemo8(() => {
|
|
2825
2914
|
const map = /* @__PURE__ */ new Map();
|
|
2826
2915
|
const mark = (name, zone) => {
|
|
2827
2916
|
const key = sourceOf(view, name).toLowerCase();
|
|
@@ -2837,14 +2926,22 @@ function Report(props) {
|
|
|
2837
2926
|
filterZoneFields(view).forEach((f) => mark(f, "filters"));
|
|
2838
2927
|
return map;
|
|
2839
2928
|
}, [view]);
|
|
2840
|
-
|
|
2929
|
+
const lang = labels.lang;
|
|
2930
|
+
useEffect11(() => {
|
|
2841
2931
|
let live = true;
|
|
2842
|
-
loadMenus().then(
|
|
2932
|
+
loadMenus(lang).then(
|
|
2933
|
+
(m) => {
|
|
2934
|
+
if (live) {
|
|
2935
|
+
setMenus(() => m);
|
|
2936
|
+
}
|
|
2937
|
+
},
|
|
2938
|
+
() => void 0
|
|
2939
|
+
);
|
|
2843
2940
|
return () => {
|
|
2844
2941
|
live = false;
|
|
2845
2942
|
};
|
|
2846
|
-
}, []);
|
|
2847
|
-
const mainRef =
|
|
2943
|
+
}, [lang]);
|
|
2944
|
+
const mainRef = useRef11(
|
|
2848
2945
|
/** @type {HTMLDivElement | null} */
|
|
2849
2946
|
null
|
|
2850
2947
|
);
|
|
@@ -2872,7 +2969,7 @@ function Report(props) {
|
|
|
2872
2969
|
ro.observe(el);
|
|
2873
2970
|
return () => ro.disconnect();
|
|
2874
2971
|
}, []);
|
|
2875
|
-
|
|
2972
|
+
useEffect11(() => {
|
|
2876
2973
|
if (measuredShort === short) {
|
|
2877
2974
|
return void 0;
|
|
2878
2975
|
}
|
|
@@ -2890,11 +2987,11 @@ function Report(props) {
|
|
|
2890
2987
|
return () => mo.disconnect();
|
|
2891
2988
|
}, [measuredShort, short, layer]);
|
|
2892
2989
|
const drawerOpen = drawer && size === "narrow";
|
|
2893
|
-
const panelRef =
|
|
2990
|
+
const panelRef = useRef11(
|
|
2894
2991
|
/** @type {HTMLDivElement | null} */
|
|
2895
2992
|
null
|
|
2896
2993
|
);
|
|
2897
|
-
|
|
2994
|
+
useEffect11(() => {
|
|
2898
2995
|
if (panelRef.current) {
|
|
2899
2996
|
panelRef.current.inert = size === "narrow" && !drawerOpen;
|
|
2900
2997
|
}
|
|
@@ -2969,110 +3066,64 @@ function Report(props) {
|
|
|
2969
3066
|
const d = defaultsFor(fieldDefaults, name);
|
|
2970
3067
|
return d ? d.drillFormat ?? d.format : void 0;
|
|
2971
3068
|
};
|
|
2972
|
-
|
|
2973
|
-
const columns = table.columns.map((c) => ({ ...c, label: nameOf(c.name), description: infoOf(c.name)?.description }));
|
|
2974
|
-
const formats = Object.fromEntries(table.columns.map((c) => [c.name, formatOf(c.name)]).filter(([, f]) => typeof f === "string"));
|
|
2975
|
-
setDrill({ ...pathTitle(result, rowPath, colPath, labels), count, rows: table.rows, columns, indices, formats, locale: result.locale });
|
|
3069
|
+
setDrill({ result, rowPath, colPath, count, indices, formatOf, nameOf, infoOf });
|
|
2976
3070
|
}
|
|
2977
3071
|
},
|
|
2978
|
-
[result, encodedProp, data, drillDownLimit, onCellClick, drillDown,
|
|
3072
|
+
[result, encodedProp, data, drillDownLimit, onCellClick, drillDown, fieldDefaults, nameOf, infoOf]
|
|
2979
3073
|
);
|
|
2980
3074
|
const doExport = useExport({ fileName, result, locale, labels, limits, root, chartRef, announce, onExport });
|
|
2981
3075
|
const base = shareBase(shareLink, here()?.href);
|
|
2982
|
-
const viewFile = () => viewFileText(toViewFile(view, { name: viewName ?? "", createdAt: /* @__PURE__ */ new Date(), generator: { name: "pivotkit-react", version: VERSION }, source: { id: sourceId, name: sourceName }, data: encoded, ...schemaUrl !== void 0 ? { schemaUrl } : {} }));
|
|
2983
3076
|
const share = {
|
|
2984
3077
|
canLink: base !== null,
|
|
2985
3078
|
prepare: base !== null ? () => void loadLink().catch(() => void 0) : void 0,
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
copyJson: async () => {
|
|
3003
|
-
const ok = await copyText(viewFile(), root.current);
|
|
3004
|
-
announce(ok ? labels.toastJsonCopied : labels.toastCopyFailed, ok ? void 0 : { tone: "error" });
|
|
3005
|
-
},
|
|
3006
|
-
download: () => {
|
|
3007
|
-
const file = viewFileName(viewName || sourceName || safeFileName(fileName));
|
|
3008
|
-
const blob = new Blob([viewFile()], { type: "application/json" });
|
|
3009
|
-
if (onExport?.({ kind: "json", fileName: file, blob }) === false) {
|
|
3010
|
-
return;
|
|
3011
|
-
}
|
|
3012
|
-
saveBlob(blob, file, root.current?.ownerDocument ?? document);
|
|
3013
|
-
announce(fill(labels.toastExported, { file }));
|
|
3014
|
-
},
|
|
3015
|
-
/**
|
|
3016
|
-
* @param {string} text
|
|
3017
|
-
* @returns {Promise<string | null | { lines: string[], load: () => void, switchTo?: { name: string, run: () => void } }>}
|
|
3018
|
-
* why nothing was loaded, null when it was, or what to ask first (a view for other data)
|
|
3019
|
-
*/
|
|
3020
|
-
loadText: async (text) => {
|
|
3021
|
-
let loaded2 = viewFromText(text, encoded, { limits, sourceId });
|
|
3022
|
-
if (loaded2.failed === "notJson") {
|
|
3023
|
-
const t = text.trim();
|
|
3024
|
-
const fromUrl = t.includes("#") ? readLinkParam(t.slice(t.indexOf("#")), param) ?? readLinkParam(t.slice(t.indexOf("#")), "pivot") : null;
|
|
3025
|
-
const payload = fromUrl ?? (t.startsWith("1.") ? t : null);
|
|
3026
|
-
if (!payload) {
|
|
3027
|
-
return labels.viewFailed.notJson;
|
|
3028
|
-
}
|
|
3029
|
-
try {
|
|
3030
|
-
const decoded = (linkNow() ?? await loadLink()).decodeViewLink(payload);
|
|
3031
|
-
loaded2 = decoded.view ? viewFromObject(decoded.view, encoded, { limits, sourceId }) : { view: null, issues: [], failed: "badLink", file: null };
|
|
3032
|
-
} catch {
|
|
3033
|
-
return labels.viewFailed.badLink;
|
|
3034
|
-
}
|
|
3035
|
-
}
|
|
3036
|
-
if (!loaded2.view) {
|
|
3037
|
-
return labels.viewFailed[loaded2.failed ?? "notView"] ?? labels.viewFailed.notView;
|
|
3038
|
-
}
|
|
3039
|
-
const ready = (
|
|
3040
|
-
/** @type {import("./share.js").LoadedView} */
|
|
3041
|
-
loaded2
|
|
3042
|
-
);
|
|
3043
|
-
const check = loadCheck(ready, labels, Array.isArray(sources) ? sources : []);
|
|
3044
|
-
if (!check) {
|
|
3045
|
-
applyLoaded(ready);
|
|
3046
|
-
return null;
|
|
3047
|
-
}
|
|
3048
|
-
const target = check.switchTo;
|
|
3049
|
-
return {
|
|
3050
|
-
lines: check.lines,
|
|
3051
|
-
load: () => applyLoaded(ready),
|
|
3052
|
-
switchTo: target && typeof onSourceSwitch === "function" ? { name: target.name, run: () => onSourceSwitch({ source: { id: target.id, name: target.name }, view: (
|
|
3053
|
-
/** @type {Record<string, unknown>} */
|
|
3054
|
-
ready.file?.view ?? ready.view
|
|
3055
|
-
), name: ready.file?.name || void 0 }) } : void 0
|
|
3056
|
-
};
|
|
3057
|
-
}
|
|
3079
|
+
view,
|
|
3080
|
+
viewName,
|
|
3081
|
+
sourceId,
|
|
3082
|
+
sourceName,
|
|
3083
|
+
schemaUrl,
|
|
3084
|
+
encoded,
|
|
3085
|
+
shareLink,
|
|
3086
|
+
param,
|
|
3087
|
+
root,
|
|
3088
|
+
fileName,
|
|
3089
|
+
onExport,
|
|
3090
|
+
announce,
|
|
3091
|
+
limits,
|
|
3092
|
+
sources,
|
|
3093
|
+
onSourceSwitch,
|
|
3094
|
+
applyLoaded
|
|
3058
3095
|
};
|
|
3059
3096
|
const loadTemplate = useCallback9(
|
|
3060
3097
|
(t) => {
|
|
3061
|
-
|
|
3062
|
-
|
|
3098
|
+
const tag = { name: t.name, scope: t.scope === "user" ? "user" : "shared", store: t.at !== void 0, storeSource: t.sourceId ?? null, sourceId };
|
|
3099
|
+
remember(tag, history.keyOf(t.view));
|
|
3100
|
+
commit(t.view, { step: "template", name: t.name }, tag);
|
|
3063
3101
|
const over = zoneOverLimit(t.view, limits);
|
|
3064
|
-
|
|
3102
|
+
const issues = normalize2(t.view, encoded, { limits }).issues.filter((i) => !over || i.code !== "tooMany");
|
|
3103
|
+
setLeftOut([...over ? [{ text: fill(labels.viewTrimmed, { name: t.name, zone: labels.zones[over.zone], max: over.max.toLocaleString(locale) }) }] : [], ...unusedNotes(issues, t.view)]);
|
|
3065
3104
|
setIssuesDismissed(null);
|
|
3105
|
+
setLoads((x) => x + 1);
|
|
3106
|
+
setUnusedSaid(false);
|
|
3066
3107
|
announce(fill(labels.toastLoaded, { name: t.name }));
|
|
3067
3108
|
},
|
|
3068
|
-
[commit, labels, announce, limits, locale]
|
|
3109
|
+
[commit, labels, announce, limits, locale, history, remember, sourceId, encoded]
|
|
3069
3110
|
);
|
|
3111
|
+
const newReport = () => {
|
|
3112
|
+
if (empty) {
|
|
3113
|
+
return;
|
|
3114
|
+
}
|
|
3115
|
+
commit(emptyView2(), { step: "new" }, null);
|
|
3116
|
+
setLeftOut([]);
|
|
3117
|
+
setLoads((x) => x + 1);
|
|
3118
|
+
setUnusedSaid(false);
|
|
3119
|
+
announce(labels.newEmpty, { action: { label: labels.undo, run: () => undoLater.current() } });
|
|
3120
|
+
};
|
|
3070
3121
|
const viewStore = templateStore === "browser";
|
|
3071
3122
|
const storeName = viewsName(storageKey);
|
|
3072
3123
|
const subscribeViews = useCallback9((callback) => viewStore ? subscribeItem(storeName, callback) : () => {
|
|
3073
3124
|
}, [viewStore, storeName]);
|
|
3074
3125
|
const viewsText = useSyncExternalStore3(subscribeViews, () => viewStore ? readItem(storeName, localStore()) : null, () => null);
|
|
3075
|
-
const
|
|
3126
|
+
const entries = useMemo8(() => templateEntries(templates, viewStore && menus ? menus.storedViews(viewsText, sourceId) : [], Boolean(onDeleteTemplate)), [templates, viewStore, menus, viewsText, sourceId, onDeleteTemplate]);
|
|
3076
3127
|
const templateActions = {
|
|
3077
3128
|
view,
|
|
3078
3129
|
announce,
|
|
@@ -3084,9 +3135,29 @@ function Report(props) {
|
|
|
3084
3135
|
onSave: onSaveTemplate,
|
|
3085
3136
|
onDelete: onDeleteTemplate,
|
|
3086
3137
|
onPublish: canPublish ? onPublishTemplate : void 0,
|
|
3087
|
-
// a view leaves the report checked against the data, never as it was stored
|
|
3088
|
-
|
|
3089
|
-
|
|
3138
|
+
// a view leaves the report checked against the data, never as it was stored, and in the form a
|
|
3139
|
+
// save hands over (the view as shown: normalized, with the host's orders), so Publish and
|
|
3140
|
+
// Save send the same view
|
|
3141
|
+
normalized: (v) => JSON.parse(history.keyOf(v)),
|
|
3142
|
+
loaded: loadedView,
|
|
3143
|
+
empty,
|
|
3144
|
+
/**
|
|
3145
|
+
* A save kept: the view as it was when the save was clicked (`key`) is that saved view now. The
|
|
3146
|
+
* view shown takes its name only while it is still that view: a slow host may answer after
|
|
3147
|
+
* New, another view loaded or a change, and none of those may become the saved view.
|
|
3148
|
+
*/
|
|
3149
|
+
onSaved: (saved, key) => {
|
|
3150
|
+
setSavedAt(changesRef.current);
|
|
3151
|
+
const tag = { ...saved, sourceId };
|
|
3152
|
+
remember(tag, key);
|
|
3153
|
+
const now = latest.current.history;
|
|
3154
|
+
if (now.viewKey === key) {
|
|
3155
|
+
now.setTag(tag);
|
|
3156
|
+
}
|
|
3157
|
+
},
|
|
3158
|
+
viewKey: history.viewKey,
|
|
3159
|
+
onNew: newReport,
|
|
3160
|
+
canNew: !empty
|
|
3090
3161
|
};
|
|
3091
3162
|
const onKeyDown = (e) => {
|
|
3092
3163
|
const target = (
|
|
@@ -3114,27 +3185,27 @@ function Report(props) {
|
|
|
3114
3185
|
redo2();
|
|
3115
3186
|
}
|
|
3116
3187
|
};
|
|
3117
|
-
const layerValue =
|
|
3118
|
-
const renderOverlay = (src) => /* @__PURE__ */
|
|
3188
|
+
const layerValue = useMemo8(() => ({ layer, size }), [layer, size]);
|
|
3189
|
+
const renderOverlay = (src) => /* @__PURE__ */ React12.createElement("div", { className: "pk-chip pk-overlay" }, /* @__PURE__ */ React12.createElement(Icon, { name: "grip", size: 14 }), /* @__PURE__ */ React12.createElement("span", { className: `pk-type pk-type-${src.type ?? typeOf(src.field)}` }, /* @__PURE__ */ React12.createElement(Icon, { name: (
|
|
3119
3190
|
/** @type {any} */
|
|
3120
3191
|
TYPE_ICON[src.type ?? typeOf(src.field)] ?? "text"
|
|
3121
|
-
), size: 13 })), /* @__PURE__ */
|
|
3192
|
+
), size: 13 })), /* @__PURE__ */ React12.createElement("span", { className: "pk-chip-text" }, src.label ?? src.field));
|
|
3122
3193
|
const showTable = !error && !(empty && view.display === "table") && view.display !== "chart" && gridState.grid;
|
|
3123
|
-
const outer =
|
|
3194
|
+
const outer = useMemo8(() => result ? outerPaths(result) : [], [result]);
|
|
3124
3195
|
const folding = rowFolding(view, outer);
|
|
3125
|
-
const expandAll = () => {
|
|
3196
|
+
const expandAll = (texts) => {
|
|
3126
3197
|
const count = view.collapsed.rows.length;
|
|
3127
3198
|
commit(setCollapsed(view, "rows", null), { step: "collapse" });
|
|
3128
|
-
announce(plural(
|
|
3199
|
+
announce(plural(texts.groupsExpanded, count, { lang: labels.lang, locale }));
|
|
3129
3200
|
};
|
|
3130
|
-
const collapseAll = () => {
|
|
3201
|
+
const collapseAll = (texts) => {
|
|
3131
3202
|
if (!result) {
|
|
3132
3203
|
return;
|
|
3133
3204
|
}
|
|
3134
3205
|
commit(setCollapsed(view, "rows", outer), { step: "collapse" });
|
|
3135
|
-
announce(plural(
|
|
3206
|
+
announce(plural(texts.groupsCollapsed, folding.open, { lang: labels.lang, locale }));
|
|
3136
3207
|
};
|
|
3137
|
-
const series =
|
|
3208
|
+
const series = useMemo8(() => {
|
|
3138
3209
|
if (!chartResult || view.display !== "chart" || view.values.length === 0) {
|
|
3139
3210
|
return null;
|
|
3140
3211
|
}
|
|
@@ -3145,17 +3216,17 @@ function Report(props) {
|
|
|
3145
3216
|
}
|
|
3146
3217
|
}, [chartResult, view.display, view.values.length, labels]);
|
|
3147
3218
|
const allowedKey = JSON.stringify(allowedTips(tipsProp));
|
|
3148
|
-
const allowed =
|
|
3219
|
+
const allowed = useMemo8(() => JSON.parse(allowedKey), [allowedKey]);
|
|
3149
3220
|
const dismissedKey = JSON.stringify(cleanDismissed(dismissedTips));
|
|
3150
|
-
const [own2, setOwn] =
|
|
3151
|
-
const [lastDismissedKey, setLastDismissedKey] =
|
|
3221
|
+
const [own2, setOwn] = useState12(() => cleanDismissed(JSON.parse(dismissedKey)));
|
|
3222
|
+
const [lastDismissedKey, setLastDismissedKey] = useState12(dismissedKey);
|
|
3152
3223
|
if (dismissedKey !== lastDismissedKey) {
|
|
3153
3224
|
setLastDismissedKey(dismissedKey);
|
|
3154
3225
|
setOwn(JSON.parse(dismissedKey));
|
|
3155
3226
|
}
|
|
3156
3227
|
const subscribe = useCallback9((callback) => subscribeStored(storageKey, callback), [storageKey]);
|
|
3157
3228
|
const storedRaw = useSyncExternalStore3(subscribe, () => readStored(storageKey, localStore()), () => null);
|
|
3158
|
-
const dismissed =
|
|
3229
|
+
const dismissed = useMemo8(() => cleanDismissed([...own2, ...parseStored(storedRaw)]), [own2, storedRaw]);
|
|
3159
3230
|
const changeDismissed = useCallback9(
|
|
3160
3231
|
(next, id) => {
|
|
3161
3232
|
setOwn(next);
|
|
@@ -3170,21 +3241,28 @@ function Report(props) {
|
|
|
3170
3241
|
const zoneSwitch = helpSwitch(zoneInfoProp, dismissed);
|
|
3171
3242
|
const settingSwitch = helpSwitch(settingInfoProp, dismissed);
|
|
3172
3243
|
const explainUser = settingSwitch.user || zoneSwitch.user || describedFields && fieldSwitch.user;
|
|
3173
|
-
const
|
|
3244
|
+
const ready = menus ? menusNow(labels.lang) : null;
|
|
3245
|
+
const withTexts = ready ? ready.menuLabels(labels) : null;
|
|
3246
|
+
const [keptTexts, setKeptTexts] = useState12(
|
|
3247
|
+
/** @type {any} */
|
|
3248
|
+
null
|
|
3249
|
+
);
|
|
3250
|
+
if (withTexts && withTexts !== keptTexts) {
|
|
3251
|
+
setKeptTexts(withTexts);
|
|
3252
|
+
}
|
|
3253
|
+
const helpLabels = withTexts ?? keptTexts ?? labels;
|
|
3254
|
+
const help = useMemo8(
|
|
3174
3255
|
() => ({
|
|
3175
3256
|
explain: settingSwitch.on,
|
|
3176
|
-
|
|
3177
|
-
labels: menus ? menus.menuLabels(labels) : labels,
|
|
3178
|
-
isOpen: (id) => sectionOpen(id, dismissed),
|
|
3179
|
-
setOpen: (id, open) => changeDismissed(withSection(dismissed, id, open), null)
|
|
3257
|
+
labels: helpLabels
|
|
3180
3258
|
}),
|
|
3181
|
-
[settingSwitch.on,
|
|
3259
|
+
[settingSwitch.on, helpLabels]
|
|
3182
3260
|
);
|
|
3183
|
-
const [fieldsSession, setFieldsSession] =
|
|
3261
|
+
const [fieldsSession, setFieldsSession] = useState12(
|
|
3184
3262
|
/** @type {boolean | null} */
|
|
3185
3263
|
null
|
|
3186
3264
|
);
|
|
3187
|
-
|
|
3265
|
+
useEffect11(() => {
|
|
3188
3266
|
if (fieldList !== void 0 && fieldList !== "open" && fieldList !== "collapsed") {
|
|
3189
3267
|
warnOnce(`pivotkit: fieldList ${JSON.stringify(String(fieldList)).slice(0, 40)} is neither "open" nor "collapsed"; the user's choice decides`);
|
|
3190
3268
|
}
|
|
@@ -3228,11 +3306,11 @@ function Report(props) {
|
|
|
3228
3306
|
appliedLink.current = null;
|
|
3229
3307
|
setLinkCheck(null);
|
|
3230
3308
|
};
|
|
3231
|
-
const notes =
|
|
3232
|
-
const notesKey = JSON.stringify(notes);
|
|
3309
|
+
const notes = useMemo8(() => [...leftOut, ...result && !empty ? result.issues.slice(0, 20).map((issue) => ({ issue, raw: view })) : []], [leftOut, result, empty, view]);
|
|
3310
|
+
const notesKey = useMemo8(() => JSON.stringify([loads, ...notes.map((n) => "issue" in n ? [n.issue.path, n.issue.message] : n.text)]), [notes, loads]);
|
|
3233
3311
|
const summaryParts = big.enlarged ? layoutSummary(zoneEntries(view, types, labels), labels) : [];
|
|
3234
3312
|
const summaryText = summaryParts.length ? summaryParts.map((p) => `${p.title}: ${p.fields}`).join(" \xB7 ") : labels.layoutEmpty;
|
|
3235
|
-
return /* @__PURE__ */
|
|
3313
|
+
return /* @__PURE__ */ React12.createElement(
|
|
3236
3314
|
"div",
|
|
3237
3315
|
{
|
|
3238
3316
|
ref: root,
|
|
@@ -3250,7 +3328,7 @@ function Report(props) {
|
|
|
3250
3328
|
tabIndex: -1,
|
|
3251
3329
|
onKeyDown
|
|
3252
3330
|
},
|
|
3253
|
-
/* @__PURE__ */
|
|
3331
|
+
/* @__PURE__ */ React12.createElement(LayerContext.Provider, { value: layerValue }, /* @__PURE__ */ React12.createElement(HelpContext.Provider, { value: help }, /* @__PURE__ */ React12.createElement(
|
|
3254
3332
|
PivotDnd,
|
|
3255
3333
|
{
|
|
3256
3334
|
labels,
|
|
@@ -3262,7 +3340,7 @@ function Report(props) {
|
|
|
3262
3340
|
}
|
|
3263
3341
|
}
|
|
3264
3342
|
},
|
|
3265
|
-
/* @__PURE__ */
|
|
3343
|
+
/* @__PURE__ */ React12.createElement("div", { className: `pk-layout${drawerOpen ? " pk-drawer-open" : ""}` }, /* @__PURE__ */ React12.createElement("div", { className: "pk-panel-slot", ref: panelRef }, /* @__PURE__ */ React12.createElement(
|
|
3266
3344
|
FieldPanel,
|
|
3267
3345
|
{
|
|
3268
3346
|
fields,
|
|
@@ -3289,7 +3367,7 @@ function Report(props) {
|
|
|
3289
3367
|
root.current?.querySelector(".pk-toolbar button:not([disabled])")?.focus()
|
|
3290
3368
|
)
|
|
3291
3369
|
}
|
|
3292
|
-
)), drawerOpen ? /* @__PURE__ */
|
|
3370
|
+
)), drawerOpen ? /* @__PURE__ */ React12.createElement("div", { className: "pk-scrim pk-drawer-scrim", onClick: () => setDrawer(false), "aria-hidden": "true" }) : null, /* @__PURE__ */ React12.createElement("div", { className: "pk-main", ref: mainRef }, /* @__PURE__ */ React12.createElement(
|
|
3293
3371
|
Toolbar,
|
|
3294
3372
|
{
|
|
3295
3373
|
view,
|
|
@@ -3302,6 +3380,7 @@ function Report(props) {
|
|
|
3302
3380
|
onUndo: undo2,
|
|
3303
3381
|
onRedo: redo2,
|
|
3304
3382
|
onReset: reset2,
|
|
3383
|
+
loadedView: loadedView ? { name: loadedView.name, changed: unsaved } : null,
|
|
3305
3384
|
onDisplay: (d) => commit(setDisplay(view, d), { step: "display", display: d }),
|
|
3306
3385
|
onChart: (p) => commit(setChart(view, p), { step: "chart", type: p }),
|
|
3307
3386
|
onChartDisplay: (patch) => commit(setChartDisplay(view, patch), { step: "chartDisplay" }),
|
|
@@ -3310,12 +3389,13 @@ function Report(props) {
|
|
|
3310
3389
|
onCollapse: collapseAll,
|
|
3311
3390
|
folding,
|
|
3312
3391
|
share,
|
|
3313
|
-
templates:
|
|
3392
|
+
templates: entries,
|
|
3314
3393
|
onLoadTemplate: loadTemplate,
|
|
3315
3394
|
templateActions,
|
|
3316
3395
|
onExport: doExport,
|
|
3317
3396
|
prepareExport: prepareExporters,
|
|
3318
3397
|
chartReady: view.display === "chart" && chartReady,
|
|
3398
|
+
empty,
|
|
3319
3399
|
onShowFields: () => setDrawer(true),
|
|
3320
3400
|
layoutFolded,
|
|
3321
3401
|
onLayout: () => setFolded(!layoutFolded),
|
|
@@ -3330,14 +3410,13 @@ function Report(props) {
|
|
|
3330
3410
|
},
|
|
3331
3411
|
viewsRequest
|
|
3332
3412
|
}
|
|
3333
|
-
), /* @__PURE__ */
|
|
3413
|
+
), /* @__PURE__ */ React12.createElement(
|
|
3334
3414
|
Zones,
|
|
3335
3415
|
{
|
|
3336
3416
|
view,
|
|
3337
3417
|
types,
|
|
3338
3418
|
labels,
|
|
3339
3419
|
commit,
|
|
3340
|
-
openFilter: (field, anchor) => setFilterTarget({ field, anchor }),
|
|
3341
3420
|
encoded,
|
|
3342
3421
|
locale,
|
|
3343
3422
|
onSwap: () => commit(swapAxes(view), { step: "swap" }),
|
|
@@ -3346,14 +3425,29 @@ function Report(props) {
|
|
|
3346
3425
|
onShow: () => setFolded(false),
|
|
3347
3426
|
defaultsOf,
|
|
3348
3427
|
infoOf,
|
|
3428
|
+
earlier: history.earlier,
|
|
3349
3429
|
explain: zoneSwitch.on,
|
|
3350
3430
|
showInfo: fieldSwitch.on
|
|
3351
3431
|
}
|
|
3352
|
-
), linkCheck ? /* @__PURE__ */
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3432
|
+
), linkCheck ? /* @__PURE__ */ React12.createElement("div", { className: "pk-link-check", "data-testid": "link-check" }, /* @__PURE__ */ React12.createElement(MenuPanel, { name: "LoadCheck", props: { check: linkCheck, labels, title: labels.linkCheckTitle, quiet: linkCheck.quiet, close: () => setLinkCheck(null), onCancel: cancelLink } })) : null, /* @__PURE__ */ React12.createElement(
|
|
3433
|
+
Unused,
|
|
3434
|
+
{
|
|
3435
|
+
notes,
|
|
3436
|
+
notesKey,
|
|
3437
|
+
dismissed: issuesDismissed === notesKey,
|
|
3438
|
+
onDismiss: (next) => {
|
|
3439
|
+
setIssuesDismissed(notesKey);
|
|
3440
|
+
next?.focus({ preventScroll: true });
|
|
3441
|
+
if (!next || activeIn(next) !== next) {
|
|
3442
|
+
root.current?.focus({ preventScroll: true });
|
|
3443
|
+
}
|
|
3444
|
+
},
|
|
3445
|
+
labels,
|
|
3446
|
+
locale,
|
|
3447
|
+
narrow: size === "narrow",
|
|
3448
|
+
quiet: unusedSaid
|
|
3449
|
+
}
|
|
3450
|
+
), /* @__PURE__ */ React12.createElement(
|
|
3357
3451
|
Tips,
|
|
3358
3452
|
{
|
|
3359
3453
|
tips: shownTips,
|
|
@@ -3362,7 +3456,7 @@ function Report(props) {
|
|
|
3362
3456
|
onAction: runTip,
|
|
3363
3457
|
focusFallback: () => root.current?.focus({ preventScroll: true })
|
|
3364
3458
|
}
|
|
3365
|
-
), showTable && view.values.length ? /* @__PURE__ */
|
|
3459
|
+
), showTable && view.values.length ? /* @__PURE__ */ React12.createElement("p", { id: hintId, className: "pk-sr", "data-testid": "cell-hint" }, labels.tips.cells) : null, /* @__PURE__ */ React12.createElement("div", { className: "pk-result-head" }, big.enlarged ? /* @__PURE__ */ React12.createElement("p", { className: "pk-enlarged-fields", "data-testid": "enlarged-fields" }, summaryText) : null, /* @__PURE__ */ React12.createElement("span", { className: "pk-grow" }), /* @__PURE__ */ React12.createElement("button", { type: "button", className: "pk-btn pk-pressable pk-small-btn", "data-pk-on": big.enlarged ? "" : void 0, onClick: big.toggleEnlarged, "data-testid": "enlarge" }, /* @__PURE__ */ React12.createElement(Icon, { name: "enlarge", size: 14 }), /* @__PURE__ */ React12.createElement("span", { className: "pk-btn-text" }, big.enlarged ? labels.reduce : labels.enlarge)), big.fullOk ? /* @__PURE__ */ React12.createElement("button", { type: "button", className: "pk-btn pk-pressable pk-small-btn", "aria-pressed": big.full, onClick: big.toggleFull, "data-testid": "full-screen" }, /* @__PURE__ */ React12.createElement(Icon, { name: "fullScreen", size: 14 }), /* @__PURE__ */ React12.createElement("span", { className: "pk-btn-text" }, labels.fullScreen)) : null), /* @__PURE__ */ React12.createElement("section", { className: "pk-result", "aria-label": view.display === "chart" ? labels.chart : labels.table }, loading2 || opening ? /* @__PURE__ */ React12.createElement(Skeleton, { text: labels.loadingReport }) : error ? /* @__PURE__ */ React12.createElement("div", { className: "pk-message pk-error", role: "alert" }, /* @__PURE__ */ React12.createElement(Icon, { name: "info" }), /* @__PURE__ */ React12.createElement("p", null, errorText(error, labels, locale))) : empty && view.display === "table" ? /* @__PURE__ */ React12.createElement(EmptyState, { labels, templates: entries, onTemplate: loadTemplate }) : view.display === "chart" && chartResult ? /* @__PURE__ */ React12.createElement(
|
|
3366
3460
|
PivotChart,
|
|
3367
3461
|
{
|
|
3368
3462
|
result: chartResult,
|
|
@@ -3380,9 +3474,9 @@ function Report(props) {
|
|
|
3380
3474
|
},
|
|
3381
3475
|
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 ?? "") })
|
|
3382
3476
|
}
|
|
3383
|
-
) : gridState.grid ? /* @__PURE__ */
|
|
3384
|
-
filterTarget ? /* @__PURE__ */
|
|
3385
|
-
), /* @__PURE__ */
|
|
3477
|
+
) : 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 }) : ""), 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),
|
|
3478
|
+
filterTarget ? /* @__PURE__ */ React12.createElement(MenuPanel, { name: "FilterPopover", props: { target: filterTarget, onClose: closeFilter, view, encoded, locale, labels, commit } }) : null
|
|
3479
|
+
), /* @__PURE__ */ React12.createElement("div", { className: "pk-layer", ref: setLayer }, /* @__PURE__ */ React12.createElement("span", { className: "pk-origin", "aria-hidden": "true" }))))
|
|
3386
3480
|
);
|
|
3387
3481
|
}
|
|
3388
3482
|
export {
|