impact-nova 1.7.39 → 1.7.40
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/cell-renderers/editors/date-cell-editor.js +58 -48
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.d.ts +0 -2
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +212 -218
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.d.ts +2 -2
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +97 -127
- package/dist/components/ui/ag-grid-react/headers/components/date-filter-picker.d.ts +39 -0
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +433 -299
- package/dist/components/ui/ag-grid-react/headers/utils/date-utils.d.ts +33 -1
- package/dist/components/ui/ag-grid-react/headers/utils/date-utils.js +60 -26
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +11 -10
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +284 -260
- package/dist/components/ui/ag-grid-react/index.js +24 -25
- package/dist/components/ui/data-table/column-indicator.d.ts +17 -0
- package/dist/components/ui/data-table/column-indicator.js +30 -0
- package/dist/components/ui/data-table/data-table-column-list.js +210 -154
- package/dist/components/ui/data-table/data-table.js +60 -59
- package/dist/components/ui/data-table/index.d.ts +3 -0
- package/dist/components/ui/data-table/index.js +34 -28
- package/dist/components/ui/data-table/indicator-legend.d.ts +8 -0
- package/dist/components/ui/data-table/indicator-legend.js +20 -0
- package/dist/components/ui/data-table/pin-switch.d.ts +30 -0
- package/dist/components/ui/data-table/pin-switch.js +75 -0
- package/dist/components/ui/date-picker/date-picker.js +65 -63
- package/dist/components/ui/date-picker/date-range-picker.js +77 -75
- package/dist/components/ui/nested-list/components/NestedListContent.js +7 -7
- package/dist/components/ui/nested-list/components/SortableItem.d.ts +10 -0
- package/dist/components/ui/nested-list/components/SortableItem.js +91 -83
- package/dist/components/ui/nested-list/nested-list.js +184 -178
- package/dist/components/ui/types/ag-grid.types.d.ts +16 -2
- package/dist/components/ui/types/date-picker.types.d.ts +4 -0
- package/dist/components/ui/types/nested-list.types.d.ts +12 -0
- package/dist/i18n/defaultMessages.d.ts +10 -0
- package/dist/i18n/defaultMessages.js +16 -8
- package/dist/i18n/locales/de.js +8 -0
- package/dist/i18n/locales/es.js +8 -0
- package/dist/i18n/locales/hi.js +8 -0
- package/dist/i18n/locales/kn.js +8 -0
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +180 -174
- package/package.json +1 -1
- package/tailwind.config.js +16 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTodayStr as
|
|
1
|
+
import { DEFAULT_DATE_DISPLAY_FORMAT as O, isoToDisplay as S, getTodayStr as b, getYesterdayStr as W, getMonthRange as F, getYearRange as x } from "./date-utils.js";
|
|
2
2
|
const v = {
|
|
3
3
|
yes: !0,
|
|
4
4
|
true: !0,
|
|
@@ -11,7 +11,7 @@ const v = {
|
|
|
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,145 +36,146 @@ const v = {
|
|
|
36
36
|
dec: 12,
|
|
37
37
|
december: 12
|
|
38
38
|
};
|
|
39
|
-
function
|
|
40
|
-
const
|
|
39
|
+
function L(i) {
|
|
40
|
+
const n = i?.filterParams?.filters || [];
|
|
41
41
|
return {
|
|
42
|
-
text:
|
|
43
|
-
number:
|
|
44
|
-
set:
|
|
45
|
-
date:
|
|
42
|
+
text: n.findIndex((e) => (typeof e == "string" ? e : e.filter) === "agTextColumnFilter"),
|
|
43
|
+
number: n.findIndex((e) => (typeof e == "string" ? e : e.filter) === "agNumberColumnFilter"),
|
|
44
|
+
set: n.findIndex((e) => (typeof e == "string" ? e : e.filter) === "agSetColumnFilter"),
|
|
45
|
+
date: n.findIndex((e) => (typeof e == "string" ? e : e.filter) === "agDateColumnFilter")
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const
|
|
50
|
-
return
|
|
48
|
+
function g(i) {
|
|
49
|
+
const n = i.toLowerCase().trim();
|
|
50
|
+
return n === "today" ? b() : n === "yesterday" ? W() : i;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
52
|
+
function E(i, n = !1, e = !1) {
|
|
53
|
+
const t = i.trim();
|
|
54
|
+
if (!t)
|
|
55
55
|
return { operator: "contains", value: "" };
|
|
56
|
-
if (
|
|
57
|
-
if (
|
|
58
|
-
if (
|
|
59
|
-
return { operator: "notEqual", value:
|
|
60
|
-
if (
|
|
61
|
-
return { operator: "equals", value:
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
return v[
|
|
56
|
+
if (t === '""') return { operator: "empty", value: "" };
|
|
57
|
+
if (t === '!""') return { operator: "notEmpty", value: "" };
|
|
58
|
+
if (t.startsWith("!="))
|
|
59
|
+
return { operator: "notEqual", value: g(t.slice(2)) };
|
|
60
|
+
if (t.startsWith("=="))
|
|
61
|
+
return { operator: "equals", value: g(t.slice(2)) };
|
|
62
|
+
if (t.startsWith("=")) {
|
|
63
|
+
const o = t.slice(1).trim(), r = o.toLowerCase();
|
|
64
|
+
return v[r] !== void 0 ? { operator: "equals", value: String(v[r]) } : { operator: "equals", value: g(o) };
|
|
65
65
|
}
|
|
66
|
-
if (
|
|
67
|
-
return { operator: "notContains", value:
|
|
68
|
-
if (
|
|
69
|
-
return { operator: "greaterThanOrEqual", value:
|
|
70
|
-
if (
|
|
71
|
-
return { operator: "greaterThan", value:
|
|
72
|
-
if (
|
|
73
|
-
return { operator: "lessThanOrEqual", value:
|
|
74
|
-
if (
|
|
75
|
-
return { operator: "lessThan", value:
|
|
76
|
-
if (
|
|
77
|
-
return { operator: "endsWith", value:
|
|
78
|
-
if (
|
|
79
|
-
return { operator: "startsWith", value:
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
return { operator: "inRange", value:
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
return { operator: "inRange", value:
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
66
|
+
if (t.startsWith("!"))
|
|
67
|
+
return { operator: "notContains", value: g(t.slice(1)) };
|
|
68
|
+
if (t.startsWith(">="))
|
|
69
|
+
return { operator: "greaterThanOrEqual", value: g(t.slice(2)) };
|
|
70
|
+
if (t.startsWith(">"))
|
|
71
|
+
return { operator: "greaterThan", value: g(t.slice(1)) };
|
|
72
|
+
if (t.startsWith("<="))
|
|
73
|
+
return { operator: "lessThanOrEqual", value: g(t.slice(2)) };
|
|
74
|
+
if (t.startsWith("<"))
|
|
75
|
+
return { operator: "lessThan", value: g(t.slice(1)) };
|
|
76
|
+
if (t.startsWith("*") && t.length > 1 && !t.endsWith("*"))
|
|
77
|
+
return { operator: "endsWith", value: t.slice(1).trim() };
|
|
78
|
+
if (t.endsWith("*") && t.length > 1 && !t.startsWith("*"))
|
|
79
|
+
return { operator: "startsWith", value: t.slice(0, -1).trim() };
|
|
80
|
+
const s = t.match(/^(\d+(?:\.\d+)?)\s*~\s*(\d+(?:\.\d+)?)$/);
|
|
81
|
+
if (s)
|
|
82
|
+
return { operator: "inRange", value: s[1], valueTo: s[2] };
|
|
83
|
+
const c = t.match(/^(\d{4}-\d{2}-\d{2})\s*~\s*(\d{4}-\d{2}-\d{2})$/);
|
|
84
|
+
if (c)
|
|
85
|
+
return { operator: "inRange", value: c[1], valueTo: c[2] };
|
|
86
|
+
const p = t.match(/^([^~]+)~([^~]+)$/);
|
|
87
|
+
if (p) {
|
|
88
|
+
const o = p[1].trim(), r = p[2].trim();
|
|
89
|
+
if (/\d/.test(o) && /\d/.test(r))
|
|
90
|
+
return { operator: "inRange", value: o, valueTo: r };
|
|
91
|
+
}
|
|
92
|
+
const a = t.toLowerCase();
|
|
93
|
+
if (n && v[a] !== void 0)
|
|
94
|
+
return { operator: "equals", value: String(v[a]) };
|
|
95
|
+
if (e) {
|
|
96
|
+
if (a === "today") return { operator: "equals", value: b() };
|
|
97
|
+
if (a === "yesterday") return { operator: "equals", value: W() };
|
|
98
|
+
if (/^\d{4}$/.test(t)) {
|
|
99
|
+
const r = x(Number(t));
|
|
100
|
+
return { operator: "inRange", value: r.from, valueTo: r.to };
|
|
95
101
|
}
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const u =
|
|
102
|
+
const o = t.match(/^([a-zA-Z]+)\s*(\d{4})$/);
|
|
103
|
+
if (o) {
|
|
104
|
+
const r = $[o[1].toLowerCase()];
|
|
105
|
+
if (r) {
|
|
106
|
+
const u = F(r, Number(o[2]));
|
|
101
107
|
return { operator: "inRange", value: u.from, valueTo: u.to };
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
|
-
return { operator: "contains", value:
|
|
111
|
+
return { operator: "contains", value: t };
|
|
106
112
|
}
|
|
107
|
-
function
|
|
108
|
-
if (!
|
|
113
|
+
function w(i, n = !1, e = !1, t = !1) {
|
|
114
|
+
if (!i || i.trim() === "")
|
|
109
115
|
return { conditions: [], logic: "OR" };
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
116
|
+
const s = i.trim();
|
|
117
|
+
if (s === "*")
|
|
112
118
|
return { conditions: [], logic: "OR", matchAll: !0 };
|
|
113
|
-
const
|
|
114
|
-
if (f)
|
|
115
|
-
return { conditions: i.split(/\s*[+&]\s*/).filter((o) => !!o.trim()).map((o) => q(o, n, r)).filter((o) => !!o.value), logic: "AND" };
|
|
119
|
+
const c = s.includes("+") || s.includes("&"), p = s.includes(",") || s.includes(";");
|
|
116
120
|
if (c)
|
|
117
|
-
return { conditions:
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
return { conditions: s.split(/\s*[+&]\s*/).filter((u) => !!u.trim()).map((u) => E(u, e, t)).filter((u) => !!u.value), logic: "AND" };
|
|
122
|
+
if (p)
|
|
123
|
+
return { conditions: s.split(/\s*[,;]\s*/).filter((u) => !!u.trim()).map((u) => E(u, e, t)).filter((u) => !!u.value), logic: "OR" };
|
|
124
|
+
if (n) {
|
|
125
|
+
const o = s.split(/\s+/).filter((r) => !!r.trim());
|
|
126
|
+
if (o.length > 1) {
|
|
127
|
+
const r = o.map((u) => E(u, e, t)).filter((u) => !!u.value);
|
|
128
|
+
if (r.length > 1)
|
|
129
|
+
return { conditions: r, logic: "OR" };
|
|
124
130
|
}
|
|
125
131
|
}
|
|
126
|
-
const
|
|
127
|
-
return !
|
|
132
|
+
const a = E(s, e, t);
|
|
133
|
+
return !a.value && a.operator === "contains" ? { conditions: [], logic: "OR" } : { conditions: [a], logic: "OR" };
|
|
128
134
|
}
|
|
129
|
-
function m(
|
|
130
|
-
if (!
|
|
131
|
-
if (Array.isArray(
|
|
132
|
-
return
|
|
133
|
-
if (/^\d{4}-\d{2}-\d{2}/.test(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return `${n}/${r}`;
|
|
139
|
-
}
|
|
140
|
-
} catch {
|
|
141
|
-
}
|
|
142
|
-
return a;
|
|
135
|
+
function m(i, n = O) {
|
|
136
|
+
if (!i) return "";
|
|
137
|
+
if (Array.isArray(i))
|
|
138
|
+
return i.map((e) => m(e, n)).join(", ");
|
|
139
|
+
if (/^\d{4}-\d{2}-\d{2}/.test(i)) {
|
|
140
|
+
const e = S(i, n);
|
|
141
|
+
if (e) return e;
|
|
142
|
+
}
|
|
143
|
+
return i;
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
-
const
|
|
146
|
-
switch (
|
|
145
|
+
function N(i, n = O) {
|
|
146
|
+
const e = m(i.value, n), t = m(i.valueTo || "", n);
|
|
147
|
+
switch (i.operator) {
|
|
147
148
|
case "contains":
|
|
148
|
-
return
|
|
149
|
+
return e;
|
|
149
150
|
case "notContains":
|
|
150
|
-
return `!${
|
|
151
|
+
return `!${e}`;
|
|
151
152
|
case "equals":
|
|
152
|
-
return
|
|
153
|
+
return i.columnType === "number" || i.columnType === "date" || i.columnType === "select" ? e : `=${e}`;
|
|
153
154
|
case "notEqual":
|
|
154
|
-
return `!=${
|
|
155
|
+
return `!=${e}`;
|
|
155
156
|
case "startsWith":
|
|
156
|
-
return `${
|
|
157
|
+
return `${e}*`;
|
|
157
158
|
case "endsWith":
|
|
158
|
-
return `*${
|
|
159
|
+
return `*${e}`;
|
|
159
160
|
case "greaterThan":
|
|
160
|
-
return `>${
|
|
161
|
+
return `>${e}`;
|
|
161
162
|
case "greaterThanOrEqual":
|
|
162
|
-
return
|
|
163
|
+
return `>=${e}`;
|
|
163
164
|
case "lessThan":
|
|
164
|
-
return `<${
|
|
165
|
+
return `<${e}`;
|
|
165
166
|
case "lessThanOrEqual":
|
|
166
|
-
return
|
|
167
|
+
return `<=${e}`;
|
|
167
168
|
case "inRange":
|
|
168
|
-
return `${
|
|
169
|
+
return `${e}~${t}`;
|
|
169
170
|
case "empty":
|
|
170
171
|
return "∅";
|
|
171
172
|
case "notEmpty":
|
|
172
173
|
return "≠∅";
|
|
173
174
|
default:
|
|
174
|
-
return
|
|
175
|
+
return e;
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
|
-
const
|
|
178
|
+
const C = {
|
|
178
179
|
contains: "contains",
|
|
179
180
|
notContains: "notContains",
|
|
180
181
|
equals: "equals",
|
|
@@ -196,47 +197,47 @@ const b = {
|
|
|
196
197
|
lt: "lessThan",
|
|
197
198
|
lte: "lessThanOrEqual"
|
|
198
199
|
};
|
|
199
|
-
function
|
|
200
|
-
if (!
|
|
201
|
-
if ("filterType" in
|
|
202
|
-
return
|
|
203
|
-
if ("filterType" in
|
|
204
|
-
const
|
|
205
|
-
return
|
|
200
|
+
function A(i, n, e = O) {
|
|
201
|
+
if (!n) return "";
|
|
202
|
+
if ("filterType" in n && n.filterType === "multi" && n.filterModels)
|
|
203
|
+
return n.filterModels.map((s) => A(i, s, e)).filter((s) => !!s).join(", ");
|
|
204
|
+
if ("filterType" in n && n.filterType === "set" && n.values) {
|
|
205
|
+
const c = n.values || [];
|
|
206
|
+
return c.length === 0 ? "" : c.length === 1 ? m(c[0]) : `${m(c[0])} (+${c.length - 1})`;
|
|
206
207
|
}
|
|
207
|
-
if ("conditions" in
|
|
208
|
-
const
|
|
209
|
-
return
|
|
208
|
+
if ("conditions" in n && n.conditions && n.operator) {
|
|
209
|
+
const s = n.operator === "AND" ? " + " : ", ";
|
|
210
|
+
return n.conditions.map((c) => A(i, c, e)).filter((c) => !!c).join(s);
|
|
210
211
|
}
|
|
211
|
-
const
|
|
212
|
-
if ("type" in
|
|
213
|
-
const
|
|
214
|
-
return
|
|
215
|
-
operator:
|
|
216
|
-
value:
|
|
217
|
-
valueTo:
|
|
212
|
+
const t = n;
|
|
213
|
+
if ("type" in t && t.type) {
|
|
214
|
+
const s = t.type, c = C[s] || s, p = t.filter !== void 0 ? String(t.filter) : t.dateFrom !== void 0 ? String(t.dateFrom) : "", a = t.filterTo !== void 0 ? String(t.filterTo) : t.dateTo !== void 0 ? String(t.dateTo) : void 0;
|
|
215
|
+
return N({
|
|
216
|
+
operator: c,
|
|
217
|
+
value: p,
|
|
218
|
+
valueTo: a,
|
|
218
219
|
// Optimization: determine type roughly for '=' vs contains logic
|
|
219
|
-
columnType:
|
|
220
|
-
});
|
|
220
|
+
columnType: t.filterType === "number" ? "number" : t.filterType === "date" ? "date" : "text"
|
|
221
|
+
}, e);
|
|
221
222
|
}
|
|
222
223
|
return "";
|
|
223
224
|
}
|
|
224
|
-
function
|
|
225
|
+
function R() {
|
|
225
226
|
return Math.random().toString(36).substring(2, 11);
|
|
226
227
|
}
|
|
227
|
-
function
|
|
228
|
-
const
|
|
228
|
+
function D(i = "", n) {
|
|
229
|
+
const e = n === "number" || n === "date" || n === "select" ? "equals" : "contains";
|
|
229
230
|
return {
|
|
230
|
-
id:
|
|
231
|
-
columnId:
|
|
232
|
-
operator:
|
|
231
|
+
id: R(),
|
|
232
|
+
columnId: i,
|
|
233
|
+
operator: e,
|
|
233
234
|
value: "",
|
|
234
|
-
columnType:
|
|
235
|
+
columnType: n
|
|
235
236
|
// Store for proper filterType in AG Grid conversion
|
|
236
237
|
};
|
|
237
238
|
}
|
|
238
|
-
function h(
|
|
239
|
-
switch (
|
|
239
|
+
function h(i) {
|
|
240
|
+
switch (i) {
|
|
240
241
|
case "contains":
|
|
241
242
|
return "contains";
|
|
242
243
|
case "notContains":
|
|
@@ -267,185 +268,208 @@ function h(a) {
|
|
|
267
268
|
return "contains";
|
|
268
269
|
}
|
|
269
270
|
}
|
|
270
|
-
function
|
|
271
|
-
return
|
|
271
|
+
function M(i, n, e) {
|
|
272
|
+
return e === "number" ? "number" : e === "date" ? "date" : e === "select" || e === "set" || Array.isArray(n) ? i === "notEqual" || i === "notContains" ? "text" : "set" : typeof n == "string" && /^\d{4}-\d{2}-\d{2}/.test(n) ? "date" : ["greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "inRange"].includes(i) && n && !I(n) && !isNaN(Number(n)) || typeof n == "string" && n && /^-?\d+(\.\d+)?$/.test(n.trim()) ? "number" : "text";
|
|
272
273
|
}
|
|
273
|
-
function
|
|
274
|
-
return Array.isArray(
|
|
274
|
+
function I(i) {
|
|
275
|
+
return Array.isArray(i);
|
|
275
276
|
}
|
|
276
|
-
function
|
|
277
|
-
if (
|
|
278
|
-
return
|
|
279
|
-
const
|
|
280
|
-
"logic" in
|
|
277
|
+
function k(i) {
|
|
278
|
+
if (!i || !i.rules || i.rules.length === 0)
|
|
279
|
+
return {};
|
|
280
|
+
const n = {}, e = {}, t = (s) => {
|
|
281
|
+
"logic" in s ? (s.conditions || []).forEach(t) : s.columnId && (s.value || s.operator === "empty" || s.operator === "notEmpty") && (e[s.columnId] || (e[s.columnId] = []), e[s.columnId].push(s));
|
|
281
282
|
};
|
|
282
|
-
|
|
283
|
-
for (const [
|
|
284
|
-
if (
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
i.rules.forEach(t);
|
|
284
|
+
for (const [s, c] of Object.entries(e)) {
|
|
285
|
+
if (c.length === 0) continue;
|
|
286
|
+
const p = i.columnLogic?.[s] || i.logic;
|
|
287
|
+
if (c[0].columnType === "multi") {
|
|
288
|
+
const o = (f) => f.operator !== "equals" ? !1 : !!(Array.isArray(f.value) || ["select", "multi"].includes(f.columnType)), r = c.filter(o), u = c.filter((f) => !o(f)), l = [null, null];
|
|
287
289
|
if (u.length > 0) {
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
+
const f = q(u, "text", p);
|
|
291
|
+
f && (l[0] = f);
|
|
290
292
|
}
|
|
291
|
-
if (
|
|
292
|
-
const
|
|
293
|
-
|
|
293
|
+
if (r.length > 0) {
|
|
294
|
+
const f = q(r, "set", p);
|
|
295
|
+
f && (l[1] = f);
|
|
294
296
|
}
|
|
295
|
-
(
|
|
297
|
+
(l[0] || l[1]) && (n[s] = {
|
|
296
298
|
filterType: "multi",
|
|
297
|
-
filterModels:
|
|
299
|
+
filterModels: l
|
|
298
300
|
});
|
|
299
301
|
} else {
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
+
const o = q(c, c[0].columnType, p);
|
|
303
|
+
o && (n[s] = o);
|
|
302
304
|
}
|
|
303
305
|
}
|
|
304
|
-
return
|
|
306
|
+
return n;
|
|
305
307
|
}
|
|
306
|
-
function
|
|
307
|
-
if (
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
Array.isArray(
|
|
311
|
-
|
|
312
|
-
...
|
|
313
|
-
value:
|
|
314
|
-
id:
|
|
308
|
+
function q(i, n, e = "OR") {
|
|
309
|
+
if (i.length === 0) return null;
|
|
310
|
+
const t = [];
|
|
311
|
+
i.forEach((a) => {
|
|
312
|
+
Array.isArray(a.value) && (a.operator === "notEqual" || a.operator === "notContains") ? a.value.forEach((o) => {
|
|
313
|
+
t.push({
|
|
314
|
+
...a,
|
|
315
|
+
value: o,
|
|
316
|
+
id: R()
|
|
315
317
|
// Unique ID for each condition
|
|
316
318
|
});
|
|
317
|
-
}) :
|
|
319
|
+
}) : t.push(a);
|
|
318
320
|
});
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
321
|
-
const
|
|
322
|
-
return
|
|
323
|
-
Array.isArray(
|
|
321
|
+
const s = t.some((a) => a.operator === "notEqual" || a.operator === "notContains");
|
|
322
|
+
if (n === "set" || t.some((a) => Array.isArray(a.value) || a.columnType === "select") && !s) {
|
|
323
|
+
const a = /* @__PURE__ */ new Set();
|
|
324
|
+
return t.forEach((o) => {
|
|
325
|
+
Array.isArray(o.value) ? o.value.forEach((r) => a.add(r)) : o.value && a.add(o.value);
|
|
324
326
|
}), {
|
|
325
327
|
filterType: "set",
|
|
326
|
-
values: Array.from(
|
|
328
|
+
values: Array.from(a)
|
|
327
329
|
};
|
|
328
330
|
}
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
335
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(
|
|
331
|
+
const p = t;
|
|
332
|
+
if (p.length === 1) {
|
|
333
|
+
const a = p[0], o = M(a.operator, a.value, a.columnType);
|
|
334
|
+
if (o === "date" && typeof a.value == "string") {
|
|
335
|
+
const u = (l) => {
|
|
336
|
+
if (!l || Array.isArray(l)) return null;
|
|
337
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(l)) return l;
|
|
336
338
|
try {
|
|
337
|
-
const
|
|
338
|
-
return `${
|
|
339
|
+
const f = new Date(l), d = f.getFullYear(), y = String(f.getMonth() + 1).padStart(2, "0"), T = String(f.getDate()).padStart(2, "0");
|
|
340
|
+
return `${d}-${y}-${T}`;
|
|
339
341
|
} catch {
|
|
340
|
-
return
|
|
342
|
+
return l;
|
|
341
343
|
}
|
|
342
344
|
};
|
|
343
|
-
return
|
|
345
|
+
return a.operator === "inRange" ? {
|
|
344
346
|
type: "inRange",
|
|
345
|
-
dateFrom:
|
|
346
|
-
dateTo:
|
|
347
|
+
dateFrom: u(a.value),
|
|
348
|
+
dateTo: u(a.valueTo || ""),
|
|
347
349
|
filterType: "date"
|
|
348
350
|
} : {
|
|
349
|
-
type: h(
|
|
350
|
-
dateFrom:
|
|
351
|
+
type: h(a.operator),
|
|
352
|
+
dateFrom: u(a.value),
|
|
351
353
|
filterType: "date"
|
|
352
354
|
};
|
|
353
355
|
}
|
|
354
|
-
const
|
|
355
|
-
if (Array.isArray(
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
const
|
|
359
|
-
return isNaN(
|
|
356
|
+
const r = (u) => {
|
|
357
|
+
if (Array.isArray(u)) return u;
|
|
358
|
+
const l = a.columnType === "number";
|
|
359
|
+
if (o === "number" || l) {
|
|
360
|
+
const f = parseFloat(u);
|
|
361
|
+
return isNaN(f) ? u : f;
|
|
360
362
|
}
|
|
361
|
-
return
|
|
363
|
+
return u;
|
|
362
364
|
};
|
|
363
|
-
return
|
|
364
|
-
type: h(
|
|
365
|
-
filter:
|
|
366
|
-
filterTo:
|
|
367
|
-
filterType:
|
|
368
|
-
} :
|
|
369
|
-
type: h(
|
|
365
|
+
return a.operator === "inRange" ? {
|
|
366
|
+
type: h(a.operator),
|
|
367
|
+
filter: r(a.value),
|
|
368
|
+
filterTo: r(a.valueTo || ""),
|
|
369
|
+
filterType: o
|
|
370
|
+
} : a.operator === "empty" || a.operator === "notEmpty" ? {
|
|
371
|
+
type: h(a.operator),
|
|
370
372
|
filterType: "text"
|
|
371
373
|
// Empty checks usually run on text filter or generic
|
|
372
374
|
} : {
|
|
373
|
-
type: h(
|
|
374
|
-
filter:
|
|
375
|
-
filterType:
|
|
375
|
+
type: h(a.operator),
|
|
376
|
+
filter: r(a.value),
|
|
377
|
+
filterType: o
|
|
376
378
|
};
|
|
377
379
|
} else {
|
|
378
|
-
let
|
|
379
|
-
const
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
const
|
|
383
|
-
if (Array.isArray(
|
|
384
|
-
if (
|
|
385
|
-
const T = parseFloat(
|
|
386
|
-
return isNaN(T) ?
|
|
380
|
+
let a = "text";
|
|
381
|
+
const o = i.map((r) => {
|
|
382
|
+
const u = h(r.operator), l = M(r.operator, r.value, r.columnType);
|
|
383
|
+
a === "text" && l !== "text" && l !== "set" && (a = l);
|
|
384
|
+
const f = (y) => {
|
|
385
|
+
if (Array.isArray(y)) return y;
|
|
386
|
+
if (l === "number") {
|
|
387
|
+
const T = parseFloat(y);
|
|
388
|
+
return isNaN(T) ? y : T;
|
|
387
389
|
}
|
|
388
|
-
return
|
|
390
|
+
return y;
|
|
389
391
|
};
|
|
390
|
-
let
|
|
391
|
-
return
|
|
392
|
-
type:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
filterType:
|
|
396
|
-
} :
|
|
397
|
-
type:
|
|
392
|
+
let d = u;
|
|
393
|
+
return l === "number" && (["contains", "startsWith", "endsWith"].includes(u) ? d = "equals" : u === "notContains" && (d = "notEqual")), r.operator === "inRange" ? l === "date" ? {
|
|
394
|
+
type: "inRange",
|
|
395
|
+
dateFrom: r.value,
|
|
396
|
+
dateTo: r.valueTo || "",
|
|
397
|
+
filterType: "date"
|
|
398
|
+
} : {
|
|
399
|
+
type: u,
|
|
400
|
+
filter: f(r.value),
|
|
401
|
+
filterTo: f(r.valueTo || ""),
|
|
402
|
+
filterType: l
|
|
403
|
+
} : r.operator === "empty" || r.operator === "notEmpty" ? {
|
|
404
|
+
type: u,
|
|
398
405
|
filterType: "text"
|
|
406
|
+
} : l === "date" && typeof r.value == "string" ? {
|
|
407
|
+
type: d,
|
|
408
|
+
dateFrom: r.value,
|
|
409
|
+
filterType: "date"
|
|
399
410
|
} : {
|
|
400
|
-
type:
|
|
401
|
-
filter:
|
|
402
|
-
filterType:
|
|
411
|
+
type: d,
|
|
412
|
+
filter: f(r.value),
|
|
413
|
+
filterType: l
|
|
403
414
|
};
|
|
404
415
|
});
|
|
405
416
|
return {
|
|
406
|
-
filterType:
|
|
407
|
-
operator:
|
|
408
|
-
conditions:
|
|
417
|
+
filterType: a,
|
|
418
|
+
operator: e,
|
|
419
|
+
conditions: o
|
|
409
420
|
};
|
|
410
421
|
}
|
|
411
422
|
}
|
|
412
|
-
function
|
|
413
|
-
if (!
|
|
414
|
-
const
|
|
415
|
-
for (const [
|
|
416
|
-
if (!
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
if (
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
423
|
+
function _(i) {
|
|
424
|
+
if (!i || Object.keys(i).length === 0) return null;
|
|
425
|
+
const n = [], e = {};
|
|
426
|
+
for (const [t, s] of Object.entries(i)) {
|
|
427
|
+
if (!s) continue;
|
|
428
|
+
((o) => {
|
|
429
|
+
const r = o;
|
|
430
|
+
if (r.conditions && r.operator && (e[t] = r.operator), "filterType" in o && o.filterType === "multi" && o.filterModels)
|
|
431
|
+
for (const u of o.filterModels) {
|
|
432
|
+
if (!u) continue;
|
|
433
|
+
const l = u;
|
|
434
|
+
if (l.conditions && l.operator) {
|
|
435
|
+
e[t] = l.operator;
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
})(s);
|
|
440
|
+
const p = (o) => {
|
|
441
|
+
if (!o) return [];
|
|
442
|
+
if ("conditions" in o && o.conditions && o.operator)
|
|
443
|
+
return o.conditions.flatMap((d) => p(d));
|
|
444
|
+
if ("filterType" in o && o.filterType === "multi" && o.filterModels)
|
|
445
|
+
return o.filterModels.flatMap((d) => d ? p(d) : []);
|
|
446
|
+
const r = o, u = "type" in r ? r.type : "equals", l = r.filterType === "set" ? "equals" : C[u] || "contains", f = r.filter !== void 0 ? String(r.filter) : r.dateFrom !== void 0 ? String(r.dateFrom) : r.values ? r.values : "";
|
|
424
447
|
return [{
|
|
425
|
-
id:
|
|
426
|
-
columnId:
|
|
427
|
-
operator:
|
|
428
|
-
value:
|
|
429
|
-
valueTo:
|
|
430
|
-
columnType:
|
|
448
|
+
id: R(),
|
|
449
|
+
columnId: t,
|
|
450
|
+
operator: l,
|
|
451
|
+
value: f,
|
|
452
|
+
valueTo: r.filterTo || r.dateTo,
|
|
453
|
+
columnType: r.filterType
|
|
431
454
|
}];
|
|
432
|
-
},
|
|
433
|
-
|
|
455
|
+
}, a = p(s);
|
|
456
|
+
n.push(...a);
|
|
434
457
|
}
|
|
435
|
-
return
|
|
436
|
-
logic: "
|
|
437
|
-
|
|
438
|
-
|
|
458
|
+
return n.length === 0 ? null : {
|
|
459
|
+
logic: "OR",
|
|
460
|
+
rules: n,
|
|
461
|
+
columnLogic: Object.keys(e).length > 0 ? e : void 0
|
|
439
462
|
};
|
|
440
463
|
}
|
|
441
464
|
export {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
465
|
+
C as agToInternalOperator,
|
|
466
|
+
_ as convertFromAgGridFilterModel,
|
|
467
|
+
k as convertToAgGridFilterModel,
|
|
468
|
+
D as createEmptyRule,
|
|
469
|
+
N as formatRuleForDisplay,
|
|
470
|
+
R as generateFilterId,
|
|
471
|
+
A as getDisplayStringFromFilterModel,
|
|
472
|
+
L as getMultiFilterIndices,
|
|
449
473
|
h as mapOperatorToAgGrid,
|
|
450
|
-
|
|
474
|
+
w as parseInputPattern
|
|
451
475
|
};
|