impact-nova 3.0.0-alpha.17 → 3.0.0-alpha.18
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/dist/components/data/ag-grid-react/ag-grid.types.d.ts +9 -0
- package/dist/components/data/ag-grid-react/cell-renderers/badge-cell-renderer.d.ts +2 -0
- package/dist/components/data/ag-grid-react/cell-renderers/badge-cell-renderer.js +15 -14
- package/dist/components/data/ag-grid-react/cell-renderers/badge-icon-registry.d.ts +10 -0
- package/dist/components/data/ag-grid-react/cell-renderers/badge-icon-registry.js +17 -0
- package/dist/components/data/ag-grid-react/cell-renderers/index.d.ts +45 -7
- package/dist/components/data/ag-grid-react/cell-renderers/index.js +70 -58
- package/dist/components/data/ag-grid-react/cell-renderers/style-description-display-renderer.d.ts +5 -11
- package/dist/components/data/ag-grid-react/cell-renderers/style-description-display-renderer.js +127 -51
- package/dist/components/data/ag-grid-react/index.d.ts +1 -1
- package/dist/components/data/ag-grid-react/index.js +150 -147
- package/dist/components/data/ag-grid-react/list-drag-grid-options.d.ts +14 -1
- package/dist/components/data/ag-grid-react/list-drag-grid-options.js +95 -31
- package/dist/components/data/ag-grid-react/list-drag-preview-card.d.ts +4 -0
- package/dist/components/data/ag-grid-react/list-drag-preview-card.js +14 -0
- package/dist/components/data/ag-grid-react/list-drag-preview-snapshot.d.ts +20 -0
- package/dist/components/data/ag-grid-react/list-drag-preview-snapshot.js +42 -0
- package/dist/components/data/ag-grid-react/list-find-highlight.d.ts +6 -0
- package/dist/components/data/ag-grid-react/list-find-highlight.js +7 -0
- package/dist/components/data/ag-grid-react/process-backend-columndefs.d.ts +4 -0
- package/dist/components/data/ag-grid-react/process-backend-columndefs.js +78 -0
- package/dist/components/data/ag-grid-react/use-ag-grid-list-drag.d.ts +10 -2
- package/dist/components/data/ag-grid-react/use-ag-grid-list-drag.js +130 -107
- package/dist/components/data/ag-grid-react/use-list-drag-preview.d.ts +4 -1
- package/dist/components/data/ag-grid-react/use-list-drag-preview.js +131 -32
- package/dist/components/data/ag-grid-react/use-list-find.d.ts +36 -0
- package/dist/components/data/ag-grid-react/use-list-row-drop-zones.d.ts +2 -0
- package/dist/components/data/ag-grid-react/use-list-row-drop-zones.js +60 -41
- package/dist/components/data/data-table/data-table-list-header.js +1 -1
- package/dist/components/data/data-table/data-table-overlay.d.ts +6 -0
- package/dist/components/data/data-table/data-table-overlay.js +18 -0
- package/dist/components/data/data-table/data-table.types.d.ts +1 -0
- package/dist/components/data/data-table/index.d.ts +3 -0
- package/dist/components/data/data-table/index.js +67 -63
- package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +3 -2
- package/dist/components/data/expandable-list-item/expandable-list-item-metrics.js +3 -2
- package/dist/components/data/scenario-comparison/flatten-scenario-comparison-rows.d.ts +2 -0
- package/dist/components/data/scenario-comparison/flatten-scenario-comparison-rows.js +16 -0
- package/dist/components/data/scenario-comparison/index.d.ts +3 -0
- package/dist/components/data/scenario-comparison/index.js +6 -0
- package/dist/components/data/scenario-comparison/scenario-comparison-column.d.ts +12 -0
- package/dist/components/data/scenario-comparison/scenario-comparison-column.js +172 -0
- package/dist/components/data/scenario-comparison/scenario-comparison-label.d.ts +6 -0
- package/dist/components/data/scenario-comparison/scenario-comparison-label.js +64 -0
- package/dist/components/data/scenario-comparison/scenario-comparison.d.ts +5 -0
- package/dist/components/data/scenario-comparison/scenario-comparison.js +127 -0
- package/dist/components/data/scenario-comparison/scenario-comparison.types.d.ts +56 -0
- package/dist/components/data/scenario-comparison/scenario-comparison.variants.d.ts +7 -0
- package/dist/components/data/scenario-comparison/scenario-comparison.variants.js +29 -0
- package/dist/components/data-display/badge/index.d.ts +2 -0
- package/dist/components/data-display/badge/index.js +4 -2
- package/dist/components/data-display/badge/trophy-icon.d.ts +6 -0
- package/dist/components/data-display/badge/trophy-icon.js +28 -0
- package/dist/components/feedback/find-bar/collect-find-matches.d.ts +35 -0
- package/dist/components/feedback/find-bar/collect-find-matches.js +68 -0
- package/dist/components/feedback/find-bar/find-bar-shortcuts.d.ts +5 -0
- package/dist/components/feedback/find-bar/find-bar-shortcuts.js +27 -0
- package/dist/components/feedback/find-bar/find-bar.d.ts +7 -0
- package/dist/components/feedback/find-bar/find-bar.js +266 -0
- package/dist/components/feedback/find-bar/find-bar.types.d.ts +32 -0
- package/dist/components/feedback/find-bar/index.d.ts +4 -0
- package/dist/components/feedback/find-bar/index.js +11 -0
- package/dist/components/feedback/tooltip/tab-tooltip-render.js +3 -2
- package/dist/components/flows/command-palette/shortcut-settings.js +10 -10
- package/dist/components/flows/filter-panel/filter-panel.js +4 -4
- package/dist/components/forms/choice-card/choice-card-compare-scroll.d.ts +4 -0
- package/dist/components/forms/choice-card/choice-card-compare-scroll.js +6 -0
- package/dist/components/forms/choice-card/choice-card.d.ts +13 -2
- package/dist/components/forms/choice-card/choice-card.js +432 -342
- package/dist/components/forms/choice-card/choice-card.types.d.ts +9 -2
- package/dist/components/forms/select/components/SelectTriggerValue.js +3 -2
- package/dist/components/forms/select/components/Submenu.js +3 -2
- package/dist/components/primitives/tabs/folder-tab-path.d.ts +6 -0
- package/dist/components/primitives/tabs/folder-tab-path.js +16 -0
- package/dist/components/primitives/tabs/tabs.js +164 -111
- package/dist/components/primitives/tabs/tabs.types.d.ts +1 -1
- package/dist/i18n/defaultMessages.d.ts +17 -0
- package/dist/i18n/defaultMessages.js +52 -38
- package/dist/i18n/impact-nova-i18n-defaults.d.ts +5 -0
- package/dist/i18n/impact-nova-i18n-defaults.js +4 -9
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/locales/de.js +15 -1
- package/dist/i18n/locales/es.js +15 -1
- package/dist/i18n/locales/hi.js +15 -1
- package/dist/i18n/locales/kn.js +15 -1
- package/dist/impact-nova-components.css +189 -14
- package/dist/impact-nova-tokens.scss +2 -0
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +621 -607
- package/dist/lib/virtualized/index.d.ts +2 -0
- package/dist/lib/virtualized/index.js +35 -31
- package/dist/lib/virtualized/list-index.d.ts +5 -0
- package/dist/lib/virtualized/list-index.js +13 -0
- package/dist/lib/virtualized/read-infinite-query-list.d.ts +14 -0
- package/dist/lib/virtualized/read-infinite-query-list.js +12 -0
- package/dist/lib/virtualized/types.d.ts +4 -2
- package/dist/lib/virtualized/useRowState.js +60 -56
- package/dist/lib/virtualized/useVirtualizedList.d.ts +5 -0
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
|
@@ -1,46 +1,110 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function s(t) {
|
|
2
|
+
return t === "list";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
return
|
|
4
|
+
function a(t) {
|
|
5
|
+
return t.variant === "list" && t.onRowReorder != null && t.getRowId != null;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
if (!(
|
|
9
|
-
return String(
|
|
7
|
+
function g(t) {
|
|
8
|
+
if (!(t?.id == null || t.id === ""))
|
|
9
|
+
return String(t.id);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
11
|
+
function w(t) {
|
|
12
|
+
const { api: n, target: r } = t;
|
|
13
|
+
if (n && r instanceof Element) {
|
|
14
|
+
const i = r.closest(".ag-row");
|
|
15
|
+
if (i) {
|
|
16
|
+
const e = i.getAttribute("row-id");
|
|
17
|
+
if (e) {
|
|
18
|
+
const d = n.getRowNode(e);
|
|
19
|
+
if (d) return d;
|
|
20
|
+
}
|
|
21
|
+
const l = i.getAttribute("row-index");
|
|
22
|
+
if (l) {
|
|
23
|
+
const d = Number(l);
|
|
24
|
+
if (!Number.isNaN(d)) {
|
|
25
|
+
const f = n.getDisplayedRowAtIndex(d);
|
|
26
|
+
if (f) return f;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const o = n?.getFocusedCell();
|
|
32
|
+
if (!(!o || o.rowIndex == null))
|
|
33
|
+
return n?.getDisplayedRowAtIndex(o.rowIndex) ?? void 0;
|
|
34
|
+
}
|
|
35
|
+
function b(t, n) {
|
|
36
|
+
return n.replace(/\{\{position\}\}/g, String(t));
|
|
37
|
+
}
|
|
38
|
+
function p(t) {
|
|
39
|
+
return t.rowsDrop?.position === "above" ? "above" : "below";
|
|
40
|
+
}
|
|
41
|
+
function I(t, n) {
|
|
42
|
+
if (!n) return !0;
|
|
43
|
+
const r = t.event;
|
|
44
|
+
if (r == null || typeof r.clientX != "number" || typeof r.clientY != "number")
|
|
45
|
+
return !0;
|
|
46
|
+
const o = n.getBoundingClientRect();
|
|
47
|
+
return o.width <= 0 || o.height <= 0 ? !0 : r.clientX >= o.left && r.clientX <= o.right && r.clientY >= o.top && r.clientY <= o.bottom;
|
|
13
48
|
}
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
49
|
+
function m(t, n) {
|
|
50
|
+
if (t)
|
|
16
51
|
return String(
|
|
17
|
-
|
|
52
|
+
t({ data: n, level: 0 })
|
|
18
53
|
);
|
|
19
54
|
}
|
|
20
|
-
function
|
|
21
|
-
const t = [],
|
|
22
|
-
for (const
|
|
23
|
-
if (
|
|
24
|
-
"children" in
|
|
55
|
+
function x(t) {
|
|
56
|
+
const n = u(t), r = [], o = (i) => {
|
|
57
|
+
for (const e of i) {
|
|
58
|
+
if (r.length >= 2) return;
|
|
59
|
+
"children" in e && e.children ? o(e.children) : "field" in e && typeof e.field == "string" && r.push(e.field);
|
|
25
60
|
}
|
|
26
61
|
};
|
|
27
|
-
return
|
|
28
|
-
const
|
|
29
|
-
|
|
62
|
+
return t && o(t), (i) => {
|
|
63
|
+
const e = i.rowNode?.data ?? {};
|
|
64
|
+
if (n) {
|
|
65
|
+
const l = e[n];
|
|
66
|
+
if (l != null && l !== "") return String(l);
|
|
67
|
+
}
|
|
68
|
+
return r.map((l) => e[l]).filter((l) => l != null && l !== "").join(" · ");
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function c(t, n) {
|
|
72
|
+
return /rank/i.test(t) || n != null && /rank/i.test(n);
|
|
73
|
+
}
|
|
74
|
+
function u(t) {
|
|
75
|
+
const n = [], r = (i) => {
|
|
76
|
+
for (const e of i)
|
|
77
|
+
"children" in e && e.children ? r(e.children) : "field" in e && typeof e.field == "string" && e.colId !== "__drag-handle" && n.push({
|
|
78
|
+
field: e.field,
|
|
79
|
+
colId: typeof e.colId == "string" ? e.colId : void 0,
|
|
80
|
+
context: e.context
|
|
81
|
+
});
|
|
30
82
|
};
|
|
83
|
+
t && r(t);
|
|
84
|
+
for (const i of n)
|
|
85
|
+
if (/label|name|title$/i.test(i.field)) return i.field;
|
|
86
|
+
for (const i of n) {
|
|
87
|
+
const e = i.context;
|
|
88
|
+
if (e != null && typeof e == "object" && "findable" in e && e.findable === !0 && !c(i.field, i.colId))
|
|
89
|
+
return i.field;
|
|
90
|
+
}
|
|
91
|
+
return n.filter((i) => !c(i.field, i.colId))[0]?.field ?? n[0]?.field;
|
|
31
92
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
34
|
-
const
|
|
35
|
-
return
|
|
93
|
+
function y(t, n) {
|
|
94
|
+
return t == null ? n : (r) => {
|
|
95
|
+
const o = typeof t == "function" ? t({ data: r.data, rowIndex: r.node.rowIndex }) : t, i = n?.(r);
|
|
96
|
+
return o ? { ...i, "--in-ag-list-row-gradient": o } : i;
|
|
36
97
|
};
|
|
37
98
|
}
|
|
38
99
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
100
|
+
x as createDefaultRowDragText,
|
|
101
|
+
y as createListRowStyle,
|
|
102
|
+
p as dropPositionFromEvent,
|
|
103
|
+
b as formatListReorderLiveMessage,
|
|
104
|
+
a as isAgGridListDragEnabled,
|
|
105
|
+
s as isAgGridListVariant,
|
|
106
|
+
I as isListDragPointerOverHost,
|
|
107
|
+
m as itemIdFromGetRowId,
|
|
108
|
+
g as readDragRowId,
|
|
109
|
+
w as readListKeyboardRow
|
|
46
110
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
function r(e) {
|
|
3
|
+
return /* @__PURE__ */ t(
|
|
4
|
+
"span",
|
|
5
|
+
{
|
|
6
|
+
"data-component": "ag-grid-drag-preview-label",
|
|
7
|
+
className: "block min-w-0 truncate text-sm leading-5 text-content",
|
|
8
|
+
children: e.label
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
r as ListDragPreviewCard
|
|
14
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ListDragRowFrame = {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
cardHeight: number;
|
|
7
|
+
rowGradient: string;
|
|
8
|
+
listBorderRadius: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function readListDragRowFrame(container: HTMLElement | null): ListDragRowFrame | null;
|
|
11
|
+
/** List row cells without the drag handle — same content as the visible row card. */
|
|
12
|
+
export declare function readListDragPreviewMarkup(container: HTMLElement | null): string;
|
|
13
|
+
export declare function readListDragPreviewPosition(options: {
|
|
14
|
+
pointerX: number;
|
|
15
|
+
pointerY: number;
|
|
16
|
+
frame: ListDragRowFrame | null;
|
|
17
|
+
}): {
|
|
18
|
+
left: number;
|
|
19
|
+
top: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function o(t) {
|
|
2
|
+
const e = t?.closest('[data-component="ag-grid-react"][data-variant="list"]');
|
|
3
|
+
if (!(e instanceof HTMLElement)) return "";
|
|
4
|
+
const r = getComputedStyle(e).getPropertyValue("--in-ag-list-radius").trim();
|
|
5
|
+
return r && !r.startsWith("var(") ? r : getComputedStyle(e).getPropertyValue("--radius").trim();
|
|
6
|
+
}
|
|
7
|
+
function c(t) {
|
|
8
|
+
const e = t.querySelector(".ag-center-cols-container") ?? t.querySelector(".ag-grid-scrolling-cells");
|
|
9
|
+
return e instanceof HTMLElement ? e : t;
|
|
10
|
+
}
|
|
11
|
+
function l(t) {
|
|
12
|
+
const e = t?.querySelector(".ag-row.ag-row-dragging");
|
|
13
|
+
if (!(e instanceof HTMLElement)) return null;
|
|
14
|
+
const r = e.getBoundingClientRect(), n = c(e).getBoundingClientRect(), a = e.style.getPropertyValue("--in-ag-list-row-gradient").trim();
|
|
15
|
+
return {
|
|
16
|
+
left: n.left,
|
|
17
|
+
top: r.top,
|
|
18
|
+
width: n.width / 2,
|
|
19
|
+
height: r.height,
|
|
20
|
+
cardHeight: Math.max(r.height - 12, 0),
|
|
21
|
+
rowGradient: a,
|
|
22
|
+
listBorderRadius: o(t)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function s(t) {
|
|
26
|
+
const e = t?.querySelector(".ag-row.ag-row-dragging");
|
|
27
|
+
if (!(e instanceof HTMLElement)) return "";
|
|
28
|
+
const r = e.querySelectorAll('.ag-cell:not([col-id="__drag-handle"])');
|
|
29
|
+
return r.length === 0 ? "" : `<div class="in-ag-list-drag-preview-row">${Array.from(r).map((n) => `<div class="in-ag-list-drag-preview-cell">${n.innerHTML}</div>`).join("")}</div>`;
|
|
30
|
+
}
|
|
31
|
+
function g(t) {
|
|
32
|
+
const r = t.frame?.cardHeight ?? 40;
|
|
33
|
+
return {
|
|
34
|
+
left: t.pointerX + 16,
|
|
35
|
+
top: t.pointerY - r / 2
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
s as readListDragPreviewMarkup,
|
|
40
|
+
g as readListDragPreviewPosition,
|
|
41
|
+
l as readListDragRowFrame
|
|
42
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
function t(i) {
|
|
3
|
+
return /* @__PURE__ */ e("div", { className: i.active ? "bg-canvas-sunken" : void 0, "data-find-current": i.active ? "true" : "false", children: i.children });
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
t as ListFindHighlight
|
|
7
|
+
};
|
|
@@ -16,6 +16,10 @@ export interface BackendColDef extends Omit<ColDef, 'cellStyle'> {
|
|
|
16
16
|
colorRules?: ColorRule[];
|
|
17
17
|
cellStyle?: CellStyle | ((params: CellClassParams) => CellStyle | undefined);
|
|
18
18
|
children?: BackendColDef[];
|
|
19
|
+
decimals?: number;
|
|
20
|
+
divideBy?: number;
|
|
21
|
+
symbol?: string;
|
|
22
|
+
currency?: string;
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* Processes a single column definition to handle colorRules, valueFormatters, and alignment.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AG_GRID_VALUE_FORMATTERS as a } from "./value-formatters.js";
|
|
2
|
+
import { isBackendValueFormatterObject as l } from "./value-formatter.types.js";
|
|
3
|
+
const m = ["percentage", "currency", "currencySymbol", "number"], y = {
|
|
4
|
+
percentage: 2,
|
|
5
|
+
currencySymbol: 2,
|
|
6
|
+
currency: 2,
|
|
7
|
+
number: 0
|
|
8
|
+
}, f = (t, e, r) => {
|
|
9
|
+
if (t == null) return !1;
|
|
10
|
+
switch (e) {
|
|
11
|
+
case ">":
|
|
12
|
+
return Number(t) > Number(r);
|
|
13
|
+
case "<":
|
|
14
|
+
return Number(t) < Number(r);
|
|
15
|
+
case ">=":
|
|
16
|
+
return Number(t) >= Number(r);
|
|
17
|
+
case "<=":
|
|
18
|
+
return Number(t) <= Number(r);
|
|
19
|
+
case "==":
|
|
20
|
+
return t == r;
|
|
21
|
+
case "!=":
|
|
22
|
+
return t != r;
|
|
23
|
+
case "contains":
|
|
24
|
+
return String(t).includes(String(r));
|
|
25
|
+
case "startsWith":
|
|
26
|
+
return String(t).startsWith(String(r));
|
|
27
|
+
case "endsWith":
|
|
28
|
+
return String(t).endsWith(String(r));
|
|
29
|
+
default:
|
|
30
|
+
return !1;
|
|
31
|
+
}
|
|
32
|
+
}, g = (t) => (e) => {
|
|
33
|
+
const r = e.value;
|
|
34
|
+
for (const n of t)
|
|
35
|
+
if (f(r, n.condition, n.value)) {
|
|
36
|
+
const o = {
|
|
37
|
+
color: n.color
|
|
38
|
+
};
|
|
39
|
+
return n.fontWeight && (o.fontWeight = n.fontWeight), n.backgroundColor && (o.backgroundColor = n.backgroundColor), o;
|
|
40
|
+
}
|
|
41
|
+
}, u = (t) => {
|
|
42
|
+
if ("children" in t && t.children)
|
|
43
|
+
return {
|
|
44
|
+
...t,
|
|
45
|
+
children: t.children.map((r) => u(r))
|
|
46
|
+
};
|
|
47
|
+
const e = { ...t };
|
|
48
|
+
if (l(e.valueFormatter)) {
|
|
49
|
+
const r = e.valueFormatter, n = a[r.type];
|
|
50
|
+
n ? (r.decimals !== void 0 && (e.decimals = r.decimals), r.divideBy !== void 0 && (e.divideBy = r.divideBy), r.symbol !== void 0 && (e.symbol = r.symbol), r.currency !== void 0 && (e.currency = r.currency), e.valueFormatter = n) : console.warn(`[processColDef] Unknown valueFormatter type: "${r.type}"`);
|
|
51
|
+
}
|
|
52
|
+
if (t.colorRules && t.colorRules.length > 0) {
|
|
53
|
+
const r = g(t.colorRules), n = e.cellStyle;
|
|
54
|
+
typeof n == "function" ? e.cellStyle = (o) => {
|
|
55
|
+
const i = n(o), s = r(o);
|
|
56
|
+
if (!(!i && !s))
|
|
57
|
+
return { ...i, ...s };
|
|
58
|
+
} : n ? e.cellStyle = (o) => ({
|
|
59
|
+
...n,
|
|
60
|
+
...r(o) || {}
|
|
61
|
+
}) : e.cellStyle = r, delete e.colorRules;
|
|
62
|
+
}
|
|
63
|
+
if (l(t.valueFormatter)) {
|
|
64
|
+
const { type: r, decimals: n } = t.valueFormatter;
|
|
65
|
+
if (r && m.includes(r) && !e.filterValueGetter) {
|
|
66
|
+
const o = n ?? y[r] ?? 0, i = Math.pow(10, o), s = t.field;
|
|
67
|
+
e.filterValueGetter = (d) => {
|
|
68
|
+
const c = d.data?.[s];
|
|
69
|
+
return c == null || isNaN(Number(c)) ? c : Math.round(Number(c) * i) / i;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return (e.type === "number" || e.type === "numericColumn" || e.type === "currency" || e.type === "percentage") && (e.headerClass = e.headerClass ? `${e.headerClass} ag-right-aligned-header` : "ag-right-aligned-header", e.cellClass = e.cellClass ? `${e.cellClass} ag-right-aligned-cell` : "ag-right-aligned-cell"), !e.valueFormatter && (e.type === "numericColumn" || e.type === "number") && (e.valueFormatter = a.number), e;
|
|
74
|
+
}, p = (t) => !t || t.length === 0 ? t : t.filter((e) => e != null).map((e) => u(e));
|
|
75
|
+
export {
|
|
76
|
+
p as processBackendColumnDefs,
|
|
77
|
+
u as processColDef
|
|
78
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { ColDef, ColGroupDef, GridApi, RowDragEndEvent, RowDragMoveEvent } from 'ag-grid-community';
|
|
2
|
+
import { ColDef, ColGroupDef, GridApi, RowDragCancelEvent, RowDragEndEvent, RowDragLeaveEvent, RowDragMoveEvent } from 'ag-grid-community';
|
|
3
3
|
import { AgGridReactProps } from 'ag-grid-react';
|
|
4
4
|
import { ListRowDropCheck, ListRowReorderMeta } from './list-row-move';
|
|
5
5
|
import { AgGridListHeaderMode, AgGridVisualVariant, AgGridWrapperProps } from './ag-grid.types';
|
|
@@ -14,6 +14,11 @@ export declare function useAgGridDragList<TData>(options: {
|
|
|
14
14
|
getRowDragHandleLabel?: AgGridWrapperProps<TData>['getRowDragHandleLabel'];
|
|
15
15
|
canDropRow?: (params: ListRowDropCheck<TData>) => boolean;
|
|
16
16
|
onRowReorder?: (meta: ListRowReorderMeta<TData>) => void;
|
|
17
|
+
onRowMoveBeyondEdge?: (meta: {
|
|
18
|
+
rowId: string;
|
|
19
|
+
direction: 'up' | 'down';
|
|
20
|
+
row: TData;
|
|
21
|
+
}) => void;
|
|
17
22
|
getRowStyle?: AgGridReactProps<TData>['getRowStyle'];
|
|
18
23
|
getRowId?: AgGridReactProps<TData>['getRowId'];
|
|
19
24
|
rowData?: TData[] | null;
|
|
@@ -21,6 +26,7 @@ export declare function useAgGridDragList<TData>(options: {
|
|
|
21
26
|
rowDragText?: AgGridReactProps<TData>['rowDragText'];
|
|
22
27
|
onRowDragEnter?: AgGridReactProps<TData>['onRowDragEnter'];
|
|
23
28
|
onRowDragMove?: AgGridReactProps<TData>['onRowDragMove'];
|
|
29
|
+
onRowDragLeave?: AgGridReactProps<TData>['onRowDragLeave'];
|
|
24
30
|
onRowDragCancel?: AgGridReactProps<TData>['onRowDragCancel'];
|
|
25
31
|
onRowDragEnd?: AgGridReactProps<TData>['onRowDragEnd'];
|
|
26
32
|
gridContainerRef: RefObject<HTMLDivElement | null>;
|
|
@@ -38,7 +44,8 @@ export declare function useAgGridDragList<TData>(options: {
|
|
|
38
44
|
getRowStyle: import('ag-grid-community').GetRowStyle<TData, any> | undefined;
|
|
39
45
|
onRowDragEnter: (event: import('ag-grid-community').RowDragEnterEvent<TData, any>) => void;
|
|
40
46
|
onRowDragMove: (event: RowDragMoveEvent<TData>) => void;
|
|
41
|
-
|
|
47
|
+
onRowDragLeave: (event: RowDragLeaveEvent<TData>) => void;
|
|
48
|
+
onRowDragCancel: (event: RowDragCancelEvent<TData>) => void;
|
|
42
49
|
onRowDragEnd: (event: RowDragEndEvent<TData>) => void;
|
|
43
50
|
} | {
|
|
44
51
|
getRowStyle: import('ag-grid-community').GetRowStyle<TData, any> | undefined;
|
|
@@ -48,6 +55,7 @@ export declare function useAgGridDragList<TData>(options: {
|
|
|
48
55
|
animateRows?: undefined;
|
|
49
56
|
onRowDragEnter?: undefined;
|
|
50
57
|
onRowDragMove?: undefined;
|
|
58
|
+
onRowDragLeave?: undefined;
|
|
51
59
|
onRowDragCancel?: undefined;
|
|
52
60
|
onRowDragEnd?: undefined;
|
|
53
61
|
} | null;
|
|
@@ -1,139 +1,162 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as so } from "react/jsx-runtime";
|
|
2
|
+
import { useState as lo, useMemo as A, useCallback as p, useEffect as wo } from "react";
|
|
3
|
+
import { useImpactNovaI18n as go } from "../../../i18n/use-impact-nova-i18n.js";
|
|
4
|
+
import { isListDropAllowed as B, applyUnmanagedRowDrag as co, applyKeyboardListRowReorder as Do } from "./list-row-move.js";
|
|
5
|
+
import { buildDragListColumnDefs as Ro } from "./build-list-drag-column-defs.js";
|
|
6
|
+
import { createDefaultRowDragText as uo, createListRowStyle as po, formatListReorderLiveMessage as fo, isListDragPointerOverHost as mo, dropPositionFromEvent as W, readDragRowId as h, isAgGridListDragEnabled as Io, isAgGridListVariant as Lo, itemIdFromGetRowId as q, readListKeyboardRow as yo } from "./list-drag-grid-options.js";
|
|
7
|
+
import { useListDragPreview as ho } from "./use-list-drag-preview.js";
|
|
8
|
+
function z(x) {
|
|
9
|
+
const w = [];
|
|
10
|
+
return x.forEachNodeAfterFilterAndSort((P) => {
|
|
11
|
+
const g = h(P);
|
|
12
|
+
g && w.push(g);
|
|
13
|
+
}), w;
|
|
11
14
|
}
|
|
12
|
-
function
|
|
13
|
-
const r = [];
|
|
14
|
-
return d.forEachNodeAfterFilterAndSort((I) => {
|
|
15
|
-
const g = m(I);
|
|
16
|
-
g && r.push(g);
|
|
17
|
-
}), r;
|
|
18
|
-
}
|
|
19
|
-
function Io(d) {
|
|
15
|
+
function Go(x) {
|
|
20
16
|
const {
|
|
21
|
-
variant:
|
|
22
|
-
listHeader:
|
|
17
|
+
variant: w,
|
|
18
|
+
listHeader: P,
|
|
23
19
|
columnDefs: g,
|
|
24
|
-
mergedColumnDefs:
|
|
25
|
-
listRowGradient:
|
|
26
|
-
listDragPreview:
|
|
27
|
-
isRowDragDisabled:
|
|
28
|
-
getRowDragHandleLabel:
|
|
29
|
-
canDropRow:
|
|
30
|
-
onRowReorder:
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
mergedColumnDefs: E,
|
|
21
|
+
listRowGradient: f,
|
|
22
|
+
listDragPreview: J,
|
|
23
|
+
isRowDragDisabled: m,
|
|
24
|
+
getRowDragHandleLabel: C,
|
|
25
|
+
canDropRow: d,
|
|
26
|
+
onRowReorder: M,
|
|
27
|
+
onRowMoveBeyondEdge: v,
|
|
28
|
+
getRowStyle: b,
|
|
29
|
+
getRowId: n,
|
|
33
30
|
rowData: l,
|
|
34
|
-
rowDragManaged:
|
|
35
|
-
rowDragText:
|
|
36
|
-
onRowDragEnter:
|
|
37
|
-
onRowDragMove:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
rowDragManaged: Q,
|
|
32
|
+
rowDragText: G,
|
|
33
|
+
onRowDragEnter: X,
|
|
34
|
+
onRowDragMove: T,
|
|
35
|
+
onRowDragLeave: S,
|
|
36
|
+
onRowDragCancel: Y,
|
|
37
|
+
onRowDragEnd: k,
|
|
38
|
+
gridContainerRef: c,
|
|
39
|
+
gridApiRef: H
|
|
40
|
+
} = x, D = Lo(w), t = Io({ variant: w, onRowReorder: M, getRowId: n }), N = D && P === "none", e = Q === !0, { t: K } = go(), [Z, _] = lo(""), $ = A(() => t ? Ro({
|
|
41
|
+
columnDefs: E,
|
|
42
|
+
isRowDragDisabled: m,
|
|
43
|
+
getRowDragHandleLabel: C
|
|
44
|
+
}) : E, [C, t, m, E]), F = A(
|
|
45
|
+
() => uo(g),
|
|
48
46
|
[g]
|
|
49
|
-
),
|
|
50
|
-
() =>
|
|
51
|
-
[
|
|
52
|
-
),
|
|
47
|
+
), O = A(
|
|
48
|
+
() => D ? po(f, b) : b,
|
|
49
|
+
[b, D, f]
|
|
50
|
+
), I = p(
|
|
53
51
|
(o) => {
|
|
54
|
-
|
|
52
|
+
M?.(o), _(
|
|
53
|
+
fo(o.toIndex + 1, K("dataTable.listMovedToPosition"))
|
|
54
|
+
);
|
|
55
55
|
},
|
|
56
|
-
[
|
|
57
|
-
),
|
|
56
|
+
[M, K]
|
|
57
|
+
), a = ho({
|
|
58
58
|
enabled: t,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
gridContainerRef: c,
|
|
60
|
+
listDragPreview: J,
|
|
61
|
+
rowDragText: G ?? F,
|
|
62
|
+
onRowDragEnter: X,
|
|
63
|
+
onRowDragCancel: Y
|
|
64
|
+
}), oo = p(
|
|
63
65
|
(o) => {
|
|
64
|
-
if (
|
|
65
|
-
const i = Math.max(o.overIndex, 0),
|
|
66
|
+
if (a.handleRowDragMove(o), !e) {
|
|
67
|
+
const i = Math.max(o.overIndex, 0), r = o.node.data && B(d, { row: o.node.data, toIndex: i }), R = mo(
|
|
68
|
+
o,
|
|
69
|
+
c.current
|
|
70
|
+
);
|
|
66
71
|
o.api.setRowDropPositionIndicator(
|
|
67
|
-
|
|
72
|
+
R && r && o.overNode ? { row: o.overNode, dropIndicatorPosition: W(o) } : null
|
|
68
73
|
);
|
|
69
74
|
}
|
|
70
|
-
|
|
75
|
+
T?.(o);
|
|
76
|
+
},
|
|
77
|
+
[d, c, e, T, a]
|
|
78
|
+
), ro = p(
|
|
79
|
+
(o) => {
|
|
80
|
+
e || o.api.setRowDropPositionIndicator(null), S?.(o);
|
|
71
81
|
},
|
|
72
|
-
[
|
|
73
|
-
),
|
|
82
|
+
[e, S]
|
|
83
|
+
), eo = p(
|
|
74
84
|
(o) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
85
|
+
e || o.api.setRowDropPositionIndicator(null), a.handleRowDragCancel(o);
|
|
86
|
+
},
|
|
87
|
+
[e, a]
|
|
88
|
+
), to = p(
|
|
89
|
+
(o) => {
|
|
90
|
+
if (a.clearPreview(), o.api.setRowDropPositionIndicator(null), !e && l && o.node.data && n) {
|
|
91
|
+
const i = h(o.node), r = Math.max(o.overIndex, 0);
|
|
92
|
+
if (o.node.data && B(d, { row: o.node.data, toIndex: r }) && i) {
|
|
93
|
+
const s = co({
|
|
79
94
|
items: l,
|
|
80
|
-
getItemId: (
|
|
95
|
+
getItemId: (u) => q(n, u) ?? "",
|
|
81
96
|
draggedId: i,
|
|
82
|
-
overId:
|
|
83
|
-
position:
|
|
97
|
+
overId: h(o.overNode),
|
|
98
|
+
position: W(o)
|
|
84
99
|
});
|
|
85
|
-
|
|
100
|
+
s && I(s);
|
|
86
101
|
}
|
|
87
|
-
} else typeof
|
|
88
|
-
|
|
102
|
+
} else typeof f == "function" && o.api.redrawRows();
|
|
103
|
+
k?.(o);
|
|
89
104
|
},
|
|
90
|
-
[
|
|
105
|
+
[d, I, n, f, e, k, a, l]
|
|
91
106
|
);
|
|
92
|
-
|
|
93
|
-
const o =
|
|
94
|
-
if (!t || !o || !
|
|
95
|
-
const i = (
|
|
96
|
-
if (!
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
wo(() => {
|
|
108
|
+
const o = c.current;
|
|
109
|
+
if (!t || !o || !n) return;
|
|
110
|
+
const i = (r) => {
|
|
111
|
+
if (!r.altKey || r.key !== "ArrowUp" && r.key !== "ArrowDown") return;
|
|
112
|
+
const R = r.target;
|
|
113
|
+
if (R?.closest('input, textarea, [contenteditable="true"]')) return;
|
|
114
|
+
const s = H.current, u = yo({ api: s ?? void 0, target: R });
|
|
115
|
+
if (!u?.data || !l || !s) return;
|
|
116
|
+
const L = h(u);
|
|
117
|
+
if (!L) return;
|
|
118
|
+
r.preventDefault();
|
|
119
|
+
const y = r.key === "ArrowUp" ? "up" : "down", U = Do({
|
|
103
120
|
items: l,
|
|
104
|
-
displayedRowIds:
|
|
105
|
-
draggedId:
|
|
106
|
-
direction:
|
|
107
|
-
getItemId: (
|
|
108
|
-
isRowDragDisabled:
|
|
109
|
-
canDropRow:
|
|
121
|
+
displayedRowIds: z(s),
|
|
122
|
+
draggedId: L,
|
|
123
|
+
direction: y,
|
|
124
|
+
getItemId: (io) => q(n, io) ?? "",
|
|
125
|
+
isRowDragDisabled: m,
|
|
126
|
+
canDropRow: d
|
|
110
127
|
});
|
|
111
|
-
|
|
128
|
+
if (U) {
|
|
129
|
+
I(U);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const V = z(s), j = V.indexOf(L);
|
|
133
|
+
(y === "up" && j === 0 || y === "down" && j === V.length - 1) && v && v({ rowId: L, direction: y, row: u.data });
|
|
112
134
|
};
|
|
113
135
|
return o.addEventListener("keydown", i), () => o.removeEventListener("keydown", i);
|
|
114
|
-
}, [
|
|
115
|
-
const
|
|
116
|
-
rowDragManaged:
|
|
117
|
-
rowDragText:
|
|
136
|
+
}, [d, I, n, H, c, t, m, v, l]);
|
|
137
|
+
const ao = t ? /* @__PURE__ */ so("div", { className: "sr-only", "aria-live": "polite", children: Z }) : null, no = t ? {
|
|
138
|
+
rowDragManaged: e,
|
|
139
|
+
rowDragText: G ?? F,
|
|
118
140
|
suppressMoveWhenRowDragging: !0,
|
|
119
141
|
animateRows: !0,
|
|
120
|
-
getRowStyle:
|
|
121
|
-
onRowDragEnter:
|
|
122
|
-
onRowDragMove:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
142
|
+
getRowStyle: O,
|
|
143
|
+
onRowDragEnter: a.handleRowDragEnter,
|
|
144
|
+
onRowDragMove: oo,
|
|
145
|
+
onRowDragLeave: ro,
|
|
146
|
+
onRowDragCancel: eo,
|
|
147
|
+
onRowDragEnd: to
|
|
148
|
+
} : D ? { getRowStyle: O } : null;
|
|
126
149
|
return {
|
|
127
150
|
isDragList: t,
|
|
128
|
-
isListVariant:
|
|
129
|
-
hideColumnHeader:
|
|
130
|
-
dragListColumnDefs:
|
|
131
|
-
dragListGridProps:
|
|
132
|
-
listHeaderGridProps:
|
|
133
|
-
dragPreviewPortal:
|
|
134
|
-
liveRegion:
|
|
151
|
+
isListVariant: D,
|
|
152
|
+
hideColumnHeader: N,
|
|
153
|
+
dragListColumnDefs: $,
|
|
154
|
+
dragListGridProps: no,
|
|
155
|
+
listHeaderGridProps: N ? { headerHeight: 0 } : null,
|
|
156
|
+
dragPreviewPortal: a.dragPreviewPortal,
|
|
157
|
+
liveRegion: ao
|
|
135
158
|
};
|
|
136
159
|
}
|
|
137
160
|
export {
|
|
138
|
-
|
|
161
|
+
Go as useAgGridDragList
|
|
139
162
|
};
|