impact-nova 0.1.9 → 0.1.11
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/header-search-input.d.ts +1 -3
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +37 -39
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +1 -4
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +195 -199
- package/package.json +15 -5
|
@@ -18,8 +18,6 @@ export interface HeaderSearchInputProps {
|
|
|
18
18
|
onSelectSearchChange?: (value: string) => void;
|
|
19
19
|
onSelectOpen?: () => void;
|
|
20
20
|
isLoadingSelect?: boolean;
|
|
21
|
-
enableSpaceSplitting?: boolean;
|
|
22
|
-
enableBooleanParsing?: boolean;
|
|
23
21
|
}
|
|
24
22
|
/**
|
|
25
23
|
* HeaderSearchInput - A single instance input for column filtering.
|
|
@@ -27,5 +25,5 @@ export interface HeaderSearchInputProps {
|
|
|
27
25
|
* ZERO HOOKS SYNC: This component reads its state directly from AG Grid on mount.
|
|
28
26
|
* It does not use useEffect to sync with external state, as the Grid API is the source of truth.
|
|
29
27
|
*/
|
|
30
|
-
export declare const HeaderSearchInput: ({ column, api, onClose, handleInlineSearch, handleClearSearchInline, onAdvanceSearchClick, toggleAdvanceSearch, advanceSearchEnabled, selectOptions, isMultiSelect, onSelectScrollToBottom, onSelectSearchChange, onSelectOpen, isLoadingSelect,
|
|
28
|
+
export declare const HeaderSearchInput: ({ column, api, onClose, handleInlineSearch, handleClearSearchInline, onAdvanceSearchClick, toggleAdvanceSearch, advanceSearchEnabled, selectOptions, isMultiSelect, onSelectScrollToBottom, onSelectSearchChange, onSelectOpen, isLoadingSelect, }: HeaderSearchInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
29
|
export default HeaderSearchInput;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsxs as y, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Filter as
|
|
4
|
-
import { cn as
|
|
2
|
+
import { useRef as Ce, useState as I, useEffect as Te, useCallback as be } from "react";
|
|
3
|
+
import { Filter as De } from "lucide-react";
|
|
4
|
+
import { cn as Ne } from "../../../../lib/utils.js";
|
|
5
5
|
import { DatePicker as oe } from "../../date-picker/date-picker.js";
|
|
6
6
|
import { Input as ie } from "../../input.js";
|
|
7
7
|
import se from "../../select/select.js";
|
|
8
|
-
import { Popover as
|
|
8
|
+
import { Popover as Ae, PopoverTrigger as Se, PopoverContent as we, PopoverHeader as Ie, PopoverTitle as Pe, PopoverBody as qe } from "../../popover.js";
|
|
9
9
|
import { Cross as ae } from "../../../../icons/index.js";
|
|
10
|
-
import { useGridHeader as
|
|
11
|
-
import { getMultiFilterIndices as C, getDisplayStringFromFilterModel as P, parseInputPattern as
|
|
10
|
+
import { useGridHeader as ze } from "./context/grid-header-context.js";
|
|
11
|
+
import { getMultiFilterIndices as C, getDisplayStringFromFilterModel as P, parseInputPattern as Be } from "./utils/filter-utils.js";
|
|
12
12
|
import { deserializeDate as M, serializeDate as ce } from "./utils/date-utils.js";
|
|
13
|
-
const
|
|
13
|
+
const Ee = {
|
|
14
14
|
contains: "contains",
|
|
15
15
|
notContains: "notContains",
|
|
16
16
|
equals: "equals",
|
|
@@ -24,7 +24,7 @@ const ke = {
|
|
|
24
24
|
inRange: "inRange",
|
|
25
25
|
empty: "blank",
|
|
26
26
|
notEmpty: "notBlank"
|
|
27
|
-
},
|
|
27
|
+
}, Ue = ({
|
|
28
28
|
column: D,
|
|
29
29
|
api: d,
|
|
30
30
|
onClose: W,
|
|
@@ -38,11 +38,9 @@ const ke = {
|
|
|
38
38
|
onSelectScrollToBottom: fe,
|
|
39
39
|
onSelectSearchChange: ue,
|
|
40
40
|
onSelectOpen: V,
|
|
41
|
-
isLoadingSelect: J
|
|
42
|
-
enableSpaceSplitting: he = !1,
|
|
43
|
-
enableBooleanParsing: me = !1
|
|
41
|
+
isLoadingSelect: J
|
|
44
42
|
}) => {
|
|
45
|
-
const c = D.getColDef(), o = D.getColId(), z = c?.filter || "agTextColumnFilter", p = z === "agDateColumnFilter", B = z === "agSetColumnFilter" || q && q.length > 0 || c?.cellDataType === "boolean", K =
|
|
43
|
+
const c = D.getColDef(), o = D.getColId(), z = c?.filter || "agTextColumnFilter", p = z === "agDateColumnFilter", B = z === "agSetColumnFilter" || q && q.length > 0 || c?.cellDataType === "boolean", K = ze(), E = Ce(null), [H, k] = I(() => {
|
|
46
44
|
const t = d.getFilterModel()[o];
|
|
47
45
|
if (!t) return "";
|
|
48
46
|
if (t.filterType === "multi" && t.filterModels) {
|
|
@@ -54,7 +52,7 @@ const ke = {
|
|
|
54
52
|
return "";
|
|
55
53
|
}
|
|
56
54
|
return p ? "" : P(o, t);
|
|
57
|
-
}), [
|
|
55
|
+
}), [he, u] = I(!1), [Q, R] = I(() => {
|
|
58
56
|
const t = d.getFilterModel()[o];
|
|
59
57
|
if (t) {
|
|
60
58
|
if (t.filterType === "multi" && t.filterModels) {
|
|
@@ -74,7 +72,7 @@ const ke = {
|
|
|
74
72
|
}
|
|
75
73
|
return null;
|
|
76
74
|
});
|
|
77
|
-
|
|
75
|
+
Te(() => {
|
|
78
76
|
const e = () => {
|
|
79
77
|
const l = d.getFilterModel()[o];
|
|
80
78
|
let r = "";
|
|
@@ -86,7 +84,7 @@ const ke = {
|
|
|
86
84
|
r = f ? P(o, f) : "";
|
|
87
85
|
}
|
|
88
86
|
} else p || (r = P(o, l));
|
|
89
|
-
|
|
87
|
+
he || k((n) => n !== r ? r : n);
|
|
90
88
|
let m = null;
|
|
91
89
|
if (l)
|
|
92
90
|
if (l.filterType === "multi" && l.filterModels) {
|
|
@@ -104,14 +102,14 @@ const ke = {
|
|
|
104
102
|
}, [d, o, p]);
|
|
105
103
|
const U = (e, t) => {
|
|
106
104
|
const r = { ...d.getFilterModel() }, m = (n, a) => {
|
|
107
|
-
const f =
|
|
105
|
+
const f = Be(n);
|
|
108
106
|
if (console.log("[HeaderSearchInput] Pattern Debug:", {
|
|
109
107
|
input: n,
|
|
110
108
|
filterType: a,
|
|
111
109
|
parsed: f
|
|
112
110
|
}), f.conditions.length === 0) return null;
|
|
113
111
|
const b = (s) => {
|
|
114
|
-
let F =
|
|
112
|
+
let F = Ee[s.operator] || "contains";
|
|
115
113
|
if (a === "number") {
|
|
116
114
|
const ne = parseFloat(s.value);
|
|
117
115
|
return ["contains", "notContains", "startsWith", "endsWith"].includes(F) && (F = F === "notContains" ? "notEqual" : "equals"), s.operator === "inRange" ? {
|
|
@@ -183,11 +181,11 @@ const ke = {
|
|
|
183
181
|
k(t), O(t);
|
|
184
182
|
}, Y = (e) => {
|
|
185
183
|
R(e), O(e);
|
|
186
|
-
},
|
|
184
|
+
}, me = () => {
|
|
187
185
|
k(""), R(null), O(""), G && G();
|
|
188
186
|
}, A = (e) => {
|
|
189
187
|
U(e, "set");
|
|
190
|
-
}, S = q || (c?.cellDataType === "boolean" ? [{ label: "True", value: "true" }, { label: "False", value: "false" }] : []), Z =
|
|
188
|
+
}, S = q || (c?.cellDataType === "boolean" ? [{ label: "True", value: "true" }, { label: "False", value: "false" }] : []), Z = be(() => {
|
|
191
189
|
const e = d.getFilterModel()[o];
|
|
192
190
|
if (!e) return [];
|
|
193
191
|
if ("filterType" in e && e.filterType === "multi" && e.filterModels) {
|
|
@@ -213,9 +211,9 @@ const ke = {
|
|
|
213
211
|
return;
|
|
214
212
|
}
|
|
215
213
|
N(t);
|
|
216
|
-
},
|
|
214
|
+
}, pe = () => {
|
|
217
215
|
A([]), N([]);
|
|
218
|
-
},
|
|
216
|
+
}, ge = (e) => {
|
|
219
217
|
if (v) {
|
|
220
218
|
if (e !== void 0) {
|
|
221
219
|
let t = [];
|
|
@@ -224,14 +222,14 @@ const ke = {
|
|
|
224
222
|
}
|
|
225
223
|
w !== null && (A(w), N(null));
|
|
226
224
|
}
|
|
227
|
-
},
|
|
225
|
+
}, xe = () => {
|
|
228
226
|
N(Z()), V && V();
|
|
229
|
-
},
|
|
227
|
+
}, ye = () => de ? /* @__PURE__ */ i("svg", { className: "cursor-pointer text-[#7a8294] hover:text-[#3649C6] shrink-0", fill: "currentColor", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", width: "18", height: "18", onClick: (e) => {
|
|
230
228
|
e.stopPropagation(), E.current && E.current.blur(), L ? L(D) : _ ? _(o) : K && K.openAdvancedFilter(o);
|
|
231
|
-
}, children: /* @__PURE__ */ i("path", { d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z" }) }) : null,
|
|
229
|
+
}, children: /* @__PURE__ */ i("path", { d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z" }) }) : null, Fe = () => /* @__PURE__ */ i("button", { onClick: W, className: "cursor-pointer shrink-0 text-[#4259ee] hover:text-[#0f1c76]", children: /* @__PURE__ */ i(ae, { size: 12 }) }), T = c.filter === "agMultiColumnFilter", g = C(c);
|
|
232
230
|
let x = "text";
|
|
233
231
|
T ? x = g.set !== -1 ? "set" : g.date !== -1 ? "date" : "text" : B ? x = "set" : p && (x = "date");
|
|
234
|
-
const
|
|
232
|
+
const Me = T ? g.text !== -1 || g.number !== -1 : !p && !B, te = T ? g.set !== -1 : B, le = T ? g.date !== -1 : p, ve = d.getFilterModel()[o], re = T && ve?.filterModels?.some((e, t) => {
|
|
235
233
|
const l = t === g.text || t === g.number ? "text" : t === g.set ? "set" : "date";
|
|
236
234
|
return e !== null && l !== x;
|
|
237
235
|
});
|
|
@@ -249,11 +247,11 @@ const ke = {
|
|
|
249
247
|
menuWidth: "200px",
|
|
250
248
|
menuPortalTarget: document.body,
|
|
251
249
|
autoFocus: !0,
|
|
252
|
-
onMenuOpen:
|
|
253
|
-
onMenuClose:
|
|
250
|
+
onMenuOpen: xe,
|
|
251
|
+
onMenuClose: ge,
|
|
254
252
|
onMenuScrollToBottom: fe,
|
|
255
253
|
onInputChange: ue,
|
|
256
|
-
onClearAll:
|
|
254
|
+
onClearAll: pe,
|
|
257
255
|
isLoading: J,
|
|
258
256
|
onFocus: () => u(!0),
|
|
259
257
|
onBlur: () => u(!1)
|
|
@@ -284,20 +282,20 @@ const ke = {
|
|
|
284
282
|
onFocus: () => u(!0),
|
|
285
283
|
onBlur: () => u(!1),
|
|
286
284
|
suffix: H && /* @__PURE__ */ i("button", { onClick: (e) => {
|
|
287
|
-
e.stopPropagation(),
|
|
285
|
+
e.stopPropagation(), me();
|
|
288
286
|
}, className: "cursor-pointer text-[#7a8294] hover:text-[#3649C6]", children: /* @__PURE__ */ i(ae, { size: 10 }) })
|
|
289
287
|
}
|
|
290
288
|
),
|
|
291
289
|
/* @__PURE__ */ y("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
292
|
-
T && /* @__PURE__ */ y(
|
|
293
|
-
/* @__PURE__ */ i(
|
|
294
|
-
/* @__PURE__ */ i(
|
|
290
|
+
T && /* @__PURE__ */ y(Ae, { children: [
|
|
291
|
+
/* @__PURE__ */ i(Se, { asChild: !0, children: /* @__PURE__ */ y("div", { className: "relative group p-1 hover:bg-[#dbe0fb] rounded-md transition-colors cursor-pointer", children: [
|
|
292
|
+
/* @__PURE__ */ i(De, { size: 16, className: Ne("text-[#60697D] group-hover:text-[#3649C6]", re && "text-[#3649C6]") }),
|
|
295
293
|
re && /* @__PURE__ */ i("span", { className: "absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-[#4259ee] border border-white shadow-sm" })
|
|
296
294
|
] }) }),
|
|
297
|
-
/* @__PURE__ */ y(
|
|
298
|
-
/* @__PURE__ */ i(
|
|
299
|
-
/* @__PURE__ */ y(
|
|
300
|
-
x !== "text" &&
|
|
295
|
+
/* @__PURE__ */ y(we, { align: "end", className: "w-[300px]", children: [
|
|
296
|
+
/* @__PURE__ */ i(Ie, { children: /* @__PURE__ */ i(Pe, { children: "Active Filters" }) }),
|
|
297
|
+
/* @__PURE__ */ y(qe, { className: "flex flex-col gap-4", children: [
|
|
298
|
+
x !== "text" && Me && /* @__PURE__ */ y("div", { className: "flex flex-col gap-1.5", children: [
|
|
301
299
|
/* @__PURE__ */ i("span", { className: "text-xs font-semibold text-[#60697D]", children: "Text Search" }),
|
|
302
300
|
/* @__PURE__ */ i(
|
|
303
301
|
ie,
|
|
@@ -344,11 +342,11 @@ const ke = {
|
|
|
344
342
|
] })
|
|
345
343
|
] })
|
|
346
344
|
] }),
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
ye(),
|
|
346
|
+
Fe()
|
|
349
347
|
] })
|
|
350
348
|
] });
|
|
351
349
|
};
|
|
352
350
|
export {
|
|
353
|
-
|
|
351
|
+
Ue as HeaderSearchInput
|
|
354
352
|
};
|
|
@@ -42,12 +42,9 @@ export declare function getMultiFilterIndices(colDef: ColDef | undefined): {
|
|
|
42
42
|
* - Multiple patterns with AND: `fo+ au` or `fo +au` (plus separated)
|
|
43
43
|
* - Match all: `*` alone
|
|
44
44
|
*
|
|
45
|
-
* @param input - The search input string
|
|
46
|
-
* @param enableSpaceSplitting - If true, spaces split terms into multiple OR conditions. If false (default), preserves phrases like "Pratik Kumar"
|
|
47
|
-
* @param enableBooleanParsing - If true, boolean keywords parsed globally (e.g., "yes" → true). If false (default), only with '=' prefix (e.g., "=yes" → true)
|
|
48
45
|
* @returns ParsedInput with conditions array and logic
|
|
49
46
|
*/
|
|
50
|
-
export declare function parseInputPattern(input: string
|
|
47
|
+
export declare function parseInputPattern(input: string): ParsedInput;
|
|
51
48
|
/**
|
|
52
49
|
* Convert ParsedInput to AdvancedFilterRule array for a specific column.
|
|
53
50
|
* Used to sync inline search input with the advanced filter modal.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getTodayStr as R, getYesterdayStr as b, getMonthRange as S, getYearRange as W } from "./date-utils.js";
|
|
2
|
-
const
|
|
2
|
+
const E = {
|
|
3
3
|
yes: !0,
|
|
4
4
|
true: !0,
|
|
5
5
|
"[x]": !0,
|
|
@@ -11,7 +11,7 @@ const T = {
|
|
|
11
11
|
"[ ]": !1,
|
|
12
12
|
inactive: !1,
|
|
13
13
|
disabled: !1
|
|
14
|
-
},
|
|
14
|
+
}, $ = {
|
|
15
15
|
jan: 1,
|
|
16
16
|
january: 1,
|
|
17
17
|
feb: 2,
|
|
@@ -36,20 +36,20 @@ const T = {
|
|
|
36
36
|
dec: 12,
|
|
37
37
|
december: 12
|
|
38
38
|
};
|
|
39
|
-
function
|
|
40
|
-
const
|
|
39
|
+
function I(n) {
|
|
40
|
+
const t = n?.filterParams?.filters || [];
|
|
41
41
|
return {
|
|
42
|
-
text:
|
|
43
|
-
number:
|
|
44
|
-
set:
|
|
45
|
-
date:
|
|
42
|
+
text: t.findIndex((r) => (typeof r == "string" ? r : r.filter) === "agTextColumnFilter"),
|
|
43
|
+
number: t.findIndex((r) => (typeof r == "string" ? r : r.filter) === "agNumberColumnFilter"),
|
|
44
|
+
set: t.findIndex((r) => (typeof r == "string" ? r : r.filter) === "agSetColumnFilter"),
|
|
45
|
+
date: t.findIndex((r) => (typeof r == "string" ? r : r.filter) === "agDateColumnFilter")
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
function p(n) {
|
|
49
|
-
const
|
|
50
|
-
return
|
|
49
|
+
const t = n.toLowerCase().trim();
|
|
50
|
+
return t === "today" ? R() : t === "yesterday" ? b() : n;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function T(n) {
|
|
53
53
|
const t = n.trim();
|
|
54
54
|
if (!t)
|
|
55
55
|
return { operator: "contains", value: "" };
|
|
@@ -59,10 +59,8 @@ function v(n, e = !1) {
|
|
|
59
59
|
return { operator: "notEqual", value: p(t.slice(2)) };
|
|
60
60
|
if (t.startsWith("=="))
|
|
61
61
|
return { operator: "equals", value: p(t.slice(2)) };
|
|
62
|
-
if (t.startsWith("="))
|
|
63
|
-
|
|
64
|
-
return T[l] !== void 0 ? { operator: "equals", value: String(T[l]) } : { operator: "equals", value: p(r) };
|
|
65
|
-
}
|
|
62
|
+
if (t.startsWith("="))
|
|
63
|
+
return { operator: "equals", value: p(t.slice(1)) };
|
|
66
64
|
if (t.startsWith("!"))
|
|
67
65
|
return { operator: "notContains", value: p(t.slice(1)) };
|
|
68
66
|
if (t.startsWith(">="))
|
|
@@ -77,99 +75,97 @@ function v(n, e = !1) {
|
|
|
77
75
|
return { operator: "endsWith", value: t.slice(1).trim() };
|
|
78
76
|
if (t.endsWith("*") && t.length > 1 && !t.startsWith("*"))
|
|
79
77
|
return { operator: "startsWith", value: t.slice(0, -1).trim() };
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
return { operator: "inRange", value:
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
return { operator: "inRange", value:
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
return { operator: "equals", value: String(
|
|
89
|
-
if (
|
|
90
|
-
if (
|
|
78
|
+
const r = t.match(/^(\d+(?:\.\d+)?)\s*-\s*(\d+(?:\.\d+)?)$/);
|
|
79
|
+
if (r)
|
|
80
|
+
return { operator: "inRange", value: r[1], valueTo: r[2] };
|
|
81
|
+
const o = t.match(/^(\d{4}-\d{2}-\d{2})\s*-\s*(\d{4}-\d{2}-\d{2})$/);
|
|
82
|
+
if (o)
|
|
83
|
+
return { operator: "inRange", value: o[1], valueTo: o[2] };
|
|
84
|
+
const a = t.toLowerCase();
|
|
85
|
+
if (E[a] !== void 0)
|
|
86
|
+
return { operator: "equals", value: String(E[a]) };
|
|
87
|
+
if (a === "today") return { operator: "equals", value: R() };
|
|
88
|
+
if (a === "yesterday") return { operator: "equals", value: b() };
|
|
91
89
|
if (/^\d{4}$/.test(t)) {
|
|
92
|
-
const
|
|
93
|
-
return { operator: "inRange", value:
|
|
90
|
+
const l = W(Number(t));
|
|
91
|
+
return { operator: "inRange", value: l.from, valueTo: l.to };
|
|
94
92
|
}
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
return { operator: "inRange", value:
|
|
93
|
+
const f = t.match(/^([a-zA-Z]+)\s*(\d{4})$/);
|
|
94
|
+
if (f) {
|
|
95
|
+
const l = $[f[1].toLowerCase()];
|
|
96
|
+
if (l) {
|
|
97
|
+
const e = S(l, Number(f[2]));
|
|
98
|
+
return { operator: "inRange", value: e.from, valueTo: e.to };
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
return { operator: "contains", value: t };
|
|
104
102
|
}
|
|
105
|
-
function
|
|
103
|
+
function j(n) {
|
|
106
104
|
if (!n || n.trim() === "")
|
|
107
105
|
return { conditions: [], logic: "OR" };
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
106
|
+
const t = n.trim();
|
|
107
|
+
if (t === "*")
|
|
110
108
|
return { conditions: [], logic: "OR", matchAll: !0 };
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
113
|
-
return { conditions:
|
|
114
|
-
if (
|
|
115
|
-
return { conditions:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return { conditions: l, logic: "OR" };
|
|
122
|
-
}
|
|
109
|
+
const r = t.includes("+") || t.includes("&"), o = t.includes(",") || t.includes(";");
|
|
110
|
+
if (r)
|
|
111
|
+
return { conditions: t.split(/\s*[+&]\s*/).filter((s) => !!s.trim()).map((s) => T(s)).filter((s) => !!s.value), logic: "AND" };
|
|
112
|
+
if (o)
|
|
113
|
+
return { conditions: t.split(/\s*[,;]\s*/).filter((s) => !!s.trim()).map((s) => T(s)).filter((s) => !!s.value), logic: "OR" };
|
|
114
|
+
const a = t.split(/\s+/).filter((l) => !!l.trim());
|
|
115
|
+
if (a.length > 1) {
|
|
116
|
+
const l = a.map((e) => T(e)).filter((e) => !!e.value);
|
|
117
|
+
if (l.length > 1)
|
|
118
|
+
return { conditions: l, logic: "OR" };
|
|
123
119
|
}
|
|
124
|
-
const
|
|
125
|
-
return !
|
|
120
|
+
const f = T(t);
|
|
121
|
+
return !f.value && f.operator === "contains" ? { conditions: [], logic: "OR" } : { conditions: [f], logic: "OR" };
|
|
126
122
|
}
|
|
127
123
|
function m(n) {
|
|
128
124
|
if (!n) return "";
|
|
129
125
|
if (Array.isArray(n))
|
|
130
|
-
return n.map((
|
|
126
|
+
return n.map((t) => m(t)).join(", ");
|
|
131
127
|
if (/^\d{4}-\d{2}-\d{2}/.test(n))
|
|
132
128
|
try {
|
|
133
|
-
const
|
|
134
|
-
if (!isNaN(
|
|
135
|
-
const
|
|
136
|
-
return `${
|
|
129
|
+
const t = new Date(n);
|
|
130
|
+
if (!isNaN(t.getTime())) {
|
|
131
|
+
const r = String(t.getMonth() + 1).padStart(2, "0"), o = String(t.getDate()).padStart(2, "0");
|
|
132
|
+
return `${r}/${o}`;
|
|
137
133
|
}
|
|
138
134
|
} catch {
|
|
139
135
|
}
|
|
140
136
|
return n;
|
|
141
137
|
}
|
|
142
|
-
function
|
|
143
|
-
const
|
|
138
|
+
function C(n) {
|
|
139
|
+
const t = m(n.value), r = m(n.valueTo || "");
|
|
144
140
|
switch (n.operator) {
|
|
145
141
|
case "contains":
|
|
146
|
-
return
|
|
142
|
+
return t;
|
|
147
143
|
case "notContains":
|
|
148
|
-
return `!${
|
|
144
|
+
return `!${t}`;
|
|
149
145
|
case "equals":
|
|
150
|
-
return n.columnType === "number" || n.columnType === "date" || n.columnType === "select" ?
|
|
146
|
+
return n.columnType === "number" || n.columnType === "date" || n.columnType === "select" ? t : `=${t}`;
|
|
151
147
|
case "notEqual":
|
|
152
|
-
return `!=${
|
|
148
|
+
return `!=${t}`;
|
|
153
149
|
case "startsWith":
|
|
154
|
-
return `${
|
|
150
|
+
return `${t}*`;
|
|
155
151
|
case "endsWith":
|
|
156
|
-
return `*${
|
|
152
|
+
return `*${t}`;
|
|
157
153
|
case "greaterThan":
|
|
158
|
-
return `>${
|
|
154
|
+
return `>${t}`;
|
|
159
155
|
case "greaterThanOrEqual":
|
|
160
|
-
return `≥${
|
|
156
|
+
return `≥${t}`;
|
|
161
157
|
case "lessThan":
|
|
162
|
-
return `<${
|
|
158
|
+
return `<${t}`;
|
|
163
159
|
case "lessThanOrEqual":
|
|
164
|
-
return `≤${
|
|
160
|
+
return `≤${t}`;
|
|
165
161
|
case "inRange":
|
|
166
|
-
return `${
|
|
162
|
+
return `${t}–${r}`;
|
|
167
163
|
case "empty":
|
|
168
164
|
return "∅";
|
|
169
165
|
case "notEmpty":
|
|
170
166
|
return "≠∅";
|
|
171
167
|
default:
|
|
172
|
-
return
|
|
168
|
+
return t;
|
|
173
169
|
}
|
|
174
170
|
}
|
|
175
171
|
const M = {
|
|
@@ -194,42 +190,42 @@ const M = {
|
|
|
194
190
|
lt: "lessThan",
|
|
195
191
|
lte: "lessThanOrEqual"
|
|
196
192
|
};
|
|
197
|
-
function A(n,
|
|
198
|
-
if (!
|
|
199
|
-
if ("filterType" in
|
|
200
|
-
return
|
|
201
|
-
if ("filterType" in
|
|
202
|
-
const
|
|
203
|
-
return
|
|
193
|
+
function A(n, t) {
|
|
194
|
+
if (!t) return "";
|
|
195
|
+
if ("filterType" in t && t.filterType === "multi" && t.filterModels)
|
|
196
|
+
return t.filterModels.map((o) => A(n, o)).filter((o) => !!o).join(", ");
|
|
197
|
+
if ("filterType" in t && t.filterType === "set" && t.values) {
|
|
198
|
+
const a = t.values || [];
|
|
199
|
+
return a.length === 0 ? "" : a.length === 1 ? m(a[0]) : `${m(a[0])} (+${a.length - 1})`;
|
|
204
200
|
}
|
|
205
|
-
if ("conditions" in
|
|
206
|
-
const
|
|
207
|
-
return
|
|
201
|
+
if ("conditions" in t && t.conditions && t.operator) {
|
|
202
|
+
const o = t.operator === "AND" ? " + " : ", ";
|
|
203
|
+
return t.conditions.map((a) => A(n, a)).filter((a) => !!a).join(o);
|
|
208
204
|
}
|
|
209
|
-
const
|
|
210
|
-
if ("type" in
|
|
211
|
-
const
|
|
212
|
-
return
|
|
213
|
-
operator:
|
|
205
|
+
const r = t;
|
|
206
|
+
if ("type" in r && r.type) {
|
|
207
|
+
const o = r.type, a = M[o] || o, f = r.filter !== void 0 ? String(r.filter) : r.dateFrom !== void 0 ? String(r.dateFrom) : "", l = r.filterTo !== void 0 ? String(r.filterTo) : r.dateTo !== void 0 ? String(r.dateTo) : void 0;
|
|
208
|
+
return C({
|
|
209
|
+
operator: a,
|
|
214
210
|
value: f,
|
|
215
|
-
valueTo:
|
|
211
|
+
valueTo: l,
|
|
216
212
|
// Optimization: determine type roughly for '=' vs contains logic
|
|
217
|
-
columnType:
|
|
213
|
+
columnType: r.filterType === "number" ? "number" : r.filterType === "date" ? "date" : "text"
|
|
218
214
|
});
|
|
219
215
|
}
|
|
220
216
|
return "";
|
|
221
217
|
}
|
|
222
|
-
function
|
|
218
|
+
function q() {
|
|
223
219
|
return Math.random().toString(36).substring(2, 11);
|
|
224
220
|
}
|
|
225
|
-
function
|
|
226
|
-
const
|
|
221
|
+
function D(n = "", t) {
|
|
222
|
+
const r = t === "number" || t === "date" || t === "select" ? "equals" : "contains";
|
|
227
223
|
return {
|
|
228
|
-
id:
|
|
224
|
+
id: q(),
|
|
229
225
|
columnId: n,
|
|
230
|
-
operator:
|
|
226
|
+
operator: r,
|
|
231
227
|
value: "",
|
|
232
|
-
columnType:
|
|
228
|
+
columnType: t
|
|
233
229
|
// Store for proper filterType in AG Grid conversion
|
|
234
230
|
};
|
|
235
231
|
}
|
|
@@ -265,174 +261,174 @@ function h(n) {
|
|
|
265
261
|
return "contains";
|
|
266
262
|
}
|
|
267
263
|
}
|
|
268
|
-
function O(n,
|
|
269
|
-
return
|
|
264
|
+
function O(n, t, r) {
|
|
265
|
+
return r === "number" ? "number" : r === "date" ? "date" : r === "select" || r === "set" || Array.isArray(t) ? n === "notEqual" || n === "notContains" ? "text" : "set" : typeof t == "string" && /^\d{4}-\d{2}-\d{2}/.test(t) ? "date" : ["greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "inRange"].includes(n) && t && !x(t) && !isNaN(Number(t)) || typeof t == "string" && t && /^-?\d+(\.\d+)?$/.test(t.trim()) ? "number" : "text";
|
|
270
266
|
}
|
|
271
267
|
function x(n) {
|
|
272
268
|
return Array.isArray(n);
|
|
273
269
|
}
|
|
274
|
-
function
|
|
270
|
+
function w(n) {
|
|
275
271
|
if (console.log("[AdvancedFilter] convertToAgGridFilterModel input:", n), !n || !n.rules || n.rules.length === 0)
|
|
276
272
|
return console.log("[AdvancedFilter] No model or empty rules, returning empty"), {};
|
|
277
|
-
const
|
|
278
|
-
"logic" in
|
|
273
|
+
const t = {}, r = {}, o = (a) => {
|
|
274
|
+
"logic" in a ? (a.conditions || []).forEach(o) : a.columnId && (a.value || a.operator === "empty" || a.operator === "notEmpty") && (r[a.columnId] || (r[a.columnId] = []), r[a.columnId].push(a));
|
|
279
275
|
};
|
|
280
|
-
n.rules.forEach(
|
|
281
|
-
for (const [
|
|
276
|
+
n.rules.forEach(o), console.log("[AdvancedFilter] Rules by column:", r);
|
|
277
|
+
for (const [a, f] of Object.entries(r)) {
|
|
282
278
|
if (f.length === 0) continue;
|
|
283
279
|
if (f[0].columnType === "multi") {
|
|
284
|
-
const
|
|
285
|
-
if (
|
|
286
|
-
const
|
|
287
|
-
|
|
280
|
+
const e = (i) => i.operator !== "equals" ? !1 : !!(Array.isArray(i.value) || ["select", "multi"].includes(i.columnType)), s = f.filter(e), c = f.filter((i) => !e(i)), u = [null, null];
|
|
281
|
+
if (c.length > 0) {
|
|
282
|
+
const i = v(c, "text", n.logic);
|
|
283
|
+
i && (u[0] = i);
|
|
288
284
|
}
|
|
289
|
-
if (
|
|
290
|
-
const
|
|
291
|
-
|
|
285
|
+
if (s.length > 0) {
|
|
286
|
+
const i = v(s, "set", n.logic);
|
|
287
|
+
i && (u[1] = i);
|
|
292
288
|
}
|
|
293
|
-
(
|
|
289
|
+
(u[0] || u[1]) && (t[a] = {
|
|
294
290
|
filterType: "multi",
|
|
295
|
-
filterModels:
|
|
291
|
+
filterModels: u
|
|
296
292
|
});
|
|
297
293
|
} else {
|
|
298
|
-
const
|
|
299
|
-
|
|
294
|
+
const e = v(f, f[0].columnType, n.logic);
|
|
295
|
+
e && (t[a] = e);
|
|
300
296
|
}
|
|
301
297
|
}
|
|
302
|
-
return console.log("[AdvancedFilter] Converted AG Grid filter model:",
|
|
298
|
+
return console.log("[AdvancedFilter] Converted AG Grid filter model:", t), t;
|
|
303
299
|
}
|
|
304
|
-
function
|
|
300
|
+
function v(n, t, r = "OR") {
|
|
305
301
|
if (n.length === 0) return null;
|
|
306
|
-
const
|
|
307
|
-
n.forEach((
|
|
308
|
-
Array.isArray(
|
|
309
|
-
|
|
310
|
-
...
|
|
311
|
-
value:
|
|
312
|
-
id:
|
|
302
|
+
const o = [];
|
|
303
|
+
n.forEach((e) => {
|
|
304
|
+
Array.isArray(e.value) && (e.operator === "notEqual" || e.operator === "notContains") ? e.value.forEach((s) => {
|
|
305
|
+
o.push({
|
|
306
|
+
...e,
|
|
307
|
+
value: s,
|
|
308
|
+
id: q()
|
|
313
309
|
// Unique ID for each condition
|
|
314
310
|
});
|
|
315
|
-
}) :
|
|
311
|
+
}) : o.push(e);
|
|
316
312
|
});
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
319
|
-
const
|
|
320
|
-
return
|
|
321
|
-
Array.isArray(
|
|
313
|
+
const a = o.some((e) => e.operator === "notEqual" || e.operator === "notContains");
|
|
314
|
+
if (t === "set" || o.some((e) => Array.isArray(e.value) || e.columnType === "select") && !a) {
|
|
315
|
+
const e = /* @__PURE__ */ new Set();
|
|
316
|
+
return o.forEach((s) => {
|
|
317
|
+
Array.isArray(s.value) ? s.value.forEach((c) => e.add(c)) : s.value && e.add(s.value);
|
|
322
318
|
}), {
|
|
323
319
|
filterType: "set",
|
|
324
|
-
values: Array.from(
|
|
320
|
+
values: Array.from(e)
|
|
325
321
|
};
|
|
326
322
|
}
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
331
|
-
const
|
|
332
|
-
if (!
|
|
333
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(
|
|
323
|
+
const l = o;
|
|
324
|
+
if (l.length === 1) {
|
|
325
|
+
const e = l[0], s = O(e.operator, e.value, e.columnType);
|
|
326
|
+
if (s === "date" && typeof e.value == "string") {
|
|
327
|
+
const u = (i) => {
|
|
328
|
+
if (!i || Array.isArray(i)) return null;
|
|
329
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(i)) return i;
|
|
334
330
|
try {
|
|
335
|
-
const d = new Date(
|
|
331
|
+
const d = new Date(i), y = d.getFullYear(), g = String(d.getMonth() + 1).padStart(2, "0"), F = String(d.getDate()).padStart(2, "0");
|
|
336
332
|
return `${y}-${g}-${F}`;
|
|
337
333
|
} catch {
|
|
338
|
-
return
|
|
334
|
+
return i;
|
|
339
335
|
}
|
|
340
336
|
};
|
|
341
|
-
return
|
|
337
|
+
return e.operator === "inRange" ? {
|
|
342
338
|
type: "inRange",
|
|
343
|
-
dateFrom:
|
|
344
|
-
dateTo:
|
|
339
|
+
dateFrom: u(e.value),
|
|
340
|
+
dateTo: u(e.valueTo || ""),
|
|
345
341
|
filterType: "date"
|
|
346
342
|
} : {
|
|
347
|
-
type: h(
|
|
348
|
-
dateFrom:
|
|
343
|
+
type: h(e.operator),
|
|
344
|
+
dateFrom: u(e.value),
|
|
349
345
|
filterType: "date"
|
|
350
346
|
};
|
|
351
347
|
}
|
|
352
|
-
const
|
|
353
|
-
if (Array.isArray(
|
|
354
|
-
const
|
|
355
|
-
return (
|
|
348
|
+
const c = (u) => {
|
|
349
|
+
if (Array.isArray(u)) return u;
|
|
350
|
+
const i = e.columnType === "number";
|
|
351
|
+
return (s === "number" || i) && parseFloat(u) || u;
|
|
356
352
|
};
|
|
357
|
-
return
|
|
358
|
-
type: h(
|
|
359
|
-
filter:
|
|
360
|
-
filterTo:
|
|
361
|
-
filterType:
|
|
362
|
-
} :
|
|
363
|
-
type: h(
|
|
353
|
+
return e.operator === "inRange" ? {
|
|
354
|
+
type: h(e.operator),
|
|
355
|
+
filter: c(e.value),
|
|
356
|
+
filterTo: c(e.valueTo || ""),
|
|
357
|
+
filterType: s
|
|
358
|
+
} : e.operator === "empty" || e.operator === "notEmpty" ? {
|
|
359
|
+
type: h(e.operator),
|
|
364
360
|
filterType: "text"
|
|
365
361
|
// Empty checks usually run on text filter or generic
|
|
366
362
|
} : {
|
|
367
|
-
type: h(
|
|
368
|
-
filter:
|
|
369
|
-
filterType:
|
|
363
|
+
type: h(e.operator),
|
|
364
|
+
filter: c(e.value),
|
|
365
|
+
filterType: s
|
|
370
366
|
};
|
|
371
367
|
} else {
|
|
372
|
-
let
|
|
373
|
-
const
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
const d = (g) => Array.isArray(g) ? g :
|
|
377
|
-
let y =
|
|
378
|
-
return
|
|
379
|
-
type:
|
|
380
|
-
filter: d(
|
|
381
|
-
filterTo: d(
|
|
382
|
-
filterType:
|
|
383
|
-
} :
|
|
384
|
-
type:
|
|
368
|
+
let e = "text";
|
|
369
|
+
const s = n.map((c) => {
|
|
370
|
+
const u = h(c.operator), i = O(c.operator, c.value, c.columnType);
|
|
371
|
+
e === "text" && i !== "text" && i !== "set" && (e = i);
|
|
372
|
+
const d = (g) => Array.isArray(g) ? g : i === "number" && parseFloat(g) || g;
|
|
373
|
+
let y = u;
|
|
374
|
+
return i === "number" && (["contains", "startsWith", "endsWith"].includes(u) ? y = "equals" : u === "notContains" && (y = "notEqual")), c.operator === "inRange" ? {
|
|
375
|
+
type: u,
|
|
376
|
+
filter: d(c.value),
|
|
377
|
+
filterTo: d(c.valueTo || ""),
|
|
378
|
+
filterType: i
|
|
379
|
+
} : c.operator === "empty" || c.operator === "notEmpty" ? {
|
|
380
|
+
type: u,
|
|
385
381
|
filterType: "text"
|
|
386
382
|
} : {
|
|
387
383
|
type: y,
|
|
388
|
-
filter: d(
|
|
389
|
-
filterType:
|
|
384
|
+
filter: d(c.value),
|
|
385
|
+
filterType: i
|
|
390
386
|
};
|
|
391
387
|
});
|
|
392
388
|
return {
|
|
393
|
-
filterType:
|
|
394
|
-
operator:
|
|
395
|
-
conditions:
|
|
389
|
+
filterType: e,
|
|
390
|
+
operator: r,
|
|
391
|
+
conditions: s
|
|
396
392
|
};
|
|
397
393
|
}
|
|
398
394
|
}
|
|
399
395
|
function k(n) {
|
|
400
396
|
if (!n || Object.keys(n).length === 0) return null;
|
|
401
|
-
const
|
|
402
|
-
for (const [
|
|
403
|
-
if (!
|
|
404
|
-
const
|
|
405
|
-
if (!
|
|
406
|
-
if ("conditions" in
|
|
407
|
-
return
|
|
408
|
-
if ("filterType" in
|
|
409
|
-
return
|
|
410
|
-
const
|
|
397
|
+
const t = [];
|
|
398
|
+
for (const [r, o] of Object.entries(n)) {
|
|
399
|
+
if (!o) continue;
|
|
400
|
+
const a = (l) => {
|
|
401
|
+
if (!l) return [];
|
|
402
|
+
if ("conditions" in l && l.conditions && l.operator)
|
|
403
|
+
return l.conditions.flatMap((i) => a(i));
|
|
404
|
+
if ("filterType" in l && l.filterType === "multi" && l.filterModels)
|
|
405
|
+
return l.filterModels.flatMap((i) => i ? a(i) : []);
|
|
406
|
+
const e = l, s = "type" in e ? e.type : "equals", c = e.filterType === "set" ? "equals" : M[s] || "contains", u = e.filter !== void 0 ? String(e.filter) : e.dateFrom !== void 0 ? String(e.dateFrom) : e.values ? e.values : "";
|
|
411
407
|
return [{
|
|
412
|
-
id:
|
|
413
|
-
columnId:
|
|
414
|
-
operator:
|
|
415
|
-
value:
|
|
416
|
-
valueTo:
|
|
417
|
-
columnType:
|
|
408
|
+
id: q(),
|
|
409
|
+
columnId: r,
|
|
410
|
+
operator: c,
|
|
411
|
+
value: u,
|
|
412
|
+
valueTo: e.filterTo || e.dateTo,
|
|
413
|
+
columnType: e.filterType
|
|
418
414
|
}];
|
|
419
|
-
}, f =
|
|
420
|
-
|
|
415
|
+
}, f = a(o);
|
|
416
|
+
t.push(...f);
|
|
421
417
|
}
|
|
422
|
-
return
|
|
418
|
+
return t.length === 0 ? null : {
|
|
423
419
|
logic: "AND",
|
|
424
420
|
// Default top-level logic
|
|
425
|
-
rules:
|
|
421
|
+
rules: t
|
|
426
422
|
};
|
|
427
423
|
}
|
|
428
424
|
export {
|
|
429
425
|
k as convertFromAgGridFilterModel,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
426
|
+
w as convertToAgGridFilterModel,
|
|
427
|
+
D as createEmptyRule,
|
|
428
|
+
C as formatRuleForDisplay,
|
|
429
|
+
q as generateFilterId,
|
|
434
430
|
A as getDisplayStringFromFilterModel,
|
|
435
|
-
|
|
431
|
+
I as getMultiFilterIndices,
|
|
436
432
|
h as mapOperatorToAgGrid,
|
|
437
|
-
|
|
433
|
+
j as parseInputPattern
|
|
438
434
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
{
|
|
3
3
|
"name": "impact-nova",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.11",
|
|
5
5
|
"description": "Enterprise-grade React design system built with React 19, Vite, Tailwind CSS, and Radix UI. Comprehensive UI component library for scalable, accessible, and performant applications.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"author": "Impact Analytics",
|
|
12
|
+
"contributors": [
|
|
13
|
+
{
|
|
14
|
+
"name": "Impact Analytics Team"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
12
17
|
"keywords": [
|
|
13
18
|
"react",
|
|
14
19
|
"react-19",
|
|
@@ -17,20 +22,26 @@
|
|
|
17
22
|
"ui-library",
|
|
18
23
|
"tailwind",
|
|
19
24
|
"tailwindcss",
|
|
25
|
+
"radix",
|
|
20
26
|
"radix-ui",
|
|
21
27
|
"typescript",
|
|
22
|
-
"vite",
|
|
23
28
|
"enterprise",
|
|
24
29
|
"accessibility",
|
|
25
30
|
"a11y",
|
|
26
31
|
"ui-components",
|
|
27
32
|
"react-components",
|
|
28
33
|
"shadcn",
|
|
29
|
-
"
|
|
34
|
+
"shadcn-ui",
|
|
30
35
|
"ag-grid",
|
|
31
36
|
"data-table",
|
|
32
37
|
"charts",
|
|
33
38
|
"highcharts",
|
|
39
|
+
"impact-nova",
|
|
40
|
+
"impact-ui",
|
|
41
|
+
"impact-analytics",
|
|
42
|
+
"dashboard",
|
|
43
|
+
"b2b",
|
|
44
|
+
"admin-panel",
|
|
34
45
|
"forms",
|
|
35
46
|
"navigation",
|
|
36
47
|
"modal",
|
|
@@ -46,8 +57,7 @@
|
|
|
46
57
|
"date-picker",
|
|
47
58
|
"icons",
|
|
48
59
|
"theme",
|
|
49
|
-
"design-tokens"
|
|
50
|
-
"impact-nova"
|
|
60
|
+
"design-tokens"
|
|
51
61
|
],
|
|
52
62
|
"repository": {
|
|
53
63
|
"type": "git",
|