impact-nova 1.2.4 → 1.5.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 +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.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/ui/alert.js +76 -60
- package/dist/components/ui/breadcrumb.js +81 -74
- package/dist/components/ui/calendar.js +355 -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 -85
- package/dist/components/ui/select/select.js +225 -229
- 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/tabs.d.ts +11 -1
- package/dist/components/ui/tabs.js +79 -54
- 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/assets/webp/delete-3d.webp.js +4 -0
- package/dist/icons/assets/webp/info-3d.webp.js +4 -0
- package/dist/icons/assets/webp/success-3d.webp.js +4 -0
- package/dist/icons/assets/webp/warning-3d.webp.js +4 -0
- package/dist/icons/index.d.ts +8 -0
- package/dist/icons/index.js +197 -181
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +260 -199
- package/package.json +36 -4
- package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
|
@@ -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
|
+
};
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { jsxs as f, jsx as r, Fragment as
|
|
1
|
+
import { jsxs as f, jsx as r, Fragment as U } from "react/jsx-runtime";
|
|
2
2
|
import { useState as R } from "react";
|
|
3
|
-
import { Dialog as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { ButtonGroup as
|
|
6
|
-
import { Cross as
|
|
7
|
-
import { ColumnFilterSection as
|
|
8
|
-
import { createEmptyRule as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
import { Dialog as W, DialogContent as X, DialogHeader as Y, DialogTitle as Z, DialogClose as _, DialogBody as I, DialogFooter as ee } from "../../../dialog.js";
|
|
4
|
+
import { Button as C } from "../../../button.js";
|
|
5
|
+
import { ButtonGroup as te } from "../../../button-group.js";
|
|
6
|
+
import { Cross as le } from "../../../../../icons/index.js";
|
|
7
|
+
import { ColumnFilterSection as z } from "./column-filter-section.js";
|
|
8
|
+
import { createEmptyRule as N } from "../utils/filter-utils.js";
|
|
9
|
+
import { useImpactNovaI18n as ne } from "../../../../../i18n/ImpactNovaI18nContext.js";
|
|
10
|
+
const B = (S) => {
|
|
11
|
+
const u = {};
|
|
12
|
+
return S.forEach((m) => {
|
|
13
|
+
m.columnId && (u[m.columnId] || (u[m.columnId] = []), u[m.columnId].push(m));
|
|
14
|
+
}), u;
|
|
15
|
+
}, fe = ({
|
|
16
|
+
isOpen: S,
|
|
17
|
+
onClose: u,
|
|
17
18
|
onApply: m,
|
|
18
19
|
columnId: s,
|
|
19
|
-
columnLabel:
|
|
20
|
-
columnType:
|
|
21
|
-
selectOptions:
|
|
22
|
-
isMultiSelect:
|
|
23
|
-
initialModel:
|
|
24
|
-
api:
|
|
20
|
+
columnLabel: P,
|
|
21
|
+
columnType: v,
|
|
22
|
+
selectOptions: j,
|
|
23
|
+
isMultiSelect: $,
|
|
24
|
+
initialModel: T,
|
|
25
|
+
api: h
|
|
25
26
|
// Add api to props
|
|
26
27
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
const e = {}, n =
|
|
28
|
+
const { t: d } = ne(), k = () => (T?.rules || []).filter((e) => !("logic" in e)), [y, G] = R("column"), [F, O] = R(() => {
|
|
29
|
+
const e = {}, n = k(), t = B(n);
|
|
29
30
|
return Object.keys(t).forEach((a) => {
|
|
30
|
-
e[a] =
|
|
31
|
+
e[a] = T?.logic || "OR";
|
|
31
32
|
}), e[s] || (e[s] = "OR"), e;
|
|
32
|
-
}), [
|
|
33
|
-
const e =
|
|
34
|
-
if (
|
|
35
|
-
const t =
|
|
33
|
+
}), [g, L] = R(() => {
|
|
34
|
+
const e = k();
|
|
35
|
+
if (h) {
|
|
36
|
+
const t = h.getFilterModel();
|
|
36
37
|
t && Object.keys(t).forEach((i) => {
|
|
37
38
|
if (!e.some((l) => l.columnId === i)) {
|
|
38
39
|
const l = t[i];
|
|
@@ -62,162 +63,162 @@ const z = (N) => {
|
|
|
62
63
|
value: l.values
|
|
63
64
|
};
|
|
64
65
|
else if (l.filterType === "multi") {
|
|
65
|
-
const
|
|
66
|
-
|
|
66
|
+
const c = l.filterModels?.find((D) => D && D.filterType === "set");
|
|
67
|
+
c && (o = {
|
|
67
68
|
id: Math.random().toString(36).substr(2, 9),
|
|
68
69
|
columnId: i,
|
|
69
70
|
columnType: "multi",
|
|
70
71
|
// or select?
|
|
71
72
|
operator: "equals",
|
|
72
|
-
value:
|
|
73
|
+
value: c.values
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
o && e.push(o);
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
|
-
return e.some((t) => t.columnId === s) || e.push(
|
|
80
|
-
}), [
|
|
81
|
-
allRules:
|
|
80
|
+
return e.some((t) => t.columnId === s) || e.push(N(s, v)), e;
|
|
81
|
+
}), [x] = R(() => ({
|
|
82
|
+
allRules: g,
|
|
82
83
|
// Use the computed rules (potentially synced)
|
|
83
|
-
columnLogic: { ...
|
|
84
|
-
})),
|
|
85
|
-
|
|
84
|
+
columnLogic: { ...F }
|
|
85
|
+
})), J = JSON.stringify({ allRules: g, columnLogic: F }) !== JSON.stringify(x), E = (e) => g.filter((n) => n.columnId === e), b = (e, n) => {
|
|
86
|
+
L((t) => {
|
|
86
87
|
const a = /* @__PURE__ */ new Set(), i = [];
|
|
87
88
|
t.forEach((o) => {
|
|
88
89
|
a.has(o.columnId) || (a.add(o.columnId), i.push(o.columnId));
|
|
89
90
|
}), a.has(e) || i.push(e);
|
|
90
91
|
const l = [];
|
|
91
92
|
return i.forEach((o) => {
|
|
92
|
-
o === e ? l.push(...n) : l.push(...t.filter((
|
|
93
|
+
o === e ? l.push(...n) : l.push(...t.filter((c) => c.columnId === o));
|
|
93
94
|
}), l;
|
|
94
95
|
});
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
}, J = () => {
|
|
98
|
-
y === "column" ? (D(s, [F(s, C)]), M(s, "OR")) : (O([F(s, C)]), S({ [s]: "OR" }));
|
|
96
|
+
}, M = (e) => F[e] || "OR", w = (e, n) => {
|
|
97
|
+
O((t) => ({ ...t, [e]: n }));
|
|
99
98
|
}, H = () => {
|
|
100
|
-
|
|
99
|
+
y === "column" ? (b(s, [N(s, v)]), w(s, "OR")) : (L([N(s, v)]), O({ [s]: "OR" }));
|
|
101
100
|
}, V = () => {
|
|
102
|
-
|
|
101
|
+
L(x.allRules.length > 0 ? x.allRules : [N(s, v)]), O(x.columnLogic);
|
|
102
|
+
}, K = () => {
|
|
103
|
+
const e = g.filter((n) => n.operator === "empty" || n.operator === "notEmpty" ? !!n.columnId : n.columnId && n.value !== "" && n.value !== null);
|
|
103
104
|
if (e.length === 0)
|
|
104
105
|
m(null);
|
|
105
106
|
else {
|
|
106
107
|
const n = e[0].columnId;
|
|
107
|
-
m({ logic:
|
|
108
|
+
m({ logic: M(n), rules: e });
|
|
108
109
|
}
|
|
109
|
-
|
|
110
|
-
},
|
|
111
|
-
if (!
|
|
112
|
-
const t =
|
|
110
|
+
u();
|
|
111
|
+
}, Q = B(g), A = Object.keys(Q), q = (e, n) => {
|
|
112
|
+
if (!h) return n;
|
|
113
|
+
const t = h.getColumn(e);
|
|
113
114
|
if (!t) return n;
|
|
114
115
|
const a = t.getColDef(), i = [];
|
|
115
116
|
let l = t.getParent();
|
|
116
117
|
for (; l; ) {
|
|
117
|
-
const
|
|
118
|
-
|
|
118
|
+
const c = l.getColGroupDef();
|
|
119
|
+
c && c.headerName && i.unshift(c.headerName), l = l.getParent();
|
|
119
120
|
}
|
|
120
121
|
const o = a?.headerName || e;
|
|
121
122
|
return i.push(o), i.join(" > ");
|
|
122
123
|
};
|
|
123
|
-
return /* @__PURE__ */ f(
|
|
124
|
+
return /* @__PURE__ */ f(W, { open: S, onOpenChange: u, children: [
|
|
124
125
|
(console.log("[AdvancedFilterDialog] Current State:", {
|
|
125
126
|
mode: y,
|
|
126
|
-
allRules:
|
|
127
|
-
columnLogic:
|
|
128
|
-
activeColumns:
|
|
127
|
+
allRules: g,
|
|
128
|
+
columnLogic: F,
|
|
129
|
+
activeColumns: A
|
|
129
130
|
}), null),
|
|
130
|
-
/* @__PURE__ */ f(
|
|
131
|
-
/* @__PURE__ */ f(
|
|
132
|
-
/* @__PURE__ */ r(
|
|
131
|
+
/* @__PURE__ */ f(X, { className: "w-[550px] max-w-[95vw] p-0", hideClose: !0, children: [
|
|
132
|
+
/* @__PURE__ */ f(Y, { className: "flex flex-row items-center gap-4 px-4 py-2", children: [
|
|
133
|
+
/* @__PURE__ */ r(Z, { children: d("advancedFilter.title") }),
|
|
133
134
|
/* @__PURE__ */ r("div", { className: "flex-1 flex items-center justify-end", children: /* @__PURE__ */ f(
|
|
134
|
-
|
|
135
|
+
te,
|
|
135
136
|
{
|
|
136
137
|
className: "",
|
|
137
138
|
value: y,
|
|
138
|
-
onValueChange: (e) =>
|
|
139
|
+
onValueChange: (e) => G(e),
|
|
139
140
|
children: [
|
|
140
|
-
/* @__PURE__ */ r(
|
|
141
|
-
/* @__PURE__ */ r(
|
|
141
|
+
/* @__PURE__ */ r(C, { value: "column", size: "md", children: d("advancedFilter.currentColumn") }),
|
|
142
|
+
/* @__PURE__ */ r(C, { value: "global", size: "md", children: d("advancedFilter.allFilters") })
|
|
142
143
|
]
|
|
143
144
|
}
|
|
144
145
|
) }),
|
|
145
|
-
/* @__PURE__ */ r(
|
|
146
|
+
/* @__PURE__ */ r(_, { asChild: !0, children: /* @__PURE__ */ r(C, { variant: "ghost", size: "icon", className: "h-8 w-8 p-0 text-[#60697D] hover:text-[#3649C6]", onClick: u, "aria-label": d("aria.close"), children: /* @__PURE__ */ r(le, { size: 14 }) }) })
|
|
146
147
|
] }),
|
|
147
|
-
/* @__PURE__ */ r(
|
|
148
|
+
/* @__PURE__ */ r(I, { className: "px-0 py-4 min-h-[300px] max-h-[400px] overflow-y-auto", children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-6 w-full px-4", children: y === "column" ? (
|
|
148
149
|
// Column Mode: Single column section
|
|
149
150
|
/* @__PURE__ */ r(
|
|
150
|
-
|
|
151
|
+
z,
|
|
151
152
|
{
|
|
152
153
|
columnId: s,
|
|
153
|
-
columnLabel:
|
|
154
|
-
columnType:
|
|
155
|
-
selectOptions:
|
|
156
|
-
isMultiSelect:
|
|
157
|
-
rules:
|
|
158
|
-
logic:
|
|
159
|
-
onLogicChange: (e) =>
|
|
160
|
-
onRulesChange: (e) =>
|
|
154
|
+
columnLabel: q(s, P),
|
|
155
|
+
columnType: v,
|
|
156
|
+
selectOptions: j,
|
|
157
|
+
isMultiSelect: j ? !!$ : !0,
|
|
158
|
+
rules: E(s),
|
|
159
|
+
logic: M(s),
|
|
160
|
+
onLogicChange: (e) => w(s, e),
|
|
161
|
+
onRulesChange: (e) => b(s, e)
|
|
161
162
|
}
|
|
162
163
|
)
|
|
163
164
|
) : (
|
|
164
165
|
// Global Mode: All columns with filters
|
|
165
|
-
/* @__PURE__ */ r(
|
|
166
|
+
/* @__PURE__ */ r(U, { children: A.length === 0 ? /* @__PURE__ */ r("div", { className: "text-center py-8 text-slate-400", children: d("advancedFilter.noFiltersApplied") }) : A.map((e, n) => {
|
|
166
167
|
let t = null;
|
|
167
|
-
if (
|
|
168
|
-
const
|
|
169
|
-
|
|
168
|
+
if (h) {
|
|
169
|
+
const p = h.getColumn(e);
|
|
170
|
+
p && (t = p.getColDef());
|
|
170
171
|
}
|
|
171
|
-
const a = t?.headerComponentParams, i = t?.headerName || e, l =
|
|
172
|
+
const a = t?.headerComponentParams, i = t?.headerName || e, l = q(e, i), o = t?.filter === "agNumberColumnFilter" ? "number" : t?.filter === "agDateColumnFilter" ? "date" : t?.filter === "agMultiColumnFilter" ? "multi" : t?.filter === "agSetColumnFilter" || a?.selectOptions ? "select" : "text";
|
|
172
173
|
console.log(`[AdvancedFilterDialog] Column: ${e}, Type: ${o}, Filter: ${t?.filter}`);
|
|
173
|
-
const
|
|
174
|
+
const c = a?.selectOptions, D = a?.isMultiSelect;
|
|
174
175
|
return /* @__PURE__ */ f("div", { children: [
|
|
175
176
|
n > 0 && /* @__PURE__ */ r("hr", { className: "border-slate-200 mb-6" }),
|
|
176
177
|
/* @__PURE__ */ r(
|
|
177
|
-
|
|
178
|
+
z,
|
|
178
179
|
{
|
|
179
180
|
columnId: e,
|
|
180
181
|
columnLabel: l,
|
|
181
182
|
columnType: o,
|
|
182
|
-
selectOptions:
|
|
183
|
-
isMultiSelect:
|
|
184
|
-
rules:
|
|
185
|
-
logic:
|
|
186
|
-
onLogicChange: (
|
|
187
|
-
onRulesChange: (
|
|
183
|
+
selectOptions: c,
|
|
184
|
+
isMultiSelect: D,
|
|
185
|
+
rules: E(e),
|
|
186
|
+
logic: M(e),
|
|
187
|
+
onLogicChange: (p) => w(e, p),
|
|
188
|
+
onRulesChange: (p) => b(e, p),
|
|
188
189
|
canDeleteLastRule: !0,
|
|
189
|
-
onDeleteColumnFilter: () =>
|
|
190
|
+
onDeleteColumnFilter: () => b(e, [])
|
|
190
191
|
}
|
|
191
192
|
)
|
|
192
193
|
] }, e);
|
|
193
194
|
}) })
|
|
194
195
|
) }) }),
|
|
195
|
-
/* @__PURE__ */ f(
|
|
196
|
+
/* @__PURE__ */ f(ee, { className: "flex justify-between", children: [
|
|
196
197
|
/* @__PURE__ */ r(
|
|
197
|
-
|
|
198
|
+
C,
|
|
198
199
|
{
|
|
199
|
-
onClick:
|
|
200
|
+
onClick: H,
|
|
200
201
|
variant: "secondary",
|
|
201
|
-
children: "
|
|
202
|
+
children: d("advancedFilter.clearAll")
|
|
202
203
|
}
|
|
203
204
|
),
|
|
204
205
|
/* @__PURE__ */ f("div", { className: "flex gap-3", children: [
|
|
205
206
|
/* @__PURE__ */ r(
|
|
206
|
-
|
|
207
|
+
C,
|
|
207
208
|
{
|
|
208
|
-
onClick:
|
|
209
|
+
onClick: V,
|
|
209
210
|
variant: "outline",
|
|
210
|
-
disabled: !
|
|
211
|
-
children: "
|
|
211
|
+
disabled: !J,
|
|
212
|
+
children: d("advancedFilter.discard")
|
|
212
213
|
}
|
|
213
214
|
),
|
|
214
|
-
/* @__PURE__ */ r(
|
|
215
|
+
/* @__PURE__ */ r(C, { onClick: K, variant: "default", children: d("advancedFilter.apply") })
|
|
215
216
|
] })
|
|
216
217
|
] })
|
|
217
218
|
] })
|
|
218
219
|
] });
|
|
219
220
|
};
|
|
220
221
|
export {
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
fe as AdvancedFilterDialog,
|
|
223
|
+
fe as default
|
|
223
224
|
};
|