impact-nova 3.0.0-alpha.16 → 3.0.0-alpha.18

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 (102) hide show
  1. package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +9 -0
  2. package/dist/components/data/ag-grid-react/cell-renderers/badge-cell-renderer.d.ts +2 -0
  3. package/dist/components/data/ag-grid-react/cell-renderers/badge-cell-renderer.js +15 -14
  4. package/dist/components/data/ag-grid-react/cell-renderers/badge-icon-registry.d.ts +10 -0
  5. package/dist/components/data/ag-grid-react/cell-renderers/badge-icon-registry.js +17 -0
  6. package/dist/components/data/ag-grid-react/cell-renderers/index.d.ts +45 -7
  7. package/dist/components/data/ag-grid-react/cell-renderers/index.js +70 -58
  8. package/dist/components/data/ag-grid-react/cell-renderers/style-description-display-renderer.d.ts +5 -11
  9. package/dist/components/data/ag-grid-react/cell-renderers/style-description-display-renderer.js +127 -51
  10. package/dist/components/data/ag-grid-react/index.d.ts +1 -1
  11. package/dist/components/data/ag-grid-react/index.js +150 -147
  12. package/dist/components/data/ag-grid-react/list-drag-grid-options.d.ts +14 -1
  13. package/dist/components/data/ag-grid-react/list-drag-grid-options.js +95 -31
  14. package/dist/components/data/ag-grid-react/list-drag-preview-card.d.ts +4 -0
  15. package/dist/components/data/ag-grid-react/list-drag-preview-card.js +14 -0
  16. package/dist/components/data/ag-grid-react/list-drag-preview-snapshot.d.ts +20 -0
  17. package/dist/components/data/ag-grid-react/list-drag-preview-snapshot.js +42 -0
  18. package/dist/components/data/ag-grid-react/list-find-highlight.d.ts +6 -0
  19. package/dist/components/data/ag-grid-react/list-find-highlight.js +7 -0
  20. package/dist/components/data/ag-grid-react/process-backend-columndefs.d.ts +4 -0
  21. package/dist/components/data/ag-grid-react/process-backend-columndefs.js +78 -0
  22. package/dist/components/data/ag-grid-react/use-ag-grid-list-drag.d.ts +10 -2
  23. package/dist/components/data/ag-grid-react/use-ag-grid-list-drag.js +130 -107
  24. package/dist/components/data/ag-grid-react/use-list-drag-preview.d.ts +4 -1
  25. package/dist/components/data/ag-grid-react/use-list-drag-preview.js +131 -32
  26. package/dist/components/data/ag-grid-react/use-list-find.d.ts +36 -0
  27. package/dist/components/data/ag-grid-react/use-list-row-drop-zones.d.ts +2 -0
  28. package/dist/components/data/ag-grid-react/use-list-row-drop-zones.js +60 -41
  29. package/dist/components/data/data-table/data-table-list-header.js +1 -1
  30. package/dist/components/data/data-table/data-table-overlay.d.ts +6 -0
  31. package/dist/components/data/data-table/data-table-overlay.js +18 -0
  32. package/dist/components/data/data-table/data-table.types.d.ts +1 -0
  33. package/dist/components/data/data-table/index.d.ts +3 -0
  34. package/dist/components/data/data-table/index.js +67 -63
  35. package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +3 -2
  36. package/dist/components/data/expandable-list-item/expandable-list-item-metrics.js +3 -2
  37. package/dist/components/data/scenario-comparison/flatten-scenario-comparison-rows.d.ts +2 -0
  38. package/dist/components/data/scenario-comparison/flatten-scenario-comparison-rows.js +16 -0
  39. package/dist/components/data/scenario-comparison/index.d.ts +3 -0
  40. package/dist/components/data/scenario-comparison/index.js +6 -0
  41. package/dist/components/data/scenario-comparison/scenario-comparison-column.d.ts +12 -0
  42. package/dist/components/data/scenario-comparison/scenario-comparison-column.js +172 -0
  43. package/dist/components/data/scenario-comparison/scenario-comparison-label.d.ts +6 -0
  44. package/dist/components/data/scenario-comparison/scenario-comparison-label.js +64 -0
  45. package/dist/components/data/scenario-comparison/scenario-comparison.d.ts +5 -0
  46. package/dist/components/data/scenario-comparison/scenario-comparison.js +127 -0
  47. package/dist/components/data/scenario-comparison/scenario-comparison.types.d.ts +56 -0
  48. package/dist/components/data/scenario-comparison/scenario-comparison.variants.d.ts +7 -0
  49. package/dist/components/data/scenario-comparison/scenario-comparison.variants.js +29 -0
  50. package/dist/components/data-display/badge/index.d.ts +2 -0
  51. package/dist/components/data-display/badge/index.js +4 -2
  52. package/dist/components/data-display/badge/trophy-icon.d.ts +6 -0
  53. package/dist/components/data-display/badge/trophy-icon.js +28 -0
  54. package/dist/components/feedback/find-bar/collect-find-matches.d.ts +35 -0
  55. package/dist/components/feedback/find-bar/collect-find-matches.js +68 -0
  56. package/dist/components/feedback/find-bar/find-bar-shortcuts.d.ts +5 -0
  57. package/dist/components/feedback/find-bar/find-bar-shortcuts.js +27 -0
  58. package/dist/components/feedback/find-bar/find-bar.d.ts +7 -0
  59. package/dist/components/feedback/find-bar/find-bar.js +266 -0
  60. package/dist/components/feedback/find-bar/find-bar.types.d.ts +32 -0
  61. package/dist/components/feedback/find-bar/index.d.ts +4 -0
  62. package/dist/components/feedback/find-bar/index.js +11 -0
  63. package/dist/components/feedback/tooltip/tab-tooltip-render.js +3 -2
  64. package/dist/components/flows/command-palette/shortcut-settings.js +10 -10
  65. package/dist/components/flows/filter-panel/filter-panel.js +4 -4
  66. package/dist/components/forms/choice-card/choice-card-compare-scroll.d.ts +4 -0
  67. package/dist/components/forms/choice-card/choice-card-compare-scroll.js +6 -0
  68. package/dist/components/forms/choice-card/choice-card.d.ts +13 -2
  69. package/dist/components/forms/choice-card/choice-card.js +432 -342
  70. package/dist/components/forms/choice-card/choice-card.types.d.ts +9 -2
  71. package/dist/components/forms/select/components/SelectTriggerValue.js +3 -2
  72. package/dist/components/forms/select/components/Submenu.js +3 -2
  73. package/dist/components/primitives/tabs/folder-tab-path.d.ts +6 -0
  74. package/dist/components/primitives/tabs/folder-tab-path.js +16 -0
  75. package/dist/components/primitives/tabs/tabs.js +164 -111
  76. package/dist/components/primitives/tabs/tabs.types.d.ts +1 -1
  77. package/dist/i18n/defaultMessages.d.ts +17 -0
  78. package/dist/i18n/defaultMessages.js +52 -38
  79. package/dist/i18n/impact-nova-i18n-defaults.d.ts +5 -0
  80. package/dist/i18n/impact-nova-i18n-defaults.js +4 -9
  81. package/dist/i18n/index.d.ts +1 -1
  82. package/dist/i18n/locales/de.js +15 -1
  83. package/dist/i18n/locales/es.js +15 -1
  84. package/dist/i18n/locales/hi.js +15 -1
  85. package/dist/i18n/locales/kn.js +15 -1
  86. package/dist/impact-nova-components.css +189 -14
  87. package/dist/impact-nova-tokens.scss +2 -0
  88. package/dist/impact-nova.css +1 -1
  89. package/dist/index.d.ts +1 -0
  90. package/dist/index.js +621 -607
  91. package/dist/lib/virtualized/index.d.ts +2 -0
  92. package/dist/lib/virtualized/index.js +35 -31
  93. package/dist/lib/virtualized/list-index.d.ts +5 -0
  94. package/dist/lib/virtualized/list-index.js +13 -0
  95. package/dist/lib/virtualized/read-infinite-query-list.d.ts +14 -0
  96. package/dist/lib/virtualized/read-infinite-query-list.js +12 -0
  97. package/dist/lib/virtualized/types.d.ts +4 -2
  98. package/dist/lib/virtualized/useRowState.js +60 -56
  99. package/dist/lib/virtualized/useVirtualizedList.d.ts +5 -0
  100. package/dist/llms/rules/installation.js +1 -1
  101. package/dist/llms/rules/requirements.js +1 -1
  102. package/package.json +16 -3
@@ -1,46 +1,110 @@
1
- function d(n) {
2
- return n === "list";
1
+ function s(t) {
2
+ return t === "list";
3
3
  }
4
- function f(n) {
5
- return n.variant === "list" && n.onRowReorder != null && n.getRowId != null;
4
+ function a(t) {
5
+ return t.variant === "list" && t.onRowReorder != null && t.getRowId != null;
6
6
  }
7
- function u(n) {
8
- if (!(n?.id == null || n.id === ""))
9
- return String(n.id);
7
+ function g(t) {
8
+ if (!(t?.id == null || t.id === ""))
9
+ return String(t.id);
10
10
  }
11
- function l(n) {
12
- return n.rowsDrop?.position === "above" ? "above" : "below";
11
+ function w(t) {
12
+ const { api: n, target: r } = t;
13
+ if (n && r instanceof Element) {
14
+ const i = r.closest(".ag-row");
15
+ if (i) {
16
+ const e = i.getAttribute("row-id");
17
+ if (e) {
18
+ const d = n.getRowNode(e);
19
+ if (d) return d;
20
+ }
21
+ const l = i.getAttribute("row-index");
22
+ if (l) {
23
+ const d = Number(l);
24
+ if (!Number.isNaN(d)) {
25
+ const f = n.getDisplayedRowAtIndex(d);
26
+ if (f) return f;
27
+ }
28
+ }
29
+ }
30
+ }
31
+ const o = n?.getFocusedCell();
32
+ if (!(!o || o.rowIndex == null))
33
+ return n?.getDisplayedRowAtIndex(o.rowIndex) ?? void 0;
34
+ }
35
+ function b(t, n) {
36
+ return n.replace(/\{\{position\}\}/g, String(t));
37
+ }
38
+ function p(t) {
39
+ return t.rowsDrop?.position === "above" ? "above" : "below";
40
+ }
41
+ function I(t, n) {
42
+ if (!n) return !0;
43
+ const r = t.event;
44
+ if (r == null || typeof r.clientX != "number" || typeof r.clientY != "number")
45
+ return !0;
46
+ const o = n.getBoundingClientRect();
47
+ return o.width <= 0 || o.height <= 0 ? !0 : r.clientX >= o.left && r.clientX <= o.right && r.clientY >= o.top && r.clientY <= o.bottom;
13
48
  }
14
- function a(n, t) {
15
- if (n)
49
+ function m(t, n) {
50
+ if (t)
16
51
  return String(
17
- n({ data: t, level: 0 })
52
+ t({ data: n, level: 0 })
18
53
  );
19
54
  }
20
- function c(n) {
21
- const t = [], i = (e) => {
22
- for (const r of e) {
23
- if (t.length >= 2) return;
24
- "children" in r && r.children ? i(r.children) : "field" in r && typeof r.field == "string" && t.push(r.field);
55
+ function x(t) {
56
+ const n = u(t), r = [], o = (i) => {
57
+ for (const e of i) {
58
+ if (r.length >= 2) return;
59
+ "children" in e && e.children ? o(e.children) : "field" in e && typeof e.field == "string" && r.push(e.field);
25
60
  }
26
61
  };
27
- return n && i(n), (e) => {
28
- const r = e.rowNode?.data ?? {};
29
- return t.map((o) => r[o]).filter((o) => o != null && o !== "").join(" · ");
62
+ return t && o(t), (i) => {
63
+ const e = i.rowNode?.data ?? {};
64
+ if (n) {
65
+ const l = e[n];
66
+ if (l != null && l !== "") return String(l);
67
+ }
68
+ return r.map((l) => e[l]).filter((l) => l != null && l !== "").join(" · ");
69
+ };
70
+ }
71
+ function c(t, n) {
72
+ return /rank/i.test(t) || n != null && /rank/i.test(n);
73
+ }
74
+ function u(t) {
75
+ const n = [], r = (i) => {
76
+ for (const e of i)
77
+ "children" in e && e.children ? r(e.children) : "field" in e && typeof e.field == "string" && e.colId !== "__drag-handle" && n.push({
78
+ field: e.field,
79
+ colId: typeof e.colId == "string" ? e.colId : void 0,
80
+ context: e.context
81
+ });
30
82
  };
83
+ t && r(t);
84
+ for (const i of n)
85
+ if (/label|name|title$/i.test(i.field)) return i.field;
86
+ for (const i of n) {
87
+ const e = i.context;
88
+ if (e != null && typeof e == "object" && "findable" in e && e.findable === !0 && !c(i.field, i.colId))
89
+ return i.field;
90
+ }
91
+ return n.filter((i) => !c(i.field, i.colId))[0]?.field ?? n[0]?.field;
31
92
  }
32
- function s(n, t) {
33
- return n == null ? t : (i) => {
34
- const e = typeof n == "function" ? n({ data: i.data, rowIndex: i.node.rowIndex }) : n, r = t?.(i);
35
- return e ? { ...r, "--in-ag-list-row-gradient": e } : r;
93
+ function y(t, n) {
94
+ return t == null ? n : (r) => {
95
+ const o = typeof t == "function" ? t({ data: r.data, rowIndex: r.node.rowIndex }) : t, i = n?.(r);
96
+ return o ? { ...i, "--in-ag-list-row-gradient": o } : i;
36
97
  };
37
98
  }
38
99
  export {
39
- c as createDefaultRowDragText,
40
- s as createListRowStyle,
41
- l as dropPositionFromEvent,
42
- f as isAgGridListDragEnabled,
43
- d as isAgGridListVariant,
44
- a as itemIdFromGetRowId,
45
- u as readDragRowId
100
+ x as createDefaultRowDragText,
101
+ y as createListRowStyle,
102
+ p as dropPositionFromEvent,
103
+ b as formatListReorderLiveMessage,
104
+ a as isAgGridListDragEnabled,
105
+ s as isAgGridListVariant,
106
+ I as isListDragPointerOverHost,
107
+ m as itemIdFromGetRowId,
108
+ g as readDragRowId,
109
+ w as readListKeyboardRow
46
110
  };
@@ -0,0 +1,4 @@
1
+ /** Default picked-row body: row label only. The portal owns position and chrome. */
2
+ export declare function ListDragPreviewCard(props: {
3
+ label: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ function r(e) {
3
+ return /* @__PURE__ */ t(
4
+ "span",
5
+ {
6
+ "data-component": "ag-grid-drag-preview-label",
7
+ className: "block min-w-0 truncate text-sm leading-5 text-content",
8
+ children: e.label
9
+ }
10
+ );
11
+ }
12
+ export {
13
+ r as ListDragPreviewCard
14
+ };
@@ -0,0 +1,20 @@
1
+ export type ListDragRowFrame = {
2
+ left: number;
3
+ top: number;
4
+ width: number;
5
+ height: number;
6
+ cardHeight: number;
7
+ rowGradient: string;
8
+ listBorderRadius: string;
9
+ };
10
+ export declare function readListDragRowFrame(container: HTMLElement | null): ListDragRowFrame | null;
11
+ /** List row cells without the drag handle — same content as the visible row card. */
12
+ export declare function readListDragPreviewMarkup(container: HTMLElement | null): string;
13
+ export declare function readListDragPreviewPosition(options: {
14
+ pointerX: number;
15
+ pointerY: number;
16
+ frame: ListDragRowFrame | null;
17
+ }): {
18
+ left: number;
19
+ top: number;
20
+ };
@@ -0,0 +1,42 @@
1
+ function o(t) {
2
+ const e = t?.closest('[data-component="ag-grid-react"][data-variant="list"]');
3
+ if (!(e instanceof HTMLElement)) return "";
4
+ const r = getComputedStyle(e).getPropertyValue("--in-ag-list-radius").trim();
5
+ return r && !r.startsWith("var(") ? r : getComputedStyle(e).getPropertyValue("--radius").trim();
6
+ }
7
+ function c(t) {
8
+ const e = t.querySelector(".ag-center-cols-container") ?? t.querySelector(".ag-grid-scrolling-cells");
9
+ return e instanceof HTMLElement ? e : t;
10
+ }
11
+ function l(t) {
12
+ const e = t?.querySelector(".ag-row.ag-row-dragging");
13
+ if (!(e instanceof HTMLElement)) return null;
14
+ const r = e.getBoundingClientRect(), n = c(e).getBoundingClientRect(), a = e.style.getPropertyValue("--in-ag-list-row-gradient").trim();
15
+ return {
16
+ left: n.left,
17
+ top: r.top,
18
+ width: n.width / 2,
19
+ height: r.height,
20
+ cardHeight: Math.max(r.height - 12, 0),
21
+ rowGradient: a,
22
+ listBorderRadius: o(t)
23
+ };
24
+ }
25
+ function s(t) {
26
+ const e = t?.querySelector(".ag-row.ag-row-dragging");
27
+ if (!(e instanceof HTMLElement)) return "";
28
+ const r = e.querySelectorAll('.ag-cell:not([col-id="__drag-handle"])');
29
+ return r.length === 0 ? "" : `<div class="in-ag-list-drag-preview-row">${Array.from(r).map((n) => `<div class="in-ag-list-drag-preview-cell">${n.innerHTML}</div>`).join("")}</div>`;
30
+ }
31
+ function g(t) {
32
+ const r = t.frame?.cardHeight ?? 40;
33
+ return {
34
+ left: t.pointerX + 16,
35
+ top: t.pointerY - r / 2
36
+ };
37
+ }
38
+ export {
39
+ s as readListDragPreviewMarkup,
40
+ g as readListDragPreviewPosition,
41
+ l as readListDragRowFrame
42
+ };
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ /** Row-level current-match highlight. Find does not remove other rows. */
3
+ export declare function ListFindHighlight(props: {
4
+ active: boolean;
5
+ children: ReactNode;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ function t(i) {
3
+ return /* @__PURE__ */ e("div", { className: i.active ? "bg-canvas-sunken" : void 0, "data-find-current": i.active ? "true" : "false", children: i.children });
4
+ }
5
+ export {
6
+ t as ListFindHighlight
7
+ };
@@ -16,6 +16,10 @@ export interface BackendColDef extends Omit<ColDef, 'cellStyle'> {
16
16
  colorRules?: ColorRule[];
17
17
  cellStyle?: CellStyle | ((params: CellClassParams) => CellStyle | undefined);
18
18
  children?: BackendColDef[];
19
+ decimals?: number;
20
+ divideBy?: number;
21
+ symbol?: string;
22
+ currency?: string;
19
23
  }
20
24
  /**
21
25
  * Processes a single column definition to handle colorRules, valueFormatters, and alignment.
@@ -0,0 +1,78 @@
1
+ import { AG_GRID_VALUE_FORMATTERS as a } from "./value-formatters.js";
2
+ import { isBackendValueFormatterObject as l } from "./value-formatter.types.js";
3
+ const m = ["percentage", "currency", "currencySymbol", "number"], y = {
4
+ percentage: 2,
5
+ currencySymbol: 2,
6
+ currency: 2,
7
+ number: 0
8
+ }, f = (t, e, r) => {
9
+ if (t == null) return !1;
10
+ switch (e) {
11
+ case ">":
12
+ return Number(t) > Number(r);
13
+ case "<":
14
+ return Number(t) < Number(r);
15
+ case ">=":
16
+ return Number(t) >= Number(r);
17
+ case "<=":
18
+ return Number(t) <= Number(r);
19
+ case "==":
20
+ return t == r;
21
+ case "!=":
22
+ return t != r;
23
+ case "contains":
24
+ return String(t).includes(String(r));
25
+ case "startsWith":
26
+ return String(t).startsWith(String(r));
27
+ case "endsWith":
28
+ return String(t).endsWith(String(r));
29
+ default:
30
+ return !1;
31
+ }
32
+ }, g = (t) => (e) => {
33
+ const r = e.value;
34
+ for (const n of t)
35
+ if (f(r, n.condition, n.value)) {
36
+ const o = {
37
+ color: n.color
38
+ };
39
+ return n.fontWeight && (o.fontWeight = n.fontWeight), n.backgroundColor && (o.backgroundColor = n.backgroundColor), o;
40
+ }
41
+ }, u = (t) => {
42
+ if ("children" in t && t.children)
43
+ return {
44
+ ...t,
45
+ children: t.children.map((r) => u(r))
46
+ };
47
+ const e = { ...t };
48
+ if (l(e.valueFormatter)) {
49
+ const r = e.valueFormatter, n = a[r.type];
50
+ n ? (r.decimals !== void 0 && (e.decimals = r.decimals), r.divideBy !== void 0 && (e.divideBy = r.divideBy), r.symbol !== void 0 && (e.symbol = r.symbol), r.currency !== void 0 && (e.currency = r.currency), e.valueFormatter = n) : console.warn(`[processColDef] Unknown valueFormatter type: "${r.type}"`);
51
+ }
52
+ if (t.colorRules && t.colorRules.length > 0) {
53
+ const r = g(t.colorRules), n = e.cellStyle;
54
+ typeof n == "function" ? e.cellStyle = (o) => {
55
+ const i = n(o), s = r(o);
56
+ if (!(!i && !s))
57
+ return { ...i, ...s };
58
+ } : n ? e.cellStyle = (o) => ({
59
+ ...n,
60
+ ...r(o) || {}
61
+ }) : e.cellStyle = r, delete e.colorRules;
62
+ }
63
+ if (l(t.valueFormatter)) {
64
+ const { type: r, decimals: n } = t.valueFormatter;
65
+ if (r && m.includes(r) && !e.filterValueGetter) {
66
+ const o = n ?? y[r] ?? 0, i = Math.pow(10, o), s = t.field;
67
+ e.filterValueGetter = (d) => {
68
+ const c = d.data?.[s];
69
+ return c == null || isNaN(Number(c)) ? c : Math.round(Number(c) * i) / i;
70
+ };
71
+ }
72
+ }
73
+ return (e.type === "number" || e.type === "numericColumn" || e.type === "currency" || e.type === "percentage") && (e.headerClass = e.headerClass ? `${e.headerClass} ag-right-aligned-header` : "ag-right-aligned-header", e.cellClass = e.cellClass ? `${e.cellClass} ag-right-aligned-cell` : "ag-right-aligned-cell"), !e.valueFormatter && (e.type === "numericColumn" || e.type === "number") && (e.valueFormatter = a.number), e;
74
+ }, p = (t) => !t || t.length === 0 ? t : t.filter((e) => e != null).map((e) => u(e));
75
+ export {
76
+ p as processBackendColumnDefs,
77
+ u as processColDef
78
+ };
@@ -1,5 +1,5 @@
1
1
  import { RefObject } from 'react';
2
- import { ColDef, ColGroupDef, GridApi, RowDragEndEvent, RowDragMoveEvent } from 'ag-grid-community';
2
+ import { ColDef, ColGroupDef, GridApi, RowDragCancelEvent, RowDragEndEvent, RowDragLeaveEvent, RowDragMoveEvent } from 'ag-grid-community';
3
3
  import { AgGridReactProps } from 'ag-grid-react';
4
4
  import { ListRowDropCheck, ListRowReorderMeta } from './list-row-move';
5
5
  import { AgGridListHeaderMode, AgGridVisualVariant, AgGridWrapperProps } from './ag-grid.types';
@@ -14,6 +14,11 @@ export declare function useAgGridDragList<TData>(options: {
14
14
  getRowDragHandleLabel?: AgGridWrapperProps<TData>['getRowDragHandleLabel'];
15
15
  canDropRow?: (params: ListRowDropCheck<TData>) => boolean;
16
16
  onRowReorder?: (meta: ListRowReorderMeta<TData>) => void;
17
+ onRowMoveBeyondEdge?: (meta: {
18
+ rowId: string;
19
+ direction: 'up' | 'down';
20
+ row: TData;
21
+ }) => void;
17
22
  getRowStyle?: AgGridReactProps<TData>['getRowStyle'];
18
23
  getRowId?: AgGridReactProps<TData>['getRowId'];
19
24
  rowData?: TData[] | null;
@@ -21,6 +26,7 @@ export declare function useAgGridDragList<TData>(options: {
21
26
  rowDragText?: AgGridReactProps<TData>['rowDragText'];
22
27
  onRowDragEnter?: AgGridReactProps<TData>['onRowDragEnter'];
23
28
  onRowDragMove?: AgGridReactProps<TData>['onRowDragMove'];
29
+ onRowDragLeave?: AgGridReactProps<TData>['onRowDragLeave'];
24
30
  onRowDragCancel?: AgGridReactProps<TData>['onRowDragCancel'];
25
31
  onRowDragEnd?: AgGridReactProps<TData>['onRowDragEnd'];
26
32
  gridContainerRef: RefObject<HTMLDivElement | null>;
@@ -38,7 +44,8 @@ export declare function useAgGridDragList<TData>(options: {
38
44
  getRowStyle: import('ag-grid-community').GetRowStyle<TData, any> | undefined;
39
45
  onRowDragEnter: (event: import('ag-grid-community').RowDragEnterEvent<TData, any>) => void;
40
46
  onRowDragMove: (event: RowDragMoveEvent<TData>) => void;
41
- onRowDragCancel: (event: import('ag-grid-community').RowDragCancelEvent<TData, any>) => void;
47
+ onRowDragLeave: (event: RowDragLeaveEvent<TData>) => void;
48
+ onRowDragCancel: (event: RowDragCancelEvent<TData>) => void;
42
49
  onRowDragEnd: (event: RowDragEndEvent<TData>) => void;
43
50
  } | {
44
51
  getRowStyle: import('ag-grid-community').GetRowStyle<TData, any> | undefined;
@@ -48,6 +55,7 @@ export declare function useAgGridDragList<TData>(options: {
48
55
  animateRows?: undefined;
49
56
  onRowDragEnter?: undefined;
50
57
  onRowDragMove?: undefined;
58
+ onRowDragLeave?: undefined;
51
59
  onRowDragCancel?: undefined;
52
60
  onRowDragEnd?: undefined;
53
61
  } | null;
@@ -1,139 +1,162 @@
1
- import { jsx as _ } from "react/jsx-runtime";
2
- import { useState as oo, useMemo as h, useCallback as M, useEffect as eo } from "react";
3
- import { isListDropAllowed as F, applyUnmanagedRowDrag as ro, applyKeyboardListRowReorder as to } from "./list-row-move.js";
4
- import { buildDragListColumnDefs as ao } from "./build-list-drag-column-defs.js";
5
- import { createDefaultRowDragText as no, createListRowStyle as io, dropPositionFromEvent as H, readDragRowId as m, isAgGridListDragEnabled as so, isAgGridListVariant as lo, itemIdFromGetRowId as N } from "./list-drag-grid-options.js";
6
- import { useListDragPreview as wo } from "./use-list-drag-preview.js";
7
- function go(d) {
8
- const r = d?.getFocusedCell();
9
- if (!(!r || r.rowIndex == null))
10
- return d?.getDisplayedRowAtIndex(r.rowIndex) ?? void 0;
1
+ import { jsx as so } from "react/jsx-runtime";
2
+ import { useState as lo, useMemo as A, useCallback as p, useEffect as wo } from "react";
3
+ import { useImpactNovaI18n as go } from "../../../i18n/use-impact-nova-i18n.js";
4
+ import { isListDropAllowed as B, applyUnmanagedRowDrag as co, applyKeyboardListRowReorder as Do } from "./list-row-move.js";
5
+ import { buildDragListColumnDefs as Ro } from "./build-list-drag-column-defs.js";
6
+ import { createDefaultRowDragText as uo, createListRowStyle as po, formatListReorderLiveMessage as fo, isListDragPointerOverHost as mo, dropPositionFromEvent as W, readDragRowId as h, isAgGridListDragEnabled as Io, isAgGridListVariant as Lo, itemIdFromGetRowId as q, readListKeyboardRow as yo } from "./list-drag-grid-options.js";
7
+ import { useListDragPreview as ho } from "./use-list-drag-preview.js";
8
+ function z(x) {
9
+ const w = [];
10
+ return x.forEachNodeAfterFilterAndSort((P) => {
11
+ const g = h(P);
12
+ g && w.push(g);
13
+ }), w;
11
14
  }
12
- function co(d) {
13
- const r = [];
14
- return d.forEachNodeAfterFilterAndSort((I) => {
15
- const g = m(I);
16
- g && r.push(g);
17
- }), r;
18
- }
19
- function Io(d) {
15
+ function Go(x) {
20
16
  const {
21
- variant: r,
22
- listHeader: I,
17
+ variant: w,
18
+ listHeader: P,
23
19
  columnDefs: g,
24
- mergedColumnDefs: y,
25
- listRowGradient: D,
26
- listDragPreview: T,
27
- isRowDragDisabled: R,
28
- getRowDragHandleLabel: P,
29
- canDropRow: s,
30
- onRowReorder: L,
31
- getRowStyle: x,
32
- getRowId: a,
20
+ mergedColumnDefs: E,
21
+ listRowGradient: f,
22
+ listDragPreview: J,
23
+ isRowDragDisabled: m,
24
+ getRowDragHandleLabel: C,
25
+ canDropRow: d,
26
+ onRowReorder: M,
27
+ onRowMoveBeyondEdge: v,
28
+ getRowStyle: b,
29
+ getRowId: n,
33
30
  rowData: l,
34
- rowDragManaged: K,
35
- rowDragText: U,
36
- onRowDragEnter: V,
37
- onRowDragMove: E,
38
- onRowDragCancel: j,
39
- onRowDragEnd: v,
40
- gridContainerRef: A,
41
- gridApiRef: C
42
- } = d, c = lo(r), t = so({ variant: r, onRowReorder: L, getRowId: a }), b = c && I === "none", u = K === !0, [W, $] = oo(""), q = h(() => t ? ao({
43
- columnDefs: y,
44
- isRowDragDisabled: R,
45
- getRowDragHandleLabel: P
46
- }) : y, [P, t, R, y]), z = h(
47
- () => no(g),
31
+ rowDragManaged: Q,
32
+ rowDragText: G,
33
+ onRowDragEnter: X,
34
+ onRowDragMove: T,
35
+ onRowDragLeave: S,
36
+ onRowDragCancel: Y,
37
+ onRowDragEnd: k,
38
+ gridContainerRef: c,
39
+ gridApiRef: H
40
+ } = x, D = Lo(w), t = Io({ variant: w, onRowReorder: M, getRowId: n }), N = D && P === "none", e = Q === !0, { t: K } = go(), [Z, _] = lo(""), $ = A(() => t ? Ro({
41
+ columnDefs: E,
42
+ isRowDragDisabled: m,
43
+ getRowDragHandleLabel: C
44
+ }) : E, [C, t, m, E]), F = A(
45
+ () => uo(g),
48
46
  [g]
49
- ), G = h(
50
- () => c ? io(D, x) : x,
51
- [x, c, D]
52
- ), f = M(
47
+ ), O = A(
48
+ () => D ? po(f, b) : b,
49
+ [b, D, f]
50
+ ), I = p(
53
51
  (o) => {
54
- L?.(o), $(`Moved to position ${o.toIndex + 1}`);
52
+ M?.(o), _(
53
+ fo(o.toIndex + 1, K("dataTable.listMovedToPosition"))
54
+ );
55
55
  },
56
- [L]
57
- ), n = wo({
56
+ [M, K]
57
+ ), a = ho({
58
58
  enabled: t,
59
- listDragPreview: T,
60
- onRowDragEnter: V,
61
- onRowDragCancel: j
62
- }), B = M(
59
+ gridContainerRef: c,
60
+ listDragPreview: J,
61
+ rowDragText: G ?? F,
62
+ onRowDragEnter: X,
63
+ onRowDragCancel: Y
64
+ }), oo = p(
63
65
  (o) => {
64
- if (n.handleRowDragMove(o), !u) {
65
- const i = Math.max(o.overIndex, 0), e = o.node.data && F(s, { row: o.node.data, toIndex: i });
66
+ if (a.handleRowDragMove(o), !e) {
67
+ const i = Math.max(o.overIndex, 0), r = o.node.data && B(d, { row: o.node.data, toIndex: i }), R = mo(
68
+ o,
69
+ c.current
70
+ );
66
71
  o.api.setRowDropPositionIndicator(
67
- e && o.overNode ? { row: o.overNode, dropIndicatorPosition: H(o) } : null
72
+ R && r && o.overNode ? { row: o.overNode, dropIndicatorPosition: W(o) } : null
68
73
  );
69
74
  }
70
- E?.(o);
75
+ T?.(o);
76
+ },
77
+ [d, c, e, T, a]
78
+ ), ro = p(
79
+ (o) => {
80
+ e || o.api.setRowDropPositionIndicator(null), S?.(o);
71
81
  },
72
- [s, u, E, n]
73
- ), J = M(
82
+ [e, S]
83
+ ), eo = p(
74
84
  (o) => {
75
- if (n.clearPreview(), o.api.setRowDropPositionIndicator(null), !u && l && o.node.data && a) {
76
- const i = m(o.node), e = Math.max(o.overIndex, 0);
77
- if (o.node.data && F(s, { row: o.node.data, toIndex: e }) && i) {
78
- const w = ro({
85
+ e || o.api.setRowDropPositionIndicator(null), a.handleRowDragCancel(o);
86
+ },
87
+ [e, a]
88
+ ), to = p(
89
+ (o) => {
90
+ if (a.clearPreview(), o.api.setRowDropPositionIndicator(null), !e && l && o.node.data && n) {
91
+ const i = h(o.node), r = Math.max(o.overIndex, 0);
92
+ if (o.node.data && B(d, { row: o.node.data, toIndex: r }) && i) {
93
+ const s = co({
79
94
  items: l,
80
- getItemId: (p) => N(a, p) ?? "",
95
+ getItemId: (u) => q(n, u) ?? "",
81
96
  draggedId: i,
82
- overId: m(o.overNode),
83
- position: H(o)
97
+ overId: h(o.overNode),
98
+ position: W(o)
84
99
  });
85
- w && f(w);
100
+ s && I(s);
86
101
  }
87
- } else typeof D == "function" && o.api.redrawRows();
88
- v?.(o);
102
+ } else typeof f == "function" && o.api.redrawRows();
103
+ k?.(o);
89
104
  },
90
- [s, f, a, D, u, v, n, l]
105
+ [d, I, n, f, e, k, a, l]
91
106
  );
92
- eo(() => {
93
- const o = A.current;
94
- if (!t || !o || !a) return;
95
- const i = (e) => {
96
- if (!e.altKey || e.key !== "ArrowUp" && e.key !== "ArrowDown" || e.target?.closest('input, textarea, [contenteditable="true"]')) return;
97
- const w = C.current, p = go(w ?? void 0);
98
- if (!p?.data || !l || !w) return;
99
- const S = m(p);
100
- if (!S) return;
101
- e.preventDefault();
102
- const Y = e.key === "ArrowUp" ? "up" : "down", k = to({
107
+ wo(() => {
108
+ const o = c.current;
109
+ if (!t || !o || !n) return;
110
+ const i = (r) => {
111
+ if (!r.altKey || r.key !== "ArrowUp" && r.key !== "ArrowDown") return;
112
+ const R = r.target;
113
+ if (R?.closest('input, textarea, [contenteditable="true"]')) return;
114
+ const s = H.current, u = yo({ api: s ?? void 0, target: R });
115
+ if (!u?.data || !l || !s) return;
116
+ const L = h(u);
117
+ if (!L) return;
118
+ r.preventDefault();
119
+ const y = r.key === "ArrowUp" ? "up" : "down", U = Do({
103
120
  items: l,
104
- displayedRowIds: co(w),
105
- draggedId: S,
106
- direction: Y,
107
- getItemId: (Z) => N(a, Z) ?? "",
108
- isRowDragDisabled: R,
109
- canDropRow: s
121
+ displayedRowIds: z(s),
122
+ draggedId: L,
123
+ direction: y,
124
+ getItemId: (io) => q(n, io) ?? "",
125
+ isRowDragDisabled: m,
126
+ canDropRow: d
110
127
  });
111
- k && f(k);
128
+ if (U) {
129
+ I(U);
130
+ return;
131
+ }
132
+ const V = z(s), j = V.indexOf(L);
133
+ (y === "up" && j === 0 || y === "down" && j === V.length - 1) && v && v({ rowId: L, direction: y, row: u.data });
112
134
  };
113
135
  return o.addEventListener("keydown", i), () => o.removeEventListener("keydown", i);
114
- }, [s, f, a, C, A, t, R, l]);
115
- const O = t ? /* @__PURE__ */ _("div", { className: "sr-only", "aria-live": "polite", children: W }) : null, Q = t ? {
116
- rowDragManaged: u,
117
- rowDragText: U ?? z,
136
+ }, [d, I, n, H, c, t, m, v, l]);
137
+ const ao = t ? /* @__PURE__ */ so("div", { className: "sr-only", "aria-live": "polite", children: Z }) : null, no = t ? {
138
+ rowDragManaged: e,
139
+ rowDragText: G ?? F,
118
140
  suppressMoveWhenRowDragging: !0,
119
141
  animateRows: !0,
120
- getRowStyle: G,
121
- onRowDragEnter: n.handleRowDragEnter,
122
- onRowDragMove: B,
123
- onRowDragCancel: n.handleRowDragCancel,
124
- onRowDragEnd: J
125
- } : c ? { getRowStyle: G } : null;
142
+ getRowStyle: O,
143
+ onRowDragEnter: a.handleRowDragEnter,
144
+ onRowDragMove: oo,
145
+ onRowDragLeave: ro,
146
+ onRowDragCancel: eo,
147
+ onRowDragEnd: to
148
+ } : D ? { getRowStyle: O } : null;
126
149
  return {
127
150
  isDragList: t,
128
- isListVariant: c,
129
- hideColumnHeader: b,
130
- dragListColumnDefs: q,
131
- dragListGridProps: Q,
132
- listHeaderGridProps: b ? { headerHeight: 0 } : null,
133
- dragPreviewPortal: n.dragPreviewPortal,
134
- liveRegion: O
151
+ isListVariant: D,
152
+ hideColumnHeader: N,
153
+ dragListColumnDefs: $,
154
+ dragListGridProps: no,
155
+ listHeaderGridProps: N ? { headerHeight: 0 } : null,
156
+ dragPreviewPortal: a.dragPreviewPortal,
157
+ liveRegion: ao
135
158
  };
136
159
  }
137
160
  export {
138
- Io as useAgGridDragList
161
+ Go as useAgGridDragList
139
162
  };