impact-nova 1.7.38 → 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.
Files changed (42) hide show
  1. package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +58 -48
  2. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.d.ts +0 -2
  3. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +212 -218
  4. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.d.ts +2 -2
  5. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +97 -127
  6. package/dist/components/ui/ag-grid-react/headers/components/date-filter-picker.d.ts +39 -0
  7. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +433 -299
  8. package/dist/components/ui/ag-grid-react/headers/utils/date-utils.d.ts +33 -1
  9. package/dist/components/ui/ag-grid-react/headers/utils/date-utils.js +60 -26
  10. package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +11 -10
  11. package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +284 -260
  12. package/dist/components/ui/ag-grid-react/index.js +24 -25
  13. package/dist/components/ui/create-item-flow/create-item-flow.js +1 -1
  14. package/dist/components/ui/data-table/column-indicator.d.ts +17 -0
  15. package/dist/components/ui/data-table/column-indicator.js +30 -0
  16. package/dist/components/ui/data-table/data-table-column-list.js +210 -154
  17. package/dist/components/ui/data-table/data-table.js +60 -59
  18. package/dist/components/ui/data-table/index.d.ts +3 -0
  19. package/dist/components/ui/data-table/index.js +34 -28
  20. package/dist/components/ui/data-table/indicator-legend.d.ts +8 -0
  21. package/dist/components/ui/data-table/indicator-legend.js +20 -0
  22. package/dist/components/ui/data-table/pin-switch.d.ts +30 -0
  23. package/dist/components/ui/data-table/pin-switch.js +75 -0
  24. package/dist/components/ui/date-picker/date-picker.js +65 -63
  25. package/dist/components/ui/date-picker/date-range-picker.js +77 -75
  26. package/dist/components/ui/nested-list/components/NestedListContent.js +7 -7
  27. package/dist/components/ui/nested-list/components/SortableItem.d.ts +10 -0
  28. package/dist/components/ui/nested-list/components/SortableItem.js +91 -83
  29. package/dist/components/ui/nested-list/nested-list.js +184 -178
  30. package/dist/components/ui/types/ag-grid.types.d.ts +16 -2
  31. package/dist/components/ui/types/date-picker.types.d.ts +4 -0
  32. package/dist/components/ui/types/nested-list.types.d.ts +12 -0
  33. package/dist/i18n/defaultMessages.d.ts +10 -0
  34. package/dist/i18n/defaultMessages.js +16 -8
  35. package/dist/i18n/locales/de.js +8 -0
  36. package/dist/i18n/locales/es.js +8 -0
  37. package/dist/i18n/locales/hi.js +8 -0
  38. package/dist/i18n/locales/kn.js +8 -0
  39. package/dist/impact-nova.css +1 -1
  40. package/dist/index.js +180 -174
  41. package/package.json +1 -1
  42. package/tailwind.config.js +16 -0
@@ -1,247 +1,319 @@
1
- import { jsxs as M, jsx as a } from "react/jsx-runtime";
2
- import { useRef as he, useState as w, useEffect as pe, useCallback as Re } from "react";
3
- import { Filter as je } from "lucide-react";
4
- import { cn as Oe } from "../../../../lib/utils.js";
5
- import { DatePicker as ge } from "../../date-picker/date-picker.js";
6
- import { MonthPicker as ye } from "../../date-picker/month-picker.js";
7
- import { Input as Fe } from "../../input.js";
8
- import xe from "../../select/select.js";
9
- import { Popover as We, PopoverTrigger as Ve, PopoverContent as Ge, PopoverHeader as Le, PopoverTitle as _e, PopoverBody as Je } from "../../popover.js";
10
- import { Cross as Me } from "../../../../icons/index.js";
11
- import { useGridHeader as Ke } from "./context/grid-header-context.js";
12
- import { getMultiFilterIndices as v, getDisplayStringFromFilterModel as q, parseInputPattern as Qe } from "./utils/filter-utils.js";
13
- import { deserializeDate as C, deserializeMonth as E, serializeMonth as ve, serializeDate as be } from "./utils/date-utils.js";
14
- import { useImpactNovaI18n as Ue } from "../../../../i18n/ImpactNovaI18nContext.js";
15
- const Xe = {
16
- contains: "contains",
17
- notContains: "notContains",
18
- equals: "equals",
19
- notEqual: "notEqual",
20
- startsWith: "startsWith",
21
- endsWith: "endsWith",
22
- greaterThan: "greaterThan",
23
- greaterThanOrEqual: "greaterThanOrEqual",
24
- lessThan: "lessThan",
25
- lessThanOrEqual: "lessThanOrEqual",
26
- inRange: "inRange",
27
- empty: "blank",
28
- notEmpty: "notBlank"
29
- }, ut = ({
30
- column: I,
31
- api: u,
32
- onClose: J,
33
- handleInlineSearch: K,
34
- handleClearSearchInline: Q,
35
- onAdvanceSearchClick: U,
36
- toggleAdvanceSearch: X,
37
- advanceSearchEnabled: Te = !1,
38
- selectOptions: k,
39
- isMultiSelect: D,
40
- onSelectScrollToBottom: Ce,
41
- onSelectSearchChange: De,
42
- onSelectOpen: Y,
43
- isLoadingSelect: Z,
44
- enableSpaceSplitting: Ne = !1,
45
- enableBooleanParsing: Pe = !1,
46
- enableDateParsing: Ie = !1
1
+ import { jsxs as D, jsx as i } from "react/jsx-runtime";
2
+ import { useRef as Oe, useState as A, useEffect as Ee, useCallback as ue } from "react";
3
+ import { Filter as ot } from "lucide-react";
4
+ import { cn as at } from "../../../../lib/utils.js";
5
+ import { DatePicker as Re } from "../../date-picker/date-picker.js";
6
+ import { MonthPicker as je } from "../../date-picker/month-picker.js";
7
+ import { WeekPicker as qe } from "../../date-picker/week-picker.js";
8
+ import { Input as J } from "../../input.js";
9
+ import Le from "../../select/select.js";
10
+ import { Popover as it, PopoverTrigger as st, PopoverContent as dt, PopoverHeader as ct, PopoverTitle as ft, PopoverBody as ut } from "../../popover.js";
11
+ import { Cross as K } from "../../../../icons/index.js";
12
+ import { useGridHeader as mt } from "./context/grid-header-context.js";
13
+ import { getMultiFilterIndices as y, getDisplayStringFromFilterModel as Q, formatRuleForDisplay as ht, agToInternalOperator as pt, parseInputPattern as Ye, mapOperatorToAgGrid as Ge } from "./utils/filter-utils.js";
14
+ import { DEFAULT_DATE_DISPLAY_FORMAT as pe, deserializeDate as P, deserializeMonth as X, deserializeWeek as Z, serializeWeek as gt, serializeMonth as yt, serializeDate as Ft, displayDateToIso as me } from "./utils/date-utils.js";
15
+ import { useImpactNovaI18n as vt } from "../../../../i18n/ImpactNovaI18nContext.js";
16
+ function Ve(h, f, N, H, B = "date", k = pe) {
17
+ const F = f[h];
18
+ if (!F) return "";
19
+ let M = null;
20
+ if (F.filterType === "multi" && F.filterModels) {
21
+ const { date: x } = y(N);
22
+ x !== -1 && (M = F.filterModels[x]);
23
+ } else H && (M = F);
24
+ if (!M) return "";
25
+ if ("conditions" in M && M.conditions)
26
+ return he(M, k);
27
+ const W = M.type;
28
+ return !W || B === "date" && W === "equals" ? "" : he(M, k);
29
+ }
30
+ function he(h, f = pe) {
31
+ if ("conditions" in h && h.conditions && h.operator) {
32
+ const k = h.operator === "AND" ? "+" : ",";
33
+ return h.conditions.map((F) => he(F, f)).filter((F) => !!F).join(k);
34
+ }
35
+ const N = h.type, H = h.dateFrom, B = h.dateTo;
36
+ return N ? ht({
37
+ operator: pt[N] || N,
38
+ value: H || "",
39
+ valueTo: B,
40
+ columnType: "date"
41
+ }, f) : "";
42
+ }
43
+ const Wt = ({
44
+ column: h,
45
+ api: f,
46
+ onClose: N,
47
+ handleInlineSearch: H,
48
+ handleClearSearchInline: B,
49
+ onAdvanceSearchClick: k,
50
+ toggleAdvanceSearch: F,
51
+ advanceSearchEnabled: M = !1,
52
+ selectOptions: W,
53
+ isMultiSelect: x,
54
+ onSelectScrollToBottom: _e,
55
+ onSelectSearchChange: Ue,
56
+ onSelectOpen: ge,
57
+ isLoadingSelect: ye,
58
+ enableSpaceSplitting: Je = !1,
59
+ enableBooleanParsing: Ke = !1,
60
+ enableDateParsing: Qe = !1
47
61
  }) => {
48
- const { t: m } = Ue(), c = I.getColDef(), o = I.getColId(), R = c?.filter || "agTextColumnFilter", h = R === "agDateColumnFilter", j = R === "agSetColumnFilter" || k && k.length > 0 || c?.cellDataType === "boolean", Ae = c?.headerComponentParams?.datePickerVariant || "date", b = h && Ae === "month", $ = Ke(), O = he(null), ee = he(!1), [W, V] = w(() => {
49
- const t = u.getFilterModel()[o];
62
+ const { t: p } = vt(), a = h.getColDef(), d = h.getColId(), $ = a?.filter || "agTextColumnFilter", m = $ === "agDateColumnFilter", ee = $ === "agSetColumnFilter" || W && W.length > 0 || a?.cellDataType === "boolean", Y = a?.headerComponentParams?.datePickerVariant || "date", S = m && Y === "month", I = m && Y === "week", g = a?.headerComponentParams?.fiscalConfig, T = a?.headerComponentParams?.dateDisplayFormat || pe, Fe = mt(), te = Oe(null), le = Oe(!1), [re, ne] = A(() => {
63
+ const t = f.getFilterModel()[d];
50
64
  if (!t) return "";
51
65
  if (t.filterType === "multi" && t.filterModels) {
52
- const l = v(c), r = l.text !== -1 ? l.text : l.number;
53
- if (r !== -1) {
54
- const i = t.filterModels[r];
55
- if (i) return q(o, i);
66
+ const l = y(a), o = l.text !== -1 ? l.text : l.number;
67
+ if (o !== -1) {
68
+ const r = t.filterModels[o];
69
+ if (r) return Q(d, r);
56
70
  }
57
71
  return "";
58
72
  }
59
- return h ? "" : q(o, t);
60
- }), [te, f] = w(!1);
61
- pe(() => {
62
- ee.current = te;
63
- }, [te]);
64
- const [le, G] = w(() => {
65
- if (b) return null;
66
- const t = u.getFilterModel()[o];
73
+ return m ? "" : Q(d, t);
74
+ }), [ve, u] = A(!1), [G, oe] = A(() => {
75
+ if (!m) return "";
76
+ const e = f.getFilterModel();
77
+ return Ve(d, e, a, m, Y, T);
78
+ });
79
+ Ee(() => {
80
+ le.current = ve;
81
+ }, [ve]);
82
+ const [Me, ae] = A(() => {
83
+ if (S || I) return null;
84
+ const t = f.getFilterModel()[d];
67
85
  if (t) {
68
86
  if (t.filterType === "multi" && t.filterModels) {
69
- const { date: l } = v(c);
87
+ const { date: l } = y(a);
70
88
  if (l !== -1) {
71
- const r = t.filterModels[l];
72
- if (r) {
73
- if (r.dateFrom) return C(r.dateFrom);
74
- if (r.filter) return C(r.filter);
89
+ const o = t.filterModels[l];
90
+ if (o) {
91
+ if (o.dateFrom) return P(o.dateFrom);
92
+ if (o.filter) return P(o.filter);
75
93
  }
76
94
  }
77
95
  }
78
- if (h) {
79
- if (t.dateFrom) return C(t.dateFrom);
80
- if (t.filter) return C(t.filter);
96
+ if (m) {
97
+ if (t.dateFrom) return P(t.dateFrom);
98
+ if (t.filter) return P(t.filter);
99
+ }
100
+ }
101
+ return null;
102
+ }), [xe, ie] = A(() => {
103
+ if (!S) return null;
104
+ const t = f.getFilterModel()[d];
105
+ if (t) {
106
+ if (t.filterType === "multi" && t.filterModels) {
107
+ const { date: l } = y(a);
108
+ if (l !== -1) {
109
+ const o = t.filterModels[l];
110
+ if (o?.dateFrom) return X(o.dateFrom);
111
+ }
81
112
  }
113
+ if (m && t.dateFrom)
114
+ return X(t.dateFrom);
82
115
  }
83
116
  return null;
84
- }), [re, L] = w(() => {
85
- if (!b) return null;
86
- const t = u.getFilterModel()[o];
117
+ }), [Te, se] = A(() => {
118
+ if (!I) return null;
119
+ const t = f.getFilterModel()[d];
87
120
  if (t) {
88
121
  if (t.filterType === "multi" && t.filterModels) {
89
- const { date: l } = v(c);
122
+ const { date: l } = y(a);
90
123
  if (l !== -1) {
91
- const r = t.filterModels[l];
92
- if (r?.dateFrom) return E(r.dateFrom);
124
+ const o = t.filterModels[l];
125
+ if (o?.dateFrom && o?.dateTo)
126
+ return Z(o.dateFrom, o.dateTo);
93
127
  }
94
128
  }
95
- if (h && t.dateFrom)
96
- return E(t.dateFrom);
129
+ if (m && t.dateFrom && t.dateTo)
130
+ return Z(t.dateFrom, t.dateTo);
97
131
  }
98
132
  return null;
99
133
  });
100
- pe(() => {
134
+ Ee(() => {
101
135
  const e = () => {
102
- const l = u.getFilterModel()[o];
103
- let r = "";
136
+ const t = f.getFilterModel(), l = t[d];
137
+ let o = "";
104
138
  if (l)
105
139
  if (l.filterType === "multi" && l.filterModels) {
106
- const i = v(c), d = i.text !== -1 ? i.text : i.number;
107
- if (d !== -1) {
108
- const n = l.filterModels[d];
109
- r = n ? q(o, n) : "";
140
+ const r = y(a), n = r.text !== -1 ? r.text : r.number;
141
+ if (n !== -1) {
142
+ const s = l.filterModels[n];
143
+ o = s ? Q(d, s) : "";
110
144
  }
111
- } else h || (r = q(o, l));
112
- if (ee.current || V((i) => i !== r ? r : i), b) {
113
- let i = null;
145
+ } else m || (o = Q(d, l));
146
+ if (le.current || ne((r) => r !== o ? o : r), m && !le.current) {
147
+ const r = Ve(d, t, a, m, Y, T);
148
+ oe((n) => n !== r ? r : n);
149
+ }
150
+ if (I) {
151
+ let r = null;
152
+ if (l)
153
+ if (l.filterType === "multi" && l.filterModels) {
154
+ const { date: n } = y(a);
155
+ if (n !== -1) {
156
+ const s = l.filterModels[n];
157
+ s?.dateFrom && s?.dateTo && (r = Z(s.dateFrom, s.dateTo));
158
+ }
159
+ } else m && l.dateFrom && l.dateTo && (r = Z(l.dateFrom, l.dateTo));
160
+ se((n) => n === null && r === null ? n : n?.startDate?.getTime() !== r?.startDate?.getTime() || n?.endDate?.getTime() !== r?.endDate?.getTime() ? r : n);
161
+ } else if (S) {
162
+ let r = null;
114
163
  if (l)
115
164
  if (l.filterType === "multi" && l.filterModels) {
116
- const { date: d } = v(c);
117
- if (d !== -1) {
118
- const n = l.filterModels[d];
119
- n?.dateFrom && (i = E(n.dateFrom));
165
+ const { date: n } = y(a);
166
+ if (n !== -1) {
167
+ const s = l.filterModels[n];
168
+ s?.dateFrom && (r = X(s.dateFrom));
120
169
  }
121
- } else h && l.dateFrom && (i = E(l.dateFrom));
122
- L((d) => d === null && i === null ? d : d?.month !== i?.month || d?.year !== i?.year ? i : d);
170
+ } else m && l.dateFrom && (r = X(l.dateFrom));
171
+ ie((n) => n === null && r === null ? n : n?.month !== r?.month || n?.year !== r?.year ? r : n);
123
172
  } else {
124
- let i = null;
173
+ let r = null;
125
174
  if (l)
126
175
  if (l.filterType === "multi" && l.filterModels) {
127
- const { date: d } = v(c);
128
- if (d !== -1) {
129
- const n = l.filterModels[d];
130
- n && (i = n.dateFrom ? C(n.dateFrom) : n.filter ? C(n.filter) : null);
176
+ const { date: n } = y(a);
177
+ if (n !== -1) {
178
+ const s = l.filterModels[n];
179
+ s && (r = s.dateFrom ? P(s.dateFrom) : s.filter ? P(s.filter) : null);
131
180
  }
132
- } else h && (i = l.dateFrom ? C(l.dateFrom) : l.filter ? C(l.filter) : null);
133
- G((d) => d?.getTime() !== i?.getTime() ? i : d);
181
+ } else m && (r = l.dateFrom ? P(l.dateFrom) : l.filter ? P(l.filter) : null);
182
+ ae((n) => n?.getTime() !== r?.getTime() ? r : n);
134
183
  }
135
184
  };
136
- return u.addEventListener("filterChanged", e), () => {
137
- u.removeEventListener("filterChanged", e);
185
+ return f.addEventListener("filterChanged", e), () => {
186
+ f.removeEventListener("filterChanged", e);
138
187
  };
139
- }, [u, o, h, b]);
140
- const H = (e, t) => {
141
- const r = { ...u.getFilterModel() }, i = (n) => n.replace(/[^0-9.\-+eE]/g, ""), d = (n, x) => {
142
- const g = Qe(n, Ne, Pe, Ie);
188
+ }, [f, d, m, S, I]);
189
+ const O = (e, t) => {
190
+ const l = (c) => c.replace(/[^0-9.\-+eE]/g, ""), o = (c, q) => {
191
+ const R = Ye(c, Je, Ke, Qe);
143
192
  if (console.log("[HeaderSearchInput] Pattern Debug:", {
144
- input: n,
145
- filterType: x,
146
- parsed: g
147
- }), g.conditions.length === 0) return null;
148
- const P = (s) => {
149
- let T = Xe[s.operator] || "contains";
150
- if (x === "number") {
151
- const me = parseFloat(i(s.value));
152
- return ["contains", "notContains", "startsWith", "endsWith"].includes(T) && (T = T === "notContains" ? "notEqual" : "equals"), s.operator === "inRange" ? {
153
- type: T,
154
- filter: parseFloat(i(s.value)) || 0,
155
- filterTo: parseFloat(i(s.valueTo || "")) || 0,
193
+ input: c,
194
+ filterType: q,
195
+ parsed: R
196
+ }), R.conditions.length === 0) return null;
197
+ const Be = (v) => {
198
+ let w = Ge(v.operator);
199
+ if (q === "number") {
200
+ const We = parseFloat(l(v.value));
201
+ return ["contains", "notContains", "startsWith", "endsWith"].includes(w) && (w = w === "notContains" ? "notEqual" : "equals"), v.operator === "inRange" ? {
202
+ type: w,
203
+ filter: parseFloat(l(v.value)) || 0,
204
+ filterTo: parseFloat(l(v.valueTo || "")) || 0,
156
205
  filterType: "number"
157
- } : isNaN(me) ? null : { type: T, filter: me, filterType: "number" };
206
+ } : isNaN(We) ? null : { type: w, filter: We, filterType: "number" };
158
207
  }
159
208
  return {
160
- type: T,
161
- filter: s.value,
162
- filterTo: s.valueTo,
209
+ type: w,
210
+ filter: v.value,
211
+ filterTo: v.valueTo,
163
212
  filterType: "text"
164
213
  };
165
214
  };
166
- let p = null;
167
- if (g.conditions.length === 1)
168
- p = P(g.conditions[0]);
215
+ let L = null;
216
+ if (R.conditions.length === 1)
217
+ L = Be(R.conditions[0]);
169
218
  else {
170
- const s = g.conditions.map(P).filter((T) => T !== null);
171
- s.length === 0 ? p = null : s.length === 1 ? p = s[0] : p = {
172
- filterType: x,
173
- operator: g.logic,
174
- conditions: s
219
+ const v = R.conditions.map(Be).filter((w) => w !== null);
220
+ v.length === 0 ? L = null : v.length === 1 ? L = v[0] : L = {
221
+ filterType: q,
222
+ operator: R.logic,
223
+ conditions: v
175
224
  };
176
225
  }
177
- return console.log("[HeaderSearchInput] Resulting Model:", p), p;
226
+ return L;
178
227
  };
179
- if (c.filter === "agMultiColumnFilter") {
180
- const n = v(c), x = t === "text" ? n.text !== -1 ? n.text : n.number : t === "set" ? n.set : n.date;
181
- if (x === -1) return;
182
- const g = u.getFilterModel()[o], P = g && g.filterType === "multi" ? [...g.filterModels || []] : Array(c.filterParams?.filters?.length || 1).fill(null);
183
- let p = null;
184
- if (e !== null && e !== "" && (!Array.isArray(e) || e.length > 0))
185
- if (t === "set")
186
- p = { values: Array.isArray(e) ? e : [String(e)], filterType: "set" };
187
- else if (t === "date")
188
- if (b && e && typeof e == "object" && "month" in e && "year" in e) {
189
- const s = ve(e);
190
- p = { type: "inRange", dateFrom: s.dateFrom, dateTo: s.dateTo, filterType: "date" };
191
- } else {
192
- const s = e instanceof Date ? be(e) : null;
193
- p = s ? { type: "equals", dateFrom: s, filterType: "date" } : null;
194
- }
195
- else {
196
- const s = n.text !== -1 ? "text" : "number";
197
- p = d(String(e), s);
228
+ let r = null;
229
+ if (!(e === null || e === "" || Array.isArray(e) && e.length === 0))
230
+ if (t === "set")
231
+ r = { values: Array.isArray(e) ? e : [String(e)], filterType: "set" };
232
+ else if (t === "date")
233
+ if (I && e && typeof e == "object" && "startDate" in e && "endDate" in e) {
234
+ const c = gt(e);
235
+ r = { type: "inRange", dateFrom: c.dateFrom, dateTo: c.dateTo, filterType: "date" };
236
+ } else if (S && e && typeof e == "object" && "month" in e && "year" in e) {
237
+ const c = yt(e);
238
+ r = { type: "inRange", dateFrom: c.dateFrom, dateTo: c.dateTo, filterType: "date" };
239
+ } else {
240
+ const c = e instanceof Date ? Ft(e) : null;
241
+ r = c ? { type: "equals", dateFrom: c, filterType: "date" } : null;
198
242
  }
199
- P[x] = p, P.every((s) => s === null) ? delete r[o] : r[o] = { filterType: "multi", filterModels: P };
200
- } else if (e === null || e === "" || Array.isArray(e) && e.length === 0)
201
- delete r[o];
202
- else if (t === "date")
203
- if (b && e && typeof e == "object" && "month" in e && "year" in e) {
204
- const n = ve(e);
205
- r[o] = { type: "inRange", dateFrom: n.dateFrom, dateTo: n.dateTo, filterType: "date" };
206
- } else {
207
- const n = e instanceof Date ? be(e) : null;
208
- r[o] = n ? { type: "equals", dateFrom: n, filterType: "date" } : null;
243
+ else {
244
+ const c = a.filter === "agMultiColumnFilter" ? y(a) : null, q = c ? c.text !== -1 ? "text" : "number" : $ === "agNumberColumnFilter" ? "number" : "text";
245
+ r = o(String(e), q);
209
246
  }
210
- else if (t === "set")
211
- r[o] = { filterType: "set", values: Array.isArray(e) ? e : [String(e)] };
212
- else {
213
- const n = R === "agNumberColumnFilter" ? "number" : "text", x = d(String(e), n);
214
- x ? r[o] = x : delete r[o];
215
- }
216
- console.log("[HeaderSearchInput] Final Model Applied:", {
217
- column: o,
218
- model: r[o]
219
- }), u.setFilterModel(r), u.onFilterChanged();
220
- }, _ = (e) => {
221
- if (K) {
222
- K(Array.isArray(e) ? e.join(",") : e);
247
+ const s = a.filter === "agMultiColumnFilter" ? y(a) : null, z = s ? t === "text" ? s.text !== -1 ? s.text : s.number : t === "set" ? s.set : s.date : 0;
248
+ ce(r, z);
249
+ }, de = (e) => {
250
+ if (H) {
251
+ H(Array.isArray(e) ? e.join(",") : e);
223
252
  return;
224
253
  }
225
- H(e, h ? "date" : "text");
226
- }, ne = (e) => {
254
+ O(e, m ? "date" : "text");
255
+ }, be = (e) => {
227
256
  const t = e.target.value;
228
- V(t), _(t);
229
- }, oe = (e) => {
230
- G(e), _(e);
231
- }, ie = (e) => {
232
- L(e), H(e || null, "date");
233
- }, we = () => {
234
- V(""), G(null), L(null), _(""), Q && Q();
235
- }, z = (e) => {
236
- H(e, "set");
237
- }, S = k || (c?.cellDataType === "boolean" ? [{ label: m("gridHeader.true"), value: "true" }, { label: m("gridHeader.false"), value: "false" }] : []), se = Re(() => {
238
- const e = u.getFilterModel()[o];
257
+ ne(t), de(t);
258
+ }, Ce = (e) => {
259
+ ae(e), de(e);
260
+ }, De = (e) => {
261
+ ie(e), O(e || null, "date");
262
+ }, Ne = (e) => {
263
+ se(e), O(e || null, "date");
264
+ }, Xe = (e) => {
265
+ if (!e.trim()) return null;
266
+ const t = Ye(e, !1, !1, !1);
267
+ if (t.conditions.length === 0) return null;
268
+ const l = (r) => {
269
+ let n = Ge(r.operator);
270
+ if (["contains", "notContains", "startsWith", "endsWith"].includes(n) && (n = n === "notContains" ? "notEqual" : "equals"), r.operator === "inRange") {
271
+ let z = me(r.value, T), c = me(r.valueTo || "", T);
272
+ return !z || !c ? null : (z > c && ([z, c] = [c, z]), { type: "inRange", dateFrom: z, dateTo: c, filterType: "date" });
273
+ }
274
+ const s = me(r.value, T);
275
+ return s ? { type: n, dateFrom: s, filterType: "date" } : null;
276
+ };
277
+ if (t.conditions.length === 1)
278
+ return l(t.conditions[0]);
279
+ const o = t.conditions.map(l).filter((r) => r !== null);
280
+ return o.length === 0 ? null : o.length === 1 ? o[0] : {
281
+ filterType: "date",
282
+ operator: t.logic,
283
+ conditions: o
284
+ };
285
+ }, ce = ue((e, t) => {
286
+ const l = f.getFilterModel(), o = { ...l };
287
+ if (a.filter === "agMultiColumnFilter") {
288
+ if (t === -1) return;
289
+ const r = l[d], n = r && r.filterType === "multi" ? [...r.filterModels || []] : Array(a.filterParams?.filters?.length || 1).fill(null);
290
+ n[t] = e, n.every((s) => s === null) ? delete o[d] : o[d] = { filterType: "multi", filterModels: n };
291
+ } else
292
+ e ? o[d] = e : delete o[d];
293
+ f.setFilterModel(o), f.onFilterChanged();
294
+ }, [f, d, a]), we = ue((e) => {
295
+ const t = a.filter === "agMultiColumnFilter" ? y(a).date : 0;
296
+ ce(e, t);
297
+ }, [a, ce]), Pe = (e) => {
298
+ const t = e.target.value.replace(/[^0-9/\-!=><+,~]/g, "");
299
+ if (oe(t), !t.trim()) {
300
+ we(null);
301
+ return;
302
+ }
303
+ const l = Xe(t);
304
+ l && we(l);
305
+ }, fe = () => {
306
+ ne(""), ae(null), ie(null), se(null), oe(""), de(""), B && B();
307
+ }, V = (e) => {
308
+ O(e, "set");
309
+ }, _ = W || (a?.cellDataType === "boolean" ? [{ label: p("gridHeader.true"), value: "true" }, { label: p("gridHeader.false"), value: "false" }] : []), ke = ue(() => {
310
+ const e = f.getFilterModel()[d];
239
311
  if (!e) return [];
240
312
  if ("filterType" in e && e.filterType === "multi" && e.filterModels) {
241
- const l = v(I.getColDef()).set;
313
+ const l = y(h.getColDef()).set;
242
314
  if (l !== -1) {
243
- const r = e.filterModels[l];
244
- if (r?.filterType === "set" && r.values) return r.values;
315
+ const o = e.filterModels[l];
316
+ if (o?.filterType === "set" && o.values) return o.values;
245
317
  }
246
318
  } else {
247
319
  if (e.filterType === "set" && "values" in e)
@@ -250,174 +322,236 @@ const Xe = {
250
322
  return [String(e.filter)];
251
323
  }
252
324
  return [];
253
- }, [u, o, I]), [B, A] = w(null), ae = () => {
254
- const e = B !== null ? B : se();
255
- return D ? S.filter((t) => e.includes(t.value)) : S.find((t) => e.includes(t.value)) || null;
256
- }, de = (e) => {
325
+ }, [f, d, h]), [U, j] = A(null), Se = () => {
326
+ const e = U !== null ? U : ke();
327
+ return x ? _.filter((t) => e.includes(t.value)) : _.find((t) => e.includes(t.value)) || null;
328
+ }, Ie = (e) => {
257
329
  let t = [];
258
- if (Array.isArray(e) ? t = e.map((l) => l.value) : e && typeof e == "object" && "value" in e && (t = [e.value]), !D) {
259
- z(t), e && J();
330
+ if (Array.isArray(e) ? t = e.map((l) => l.value) : e && typeof e == "object" && "value" in e && (t = [e.value]), !x) {
331
+ V(t), e && N();
260
332
  return;
261
333
  }
262
- A(t);
263
- }, He = () => {
264
- z([]), A([]);
265
- }, ze = (e) => {
266
- if (D) {
334
+ j(t);
335
+ }, Ze = () => {
336
+ V([]), j([]);
337
+ }, $e = (e) => {
338
+ if (x) {
267
339
  if (e !== void 0) {
268
340
  let t = [];
269
- Array.isArray(e) ? t = e.map((l) => l.value) : e && typeof e == "object" && "value" in e ? t = [e.value] : e === null && (t = []), z(t), A(null);
341
+ Array.isArray(e) ? t = e.map((l) => l.value) : e && typeof e == "object" && "value" in e ? t = [e.value] : e === null && (t = []), V(t), j(null);
270
342
  return;
271
343
  }
272
- B !== null && (z(B), A(null));
344
+ U !== null && (V(U), j(null));
273
345
  }
274
- }, Se = () => {
275
- A(se()), Y && Y();
276
- }, Be = () => Te ? /* @__PURE__ */ a("svg", { className: "cursor-pointer text-navigation-muted hover:text-brand-variant-hover shrink-0", fill: "currentColor", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", width: "18", height: "18", onClick: (e) => {
277
- e.stopPropagation(), O.current && O.current.blur(), U ? U(I) : X ? X(o) : $ && $.openAdvancedFilter(o);
278
- }, children: /* @__PURE__ */ a("path", { d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z" }) }) : null, qe = () => /* @__PURE__ */ a("button", { onClick: J, className: "cursor-pointer shrink-0 text-brand hover:text-brand-strong", children: /* @__PURE__ */ a(Me, { size: "xs" }) }), N = c.filter === "agMultiColumnFilter", y = v(c);
279
- let F = "text";
280
- N ? F = y.set !== -1 ? "set" : y.date !== -1 ? "date" : "text" : j ? F = "set" : h && (F = "date");
281
- const Ee = N ? y.text !== -1 || y.number !== -1 : !h && !j, ce = N ? y.set !== -1 : j, fe = N ? y.date !== -1 : h, ke = u.getFilterModel()[o], ue = N && ke?.filterModels?.some((e, t) => {
282
- const l = t === y.text || t === y.number ? "text" : t === y.set ? "set" : "date";
283
- return e !== null && l !== F;
346
+ }, et = () => {
347
+ j(ke()), ge && ge();
348
+ }, tt = () => M ? /* @__PURE__ */ i("svg", { className: "cursor-pointer text-navigation-muted hover:text-brand-variant-hover shrink-0", fill: "currentColor", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", width: "18", height: "18", onClick: (e) => {
349
+ e.stopPropagation(), te.current && te.current.blur(), k ? k(h) : F ? F(d) : Fe && Fe.openAdvancedFilter(d);
350
+ }, children: /* @__PURE__ */ i("path", { d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z" }) }) : null, lt = () => /* @__PURE__ */ i("button", { onClick: N, className: "cursor-pointer shrink-0 text-brand hover:text-brand-strong", children: /* @__PURE__ */ i(K, { size: "xs" }) }), E = a.filter === "agMultiColumnFilter", b = y(a);
351
+ let C = "text";
352
+ E ? C = b.set !== -1 ? "set" : b.date !== -1 ? "date" : "text" : ee ? C = "set" : m && (C = "date");
353
+ const rt = E ? b.text !== -1 || b.number !== -1 : !m && !ee, ze = E ? b.set !== -1 : ee, Ae = E ? b.date !== -1 : m, nt = f.getFilterModel()[d], He = E && nt?.filterModels?.some((e, t) => {
354
+ const l = t === b.text || t === b.number ? "text" : t === b.set ? "set" : "date";
355
+ return e !== null && l !== C;
284
356
  });
285
- return /* @__PURE__ */ M("div", { className: "ag-header-cell-label flex items-center gap-1 w-full bg-brand-tint px-1 py-2 ag-header-cell-search-active h-full", children: [
286
- F === "set" && ce ? /* @__PURE__ */ a(
287
- xe,
357
+ return /* @__PURE__ */ D("div", { className: "ag-header-cell-label flex items-center gap-1 w-full bg-brand-tint px-1 py-2 ag-header-cell-search-active h-full", children: [
358
+ C === "set" && ze ? /* @__PURE__ */ i(
359
+ Le,
288
360
  {
289
- options: S,
290
- value: ae(),
291
- onChange: de,
292
- isMulti: D !== void 0 ? D : c?.cellDataType !== "boolean",
293
- placeholder: m("filter.select"),
361
+ options: _,
362
+ value: Se(),
363
+ onChange: Ie,
364
+ isMulti: x !== void 0 ? x : a?.cellDataType !== "boolean",
365
+ placeholder: p("filter.select"),
294
366
  className: "w-full bg-canvas-elevated",
295
367
  parentClassName: "flex-1 min-w-0",
296
368
  menuWidth: "200px",
297
369
  menuPortalTarget: document.body,
298
370
  autoFocus: !0,
299
- onMenuOpen: Se,
300
- onMenuClose: ze,
301
- onMenuScrollToBottom: Ce,
302
- onInputChange: De,
303
- onClearAll: He,
304
- isLoading: Z,
305
- onFocus: () => f(!0),
306
- onBlur: () => f(!1)
371
+ onMenuOpen: et,
372
+ onMenuClose: $e,
373
+ onMenuScrollToBottom: _e,
374
+ onInputChange: Ue,
375
+ onClearAll: Ze,
376
+ isLoading: ye,
377
+ onFocus: () => u(!0),
378
+ onBlur: () => u(!1)
379
+ }
380
+ ) : C === "date" && Ae ? G ? /* @__PURE__ */ i(
381
+ J,
382
+ {
383
+ value: G,
384
+ onChange: Pe,
385
+ placeholder: p("filter.search"),
386
+ className: "w-full bg-canvas-elevated",
387
+ autoFocus: !0,
388
+ onFocus: () => u(!0),
389
+ onBlur: () => u(!1),
390
+ suffix: /* @__PURE__ */ i("button", { onClick: (e) => {
391
+ e.stopPropagation(), fe();
392
+ }, className: "cursor-pointer text-navigation-muted hover:text-brand-variant-hover", children: /* @__PURE__ */ i(K, { size: "xs" }) })
393
+ }
394
+ ) : I ? /* @__PURE__ */ i(
395
+ qe,
396
+ {
397
+ value: Te || void 0,
398
+ onChange: (e) => Ne(e || null),
399
+ placeholder: p("datePicker.selectWeek"),
400
+ format: T,
401
+ minDate: /* @__PURE__ */ new Date("2000-01-01"),
402
+ maxDate: /* @__PURE__ */ new Date("2100-12-31"),
403
+ className: "w-full bg-canvas-elevated",
404
+ showFooter: !1,
405
+ calendarType: g?.calendarType,
406
+ fiscalMode: g?.fiscalMode,
407
+ selectionMode: g?.selectionMode,
408
+ fiscalMonthPattern: g?.fiscalMonthPattern,
409
+ fiscalYearStartMonth: g?.fiscalYearStartMonth,
410
+ weekStartsOn: g?.weekStartsOn
307
411
  }
308
- ) : F === "date" && fe ? b ? /* @__PURE__ */ a(
309
- ye,
412
+ ) : S ? /* @__PURE__ */ i(
413
+ je,
310
414
  {
311
- value: re || void 0,
312
- onChange: (e) => ie(e || null),
313
- placeholder: m("filter.selectMonth"),
415
+ value: xe || void 0,
416
+ onChange: (e) => De(e || null),
417
+ placeholder: p("datePicker.selectMonth"),
314
418
  minDate: /* @__PURE__ */ new Date("2000-01-01"),
315
419
  maxDate: /* @__PURE__ */ new Date("2100-12-31"),
316
420
  className: "w-full bg-canvas-elevated",
317
421
  showFooter: !1,
318
- onFocus: () => f(!0),
319
- onBlur: () => f(!1)
422
+ onFocus: () => u(!0),
423
+ onBlur: () => u(!1)
320
424
  }
321
- ) : /* @__PURE__ */ a(
322
- ge,
425
+ ) : /* @__PURE__ */ i(
426
+ Re,
323
427
  {
324
- value: le || void 0,
325
- onChange: (e) => oe(e || null),
326
- placeholder: m("filter.selectDate"),
327
- format: "MM-dd-yyyy",
428
+ value: Me || void 0,
429
+ onChange: (e) => Ce(e || null),
430
+ placeholder: p("filter.selectDate"),
431
+ format: T,
328
432
  minDate: /* @__PURE__ */ new Date("2000-01-01"),
329
433
  maxDate: /* @__PURE__ */ new Date("2100-12-31"),
330
434
  className: "w-full bg-canvas-elevated",
331
- onFocus: () => f(!0),
332
- onBlur: () => f(!1)
435
+ weekStartsOn: g?.weekStartsOn,
436
+ onFocus: () => u(!0),
437
+ onBlur: () => u(!1)
333
438
  }
334
- ) : /* @__PURE__ */ a(
335
- Fe,
439
+ ) : /* @__PURE__ */ i(
440
+ J,
336
441
  {
337
- value: W,
338
- onChange: ne,
339
- placeholder: m("filter.search"),
442
+ value: re,
443
+ onChange: be,
444
+ placeholder: p("filter.search"),
340
445
  type: "text",
341
446
  autoFocus: !0,
342
- ref: O,
343
- onFocus: () => f(!0),
344
- onBlur: () => f(!1),
345
- suffix: W && /* @__PURE__ */ a("button", { onClick: (e) => {
346
- e.stopPropagation(), we();
347
- }, className: "cursor-pointer text-navigation-muted hover:text-brand-variant-hover", children: /* @__PURE__ */ a(Me, { size: "xs" }) })
447
+ ref: te,
448
+ onFocus: () => u(!0),
449
+ onBlur: () => u(!1),
450
+ suffix: re && /* @__PURE__ */ i("button", { onClick: (e) => {
451
+ e.stopPropagation(), fe();
452
+ }, className: "cursor-pointer text-navigation-muted hover:text-brand-variant-hover", children: /* @__PURE__ */ i(K, { size: "xs" }) })
348
453
  }
349
454
  ),
350
- /* @__PURE__ */ M("div", { className: "flex items-center gap-1.5 shrink-0", children: [
351
- N && /* @__PURE__ */ M(We, { children: [
352
- /* @__PURE__ */ a(Ve, { asChild: !0, children: /* @__PURE__ */ M("div", { className: "relative group p-1 hover:bg-brand-tint rounded-md transition-colors cursor-pointer", children: [
353
- /* @__PURE__ */ a(je, { size: "md", className: Oe("text-content-tertiary group-hover:text-brand-variant-hover", ue && "text-brand-variant-hover") }),
354
- ue && /* @__PURE__ */ a("span", { className: "absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-brand border border-white shadow-sm" })
455
+ /* @__PURE__ */ D("div", { className: "flex items-center gap-1.5 shrink-0", children: [
456
+ E && /* @__PURE__ */ D(it, { children: [
457
+ /* @__PURE__ */ i(st, { asChild: !0, children: /* @__PURE__ */ D("div", { className: "relative group p-1 hover:bg-brand-tint rounded-md transition-colors cursor-pointer", children: [
458
+ /* @__PURE__ */ i(ot, { size: "md", className: at("text-content-tertiary group-hover:text-brand-variant-hover", He && "text-brand-variant-hover") }),
459
+ He && /* @__PURE__ */ i("span", { className: "absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-brand border border-white shadow-sm" })
355
460
  ] }) }),
356
- /* @__PURE__ */ M(Ge, { align: "end", className: "w-[300px]", children: [
357
- /* @__PURE__ */ a(Le, { children: /* @__PURE__ */ a(_e, { children: m("gridHeader.activeFilters") }) }),
358
- /* @__PURE__ */ M(Je, { className: "flex flex-col gap-4", children: [
359
- F !== "text" && Ee && /* @__PURE__ */ M("div", { className: "flex flex-col gap-1.5", children: [
360
- /* @__PURE__ */ a("span", { className: "text-xs font-semibold text-content-tertiary", children: m("gridHeader.textSearch") }),
361
- /* @__PURE__ */ a(
362
- Fe,
461
+ /* @__PURE__ */ D(dt, { align: "end", className: "w-[300px]", children: [
462
+ /* @__PURE__ */ i(ct, { children: /* @__PURE__ */ i(ft, { children: p("gridHeader.activeFilters") }) }),
463
+ /* @__PURE__ */ D(ut, { className: "flex flex-col gap-4", children: [
464
+ C !== "text" && rt && /* @__PURE__ */ D("div", { className: "flex flex-col gap-1.5", children: [
465
+ /* @__PURE__ */ i("span", { className: "text-xs font-semibold text-content-tertiary", children: p("gridHeader.textSearch") }),
466
+ /* @__PURE__ */ i(
467
+ J,
363
468
  {
364
- value: W,
365
- onChange: ne,
366
- placeholder: m("filter.searchPlaceholder"),
469
+ value: re,
470
+ onChange: be,
471
+ placeholder: p("filter.searchPlaceholder"),
367
472
  className: "bg-canvas-elevated",
368
- onFocus: () => f(!0),
369
- onBlur: () => f(!1)
473
+ onFocus: () => u(!0),
474
+ onBlur: () => u(!1)
370
475
  }
371
476
  )
372
477
  ] }),
373
- F !== "set" && ce && /* @__PURE__ */ M("div", { className: "flex flex-col gap-1.5", children: [
374
- /* @__PURE__ */ a("span", { className: "text-xs font-semibold text-content-tertiary", children: m("gridHeader.selectionFilter") }),
375
- /* @__PURE__ */ a(
376
- xe,
478
+ C !== "set" && ze && /* @__PURE__ */ D("div", { className: "flex flex-col gap-1.5", children: [
479
+ /* @__PURE__ */ i("span", { className: "text-xs font-semibold text-content-tertiary", children: p("gridHeader.selectionFilter") }),
480
+ /* @__PURE__ */ i(
481
+ Le,
377
482
  {
378
- options: S,
379
- value: ae(),
380
- onChange: de,
381
- isMulti: D !== void 0 ? D : c?.cellDataType !== "boolean",
382
- placeholder: m("filter.select"),
483
+ options: _,
484
+ value: Se(),
485
+ onChange: Ie,
486
+ isMulti: x !== void 0 ? x : a?.cellDataType !== "boolean",
487
+ placeholder: p("filter.select"),
383
488
  className: "w-full bg-canvas-elevated",
384
- isLoading: Z,
385
- onFocus: () => f(!0),
386
- onBlur: () => f(!1)
489
+ isLoading: ye,
490
+ onFocus: () => u(!0),
491
+ onBlur: () => u(!1)
387
492
  }
388
493
  )
389
494
  ] }),
390
- F !== "date" && fe && /* @__PURE__ */ M("div", { className: "flex flex-col gap-1.5", children: [
391
- /* @__PURE__ */ a("span", { className: "text-xs font-semibold text-content-tertiary", children: m("gridHeader.dateFilter") }),
392
- b ? /* @__PURE__ */ a(
393
- ye,
495
+ C !== "date" && Ae && /* @__PURE__ */ D("div", { className: "flex flex-col gap-1.5", children: [
496
+ /* @__PURE__ */ i("span", { className: "text-xs font-semibold text-content-tertiary", children: p("gridHeader.dateFilter") }),
497
+ G ? /* @__PURE__ */ i(
498
+ J,
499
+ {
500
+ value: G,
501
+ onChange: Pe,
502
+ className: "w-full bg-canvas-elevated",
503
+ onFocus: () => u(!0),
504
+ onBlur: () => u(!1),
505
+ suffix: /* @__PURE__ */ i("button", { onClick: (e) => {
506
+ e.stopPropagation(), fe();
507
+ }, className: "cursor-pointer text-navigation-muted hover:text-brand-variant-hover", children: /* @__PURE__ */ i(K, { size: "xs" }) })
508
+ }
509
+ ) : I ? /* @__PURE__ */ i(
510
+ qe,
511
+ {
512
+ value: Te || void 0,
513
+ onChange: (e) => Ne(e || null),
514
+ format: T,
515
+ className: "w-full bg-canvas-elevated",
516
+ showFooter: !1,
517
+ calendarType: g?.calendarType,
518
+ fiscalMode: g?.fiscalMode,
519
+ selectionMode: g?.selectionMode,
520
+ fiscalMonthPattern: g?.fiscalMonthPattern,
521
+ fiscalYearStartMonth: g?.fiscalYearStartMonth,
522
+ weekStartsOn: g?.weekStartsOn
523
+ }
524
+ ) : S ? /* @__PURE__ */ i(
525
+ je,
394
526
  {
395
- value: re || void 0,
396
- onChange: (e) => ie(e || null),
527
+ value: xe || void 0,
528
+ onChange: (e) => De(e || null),
397
529
  className: "w-full bg-canvas-elevated",
398
530
  showFooter: !1,
399
- onFocus: () => f(!0),
400
- onBlur: () => f(!1)
531
+ onFocus: () => u(!0),
532
+ onBlur: () => u(!1)
401
533
  }
402
- ) : /* @__PURE__ */ a(
403
- ge,
534
+ ) : /* @__PURE__ */ i(
535
+ Re,
404
536
  {
405
- value: le || void 0,
406
- onChange: (e) => oe(e || null),
537
+ value: Me || void 0,
538
+ onChange: (e) => Ce(e || null),
539
+ format: T,
407
540
  className: "w-full bg-canvas-elevated",
408
- onFocus: () => f(!0),
409
- onBlur: () => f(!1)
541
+ weekStartsOn: g?.weekStartsOn,
542
+ onFocus: () => u(!0),
543
+ onBlur: () => u(!1)
410
544
  }
411
545
  )
412
546
  ] })
413
547
  ] })
414
548
  ] })
415
549
  ] }),
416
- Be(),
417
- qe()
550
+ tt(),
551
+ lt()
418
552
  ] })
419
553
  ] });
420
554
  };
421
555
  export {
422
- ut as HeaderSearchInput
556
+ Wt as HeaderSearchInput
423
557
  };