impact-nova 1.7.3 → 1.7.4
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getTodayStr as
|
|
2
|
-
const
|
|
1
|
+
import { getTodayStr as M, getYesterdayStr as F, getMonthRange as S, getYearRange as W } from "./date-utils.js";
|
|
2
|
+
const v = {
|
|
3
3
|
yes: !0,
|
|
4
4
|
true: !0,
|
|
5
5
|
"[x]": !0,
|
|
@@ -45,34 +45,34 @@ function w(a) {
|
|
|
45
45
|
date: t.findIndex((n) => (typeof n == "string" ? n : n.filter) === "agDateColumnFilter")
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function d(a) {
|
|
49
49
|
const t = a.toLowerCase().trim();
|
|
50
|
-
return t === "today" ?
|
|
50
|
+
return t === "today" ? M() : t === "yesterday" ? F() : a;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function q(a, t = !1, n = !1) {
|
|
53
53
|
const r = a.trim();
|
|
54
54
|
if (!r)
|
|
55
55
|
return { operator: "contains", value: "" };
|
|
56
56
|
if (r === '""') return { operator: "empty", value: "" };
|
|
57
57
|
if (r === '!""') return { operator: "notEmpty", value: "" };
|
|
58
58
|
if (r.startsWith("!="))
|
|
59
|
-
return { operator: "notEqual", value:
|
|
59
|
+
return { operator: "notEqual", value: d(r.slice(2)) };
|
|
60
60
|
if (r.startsWith("=="))
|
|
61
|
-
return { operator: "equals", value:
|
|
61
|
+
return { operator: "equals", value: d(r.slice(2)) };
|
|
62
62
|
if (r.startsWith("=")) {
|
|
63
63
|
const e = r.slice(1).trim(), l = e.toLowerCase();
|
|
64
|
-
return
|
|
64
|
+
return v[l] !== void 0 ? { operator: "equals", value: String(v[l]) } : { operator: "equals", value: d(e) };
|
|
65
65
|
}
|
|
66
66
|
if (r.startsWith("!"))
|
|
67
|
-
return { operator: "notContains", value:
|
|
67
|
+
return { operator: "notContains", value: d(r.slice(1)) };
|
|
68
68
|
if (r.startsWith(">="))
|
|
69
|
-
return { operator: "greaterThanOrEqual", value:
|
|
69
|
+
return { operator: "greaterThanOrEqual", value: d(r.slice(2)) };
|
|
70
70
|
if (r.startsWith(">"))
|
|
71
|
-
return { operator: "greaterThan", value:
|
|
71
|
+
return { operator: "greaterThan", value: d(r.slice(1)) };
|
|
72
72
|
if (r.startsWith("<="))
|
|
73
|
-
return { operator: "lessThanOrEqual", value:
|
|
73
|
+
return { operator: "lessThanOrEqual", value: d(r.slice(2)) };
|
|
74
74
|
if (r.startsWith("<"))
|
|
75
|
-
return { operator: "lessThan", value:
|
|
75
|
+
return { operator: "lessThan", value: d(r.slice(1)) };
|
|
76
76
|
if (r.startsWith("*") && r.length > 1 && !r.endsWith("*"))
|
|
77
77
|
return { operator: "endsWith", value: r.slice(1).trim() };
|
|
78
78
|
if (r.endsWith("*") && r.length > 1 && !r.startsWith("*"))
|
|
@@ -84,11 +84,11 @@ function v(a, t = !1, n = !1) {
|
|
|
84
84
|
if (f)
|
|
85
85
|
return { operator: "inRange", value: f[1], valueTo: f[2] };
|
|
86
86
|
const c = r.toLowerCase();
|
|
87
|
-
if (t &&
|
|
88
|
-
return { operator: "equals", value: String(
|
|
87
|
+
if (t && v[c] !== void 0)
|
|
88
|
+
return { operator: "equals", value: String(v[c]) };
|
|
89
89
|
if (n) {
|
|
90
|
-
if (c === "today") return { operator: "equals", value:
|
|
91
|
-
if (c === "yesterday") return { operator: "equals", value:
|
|
90
|
+
if (c === "today") return { operator: "equals", value: M() };
|
|
91
|
+
if (c === "yesterday") return { operator: "equals", value: F() };
|
|
92
92
|
if (/^\d{4}$/.test(r)) {
|
|
93
93
|
const l = W(Number(r));
|
|
94
94
|
return { operator: "inRange", value: l.from, valueTo: l.to };
|
|
@@ -112,18 +112,18 @@ function I(a, t = !1, n = !1, r = !1) {
|
|
|
112
112
|
return { conditions: [], logic: "OR", matchAll: !0 };
|
|
113
113
|
const f = i.includes("+") || i.includes("&"), c = i.includes(",") || i.includes(";");
|
|
114
114
|
if (f)
|
|
115
|
-
return { conditions: i.split(/\s*[+&]\s*/).filter((o) => !!o.trim()).map((o) =>
|
|
115
|
+
return { conditions: i.split(/\s*[+&]\s*/).filter((o) => !!o.trim()).map((o) => q(o, n, r)).filter((o) => !!o.value), logic: "AND" };
|
|
116
116
|
if (c)
|
|
117
|
-
return { conditions: i.split(/\s*[,;]\s*/).filter((o) => !!o.trim()).map((o) =>
|
|
117
|
+
return { conditions: i.split(/\s*[,;]\s*/).filter((o) => !!o.trim()).map((o) => q(o, n, r)).filter((o) => !!o.value), logic: "OR" };
|
|
118
118
|
if (t) {
|
|
119
119
|
const l = i.split(/\s+/).filter((u) => !!u.trim());
|
|
120
120
|
if (l.length > 1) {
|
|
121
|
-
const u = l.map((o) =>
|
|
121
|
+
const u = l.map((o) => q(o, n, r)).filter((o) => !!o.value);
|
|
122
122
|
if (u.length > 1)
|
|
123
123
|
return { conditions: u, logic: "OR" };
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
const e =
|
|
126
|
+
const e = q(i, n, r);
|
|
127
127
|
return !e.value && e.operator === "contains" ? { conditions: [], logic: "OR" } : { conditions: [e], logic: "OR" };
|
|
128
128
|
}
|
|
129
129
|
function m(a) {
|
|
@@ -174,7 +174,7 @@ function $(a) {
|
|
|
174
174
|
return t;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
const
|
|
177
|
+
const b = {
|
|
178
178
|
contains: "contains",
|
|
179
179
|
notContains: "notContains",
|
|
180
180
|
equals: "equals",
|
|
@@ -196,21 +196,21 @@ const F = {
|
|
|
196
196
|
lt: "lessThan",
|
|
197
197
|
lte: "lessThanOrEqual"
|
|
198
198
|
};
|
|
199
|
-
function
|
|
199
|
+
function O(a, t) {
|
|
200
200
|
if (!t) return "";
|
|
201
201
|
if ("filterType" in t && t.filterType === "multi" && t.filterModels)
|
|
202
|
-
return t.filterModels.map((r) =>
|
|
202
|
+
return t.filterModels.map((r) => O(a, r)).filter((r) => !!r).join(", ");
|
|
203
203
|
if ("filterType" in t && t.filterType === "set" && t.values) {
|
|
204
204
|
const i = t.values || [];
|
|
205
205
|
return i.length === 0 ? "" : i.length === 1 ? m(i[0]) : `${m(i[0])} (+${i.length - 1})`;
|
|
206
206
|
}
|
|
207
207
|
if ("conditions" in t && t.conditions && t.operator) {
|
|
208
208
|
const r = t.operator === "AND" ? " + " : ", ";
|
|
209
|
-
return t.conditions.map((i) =>
|
|
209
|
+
return t.conditions.map((i) => O(a, i)).filter((i) => !!i).join(r);
|
|
210
210
|
}
|
|
211
211
|
const n = t;
|
|
212
212
|
if ("type" in n && n.type) {
|
|
213
|
-
const r = n.type, i =
|
|
213
|
+
const r = n.type, i = b[r] || r, f = n.filter !== void 0 ? String(n.filter) : n.dateFrom !== void 0 ? String(n.dateFrom) : "", c = n.filterTo !== void 0 ? String(n.filterTo) : n.dateTo !== void 0 ? String(n.dateTo) : void 0;
|
|
214
214
|
return $({
|
|
215
215
|
operator: i,
|
|
216
216
|
value: f,
|
|
@@ -221,13 +221,13 @@ function A(a, t) {
|
|
|
221
221
|
}
|
|
222
222
|
return "";
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function A() {
|
|
225
225
|
return Math.random().toString(36).substring(2, 11);
|
|
226
226
|
}
|
|
227
227
|
function j(a = "", t) {
|
|
228
228
|
const n = t === "number" || t === "date" || t === "select" ? "equals" : "contains";
|
|
229
229
|
return {
|
|
230
|
-
id:
|
|
230
|
+
id: A(),
|
|
231
231
|
columnId: a,
|
|
232
232
|
operator: n,
|
|
233
233
|
value: "",
|
|
@@ -267,7 +267,7 @@ function h(a) {
|
|
|
267
267
|
return "contains";
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function R(a, t, n) {
|
|
271
271
|
return n === "number" ? "number" : n === "date" ? "date" : n === "select" || n === "set" || Array.isArray(t) ? a === "notEqual" || a === "notContains" ? "text" : "set" : typeof t == "string" && /^\d{4}-\d{2}-\d{2}/.test(t) ? "date" : ["greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "inRange"].includes(a) && t && !x(t) && !isNaN(Number(t)) || typeof t == "string" && t && /^-?\d+(\.\d+)?$/.test(t.trim()) ? "number" : "text";
|
|
272
272
|
}
|
|
273
273
|
function x(a) {
|
|
@@ -285,11 +285,11 @@ function D(a) {
|
|
|
285
285
|
if (f[0].columnType === "multi") {
|
|
286
286
|
const e = (s) => s.operator !== "equals" ? !1 : !!(Array.isArray(s.value) || ["select", "multi"].includes(s.columnType)), l = f.filter(e), u = f.filter((s) => !e(s)), o = [null, null];
|
|
287
287
|
if (u.length > 0) {
|
|
288
|
-
const s =
|
|
288
|
+
const s = E(u, "text", a.logic);
|
|
289
289
|
s && (o[0] = s);
|
|
290
290
|
}
|
|
291
291
|
if (l.length > 0) {
|
|
292
|
-
const s =
|
|
292
|
+
const s = E(l, "set", a.logic);
|
|
293
293
|
s && (o[1] = s);
|
|
294
294
|
}
|
|
295
295
|
(o[0] || o[1]) && (t[i] = {
|
|
@@ -297,13 +297,13 @@ function D(a) {
|
|
|
297
297
|
filterModels: o
|
|
298
298
|
});
|
|
299
299
|
} else {
|
|
300
|
-
const e =
|
|
300
|
+
const e = E(f, f[0].columnType, a.logic);
|
|
301
301
|
e && (t[i] = e);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
return console.log("[AdvancedFilter] Converted AG Grid filter model:", t), t;
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function E(a, t, n = "OR") {
|
|
307
307
|
if (a.length === 0) return null;
|
|
308
308
|
const r = [];
|
|
309
309
|
a.forEach((e) => {
|
|
@@ -311,7 +311,7 @@ function q(a, t, n = "OR") {
|
|
|
311
311
|
r.push({
|
|
312
312
|
...e,
|
|
313
313
|
value: l,
|
|
314
|
-
id:
|
|
314
|
+
id: A()
|
|
315
315
|
// Unique ID for each condition
|
|
316
316
|
});
|
|
317
317
|
}) : r.push(e);
|
|
@@ -328,14 +328,14 @@ function q(a, t, n = "OR") {
|
|
|
328
328
|
}
|
|
329
329
|
const c = r;
|
|
330
330
|
if (c.length === 1) {
|
|
331
|
-
const e = c[0], l =
|
|
331
|
+
const e = c[0], l = R(e.operator, e.value, e.columnType);
|
|
332
332
|
if (l === "date" && typeof e.value == "string") {
|
|
333
333
|
const o = (s) => {
|
|
334
334
|
if (!s || Array.isArray(s)) return null;
|
|
335
335
|
if (/^\d{4}-\d{2}-\d{2}$/.test(s)) return s;
|
|
336
336
|
try {
|
|
337
|
-
const
|
|
338
|
-
return `${y}-${g}-${
|
|
337
|
+
const p = new Date(s), y = p.getFullYear(), g = String(p.getMonth() + 1).padStart(2, "0"), T = String(p.getDate()).padStart(2, "0");
|
|
338
|
+
return `${y}-${g}-${T}`;
|
|
339
339
|
} catch {
|
|
340
340
|
return s;
|
|
341
341
|
}
|
|
@@ -354,7 +354,11 @@ function q(a, t, n = "OR") {
|
|
|
354
354
|
const u = (o) => {
|
|
355
355
|
if (Array.isArray(o)) return o;
|
|
356
356
|
const s = e.columnType === "number";
|
|
357
|
-
|
|
357
|
+
if (l === "number" || s) {
|
|
358
|
+
const p = parseFloat(o);
|
|
359
|
+
return isNaN(p) ? o : p;
|
|
360
|
+
}
|
|
361
|
+
return o;
|
|
358
362
|
};
|
|
359
363
|
return e.operator === "inRange" ? {
|
|
360
364
|
type: h(e.operator),
|
|
@@ -373,21 +377,28 @@ function q(a, t, n = "OR") {
|
|
|
373
377
|
} else {
|
|
374
378
|
let e = "text";
|
|
375
379
|
const l = a.map((u) => {
|
|
376
|
-
const o = h(u.operator), s =
|
|
380
|
+
const o = h(u.operator), s = R(u.operator, u.value, u.columnType);
|
|
377
381
|
e === "text" && s !== "text" && s !== "set" && (e = s);
|
|
378
|
-
const
|
|
382
|
+
const p = (g) => {
|
|
383
|
+
if (Array.isArray(g)) return g;
|
|
384
|
+
if (s === "number") {
|
|
385
|
+
const T = parseFloat(g);
|
|
386
|
+
return isNaN(T) ? g : T;
|
|
387
|
+
}
|
|
388
|
+
return g;
|
|
389
|
+
};
|
|
379
390
|
let y = o;
|
|
380
391
|
return s === "number" && (["contains", "startsWith", "endsWith"].includes(o) ? y = "equals" : o === "notContains" && (y = "notEqual")), u.operator === "inRange" ? {
|
|
381
392
|
type: o,
|
|
382
|
-
filter:
|
|
383
|
-
filterTo:
|
|
393
|
+
filter: p(u.value),
|
|
394
|
+
filterTo: p(u.valueTo || ""),
|
|
384
395
|
filterType: s
|
|
385
396
|
} : u.operator === "empty" || u.operator === "notEmpty" ? {
|
|
386
397
|
type: o,
|
|
387
398
|
filterType: "text"
|
|
388
399
|
} : {
|
|
389
400
|
type: y,
|
|
390
|
-
filter:
|
|
401
|
+
filter: p(u.value),
|
|
391
402
|
filterType: s
|
|
392
403
|
};
|
|
393
404
|
});
|
|
@@ -409,9 +420,9 @@ function k(a) {
|
|
|
409
420
|
return c.conditions.flatMap((s) => i(s));
|
|
410
421
|
if ("filterType" in c && c.filterType === "multi" && c.filterModels)
|
|
411
422
|
return c.filterModels.flatMap((s) => s ? i(s) : []);
|
|
412
|
-
const e = c, l = "type" in e ? e.type : "equals", u = e.filterType === "set" ? "equals" :
|
|
423
|
+
const e = c, l = "type" in e ? e.type : "equals", u = e.filterType === "set" ? "equals" : b[l] || "contains", o = e.filter !== void 0 ? String(e.filter) : e.dateFrom !== void 0 ? String(e.dateFrom) : e.values ? e.values : "";
|
|
413
424
|
return [{
|
|
414
|
-
id:
|
|
425
|
+
id: A(),
|
|
415
426
|
columnId: n,
|
|
416
427
|
operator: u,
|
|
417
428
|
value: o,
|
|
@@ -432,8 +443,8 @@ export {
|
|
|
432
443
|
D as convertToAgGridFilterModel,
|
|
433
444
|
j as createEmptyRule,
|
|
434
445
|
$ as formatRuleForDisplay,
|
|
435
|
-
|
|
436
|
-
|
|
446
|
+
A as generateFilterId,
|
|
447
|
+
O as getDisplayStringFromFilterModel,
|
|
437
448
|
w as getMultiFilterIndices,
|
|
438
449
|
h as mapOperatorToAgGrid,
|
|
439
450
|
I as parseInputPattern
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "impact-nova",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"description": "Enterprise-grade React design system built with React 19, Vite, Tailwind CSS, and Radix UI. Built-in internationalization (i18n) and comprehensive UI component library for scalable, accessible, and performant applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|