@svgrid/grid-wc 3.0.1 → 3.0.3
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 +24 -1
- package/dist/GridMenus-DMkf7UMn.js +1086 -0
- package/dist/SvChartMenu-DkSyLWYH.js +413 -0
- package/dist/SvDateRangeInput-BrYTQEMM.js +197 -0
- package/dist/SvDateTimePicker-Czin1Ead.js +766 -0
- package/dist/SvField-Bmzp3ObZ.js +147 -0
- package/dist/SvGridCellEditor-DhXEIlyE.js +560 -0
- package/dist/SvGridChart-BMdCbrqb.js +3702 -0
- package/dist/SvGridChartBuilder-Chp_MD1B.js +1166 -0
- package/dist/SvGridChartPanel-BIV2O2Lp.js +1743 -0
- package/dist/SvGridChartView-DyhkumD-.js +45 -0
- package/dist/SvGridDropdown-BwPpGwLz.js +257 -0
- package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs +212 -7
- package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs.map +1 -1
- package/dist/angular/types/svgrid-grid-wc-angular.d.ts +92 -2
- package/dist/{cell-formatting-Eypm-id0.js → cell-formatting-CBfgahv1.js} +1 -1
- package/dist/chart/SvChartMenu-DslxOgPN.js +590 -0
- package/dist/chart/chart-export-BHGuh_kZ.js +127 -0
- package/dist/chart/chart-export-pdf-BjkkIEkE.js +104 -0
- package/dist/chart/chart-summary-6Xu2JoNC.js +137 -0
- package/dist/chart/chart-trend-7fxtAqEl.js +56 -0
- package/dist/chart/chart-validate-CD6ptiwg.js +180 -0
- package/dist/chart/client-BuB0wIgc.js +2757 -0
- package/dist/chart/sv-chart-element.d.ts +98 -0
- package/dist/chart/sv-chart-element.js +7282 -0
- package/dist/chart-D_LKA1fr.js +4398 -0
- package/dist/chart-export-pdf-9OCvhzr0.js +104 -0
- package/dist/chart-summary-v3Lhe8YD.js +137 -0
- package/dist/chart-validate-CD6ptiwg.js +180 -0
- package/dist/{shadow/client-DjwUji8D.js → client-DEF0GRjE.js} +1 -1
- package/dist/{shadow/column-resize-DvCRUrN3.js → column-resize-DUPgynvc.js} +3 -3
- package/dist/date-format-DMTwV8NC.js +1128 -0
- package/dist/{shadow/dismissable-DvhBKm3q.js → dismissable-CQ6XFXsk.js} +5 -1
- package/dist/{export-format-uGayRKWM.js → export-format-CAi1mp-1.js} +1 -1
- package/dist/focus-trap-Dbb2tJxb.js +65 -0
- package/dist/list-option-DrRyivWp.js +82 -0
- package/dist/react/chart.d.ts +99 -0
- package/dist/react/chart.js +49 -0
- package/dist/react/index.d.ts +72 -0
- package/dist/react/index.js +8 -1
- package/dist/row-resize-limG_N1z.js +111 -0
- package/dist/shadow/GridMenus-DMkf7UMn.js +1086 -0
- package/dist/shadow/SvChartMenu-DkSyLWYH.js +413 -0
- package/dist/shadow/SvDateRangeInput-BrYTQEMM.js +197 -0
- package/dist/shadow/SvDateTimePicker-Czin1Ead.js +766 -0
- package/dist/shadow/SvField-Bmzp3ObZ.js +147 -0
- package/dist/shadow/SvGridCellEditor-DhXEIlyE.js +560 -0
- package/dist/shadow/SvGridChart-BMdCbrqb.js +3702 -0
- package/dist/shadow/SvGridChartBuilder-Chp_MD1B.js +1166 -0
- package/dist/shadow/SvGridChartPanel-BIV2O2Lp.js +1743 -0
- package/dist/shadow/SvGridChartView-DyhkumD-.js +45 -0
- package/dist/shadow/SvGridDropdown-BwPpGwLz.js +257 -0
- package/dist/shadow/{cell-formatting-Eypm-id0.js → cell-formatting-CBfgahv1.js} +1 -1
- package/dist/shadow/chart-D_LKA1fr.js +4398 -0
- package/dist/shadow/chart-export-pdf-9OCvhzr0.js +104 -0
- package/dist/shadow/chart-summary-v3Lhe8YD.js +137 -0
- package/dist/shadow/chart-validate-CD6ptiwg.js +180 -0
- package/dist/{client-DjwUji8D.js → shadow/client-DEF0GRjE.js} +1 -1
- package/dist/{column-resize-DvCRUrN3.js → shadow/column-resize-DUPgynvc.js} +3 -3
- package/dist/shadow/date-format-DMTwV8NC.js +1128 -0
- package/dist/{dismissable-DvhBKm3q.js → shadow/dismissable-CQ6XFXsk.js} +5 -1
- package/dist/shadow/{export-format-DhdZREP1.js → export-format-mnW_rVBZ.js} +1 -1
- package/dist/shadow/focus-trap-Dbb2tJxb.js +65 -0
- package/dist/shadow/list-option-DrRyivWp.js +82 -0
- package/dist/shadow/row-resize-limG_N1z.js +111 -0
- package/dist/shadow/sv-grid-shadow-element.d.ts +41 -0
- package/dist/shadow/sv-grid-shadow-element.js +5905 -3986
- package/dist/shadow/{svelte-virtualizer.svelte-DZ9UcyfT.js → svelte-virtualizer.svelte-CnGhFGDc.js} +37 -34
- package/dist/shadow/validate-BqDthkNr.js +88 -0
- package/dist/sv-grid-element.d.ts +41 -0
- package/dist/sv-grid-element.js +5874 -3985
- package/dist/{svelte-virtualizer.svelte-DZ9UcyfT.js → svelte-virtualizer.svelte-CnGhFGDc.js} +37 -34
- package/dist/validate-BqDthkNr.js +88 -0
- package/dist/vue/chart.d.ts +64 -0
- package/dist/vue/chart.js +41 -0
- package/dist/vue/index.d.ts +26 -2
- package/dist/vue/index.js +1 -22
- package/package.json +18 -5
- package/dist/GridMenus-YwTw9Upd.js +0 -1123
- package/dist/SvDateRangeInput-CrxeppBV.js +0 -196
- package/dist/SvDateTimePicker-xAO-Pb4S.js +0 -765
- package/dist/SvField-CE345DyF.js +0 -146
- package/dist/SvGridCellEditor-D7SyHtff.js +0 -550
- package/dist/SvGridChart-CMaVmlso.js +0 -1477
- package/dist/SvGridChartPanel-Pc_IW0eA.js +0 -833
- package/dist/SvGridChartView-DLhhzmFy.js +0 -52
- package/dist/SvGridDropdown-DUncHqM-.js +0 -256
- package/dist/chart-GRBAgN1M.js +0 -1658
- package/dist/date-format-D_oQ5Yw0.js +0 -1127
- package/dist/row-resize-D-8s3cqT.js +0 -94
- package/dist/shadow/GridMenus-YwTw9Upd.js +0 -1123
- package/dist/shadow/SvDateRangeInput-CrxeppBV.js +0 -196
- package/dist/shadow/SvDateTimePicker-xAO-Pb4S.js +0 -765
- package/dist/shadow/SvField-CE345DyF.js +0 -146
- package/dist/shadow/SvGridCellEditor-D7SyHtff.js +0 -550
- package/dist/shadow/SvGridChart-CMaVmlso.js +0 -1477
- package/dist/shadow/SvGridChartPanel-Pc_IW0eA.js +0 -833
- package/dist/shadow/SvGridChartView-DLhhzmFy.js +0 -52
- package/dist/shadow/SvGridDropdown-DUncHqM-.js +0 -256
- package/dist/shadow/chart-GRBAgN1M.js +0 -1658
- package/dist/shadow/date-format-D_oQ5Yw0.js +0 -1127
- package/dist/shadow/row-resize-D-8s3cqT.js +0 -94
- package/dist/shadow/validate-CgmAtX1A.js +0 -75
- package/dist/validate-CgmAtX1A.js +0 -75
|
@@ -34,8 +34,12 @@ function a(t, n) {
|
|
|
34
34
|
if (typeof window > "u") return () => {};
|
|
35
35
|
let r = (r) => {
|
|
36
36
|
e(t(), r.target) || n();
|
|
37
|
+
}, i = !1, a = requestAnimationFrame(() => {
|
|
38
|
+
a = null, i = !0, window.addEventListener("scroll", r, !0);
|
|
39
|
+
});
|
|
40
|
+
return () => {
|
|
41
|
+
a !== null && cancelAnimationFrame(a), a = null, i && window.removeEventListener("scroll", r, !0), i = !1;
|
|
37
42
|
};
|
|
38
|
-
return window.addEventListener("scroll", r, !0), () => window.removeEventListener("scroll", r, !0);
|
|
39
43
|
}
|
|
40
44
|
//#endregion
|
|
41
45
|
export { a as n, i as t };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region ../grid/dist/a11y/focus-trap.js
|
|
2
|
+
var e = [
|
|
3
|
+
"a[href]",
|
|
4
|
+
"area[href]",
|
|
5
|
+
"button:not([disabled])",
|
|
6
|
+
"input:not([disabled])",
|
|
7
|
+
"select:not([disabled])",
|
|
8
|
+
"textarea:not([disabled])",
|
|
9
|
+
"iframe",
|
|
10
|
+
"audio[controls]",
|
|
11
|
+
"video[controls]",
|
|
12
|
+
"[contenteditable]:not([contenteditable=\"false\"])",
|
|
13
|
+
"[tabindex]"
|
|
14
|
+
].join(",");
|
|
15
|
+
function t(e) {
|
|
16
|
+
if (e.hasAttribute("disabled") || e.getAttribute("aria-hidden") === "true" || e.hidden || e.closest("[hidden]")) return !1;
|
|
17
|
+
let t = e.style;
|
|
18
|
+
return !(t.display === "none" || t.visibility === "hidden" || typeof e.getClientRects == "function" && e.getClientRects().length === 0 && document.body.getClientRects().length > 0);
|
|
19
|
+
}
|
|
20
|
+
function n(n) {
|
|
21
|
+
return Array.from(n.querySelectorAll(e)).filter((e) => {
|
|
22
|
+
let n = e.getAttribute("tabindex");
|
|
23
|
+
return n !== null && Number(n) < 0 ? !1 : t(e);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function r(e, t = {}) {
|
|
27
|
+
let { initialFocus: r = "first", returnFocus: i = !0 } = t, a = null, o = !1;
|
|
28
|
+
function s() {
|
|
29
|
+
let t = r;
|
|
30
|
+
return t === "container" ? e : t === "first" ? n(e)[0] ?? e : typeof t == "function" ? t() : t;
|
|
31
|
+
}
|
|
32
|
+
function c(r) {
|
|
33
|
+
if (!o) return;
|
|
34
|
+
if (r.key === "Escape" && t.onEscape) {
|
|
35
|
+
t.onEscape(r);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (r.key !== "Tab") return;
|
|
39
|
+
let i = n(e);
|
|
40
|
+
if (!i.length) {
|
|
41
|
+
r.preventDefault(), e.focus();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let a = i[0], s = i[i.length - 1], c = document.activeElement;
|
|
45
|
+
if (!e.contains(c)) {
|
|
46
|
+
r.preventDefault(), a.focus();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
r.shiftKey && c === a ? (r.preventDefault(), s.focus()) : !r.shiftKey && c === s && (r.preventDefault(), a.focus());
|
|
50
|
+
}
|
|
51
|
+
function l() {
|
|
52
|
+
o || (o = !0, a = document.activeElement, e.hasAttribute("tabindex") || e.setAttribute("tabindex", "-1"), document.addEventListener("keydown", c, !0), queueMicrotask(() => {
|
|
53
|
+
o && s()?.focus();
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
function u() {
|
|
57
|
+
o && (o = !1, document.removeEventListener("keydown", c, !0), i && a?.focus?.(), a = null);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
activate: l,
|
|
61
|
+
release: u
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { n, r as t };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region ../grid/dist/list-option.js
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e ? e.map((e) => {
|
|
4
|
+
if (typeof e == "object" && e) {
|
|
5
|
+
let t = e, n = t.value ?? t.label ?? "";
|
|
6
|
+
return {
|
|
7
|
+
...t,
|
|
8
|
+
value: n,
|
|
9
|
+
label: t.label ?? String(n)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
value: e,
|
|
14
|
+
label: String(e)
|
|
15
|
+
};
|
|
16
|
+
}) : [];
|
|
17
|
+
}
|
|
18
|
+
function t(e) {
|
|
19
|
+
let t = [], n = /* @__PURE__ */ new Map();
|
|
20
|
+
return e.forEach((e, r) => {
|
|
21
|
+
let i = e.group ?? null, a = n.get(i);
|
|
22
|
+
a || (a = {
|
|
23
|
+
group: i,
|
|
24
|
+
options: []
|
|
25
|
+
}, n.set(i, a), t.push(a)), a.options.push({
|
|
26
|
+
...e,
|
|
27
|
+
index: r
|
|
28
|
+
});
|
|
29
|
+
}), t;
|
|
30
|
+
}
|
|
31
|
+
function n(e, n) {
|
|
32
|
+
let r = Math.max(1, n.groupHeaderHeight ?? 28), i = n.rowHeight, a = (e) => Math.max(1, typeof i == "function" ? i(e, e.index) : i), o = [], s = Array(e.length), c = !1;
|
|
33
|
+
for (let n of t(e)) {
|
|
34
|
+
n.group != null && (c = !0, o.push({
|
|
35
|
+
type: "group",
|
|
36
|
+
label: n.group,
|
|
37
|
+
size: r
|
|
38
|
+
}));
|
|
39
|
+
for (let e of n.options) s[e.index] = o.length, o.push({
|
|
40
|
+
type: "option",
|
|
41
|
+
opt: e,
|
|
42
|
+
size: a(e)
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
entries: o,
|
|
47
|
+
hasGroups: c,
|
|
48
|
+
sizeAt: (e) => o[e]?.size ?? 0,
|
|
49
|
+
optionFlatIndex: s
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function r(e, t, n) {
|
|
53
|
+
let r = t.trim().toLowerCase();
|
|
54
|
+
if (!r || !e.length) return -1;
|
|
55
|
+
let i = e.length;
|
|
56
|
+
for (let t = 1; t <= i; t++) {
|
|
57
|
+
let a = (n + t) % i, o = e[a];
|
|
58
|
+
if (o && !o.disabled && o.label.toLowerCase().startsWith(r)) return a;
|
|
59
|
+
}
|
|
60
|
+
return -1;
|
|
61
|
+
}
|
|
62
|
+
function i(e = 600) {
|
|
63
|
+
let t = "", n;
|
|
64
|
+
return {
|
|
65
|
+
get value() {
|
|
66
|
+
return t;
|
|
67
|
+
},
|
|
68
|
+
push(r) {
|
|
69
|
+
return t += r, n && clearTimeout(n), n = setTimeout(() => {
|
|
70
|
+
t = "";
|
|
71
|
+
}, e), t;
|
|
72
|
+
},
|
|
73
|
+
clear() {
|
|
74
|
+
t = "", n && clearTimeout(n);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function a(e) {
|
|
79
|
+
return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && e.key !== " ";
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { r as a, a as i, n, e as o, t as r, i as t };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import '@svgrid/grid-wc/chart';
|
|
2
|
+
export interface SvChartProps {
|
|
3
|
+
/** `property only` - ChartSpec */
|
|
4
|
+
spec?: unknown;
|
|
5
|
+
/** `legend` - boolean | ChartLegendPosition */
|
|
6
|
+
legend?: string;
|
|
7
|
+
/** `interactive` - boolean */
|
|
8
|
+
interactive?: boolean;
|
|
9
|
+
/** `data-labels` - boolean | ChartDataLabelConfig */
|
|
10
|
+
dataLabels?: boolean;
|
|
11
|
+
/** `property only` - (value: number) => string */
|
|
12
|
+
formatValue?: unknown;
|
|
13
|
+
/** `property only` - (ctx: ChartTooltipContext) => { title?: string; rows?: ChartTooltipRow[] } */
|
|
14
|
+
tooltipFormat?: unknown;
|
|
15
|
+
/** `tooltip-mode` - 'shared' | 'single' */
|
|
16
|
+
tooltipMode?: "shared" | "single";
|
|
17
|
+
/** `tooltip-position` - 'follow' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' */
|
|
18
|
+
tooltipPosition?: "follow" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
19
|
+
/** `tooltip-sticky` - boolean */
|
|
20
|
+
tooltipSticky?: boolean;
|
|
21
|
+
/** `zoomable` - boolean | ChartZoomConfig */
|
|
22
|
+
zoomable?: boolean;
|
|
23
|
+
/** `property only` - ChartZoomWindow | null */
|
|
24
|
+
zoom?: unknown;
|
|
25
|
+
/** `range-presets` - boolean | ChartRangePreset[] */
|
|
26
|
+
rangePresets?: boolean;
|
|
27
|
+
/** `sync-group` - string */
|
|
28
|
+
syncGroup?: string;
|
|
29
|
+
/** `context-menu` - boolean | MenuItem[] | ((target: ChartContextTarget) => MenuItem[]) */
|
|
30
|
+
contextMenu?: boolean;
|
|
31
|
+
/** `animate` - boolean | ChartAnimateConfig */
|
|
32
|
+
animate?: boolean;
|
|
33
|
+
/** `live` - boolean */
|
|
34
|
+
live?: boolean;
|
|
35
|
+
/** `drillable` - boolean */
|
|
36
|
+
drillable?: boolean;
|
|
37
|
+
/** `property only` - string[] */
|
|
38
|
+
drillPath?: readonly unknown[];
|
|
39
|
+
/** `selectable` - boolean | 'single' | 'multi' */
|
|
40
|
+
selectable?: string;
|
|
41
|
+
/** `property only` - ChartPointRef[] */
|
|
42
|
+
selected?: readonly unknown[];
|
|
43
|
+
/** `hover-highlight` - boolean */
|
|
44
|
+
hoverHighlight?: boolean;
|
|
45
|
+
/** `announce` - boolean */
|
|
46
|
+
announce?: boolean;
|
|
47
|
+
/** `describe` - boolean */
|
|
48
|
+
describe?: boolean;
|
|
49
|
+
/** `property only` - Partial<ChartMessages> */
|
|
50
|
+
localeText?: unknown;
|
|
51
|
+
/** `crosshair-labels` - boolean */
|
|
52
|
+
crosshairLabels?: boolean;
|
|
53
|
+
/** `brush` - boolean */
|
|
54
|
+
brush?: boolean;
|
|
55
|
+
/** `brush-height` - number */
|
|
56
|
+
brushHeight?: number;
|
|
57
|
+
/** `toolbar` - boolean */
|
|
58
|
+
toolbar?: boolean;
|
|
59
|
+
/** `width` - number */
|
|
60
|
+
width?: number;
|
|
61
|
+
/** `height` - number */
|
|
62
|
+
height?: number;
|
|
63
|
+
/** `autosize` - boolean */
|
|
64
|
+
autosize?: boolean;
|
|
65
|
+
/** `annotatable` - boolean */
|
|
66
|
+
annotatable?: boolean;
|
|
67
|
+
/** `drawable` - boolean | ChartDrawingKind[] */
|
|
68
|
+
drawable?: boolean;
|
|
69
|
+
/** `select` */
|
|
70
|
+
onSelect?: (detail: unknown) => void;
|
|
71
|
+
/** `drill` */
|
|
72
|
+
onDrill?: (detail: unknown) => void;
|
|
73
|
+
/** `zoom` */
|
|
74
|
+
onZoom?: (detail: unknown) => void;
|
|
75
|
+
/** `selectionchange` */
|
|
76
|
+
onSelectionChange?: (detail: unknown) => void;
|
|
77
|
+
/** `hover` */
|
|
78
|
+
onHover?: (detail: unknown) => void;
|
|
79
|
+
/** `annotate` */
|
|
80
|
+
onAnnotate?: (detail: unknown) => void;
|
|
81
|
+
/** `annotationremove` */
|
|
82
|
+
onAnnotationRemove?: (detail: number) => void;
|
|
83
|
+
/** `drawingschange` */
|
|
84
|
+
onDrawingsChange?: (detail: unknown) => void;
|
|
85
|
+
/** Forwarded to the host element. */
|
|
86
|
+
className?: string;
|
|
87
|
+
style?: Record<string, string | number>;
|
|
88
|
+
}
|
|
89
|
+
/** The host element, reachable through a ref. */
|
|
90
|
+
export interface SvChartHandle {
|
|
91
|
+
element: HTMLElement | null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* SvChart as a React component. Same shape as the grid wrapper: props are
|
|
95
|
+
* written as DOM properties when they change, handlers are bound once through
|
|
96
|
+
* a ref so inline arrows do not rebind on every render.
|
|
97
|
+
*/
|
|
98
|
+
export declare const SvChart: import("react").ForwardRefExoticComponent<SvChartProps & import("react").RefAttributes<SvChartHandle>>;
|
|
99
|
+
export default SvChart;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createElement as e, forwardRef as t, useEffect as n, useImperativeHandle as r, useRef as i } from "react";
|
|
2
|
+
import "@svgrid/grid-wc/chart";
|
|
3
|
+
//#region src/react/chart.tsx
|
|
4
|
+
var a = /* @__PURE__ */ "spec.legend.interactive.dataLabels.formatValue.tooltipFormat.tooltipMode.tooltipPosition.tooltipSticky.zoomable.zoom.rangePresets.syncGroup.contextMenu.animate.live.drillable.drillPath.selectable.selected.hoverHighlight.announce.describe.localeText.crosshairLabels.brush.brushHeight.toolbar.width.height.autosize.annotatable.drawable".split("."), o = [
|
|
5
|
+
["onSelect", "select"],
|
|
6
|
+
["onDrill", "drill"],
|
|
7
|
+
["onZoom", "zoom"],
|
|
8
|
+
["onSelectionChange", "selectionchange"],
|
|
9
|
+
["onHover", "hover"],
|
|
10
|
+
["onAnnotate", "annotate"],
|
|
11
|
+
["onAnnotationRemove", "annotationremove"],
|
|
12
|
+
["onDrawingsChange", "drawingschange"]
|
|
13
|
+
], s = t(function(t, s) {
|
|
14
|
+
let c = i(null), { className: l, style: u, ...d } = t, f = i({});
|
|
15
|
+
n(() => {
|
|
16
|
+
let e = c.current;
|
|
17
|
+
if (e) for (let t of a) {
|
|
18
|
+
let n = d[t];
|
|
19
|
+
n === void 0 || Object.is(f.current[t], n) || (f.current[t] = n, e[t] = n);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
let p = i(d);
|
|
23
|
+
return p.current = d, n(() => {
|
|
24
|
+
let e = c.current;
|
|
25
|
+
if (!e) return;
|
|
26
|
+
let t = [];
|
|
27
|
+
for (let [n, r] of o) {
|
|
28
|
+
let i = (e) => {
|
|
29
|
+
let t = p.current[n];
|
|
30
|
+
t?.(e.detail);
|
|
31
|
+
};
|
|
32
|
+
e.addEventListener(r, i), t.push([r, i]);
|
|
33
|
+
}
|
|
34
|
+
return () => {
|
|
35
|
+
for (let [n, r] of t) e.removeEventListener(n, r);
|
|
36
|
+
};
|
|
37
|
+
}, []), r(s, () => ({ get element() {
|
|
38
|
+
return c.current;
|
|
39
|
+
} }), []), e("sv-chart", {
|
|
40
|
+
ref: c,
|
|
41
|
+
class: l,
|
|
42
|
+
style: {
|
|
43
|
+
display: "block",
|
|
44
|
+
...u
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { s as SvChart, s as default };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface SvGridProps {
|
|
|
8
8
|
board?: unknown;
|
|
9
9
|
/** `property only` - SchedulerConfig<TFeatures, TData> */
|
|
10
10
|
scheduler?: unknown;
|
|
11
|
+
/** `property only` - GanttConfig<TFeatures, TData> */
|
|
12
|
+
gantt?: unknown;
|
|
11
13
|
/** `property only` - ChartViewConfig<TFeatures, TData> */
|
|
12
14
|
chart?: unknown;
|
|
13
15
|
/** `property only` - GridPivotConfig<TData> */
|
|
@@ -122,10 +124,20 @@ export interface SvGridProps {
|
|
|
122
124
|
enableRowHover?: boolean;
|
|
123
125
|
/** `copy-headers-to-clipboard` - boolean */
|
|
124
126
|
copyHeadersToClipboard?: boolean;
|
|
127
|
+
/** `property only` - (params: { value: unknown; delta: { rows: number; cols: number }; rowIndex: number; column */
|
|
128
|
+
processCellForFill?: unknown;
|
|
125
129
|
/** `property only` - (params: { value: unknown; column: unknown; row: TData; rowIndex: number; columnId: string */
|
|
126
130
|
processCellForClipboard?: unknown;
|
|
131
|
+
/** `property only` - (rowIndex: number) => boolean */
|
|
132
|
+
includeCollapsedRows?: unknown;
|
|
133
|
+
/** `property only` - (params: { rects: ReadonlyArray<{ minRow: number; maxRow: number; minCol: number; maxCol: */
|
|
134
|
+
clipboardHtml?: unknown;
|
|
135
|
+
/** `property only` - (params: { text: string; parsedValue: unknown; row: TData; rowIndex: number; columnId: str */
|
|
136
|
+
processCellFromClipboard?: unknown;
|
|
127
137
|
/** `enable-inline-editing` - boolean */
|
|
128
138
|
enableInlineEditing?: boolean;
|
|
139
|
+
/** `edit-on-second-click` - boolean */
|
|
140
|
+
editOnSecondClick?: boolean;
|
|
129
141
|
/** `full-row-editing` - boolean */
|
|
130
142
|
fullRowEditing?: boolean;
|
|
131
143
|
/** `enable-row-summaries` - boolean */
|
|
@@ -172,14 +184,36 @@ export interface SvGridProps {
|
|
|
172
184
|
conditionalFormats?: readonly unknown[];
|
|
173
185
|
/** `conditional-stat-scope` - "filtered" | "visible" | "all" */
|
|
174
186
|
conditionalStatScope?: "filtered" | "visible" | "all";
|
|
187
|
+
/** `property only` - (row: TData, rowIndex: number) => "loading" | "failed" | null */
|
|
188
|
+
rowPlaceholder?: unknown;
|
|
189
|
+
/** `property only` - GridRowModel<TData> */
|
|
190
|
+
rowModel?: unknown;
|
|
191
|
+
/** `property only` - Array<ColumnDef<TFeatures, TData>> | null */
|
|
192
|
+
pivotResultColumns?: readonly unknown[];
|
|
193
|
+
/** `property only` - { isSelected: (rowId: string, row: TData) => boolean; headerState: () => "none" | "some" | */
|
|
194
|
+
rowSelectionModel?: unknown;
|
|
175
195
|
/** `property only` - (row: TData, rowIndex: number) => boolean */
|
|
176
196
|
isDetailRow?: unknown;
|
|
197
|
+
/** `detail-row-height` - number | ((row: TData) => number) */
|
|
198
|
+
detailRowHeight?: number;
|
|
199
|
+
/** `show-detail-toggle` - boolean */
|
|
200
|
+
showDetailToggle?: boolean;
|
|
201
|
+
/** `property only` - (row: TData) => boolean */
|
|
202
|
+
isDetailOpen?: unknown;
|
|
203
|
+
/** `property only` - (row: TData) => boolean */
|
|
204
|
+
hasDetail?: unknown;
|
|
177
205
|
/** `property only` - { isGroup: (row: TData) => boolean; level: (row: TData) => number; expanded?: (row: TData) */
|
|
178
206
|
serverGroup?: unknown;
|
|
179
207
|
/** `property only` - (columnId: string) => Promise<string[]> */
|
|
180
208
|
serverFilterValues?: unknown;
|
|
181
209
|
/** `property only` - ReadonlyArray<TData> */
|
|
182
210
|
pinnedTopRows?: readonly unknown[];
|
|
211
|
+
/** `frozen-rows` - number */
|
|
212
|
+
frozenRows?: number;
|
|
213
|
+
/** `sticky-group-rows` - boolean */
|
|
214
|
+
stickyGroupRows?: boolean;
|
|
215
|
+
/** `property only` - ReadonlyArray<{ rowIndex: number; colIndex: number; rowSpan: number; colSpan: number }> */
|
|
216
|
+
mergedCells?: readonly unknown[];
|
|
183
217
|
/** `property only` - ReadonlyArray<TData> */
|
|
184
218
|
pinnedBottomRows?: readonly unknown[];
|
|
185
219
|
/** `enable-column-reorder` - boolean */
|
|
@@ -205,6 +239,22 @@ export interface SvGridProps {
|
|
|
205
239
|
pageIndex: number;
|
|
206
240
|
pageSize: number;
|
|
207
241
|
}) => void;
|
|
242
|
+
/** `columnresize` */
|
|
243
|
+
onColumnResize?: (detail: {
|
|
244
|
+
columnId: string;
|
|
245
|
+
width: number;
|
|
246
|
+
}) => void;
|
|
247
|
+
/** `rowresize` */
|
|
248
|
+
onRowResize?: (detail: {
|
|
249
|
+
rowIndex: number;
|
|
250
|
+
height: number | null;
|
|
251
|
+
}) => void;
|
|
252
|
+
/** `pasteclipboard` */
|
|
253
|
+
onPasteClipboard?: (detail: {
|
|
254
|
+
text: string;
|
|
255
|
+
html: string | null;
|
|
256
|
+
source: "event" | "async";
|
|
257
|
+
}) => void;
|
|
208
258
|
/** `apiready` */
|
|
209
259
|
onApiReady?: (detail: unknown) => void;
|
|
210
260
|
/** `rowselectionchange` */
|
|
@@ -277,6 +327,21 @@ export interface SvGridProps {
|
|
|
277
327
|
scrollHeight: number;
|
|
278
328
|
clientHeight: number;
|
|
279
329
|
}) => void;
|
|
330
|
+
/** `visiblerangechange` */
|
|
331
|
+
onVisibleRangeChange?: (detail: {
|
|
332
|
+
startIndex: number;
|
|
333
|
+
endIndex: number;
|
|
334
|
+
}) => void;
|
|
335
|
+
/** `retryrow` */
|
|
336
|
+
onRetryRow?: (detail: {
|
|
337
|
+
row: Record<string, unknown>;
|
|
338
|
+
rowIndex: number;
|
|
339
|
+
}) => void;
|
|
340
|
+
/** `detailtoggle` */
|
|
341
|
+
onDetailToggle?: (detail: {
|
|
342
|
+
row: Record<string, unknown>;
|
|
343
|
+
rowIndex: number;
|
|
344
|
+
}) => void;
|
|
280
345
|
/** `columnorderchange` */
|
|
281
346
|
onColumnOrderChange?: (detail: ReadonlyArray<string>) => void;
|
|
282
347
|
/** `rowdragend` */
|
|
@@ -287,6 +352,13 @@ export interface SvGridProps {
|
|
|
287
352
|
fromGridId: number;
|
|
288
353
|
toGridId: number;
|
|
289
354
|
}) => void;
|
|
355
|
+
/** `rowdrop` */
|
|
356
|
+
onRowDrop?: (detail: {
|
|
357
|
+
row: Record<string, unknown>;
|
|
358
|
+
target: Record<string, unknown> | null;
|
|
359
|
+
targetIndex: number | null;
|
|
360
|
+
side: "before" | "after" | "into";
|
|
361
|
+
}) => void;
|
|
290
362
|
/** `selectionchange` - published alias of rowselectionchange, detail is the selected rows */
|
|
291
363
|
onSelectionchange?: (detail: unknown) => void;
|
|
292
364
|
/** Render inside an open shadow root, so page CSS cannot reach the grid. */
|
package/dist/react/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { createElement as e, forwardRef as t, useEffect as n, useImperativeHandle as r, useRef as i } from "react";
|
|
2
2
|
import "@svgrid/grid-wc";
|
|
3
3
|
//#region src/react/index.tsx
|
|
4
|
-
var a = /* @__PURE__ */ "data.columns.board.scheduler.chart.pivot.pivotMode.contextMenu.selectionBar.features.sortable.filterable.editable.treeData.groupable.groupBy.expanded.groupFooters.grandTotalRow.groupDisplayMode.autoGroupColumnHeader.autoGroupColumnWidth.pageable.loading.loadingOverlay.loadingSkeletonRows.error.emptyMessage.localization.showGlobalFilter.showColumnFilters.filterMode.showGroupingControls.showRowSelection.showPagination.pageSize.pageSizeOptions.paginationPosition.externalPagination.rowCount.pageIndex.virtualization.rowHeight.autoRowHeight.rowResize.headerHeight.overscan.containerHeight.columnVirtualization.columnOverscan.columnWidth.initialColumnPinning.fitColumns.columnResize.responsive.showFilterMenu.showFilterRow.enableCellSelection.moveCells.enableRowHover.copyHeadersToClipboard.processCellForClipboard.enableInlineEditing.fullRowEditing.enableRowSummaries.summary.statusBar.toolPanel.charting.columnMenuTabs.toolPanelDefaultOpen.toolPanelDefaultTab.selectionMode.showRowNumbers.zebraRows.rowNumberWidth.externalSort.initialSorting.initialAdvancedFilter.externalFilter.getRowId.rowClass.notes.editableComments.conditionalFormats.conditionalStatScope.isDetailRow.serverGroup.serverFilterValues.pinnedTopRows.pinnedBottomRows.enableColumnReorder.columnOrder.inferColumnTypes.rowDragManaged.rowDragGroup.alignedGridGroup.filterLocale".split("."), o = [
|
|
4
|
+
var a = /* @__PURE__ */ "data.columns.board.scheduler.gantt.chart.pivot.pivotMode.contextMenu.selectionBar.features.sortable.filterable.editable.treeData.groupable.groupBy.expanded.groupFooters.grandTotalRow.groupDisplayMode.autoGroupColumnHeader.autoGroupColumnWidth.pageable.loading.loadingOverlay.loadingSkeletonRows.error.emptyMessage.localization.showGlobalFilter.showColumnFilters.filterMode.showGroupingControls.showRowSelection.showPagination.pageSize.pageSizeOptions.paginationPosition.externalPagination.rowCount.pageIndex.virtualization.rowHeight.autoRowHeight.rowResize.headerHeight.overscan.containerHeight.columnVirtualization.columnOverscan.columnWidth.initialColumnPinning.fitColumns.columnResize.responsive.showFilterMenu.showFilterRow.enableCellSelection.moveCells.enableRowHover.copyHeadersToClipboard.processCellForFill.processCellForClipboard.includeCollapsedRows.clipboardHtml.processCellFromClipboard.enableInlineEditing.editOnSecondClick.fullRowEditing.enableRowSummaries.summary.statusBar.toolPanel.charting.columnMenuTabs.toolPanelDefaultOpen.toolPanelDefaultTab.selectionMode.showRowNumbers.zebraRows.rowNumberWidth.externalSort.initialSorting.initialAdvancedFilter.externalFilter.getRowId.rowClass.notes.editableComments.conditionalFormats.conditionalStatScope.rowPlaceholder.rowModel.pivotResultColumns.rowSelectionModel.isDetailRow.detailRowHeight.showDetailToggle.isDetailOpen.hasDetail.serverGroup.serverFilterValues.pinnedTopRows.frozenRows.stickyGroupRows.mergedCells.pinnedBottomRows.enableColumnReorder.columnOrder.inferColumnTypes.rowDragManaged.rowDragGroup.alignedGridGroup.filterLocale".split("."), o = [
|
|
5
5
|
["onPivotModeChange", "pivotmodechange"],
|
|
6
6
|
["onExpandedChange", "expandedchange"],
|
|
7
7
|
["onPaginationChange", "paginationchange"],
|
|
8
|
+
["onColumnResize", "columnresize"],
|
|
9
|
+
["onRowResize", "rowresize"],
|
|
10
|
+
["onPasteClipboard", "pasteclipboard"],
|
|
8
11
|
["onApiReady", "apiready"],
|
|
9
12
|
["onRowSelectionChange", "rowselectionchange"],
|
|
10
13
|
["onCellSelectionChange", "cellselectionchange"],
|
|
@@ -19,8 +22,12 @@ var a = /* @__PURE__ */ "data.columns.board.scheduler.chart.pivot.pivotMode.cont
|
|
|
19
22
|
["onCellDoubleClick", "celldoubleclick"],
|
|
20
23
|
["onRowDoubleClick", "rowdoubleclick"],
|
|
21
24
|
["onScrollBottomReached", "scrollbottomreached"],
|
|
25
|
+
["onVisibleRangeChange", "visiblerangechange"],
|
|
26
|
+
["onRetryRow", "retryrow"],
|
|
27
|
+
["onDetailToggle", "detailtoggle"],
|
|
22
28
|
["onColumnOrderChange", "columnorderchange"],
|
|
23
29
|
["onRowDragEnd", "rowdragend"],
|
|
30
|
+
["onRowDrop", "rowdrop"],
|
|
24
31
|
["onSelectionchange", "selectionchange"]
|
|
25
32
|
], s = t(function(t, s) {
|
|
26
33
|
let c = i(null), { shadow: l, className: u, style: d, ...f } = t;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
//#region ../grid/dist/row-resize.js
|
|
2
|
+
var e = "sv-grid-row-resize-handle";
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
let r = n, i = null, a = null;
|
|
5
|
+
function o(e, t) {
|
|
6
|
+
let n = r.min ?? 20, i = r.max ?? 320;
|
|
7
|
+
e.setAttribute("aria-valuemin", String(n)), e.setAttribute("aria-valuemax", String(i)), e.setAttribute("aria-valuenow", String(Math.round(Math.max(n, Math.min(i, t || n)))));
|
|
8
|
+
}
|
|
9
|
+
function s(e) {
|
|
10
|
+
let t = e.querySelector("[data-svgrid-row]")?.dataset.svgridRow;
|
|
11
|
+
return t == null ? NaN : Number(t);
|
|
12
|
+
}
|
|
13
|
+
function c(e) {
|
|
14
|
+
if (!i) return;
|
|
15
|
+
let t = r.min ?? 20, n = r.max ?? 320, a = Math.max(t, Math.min(n, i.startHeight + (e.clientY - i.startY)));
|
|
16
|
+
i.trEl.style.height = `${Math.round(a)}px`, o(i.strip, a), r.onResizeMove?.(i.rowIndex, Math.round(a));
|
|
17
|
+
}
|
|
18
|
+
function l(e) {
|
|
19
|
+
if (!i) return;
|
|
20
|
+
let t = r.min ?? 20, n = r.max ?? 320, a = Math.max(t, Math.min(n, i.startHeight + (e.clientY - i.startY)));
|
|
21
|
+
r.onResize(i.rowIndex, Math.round(a)), i.strip.classList.remove("is-resizing");
|
|
22
|
+
try {
|
|
23
|
+
i.trEl.releasePointerCapture(e.pointerId);
|
|
24
|
+
} catch {}
|
|
25
|
+
i = null, window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l), document.body.style.cursor = "";
|
|
26
|
+
}
|
|
27
|
+
function u(t) {
|
|
28
|
+
if (r.disabled) return;
|
|
29
|
+
let n = t.target;
|
|
30
|
+
if (!n?.classList.contains(e)) return;
|
|
31
|
+
let i = t.shiftKey ? 1 : 10, a = 0;
|
|
32
|
+
if (t.key === "ArrowUp") a = -i;
|
|
33
|
+
else if (t.key === "ArrowDown") a = i;
|
|
34
|
+
else return;
|
|
35
|
+
let c = n.closest("tr.sv-grid-row");
|
|
36
|
+
if (!c) return;
|
|
37
|
+
let l = s(c);
|
|
38
|
+
if (!Number.isFinite(l)) return;
|
|
39
|
+
t.preventDefault(), t.stopPropagation();
|
|
40
|
+
let u = r.min ?? 20, d = r.max ?? 320, f = Math.round(Math.max(u, Math.min(d, c.getBoundingClientRect().height + a)));
|
|
41
|
+
c.style.height = `${f}px`, o(n, f), r.onResizeMove?.(l, f), r.onResize(l, f);
|
|
42
|
+
}
|
|
43
|
+
function d(t) {
|
|
44
|
+
if (r.disabled) return;
|
|
45
|
+
let n = t.target;
|
|
46
|
+
if (!n?.classList.contains(e)) return;
|
|
47
|
+
let o = n.closest("tr.sv-grid-row");
|
|
48
|
+
if (!o) return;
|
|
49
|
+
let u = s(o);
|
|
50
|
+
if (!Number.isFinite(u)) return;
|
|
51
|
+
t.preventDefault(), t.stopPropagation();
|
|
52
|
+
let d = t.timeStamp, f = a !== null && a.rowIndex === u && d - a.at < 400;
|
|
53
|
+
if (a = {
|
|
54
|
+
rowIndex: u,
|
|
55
|
+
at: d
|
|
56
|
+
}, f && r.onAutosize) {
|
|
57
|
+
a = null, r.onAutosize(u);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
n.classList.add("is-resizing"), i = {
|
|
61
|
+
rowIndex: u,
|
|
62
|
+
startY: t.clientY,
|
|
63
|
+
startHeight: o.getBoundingClientRect().height,
|
|
64
|
+
trEl: o,
|
|
65
|
+
strip: n
|
|
66
|
+
};
|
|
67
|
+
try {
|
|
68
|
+
o.setPointerCapture(t.pointerId);
|
|
69
|
+
} catch {}
|
|
70
|
+
document.body.style.cursor = "row-resize", window.addEventListener("pointermove", c), window.addEventListener("pointerup", l);
|
|
71
|
+
}
|
|
72
|
+
function f() {
|
|
73
|
+
if (r.disabled) {
|
|
74
|
+
p();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
let n = t.querySelectorAll("tr.sv-grid-row");
|
|
78
|
+
for (let t of n) {
|
|
79
|
+
if (t.classList.contains("sv-grid-header-row") || t.classList.contains("sv-grid-row-spacer")) continue;
|
|
80
|
+
let n = t.querySelector(".sv-grid-cell.sv-row-gutter, .sv-grid-cell.sv-grid-row-number-cell") ?? (r.anchor === "row" ? t.querySelector(".sv-grid-cell") : null);
|
|
81
|
+
if (!n) continue;
|
|
82
|
+
let i = n.querySelector(`:scope > .${e}`);
|
|
83
|
+
if (i) {
|
|
84
|
+
o(i, t.getBoundingClientRect().height);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
getComputedStyle(n).position === "static" && (n.style.position = "relative"), n.style.overflow = "visible";
|
|
88
|
+
let a = document.createElement("div");
|
|
89
|
+
a.className = e, a.setAttribute("role", "separator"), a.setAttribute("aria-orientation", "horizontal"), a.setAttribute("aria-label", "Resize row"), a.tabIndex = 0, o(a, t.getBoundingClientRect().height), a.style.cssText = "position:absolute;left:0;right:0;bottom:0;height:5px;cursor:row-resize;user-select:none;z-index:60;pointer-events:auto;", n.appendChild(a);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function p() {
|
|
93
|
+
t.querySelectorAll(`.${e}`).forEach((e) => e.remove());
|
|
94
|
+
}
|
|
95
|
+
t.addEventListener("pointerdown", d, { capture: !0 }), t.addEventListener("keydown", u, { capture: !0 });
|
|
96
|
+
let m = new MutationObserver(() => f());
|
|
97
|
+
return m.observe(t, {
|
|
98
|
+
childList: !0,
|
|
99
|
+
subtree: !0
|
|
100
|
+
}), f(), {
|
|
101
|
+
update(e) {
|
|
102
|
+
let t = r.disabled;
|
|
103
|
+
r = e, t !== r.disabled && f();
|
|
104
|
+
},
|
|
105
|
+
destroy() {
|
|
106
|
+
t.removeEventListener("pointerdown", d, { capture: !0 }), t.removeEventListener("keydown", u, { capture: !0 }), window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l), m.disconnect(), p();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { t as rowResize };
|