vastgrid 0.1.1 → 0.2.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/README.md +175 -13
- package/dist/canvas/geometry.d.ts +92 -0
- package/dist/canvas/geometry.d.ts.map +1 -0
- package/dist/canvas/geometry.js +197 -0
- package/dist/canvas/geometry.js.map +1 -0
- package/dist/canvas/grid-canvas.d.ts +161 -0
- package/dist/canvas/grid-canvas.d.ts.map +1 -0
- package/dist/canvas/grid-canvas.js +1146 -0
- package/dist/canvas/grid-canvas.js.map +1 -0
- package/dist/canvas/hooks.d.ts +61 -0
- package/dist/canvas/hooks.d.ts.map +1 -0
- package/dist/canvas/hooks.js +2 -0
- package/dist/canvas/hooks.js.map +1 -0
- package/dist/canvas/keys.d.ts +26 -0
- package/dist/canvas/keys.d.ts.map +1 -0
- package/dist/canvas/keys.js +133 -0
- package/dist/canvas/keys.js.map +1 -0
- package/dist/canvas/layout.d.ts +26 -0
- package/dist/canvas/layout.d.ts.map +1 -0
- package/dist/canvas/layout.js +73 -0
- package/dist/canvas/layout.js.map +1 -0
- package/dist/canvas/scroll.d.ts +31 -0
- package/dist/canvas/scroll.d.ts.map +1 -0
- package/dist/canvas/scroll.js +111 -0
- package/dist/canvas/scroll.js.map +1 -0
- package/dist/canvas/text.d.ts +23 -0
- package/dist/canvas/text.d.ts.map +1 -0
- package/dist/canvas/text.js +142 -0
- package/dist/canvas/text.js.map +1 -0
- package/dist/{theme.d.ts → canvas/theme.d.ts} +8 -0
- package/dist/canvas/theme.d.ts.map +1 -0
- package/dist/canvas/theme.js +62 -0
- package/dist/canvas/theme.js.map +1 -0
- package/dist/core/cache.d.ts +48 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +222 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/core/checked.d.ts +20 -0
- package/dist/core/checked.d.ts.map +1 -0
- package/dist/core/checked.js +61 -0
- package/dist/core/checked.js.map +1 -0
- package/dist/core/client.d.ts +33 -0
- package/dist/core/client.d.ts.map +1 -0
- package/dist/core/client.js +103 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/conditions.d.ts +48 -0
- package/dist/core/conditions.d.ts.map +1 -0
- package/dist/core/conditions.js +105 -0
- package/dist/core/conditions.js.map +1 -0
- package/dist/core/evaluate.d.ts +20 -0
- package/dist/core/evaluate.d.ts.map +1 -0
- package/dist/core/evaluate.js +210 -0
- package/dist/core/evaluate.js.map +1 -0
- package/dist/core/filters.d.ts +51 -0
- package/dist/core/filters.d.ts.map +1 -0
- package/dist/core/filters.js +303 -0
- package/dist/core/filters.js.map +1 -0
- package/dist/core/format.d.ts +14 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/format.js +303 -0
- package/dist/core/format.js.map +1 -0
- package/dist/core/measures.d.ts +26 -0
- package/dist/core/measures.d.ts.map +1 -0
- package/dist/core/measures.js +105 -0
- package/dist/core/measures.js.map +1 -0
- package/dist/core/request-ids.d.ts +20 -0
- package/dist/core/request-ids.d.ts.map +1 -0
- package/dist/core/request-ids.js +55 -0
- package/dist/core/request-ids.js.map +1 -0
- package/dist/core/rows.d.ts +79 -0
- package/dist/core/rows.d.ts.map +1 -0
- package/dist/core/rows.js +173 -0
- package/dist/core/rows.js.map +1 -0
- package/dist/core/store.d.ts +233 -0
- package/dist/core/store.d.ts.map +1 -0
- package/dist/core/store.js +1162 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/totals.d.ts +24 -0
- package/dist/core/totals.d.ts.map +1 -0
- package/dist/core/totals.js +49 -0
- package/dist/core/totals.js.map +1 -0
- package/dist/core/trace.d.ts +7 -0
- package/dist/core/trace.d.ts.map +1 -0
- package/dist/core/trace.js +26 -0
- package/dist/core/trace.js.map +1 -0
- package/dist/core/transports.d.ts +50 -0
- package/dist/core/transports.d.ts.map +1 -0
- package/dist/core/transports.js +160 -0
- package/dist/core/transports.js.map +1 -0
- package/dist/core/types.d.ts +150 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +45 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core.d.ts +12 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +11 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +15 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/react/accessible-rows.d.ts +13 -0
- package/dist/react/accessible-rows.d.ts.map +1 -0
- package/dist/react/accessible-rows.js +320 -0
- package/dist/react/accessible-rows.js.map +1 -0
- package/dist/react/cell-editor.d.ts +22 -0
- package/dist/react/cell-editor.d.ts.map +1 -0
- package/dist/react/cell-editor.js +431 -0
- package/dist/react/cell-editor.js.map +1 -0
- package/dist/react/cell-menu.d.ts +18 -0
- package/dist/react/cell-menu.d.ts.map +1 -0
- package/dist/react/cell-menu.js +299 -0
- package/dist/react/cell-menu.js.map +1 -0
- package/dist/react/column-menu.d.ts +16 -0
- package/dist/react/column-menu.d.ts.map +1 -0
- package/dist/react/column-menu.js +1311 -0
- package/dist/react/column-menu.js.map +1 -0
- package/dist/react/columns-menu.d.ts +7 -0
- package/dist/react/columns-menu.d.ts.map +1 -0
- package/dist/react/columns-menu.js +249 -0
- package/dist/react/columns-menu.js.map +1 -0
- package/dist/react/conditions-menu.d.ts +10 -0
- package/dist/react/conditions-menu.d.ts.map +1 -0
- package/dist/react/conditions-menu.js +795 -0
- package/dist/react/conditions-menu.js.map +1 -0
- package/dist/react/context.d.ts +29 -0
- package/dist/react/context.d.ts.map +1 -0
- package/dist/react/context.js +18 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/data-grid.d.ts +79 -0
- package/dist/react/data-grid.d.ts.map +1 -0
- package/dist/react/data-grid.js +653 -0
- package/dist/react/data-grid.js.map +1 -0
- package/dist/react/detail-panel.d.ts +22 -0
- package/dist/react/detail-panel.d.ts.map +1 -0
- package/dist/react/detail-panel.js +242 -0
- package/dist/react/detail-panel.js.map +1 -0
- package/dist/react/export-menu.d.ts +11 -0
- package/dist/react/export-menu.d.ts.map +1 -0
- package/dist/react/export-menu.js +304 -0
- package/dist/react/export-menu.js.map +1 -0
- package/dist/react/find-bar.d.ts +11 -0
- package/dist/react/find-bar.d.ts.map +1 -0
- package/dist/react/find-bar.js +303 -0
- package/dist/react/find-bar.js.map +1 -0
- package/dist/react/format-form.d.ts +12 -0
- package/dist/react/format-form.d.ts.map +1 -0
- package/dist/react/format-form.js +863 -0
- package/dist/react/format-form.js.map +1 -0
- package/dist/react/formula-menu.d.ts +6 -0
- package/dist/react/formula-menu.d.ts.map +1 -0
- package/dist/react/formula-menu.js +343 -0
- package/dist/react/formula-menu.js.map +1 -0
- package/dist/react/grid-body.d.ts +33 -0
- package/dist/react/grid-body.d.ts.map +1 -0
- package/dist/react/grid-body.js +1389 -0
- package/dist/react/grid-body.js.map +1 -0
- package/dist/react/group-menu.d.ts +7 -0
- package/dist/react/group-menu.d.ts.map +1 -0
- package/dist/react/group-menu.js +508 -0
- package/dist/react/group-menu.js.map +1 -0
- package/dist/react/hooks.d.ts +33 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +161 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/messages.d.ts +180 -0
- package/dist/react/messages.d.ts.map +1 -0
- package/dist/react/messages.js +414 -0
- package/dist/react/messages.js.map +1 -0
- package/dist/react/save.d.ts +9 -0
- package/dist/react/save.d.ts.map +1 -0
- package/dist/react/save.js +102 -0
- package/dist/react/save.js.map +1 -0
- package/dist/react/static-rows.d.ts +9 -0
- package/dist/react/static-rows.d.ts.map +1 -0
- package/dist/react/static-rows.js +176 -0
- package/dist/react/static-rows.js.map +1 -0
- package/dist/react/status-bar.d.ts +12 -0
- package/dist/react/status-bar.d.ts.map +1 -0
- package/dist/react/status-bar.js +413 -0
- package/dist/react/status-bar.js.map +1 -0
- package/dist/react/toolbar-popover.d.ts +14 -0
- package/dist/react/toolbar-popover.d.ts.map +1 -0
- package/dist/react/toolbar-popover.js +143 -0
- package/dist/react/toolbar-popover.js.map +1 -0
- package/dist/react/toolbar.d.ts +13 -0
- package/dist/react/toolbar.d.ts.map +1 -0
- package/dist/react/toolbar.js +344 -0
- package/dist/react/toolbar.js.map +1 -0
- package/dist/server.d.ts +22 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +45 -0
- package/dist/server.js.map +1 -0
- package/dist/styles.css +496 -316
- package/package.json +42 -17
- package/src/canvas/geometry.ts +197 -0
- package/src/canvas/grid-canvas.ts +1222 -0
- package/src/canvas/hooks.ts +61 -0
- package/src/canvas/keys.ts +96 -0
- package/src/canvas/layout.ts +77 -0
- package/src/canvas/scroll.ts +120 -0
- package/src/canvas/text.ts +155 -0
- package/src/{theme.ts → canvas/theme.ts} +14 -1
- package/src/core/cache.ts +247 -0
- package/src/core/checked.ts +64 -0
- package/src/core/client.ts +103 -0
- package/src/core/conditions.ts +89 -0
- package/src/core/evaluate.ts +221 -0
- package/src/core/filters.ts +268 -0
- package/src/core/format.ts +309 -0
- package/src/core/measures.ts +99 -0
- package/src/core/request-ids.ts +54 -0
- package/src/core/rows.ts +213 -0
- package/src/core/store.ts +1122 -0
- package/src/core/totals.ts +59 -0
- package/src/core/trace.ts +44 -0
- package/src/core/transports.ts +177 -0
- package/src/core/types.ts +168 -0
- package/src/core.ts +39 -0
- package/src/index.ts +24 -12
- package/src/react/accessible-rows.tsx +242 -0
- package/src/react/cell-editor.tsx +216 -0
- package/src/react/cell-menu.tsx +166 -0
- package/src/react/column-menu.tsx +619 -0
- package/src/react/columns-menu.tsx +116 -0
- package/src/react/conditions-menu.tsx +289 -0
- package/src/react/context.ts +33 -0
- package/src/react/data-grid.tsx +286 -0
- package/src/react/detail-panel.tsx +92 -0
- package/src/react/export-menu.tsx +112 -0
- package/src/react/find-bar.tsx +112 -0
- package/src/react/format-form.tsx +421 -0
- package/src/react/formula-menu.tsx +163 -0
- package/src/react/grid-body.tsx +744 -0
- package/src/react/group-menu.tsx +214 -0
- package/src/react/hooks.ts +104 -0
- package/src/react/messages.ts +556 -0
- package/src/react/save.ts +42 -0
- package/src/react/static-rows.tsx +59 -0
- package/src/react/status-bar.tsx +175 -0
- package/src/react/toolbar-popover.tsx +69 -0
- package/src/react/toolbar.tsx +152 -0
- package/src/server.ts +58 -0
- package/src/styles.css +496 -316
- package/dist/components/bars.d.ts +0 -14
- package/dist/components/bars.d.ts.map +0 -1
- package/dist/components/bars.js +0 -68
- package/dist/components/bars.js.map +0 -1
- package/dist/components/cell-inspector.d.ts +0 -11
- package/dist/components/cell-inspector.d.ts.map +0 -1
- package/dist/components/cell-inspector.js +0 -37
- package/dist/components/cell-inspector.js.map +0 -1
- package/dist/components/columns-panel.d.ts +0 -12
- package/dist/components/columns-panel.d.ts.map +0 -1
- package/dist/components/columns-panel.js +0 -11
- package/dist/components/columns-panel.js.map +0 -1
- package/dist/components/filter-panel.d.ts +0 -22
- package/dist/components/filter-panel.d.ts.map +0 -1
- package/dist/components/filter-panel.js +0 -169
- package/dist/components/filter-panel.js.map +0 -1
- package/dist/components/find-bar.d.ts +0 -9
- package/dist/components/find-bar.d.ts.map +0 -1
- package/dist/components/find-bar.js +0 -46
- package/dist/components/find-bar.js.map +0 -1
- package/dist/components/popover.d.ts +0 -38
- package/dist/components/popover.d.ts.map +0 -1
- package/dist/components/popover.js +0 -104
- package/dist/components/popover.js.map +0 -1
- package/dist/components/stats-panel.d.ts +0 -12
- package/dist/components/stats-panel.d.ts.map +0 -1
- package/dist/components/stats-panel.js +0 -40
- package/dist/components/stats-panel.js.map +0 -1
- package/dist/controller.d.ts +0 -227
- package/dist/controller.d.ts.map +0 -1
- package/dist/controller.js +0 -845
- package/dist/controller.js.map +0 -1
- package/dist/data-grid.d.ts +0 -51
- package/dist/data-grid.d.ts.map +0 -1
- package/dist/data-grid.js +0 -704
- package/dist/data-grid.js.map +0 -1
- package/dist/labels.d.ts +0 -9
- package/dist/labels.d.ts.map +0 -1
- package/dist/labels.js +0 -38
- package/dist/labels.js.map +0 -1
- package/dist/messages.d.ts +0 -99
- package/dist/messages.d.ts.map +0 -1
- package/dist/messages.js +0 -276
- package/dist/messages.js.map +0 -1
- package/dist/renderer.d.ts +0 -52
- package/dist/renderer.d.ts.map +0 -1
- package/dist/renderer.js +0 -522
- package/dist/renderer.js.map +0 -1
- package/dist/text.d.ts +0 -14
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js +0 -63
- package/dist/text.js.map +0 -1
- package/dist/theme.d.ts.map +0 -1
- package/dist/theme.js +0 -54
- package/dist/theme.js.map +0 -1
- package/src/components/bars.tsx +0 -180
- package/src/components/cell-inspector.tsx +0 -70
- package/src/components/columns-panel.tsx +0 -59
- package/src/components/filter-panel.tsx +0 -293
- package/src/components/find-bar.tsx +0 -104
- package/src/components/popover.tsx +0 -194
- package/src/components/stats-panel.tsx +0 -153
- package/src/controller.ts +0 -945
- package/src/data-grid.tsx +0 -1035
- package/src/labels.ts +0 -46
- package/src/messages.ts +0 -390
- package/src/renderer.ts +0 -535
- package/src/text.ts +0 -55
|
@@ -0,0 +1,1311 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { use, useEffect, useId, useLayoutEffect, useRef, useState, useTransition } from "react";
|
|
3
|
+
import { isBlank, joinParts, measureTakes, textOf } from "vastgrid-spec";
|
|
4
|
+
import { conditionsOf, FilterTextError, filterParts, operatorsFor, readFilter, takesNoValue } from "../core/filters.js";
|
|
5
|
+
import { measureName, offers, statisticsOf, TOTALS } from "../core/measures.js";
|
|
6
|
+
import { LocaleContext } from "./context.js";
|
|
7
|
+
import { FormatForm } from "./format-form.js";
|
|
8
|
+
import { useGridSelector, useGridStore } from "./hooks.js";
|
|
9
|
+
|
|
10
|
+
/** Where the column menu opens: a column of the view, at a point of the page. */
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
+
/** The key of a value in the list; blank values (§3.2) share one. */
|
|
13
|
+
const BLANK = "\u0000blank";
|
|
14
|
+
function keyOf(value, column) {
|
|
15
|
+
return isBlank(value, column) ? BLANK : JSON.stringify(value);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** `filter.column` with the parts of a filter, or null when its text is not a value of the column. */
|
|
19
|
+
function filterCommand(filter, column) {
|
|
20
|
+
let parts = [];
|
|
21
|
+
try {
|
|
22
|
+
if (filter) parts = filterParts(filter, column);
|
|
23
|
+
} catch (cause) {
|
|
24
|
+
if (cause instanceof FilterTextError) return null;
|
|
25
|
+
throw cause;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
command: "filter.column",
|
|
29
|
+
column: column.name,
|
|
30
|
+
where: joinParts(parts) ?? null
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** How long typing in the values' search box must pause before the list is read again. */
|
|
35
|
+
const SEARCH_DELAY = 250;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The filter of one column (§6.2.1): a list of its values with how many rows have each, read under the other
|
|
39
|
+
* filters (`GridStore.values`) when the engine groups rows, and a condition on typed text. Applying dispatches
|
|
40
|
+
* `filter.column` with the parts it makes, replacing the column's conditions.
|
|
41
|
+
*/
|
|
42
|
+
function FilterForm(t0) {
|
|
43
|
+
const $ = _c(118);
|
|
44
|
+
const {
|
|
45
|
+
column,
|
|
46
|
+
onDone
|
|
47
|
+
} = t0;
|
|
48
|
+
const store = useGridStore();
|
|
49
|
+
const {
|
|
50
|
+
messages,
|
|
51
|
+
number
|
|
52
|
+
} = use(LocaleContext);
|
|
53
|
+
const id = useId();
|
|
54
|
+
const parts = useGridSelector(_temp);
|
|
55
|
+
const lists = useGridSelector(_temp2);
|
|
56
|
+
let t1;
|
|
57
|
+
if ($[0] !== column.name || $[1] !== parts) {
|
|
58
|
+
t1 = () => readFilter(conditionsOf(parts, column.name), column.name);
|
|
59
|
+
$[0] = column.name;
|
|
60
|
+
$[1] = parts;
|
|
61
|
+
$[2] = t1;
|
|
62
|
+
} else {
|
|
63
|
+
t1 = $[2];
|
|
64
|
+
}
|
|
65
|
+
const [initial] = useState(t1);
|
|
66
|
+
const read = initial === "other" ? null : initial;
|
|
67
|
+
const operators = operatorsFor(column.type);
|
|
68
|
+
const [search, setSearch] = useState("");
|
|
69
|
+
const [list, setList] = useState(null);
|
|
70
|
+
const [failure, setFailure] = useState(null);
|
|
71
|
+
let t2;
|
|
72
|
+
if ($[3] !== read) {
|
|
73
|
+
t2 = () => !(read?.kind === "values" && !read.exclude);
|
|
74
|
+
$[3] = read;
|
|
75
|
+
$[4] = t2;
|
|
76
|
+
} else {
|
|
77
|
+
t2 = $[4];
|
|
78
|
+
}
|
|
79
|
+
const [base, setBase] = useState(t2);
|
|
80
|
+
let t3;
|
|
81
|
+
if ($[5] !== column || $[6] !== read) {
|
|
82
|
+
t3 = () => {
|
|
83
|
+
const map = new Map();
|
|
84
|
+
if (read?.kind !== "values") {
|
|
85
|
+
return map;
|
|
86
|
+
}
|
|
87
|
+
for (const value of read.values) {
|
|
88
|
+
map.set(keyOf(value, column), value);
|
|
89
|
+
}
|
|
90
|
+
if (read.blank) {
|
|
91
|
+
map.set(BLANK, null);
|
|
92
|
+
}
|
|
93
|
+
return map;
|
|
94
|
+
};
|
|
95
|
+
$[5] = column;
|
|
96
|
+
$[6] = read;
|
|
97
|
+
$[7] = t3;
|
|
98
|
+
} else {
|
|
99
|
+
t3 = $[7];
|
|
100
|
+
}
|
|
101
|
+
const [toggled, setToggled] = useState(t3);
|
|
102
|
+
const [operator, setOperator] = useState(read?.kind === "condition" && operators.includes(read.operator) ? read.operator : "none");
|
|
103
|
+
const [first, setFirst] = useState(read?.kind === "condition" ? read.first : "");
|
|
104
|
+
const [second, setSecond] = useState(read?.kind === "condition" ? read.second : "");
|
|
105
|
+
const [error, setError] = useState(null);
|
|
106
|
+
const [pending, startApply] = useTransition();
|
|
107
|
+
let t4;
|
|
108
|
+
let t5;
|
|
109
|
+
if ($[8] !== column.name || $[9] !== lists || $[10] !== search || $[11] !== store) {
|
|
110
|
+
t4 = () => {
|
|
111
|
+
if (!lists) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const abort = new AbortController();
|
|
115
|
+
const timer = setTimeout(() => {
|
|
116
|
+
store.values(column.name, {
|
|
117
|
+
search
|
|
118
|
+
}, abort.signal).then(result => {
|
|
119
|
+
setList(result);
|
|
120
|
+
setFailure(null);
|
|
121
|
+
}).catch(cause => {
|
|
122
|
+
if (!abort.signal.aborted) {
|
|
123
|
+
setFailure(cause instanceof Error ? cause.message : String(cause));
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}, search ? SEARCH_DELAY : 0);
|
|
127
|
+
return () => {
|
|
128
|
+
clearTimeout(timer);
|
|
129
|
+
abort.abort();
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
t5 = [store, lists, column.name, search];
|
|
133
|
+
$[8] = column.name;
|
|
134
|
+
$[9] = lists;
|
|
135
|
+
$[10] = search;
|
|
136
|
+
$[11] = store;
|
|
137
|
+
$[12] = t4;
|
|
138
|
+
$[13] = t5;
|
|
139
|
+
} else {
|
|
140
|
+
t4 = $[12];
|
|
141
|
+
t5 = $[13];
|
|
142
|
+
}
|
|
143
|
+
useEffect(t4, t5);
|
|
144
|
+
let apply;
|
|
145
|
+
let conditionOn;
|
|
146
|
+
let t10;
|
|
147
|
+
let t11;
|
|
148
|
+
let t6;
|
|
149
|
+
let t7;
|
|
150
|
+
let t8;
|
|
151
|
+
let t9;
|
|
152
|
+
if ($[14] !== base || $[15] !== column || $[16] !== failure || $[17] !== first || $[18] !== id || $[19] !== initial || $[20] !== list || $[21] !== lists || $[22] !== messages || $[23] !== number || $[24] !== onDone || $[25] !== operator || $[26] !== search || $[27] !== second || $[28] !== store || $[29] !== toggled) {
|
|
153
|
+
const items = [];
|
|
154
|
+
for (const item of list?.values ?? []) {
|
|
155
|
+
const key = keyOf(item.value, column);
|
|
156
|
+
const same = items.find(other => other.key === key);
|
|
157
|
+
if (same) {
|
|
158
|
+
same.count = same.count + item.count;
|
|
159
|
+
} else {
|
|
160
|
+
items.push({
|
|
161
|
+
key,
|
|
162
|
+
value: item.value,
|
|
163
|
+
count: item.count
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const checked = key_0 => toggled.has(key_0) ? !base : base;
|
|
168
|
+
conditionOn = operator !== "none";
|
|
169
|
+
const allChecked = toggled.size === 0 ? base : base && items.every(item_0 => checked(item_0.key));
|
|
170
|
+
const toggle = (key_1, value_0) => setToggled(current => {
|
|
171
|
+
const next = new Map(current);
|
|
172
|
+
if (next.has(key_1)) {
|
|
173
|
+
next.delete(key_1);
|
|
174
|
+
} else {
|
|
175
|
+
next.set(key_1, value_0);
|
|
176
|
+
}
|
|
177
|
+
return next;
|
|
178
|
+
});
|
|
179
|
+
let t12;
|
|
180
|
+
if ($[38] !== base || $[39] !== conditionOn || $[40] !== first || $[41] !== operator || $[42] !== second || $[43] !== toggled) {
|
|
181
|
+
t12 = () => {
|
|
182
|
+
if (conditionOn) {
|
|
183
|
+
return {
|
|
184
|
+
kind: "condition",
|
|
185
|
+
operator,
|
|
186
|
+
first,
|
|
187
|
+
second
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
if (base && toggled.size === 0) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const values = [...toggled].flatMap(_temp3);
|
|
194
|
+
return {
|
|
195
|
+
kind: "values",
|
|
196
|
+
values,
|
|
197
|
+
blank: toggled.has(BLANK),
|
|
198
|
+
exclude: base
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
$[38] = base;
|
|
202
|
+
$[39] = conditionOn;
|
|
203
|
+
$[40] = first;
|
|
204
|
+
$[41] = operator;
|
|
205
|
+
$[42] = second;
|
|
206
|
+
$[43] = toggled;
|
|
207
|
+
$[44] = t12;
|
|
208
|
+
} else {
|
|
209
|
+
t12 = $[44];
|
|
210
|
+
}
|
|
211
|
+
const filterOf = t12;
|
|
212
|
+
let t13;
|
|
213
|
+
if ($[45] !== column || $[46] !== messages || $[47] !== onDone || $[48] !== store) {
|
|
214
|
+
t13 = filter => {
|
|
215
|
+
const command = filterCommand(filter, column);
|
|
216
|
+
if (!command) {
|
|
217
|
+
setError(messages.invalidValue(column.name));
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
startApply(async () => {
|
|
221
|
+
const outcome = await store.dispatch(command);
|
|
222
|
+
if (!outcome.ok) {
|
|
223
|
+
setError(outcome.error.message);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
onDone();
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
$[45] = column;
|
|
230
|
+
$[46] = messages;
|
|
231
|
+
$[47] = onDone;
|
|
232
|
+
$[48] = store;
|
|
233
|
+
$[49] = t13;
|
|
234
|
+
} else {
|
|
235
|
+
t13 = $[49];
|
|
236
|
+
}
|
|
237
|
+
apply = t13;
|
|
238
|
+
let t14;
|
|
239
|
+
if ($[50] !== apply || $[51] !== filterOf) {
|
|
240
|
+
t14 = event => {
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
apply(filterOf());
|
|
243
|
+
};
|
|
244
|
+
$[50] = apply;
|
|
245
|
+
$[51] = filterOf;
|
|
246
|
+
$[52] = t14;
|
|
247
|
+
} else {
|
|
248
|
+
t14 = $[52];
|
|
249
|
+
}
|
|
250
|
+
const submit = t14;
|
|
251
|
+
const label = value_2 => isBlank(value_2, column) ? messages.blank : textOf(value_2, column) ?? "";
|
|
252
|
+
t6 = "vg-filter";
|
|
253
|
+
t7 = submit;
|
|
254
|
+
t8 = `${id}-title`;
|
|
255
|
+
const t15 = `${id}-title`;
|
|
256
|
+
let t16;
|
|
257
|
+
if ($[53] !== column.name || $[54] !== messages) {
|
|
258
|
+
t16 = messages.filterBy(column.name);
|
|
259
|
+
$[53] = column.name;
|
|
260
|
+
$[54] = messages;
|
|
261
|
+
$[55] = t16;
|
|
262
|
+
} else {
|
|
263
|
+
t16 = $[55];
|
|
264
|
+
}
|
|
265
|
+
if ($[56] !== t15 || $[57] !== t16) {
|
|
266
|
+
t9 = /*#__PURE__*/_jsx("p", {
|
|
267
|
+
className: "vg-filter__title",
|
|
268
|
+
id: t15,
|
|
269
|
+
children: t16
|
|
270
|
+
});
|
|
271
|
+
$[56] = t15;
|
|
272
|
+
$[57] = t16;
|
|
273
|
+
$[58] = t9;
|
|
274
|
+
} else {
|
|
275
|
+
t9 = $[58];
|
|
276
|
+
}
|
|
277
|
+
if ($[59] !== initial || $[60] !== messages.otherConditions) {
|
|
278
|
+
t10 = initial === "other" && /*#__PURE__*/_jsx("p", {
|
|
279
|
+
className: "vg-filter__note",
|
|
280
|
+
children: messages.otherConditions
|
|
281
|
+
});
|
|
282
|
+
$[59] = initial;
|
|
283
|
+
$[60] = messages.otherConditions;
|
|
284
|
+
$[61] = t10;
|
|
285
|
+
} else {
|
|
286
|
+
t10 = $[61];
|
|
287
|
+
}
|
|
288
|
+
t11 = lists && /*#__PURE__*/_jsxs(_Fragment, {
|
|
289
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
290
|
+
type: "search",
|
|
291
|
+
className: "vg-input",
|
|
292
|
+
"aria-label": messages.valuesSearch,
|
|
293
|
+
placeholder: messages.valuesSearch,
|
|
294
|
+
value: search,
|
|
295
|
+
disabled: conditionOn,
|
|
296
|
+
onChange: event_0 => setSearch(event_0.target.value)
|
|
297
|
+
}), /*#__PURE__*/_jsxs("fieldset", {
|
|
298
|
+
className: "vg-filter__values",
|
|
299
|
+
"aria-labelledby": `${id}-title`,
|
|
300
|
+
"aria-busy": list === null,
|
|
301
|
+
disabled: conditionOn,
|
|
302
|
+
children: [!search && /*#__PURE__*/_jsxs("label", {
|
|
303
|
+
className: "vg-filter__value",
|
|
304
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
305
|
+
type: "checkbox",
|
|
306
|
+
checked: allChecked,
|
|
307
|
+
onChange: event_1 => {
|
|
308
|
+
setBase(event_1.target.checked);
|
|
309
|
+
setToggled(new Map());
|
|
310
|
+
}
|
|
311
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
312
|
+
children: messages.selectAll
|
|
313
|
+
})]
|
|
314
|
+
}), items.map(item_1 => /*#__PURE__*/_jsxs("label", {
|
|
315
|
+
className: "vg-filter__value",
|
|
316
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
317
|
+
type: "checkbox",
|
|
318
|
+
checked: checked(item_1.key),
|
|
319
|
+
onChange: () => toggle(item_1.key, item_1.value)
|
|
320
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
321
|
+
className: "vg-filter__label",
|
|
322
|
+
children: label(item_1.value)
|
|
323
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
324
|
+
className: "vg-filter__count",
|
|
325
|
+
children: number.format(item_1.count)
|
|
326
|
+
})]
|
|
327
|
+
}, item_1.key)), list === null && failure === null && /*#__PURE__*/_jsx("p", {
|
|
328
|
+
className: "vg-filter__note",
|
|
329
|
+
children: messages.loading
|
|
330
|
+
}), failure !== null && /*#__PURE__*/_jsx("p", {
|
|
331
|
+
className: "vg-filter__error",
|
|
332
|
+
children: messages.failed(failure)
|
|
333
|
+
})]
|
|
334
|
+
}), list?.truncated && /*#__PURE__*/_jsx("p", {
|
|
335
|
+
className: "vg-filter__note",
|
|
336
|
+
children: messages.valuesTruncated(number.format(list.values.length))
|
|
337
|
+
})]
|
|
338
|
+
});
|
|
339
|
+
$[14] = base;
|
|
340
|
+
$[15] = column;
|
|
341
|
+
$[16] = failure;
|
|
342
|
+
$[17] = first;
|
|
343
|
+
$[18] = id;
|
|
344
|
+
$[19] = initial;
|
|
345
|
+
$[20] = list;
|
|
346
|
+
$[21] = lists;
|
|
347
|
+
$[22] = messages;
|
|
348
|
+
$[23] = number;
|
|
349
|
+
$[24] = onDone;
|
|
350
|
+
$[25] = operator;
|
|
351
|
+
$[26] = search;
|
|
352
|
+
$[27] = second;
|
|
353
|
+
$[28] = store;
|
|
354
|
+
$[29] = toggled;
|
|
355
|
+
$[30] = apply;
|
|
356
|
+
$[31] = conditionOn;
|
|
357
|
+
$[32] = t10;
|
|
358
|
+
$[33] = t11;
|
|
359
|
+
$[34] = t6;
|
|
360
|
+
$[35] = t7;
|
|
361
|
+
$[36] = t8;
|
|
362
|
+
$[37] = t9;
|
|
363
|
+
} else {
|
|
364
|
+
apply = $[30];
|
|
365
|
+
conditionOn = $[31];
|
|
366
|
+
t10 = $[32];
|
|
367
|
+
t11 = $[33];
|
|
368
|
+
t6 = $[34];
|
|
369
|
+
t7 = $[35];
|
|
370
|
+
t8 = $[36];
|
|
371
|
+
t9 = $[37];
|
|
372
|
+
}
|
|
373
|
+
const t12 = "vg-filter__condition";
|
|
374
|
+
let t13;
|
|
375
|
+
if ($[62] !== messages.condition) {
|
|
376
|
+
t13 = /*#__PURE__*/_jsx("legend", {
|
|
377
|
+
children: messages.condition
|
|
378
|
+
});
|
|
379
|
+
$[62] = messages.condition;
|
|
380
|
+
$[63] = t13;
|
|
381
|
+
} else {
|
|
382
|
+
t13 = $[63];
|
|
383
|
+
}
|
|
384
|
+
const t14 = "vg-input";
|
|
385
|
+
const t15 = messages.condition;
|
|
386
|
+
let t16;
|
|
387
|
+
if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
|
|
388
|
+
t16 = event_2 => setOperator(event_2.target.value);
|
|
389
|
+
$[64] = t16;
|
|
390
|
+
} else {
|
|
391
|
+
t16 = $[64];
|
|
392
|
+
}
|
|
393
|
+
let t17;
|
|
394
|
+
if ($[65] !== messages.conditionNone) {
|
|
395
|
+
t17 = /*#__PURE__*/_jsx("option", {
|
|
396
|
+
value: "none",
|
|
397
|
+
children: messages.conditionNone
|
|
398
|
+
});
|
|
399
|
+
$[65] = messages.conditionNone;
|
|
400
|
+
$[66] = t17;
|
|
401
|
+
} else {
|
|
402
|
+
t17 = $[66];
|
|
403
|
+
}
|
|
404
|
+
let t18;
|
|
405
|
+
if ($[67] !== messages.operators) {
|
|
406
|
+
t18 = item_2 => /*#__PURE__*/_jsx("option", {
|
|
407
|
+
value: item_2,
|
|
408
|
+
children: messages.operators[item_2]
|
|
409
|
+
}, item_2);
|
|
410
|
+
$[67] = messages.operators;
|
|
411
|
+
$[68] = t18;
|
|
412
|
+
} else {
|
|
413
|
+
t18 = $[68];
|
|
414
|
+
}
|
|
415
|
+
const t19 = operators.map(t18);
|
|
416
|
+
let t20;
|
|
417
|
+
if ($[69] !== messages.condition || $[70] !== operator || $[71] !== t16 || $[72] !== t17 || $[73] !== t19) {
|
|
418
|
+
t20 = /*#__PURE__*/_jsxs("select", {
|
|
419
|
+
className: t14,
|
|
420
|
+
"aria-label": t15,
|
|
421
|
+
value: operator,
|
|
422
|
+
onChange: t16,
|
|
423
|
+
children: [t17, t19]
|
|
424
|
+
});
|
|
425
|
+
$[69] = messages.condition;
|
|
426
|
+
$[70] = operator;
|
|
427
|
+
$[71] = t16;
|
|
428
|
+
$[72] = t17;
|
|
429
|
+
$[73] = t19;
|
|
430
|
+
$[74] = t20;
|
|
431
|
+
} else {
|
|
432
|
+
t20 = $[74];
|
|
433
|
+
}
|
|
434
|
+
let t21;
|
|
435
|
+
if ($[75] !== conditionOn || $[76] !== error || $[77] !== first || $[78] !== messages.minimum || $[79] !== messages.value || $[80] !== operator || $[81] !== setFirst) {
|
|
436
|
+
t21 = conditionOn && !takesNoValue(operator) && /*#__PURE__*/_jsx("input", {
|
|
437
|
+
className: "vg-input",
|
|
438
|
+
"aria-label": operator === "between" ? messages.minimum : messages.value,
|
|
439
|
+
placeholder: operator === "between" ? messages.minimum : messages.value,
|
|
440
|
+
"aria-invalid": error !== null,
|
|
441
|
+
value: first,
|
|
442
|
+
onChange: event_3 => setFirst(event_3.target.value)
|
|
443
|
+
});
|
|
444
|
+
$[75] = conditionOn;
|
|
445
|
+
$[76] = error;
|
|
446
|
+
$[77] = first;
|
|
447
|
+
$[78] = messages.minimum;
|
|
448
|
+
$[79] = messages.value;
|
|
449
|
+
$[80] = operator;
|
|
450
|
+
$[81] = setFirst;
|
|
451
|
+
$[82] = t21;
|
|
452
|
+
} else {
|
|
453
|
+
t21 = $[82];
|
|
454
|
+
}
|
|
455
|
+
let t22;
|
|
456
|
+
if ($[83] !== error || $[84] !== messages.maximum || $[85] !== operator || $[86] !== second || $[87] !== setSecond) {
|
|
457
|
+
t22 = operator === "between" && /*#__PURE__*/_jsx("input", {
|
|
458
|
+
className: "vg-input",
|
|
459
|
+
"aria-label": messages.maximum,
|
|
460
|
+
placeholder: messages.maximum,
|
|
461
|
+
"aria-invalid": error !== null,
|
|
462
|
+
value: second,
|
|
463
|
+
onChange: event_4 => setSecond(event_4.target.value)
|
|
464
|
+
});
|
|
465
|
+
$[83] = error;
|
|
466
|
+
$[84] = messages.maximum;
|
|
467
|
+
$[85] = operator;
|
|
468
|
+
$[86] = second;
|
|
469
|
+
$[87] = setSecond;
|
|
470
|
+
$[88] = t22;
|
|
471
|
+
} else {
|
|
472
|
+
t22 = $[88];
|
|
473
|
+
}
|
|
474
|
+
let t23;
|
|
475
|
+
if ($[89] !== t13 || $[90] !== t20 || $[91] !== t21 || $[92] !== t22) {
|
|
476
|
+
t23 = /*#__PURE__*/_jsxs("fieldset", {
|
|
477
|
+
className: t12,
|
|
478
|
+
children: [t13, t20, t21, t22]
|
|
479
|
+
});
|
|
480
|
+
$[89] = t13;
|
|
481
|
+
$[90] = t20;
|
|
482
|
+
$[91] = t21;
|
|
483
|
+
$[92] = t22;
|
|
484
|
+
$[93] = t23;
|
|
485
|
+
} else {
|
|
486
|
+
t23 = $[93];
|
|
487
|
+
}
|
|
488
|
+
let t24;
|
|
489
|
+
if ($[94] !== error) {
|
|
490
|
+
t24 = error !== null && /*#__PURE__*/_jsx("p", {
|
|
491
|
+
role: "alert",
|
|
492
|
+
className: "vg-filter__error",
|
|
493
|
+
children: error
|
|
494
|
+
});
|
|
495
|
+
$[94] = error;
|
|
496
|
+
$[95] = t24;
|
|
497
|
+
} else {
|
|
498
|
+
t24 = $[95];
|
|
499
|
+
}
|
|
500
|
+
let t25;
|
|
501
|
+
if ($[96] !== apply) {
|
|
502
|
+
t25 = () => apply(null);
|
|
503
|
+
$[96] = apply;
|
|
504
|
+
$[97] = t25;
|
|
505
|
+
} else {
|
|
506
|
+
t25 = $[97];
|
|
507
|
+
}
|
|
508
|
+
let t26;
|
|
509
|
+
if ($[98] !== messages.clearFilter || $[99] !== pending || $[100] !== t25) {
|
|
510
|
+
t26 = /*#__PURE__*/_jsx("button", {
|
|
511
|
+
type: "button",
|
|
512
|
+
className: "vg-button",
|
|
513
|
+
disabled: pending,
|
|
514
|
+
onClick: t25,
|
|
515
|
+
children: messages.clearFilter
|
|
516
|
+
});
|
|
517
|
+
$[98] = messages.clearFilter;
|
|
518
|
+
$[99] = pending;
|
|
519
|
+
$[100] = t25;
|
|
520
|
+
$[101] = t26;
|
|
521
|
+
} else {
|
|
522
|
+
t26 = $[101];
|
|
523
|
+
}
|
|
524
|
+
let t27;
|
|
525
|
+
if ($[102] !== messages.apply || $[103] !== pending) {
|
|
526
|
+
t27 = /*#__PURE__*/_jsx("button", {
|
|
527
|
+
type: "submit",
|
|
528
|
+
className: "vg-button vg-button--primary",
|
|
529
|
+
disabled: pending,
|
|
530
|
+
children: messages.apply
|
|
531
|
+
});
|
|
532
|
+
$[102] = messages.apply;
|
|
533
|
+
$[103] = pending;
|
|
534
|
+
$[104] = t27;
|
|
535
|
+
} else {
|
|
536
|
+
t27 = $[104];
|
|
537
|
+
}
|
|
538
|
+
let t28;
|
|
539
|
+
if ($[105] !== t26 || $[106] !== t27) {
|
|
540
|
+
t28 = /*#__PURE__*/_jsxs("div", {
|
|
541
|
+
className: "vg-filter__actions",
|
|
542
|
+
children: [t26, t27]
|
|
543
|
+
});
|
|
544
|
+
$[105] = t26;
|
|
545
|
+
$[106] = t27;
|
|
546
|
+
$[107] = t28;
|
|
547
|
+
} else {
|
|
548
|
+
t28 = $[107];
|
|
549
|
+
}
|
|
550
|
+
let t29;
|
|
551
|
+
if ($[108] !== t10 || $[109] !== t11 || $[110] !== t23 || $[111] !== t24 || $[112] !== t28 || $[113] !== t6 || $[114] !== t7 || $[115] !== t8 || $[116] !== t9) {
|
|
552
|
+
t29 = /*#__PURE__*/_jsxs("form", {
|
|
553
|
+
className: t6,
|
|
554
|
+
onSubmit: t7,
|
|
555
|
+
"aria-labelledby": t8,
|
|
556
|
+
children: [t9, t10, t11, t23, t24, t28]
|
|
557
|
+
});
|
|
558
|
+
$[108] = t10;
|
|
559
|
+
$[109] = t11;
|
|
560
|
+
$[110] = t23;
|
|
561
|
+
$[111] = t24;
|
|
562
|
+
$[112] = t28;
|
|
563
|
+
$[113] = t6;
|
|
564
|
+
$[114] = t7;
|
|
565
|
+
$[115] = t8;
|
|
566
|
+
$[116] = t9;
|
|
567
|
+
$[117] = t29;
|
|
568
|
+
} else {
|
|
569
|
+
t29 = $[117];
|
|
570
|
+
}
|
|
571
|
+
return t29;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* The statistics of a column over the rows of the view (`GridStore.aggregate`): the rows, the values and the empty
|
|
576
|
+
* ones, the distinct values, and the measures that take its type, read by the engine when the panel opens.
|
|
577
|
+
*/
|
|
578
|
+
function _temp3(t0) {
|
|
579
|
+
const [key_2, value_1] = t0;
|
|
580
|
+
return key_2 === BLANK ? [] : [value_1];
|
|
581
|
+
}
|
|
582
|
+
function _temp2(snapshot_0) {
|
|
583
|
+
const capabilities = snapshot_0.table?.capabilities;
|
|
584
|
+
return capabilities?.plan?.aggregate !== false && (capabilities?.measures?.includes("count") ?? true);
|
|
585
|
+
}
|
|
586
|
+
function _temp(snapshot) {
|
|
587
|
+
return snapshot.document.plan?.where;
|
|
588
|
+
}
|
|
589
|
+
function Statistics(t0) {
|
|
590
|
+
const $ = _c(32);
|
|
591
|
+
const {
|
|
592
|
+
column
|
|
593
|
+
} = t0;
|
|
594
|
+
const store = useGridStore();
|
|
595
|
+
const {
|
|
596
|
+
messages,
|
|
597
|
+
number
|
|
598
|
+
} = use(LocaleContext);
|
|
599
|
+
const capabilities = useGridSelector(_temp4);
|
|
600
|
+
const [result, setResult] = useState(null);
|
|
601
|
+
const [failure, setFailure] = useState(null);
|
|
602
|
+
const statistics = statisticsOf(column, capabilities);
|
|
603
|
+
let t1;
|
|
604
|
+
let t2;
|
|
605
|
+
if ($[0] !== capabilities || $[1] !== column || $[2] !== store) {
|
|
606
|
+
t1 = () => {
|
|
607
|
+
const abort = new AbortController();
|
|
608
|
+
store.aggregate(statisticsOf(column, capabilities).map(_temp5), abort.signal).then(read => {
|
|
609
|
+
setResult(read);
|
|
610
|
+
setFailure(null);
|
|
611
|
+
}).catch(cause => {
|
|
612
|
+
if (!abort.signal.aborted) {
|
|
613
|
+
setFailure(cause instanceof Error ? cause.message : String(cause));
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
return () => abort.abort();
|
|
617
|
+
};
|
|
618
|
+
t2 = [store, column, capabilities];
|
|
619
|
+
$[0] = capabilities;
|
|
620
|
+
$[1] = column;
|
|
621
|
+
$[2] = store;
|
|
622
|
+
$[3] = t1;
|
|
623
|
+
$[4] = t2;
|
|
624
|
+
} else {
|
|
625
|
+
t1 = $[3];
|
|
626
|
+
t2 = $[4];
|
|
627
|
+
}
|
|
628
|
+
useEffect(t1, t2);
|
|
629
|
+
let t3;
|
|
630
|
+
if ($[5] !== column || $[6] !== number || $[7] !== result?.columns || $[8] !== result?.values) {
|
|
631
|
+
t3 = name => {
|
|
632
|
+
const value = result?.values[name];
|
|
633
|
+
if (value === undefined || value === null) {
|
|
634
|
+
return "";
|
|
635
|
+
}
|
|
636
|
+
if (typeof value === "number") {
|
|
637
|
+
return number.format(value);
|
|
638
|
+
}
|
|
639
|
+
return textOf(value, result?.columns[name] ?? column) ?? "";
|
|
640
|
+
};
|
|
641
|
+
$[5] = column;
|
|
642
|
+
$[6] = number;
|
|
643
|
+
$[7] = result?.columns;
|
|
644
|
+
$[8] = result?.values;
|
|
645
|
+
$[9] = t3;
|
|
646
|
+
} else {
|
|
647
|
+
t3 = $[9];
|
|
648
|
+
}
|
|
649
|
+
const text = t3;
|
|
650
|
+
const rows = Number(result?.values.rows ?? 0);
|
|
651
|
+
const values = Number(result?.values.values ?? 0);
|
|
652
|
+
const t4 = "vg-statistics";
|
|
653
|
+
let t5;
|
|
654
|
+
if ($[10] !== column.name || $[11] !== messages) {
|
|
655
|
+
t5 = messages.statisticsOf(column.name);
|
|
656
|
+
$[10] = column.name;
|
|
657
|
+
$[11] = messages;
|
|
658
|
+
$[12] = t5;
|
|
659
|
+
} else {
|
|
660
|
+
t5 = $[12];
|
|
661
|
+
}
|
|
662
|
+
const t6 = result === null;
|
|
663
|
+
let t7;
|
|
664
|
+
if ($[13] !== column.name || $[14] !== messages) {
|
|
665
|
+
t7 = messages.statisticsOf(column.name);
|
|
666
|
+
$[13] = column.name;
|
|
667
|
+
$[14] = messages;
|
|
668
|
+
$[15] = t7;
|
|
669
|
+
} else {
|
|
670
|
+
t7 = $[15];
|
|
671
|
+
}
|
|
672
|
+
let t8;
|
|
673
|
+
if ($[16] !== t7) {
|
|
674
|
+
t8 = /*#__PURE__*/_jsx("p", {
|
|
675
|
+
className: "vg-filter__title",
|
|
676
|
+
children: t7
|
|
677
|
+
});
|
|
678
|
+
$[16] = t7;
|
|
679
|
+
$[17] = t8;
|
|
680
|
+
} else {
|
|
681
|
+
t8 = $[17];
|
|
682
|
+
}
|
|
683
|
+
let t9;
|
|
684
|
+
if ($[18] !== failure || $[19] !== messages) {
|
|
685
|
+
t9 = failure !== null && /*#__PURE__*/_jsx("p", {
|
|
686
|
+
className: "vg-filter__error",
|
|
687
|
+
children: messages.failed(failure)
|
|
688
|
+
});
|
|
689
|
+
$[18] = failure;
|
|
690
|
+
$[19] = messages;
|
|
691
|
+
$[20] = t9;
|
|
692
|
+
} else {
|
|
693
|
+
t9 = $[20];
|
|
694
|
+
}
|
|
695
|
+
let t10;
|
|
696
|
+
if ($[21] !== failure || $[22] !== messages.loading || $[23] !== result) {
|
|
697
|
+
t10 = failure === null && result === null && /*#__PURE__*/_jsx("p", {
|
|
698
|
+
className: "vg-filter__note",
|
|
699
|
+
children: messages.loading
|
|
700
|
+
});
|
|
701
|
+
$[21] = failure;
|
|
702
|
+
$[22] = messages.loading;
|
|
703
|
+
$[23] = result;
|
|
704
|
+
$[24] = t10;
|
|
705
|
+
} else {
|
|
706
|
+
t10 = $[24];
|
|
707
|
+
}
|
|
708
|
+
const t11 = result && /*#__PURE__*/_jsx("dl", {
|
|
709
|
+
className: "vg-statistics__list",
|
|
710
|
+
children: statistics.flatMap(statistic_0 => [/*#__PURE__*/_jsxs("div", {
|
|
711
|
+
children: [/*#__PURE__*/_jsx("dt", {
|
|
712
|
+
children: messages.statisticNames[statistic_0.kind]
|
|
713
|
+
}), /*#__PURE__*/_jsx("dd", {
|
|
714
|
+
children: text(statistic_0.kind)
|
|
715
|
+
})]
|
|
716
|
+
}, statistic_0.kind), ...(statistic_0.kind === "values" ? [/*#__PURE__*/_jsxs("div", {
|
|
717
|
+
children: [/*#__PURE__*/_jsx("dt", {
|
|
718
|
+
children: messages.statisticNames.nulls
|
|
719
|
+
}), /*#__PURE__*/_jsx("dd", {
|
|
720
|
+
children: number.format(rows - values)
|
|
721
|
+
})]
|
|
722
|
+
}, "nulls")] : [])])
|
|
723
|
+
});
|
|
724
|
+
let t12;
|
|
725
|
+
if ($[25] !== t10 || $[26] !== t11 || $[27] !== t5 || $[28] !== t6 || $[29] !== t8 || $[30] !== t9) {
|
|
726
|
+
t12 = /*#__PURE__*/_jsxs("section", {
|
|
727
|
+
className: t4,
|
|
728
|
+
"aria-label": t5,
|
|
729
|
+
"aria-busy": t6,
|
|
730
|
+
children: [t8, t9, t10, t11]
|
|
731
|
+
});
|
|
732
|
+
$[25] = t10;
|
|
733
|
+
$[26] = t11;
|
|
734
|
+
$[27] = t5;
|
|
735
|
+
$[28] = t6;
|
|
736
|
+
$[29] = t8;
|
|
737
|
+
$[30] = t9;
|
|
738
|
+
$[31] = t12;
|
|
739
|
+
} else {
|
|
740
|
+
t12 = $[31];
|
|
741
|
+
}
|
|
742
|
+
return t12;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* The menu of a column of the view, opened from its header (the arrow at its right, a right click, or Alt+↓ on the
|
|
747
|
+
* active cell): sorting by it (§6.2), its filter, and its pin, width and visibility (§6.3), all as commands. It is
|
|
748
|
+
* a popover: Esc and a click outside close it, and the focus goes back to the grid.
|
|
749
|
+
*/
|
|
750
|
+
function _temp5(statistic) {
|
|
751
|
+
return statistic.measure;
|
|
752
|
+
}
|
|
753
|
+
function _temp4(snapshot) {
|
|
754
|
+
return snapshot.table?.capabilities;
|
|
755
|
+
}
|
|
756
|
+
export function ColumnMenu(t0) {
|
|
757
|
+
const $ = _c(71);
|
|
758
|
+
const {
|
|
759
|
+
target,
|
|
760
|
+
onClose
|
|
761
|
+
} = t0;
|
|
762
|
+
const store = useGridStore();
|
|
763
|
+
const {
|
|
764
|
+
messages
|
|
765
|
+
} = use(LocaleContext);
|
|
766
|
+
const ref = useRef(null);
|
|
767
|
+
const [panel, setPanel] = useState(null);
|
|
768
|
+
const [shown, setShown] = useState(target);
|
|
769
|
+
if (shown !== target) {
|
|
770
|
+
setShown(target);
|
|
771
|
+
setPanel(null);
|
|
772
|
+
}
|
|
773
|
+
const name = target?.column;
|
|
774
|
+
let t1;
|
|
775
|
+
if ($[0] !== name) {
|
|
776
|
+
t1 = snapshot => snapshot.displayed.find(entry => entry.column.name === name);
|
|
777
|
+
$[0] = name;
|
|
778
|
+
$[1] = t1;
|
|
779
|
+
} else {
|
|
780
|
+
t1 = $[1];
|
|
781
|
+
}
|
|
782
|
+
const item = useGridSelector(t1);
|
|
783
|
+
const displayed = useGridSelector(_temp6);
|
|
784
|
+
const hidden = useGridSelector(_temp7);
|
|
785
|
+
const sort = useGridSelector(_temp8);
|
|
786
|
+
const aggregate = useGridSelector(_temp9);
|
|
787
|
+
const grouped = aggregate !== undefined;
|
|
788
|
+
const capabilities = useGridSelector(_temp0);
|
|
789
|
+
const ready = useGridSelector(_temp1);
|
|
790
|
+
let t2;
|
|
791
|
+
let t3;
|
|
792
|
+
if ($[2] !== target) {
|
|
793
|
+
t2 = () => {
|
|
794
|
+
const menu = ref.current;
|
|
795
|
+
if (!menu || !target) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
if (!menu.matches(":popover-open")) {
|
|
799
|
+
menu.showPopover();
|
|
800
|
+
}
|
|
801
|
+
menu.querySelector("button:not(:disabled), input, select")?.focus();
|
|
802
|
+
};
|
|
803
|
+
t3 = [target];
|
|
804
|
+
$[2] = target;
|
|
805
|
+
$[3] = t2;
|
|
806
|
+
$[4] = t3;
|
|
807
|
+
} else {
|
|
808
|
+
t2 = $[3];
|
|
809
|
+
t3 = $[4];
|
|
810
|
+
}
|
|
811
|
+
useLayoutEffect(t2, t3);
|
|
812
|
+
let t4;
|
|
813
|
+
if ($[5] !== target) {
|
|
814
|
+
t4 = () => {
|
|
815
|
+
const menu_0 = ref.current;
|
|
816
|
+
if (!menu_0 || !target) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
const rect = menu_0.getBoundingClientRect();
|
|
820
|
+
menu_0.style.left = `${Math.max(8, Math.min(target.x, window.innerWidth - rect.width - 8))}px`;
|
|
821
|
+
menu_0.style.top = `${Math.max(8, Math.min(target.y, window.innerHeight - rect.height - 8))}px`;
|
|
822
|
+
};
|
|
823
|
+
$[5] = target;
|
|
824
|
+
$[6] = t4;
|
|
825
|
+
} else {
|
|
826
|
+
t4 = $[6];
|
|
827
|
+
}
|
|
828
|
+
useLayoutEffect(t4);
|
|
829
|
+
let t5;
|
|
830
|
+
if ($[7] !== onClose) {
|
|
831
|
+
t5 = event => {
|
|
832
|
+
if (event.newState === "closed") {
|
|
833
|
+
onClose();
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
$[7] = onClose;
|
|
837
|
+
$[8] = t5;
|
|
838
|
+
} else {
|
|
839
|
+
t5 = $[8];
|
|
840
|
+
}
|
|
841
|
+
const onToggle = t5;
|
|
842
|
+
if (!target || !item) {
|
|
843
|
+
let t6;
|
|
844
|
+
if ($[9] !== onToggle) {
|
|
845
|
+
t6 = /*#__PURE__*/_jsx("div", {
|
|
846
|
+
ref: ref,
|
|
847
|
+
popover: "auto",
|
|
848
|
+
className: "vg-menu vg-column-menu",
|
|
849
|
+
onToggle: onToggle
|
|
850
|
+
});
|
|
851
|
+
$[9] = onToggle;
|
|
852
|
+
$[10] = t6;
|
|
853
|
+
} else {
|
|
854
|
+
t6 = $[10];
|
|
855
|
+
}
|
|
856
|
+
return t6;
|
|
857
|
+
}
|
|
858
|
+
const column = item.column;
|
|
859
|
+
let t6;
|
|
860
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
861
|
+
t6 = () => ref.current?.hidePopover();
|
|
862
|
+
$[11] = t6;
|
|
863
|
+
} else {
|
|
864
|
+
t6 = $[11];
|
|
865
|
+
}
|
|
866
|
+
const close = t6;
|
|
867
|
+
let t7;
|
|
868
|
+
if ($[12] !== store) {
|
|
869
|
+
t7 = command => {
|
|
870
|
+
close();
|
|
871
|
+
store.dispatch(command);
|
|
872
|
+
};
|
|
873
|
+
$[12] = store;
|
|
874
|
+
$[13] = t7;
|
|
875
|
+
} else {
|
|
876
|
+
t7 = $[13];
|
|
877
|
+
}
|
|
878
|
+
const run = t7;
|
|
879
|
+
const sorts = capabilities?.plan?.sort !== false;
|
|
880
|
+
let t8;
|
|
881
|
+
if ($[14] !== column.name || $[15] !== sort) {
|
|
882
|
+
t8 = sort?.find(key => key.column === column.name);
|
|
883
|
+
$[14] = column.name;
|
|
884
|
+
$[15] = sort;
|
|
885
|
+
$[16] = t8;
|
|
886
|
+
} else {
|
|
887
|
+
t8 = $[16];
|
|
888
|
+
}
|
|
889
|
+
const own = t8;
|
|
890
|
+
let t9;
|
|
891
|
+
if ($[17] !== sort) {
|
|
892
|
+
t9 = sort ?? [];
|
|
893
|
+
$[17] = sort;
|
|
894
|
+
$[18] = t9;
|
|
895
|
+
} else {
|
|
896
|
+
t9 = $[18];
|
|
897
|
+
}
|
|
898
|
+
let t10;
|
|
899
|
+
if ($[19] !== column.name || $[20] !== t9) {
|
|
900
|
+
let t11;
|
|
901
|
+
if ($[22] !== column.name) {
|
|
902
|
+
t11 = key_0 => key_0.column !== column.name;
|
|
903
|
+
$[22] = column.name;
|
|
904
|
+
$[23] = t11;
|
|
905
|
+
} else {
|
|
906
|
+
t11 = $[23];
|
|
907
|
+
}
|
|
908
|
+
t10 = t9.filter(t11);
|
|
909
|
+
$[19] = column.name;
|
|
910
|
+
$[20] = t9;
|
|
911
|
+
$[21] = t10;
|
|
912
|
+
} else {
|
|
913
|
+
t10 = $[21];
|
|
914
|
+
}
|
|
915
|
+
const others = t10;
|
|
916
|
+
let t11;
|
|
917
|
+
if ($[24] !== column.name || $[25] !== others || $[26] !== run) {
|
|
918
|
+
t11 = (direction, add) => run({
|
|
919
|
+
command: "sort.set",
|
|
920
|
+
keys: [...(add ? others : []), {
|
|
921
|
+
column: column.name,
|
|
922
|
+
direction
|
|
923
|
+
}]
|
|
924
|
+
});
|
|
925
|
+
$[24] = column.name;
|
|
926
|
+
$[25] = others;
|
|
927
|
+
$[26] = run;
|
|
928
|
+
$[27] = t11;
|
|
929
|
+
} else {
|
|
930
|
+
t11 = $[27];
|
|
931
|
+
}
|
|
932
|
+
const sortBy = t11;
|
|
933
|
+
const filters = ready && !grouped && capabilities?.plan?.where !== false;
|
|
934
|
+
const pin = item.setting.pin;
|
|
935
|
+
let t12;
|
|
936
|
+
if ($[28] !== capabilities || $[29] !== grouped || $[30] !== ready) {
|
|
937
|
+
t12 = ready && !grouped && offers(capabilities, "count");
|
|
938
|
+
$[28] = capabilities;
|
|
939
|
+
$[29] = grouped;
|
|
940
|
+
$[30] = ready;
|
|
941
|
+
$[31] = t12;
|
|
942
|
+
} else {
|
|
943
|
+
t12 = $[31];
|
|
944
|
+
}
|
|
945
|
+
const measures = t12;
|
|
946
|
+
let t13;
|
|
947
|
+
if ($[32] !== aggregate || $[33] !== capabilities || $[34] !== column || $[35] !== displayed || $[36] !== filters || $[37] !== grouped || $[38] !== hidden || $[39] !== item.setting || $[40] !== measures || $[41] !== messages || $[42] !== onToggle || $[43] !== others || $[44] !== own?.direction || $[45] !== panel || $[46] !== pin || $[47] !== run || $[48] !== sort || $[49] !== sortBy || $[50] !== sorts) {
|
|
948
|
+
let t14;
|
|
949
|
+
if ($[52] !== capabilities || $[53] !== column) {
|
|
950
|
+
t14 = fn => offers(capabilities, fn) && measureTakes(fn, column);
|
|
951
|
+
$[52] = capabilities;
|
|
952
|
+
$[53] = column;
|
|
953
|
+
$[54] = t14;
|
|
954
|
+
} else {
|
|
955
|
+
t14 = $[54];
|
|
956
|
+
}
|
|
957
|
+
const totals = TOTALS.filter(t14);
|
|
958
|
+
let t15;
|
|
959
|
+
if ($[55] !== aggregate?.keys) {
|
|
960
|
+
t15 = aggregate?.keys ?? [];
|
|
961
|
+
$[55] = aggregate?.keys;
|
|
962
|
+
$[56] = t15;
|
|
963
|
+
} else {
|
|
964
|
+
t15 = $[56];
|
|
965
|
+
}
|
|
966
|
+
const keys = t15;
|
|
967
|
+
let t16;
|
|
968
|
+
if ($[57] !== column.name || $[58] !== run) {
|
|
969
|
+
t16 = () => run({
|
|
970
|
+
command: "group.set",
|
|
971
|
+
aggregate: {
|
|
972
|
+
keys: [column.name],
|
|
973
|
+
measures: [{
|
|
974
|
+
name: measureName("count", undefined, new Set([column.name])),
|
|
975
|
+
fn: "count"
|
|
976
|
+
}]
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
$[57] = column.name;
|
|
980
|
+
$[58] = run;
|
|
981
|
+
$[59] = t16;
|
|
982
|
+
} else {
|
|
983
|
+
t16 = $[59];
|
|
984
|
+
}
|
|
985
|
+
const groupBy = t16;
|
|
986
|
+
let t17;
|
|
987
|
+
if ($[60] !== aggregate || $[61] !== column.name || $[62] !== keys || $[63] !== run) {
|
|
988
|
+
t17 = () => {
|
|
989
|
+
const rest = keys.filter(key_1 => key_1 !== column.name);
|
|
990
|
+
run(rest.length === 0 || !aggregate ? {
|
|
991
|
+
command: "group.clear"
|
|
992
|
+
} : {
|
|
993
|
+
command: "group.set",
|
|
994
|
+
aggregate: {
|
|
995
|
+
...aggregate,
|
|
996
|
+
keys: rest
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
};
|
|
1000
|
+
$[60] = aggregate;
|
|
1001
|
+
$[61] = column.name;
|
|
1002
|
+
$[62] = keys;
|
|
1003
|
+
$[63] = run;
|
|
1004
|
+
$[64] = t17;
|
|
1005
|
+
} else {
|
|
1006
|
+
t17 = $[64];
|
|
1007
|
+
}
|
|
1008
|
+
const ungroupBy = t17;
|
|
1009
|
+
let t18;
|
|
1010
|
+
if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1011
|
+
t18 = () => setPanel(null);
|
|
1012
|
+
$[65] = t18;
|
|
1013
|
+
} else {
|
|
1014
|
+
t18 = $[65];
|
|
1015
|
+
}
|
|
1016
|
+
let t19;
|
|
1017
|
+
if ($[66] !== messages.back) {
|
|
1018
|
+
t19 = /*#__PURE__*/_jsxs("button", {
|
|
1019
|
+
type: "button",
|
|
1020
|
+
className: "vg-menu__item",
|
|
1021
|
+
onClick: t18,
|
|
1022
|
+
children: ["\u2190 ", messages.back]
|
|
1023
|
+
});
|
|
1024
|
+
$[66] = messages.back;
|
|
1025
|
+
$[67] = t19;
|
|
1026
|
+
} else {
|
|
1027
|
+
t19 = $[67];
|
|
1028
|
+
}
|
|
1029
|
+
const back = t19;
|
|
1030
|
+
let t20;
|
|
1031
|
+
if ($[68] !== column.name || $[69] !== messages) {
|
|
1032
|
+
t20 = messages.columnMenu(column.name);
|
|
1033
|
+
$[68] = column.name;
|
|
1034
|
+
$[69] = messages;
|
|
1035
|
+
$[70] = t20;
|
|
1036
|
+
} else {
|
|
1037
|
+
t20 = $[70];
|
|
1038
|
+
}
|
|
1039
|
+
t13 = /*#__PURE__*/_jsx("div", {
|
|
1040
|
+
ref: ref,
|
|
1041
|
+
popover: "auto",
|
|
1042
|
+
role: "dialog",
|
|
1043
|
+
className: "vg-menu vg-column-menu",
|
|
1044
|
+
"aria-label": t20,
|
|
1045
|
+
onToggle: onToggle,
|
|
1046
|
+
children: panel === "filter" ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
1047
|
+
children: [back, /*#__PURE__*/_jsx(FilterForm, {
|
|
1048
|
+
column: column,
|
|
1049
|
+
onDone: close
|
|
1050
|
+
}, column.name)]
|
|
1051
|
+
}) : panel === "format" ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
1052
|
+
children: [back, /*#__PURE__*/_jsx(FormatForm, {
|
|
1053
|
+
column: column,
|
|
1054
|
+
setting: item.setting,
|
|
1055
|
+
onDone: close
|
|
1056
|
+
}, column.name)]
|
|
1057
|
+
}) : panel === "statistics" ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
1058
|
+
children: [back, /*#__PURE__*/_jsx(Statistics, {
|
|
1059
|
+
column: column
|
|
1060
|
+
}, column.name)]
|
|
1061
|
+
}) : panel === "total" ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
1062
|
+
children: [back, /*#__PURE__*/_jsxs("div", {
|
|
1063
|
+
role: "menu",
|
|
1064
|
+
"aria-label": messages.total,
|
|
1065
|
+
onKeyDown: moveFocus,
|
|
1066
|
+
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
1067
|
+
radio: true,
|
|
1068
|
+
checked: item.setting.total === undefined,
|
|
1069
|
+
onClick: () => run({
|
|
1070
|
+
command: "column.total",
|
|
1071
|
+
name: column.name,
|
|
1072
|
+
total: null
|
|
1073
|
+
}),
|
|
1074
|
+
children: messages.noTotal
|
|
1075
|
+
}), totals.map(fn_0 => /*#__PURE__*/_jsx(MenuItem, {
|
|
1076
|
+
radio: true,
|
|
1077
|
+
checked: item.setting.total?.fn === fn_0,
|
|
1078
|
+
onClick: () => run({
|
|
1079
|
+
command: "column.total",
|
|
1080
|
+
name: column.name,
|
|
1081
|
+
total: {
|
|
1082
|
+
fn: fn_0
|
|
1083
|
+
}
|
|
1084
|
+
}),
|
|
1085
|
+
children: messages.measureNames[fn_0]
|
|
1086
|
+
}, fn_0))]
|
|
1087
|
+
})]
|
|
1088
|
+
}) : /*#__PURE__*/_jsxs("div", {
|
|
1089
|
+
role: "menu",
|
|
1090
|
+
"aria-label": messages.columnMenu(column.name),
|
|
1091
|
+
onKeyDown: moveFocus,
|
|
1092
|
+
children: [sorts && /*#__PURE__*/_jsxs(_Fragment, {
|
|
1093
|
+
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
1094
|
+
checked: own?.direction === "asc" && others.length === 0,
|
|
1095
|
+
onClick: () => sortBy("asc", false),
|
|
1096
|
+
children: messages.sortAscending
|
|
1097
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
1098
|
+
checked: own?.direction === "desc" && others.length === 0,
|
|
1099
|
+
onClick: () => sortBy("desc", false),
|
|
1100
|
+
children: messages.sortDescending
|
|
1101
|
+
}), others.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
1102
|
+
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
1103
|
+
onClick: () => sortBy("asc", true),
|
|
1104
|
+
children: messages.thenSortAscending
|
|
1105
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
1106
|
+
onClick: () => sortBy("desc", true),
|
|
1107
|
+
children: messages.thenSortDescending
|
|
1108
|
+
})]
|
|
1109
|
+
}), sort && sort.length > 0 && /*#__PURE__*/_jsx(MenuItem, {
|
|
1110
|
+
onClick: () => run({
|
|
1111
|
+
command: "sort.clear"
|
|
1112
|
+
}),
|
|
1113
|
+
children: messages.clearSort
|
|
1114
|
+
}), /*#__PURE__*/_jsx("hr", {
|
|
1115
|
+
className: "vg-menu__line"
|
|
1116
|
+
})]
|
|
1117
|
+
}), filters && /*#__PURE__*/_jsx(MenuItem, {
|
|
1118
|
+
onClick: () => setPanel("filter"),
|
|
1119
|
+
children: messages.filter
|
|
1120
|
+
}), measures && /*#__PURE__*/_jsx(MenuItem, {
|
|
1121
|
+
onClick: () => setPanel("statistics"),
|
|
1122
|
+
children: messages.statistics
|
|
1123
|
+
}), !grouped && totals.length > 0 && /*#__PURE__*/_jsx(MenuItem, {
|
|
1124
|
+
onClick: () => setPanel("total"),
|
|
1125
|
+
children: item.setting.total ? `${messages.total}: ${messages.measureNames[item.setting.total.fn]}` : `${messages.total}…`
|
|
1126
|
+
}), measures && capabilities?.plan?.aggregate !== false && /*#__PURE__*/_jsx(MenuItem, {
|
|
1127
|
+
onClick: groupBy,
|
|
1128
|
+
children: messages.groupByColumn
|
|
1129
|
+
}), keys.includes(column.name) && /*#__PURE__*/_jsx(MenuItem, {
|
|
1130
|
+
onClick: ungroupBy,
|
|
1131
|
+
children: messages.removeFromGroups
|
|
1132
|
+
}), grouped && /*#__PURE__*/_jsx(MenuItem, {
|
|
1133
|
+
onClick: () => run({
|
|
1134
|
+
command: "group.clear"
|
|
1135
|
+
}),
|
|
1136
|
+
children: messages.ungroup
|
|
1137
|
+
}), (filters || measures || grouped || totals.length > 0) && /*#__PURE__*/_jsx("hr", {
|
|
1138
|
+
className: "vg-menu__line"
|
|
1139
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
1140
|
+
onClick: () => setPanel("format"),
|
|
1141
|
+
children: messages.format
|
|
1142
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
1143
|
+
onClick: () => run({
|
|
1144
|
+
command: "column.resize",
|
|
1145
|
+
name: column.name,
|
|
1146
|
+
width: null
|
|
1147
|
+
}),
|
|
1148
|
+
children: messages.autoFit
|
|
1149
|
+
}), pin !== "left" && /*#__PURE__*/_jsx(MenuItem, {
|
|
1150
|
+
onClick: () => run({
|
|
1151
|
+
command: "column.pin",
|
|
1152
|
+
name: column.name,
|
|
1153
|
+
side: "left"
|
|
1154
|
+
}),
|
|
1155
|
+
children: messages.pinLeft
|
|
1156
|
+
}), pin !== "right" && /*#__PURE__*/_jsx(MenuItem, {
|
|
1157
|
+
onClick: () => run({
|
|
1158
|
+
command: "column.pin",
|
|
1159
|
+
name: column.name,
|
|
1160
|
+
side: "right"
|
|
1161
|
+
}),
|
|
1162
|
+
children: messages.pinRight
|
|
1163
|
+
}), pin !== undefined && /*#__PURE__*/_jsx(MenuItem, {
|
|
1164
|
+
onClick: () => run({
|
|
1165
|
+
command: "column.pin",
|
|
1166
|
+
name: column.name,
|
|
1167
|
+
side: null
|
|
1168
|
+
}),
|
|
1169
|
+
children: messages.unpin
|
|
1170
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
1171
|
+
disabled: displayed <= 1,
|
|
1172
|
+
onClick: () => run({
|
|
1173
|
+
command: "column.hide",
|
|
1174
|
+
names: [column.name]
|
|
1175
|
+
}),
|
|
1176
|
+
children: messages.hideColumn
|
|
1177
|
+
}), hidden && /*#__PURE__*/_jsx(MenuItem, {
|
|
1178
|
+
onClick: () => run({
|
|
1179
|
+
command: "column.show",
|
|
1180
|
+
all: true
|
|
1181
|
+
}),
|
|
1182
|
+
children: messages.showAllColumns
|
|
1183
|
+
})]
|
|
1184
|
+
})
|
|
1185
|
+
});
|
|
1186
|
+
$[32] = aggregate;
|
|
1187
|
+
$[33] = capabilities;
|
|
1188
|
+
$[34] = column;
|
|
1189
|
+
$[35] = displayed;
|
|
1190
|
+
$[36] = filters;
|
|
1191
|
+
$[37] = grouped;
|
|
1192
|
+
$[38] = hidden;
|
|
1193
|
+
$[39] = item.setting;
|
|
1194
|
+
$[40] = measures;
|
|
1195
|
+
$[41] = messages;
|
|
1196
|
+
$[42] = onToggle;
|
|
1197
|
+
$[43] = others;
|
|
1198
|
+
$[44] = own?.direction;
|
|
1199
|
+
$[45] = panel;
|
|
1200
|
+
$[46] = pin;
|
|
1201
|
+
$[47] = run;
|
|
1202
|
+
$[48] = sort;
|
|
1203
|
+
$[49] = sortBy;
|
|
1204
|
+
$[50] = sorts;
|
|
1205
|
+
$[51] = t13;
|
|
1206
|
+
} else {
|
|
1207
|
+
t13 = $[51];
|
|
1208
|
+
}
|
|
1209
|
+
return t13;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
/** Arrows, Home and End move the focus among the items of a menu (the menu pattern of the ARIA Authoring Practices). */
|
|
1213
|
+
function _temp1(snapshot_5) {
|
|
1214
|
+
return snapshot_5.table?.status === "ready";
|
|
1215
|
+
}
|
|
1216
|
+
function _temp0(snapshot_4) {
|
|
1217
|
+
return snapshot_4.table?.capabilities;
|
|
1218
|
+
}
|
|
1219
|
+
function _temp9(snapshot_3) {
|
|
1220
|
+
return snapshot_3.document.plan?.aggregate;
|
|
1221
|
+
}
|
|
1222
|
+
function _temp8(snapshot_2) {
|
|
1223
|
+
return snapshot_2.document.plan?.sort;
|
|
1224
|
+
}
|
|
1225
|
+
function _temp7(snapshot_1) {
|
|
1226
|
+
return (snapshot_1.view?.columns.length ?? 0) > snapshot_1.displayed.length;
|
|
1227
|
+
}
|
|
1228
|
+
function _temp6(snapshot_0) {
|
|
1229
|
+
return snapshot_0.displayed.length;
|
|
1230
|
+
}
|
|
1231
|
+
function moveFocus(event) {
|
|
1232
|
+
const items = [...event.currentTarget.querySelectorAll("button:not(:disabled)")];
|
|
1233
|
+
const at = items.indexOf(document.activeElement);
|
|
1234
|
+
const next = event.key === "ArrowDown" ? (at + 1) % items.length : event.key === "ArrowUp" ? (at - 1 + items.length) % items.length : event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : -1;
|
|
1235
|
+
if (next < 0 || items.length === 0) return;
|
|
1236
|
+
event.preventDefault();
|
|
1237
|
+
items[next].focus();
|
|
1238
|
+
}
|
|
1239
|
+
function MenuItem(t0) {
|
|
1240
|
+
const $ = _c(14);
|
|
1241
|
+
const {
|
|
1242
|
+
checked,
|
|
1243
|
+
radio,
|
|
1244
|
+
disabled,
|
|
1245
|
+
onClick,
|
|
1246
|
+
children
|
|
1247
|
+
} = t0;
|
|
1248
|
+
if (checked === undefined) {
|
|
1249
|
+
let t1;
|
|
1250
|
+
if ($[0] !== children || $[1] !== disabled || $[2] !== onClick) {
|
|
1251
|
+
t1 = /*#__PURE__*/_jsx("button", {
|
|
1252
|
+
type: "button",
|
|
1253
|
+
role: "menuitem",
|
|
1254
|
+
className: "vg-menu__item",
|
|
1255
|
+
disabled: disabled,
|
|
1256
|
+
onClick: onClick,
|
|
1257
|
+
children: children
|
|
1258
|
+
});
|
|
1259
|
+
$[0] = children;
|
|
1260
|
+
$[1] = disabled;
|
|
1261
|
+
$[2] = onClick;
|
|
1262
|
+
$[3] = t1;
|
|
1263
|
+
} else {
|
|
1264
|
+
t1 = $[3];
|
|
1265
|
+
}
|
|
1266
|
+
return t1;
|
|
1267
|
+
}
|
|
1268
|
+
if (radio) {
|
|
1269
|
+
let t1;
|
|
1270
|
+
if ($[4] !== checked || $[5] !== children || $[6] !== disabled || $[7] !== onClick) {
|
|
1271
|
+
t1 = /*#__PURE__*/_jsx("button", {
|
|
1272
|
+
type: "button",
|
|
1273
|
+
role: "menuitemradio",
|
|
1274
|
+
"aria-checked": checked,
|
|
1275
|
+
className: "vg-menu__item",
|
|
1276
|
+
disabled: disabled,
|
|
1277
|
+
onClick: onClick,
|
|
1278
|
+
children: children
|
|
1279
|
+
});
|
|
1280
|
+
$[4] = checked;
|
|
1281
|
+
$[5] = children;
|
|
1282
|
+
$[6] = disabled;
|
|
1283
|
+
$[7] = onClick;
|
|
1284
|
+
$[8] = t1;
|
|
1285
|
+
} else {
|
|
1286
|
+
t1 = $[8];
|
|
1287
|
+
}
|
|
1288
|
+
return t1;
|
|
1289
|
+
}
|
|
1290
|
+
let t1;
|
|
1291
|
+
if ($[9] !== checked || $[10] !== children || $[11] !== disabled || $[12] !== onClick) {
|
|
1292
|
+
t1 = /*#__PURE__*/_jsx("button", {
|
|
1293
|
+
type: "button",
|
|
1294
|
+
role: "menuitemcheckbox",
|
|
1295
|
+
"aria-checked": checked,
|
|
1296
|
+
className: "vg-menu__item",
|
|
1297
|
+
disabled: disabled,
|
|
1298
|
+
onClick: onClick,
|
|
1299
|
+
children: children
|
|
1300
|
+
});
|
|
1301
|
+
$[9] = checked;
|
|
1302
|
+
$[10] = children;
|
|
1303
|
+
$[11] = disabled;
|
|
1304
|
+
$[12] = onClick;
|
|
1305
|
+
$[13] = t1;
|
|
1306
|
+
} else {
|
|
1307
|
+
t1 = $[13];
|
|
1308
|
+
}
|
|
1309
|
+
return t1;
|
|
1310
|
+
}
|
|
1311
|
+
//# sourceMappingURL=column-menu.js.map
|