impact-nova 1.7.25 → 1.7.27

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 (25) hide show
  1. package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +45 -36
  2. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +0 -1
  3. package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +92 -75
  4. package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +52 -41
  5. package/dist/components/ui/ag-grid-react/hooks/useStopEditingOnClickOutside.d.ts +5 -0
  6. package/dist/components/ui/alert.d.ts +1 -1
  7. package/dist/components/ui/calendar.js +3 -2
  8. package/dist/components/ui/data-table/data-table-column-list.js +119 -108
  9. package/dist/components/ui/nested-list/components/NestedListContent.d.ts +1 -0
  10. package/dist/components/ui/nested-list/components/NestedListContent.js +134 -63
  11. package/dist/components/ui/nested-list/components/SortableItem.js +65 -82
  12. package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.js +176 -153
  13. package/dist/components/ui/nested-list/nested-list.js +190 -203
  14. package/dist/components/ui/select/components/Submenu.js +7 -5
  15. package/dist/components/ui/select/select.js +390 -369
  16. package/dist/components/ui/toaster.d.ts +1 -1
  17. package/dist/components/ui/toaster.js +105 -72
  18. package/dist/i18n/defaultMessages.d.ts +3 -0
  19. package/dist/i18n/defaultMessages.js +14 -11
  20. package/dist/i18n/locales/de.js +4 -1
  21. package/dist/i18n/locales/es.js +4 -1
  22. package/dist/i18n/locales/hi.js +4 -1
  23. package/dist/i18n/locales/kn.js +4 -1
  24. package/dist/impact-nova.css +1 -1
  25. package/package.json +1 -1
@@ -1,82 +1,84 @@
1
- import { jsx as M } from "react/jsx-runtime";
2
- import { useState as E, useRef as P, useCallback as m, useEffect as q } from "react";
3
- import { useDataTable as B } from "./data-table-context.js";
4
- import { NestedList as H } from "../nested-list/nested-list.js";
5
- import { SelectionMode as J } from "../types/nested-list.types.js";
6
- import { mergePartialOrderedColumnState as Q } from "./data-table-column-state.js";
7
- import { useImpactNovaI18n as X } from "../../../i18n/ImpactNovaI18nContext.js";
8
- const ne = ({
9
- enableApplyDiscard: b = !1,
10
- showSearch: R = !0,
11
- showSelectAll: w = !0,
12
- showCollapse: L = !0
1
+ import { jsx as N } from "react/jsx-runtime";
2
+ import { useState as w, useRef as I, useCallback as C, useEffect as F } from "react";
3
+ import { useDataTable as Q } from "./data-table-context.js";
4
+ import { NestedList as X } from "../nested-list/nested-list.js";
5
+ import { SelectionMode as Y } from "../types/nested-list.types.js";
6
+ import { mergePartialOrderedColumnState as Z } from "./data-table-column-state.js";
7
+ import { useImpactNovaI18n as ee } from "../../../i18n/ImpactNovaI18nContext.js";
8
+ const ue = ({
9
+ enableApplyDiscard: T = !1,
10
+ showSearch: q = !0,
11
+ showSelectAll: j = !0,
12
+ showCollapse: K = !0
13
13
  }) => {
14
- const { gridApi: l } = B(), { t: f } = X(), [j, x] = E([]), [A, F] = E(!1), d = P(!1), [K, V] = E(!1), U = P(/* @__PURE__ */ new Map()), y = m(() => {
15
- if (!l || d.current) return;
16
- const o = l.getColumnState(), c = new Map(o.map((t) => [t.colId, t]));
17
- U.current = c;
18
- const n = l.getColumns() || [], u = new Map(n.map((t) => [t.getColId(), t])), a = [], e = [], S = /* @__PURE__ */ new Map(), D = (t, s) => {
19
- const r = t.getGroupId();
20
- let i = S.get(r);
21
- if (i) return i;
22
- const h = t.getOriginalParent(), g = h ? D(h, s).children : s, C = t.getColGroupDef();
23
- return i = {
24
- id: r,
25
- label: C?.headerName || r,
14
+ const { gridApi: r } = Q(), { t: p } = ee(), [V, z] = w([]), [W, B] = w(!1), f = I(!1), v = I(null), b = I(0), [O, P] = w(!1), L = I(/* @__PURE__ */ new Map()), g = C(() => {
15
+ if (!r || f.current) return;
16
+ const o = r.getColumnState(), s = new Map(o.map((l) => [l.colId, l]));
17
+ L.current = s;
18
+ const c = r.getColumns() || [], i = new Map(c.map((l) => [l.getColId(), l])), t = [], e = [], k = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), J = (l, a) => {
19
+ const n = l.getGroupId(), u = `${n}::${a === t ? "f" : "s"}`, d = k.get(u);
20
+ if (d && d.list === a && a[a.length - 1] === d.node)
21
+ return d.node;
22
+ const m = D.get(u) || 0;
23
+ D.set(u, m + 1);
24
+ const S = l.getColGroupDef(), h = a === t ? "f" : "s", R = {
25
+ id: m === 0 ? `${n}__${h}` : `${n}__${h}__${m}`,
26
+ label: S?.headerName || n,
26
27
  checked: !0,
27
28
  children: [],
28
29
  category: "group"
29
- }, S.set(r, i), g.push(i), i;
30
+ };
31
+ return a.push(R), k.set(u, { list: a, node: R }), R;
30
32
  };
31
- let T = 0, O = 0, v = 0, z = 0;
32
- o.forEach((t) => {
33
- const s = u.get(t.colId);
34
- if (!s) return;
35
- let r = l.getDisplayNameForColumn(s, "header");
36
- if (r === "") return;
37
- if (r == null) {
38
- const G = s.getColDef();
39
- if (G.headerName === "") return;
40
- r = G.headerName || G.field || t.colId;
33
+ let E = 0, $ = 0, G = 0, A = 0;
34
+ o.forEach((l) => {
35
+ const a = i.get(l.colId);
36
+ if (!a) return;
37
+ let n = r.getDisplayNameForColumn(a, "header");
38
+ if (n === "") return;
39
+ if (n == null) {
40
+ const h = a.getColDef();
41
+ if (h.headerName === "") return;
42
+ n = h.headerName || h.field || l.colId;
41
43
  }
42
- if (!r || r.trim() === "")
44
+ if (!n || n.trim() === "")
43
45
  return;
44
- const i = !t.hide, h = {
45
- id: t.colId,
46
- label: r,
47
- checked: i
46
+ const u = !l.hide, d = {
47
+ id: l.colId,
48
+ label: n,
49
+ checked: u
48
50
  };
49
- t.pinned ? (T++, i && O++) : (v++, i && z++);
50
- const g = t.pinned ? a : e, C = s.getOriginalParent();
51
- C?.getColGroupDef().children ? D(C, g).children.push(h) : g.push(h);
51
+ l.pinned ? (E++, u && $++) : (G++, u && A++);
52
+ const m = l.pinned ? t : e, S = a.getOriginalParent();
53
+ S?.getColGroupDef()?.children ? J(S, m).children.push(d) : m.push(d);
52
54
  });
53
- const I = (t) => {
54
- let s = t.length > 0;
55
- for (const r of t)
56
- r.children && (r.checked = I(r.children)), r.checked || (s = !1);
57
- return s;
55
+ const M = (l) => {
56
+ let a = l.length > 0;
57
+ for (const n of l)
58
+ n.children && (n.checked = M(n.children)), n.checked || (a = !1);
59
+ return a;
58
60
  };
59
- I(a), I(e);
60
- const k = [];
61
- a.length > 0 && k.push({
61
+ M(t), M(e);
62
+ const x = [];
63
+ t.length > 0 && x.push({
62
64
  id: "root-frozen",
63
- label: f("dataTable.frozenColumns"),
64
- checked: T > 0 && O === T,
65
- children: a,
65
+ label: p("dataTable.frozenColumns"),
66
+ checked: E > 0 && $ === E,
67
+ children: t,
66
68
  category: "structure",
67
69
  isDragDisabled: !0
68
- }), e.length > 0 && k.push({
70
+ }), e.length > 0 && x.push({
69
71
  id: "root-scrollable",
70
- label: f("dataTable.scrollableColumns"),
71
- checked: v > 0 && z === v,
72
+ label: p("dataTable.scrollableColumns"),
73
+ checked: G > 0 && A === G,
72
74
  children: e,
73
75
  category: "structure",
74
76
  isDragDisabled: !0
75
- }), x(k), F(!0);
76
- }, [l, f]);
77
- q(() => {
78
- if (!l) return;
79
- const o = setTimeout(() => y(), 0), c = [
77
+ }), z(x), B(!0);
78
+ }, [r, p]);
79
+ F(() => {
80
+ if (!r) return;
81
+ const o = setTimeout(() => g(), 0), s = [
80
82
  "columnVisible",
81
83
  "columnPinned",
82
84
  "columnMoved",
@@ -90,78 +92,87 @@ const ne = ({
90
92
  "columnValueChanged",
91
93
  "displayedColumnsChanged"
92
94
  ];
93
- let n = null;
94
- const u = () => {
95
- n && clearTimeout(n), n = setTimeout(() => {
96
- n = null;
97
- const a = !d.current;
98
- d.current = !1, y(), a && V((e) => !e);
95
+ let c = null;
96
+ const i = () => {
97
+ c && clearTimeout(c), c = setTimeout(() => {
98
+ c = null;
99
+ const t = !f.current;
100
+ f.current = !1, g(), t && P((e) => !e);
99
101
  }, 150);
100
102
  };
101
- return l.isDestroyed() || c.forEach((a) => l.addEventListener(a, u)), () => {
102
- clearTimeout(o), n && clearTimeout(n), l.isDestroyed() || c.forEach((a) => l.removeEventListener(a, u));
103
+ return r.isDestroyed() || s.forEach((t) => r.addEventListener(t, i)), () => {
104
+ clearTimeout(o), c && clearTimeout(c), r.isDestroyed() || s.forEach((t) => r.removeEventListener(t, i));
103
105
  };
104
- }, [l, y]);
105
- const N = m((o) => {
106
- const c = [], n = (u, a) => {
107
- u.forEach((e) => {
106
+ }, [r, g]), F(() => {
107
+ if (b.current === 0) return;
108
+ const o = requestAnimationFrame(() => {
109
+ const s = v.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
110
+ s && (s.scrollTop = b.current, b.current = 0);
111
+ });
112
+ return () => cancelAnimationFrame(o);
113
+ }, [O]);
114
+ const _ = C((o) => {
115
+ const s = [], c = (i, t) => {
116
+ i.forEach((e) => {
108
117
  if (e.id === "root-frozen") {
109
- e.children && n(e.children, "left");
118
+ e.children && c(e.children, "left");
110
119
  return;
111
120
  }
112
121
  if (e.id === "root-scrollable") {
113
- e.children && n(e.children, null);
122
+ e.children && c(e.children, null);
114
123
  return;
115
124
  }
116
- e.category === "group" || e.children && e.children.length > 0 ? e.children && n(e.children, a) : l?.getColumn(e.id) && c.push({
125
+ e.category === "group" || e.children && e.children.length > 0 ? e.children && c(e.children, t) : r?.getColumn(e.id) && s.push({
117
126
  colId: e.id,
118
- pinned: a,
127
+ pinned: t,
119
128
  hide: !e.checked
120
129
  });
121
130
  });
122
131
  };
123
- return n(o, null), c;
124
- }, [l]), p = m((o) => {
125
- if (!l) return;
126
- d.current = !0;
127
- const c = N(o);
128
- if (c.length === 0) {
132
+ return c(o, null), s;
133
+ }, [r]), y = C((o) => {
134
+ if (!r) return;
135
+ f.current = !0;
136
+ const s = _(o);
137
+ if (s.length === 0) {
129
138
  setTimeout(() => {
130
- d.current = !1;
139
+ f.current = !1;
131
140
  }, 300);
132
141
  return;
133
142
  }
134
- const n = l.getColumnState(), u = Q(n, c);
135
- l.applyColumnState({
136
- state: u,
143
+ const c = r.getColumnState(), i = Z(c, s);
144
+ r.applyColumnState({
145
+ state: i,
137
146
  applyOrder: !0
138
147
  }), setTimeout(() => {
139
- d.current = !1;
148
+ f.current = !1;
149
+ const t = v.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
150
+ t && (b.current = t.scrollTop), g(), P((e) => !e);
140
151
  }, 300);
141
- }, [l, N]), W = m((o) => {
142
- p(o);
143
- }, [p]), _ = m((o) => {
144
- b || p(o), x(o);
145
- }, [b, p]);
146
- return A ? /* @__PURE__ */ M("div", { className: "flex flex-col h-full bg-canvas-elevated", children: /* @__PURE__ */ M(
147
- H,
152
+ }, [r, _, g]), U = C((o) => {
153
+ y(o);
154
+ }, [y]), H = C((o) => {
155
+ T || y(o), z(o);
156
+ }, [T, y]);
157
+ return W ? /* @__PURE__ */ N("div", { ref: v, className: "flex flex-col h-full bg-canvas-elevated", children: /* @__PURE__ */ N(
158
+ X,
148
159
  {
149
- items: j,
150
- onChange: _,
151
- onSubmit: W,
152
- enableApplyDiscard: b,
153
- enableSearch: R,
154
- enableSelectAll: w,
160
+ items: V,
161
+ onChange: H,
162
+ onSubmit: U,
163
+ enableApplyDiscard: T,
164
+ enableSearch: q,
165
+ enableSelectAll: j,
155
166
  enableDragDrop: !0,
156
167
  enableCollapse: !0,
157
- enableGlobalCollapse: L,
158
- selectionMode: J.CASCADE_DOWN,
159
- searchPlaceholder: f("dataTable.searchColumnsPlaceholder"),
168
+ enableGlobalCollapse: K,
169
+ selectionMode: Y.CASCADE_DOWN,
170
+ searchPlaceholder: p("dataTable.searchColumnsPlaceholder"),
160
171
  className: "h-full"
161
172
  },
162
- K ? "sync-a" : "sync-b"
163
- ) }) : /* @__PURE__ */ M("div", { className: "p-4 text-[13px] text-content-placeholder", children: f("dataTable.loadingColumns") });
173
+ O ? "sync-a" : "sync-b"
174
+ ) }) : /* @__PURE__ */ N("div", { className: "p-4 text-[13px] text-content-placeholder", children: p("dataTable.loadingColumns") });
164
175
  };
165
176
  export {
166
- ne as DataTableColumnList
177
+ ue as DataTableColumnList
167
178
  };
@@ -14,6 +14,7 @@ interface NestedListContentProps {
14
14
  onDragOver: (event: DragOverEvent) => void;
15
15
  onDragEnd: (event: DragEndEvent) => void;
16
16
  onDragCancel: () => void;
17
+ activeId: string | null;
17
18
  }
18
19
  export declare const NestedListContent: React.FC<NestedListContentProps>;
19
20
  export {};
@@ -1,74 +1,145 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import z, { useRef as C } from "react";
3
- import { DndContext as S } from "@dnd-kit/core";
4
- import { SortableContext as w } from "@dnd-kit/sortable";
5
- import { useVirtualizer as y } from "@tanstack/react-virtual";
6
- import { customCollisionDetection as D } from "../hooks/useNestedListDragDrop.js";
7
- const _ = ({
8
- isListCollapsed: a,
9
- enableDragDrop: d,
10
- sensors: c,
11
- items: e,
12
- renderItem: m,
13
- onDragStart: f,
14
- onDragOver: u,
15
- onDragEnd: p,
16
- onDragCancel: h
17
- }) => {
18
- const r = C(null), n = y({
19
- count: e.length,
20
- getScrollElement: () => r.current,
21
- estimateSize: () => 32,
22
- overscan: 5
23
- }), x = z.useMemo(() => e.map((o) => o.item.id), [e]);
24
- if (a) return null;
25
- const i = n.getVirtualItems(), g = n.getTotalSize(), v = i.length > 0 ? i[0].start : 0, l = /* @__PURE__ */ t(
1
+ import { jsxs as z, jsx as c } from "react/jsx-runtime";
2
+ import b, { useRef as P, useState as v, useEffect as R, useCallback as f } from "react";
3
+ import { createPortal as T } from "react-dom";
4
+ import { DndContext as X } from "@dnd-kit/core";
5
+ import { SortableContext as $ } from "@dnd-kit/sortable";
6
+ import { customCollisionDetection as j } from "../hooks/useNestedListDragDrop.js";
7
+ import { Drag as H } from "../../../../icons/index.js";
8
+ const q = "0 -2px 0 0 var(--color-primary)", G = "0 2px 0 0 var(--color-primary)", J = () => null, K = ({ item: u, pointerX: m, pointerY: p }) => T(
9
+ /* @__PURE__ */ c(
26
10
  "div",
27
11
  {
28
- style: {
29
- height: `${g + 48}px`,
30
- width: "100%",
31
- position: "relative"
32
- },
33
- children: /* @__PURE__ */ t(
12
+ className: "fixed z-50 pointer-events-none",
13
+ style: { top: `${p + 16}px`, left: `${m + 12}px` },
14
+ children: /* @__PURE__ */ z(
34
15
  "div",
35
16
  {
36
- style: {
37
- position: "absolute",
38
- top: 0,
39
- left: 0,
40
- width: "100%",
41
- transform: `translateY(${v}px)`
42
- },
43
- children: i.map((o) => {
44
- const { item: s, level: b } = e[o.index];
45
- return /* @__PURE__ */ t(
46
- "div",
47
- {
48
- "data-index": o.index,
49
- ref: n.measureElement,
50
- children: m(s, b)
51
- },
52
- s.id
53
- );
54
- })
17
+ className: "inline-flex items-center gap-1.5 bg-canvas-elevated border border-stroke-subtle rounded px-2.5 py-1 shadow-md",
18
+ children: [
19
+ /* @__PURE__ */ c(H, { size: "12px", className: "text-content-icon shrink-0" }),
20
+ /* @__PURE__ */ c("span", { className: "text-[13px] text-content capitalize select-none whitespace-nowrap", children: u.label })
21
+ ]
55
22
  }
56
23
  )
57
24
  }
58
- );
59
- return /* @__PURE__ */ t("div", { className: "flex flex-col min-h-0 h-full", children: /* @__PURE__ */ t("div", { ref: r, className: "flex-1 p-1 overflow-y-auto", children: d ? /* @__PURE__ */ t(
60
- S,
61
- {
62
- sensors: c,
63
- collisionDetection: D,
64
- onDragStart: f,
65
- onDragOver: u,
66
- onDragEnd: p,
67
- onDragCancel: h,
68
- children: /* @__PURE__ */ t(w, { items: x, children: l })
25
+ ),
26
+ document.body
27
+ ), ne = ({
28
+ isListCollapsed: u,
29
+ enableDragDrop: m,
30
+ sensors: p,
31
+ items: n,
32
+ renderItem: L,
33
+ onDragStart: y,
34
+ onDragOver: w,
35
+ onDragEnd: N,
36
+ onDragCancel: C,
37
+ activeId: o
38
+ }) => {
39
+ const E = P(null), [h, d] = v(null), [_, O] = v(0), [x, Y] = v(0);
40
+ R(() => {
41
+ if (!o) return;
42
+ const e = (t) => {
43
+ O(t.clientX), Y(t.clientY);
44
+ };
45
+ return window.addEventListener("pointermove", e), () => window.removeEventListener("pointermove", e);
46
+ }, [o]), R(() => {
47
+ if (!o) return;
48
+ const e = document.createElement("style");
49
+ return e.setAttribute("data-drag-cursor", "true"), e.textContent = "body, body * { cursor: grabbing !important; }", document.head.appendChild(e), () => {
50
+ e.remove();
51
+ };
52
+ }, [o]);
53
+ const g = b.useMemo(() => {
54
+ if (!h || !o) return null;
55
+ let e = h, t = "after";
56
+ if (e === "root-frozen" || e === "root-scrollable") {
57
+ const s = n.findIndex((l) => l.item.id === e);
58
+ if (s !== -1) {
59
+ const l = n.slice(s + 1).find(
60
+ (i) => i.item.id !== "root-frozen" && i.item.id !== "root-scrollable"
61
+ );
62
+ if (l)
63
+ e = l.item.id, t = "before";
64
+ else {
65
+ const i = n.slice(0, s).filter(
66
+ (a) => a.item.id !== "root-frozen" && a.item.id !== "root-scrollable"
67
+ );
68
+ i.length > 0 && (e = i[i.length - 1].item.id, t = "after");
69
+ }
70
+ }
71
+ } else {
72
+ const s = E.current;
73
+ if (s) {
74
+ const l = s.querySelector(`[data-item-id="${e}"]`);
75
+ if (l) {
76
+ const i = l.getBoundingClientRect(), a = i.top + i.height / 2;
77
+ t = x < a ? "before" : "after";
78
+ }
79
+ }
80
+ }
81
+ return { overId: e, position: t };
82
+ }, [h, o, x, n]), k = b.useMemo(() => n.map((e) => e.item.id), [n]), S = b.useMemo(() => o && n.find((e) => e.item.id === o) || null, [o, n]), A = f((e) => {
83
+ y(e);
84
+ }, [y]), B = f((e) => {
85
+ const { active: t, over: r } = e;
86
+ !r || t.id === r.id ? d(null) : d(r.id), w(e);
87
+ }, [w]), F = f((e) => {
88
+ d(null), N(e);
89
+ }, [N]), M = f(() => {
90
+ d(null), C();
91
+ }, [C]);
92
+ if (u) return null;
93
+ const D = () => {
94
+ const e = o !== null;
95
+ let t = null;
96
+ if (e && g) {
97
+ const r = n.findIndex((s) => s.item.id === g.overId);
98
+ r !== -1 && (t = g.position === "before" ? r : r + 1);
69
99
  }
70
- ) : l }) });
100
+ return /* @__PURE__ */ c("div", { className: "w-full pb-12", children: n.map(({ item: r, level: s }, l) => {
101
+ const i = t === l, a = t === l + 1 && l === n.length - 1, I = i ? q : a ? G : void 0;
102
+ return /* @__PURE__ */ c(
103
+ "div",
104
+ {
105
+ className: "relative",
106
+ style: I ? { boxShadow: I } : void 0,
107
+ children: L(r, s)
108
+ },
109
+ r.id
110
+ );
111
+ }) });
112
+ };
113
+ return /* @__PURE__ */ z("div", { className: "flex flex-col min-h-0 h-full", children: [
114
+ /* @__PURE__ */ c(
115
+ "div",
116
+ {
117
+ ref: E,
118
+ className: "flex-1 p-1 overflow-y-auto relative",
119
+ children: m ? /* @__PURE__ */ c(
120
+ X,
121
+ {
122
+ sensors: p,
123
+ collisionDetection: j,
124
+ onDragStart: A,
125
+ onDragOver: B,
126
+ onDragEnd: F,
127
+ onDragCancel: M,
128
+ children: /* @__PURE__ */ c($, { items: k, strategy: J, children: D() })
129
+ }
130
+ ) : D()
131
+ }
132
+ ),
133
+ o && S && /* @__PURE__ */ c(
134
+ K,
135
+ {
136
+ item: S.item,
137
+ pointerX: _,
138
+ pointerY: x
139
+ }
140
+ )
141
+ ] });
71
142
  };
72
143
  export {
73
- _ as NestedListContent
144
+ ne as NestedListContent
74
145
  };