impact-nova 1.7.27 → 1.7.29

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.
@@ -6,6 +6,8 @@ interface ColumnSettingsMenuProps {
6
6
  columnId: string;
7
7
  gridApi: GridApi;
8
8
  anchor: HTMLElement | null;
9
+ /** Variant determines menu items shown: 'column' shows full menu, 'group' shows only Choose/Reset Columns */
10
+ variant?: 'column' | 'group';
9
11
  }
10
12
  export declare const ColumnSettingsMenu: React.FC<ColumnSettingsMenuProps>;
11
13
  export {};
@@ -1,114 +1,154 @@
1
- import { jsxs as r, jsx as e, Fragment as j } from "react/jsx-runtime";
1
+ import { jsxs as r, jsx as e, Fragment as V } from "react/jsx-runtime";
2
2
  import "react";
3
- import { Settings as F, Checkmark as h, Search as _ } from "../../../../../icons/index.js";
4
- import { DropdownMenu as E, DropdownMenuTrigger as G, DropdownMenuContent as q, DropdownMenuLabel as v, DropdownMenuSeparator as z, DropdownMenuSub as p, DropdownMenuSubTrigger as f, DropdownMenuSubContent as g, DropdownMenuItem as a } from "../../../dropdown-menu.js";
5
- import { useGridHeader as L } from "../context/grid-header-context.js";
6
- import { useImpactNovaI18n as R } from "../../../../../i18n/ImpactNovaI18nContext.js";
7
- const U = ({
8
- isOpen: M,
9
- onClose: c,
10
- columnId: l,
3
+ import { Settings as B, Checkmark as h, Search as W } from "../../../../../icons/index.js";
4
+ import { DropdownMenu as A, DropdownMenuTrigger as _, DropdownMenuContent as F, DropdownMenuItem as i, DropdownMenuLabel as P, DropdownMenuSeparator as T, DropdownMenuSub as f, DropdownMenuSubTrigger as g, DropdownMenuSubContent as C } from "../../../dropdown-menu.js";
5
+ import { useGridHeader as I } from "../context/grid-header-context.js";
6
+ import { useImpactNovaI18n as J } from "../../../../../i18n/ImpactNovaI18nContext.js";
7
+ const $ = ({
8
+ isOpen: x,
9
+ onClose: a,
10
+ columnId: c,
11
11
  gridApi: s,
12
- anchor: O
12
+ anchor: j,
13
+ variant: d = "column"
13
14
  }) => {
14
- const { t } = R(), C = L(), o = s.getColumn(l);
15
- if (!o) return null;
16
- const i = o.getColDef(), x = o.getSort(), S = o.getPinned(), A = i?.sortable !== !1, y = i?.filter || "agTextColumnFilter", H = y === "agNumberColumnFilter" || (Array.isArray(i?.type) ? i.type.includes("numericColumn") : i?.type === "numericColumn"), b = y === "agDateColumnFilter" || (Array.isArray(i?.type) ? i.type.includes("dateColumn") : i?.type === "dateColumn"), u = (n) => {
15
+ const { t: n } = J(), S = I(), u = d === "column" ? s.getColumn(c) : null;
16
+ if (d === "column" && !u) return null;
17
+ const l = u?.getColDef(), b = u?.getSort(), w = u?.getPinned(), q = d === "column" && l?.sortable !== !1, y = l?.filter || "agTextColumnFilter", H = y === "agNumberColumnFilter" || (Array.isArray(l?.type) ? l.type.includes("numericColumn") : l?.type === "numericColumn"), k = y === "agDateColumnFilter" || (Array.isArray(l?.type) ? l.type.includes("dateColumn") : l?.type === "dateColumn"), E = s.getGridOption("suppressRowVirtualisation") !== !0, m = (t) => {
17
18
  queueMicrotask(() => {
18
19
  s.applyColumnState({
19
- state: [{ colId: l, sort: n }],
20
+ state: [{ colId: c, sort: t }],
20
21
  defaultState: { sort: null }
21
22
  });
22
- }), c();
23
- }, m = (n) => {
23
+ }), a();
24
+ }, p = (t) => {
24
25
  queueMicrotask(() => {
25
26
  s.applyColumnState({
26
- state: [{ colId: l, pinned: n }]
27
+ state: [{ colId: c, pinned: t }]
27
28
  });
28
- }), c();
29
- }, w = (n) => {
30
- n ? s.autoSizeAllColumns() : s.autoSizeColumns([l]), c();
31
- }, P = () => {
32
- const n = s.getGridOption("context") || {};
33
- s.setGridOption("context", { ...n, activeSearchColumnId: l }), s.refreshHeader(), c();
34
- }, T = () => {
35
- const n = i?.headerComponentParams;
36
- n?.onAdvanceSearchClick ? n.onAdvanceSearchClick(o) : n?.toggleAdvanceSearch ? n.toggleAdvanceSearch(l) : C && C.openAdvancedFilter(l), c();
37
- }, d = O?.getBoundingClientRect(), D = i?.headerComponentParams, N = D?.isSearchable, k = D?.advanceSearchEnabled;
38
- return /* @__PURE__ */ r(E, { open: M, onOpenChange: (n) => !n && c(), children: [
39
- d && /* @__PURE__ */ e(G, { asChild: !0, children: /* @__PURE__ */ e(
29
+ }), a();
30
+ }, N = (t) => {
31
+ t ? s.autoSizeAllColumns() : s.autoSizeColumns([c]), a();
32
+ }, D = () => {
33
+ queueMicrotask(() => {
34
+ s.showColumnChooser();
35
+ }), a();
36
+ }, z = () => {
37
+ queueMicrotask(() => {
38
+ s.resetColumnState();
39
+ }), a();
40
+ }, G = () => {
41
+ const t = s.getGridOption("context") || {};
42
+ s.setGridOption("context", { ...t, activeSearchColumnId: c }), s.refreshHeader(), a();
43
+ }, R = () => {
44
+ const t = l?.headerComponentParams;
45
+ t?.onAdvanceSearchClick ? t.onAdvanceSearchClick(u) : t?.toggleAdvanceSearch ? t.toggleAdvanceSearch(c) : S && S.openAdvancedFilter(c), a();
46
+ }, o = j?.getBoundingClientRect(), v = l?.headerComponentParams, M = d === "column" && v?.isSearchable, O = d === "column" && v?.advanceSearchEnabled, L = n(E ? "gridHeader.autosizeAllVisibleColumns" : "gridHeader.autosizeAllColumns");
47
+ return d === "group" ? /* @__PURE__ */ r(A, { open: x, onOpenChange: (t) => !t && a(), children: [
48
+ o && /* @__PURE__ */ e(_, { asChild: !0, children: /* @__PURE__ */ e(
49
+ "div",
50
+ {
51
+ style: {
52
+ position: "fixed",
53
+ left: o.left,
54
+ top: o.top,
55
+ width: o.width,
56
+ height: o.height,
57
+ pointerEvents: "none",
58
+ visibility: "hidden"
59
+ }
60
+ }
61
+ ) }),
62
+ /* @__PURE__ */ e(
63
+ F,
64
+ {
65
+ align: "end",
66
+ side: "bottom",
67
+ sideOffset: 5,
68
+ className: "w-[200px] p-2 rounded-[8px] border-none !shadow-[0px_0px_2px_0px_rgba(0,0,0,0.25)]",
69
+ onCloseAutoFocus: (t) => t.preventDefault(),
70
+ children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5", children: [
71
+ /* @__PURE__ */ e(i, { onClick: D, children: n("gridHeader.chooseColumns") }),
72
+ /* @__PURE__ */ e(i, { onClick: z, children: n("gridHeader.resetColumns") })
73
+ ] })
74
+ }
75
+ )
76
+ ] }) : /* @__PURE__ */ r(A, { open: x, onOpenChange: (t) => !t && a(), children: [
77
+ o && /* @__PURE__ */ e(_, { asChild: !0, children: /* @__PURE__ */ e(
40
78
  "div",
41
79
  {
42
80
  style: {
43
81
  position: "fixed",
44
- left: d.left,
45
- top: d.top,
46
- width: d.width,
47
- height: d.height,
82
+ left: o.left,
83
+ top: o.top,
84
+ width: o.width,
85
+ height: o.height,
48
86
  pointerEvents: "none",
49
87
  visibility: "hidden"
50
88
  }
51
89
  }
52
90
  ) }),
53
91
  /* @__PURE__ */ e(
54
- q,
92
+ F,
55
93
  {
56
94
  align: "end",
57
95
  side: "bottom",
58
96
  sideOffset: 5,
59
97
  className: "w-[200px] p-2 rounded-[8px] border-none !shadow-[0px_0px_2px_0px_rgba(0,0,0,0.25)]",
60
- onCloseAutoFocus: (n) => n.preventDefault(),
98
+ onCloseAutoFocus: (t) => t.preventDefault(),
61
99
  children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5", children: [
62
- /* @__PURE__ */ r(v, { className: "flex items-center gap-2 text-content-tertiary", children: [
63
- /* @__PURE__ */ e(F, { size: "xs" }),
100
+ /* @__PURE__ */ r(P, { className: "flex items-center gap-2 text-content-tertiary", children: [
101
+ /* @__PURE__ */ e(B, { size: "xs" }),
64
102
  " ",
65
- t("gridHeader.columnSettings")
103
+ n("gridHeader.columnSettings")
66
104
  ] }),
67
- /* @__PURE__ */ e(z, {}),
68
- A && /* @__PURE__ */ r(p, { children: [
69
- /* @__PURE__ */ e(f, { inset: !0, children: t("gridHeader.sort") }),
70
- /* @__PURE__ */ r(g, { sideOffset: 10, alignOffset: -5, children: [
71
- /* @__PURE__ */ e(a, { onClick: () => u("asc"), children: /* @__PURE__ */ r("span", { className: "flex items-center w-full justify-between", children: [
72
- /* @__PURE__ */ e("span", { children: t(H ? "gridHeader.sortAscNumber" : b ? "gridHeader.sortAscDate" : "gridHeader.sortAscText") }),
73
- x === "asc" && /* @__PURE__ */ e(h, { size: "sm", className: "ml-2 text-content-tertiary" })
105
+ /* @__PURE__ */ e(T, {}),
106
+ q && /* @__PURE__ */ r(f, { children: [
107
+ /* @__PURE__ */ e(g, { inset: !0, children: n("gridHeader.sort") }),
108
+ /* @__PURE__ */ r(C, { sideOffset: 10, alignOffset: -5, children: [
109
+ /* @__PURE__ */ e(i, { onClick: () => m("asc"), children: /* @__PURE__ */ r("span", { className: "flex items-center w-full justify-between", children: [
110
+ /* @__PURE__ */ e("span", { children: n(H ? "gridHeader.sortAscNumber" : k ? "gridHeader.sortAscDate" : "gridHeader.sortAscText") }),
111
+ b === "asc" && /* @__PURE__ */ e(h, { size: "sm", className: "ml-2 text-content-tertiary" })
74
112
  ] }) }),
75
- /* @__PURE__ */ e(a, { onClick: () => u("desc"), children: /* @__PURE__ */ r("span", { className: "flex items-center w-full justify-between", children: [
76
- /* @__PURE__ */ e("span", { children: t(H ? "gridHeader.sortDescNumber" : b ? "gridHeader.sortDescDate" : "gridHeader.sortDescText") }),
77
- x === "desc" && /* @__PURE__ */ e(h, { size: "sm", className: "ml-2 text-content-tertiary" })
113
+ /* @__PURE__ */ e(i, { onClick: () => m("desc"), children: /* @__PURE__ */ r("span", { className: "flex items-center w-full justify-between", children: [
114
+ /* @__PURE__ */ e("span", { children: n(H ? "gridHeader.sortDescNumber" : k ? "gridHeader.sortDescDate" : "gridHeader.sortDescText") }),
115
+ b === "desc" && /* @__PURE__ */ e(h, { size: "sm", className: "ml-2 text-content-tertiary" })
78
116
  ] }) }),
79
- /* @__PURE__ */ e(a, { onClick: () => u(null), children: /* @__PURE__ */ e("span", { children: t("gridHeader.reset") }) })
117
+ /* @__PURE__ */ e(i, { onClick: () => m(null), children: /* @__PURE__ */ e("span", { children: n("gridHeader.reset") }) })
80
118
  ] })
81
119
  ] }),
82
- /* @__PURE__ */ r(p, { children: [
83
- /* @__PURE__ */ e(f, { inset: !0, children: t("gridHeader.freezeColumn") }),
84
- /* @__PURE__ */ r(g, { className: "z-[120]", sideOffset: 10, alignOffset: -5, children: [
85
- /* @__PURE__ */ e(a, { onClick: () => m("left"), children: /* @__PURE__ */ r("span", { className: "flex items-center w-full justify-between", children: [
86
- /* @__PURE__ */ e("span", { children: t("gridHeader.pinLeft") }),
87
- S === "left" && /* @__PURE__ */ e(h, { size: "sm", className: "ml-2 text-content-tertiary" })
120
+ /* @__PURE__ */ r(f, { children: [
121
+ /* @__PURE__ */ e(g, { inset: !0, children: n("gridHeader.freezeColumn") }),
122
+ /* @__PURE__ */ r(C, { className: "z-[120]", sideOffset: 10, alignOffset: -5, children: [
123
+ /* @__PURE__ */ e(i, { onClick: () => p("left"), children: /* @__PURE__ */ r("span", { className: "flex items-center w-full justify-between", children: [
124
+ /* @__PURE__ */ e("span", { children: n("gridHeader.pinLeft") }),
125
+ w === "left" && /* @__PURE__ */ e(h, { size: "sm", className: "ml-2 text-content-tertiary" })
88
126
  ] }) }),
89
- /* @__PURE__ */ e(a, { onClick: () => m("right"), children: /* @__PURE__ */ r("span", { className: "flex items-center w-full justify-between", children: [
90
- /* @__PURE__ */ e("span", { children: t("gridHeader.pinRight") }),
91
- S === "right" && /* @__PURE__ */ e(h, { size: "sm", className: "ml-2 text-content-tertiary" })
127
+ /* @__PURE__ */ e(i, { onClick: () => p("right"), children: /* @__PURE__ */ r("span", { className: "flex items-center w-full justify-between", children: [
128
+ /* @__PURE__ */ e("span", { children: n("gridHeader.pinRight") }),
129
+ w === "right" && /* @__PURE__ */ e(h, { size: "sm", className: "ml-2 text-content-tertiary" })
92
130
  ] }) }),
93
- /* @__PURE__ */ e(a, { onClick: () => m(null), children: /* @__PURE__ */ e("span", { children: t("gridHeader.noPin") }) })
131
+ /* @__PURE__ */ e(i, { onClick: () => p(null), children: /* @__PURE__ */ e("span", { children: n("gridHeader.noPin") }) })
94
132
  ] })
95
133
  ] }),
96
- /* @__PURE__ */ r(p, { children: [
97
- /* @__PURE__ */ e(f, { inset: !0, children: t("gridHeader.columnWidth") }),
98
- /* @__PURE__ */ r(g, { className: "z-[120]", sideOffset: 10, alignOffset: -5, children: [
99
- /* @__PURE__ */ e(a, { onClick: () => w(!1), children: t("gridHeader.autosizeThisColumn") }),
100
- /* @__PURE__ */ e(a, { onClick: () => w(!0), children: t("gridHeader.autosizeAllColumns") })
134
+ /* @__PURE__ */ r(f, { children: [
135
+ /* @__PURE__ */ e(g, { inset: !0, children: n("gridHeader.columnWidth") }),
136
+ /* @__PURE__ */ r(C, { className: "z-[120]", sideOffset: 10, alignOffset: -5, children: [
137
+ /* @__PURE__ */ e(i, { onClick: () => N(!1), children: n("gridHeader.autosizeThisColumn") }),
138
+ /* @__PURE__ */ e(i, { onClick: () => N(!0), children: L })
101
139
  ] })
102
140
  ] }),
103
- (N || k) && /* @__PURE__ */ r(j, { children: [
104
- /* @__PURE__ */ e(z, {}),
105
- /* @__PURE__ */ r(v, { className: "flex items-center gap-2 text-content-tertiary", children: [
106
- /* @__PURE__ */ e(_, { size: "xs" }),
141
+ /* @__PURE__ */ e(i, { inset: !0, onClick: D, children: n("gridHeader.chooseColumns") }),
142
+ /* @__PURE__ */ e(i, { inset: !0, onClick: z, children: n("gridHeader.resetColumns") }),
143
+ (M || O) && /* @__PURE__ */ r(V, { children: [
144
+ /* @__PURE__ */ e(T, {}),
145
+ /* @__PURE__ */ r(P, { className: "flex items-center gap-2 text-content-tertiary", children: [
146
+ /* @__PURE__ */ e(W, { size: "xs" }),
107
147
  " ",
108
- t("gridHeader.searchOptions")
148
+ n("gridHeader.searchOptions")
109
149
  ] }),
110
- N && /* @__PURE__ */ e(a, { inset: !0, onClick: P, children: t("gridHeader.search") }),
111
- k && /* @__PURE__ */ e(a, { inset: !0, onClick: T, children: t("gridHeader.advanceSearch") })
150
+ M && /* @__PURE__ */ e(i, { inset: !0, onClick: G, children: n("gridHeader.search") }),
151
+ O && /* @__PURE__ */ e(i, { inset: !0, onClick: R, children: n("gridHeader.advanceSearch") })
112
152
  ] })
113
153
  ] })
114
154
  }
@@ -116,5 +156,5 @@ const U = ({
116
156
  ] });
117
157
  };
118
158
  export {
119
- U as ColumnSettingsMenu
159
+ $ as ColumnSettingsMenu
120
160
  };
@@ -19,12 +19,14 @@ export interface GridHeaderContextValue {
19
19
  closeAdvancedFilter: () => void;
20
20
  /** Apply a new advanced filter model (updates state AND applies to grid) */
21
21
  applyAdvancedFilter: (model: AdvancedFilterModel | null) => void;
22
- /** Open column settings menu for a specific column */
23
- openMenu: (columnId: string, anchor: HTMLElement) => void;
22
+ /** Open column settings menu for a specific column or group */
23
+ openMenu: (columnId: string, anchor: HTMLElement, variant?: 'column' | 'group') => void;
24
24
  /** Close the column settings menu */
25
25
  closeMenu: () => void;
26
26
  /** ID of the column that currently has the settings menu open */
27
27
  activeMenuColumnId: string | null;
28
+ /** Variant of the active menu ('column' for regular columns, 'group' for column groups) */
29
+ activeMenuVariant: 'column' | 'group' | null;
28
30
  }
29
31
  export declare const GridHeaderContext: import('react').Context<GridHeaderContextValue>;
30
32
  /**
@@ -1,40 +1,47 @@
1
- import { jsxs as p, jsx as a } from "react/jsx-runtime";
2
- import { ChevronRight as m } from "../../../../icons/index.js";
3
- import { cn as x } from "../../../../lib/utils.js";
4
- import { HeaderInfo as f } from "./components/header-info.js";
5
- import { TruncatedText as u } from "./components/truncated-text.js";
6
- const y = (t) => {
1
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
+ import { ChevronRight as x } from "../../../../icons/index.js";
3
+ import { cn as g } from "../../../../lib/utils.js";
4
+ import { HeaderInfo as h } from "./components/header-info.js";
5
+ import { TruncatedText as N } from "./components/truncated-text.js";
6
+ import { useGridHeader as E } from "./context/grid-header-context.js";
7
+ const H = (n) => {
7
8
  const {
8
- displayName: i,
9
+ displayName: l,
9
10
  showInfoIcon: c = !1,
10
11
  columnGroup: e,
11
- setExpanded: n
12
- } = t, o = e ? e.isExpanded() : !1, r = e ? e.isExpandable() : !1, d = (l) => {
13
- l && l.stopPropagation(), n && e && n(!o);
14
- }, s = i || "";
15
- return !s && c === !1 ? null : /* @__PURE__ */ p(
12
+ setExpanded: a
13
+ } = n, r = E(), s = e ? e.isExpanded() : !1, i = e ? e.isExpandable() : !1, p = (t) => {
14
+ t && t.stopPropagation(), a && e && a(!s);
15
+ }, m = (t) => {
16
+ if (t.preventDefault(), t.stopPropagation(), r && e) {
17
+ const u = e.getGroupId() || "group";
18
+ r.openMenu(u, t.currentTarget, "group");
19
+ }
20
+ }, d = l || "";
21
+ return !d && c === !1 ? null : /* @__PURE__ */ f(
16
22
  "div",
17
23
  {
18
24
  className: "ag-header-group-cell-label ag-sticky-label flex items-center h-full cursor-pointer select-none",
19
- onClick: r ? d : void 0,
25
+ onClick: i ? p : void 0,
26
+ onContextMenu: m,
20
27
  role: "presentation",
21
28
  children: [
22
- /* @__PURE__ */ a(
23
- u,
29
+ /* @__PURE__ */ o(
30
+ N,
24
31
  {
25
- text: s,
32
+ text: d,
26
33
  className: "ag-header-group-text font-bold text-content"
27
34
  }
28
35
  ),
29
- /* @__PURE__ */ a(f, { ...t, className: "ml-1" }),
30
- r && /* @__PURE__ */ a("span", { className: x(
36
+ /* @__PURE__ */ o(h, { ...n, className: "ml-1" }),
37
+ i && /* @__PURE__ */ o("span", { className: g(
31
38
  "ag-header-icon ag-header-expand-icon ml-[6px] flex items-center justify-center transition-transform duration-200",
32
- o ? "ag-header-expand-icon-expanded rotate-180" : "ag-header-expand-icon-collapsed"
33
- ), children: /* @__PURE__ */ a(m, { size: 16, className: "text-content-tertiary" }) })
39
+ s ? "ag-header-expand-icon-expanded rotate-180" : "ag-header-expand-icon-collapsed"
40
+ ), children: /* @__PURE__ */ o(x, { size: 16, className: "text-content-tertiary" }) })
34
41
  ]
35
42
  }
36
43
  );
37
44
  };
38
45
  export {
39
- y as CustomHeaderGroup
46
+ H as CustomHeaderGroup
40
47
  };