impact-nova 1.7.10 → 1.7.12

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,117 +1,134 @@
1
- import { jsxs as U, jsx as a } from "react/jsx-runtime";
2
- import { lazy as V, useRef as D, useState as f, useCallback as v, useMemo as y, useEffect as W, Suspense as _ } from "react";
3
- import { ModuleRegistry as $, AllCommunityModule as q, ValidationModule as K } from "ag-grid-community";
4
- import { AllEnterpriseModule as z } from "ag-grid-enterprise";
5
- import { AgGridReact as J } from "ag-grid-react";
6
- import { customAgGridTheme as X } from "./theme.js";
7
- import { CustomHeader as B } from "./headers/custom-header.js";
8
- import { CustomHeaderGroup as Q } from "./headers/custom-header-group.js";
9
- import { GridHeaderContext as Y } from "./headers/context/grid-header-context.js";
10
- import { convertToAgGridFilterModel as Z, getMultiFilterIndices as ee, convertFromAgGridFilterModel as te } from "./headers/utils/filter-utils.js";
11
- import { ColumnSettingsMenu as re } from "./headers/column-menu/column-settings-menu.js";
12
- import { AG_GRID_VALUE_FORMATTERS as ne } from "./value-formatters.js";
1
+ import { jsxs as re, jsx as g } from "react/jsx-runtime";
2
+ import { lazy as oe, useRef as _, useState as v, useCallback as y, useMemo as b, useEffect as le, Suspense as ie } from "react";
3
+ import { ModuleRegistry as ae, AllCommunityModule as ue, ValidationModule as se } from "ag-grid-community";
4
+ import { AllEnterpriseModule as ce } from "ag-grid-enterprise";
5
+ import { AgGridReact as de } from "ag-grid-react";
6
+ import { customAgGridTheme as me } from "./theme.js";
7
+ import { CustomHeader as pe } from "./headers/custom-header.js";
8
+ import { CustomHeaderGroup as fe } from "./headers/custom-header-group.js";
9
+ import { GridHeaderContext as ge } from "./headers/context/grid-header-context.js";
10
+ import { convertToAgGridFilterModel as he, getMultiFilterIndices as Ce, convertFromAgGridFilterModel as ve } from "./headers/utils/filter-utils.js";
11
+ import { ColumnSettingsMenu as ye } from "./headers/column-menu/column-settings-menu.js";
12
+ import { AG_GRID_VALUE_FORMATTERS as be } from "./value-formatters.js";
13
+ import { resolveValueFormatter as xe, applyValueFormatter as Fe } from "./cell-renderers/cell-renderer-utils.js";
13
14
  /* empty css */
14
- const oe = V(() => import("./headers/advanced-filter/advanced-filter-dialog.js"));
15
- $.registerModules([q, z, K]);
16
- function ye({
17
- children: c,
18
- defaultColDef: o,
19
- defaultColGroupDef: i,
20
- columnDefs: g,
21
- valueFormatters: d,
22
- onGridReady: m,
23
- ...u
15
+ const Me = oe(() => import("./headers/advanced-filter/advanced-filter-dialog.js"));
16
+ ae.registerModules([ue, ce, se]);
17
+ const D = "", W = (a) => {
18
+ if (typeof navigator < "u" && navigator.clipboard?.writeText) {
19
+ navigator.clipboard.writeText(a).catch(() => K(a));
20
+ return;
21
+ }
22
+ K(a);
23
+ }, K = (a) => {
24
+ if (typeof document > "u") return;
25
+ const r = document.createElement("textarea");
26
+ r.value = a, r.setAttribute("readonly", ""), r.style.position = "fixed", r.style.top = "0", r.style.left = "0", r.style.opacity = "0", r.style.pointerEvents = "none", document.body.appendChild(r);
27
+ try {
28
+ r.select(), document.execCommand("copy");
29
+ } finally {
30
+ document.body.removeChild(r);
31
+ }
32
+ };
33
+ function Ve({
34
+ children: a,
35
+ defaultColDef: r,
36
+ defaultColGroupDef: s,
37
+ columnDefs: x,
38
+ valueFormatters: h,
39
+ onGridReady: C,
40
+ ...i
24
41
  }) {
25
- const r = D(null), s = D(null), [h, M] = f(null), [x, C] = f(!1), [b, G] = f(null), [R, S] = f(!1), [A, k] = f(null), [N, E] = f(null), O = v((e) => {
26
- if (!r.current) return;
27
- const t = Z(e);
28
- r.current.setFilterModel(t), r.current.onFilterChanged();
29
- }, []), F = y(() => ({
42
+ const o = _(null), f = _(null), [F, k] = v(null), [j, M] = v(!1), [R, w] = v(null), [U, I] = v(!1), [O, P] = v(null), [$, N] = v(null), L = y((e) => {
43
+ if (!o.current) return;
44
+ const t = he(e);
45
+ o.current.setFilterModel(t), o.current.onFilterChanged();
46
+ }, []), E = b(() => ({
30
47
  openSearch: (e) => {
31
- if (!r.current) return;
32
- const t = r.current.getGridOption("context") || {};
33
- r.current.setGridOption("context", { ...t, activeSearchColumnId: e }), r.current.refreshHeader();
48
+ if (!o.current) return;
49
+ const t = o.current.getGridOption("context") || {};
50
+ o.current.setGridOption("context", { ...t, activeSearchColumnId: e }), o.current.refreshHeader();
34
51
  },
35
52
  closeSearch: () => {
36
- if (!r.current) return;
37
- const e = r.current.getGridOption("context") || {};
38
- r.current.setGridOption("context", { ...e, activeSearchColumnId: null }), r.current.refreshHeader();
53
+ if (!o.current) return;
54
+ const e = o.current.getGridOption("context") || {};
55
+ o.current.setGridOption("context", { ...e, activeSearchColumnId: null }), o.current.refreshHeader();
39
56
  },
40
57
  openAdvancedFilter: (e) => {
41
- G(e || null), C(!0);
58
+ w(e || null), M(!0);
42
59
  },
43
60
  closeAdvancedFilter: () => {
44
- C(!1), G(null);
61
+ M(!1), w(null);
45
62
  },
46
63
  applyAdvancedFilter: (e) => {
47
- O(e);
64
+ L(e);
48
65
  },
49
66
  openMenu: (e, t) => {
50
- k(e), E(t), S(!0);
67
+ P(e), N(t), I(!0);
51
68
  },
52
69
  closeMenu: () => {
53
- S(!1), k(null), E(null);
70
+ I(!1), P(null), N(null);
54
71
  },
55
- activeMenuColumnId: A
56
- }), [O, A]), T = v((e) => {
57
- r.current = e.api, M(e.api);
72
+ activeMenuColumnId: O
73
+ }), [L, O]), q = y((e) => {
74
+ o.current = e.api, k(e.api);
58
75
  const t = e.api.getGridOption("context") || {};
59
- e.api.setGridOption("context", { ...t, activeSearchColumnId: null }), m && m(e);
60
- }, [m]);
61
- W(() => {
62
- const e = s.current;
76
+ e.api.setGridOption("context", { ...t, activeSearchColumnId: null }), C && C(e);
77
+ }, [C]);
78
+ le(() => {
79
+ const e = f.current;
63
80
  if (!e) return;
64
81
  const t = (n) => {
65
82
  if (n.key !== "Enter" && n.key !== " ") return;
66
- const l = n.target;
67
- if (!l.classList.contains("ag-cell") && !l.classList.contains("ag-header-cell")) return;
68
- const p = l.querySelector(
83
+ const c = n.target;
84
+ if (!c.classList.contains("ag-cell") && !c.classList.contains("ag-header-cell")) return;
85
+ const u = c.querySelector(
69
86
  'button, [role="checkbox"], [role="switch"], [role="combobox"], [role="button"], [role="link"], a, input, select, textarea, .cursor-pointer'
70
87
  );
71
- p && (n.preventDefault(), n.stopPropagation(), p.click(), p.focus());
88
+ u && (n.preventDefault(), n.stopPropagation(), u.click(), u.focus());
72
89
  };
73
90
  return e.addEventListener("keydown", t, !0), () => e.removeEventListener("keydown", t, !0);
74
91
  }, []);
75
- const H = y(() => ({
76
- headerComponent: B,
77
- ...o,
92
+ const z = b(() => ({
93
+ headerComponent: pe,
94
+ ...r,
78
95
  suppressHeaderKeyboardEvent: (e) => {
79
96
  const { event: t } = e, n = t.target;
80
97
  if (n.tagName === "INPUT" || n.tagName === "TEXTAREA")
81
98
  return !(t.key === "Enter" || t.key === "Escape" || t.key === "Tab");
82
99
  if (t.key === "Enter" || t.key === " ") {
83
- const p = n.closest(".ag-header-cell");
84
- if (p) {
85
- const I = p.querySelector('[role="checkbox"], button, [role="switch"], input');
86
- if (I)
87
- return t.preventDefault(), I.click(), !0;
100
+ const u = n.closest(".ag-header-cell");
101
+ if (u) {
102
+ const m = u.querySelector('[role="checkbox"], button, [role="switch"], input');
103
+ if (m)
104
+ return t.preventDefault(), m.click(), !0;
88
105
  }
89
106
  }
90
- return o?.suppressHeaderKeyboardEvent?.(e) ?? !1;
107
+ return r?.suppressHeaderKeyboardEvent?.(e) ?? !1;
91
108
  },
92
109
  headerComponentParams: {
93
- ...o?.headerComponentParams
110
+ ...r?.headerComponentParams
94
111
  }
95
- }), [o]), j = y(() => ({
96
- headerGroupComponent: Q,
97
- ...i,
112
+ }), [r]), J = b(() => ({
113
+ headerGroupComponent: fe,
114
+ ...s,
98
115
  headerGroupComponentParams: {
99
- ...i?.headerGroupComponentParams
116
+ ...s?.headerGroupComponentParams
100
117
  }
101
- }), [i]), L = y(() => ({
102
- ...ne,
118
+ }), [s]), X = b(() => ({
119
+ ...be,
103
120
  // Always available - value formatters
104
- ...u.components,
121
+ ...i.components,
105
122
  // User components override
106
- ...d
123
+ ...h
107
124
  // Optional custom formatters override defaults
108
- }), [d, u.components]), P = v((e) => {
125
+ }), [h, i.components]), B = y((e) => {
109
126
  if (e.value !== null && e.value !== void 0 && typeof e.value == "object") {
110
- const t = Object.entries(e.value).map(([n, l]) => l && typeof l == "object" && "value" in l ? l.value : typeof l != "object" && typeof l < "u" ? l : null).filter((n) => n != null);
111
- return t.length > 0 ? t.join(" ") : "";
127
+ const t = Object.entries(e.value).map(([, n]) => n && typeof n == "object" && "value" in n ? n.value : typeof n != "object" && typeof n < "u" ? n : null).filter((n) => n != null);
128
+ return t.length === 0 ? "" : t.length === 1 ? t[0] : t.join(D);
112
129
  }
113
130
  return e.value;
114
- }, []), w = v((e) => {
131
+ }, []), Q = y((e) => {
115
132
  if (typeof e.value == "string") {
116
133
  const t = e.value.trim();
117
134
  if (t.startsWith("{") || t.startsWith("["))
@@ -122,24 +139,80 @@ function ye({
122
139
  }
123
140
  }
124
141
  return e.value;
125
- }, []);
126
- return /* @__PURE__ */ U(Y.Provider, { value: F, children: [
127
- /* @__PURE__ */ a("div", { ref: s, style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ a(
128
- J,
142
+ }, []), Y = y((e) => {
143
+ const t = e?.data ?? "";
144
+ if (!t.includes(D)) {
145
+ W(t);
146
+ return;
147
+ }
148
+ const n = [], c = t.split(`
149
+ `);
150
+ for (let u = 0; u < c.length; u++) {
151
+ const m = c[u];
152
+ if (m.length === 0 && u === c.length - 1) {
153
+ n.push("");
154
+ continue;
155
+ }
156
+ const d = m.split(" ").map((l) => l.split(D)), S = Math.max(1, ...d.map((l) => l.length));
157
+ if (S === 1) {
158
+ n.push(m);
159
+ continue;
160
+ }
161
+ for (let l = 0; l < S; l++) {
162
+ const G = d.map((p) => p.length === 1 ? p[0] : p[l] ?? "");
163
+ n.push(G.join(" "));
164
+ }
165
+ }
166
+ W(n.join(`
167
+ `));
168
+ }, []), A = y((e) => {
169
+ const t = e.value;
170
+ if (t == null) return "";
171
+ if (typeof t != "object") return String(t);
172
+ const c = e.column?.getColDef?.()?.cellRendererParams ?? null, u = c?.splits, m = c?.valueFormatter ?? null, H = e.node?.data ?? null, d = [];
173
+ for (const [S, l] of Object.entries(t)) {
174
+ if (l && typeof l == "object" && "value" in l) {
175
+ const G = l, p = G.value;
176
+ if (p == null) continue;
177
+ const te = u?.find((ne) => ne.field?.split(".").pop() === S), V = xe(
178
+ G,
179
+ H,
180
+ te?.valueFormatter ?? null,
181
+ m
182
+ ), T = V ? Fe(V, p) : String(p);
183
+ T != null && d.push(String(T));
184
+ continue;
185
+ }
186
+ typeof l != "object" && typeof l < "u" && l !== null && d.push(String(l));
187
+ }
188
+ return d.length === 0 ? "" : d.length === 1 ? d[0] : d.join(`
189
+ `);
190
+ }, []), Z = b(() => ({
191
+ processCellCallback: A,
192
+ ...i.defaultCsvExportParams ?? {}
193
+ }), [A, i.defaultCsvExportParams]), ee = b(() => ({
194
+ processCellCallback: A,
195
+ ...i.defaultExcelExportParams ?? {}
196
+ }), [A, i.defaultExcelExportParams]);
197
+ return /* @__PURE__ */ re(ge.Provider, { value: E, children: [
198
+ /* @__PURE__ */ g("div", { ref: f, style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ g(
199
+ de,
129
200
  {
130
- theme: X,
131
- defaultColDef: H,
132
- columnDefs: g,
201
+ theme: me,
202
+ defaultColDef: z,
203
+ columnDefs: x,
133
204
  cellSelection: !0,
134
- defaultColGroupDef: j,
135
- onGridReady: T,
136
- components: L,
137
- processCellForClipboard: P,
138
- processCellFromClipboard: w,
205
+ defaultColGroupDef: J,
206
+ onGridReady: q,
207
+ components: X,
208
+ processCellForClipboard: B,
209
+ processCellFromClipboard: Q,
210
+ sendToClipboard: Y,
139
211
  ensureDomOrder: !0,
140
212
  suppressHeaderFocus: !1,
141
213
  suppressFocusAfterRefresh: !0,
142
214
  suppressGroupRowsSticky: !0,
215
+ enableCellTextSelection: !0,
143
216
  columnTypes: {
144
217
  numericColumn: {
145
218
  cellClass: "ag-right-aligned-cell",
@@ -162,78 +235,80 @@ function ye({
162
235
  filter: "agDateColumnFilter"
163
236
  }
164
237
  },
165
- ...u
238
+ ...i,
239
+ defaultCsvExportParams: Z,
240
+ defaultExcelExportParams: ee
166
241
  }
167
242
  ) }),
168
- c,
169
- /* @__PURE__ */ a(
170
- le,
243
+ a,
244
+ /* @__PURE__ */ g(
245
+ Ee,
171
246
  {
172
- isOpen: x,
173
- columnId: b,
174
- gridApi: h,
175
- onClose: F.closeAdvancedFilter,
176
- onApply: F.applyAdvancedFilter
247
+ isOpen: j,
248
+ columnId: R,
249
+ gridApi: F,
250
+ onClose: E.closeAdvancedFilter,
251
+ onApply: E.applyAdvancedFilter
177
252
  }
178
253
  ),
179
- /* @__PURE__ */ a(
180
- ie,
254
+ /* @__PURE__ */ g(
255
+ Ae,
181
256
  {
182
- isOpen: R,
183
- columnId: A,
184
- gridApi: h,
185
- anchor: N,
186
- onClose: F.closeMenu
257
+ isOpen: U,
258
+ columnId: O,
259
+ gridApi: F,
260
+ anchor: $,
261
+ onClose: E.closeMenu
187
262
  }
188
263
  )
189
264
  ] });
190
265
  }
191
- function le({
192
- isOpen: c,
193
- columnId: o,
194
- gridApi: i,
195
- onClose: g,
196
- onApply: d
266
+ function Ee({
267
+ isOpen: a,
268
+ columnId: r,
269
+ gridApi: s,
270
+ onClose: x,
271
+ onApply: h
197
272
  }) {
198
- if (!c || !o || !i) return null;
199
- const m = i.getColumn(o);
200
- if (!m) return null;
201
- const u = m.getColDef(), r = u.headerComponentParams, s = ee(u), h = s.text !== -1 || s.number !== -1 || s.date !== -1, M = s.set !== -1, C = u.filter === "agMultiColumnFilter" && (h || M) ? "multi" : u.filter === "agNumberColumnFilter" ? "number" : u.filter === "agDateColumnFilter" ? "date" : u.filter === "agSetColumnFilter" || r?.selectOptions ? "select" : "text", b = te(i.getFilterModel());
202
- return /* @__PURE__ */ a(_, { fallback: null, children: /* @__PURE__ */ a(
203
- oe,
273
+ if (!a || !r || !s) return null;
274
+ const C = s.getColumn(r);
275
+ if (!C) return null;
276
+ const i = C.getColDef(), o = i.headerComponentParams, f = Ce(i), F = f.text !== -1 || f.number !== -1 || f.date !== -1, k = f.set !== -1, M = i.filter === "agMultiColumnFilter" && (F || k) ? "multi" : i.filter === "agNumberColumnFilter" ? "number" : i.filter === "agDateColumnFilter" ? "date" : i.filter === "agSetColumnFilter" || o?.selectOptions ? "select" : "text", R = ve(s.getFilterModel());
277
+ return /* @__PURE__ */ g(ie, { fallback: null, children: /* @__PURE__ */ g(
278
+ Me,
204
279
  {
205
- isOpen: c,
206
- onClose: g,
207
- onApply: d,
208
- columnId: o,
209
- columnLabel: u.headerName || o,
210
- columnType: C,
211
- selectOptions: r?.selectOptions,
212
- isMultiSelect: r?.isMultiSelect,
213
- initialModel: b,
214
- api: i
280
+ isOpen: a,
281
+ onClose: x,
282
+ onApply: h,
283
+ columnId: r,
284
+ columnLabel: i.headerName || r,
285
+ columnType: M,
286
+ selectOptions: o?.selectOptions,
287
+ isMultiSelect: o?.isMultiSelect,
288
+ initialModel: R,
289
+ api: s
215
290
  }
216
291
  ) });
217
292
  }
218
- function ie({
219
- isOpen: c,
220
- columnId: o,
221
- gridApi: i,
222
- anchor: g,
223
- onClose: d
293
+ function Ae({
294
+ isOpen: a,
295
+ columnId: r,
296
+ gridApi: s,
297
+ anchor: x,
298
+ onClose: h
224
299
  }) {
225
- return !c || !o || !i ? null : /* @__PURE__ */ a(
226
- re,
300
+ return !a || !r || !s ? null : /* @__PURE__ */ g(
301
+ ye,
227
302
  {
228
- isOpen: c,
229
- columnId: o,
230
- gridApi: i,
231
- anchor: g,
232
- onClose: d
303
+ isOpen: a,
304
+ columnId: r,
305
+ gridApi: s,
306
+ anchor: x,
307
+ onClose: h
233
308
  }
234
309
  );
235
310
  }
236
311
  export {
237
- ye as AgGridWrapper,
238
- ye as default
312
+ Ve as AgGridWrapper,
313
+ Ve as default
239
314
  };