impact-nova 1.7.21 → 1.7.23
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/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +143 -112
- package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.js +93 -95
- package/dist/components/ui/nested-list/nested-list.js +204 -190
- package/dist/i18n/defaultMessages.d.ts +1 -0
- package/dist/i18n/defaultMessages.js +6 -5
- package/dist/i18n/locales/de.js +2 -1
- package/dist/i18n/locales/es.js +2 -1
- package/dist/i18n/locales/hi.js +2 -1
- package/dist/i18n/locales/kn.js +2 -1
- package/dist/impact-nova.css +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/package.json +1 -1
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsxs as f, jsx as
|
|
1
|
+
import { jsxs as f, jsx as o, Fragment as W } from "react/jsx-runtime";
|
|
2
2
|
import { useState as R } from "react";
|
|
3
|
-
import { Dialog as
|
|
4
|
-
import { Button as
|
|
5
|
-
import {
|
|
6
|
-
import { Cross as
|
|
7
|
-
import { ColumnFilterSection as
|
|
8
|
-
import { createEmptyRule as
|
|
9
|
-
import { useImpactNovaI18n as
|
|
10
|
-
const
|
|
11
|
-
const
|
|
3
|
+
import { Dialog as X, DialogContent as Y, DialogHeader as Z, DialogTitle as _, DialogClose as I, DialogBody as ee, DialogFooter as te } from "../../../dialog.js";
|
|
4
|
+
import { Button as v } from "../../../button.js";
|
|
5
|
+
import { Tooltip as le, TooltipTrigger as ne, TooltipContent as oe } from "../../../tooltip.js";
|
|
6
|
+
import { Cross as re } from "../../../../../icons/index.js";
|
|
7
|
+
import { ColumnFilterSection as B } from "./column-filter-section.js";
|
|
8
|
+
import { createEmptyRule as w } from "../utils/filter-utils.js";
|
|
9
|
+
import { useImpactNovaI18n as ae } from "../../../../../i18n/ImpactNovaI18nContext.js";
|
|
10
|
+
const j = (S) => {
|
|
11
|
+
const d = {};
|
|
12
12
|
return S.forEach((m) => {
|
|
13
|
-
m.columnId && (
|
|
14
|
-
}),
|
|
15
|
-
},
|
|
13
|
+
m.columnId && (d[m.columnId] || (d[m.columnId] = []), d[m.columnId].push(m));
|
|
14
|
+
}), d;
|
|
15
|
+
}, be = ({
|
|
16
16
|
isOpen: S,
|
|
17
|
-
onClose:
|
|
17
|
+
onClose: d,
|
|
18
18
|
onApply: m,
|
|
19
|
-
columnId:
|
|
20
|
-
columnLabel:
|
|
21
|
-
columnType:
|
|
19
|
+
columnId: a,
|
|
20
|
+
columnLabel: J,
|
|
21
|
+
columnType: C,
|
|
22
22
|
selectOptions: A,
|
|
23
|
-
isMultiSelect:
|
|
24
|
-
initialModel:
|
|
25
|
-
api:
|
|
23
|
+
isMultiSelect: G,
|
|
24
|
+
initialModel: E,
|
|
25
|
+
api: p
|
|
26
26
|
// Add api to props
|
|
27
27
|
}) => {
|
|
28
|
-
const { t:
|
|
29
|
-
const e = {}, n =
|
|
30
|
-
return Object.keys(t).forEach((
|
|
31
|
-
e[
|
|
32
|
-
}), e[
|
|
33
|
-
}), [g,
|
|
34
|
-
const e =
|
|
35
|
-
if (
|
|
36
|
-
const t =
|
|
28
|
+
const { t: u } = ae(), z = () => (E?.rules || []).filter((e) => !("logic" in e)), [h, q] = R("column"), [x, O] = R(() => {
|
|
29
|
+
const e = {}, n = z(), t = j(n);
|
|
30
|
+
return Object.keys(t).forEach((s) => {
|
|
31
|
+
e[s] = E?.logic || "OR";
|
|
32
|
+
}), e[a] || (e[a] = "OR"), e;
|
|
33
|
+
}), [g, T] = R(() => {
|
|
34
|
+
const e = z();
|
|
35
|
+
if (p) {
|
|
36
|
+
const t = p.getFilterModel();
|
|
37
37
|
t && Object.keys(t).forEach((i) => {
|
|
38
38
|
if (!e.some((l) => l.columnId === i)) {
|
|
39
39
|
const l = t[i];
|
|
40
|
-
let
|
|
40
|
+
let r = null;
|
|
41
41
|
if (l.filterType === "text")
|
|
42
|
-
|
|
42
|
+
r = {
|
|
43
43
|
id: Math.random().toString(36).substr(2, 9),
|
|
44
44
|
columnId: i,
|
|
45
45
|
columnType: "text",
|
|
@@ -47,7 +47,7 @@ const B = (S) => {
|
|
|
47
47
|
value: l.filter
|
|
48
48
|
};
|
|
49
49
|
else if (l.filterType === "number")
|
|
50
|
-
|
|
50
|
+
r = {
|
|
51
51
|
id: Math.random().toString(36).substr(2, 9),
|
|
52
52
|
columnId: i,
|
|
53
53
|
columnType: "number",
|
|
@@ -55,7 +55,7 @@ const B = (S) => {
|
|
|
55
55
|
value: String(l.filter)
|
|
56
56
|
};
|
|
57
57
|
else if (l.filterType === "set")
|
|
58
|
-
|
|
58
|
+
r = {
|
|
59
59
|
id: Math.random().toString(36).substr(2, 9),
|
|
60
60
|
columnId: i,
|
|
61
61
|
columnType: "select",
|
|
@@ -63,8 +63,8 @@ const B = (S) => {
|
|
|
63
63
|
value: l.values
|
|
64
64
|
};
|
|
65
65
|
else if (l.filterType === "multi") {
|
|
66
|
-
const c = l.filterModels?.find((
|
|
67
|
-
c && (
|
|
66
|
+
const c = l.filterModels?.find((N) => N && N.filterType === "set");
|
|
67
|
+
c && (r = {
|
|
68
68
|
id: Math.random().toString(36).substr(2, 9),
|
|
69
69
|
columnId: i,
|
|
70
70
|
columnType: "multi",
|
|
@@ -73,33 +73,33 @@ const B = (S) => {
|
|
|
73
73
|
value: c.values
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
r && e.push(r);
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
return e.some((t) => t.columnId ===
|
|
81
|
-
}), [
|
|
80
|
+
return e.some((t) => t.columnId === a) || e.push(w(a, C)), e;
|
|
81
|
+
}), [F] = R(() => ({
|
|
82
82
|
allRules: g,
|
|
83
83
|
// Use the computed rules (potentially synced)
|
|
84
84
|
columnLogic: { ...x }
|
|
85
|
-
})),
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
t.forEach((
|
|
89
|
-
|
|
90
|
-
}),
|
|
85
|
+
})), H = JSON.stringify({ allRules: g, columnLogic: x }) !== JSON.stringify(F), $ = (e) => g.filter((n) => n.columnId === e), D = (e, n) => {
|
|
86
|
+
T((t) => {
|
|
87
|
+
const s = /* @__PURE__ */ new Set(), i = [];
|
|
88
|
+
t.forEach((r) => {
|
|
89
|
+
s.has(r.columnId) || (s.add(r.columnId), i.push(r.columnId));
|
|
90
|
+
}), s.has(e) || i.push(e);
|
|
91
91
|
const l = [];
|
|
92
|
-
return i.forEach((
|
|
93
|
-
|
|
92
|
+
return i.forEach((r) => {
|
|
93
|
+
r === e ? l.push(...n) : l.push(...t.filter((c) => c.columnId === r));
|
|
94
94
|
}), l;
|
|
95
95
|
});
|
|
96
96
|
}, L = (e) => x[e] || "OR", M = (e, n) => {
|
|
97
97
|
O((t) => ({ ...t, [e]: n }));
|
|
98
|
-
}, H = () => {
|
|
99
|
-
y === "column" ? (F(s, [N(s, v)]), M(s, "OR")) : (w([N(s, v)]), O({ [s]: "OR" }));
|
|
100
|
-
}, V = () => {
|
|
101
|
-
w(b.allRules.length > 0 ? b.allRules : [N(s, v)]), O(b.columnLogic);
|
|
102
98
|
}, K = () => {
|
|
99
|
+
h === "column" ? (D(a, [w(a, C)]), M(a, "OR")) : (T([w(a, C)]), O({ [a]: "OR" }));
|
|
100
|
+
}, Q = () => {
|
|
101
|
+
T(F.allRules.length > 0 ? F.allRules : [w(a, C)]), O(F.columnLogic);
|
|
102
|
+
}, U = () => {
|
|
103
103
|
const e = g.filter((n) => n.operator === "empty" || n.operator === "notEmpty" ? !!n.columnId : n.columnId && n.value !== "" && n.value !== null);
|
|
104
104
|
if (e.length === 0)
|
|
105
105
|
m(null);
|
|
@@ -107,110 +107,141 @@ const B = (S) => {
|
|
|
107
107
|
const n = e[0].columnId;
|
|
108
108
|
m({ logic: L(n), rules: e });
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
d();
|
|
111
|
+
}, V = j(g), k = Object.keys(V), y = Object.keys(j(
|
|
112
|
+
g.filter((e) => e.operator === "empty" || e.operator === "notEmpty" ? !!e.columnId : e.columnId && e.value !== "" && e.value !== null)
|
|
113
|
+
)).length <= 1, P = (e, n) => {
|
|
114
|
+
if (!p) return n;
|
|
115
|
+
const t = p.getColumn(e);
|
|
114
116
|
if (!t) return n;
|
|
115
|
-
const
|
|
117
|
+
const s = t.getColDef(), i = [];
|
|
116
118
|
let l = t.getParent();
|
|
117
119
|
for (; l; ) {
|
|
118
120
|
const c = l.getColGroupDef();
|
|
119
121
|
c && c.headerName && i.unshift(c.headerName), l = l.getParent();
|
|
120
122
|
}
|
|
121
|
-
const
|
|
122
|
-
return i.push(
|
|
123
|
+
const r = s?.headerName || e;
|
|
124
|
+
return i.push(r), i.join(" > ");
|
|
123
125
|
};
|
|
124
|
-
return /* @__PURE__ */ f(
|
|
126
|
+
return /* @__PURE__ */ f(X, { open: S, onOpenChange: d, children: [
|
|
125
127
|
(console.log("[AdvancedFilterDialog] Current State:", {
|
|
126
|
-
mode:
|
|
128
|
+
mode: h,
|
|
127
129
|
allRules: g,
|
|
128
130
|
columnLogic: x,
|
|
129
|
-
activeColumns:
|
|
131
|
+
activeColumns: k
|
|
130
132
|
}), null),
|
|
131
|
-
/* @__PURE__ */ f(
|
|
132
|
-
/* @__PURE__ */ f(
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ f(Y, { className: "w-[800px] max-w-[95vw] max-h-[90vh] flex flex-col p-0", hideClose: !0, children: [
|
|
134
|
+
/* @__PURE__ */ f(Z, { className: "flex flex-row items-center justify-between px-4 py-3", children: [
|
|
135
|
+
/* @__PURE__ */ o(_, { children: u("advancedFilter.title") }),
|
|
136
|
+
/* @__PURE__ */ o(I, { asChild: !0, children: /* @__PURE__ */ o(v, { variant: "ghost", size: "icon", className: "h-8 w-8 p-0 text-content-tertiary hover:text-brand-variant-hover", onClick: d, "aria-label": u("aria.close"), children: /* @__PURE__ */ o(re, { size: 14 }) }) })
|
|
135
137
|
] }),
|
|
136
138
|
/* @__PURE__ */ f("div", { className: "flex items-center justify-between px-4 py-4 pb-2", children: [
|
|
137
|
-
/* @__PURE__ */ f(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
139
|
+
/* @__PURE__ */ f("div", { className: "inline-flex", role: "group", "data-component": "button-group", children: [
|
|
140
|
+
/* @__PURE__ */ o(
|
|
141
|
+
v,
|
|
142
|
+
{
|
|
143
|
+
value: "column",
|
|
144
|
+
size: "md",
|
|
145
|
+
variant: "ghost",
|
|
146
|
+
"aria-pressed": h === "column",
|
|
147
|
+
className: `!shadow-none relative border transition-colors min-w-14 !rounded-none !rounded-l-md z-[1] ${h === "column" ? "!bg-accent !border-brand !text-brand z-10" : "!bg-canvas-elevated !border-button-primary-disabled !text-[#60697d] hover:!bg-canvas-elevated hover:!text-brand"}`,
|
|
148
|
+
onClick: () => q("column"),
|
|
149
|
+
children: u("advancedFilter.currentColumn")
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
/* @__PURE__ */ f(le, { children: [
|
|
153
|
+
/* @__PURE__ */ o(ne, { asChild: !0, children: /* @__PURE__ */ o(
|
|
154
|
+
"span",
|
|
155
|
+
{
|
|
156
|
+
style: {
|
|
157
|
+
cursor: y ? "not-allowed" : "default",
|
|
158
|
+
display: "inline-flex"
|
|
159
|
+
},
|
|
160
|
+
children: /* @__PURE__ */ o(
|
|
161
|
+
v,
|
|
162
|
+
{
|
|
163
|
+
value: "global",
|
|
164
|
+
size: "md",
|
|
165
|
+
variant: "ghost",
|
|
166
|
+
"aria-pressed": h === "global",
|
|
167
|
+
disabled: y,
|
|
168
|
+
style: y ? { pointerEvents: "none" } : void 0,
|
|
169
|
+
className: `!shadow-none relative border transition-colors min-w-14 !rounded-none !rounded-r-md -ml-px ${y ? "!bg-disabled-surface !border-disabled-border !text-disabled-foreground opacity-100" : h === "global" ? "!bg-accent !border-brand !text-brand z-10" : "!bg-canvas-elevated !border-button-primary-disabled !text-[#60697d] hover:!bg-canvas-elevated hover:!text-brand z-[1]"}`,
|
|
170
|
+
onClick: () => q("global"),
|
|
171
|
+
children: u("advancedFilter.allFilters")
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
) }),
|
|
176
|
+
y && /* @__PURE__ */ o(oe, { variant: "tertiary", children: u("advancedFilter.allFiltersDisabledTooltip") })
|
|
177
|
+
] })
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ o(v, { variant: "ghost", onClick: K, className: "!text-brand", children: u("advancedFilter.clearAll") })
|
|
149
180
|
] }),
|
|
150
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ o(ee, { className: "px-0 py-4 flex-1 overflow-y-auto min-h-0", children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-6 w-full px-4", children: h === "column" ? (
|
|
151
182
|
// Column Mode: Single column section
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
|
|
183
|
+
/* @__PURE__ */ o(
|
|
184
|
+
B,
|
|
154
185
|
{
|
|
155
|
-
columnId:
|
|
156
|
-
columnLabel:
|
|
157
|
-
columnType:
|
|
186
|
+
columnId: a,
|
|
187
|
+
columnLabel: P(a, J),
|
|
188
|
+
columnType: C,
|
|
158
189
|
selectOptions: A,
|
|
159
|
-
isMultiSelect: A ?
|
|
160
|
-
rules:
|
|
161
|
-
logic: L(
|
|
162
|
-
onLogicChange: (e) => M(
|
|
163
|
-
onRulesChange: (e) =>
|
|
190
|
+
isMultiSelect: A ? !!G : !0,
|
|
191
|
+
rules: $(a),
|
|
192
|
+
logic: L(a),
|
|
193
|
+
onLogicChange: (e) => M(a, e),
|
|
194
|
+
onRulesChange: (e) => D(a, e)
|
|
164
195
|
}
|
|
165
196
|
)
|
|
166
197
|
) : (
|
|
167
198
|
// Global Mode: All columns with filters
|
|
168
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ o(W, { children: k.length === 0 ? /* @__PURE__ */ o("div", { className: "text-center py-8 text-content-placeholder", children: u("advancedFilter.noFiltersApplied") }) : k.map((e, n) => {
|
|
169
200
|
let t = null;
|
|
170
|
-
if (
|
|
171
|
-
const
|
|
172
|
-
|
|
201
|
+
if (p) {
|
|
202
|
+
const b = p.getColumn(e);
|
|
203
|
+
b && (t = b.getColDef());
|
|
173
204
|
}
|
|
174
|
-
const
|
|
175
|
-
console.log(`[AdvancedFilterDialog] Column: ${e}, Type: ${
|
|
176
|
-
const c =
|
|
205
|
+
const s = t?.headerComponentParams, i = t?.headerName || e, l = P(e, i), r = t?.filter === "agNumberColumnFilter" ? "number" : t?.filter === "agDateColumnFilter" ? "date" : t?.filter === "agMultiColumnFilter" ? "multi" : t?.filter === "agSetColumnFilter" || s?.selectOptions ? "select" : "text";
|
|
206
|
+
console.log(`[AdvancedFilterDialog] Column: ${e}, Type: ${r}, Filter: ${t?.filter}`);
|
|
207
|
+
const c = s?.selectOptions, N = s?.isMultiSelect;
|
|
177
208
|
return /* @__PURE__ */ f("div", { children: [
|
|
178
|
-
n > 0 && /* @__PURE__ */
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
|
|
209
|
+
n > 0 && /* @__PURE__ */ o("hr", { className: "border-stroke-hairline mb-6" }),
|
|
210
|
+
/* @__PURE__ */ o(
|
|
211
|
+
B,
|
|
181
212
|
{
|
|
182
213
|
columnId: e,
|
|
183
214
|
columnLabel: l,
|
|
184
|
-
columnType:
|
|
215
|
+
columnType: r,
|
|
185
216
|
selectOptions: c,
|
|
186
|
-
isMultiSelect:
|
|
187
|
-
rules:
|
|
217
|
+
isMultiSelect: N,
|
|
218
|
+
rules: $(e),
|
|
188
219
|
logic: L(e),
|
|
189
|
-
onLogicChange: (
|
|
190
|
-
onRulesChange: (
|
|
220
|
+
onLogicChange: (b) => M(e, b),
|
|
221
|
+
onRulesChange: (b) => D(e, b),
|
|
191
222
|
canDeleteLastRule: !0,
|
|
192
|
-
onDeleteColumnFilter: () =>
|
|
223
|
+
onDeleteColumnFilter: () => D(e, [])
|
|
193
224
|
}
|
|
194
225
|
)
|
|
195
226
|
] }, e);
|
|
196
227
|
}) })
|
|
197
228
|
) }) }),
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
|
|
229
|
+
/* @__PURE__ */ o(te, { className: "flex justify-end border-t border-[#D9DDE7]", children: /* @__PURE__ */ f("div", { className: "flex gap-3", children: [
|
|
230
|
+
/* @__PURE__ */ o(
|
|
231
|
+
v,
|
|
201
232
|
{
|
|
202
|
-
onClick:
|
|
233
|
+
onClick: Q,
|
|
203
234
|
variant: "secondary",
|
|
204
|
-
disabled: !
|
|
205
|
-
children:
|
|
235
|
+
disabled: !H,
|
|
236
|
+
children: u("advancedFilter.discard")
|
|
206
237
|
}
|
|
207
238
|
),
|
|
208
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ o(v, { onClick: U, variant: "default", children: u("advancedFilter.apply") })
|
|
209
240
|
] }) })
|
|
210
241
|
] })
|
|
211
242
|
] });
|
|
212
243
|
};
|
|
213
244
|
export {
|
|
214
|
-
|
|
215
|
-
|
|
245
|
+
be as AdvancedFilterDialog,
|
|
246
|
+
be as default
|
|
216
247
|
};
|