impact-nova 1.3.0 → 1.5.2
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 +49 -0
- package/dist/components/layout/dashboard-layout.d.ts +15 -1
- package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +65 -64
- package/dist/components/ui/accordion.js +38 -34
- package/dist/components/ui/ag-grid-react/cell-renderers/badge-cell-renderer.js +1 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.d.ts +58 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.js +104 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +62 -54
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +54 -68
- package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +3 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/index.js +33 -27
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +3 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.js +28 -12
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.d.ts +2 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +45 -44
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +23 -37
- package/dist/components/ui/ag-grid-react/cell-renderers/types.d.ts +33 -17
- package/dist/components/ui/ag-grid-react/editable-utils.d.ts +27 -0
- package/dist/components/ui/ag-grid-react/editable-utils.js +62 -0
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +99 -98
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +110 -143
- package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +72 -69
- package/dist/components/ui/ag-grid-react/headers/components/header-info.js +36 -35
- package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +14 -12
- package/dist/components/ui/ag-grid-react/headers/custom-header.js +111 -110
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +204 -203
- package/dist/components/ui/alert.js +62 -58
- package/dist/components/ui/breadcrumb.js +81 -74
- package/dist/components/ui/calendar.js +354 -354
- package/dist/components/ui/chart/chart.js +63 -62
- package/dist/components/ui/chips.js +42 -38
- package/dist/components/ui/command-palette/command-palette-context.d.ts +52 -0
- package/dist/components/ui/command-palette/command-palette-context.js +110 -0
- package/dist/components/ui/command-palette/command-palette.d.ts +67 -0
- package/dist/components/ui/command-palette/command-palette.js +402 -0
- package/dist/components/ui/command-palette/index.d.ts +23 -0
- package/dist/components/ui/command-palette/index.js +44 -0
- package/dist/components/ui/command-palette/kbd.d.ts +28 -0
- package/dist/components/ui/command-palette/kbd.js +52 -0
- package/dist/components/ui/command-palette/shortcut-registry.d.ts +68 -0
- package/dist/components/ui/command-palette/shortcut-registry.js +183 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.d.ts +55 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.js +55 -0
- package/dist/components/ui/command-palette/shortcut-settings.d.ts +27 -0
- package/dist/components/ui/command-palette/shortcut-settings.js +266 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.d.ts +32 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.js +48 -0
- package/dist/components/ui/command-palette/use-global-shortcut.d.ts +3 -0
- package/dist/components/ui/command-palette/use-global-shortcut.js +7 -0
- package/dist/components/ui/command-palette/use-shortcut.d.ts +47 -0
- package/dist/components/ui/command-palette/use-shortcut.js +49 -0
- package/dist/components/ui/command-palette/utils.d.ts +119 -0
- package/dist/components/ui/command-palette/utils.js +248 -0
- package/dist/components/ui/data-table/data-table-column-list.js +87 -86
- package/dist/components/ui/data-table/data-table-format-options.js +45 -44
- package/dist/components/ui/data-table/data-table-view-options.js +39 -38
- package/dist/components/ui/date-picker/date-picker.js +89 -87
- package/dist/components/ui/date-picker/date-range-picker.js +140 -138
- package/dist/components/ui/date-picker/month-picker.js +82 -81
- package/dist/components/ui/date-picker/month-range-picker.js +108 -105
- package/dist/components/ui/date-picker/multi-date-picker.js +68 -66
- package/dist/components/ui/date-picker/multi-month-picker.js +59 -58
- package/dist/components/ui/date-picker/multi-week-picker.js +80 -78
- package/dist/components/ui/date-picker/week-picker.js +117 -115
- package/dist/components/ui/date-picker/week-range-picker.js +166 -164
- package/dist/components/ui/dialog.js +78 -73
- package/dist/components/ui/drawer.js +71 -66
- package/dist/components/ui/file-upload.js +131 -127
- package/dist/components/ui/filter-panel/filter-panel.js +98 -94
- package/dist/components/ui/filter-strip/filter-strip.js +95 -91
- package/dist/components/ui/filter-strip/filter-summary.js +91 -90
- package/dist/components/ui/header.js +57 -53
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +78 -76
- package/dist/components/ui/loader.js +17 -16
- package/dist/components/ui/nested-list/components/NestedListHeader.d.ts +1 -0
- package/dist/components/ui/nested-list/components/NestedListHeader.js +51 -48
- package/dist/components/ui/nested-list/components/SortableItem.js +60 -59
- package/dist/components/ui/nested-list/nested-list.js +184 -182
- package/dist/components/ui/notification-panel/notification-panel.js +60 -53
- package/dist/components/ui/popover.js +45 -40
- package/dist/components/ui/prompt.js +90 -86
- package/dist/components/ui/select/select.js +206 -209
- package/dist/components/ui/sheet.d.ts +1 -0
- package/dist/components/ui/sheet.js +50 -48
- package/dist/components/ui/sidebar.js +273 -267
- package/dist/components/ui/stepper.js +75 -63
- package/dist/components/ui/tag.js +48 -44
- package/dist/components/ui/toast.js +46 -41
- package/dist/i18n/ImpactNovaI18nContext.d.ts +21 -0
- package/dist/i18n/ImpactNovaI18nContext.js +76 -0
- package/dist/i18n/defaultMessages.d.ts +231 -0
- package/dist/i18n/defaultMessages.js +206 -0
- package/dist/i18n/getDateFnsLocale.d.ts +11 -0
- package/dist/i18n/getDateFnsLocale.js +21 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.js +206 -0
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.js +206 -0
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.js +206 -0
- package/dist/i18n/locales/index.d.ts +4 -0
- package/dist/i18n/locales/kn.d.ts +2 -0
- package/dist/i18n/locales/kn.js +206 -0
- package/dist/icons/assets/boxAdd.svg.js +5 -0
- package/dist/icons/assets/boxed.svg.js +5 -0
- package/dist/icons/assets/trolley.svg.js +5 -0
- package/dist/icons/assets/unlocked.svg.js +5 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +179 -171
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +232 -172
- package/package.json +36 -4
- package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as c, jsxs as
|
|
2
|
-
import { useMemo as S, useCallback as
|
|
3
|
-
import { Badge as
|
|
4
|
-
import { evaluateValidationRules as
|
|
5
|
-
import { getIconComponent as
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
const
|
|
1
|
+
import { jsx as c, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as S, useCallback as T } from "react";
|
|
3
|
+
import { Badge as V } from "../../badge.js";
|
|
4
|
+
import { evaluateValidationRules as I, getFieldValue as m, mapBadgeVariant as L, mapBadgeColor as U } from "./cell-renderer-utils.js";
|
|
5
|
+
import { getIconComponent as H } from "../../../../icons/index.js";
|
|
6
|
+
import { Tooltip as _, TooltipTrigger as z, TooltipContent as M } from "../../tooltip.js";
|
|
7
|
+
const Q = (e, t, r, a) => {
|
|
8
8
|
if (!t) return e;
|
|
9
9
|
let l = e;
|
|
10
10
|
return l = l.replace(/\$\{value\}/g, String(a ?? "")), l = l.replace(/\$\{field\}/g, String(r ?? "")), Object.keys(t).forEach((i) => {
|
|
11
11
|
const o = new RegExp(`\\$\\{${i}\\}`, "g");
|
|
12
12
|
l = l.replace(o, String(t[i] ?? ""));
|
|
13
13
|
}), l;
|
|
14
|
-
},
|
|
14
|
+
}, W = ({
|
|
15
15
|
iconConfig: e,
|
|
16
16
|
rowData: t,
|
|
17
17
|
rowId: r,
|
|
@@ -19,8 +19,8 @@ const M = (e, t, r, a) => {
|
|
|
19
19
|
}) => {
|
|
20
20
|
let l = null;
|
|
21
21
|
const i = m(e.iconField, e.icon, t);
|
|
22
|
-
if (typeof i == "string" ? l =
|
|
23
|
-
const o = m(e.backgroundColorField, e.backgroundColor, t), s = m(e.colorField, e.color, t) ?? "#60697D",
|
|
22
|
+
if (typeof i == "string" ? l = H(i, { size: 16 }) : l = i, !l) return null;
|
|
23
|
+
const o = m(e.backgroundColorField, e.backgroundColor, t), s = m(e.colorField, e.color, t) ?? "#60697D", f = m(e.tooltipField, e.tooltip, t), h = /* @__PURE__ */ c(
|
|
24
24
|
"div",
|
|
25
25
|
{
|
|
26
26
|
className: `flex items-center justify-center ${e.onClick ? "cursor-pointer" : ""} ${e.showOnHover ? "opacity-0 group-hover:opacity-100 transition-opacity" : ""}`,
|
|
@@ -37,11 +37,11 @@ const M = (e, t, r, a) => {
|
|
|
37
37
|
children: l
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
|
-
return
|
|
41
|
-
/* @__PURE__ */ c(
|
|
42
|
-
/* @__PURE__ */ c(
|
|
43
|
-
] }) :
|
|
44
|
-
},
|
|
40
|
+
return f ? /* @__PURE__ */ w(_, { children: [
|
|
41
|
+
/* @__PURE__ */ c(z, { asChild: !0, children: h }),
|
|
42
|
+
/* @__PURE__ */ c(M, { variant: "tertiary", side: e.tooltipSide || "top", children: f })
|
|
43
|
+
] }) : h;
|
|
44
|
+
}, q = ({
|
|
45
45
|
badgeConfig: e,
|
|
46
46
|
rowData: t,
|
|
47
47
|
rowId: r,
|
|
@@ -51,16 +51,16 @@ const M = (e, t, r, a) => {
|
|
|
51
51
|
if (!l) return null;
|
|
52
52
|
const i = m(e.colorField, e.color, t), o = m(e.variantField, e.variant, t);
|
|
53
53
|
return /* @__PURE__ */ c(
|
|
54
|
-
|
|
54
|
+
V,
|
|
55
55
|
{
|
|
56
56
|
className: "font-medium",
|
|
57
|
-
color:
|
|
58
|
-
variant:
|
|
57
|
+
color: U(i),
|
|
58
|
+
variant: L(o),
|
|
59
59
|
onClick: e.onClick ? () => e.onClick?.({ rowId: r, field: a, rowData: t ?? {} }) : void 0,
|
|
60
60
|
children: l
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
|
-
},
|
|
63
|
+
}, A = (e) => {
|
|
64
64
|
const {
|
|
65
65
|
value: t,
|
|
66
66
|
data: r,
|
|
@@ -69,39 +69,40 @@ const M = (e, t, r, a) => {
|
|
|
69
69
|
onClick: i,
|
|
70
70
|
redirectUrl: o,
|
|
71
71
|
updateQueryParams: s,
|
|
72
|
-
navigate:
|
|
73
|
-
setSearchParams:
|
|
72
|
+
navigate: f,
|
|
73
|
+
setSearchParams: h,
|
|
74
74
|
rightSideContent: v,
|
|
75
75
|
valueFormatter: k,
|
|
76
76
|
disableOnPinnedRows: b = !0,
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
disableLinkStyle: $,
|
|
78
|
+
validationRules: R
|
|
79
|
+
} = e, y = a.id ?? String(r?.id ?? ""), d = l?.field ?? "", E = r && typeof r == "object" && "_isPinned" in r && r._isPinned === !0, F = S(() => $ || b && E || I(R, r) ? !1 : !!(s || o || i), [$, b, E, s, o, i, R, r]), C = T(
|
|
79
80
|
(u) => {
|
|
80
|
-
if (u.stopPropagation(), s &&
|
|
81
|
-
|
|
81
|
+
if (u.stopPropagation(), s && h)
|
|
82
|
+
h((n) => {
|
|
82
83
|
const g = new URLSearchParams(n);
|
|
83
|
-
return Object.entries(s).forEach(([x,
|
|
84
|
-
let p = String(
|
|
85
|
-
p = p.replace(/\$\{value\}/g, String(t ?? "")), p = p.replace(/\$\{field\}/g, d), r && Object.keys(r).forEach((
|
|
86
|
-
const
|
|
87
|
-
p = p.replace(
|
|
84
|
+
return Object.entries(s).forEach(([x, B]) => {
|
|
85
|
+
let p = String(B);
|
|
86
|
+
p = p.replace(/\$\{value\}/g, String(t ?? "")), p = p.replace(/\$\{field\}/g, d), r && Object.keys(r).forEach((j) => {
|
|
87
|
+
const O = new RegExp(`\\$\\{${j}\\}`, "g");
|
|
88
|
+
p = p.replace(O, String(r[j] ?? ""));
|
|
88
89
|
}), g.set(x, p);
|
|
89
90
|
}), g;
|
|
90
91
|
});
|
|
91
|
-
else if (o &&
|
|
92
|
-
const n =
|
|
93
|
-
|
|
92
|
+
else if (o && f) {
|
|
93
|
+
const n = Q(o, r, d, t);
|
|
94
|
+
f(n);
|
|
94
95
|
} else i && i({ rowId: y, field: d, rowData: r ?? {}, value: t });
|
|
95
96
|
},
|
|
96
|
-
[s,
|
|
97
|
-
),
|
|
97
|
+
[s, h, o, f, i, r, d, t, y]
|
|
98
|
+
), N = S(() => k ? k(t, r ?? {}) : String(t ?? ""), [t, k, r]), P = S(() => {
|
|
98
99
|
if (!v?.items || v.items.length === 0) return null;
|
|
99
100
|
const u = [];
|
|
100
101
|
return v.items.forEach((n, g) => {
|
|
101
102
|
if (n.type === "icon" && n.icon)
|
|
102
103
|
u.push(
|
|
103
104
|
/* @__PURE__ */ c(
|
|
104
|
-
|
|
105
|
+
W,
|
|
105
106
|
{
|
|
106
107
|
iconConfig: n.icon,
|
|
107
108
|
rowData: r,
|
|
@@ -114,7 +115,7 @@ const M = (e, t, r, a) => {
|
|
|
114
115
|
else if (n.type === "badge" && n.badge)
|
|
115
116
|
u.push(
|
|
116
117
|
/* @__PURE__ */ c(
|
|
117
|
-
|
|
118
|
+
q,
|
|
118
119
|
{
|
|
119
120
|
badgeConfig: n.badge,
|
|
120
121
|
rowData: r,
|
|
@@ -130,19 +131,19 @@ const M = (e, t, r, a) => {
|
|
|
130
131
|
}
|
|
131
132
|
}), u.length > 0 ? u : null;
|
|
132
133
|
}, [v, r, y, d]);
|
|
133
|
-
return /* @__PURE__ */
|
|
134
|
+
return /* @__PURE__ */ w("div", { className: "w-full h-full flex items-center justify-between gap-2 group ag-cell-inner-padding", children: [
|
|
134
135
|
/* @__PURE__ */ c(
|
|
135
136
|
"div",
|
|
136
137
|
{
|
|
137
|
-
className: `flex-1 truncate ${
|
|
138
|
-
onClick:
|
|
139
|
-
children:
|
|
138
|
+
className: `flex-1 truncate min-w-0 ${F ? "text-blue-600 cursor-pointer hover:underline font-medium" : ""}`,
|
|
139
|
+
onClick: F ? C : void 0,
|
|
140
|
+
children: N
|
|
140
141
|
}
|
|
141
142
|
),
|
|
142
|
-
|
|
143
|
+
P && /* @__PURE__ */ c("div", { className: "flex items-center gap-1 flex-shrink-0", children: P })
|
|
143
144
|
] });
|
|
144
145
|
};
|
|
145
|
-
|
|
146
|
+
A.displayName = "LinkCellRenderer";
|
|
146
147
|
export {
|
|
147
|
-
|
|
148
|
+
A as LinkCellRenderer
|
|
148
149
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ICellRendererParams, ColDef, GridApi, Column } from 'ag-grid-enterprise';
|
|
3
|
-
import { SplitConfig, SubCellComponentProps } from './types';
|
|
3
|
+
import { SplitConfig, SubCellComponentProps, ValueFormatter, SplitCellValue } from './types';
|
|
4
4
|
export interface CommonParams {
|
|
5
5
|
cellRenderer?: string | React.ComponentType<SubCellComponentProps>;
|
|
6
6
|
cellEditor?: string | React.ComponentType<SubCellComponentProps>;
|
|
@@ -21,12 +21,10 @@ export interface SplitCellRendererProps extends ICellRendererParams {
|
|
|
21
21
|
context: {
|
|
22
22
|
frameworkComponents?: Record<string, React.ComponentType<SubCellComponentProps>>;
|
|
23
23
|
};
|
|
24
|
+
/** Column-level value formatter (lowest priority: cell > row > split > column) */
|
|
25
|
+
valueFormatter?: ValueFormatter;
|
|
24
26
|
}
|
|
25
|
-
export
|
|
26
|
-
[key: string]: {
|
|
27
|
-
value: unknown;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
27
|
+
export type SplitCellRendererValue = SplitCellValue;
|
|
30
28
|
export declare const SplitCellRenderer: {
|
|
31
29
|
(props: SplitCellRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
32
30
|
displayName: string;
|
|
@@ -1,50 +1,36 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
switch (r?.decimals != null && !isNaN(Number(e)) && (t = Number(e).toFixed(r.decimals)), r.type) {
|
|
10
|
-
case "currencySymbol": {
|
|
11
|
-
const l = r.symbol ?? "$";
|
|
12
|
-
return r.position === "suffix" ? `${t} ${l}` : `${l} ${t}`;
|
|
13
|
-
}
|
|
14
|
-
case "percentage":
|
|
15
|
-
return `${t} %`;
|
|
16
|
-
case "number":
|
|
17
|
-
return t;
|
|
18
|
-
default:
|
|
19
|
-
return t;
|
|
20
|
-
}
|
|
21
|
-
}, h = (r) => {
|
|
22
|
-
const e = r;
|
|
3
|
+
import { resolveCellEditable as V, resolveValueFormatter as x, applyValueFormatter as N } from "./cell-renderer-utils.js";
|
|
4
|
+
const E = (v) => {
|
|
5
|
+
const { splits: l, commonParams: n, data: i, node: g, api: c, column: b, context: d, value: h, colDef: s, valueFormatter: y } = v;
|
|
6
|
+
if (!l || !Array.isArray(l)) return null;
|
|
7
|
+
const w = (t) => {
|
|
8
|
+
const e = t;
|
|
23
9
|
if (typeof e == "string") {
|
|
24
|
-
const
|
|
25
|
-
return
|
|
10
|
+
const a = c?.getGridOption("components");
|
|
11
|
+
return d?.frameworkComponents?.[e] || a?.[e];
|
|
26
12
|
}
|
|
27
13
|
return e;
|
|
28
14
|
};
|
|
29
|
-
return /* @__PURE__ */ o("div", { style: { display: "grid", gridTemplateRows: `repeat(${
|
|
30
|
-
const
|
|
15
|
+
return /* @__PURE__ */ o("div", { style: { display: "grid", gridTemplateRows: `repeat(${l?.length}, 1fr)`, height: "100%", width: "100%" }, children: l?.map((t, e) => {
|
|
16
|
+
const a = t?.field?.split(".")?.pop(), r = h?.[a], m = r?.value?.toString(), p = i, C = typeof s?.editable == "boolean" ? s.editable : void 0, F = V(C, t.editable, p, r), u = x(r, p, t?.valueFormatter, y ?? null), R = u ? N(u, m) : m, f = n?.cellRenderer && typeof n?.cellRenderer == "string" ? w(n?.cellRenderer) : void 0;
|
|
31
17
|
return /* @__PURE__ */ o(
|
|
32
18
|
"div",
|
|
33
19
|
{
|
|
34
20
|
className: "flex items-center overflow-hidden",
|
|
35
21
|
"data-split-index": e,
|
|
36
|
-
children:
|
|
37
|
-
|
|
22
|
+
children: f ? /* @__PURE__ */ o(
|
|
23
|
+
f,
|
|
38
24
|
{
|
|
39
|
-
node:
|
|
25
|
+
node: g,
|
|
40
26
|
api: c,
|
|
41
|
-
column:
|
|
42
|
-
context:
|
|
43
|
-
data:
|
|
44
|
-
value:
|
|
45
|
-
colDef:
|
|
46
|
-
valueFormatted:
|
|
47
|
-
className: e !==
|
|
27
|
+
column: b,
|
|
28
|
+
context: d,
|
|
29
|
+
data: i,
|
|
30
|
+
value: r,
|
|
31
|
+
colDef: { ...t, editable: F },
|
|
32
|
+
valueFormatted: R,
|
|
33
|
+
className: e !== l.length - 1 ? "border-b border-gray-200" : ""
|
|
48
34
|
}
|
|
49
35
|
) : /* @__PURE__ */ o(
|
|
50
36
|
"div",
|
|
@@ -54,11 +40,11 @@ const w = (m) => {
|
|
|
54
40
|
}
|
|
55
41
|
)
|
|
56
42
|
},
|
|
57
|
-
`${
|
|
43
|
+
`${t.field}-${e}`
|
|
58
44
|
);
|
|
59
45
|
}) });
|
|
60
46
|
};
|
|
61
|
-
|
|
47
|
+
E.displayName = "SplitCellRenderer";
|
|
62
48
|
export {
|
|
63
|
-
|
|
49
|
+
E as SplitCellRenderer
|
|
64
50
|
};
|
|
@@ -5,19 +5,6 @@ import { IRowNode, ColDef, GridApi, Column } from 'ag-grid-community';
|
|
|
5
5
|
*/
|
|
6
6
|
export type BadgeVariant = 'solid' | 'outline' | 'subtle';
|
|
7
7
|
export type BadgeColor = 'primary' | 'success' | 'warning' | 'destructive' | 'neutral';
|
|
8
|
-
/**
|
|
9
|
-
* Maps legacy variant names (from backend/config) to impact-nova Badge variants.
|
|
10
|
-
*/
|
|
11
|
-
export declare const mapBadgeVariant: (v: string | undefined) => BadgeVariant;
|
|
12
|
-
/**
|
|
13
|
-
* Maps legacy color names (from backend/config) to impact-nova Badge colors.
|
|
14
|
-
*/
|
|
15
|
-
export declare const mapBadgeColor: (c: string | undefined) => BadgeColor;
|
|
16
|
-
/**
|
|
17
|
-
* Resolves a value from either a static prop or a field in row data.
|
|
18
|
-
* Used by renderers that support both static and dynamic (field-driven) configuration.
|
|
19
|
-
*/
|
|
20
|
-
export declare const getFieldValue: <T>(fieldName: string | undefined, staticValue: T | undefined, rowData: Record<string, unknown> | null | undefined) => T | undefined;
|
|
21
8
|
/**
|
|
22
9
|
* Validation condition for dynamic behavior
|
|
23
10
|
*/
|
|
@@ -35,10 +22,6 @@ export interface ValidationRules {
|
|
|
35
22
|
conditions: ValidationCondition[];
|
|
36
23
|
};
|
|
37
24
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Evaluates validation rules against row data
|
|
40
|
-
*/
|
|
41
|
-
export declare const evaluateValidationRules: (rules: ValidationRules | undefined, rowData: Record<string, unknown> | null | undefined) => boolean;
|
|
42
25
|
export interface SelectOption {
|
|
43
26
|
label: string;
|
|
44
27
|
value: string;
|
|
@@ -121,5 +104,38 @@ export interface SplitConfig {
|
|
|
121
104
|
field: string;
|
|
122
105
|
headerName?: string;
|
|
123
106
|
editable?: boolean;
|
|
107
|
+
cellDataType?: string;
|
|
108
|
+
valueFormatter?: ValueFormatter;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Metadata attached to an individual cell value.
|
|
112
|
+
* e.g. `{ _isDisabled: true }`
|
|
113
|
+
*/
|
|
114
|
+
export interface CellMetadata {
|
|
115
|
+
_isDisabled?: boolean;
|
|
124
116
|
valueFormatter?: ValueFormatter;
|
|
125
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Metadata attached to a row.
|
|
120
|
+
* e.g. `{ _isDisabled: false, start_date: "2025-01-06", end_date: "2025-01-26", kpi: "markdown_value" }`
|
|
121
|
+
*/
|
|
122
|
+
export interface RowMetadata {
|
|
123
|
+
_isDisabled?: boolean;
|
|
124
|
+
valueFormatter?: ValueFormatter;
|
|
125
|
+
[key: string]: unknown;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Shape of an individual version value within a split cell.
|
|
129
|
+
* e.g. `{ value: 1500, cellMetadata: { _isDisabled: true } }`
|
|
130
|
+
*/
|
|
131
|
+
export interface SplitCellValueEntry {
|
|
132
|
+
value: unknown;
|
|
133
|
+
cellMetadata?: CellMetadata;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Shape of the entire split cell value object.
|
|
137
|
+
* Keys are version identifiers (e.g. "wp", "iaf").
|
|
138
|
+
*/
|
|
139
|
+
export interface SplitCellValue {
|
|
140
|
+
[versionKey: string]: SplitCellValueEntry;
|
|
141
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ColDef, ColGroupDef } from 'ag-grid-community';
|
|
2
|
+
/**
|
|
3
|
+
* Recursively overrides `editable` on leaf columns to be a function
|
|
4
|
+
* that enforces the **4-level editable priority**: column < split < row < cell.
|
|
5
|
+
*
|
|
6
|
+
* This function acts as the AG Grid "gatekeeper" — it determines whether
|
|
7
|
+
* the cell editor should open at all. The `SplitCellEditor` then handles
|
|
8
|
+
* per-sub-cell editability internally using `resolveCellEditable`.
|
|
9
|
+
*
|
|
10
|
+
* ### 4-Level priority (highest wins):
|
|
11
|
+
* 1. **Column** (`colDef.editable`) — baseline for the whole column.
|
|
12
|
+
* 2. **Split** (`split.editable`) — per sub-cell in split columns.
|
|
13
|
+
* 3. **Row** (`rowData.rowMetadata._isDisabled`) — disables all cells in the row.
|
|
14
|
+
* 4. **Cell** (`cellValue.cellMetadata._isDisabled`) — per-cell override (highest priority).
|
|
15
|
+
*
|
|
16
|
+
* ### Usage
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { addRowDataEditableCheck } from 'impact-nova';
|
|
19
|
+
*
|
|
20
|
+
* const processedColDefs = addRowDataEditableCheck(rawColDefs);
|
|
21
|
+
* // Pass processedColDefs to <AgGridWrapper columnDefs={processedColDefs} />
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param colDefs - Array of AG Grid column definitions (may contain groups).
|
|
25
|
+
* @returns A new array with `editable` overridden as runtime functions.
|
|
26
|
+
*/
|
|
27
|
+
export declare function addRowDataEditableCheck(colDefs: (ColDef | ColGroupDef)[]): (ColDef | ColGroupDef)[];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { resolveCellEditable as d } from "./cell-renderers/cell-renderer-utils.js";
|
|
2
|
+
const y = (o, l) => {
|
|
3
|
+
if (l in o) return o[l];
|
|
4
|
+
if (l.includes(".")) {
|
|
5
|
+
const e = l.split(".");
|
|
6
|
+
let t = o;
|
|
7
|
+
for (const n of e)
|
|
8
|
+
if (t != null && typeof t == "object")
|
|
9
|
+
t = t[n];
|
|
10
|
+
else
|
|
11
|
+
return;
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
}, h = (o) => {
|
|
15
|
+
const l = o.colDef.field;
|
|
16
|
+
if (!l) return !1;
|
|
17
|
+
let e = o.data, t = l;
|
|
18
|
+
if (!(l in e) && l.includes(".")) {
|
|
19
|
+
const r = l.split(".");
|
|
20
|
+
t = r[r.length - 1];
|
|
21
|
+
for (let i = 0; i < r.length - 1; i++) {
|
|
22
|
+
const s = e[r[i]];
|
|
23
|
+
if (s != null && typeof s == "object")
|
|
24
|
+
e = s;
|
|
25
|
+
else
|
|
26
|
+
return !1;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const n = e[t], u = o.newValue;
|
|
30
|
+
return n && typeof n == "object" && "cellMetadata" in n ? e[t] = u && typeof u == "object" && "value" in u ? u : { ...n, value: u } : e[t] = u, !0;
|
|
31
|
+
};
|
|
32
|
+
function j(o) {
|
|
33
|
+
return o.map((l) => {
|
|
34
|
+
const e = { ...l };
|
|
35
|
+
if (e.children?.length)
|
|
36
|
+
return e.children = j(e.children), e;
|
|
37
|
+
const t = e.field;
|
|
38
|
+
if (!t) return e;
|
|
39
|
+
const n = e.cellEditorParams?.splits, u = n?.some((i) => i.editable === !0) ?? !1, r = typeof e.editable == "boolean" ? e.editable : void 0;
|
|
40
|
+
return e._originalEditable = r, n || (e.valueSetter = h), e.editable = (i) => {
|
|
41
|
+
if (i.node?.group === !0 || i.data?.group === !0)
|
|
42
|
+
return !1;
|
|
43
|
+
const s = i.data;
|
|
44
|
+
if (!s) return u || !!r;
|
|
45
|
+
const c = y(s, t);
|
|
46
|
+
if (n) {
|
|
47
|
+
const p = c != null && typeof c == "object" ? c : null;
|
|
48
|
+
return n.some((a) => {
|
|
49
|
+
const f = a.field?.split(".")?.pop();
|
|
50
|
+
if (!f) return !1;
|
|
51
|
+
const v = p?.[f];
|
|
52
|
+
return d(r, a.editable, s, v);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const b = c != null && typeof c == "object" && "value" in c ? c : void 0;
|
|
56
|
+
return d(r, void 0, s, b);
|
|
57
|
+
}, e;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
j as addRowDataEditableCheck
|
|
62
|
+
};
|