@neo4j-ndl/react 3.2.12 → 3.2.13

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 (53) hide show
  1. package/lib/cjs/data-grid/Components.js +48 -63
  2. package/lib/cjs/data-grid/Components.js.map +1 -1
  3. package/lib/cjs/data-grid/DataGrid.js +11 -12
  4. package/lib/cjs/data-grid/DataGrid.js.map +1 -1
  5. package/lib/cjs/data-grid/DataGridContext.js.map +1 -1
  6. package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js +510 -0
  7. package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js.map +1 -0
  8. package/lib/cjs/data-grid/data-grid-nav/helpers.js +49 -0
  9. package/lib/cjs/data-grid/data-grid-nav/helpers.js.map +1 -0
  10. package/lib/cjs/data-grid/data-grid-nav/index.js +77 -0
  11. package/lib/cjs/data-grid/data-grid-nav/index.js.map +1 -0
  12. package/lib/cjs/data-grid/data-grid-nav/keys.js +42 -0
  13. package/lib/cjs/data-grid/data-grid-nav/keys.js.map +1 -0
  14. package/lib/cjs/data-grid/data-grid-nav/selectors.js +31 -0
  15. package/lib/cjs/data-grid/data-grid-nav/selectors.js.map +1 -0
  16. package/lib/cjs/data-grid/helpers.js +47 -1
  17. package/lib/cjs/data-grid/helpers.js.map +1 -1
  18. package/lib/cjs/data-grid/index.js +7 -1
  19. package/lib/cjs/data-grid/index.js.map +1 -1
  20. package/lib/cjs/modal/Modal.js +13 -7
  21. package/lib/cjs/modal/Modal.js.map +1 -1
  22. package/lib/esm/data-grid/Components.js +49 -64
  23. package/lib/esm/data-grid/Components.js.map +1 -1
  24. package/lib/esm/data-grid/DataGrid.js +5 -6
  25. package/lib/esm/data-grid/DataGrid.js.map +1 -1
  26. package/lib/esm/data-grid/DataGridContext.js.map +1 -1
  27. package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js +506 -0
  28. package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js.map +1 -0
  29. package/lib/esm/data-grid/data-grid-nav/helpers.js +45 -0
  30. package/lib/esm/data-grid/data-grid-nav/helpers.js.map +1 -0
  31. package/lib/esm/data-grid/data-grid-nav/index.js +74 -0
  32. package/lib/esm/data-grid/data-grid-nav/index.js.map +1 -0
  33. package/lib/esm/data-grid/data-grid-nav/keys.js +39 -0
  34. package/lib/esm/data-grid/data-grid-nav/keys.js.map +1 -0
  35. package/lib/esm/data-grid/data-grid-nav/selectors.js +28 -0
  36. package/lib/esm/data-grid/data-grid-nav/selectors.js.map +1 -0
  37. package/lib/esm/data-grid/helpers.js +45 -0
  38. package/lib/esm/data-grid/helpers.js.map +1 -1
  39. package/lib/esm/data-grid/index.js +2 -0
  40. package/lib/esm/data-grid/index.js.map +1 -1
  41. package/lib/esm/modal/Modal.js +13 -7
  42. package/lib/esm/modal/Modal.js.map +1 -1
  43. package/lib/types/data-grid/Components.d.ts +8 -5
  44. package/lib/types/data-grid/DataGrid.d.ts +2 -4
  45. package/lib/types/data-grid/DataGridContext.d.ts +2 -0
  46. package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts +94 -0
  47. package/lib/types/data-grid/data-grid-nav/helpers.d.ts +26 -0
  48. package/lib/types/data-grid/data-grid-nav/index.d.ts +29 -0
  49. package/lib/types/data-grid/data-grid-nav/keys.d.ts +37 -0
  50. package/lib/types/data-grid/data-grid-nav/selectors.d.ts +27 -0
  51. package/lib/types/data-grid/helpers.d.ts +11 -1
  52. package/lib/types/data-grid/index.d.ts +2 -0
  53. package/package.json +2 -4
@@ -0,0 +1,74 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import { useRef, useState, useCallback, useMemo } from 'react';
22
+ import { DataGridNav } from './data-grid-nav';
23
+ export function useTableNav(options) {
24
+ // Store the actual class instance in a ref so we only create it once
25
+ const instanceRef = useRef(null);
26
+ if (instanceRef.current === null) {
27
+ instanceRef.current = new DataGridNav(options);
28
+ }
29
+ // A piece of state to force a re-render when you want to react to instance changes
30
+ const [, setVersion] = useState(0);
31
+ const forceUpdate = useCallback(() => setVersion((v) => v + 1), []);
32
+ // Wrap the instance in a proxy that intercepts reads/writes
33
+ const proxiedInstance = useMemo(() => {
34
+ const handler = {
35
+ get(target, prop, receiver) {
36
+ const value = Reflect.get(target, prop, receiver);
37
+ // If it's a function (a class method), we can intercept calls:
38
+ if (typeof value === 'function') {
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
+ return (...args) => {
41
+ // Call the original method
42
+ const result = value.apply(target, args);
43
+ // Example: force re-render if the method is known to change internal state
44
+ // or if you want to force re-render after *every* method call, remove the condition
45
+ if (['enable', 'disable'].includes(String(prop))) {
46
+ forceUpdate();
47
+ }
48
+ return result;
49
+ };
50
+ }
51
+ // Otherwise, it's a property. Just return it.
52
+ return value;
53
+ },
54
+ // Trap for property assignments, so React can re-render on changes
55
+ set(target, prop, newValue, receiver) {
56
+ // eslint-disable-next-line @typescript-eslint/naming-convention
57
+ const result = Reflect.set(target, prop, newValue, receiver);
58
+ // Force re-render after setting *any* property
59
+ forceUpdate();
60
+ return result;
61
+ },
62
+ };
63
+ return new Proxy(instanceRef.current, handler);
64
+ // We only want to create a new Proxy if the instanceRef or forceUpdate changes
65
+ }, [forceUpdate]);
66
+ return {
67
+ listeners: {
68
+ onKeyDown: (e) => proxiedInstance.tableKeyDown(e.nativeEvent),
69
+ onKeyUp: () => proxiedInstance.tableKeyUp(),
70
+ },
71
+ tableNav: proxiedInstance,
72
+ };
73
+ }
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,WAAW,EAAU,MAAM,iBAAiB,CAAC;AAEtD,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,qEAAqE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IACrD,IAAI,WAAW,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACjC,WAAW,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,mFAAmF;IACnF,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEpE,4DAA4D;IAC5D,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;QACnC,MAAM,OAAO,GAA8B;YACzC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;gBACxB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAElD,+DAA+D;gBAC/D,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;oBAChC,8DAA8D;oBAC9D,OAAO,CAAC,GAAG,IAAW,EAAE,EAAE;wBACxB,2BAA2B;wBAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;wBAEzC,2EAA2E;wBAC3E,oFAAoF;wBACpF,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;4BACjD,WAAW,EAAE,CAAC;wBAChB,CAAC;wBACD,OAAO,MAAM,CAAC;oBAChB,CAAC,CAAC;gBACJ,CAAC;gBAED,8CAA8C;gBAC9C,OAAO,KAAK,CAAC;YACf,CAAC;YAED,mEAAmE;YACnE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ;gBAClC,gEAAgE;gBAChE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAC7D,+CAA+C;gBAC/C,WAAW,EAAE,CAAC;gBACd,OAAO,MAAM,CAAC;YAChB,CAAC;SACF,CAAC;QAEF,OAAO,IAAI,KAAK,CAAC,WAAW,CAAC,OAAsB,EAAE,OAAO,CAAC,CAAC;QAC9D,+EAA+E;IACjF,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO;QACL,SAAS,EAAE;YACT,SAAS,EAAE,CAAC,CAAsB,EAAE,EAAE,CACpC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC;YAC7C,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE;SAC5C;QACD,QAAQ,EAAE,eAAe;KAC1B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export var Keys;
22
+ (function (Keys) {
23
+ Keys["Enter"] = "Enter";
24
+ Keys["Escape"] = "Escape";
25
+ Keys["Shift"] = "Shift";
26
+ Keys["Control"] = "Control";
27
+ Keys["Home"] = "Home";
28
+ Keys["End"] = "End";
29
+ /** Page Keys */
30
+ Keys["PageUp"] = "PageUp";
31
+ Keys["PageDown"] = "PageDown";
32
+ /** Arrow Keys */
33
+ Keys["ArrowLeft"] = "ArrowLeft";
34
+ Keys["ArrowUp"] = "ArrowUp";
35
+ Keys["ArrowRight"] = "ArrowRight";
36
+ Keys["ArrowDown"] = "ArrowDown";
37
+ Keys["F2"] = "F2";
38
+ })(Keys || (Keys = {}));
39
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAN,IAAY,IAgBX;AAhBD,WAAY,IAAI;IACd,uBAAe,CAAA;IACf,yBAAiB,CAAA;IACjB,uBAAe,CAAA;IACf,2BAAmB,CAAA;IACnB,qBAAa,CAAA;IACb,mBAAW,CAAA;IACX,gBAAgB;IAChB,yBAAiB,CAAA;IACjB,6BAAqB,CAAA;IACrB,iBAAiB;IACjB,+BAAuB,CAAA;IACvB,2BAAmB,CAAA;IACnB,iCAAyB,CAAA;IACzB,+BAAuB,CAAA;IACvB,iBAAS,CAAA;AACX,CAAC,EAhBW,IAAI,KAAJ,IAAI,QAgBf"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export const Selectors = {
22
+ Cell: '[role="cell"],[role="gridcell"],[role="columnheader"],[role="rowheader"],td,th',
23
+ Row: '[role="row"],tr',
24
+ RowGroup: '[role="rowgroup"],thead,tbody,tfoot',
25
+ /** Selector from here: https://github.com/Shopify/polaris/blob/main/polaris-react/src/utilities/focus.ts#L10 */
26
+ Focusable: 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not([aria-disabled="true"]):not([tabindex="-1"]):not(:disabled),*[tabindex]:not(.ndl-data-grid-resizer)',
27
+ };
28
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,gFAAgF;IACtF,GAAG,EAAE,iBAAiB;IACtB,QAAQ,EAAE,qCAAqC;IAC/C,gHAAgH;IAChH,SAAS,EACP,qNAAqN;CAC/M,CAAC"}
@@ -86,4 +86,49 @@ export const gridGenerator = (table) => {
86
86
  * @param columnDef
87
87
  */
88
88
  export const isSizeConstrained = (columnDef) => columnDef.size !== undefined && columnDef.size !== 150;
89
+ export var ResizeDirection;
90
+ (function (ResizeDirection) {
91
+ ResizeDirection["LEFT"] = "left";
92
+ ResizeDirection["RIGHT"] = "right";
93
+ })(ResizeDirection || (ResizeDirection = {}));
94
+ const isLastColumnId = (headers, columnId) => {
95
+ const columnIndex = headers.findIndex((header) => header.id === columnId);
96
+ return columnIndex === headers.length - 1;
97
+ };
98
+ /**
99
+ * Function to resize the column
100
+ * @param direction direction to resize
101
+ * @param header the header cell that is being resized
102
+ */
103
+ export const resizeColumn = (direction, header) => {
104
+ var _a, _b, _c;
105
+ const RESIZE_AMOUNT = 5; // Pixels to shift
106
+ const currentColumnId = header.column.id;
107
+ const table = header.getContext().table;
108
+ const maxColumnWidth = (_a = header.column.columnDef.maxSize) !== null && _a !== void 0 ? _a : window.innerWidth;
109
+ const minColumnWidth = (_b = header.column.columnDef.minSize) !== null && _b !== void 0 ? _b : 0;
110
+ const maxTableRowWidth = ((_c = document.querySelector('.ndl-data-grid-thead')) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().width) || 0;
111
+ const adjustColumnWidth = (currentWidth, adjustment) => {
112
+ return Math.min(Math.max(currentWidth + adjustment, minColumnWidth), maxColumnWidth);
113
+ };
114
+ if (direction === ResizeDirection.LEFT) {
115
+ table.setColumnSizing((currentSizes) => {
116
+ const newWidth = adjustColumnWidth(currentSizes[currentColumnId], -RESIZE_AMOUNT);
117
+ return Object.assign(Object.assign({}, currentSizes), { [currentColumnId]: newWidth });
118
+ });
119
+ }
120
+ else if (direction === ResizeDirection.RIGHT) {
121
+ table.setColumnSizing((currentSizes) => {
122
+ if (isLastColumnId(header.headerGroup.headers, currentColumnId)) {
123
+ // Calculate the total width of the current columns combined
124
+ const totalCurrentWidth = Object.values(currentSizes).reduce((total, size) => total + (isNaN(size) ? 0 : size), 0);
125
+ if (totalCurrentWidth + RESIZE_AMOUNT >= maxTableRowWidth) {
126
+ return currentSizes;
127
+ }
128
+ }
129
+ const newWidth = adjustColumnWidth(currentSizes[currentColumnId], RESIZE_AMOUNT);
130
+ return Object.assign(Object.assign({}, currentSizes), { [currentColumnId]: newWidth });
131
+ });
132
+ }
133
+ };
89
134
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/data-grid/helpers.tsx"],"names":[],"mappings":"AA0BA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAE,GAAW,EAAE,EAAE;IACrE,MAAM,IAAI,GAAG,GAAG,CAAC;IACjB,MAAM,KAAK,GAAG,CAAC,CAAC;IAChB,MAAM,IAAI,GAAG,OAAO,GAAG,KAAK,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,IAAI,MAA0B,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;YACtD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC5B,aAAa,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACjC,CAAC;iBAAM,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,KA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EAAE,QAAQ,IAAG;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,SAAS,KAAK,eAAe,CAAC,KAAK,EAAE,CAAC;QAC/C,KAAK,CAAC,eAAe,CAAC,CAAC,YAAY,EAAE,EAAE;YACrC,IAAI,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,eAAoB,CAAC,EAAE,CAAC;gBACrE,4DAA4D;gBAC5D,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAC1D,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EACjD,CAAC,CACF,CAAC;gBACF,IAAI,iBAAiB,GAAG,aAAa,IAAI,gBAAgB,EAAE,CAAC;oBAC1D,OAAO,YAAY,CAAC;gBACtB,CAAC;YACH,CAAC;YACD,MAAM,QAAQ,GAAG,iBAAiB,CAChC,YAAY,CAAC,eAAe,CAAC,EAC7B,aAAa,CACd,CAAC;YACF,uCAAY,YAAY,KAAE,CAAC,eAAe,CAAC,EAAE,QAAQ,IAAG;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
@@ -22,4 +22,6 @@ import { useDataGridContext } from './DataGridContext';
22
22
  import * as dataGridUtils from './helpers';
23
23
  export { DataGrid, DataGridComponents } from './DataGrid';
24
24
  export { dataGridUtils, useDataGridContext };
25
+ export { useTableNav } from './data-grid-nav';
26
+ export * from './data-grid-nav/data-grid-nav';
25
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data-grid/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data-grid/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,cAAc,+BAA+B,CAAC"}
@@ -37,12 +37,18 @@ export const Modal = forwardRef(function Modal({ isOpen: open, size = 'medium',
37
37
  // Make sure the event starts and ends on the same DOM element.
38
38
  backdropClick.current = event.target === event.currentTarget;
39
39
  };
40
- const handleKeyDown = (e) => {
41
- if (e.key === 'Escape') {
42
- e.preventDefault();
43
- onClose === null || onClose === void 0 ? void 0 : onClose(e, ModalCloseReason.ESCAPE_KEY_DOWN);
44
- }
45
- };
40
+ useEffect(() => {
41
+ const handleKeyDown = (e) => {
42
+ if (e.key === 'Escape') {
43
+ e.preventDefault();
44
+ onClose === null || onClose === void 0 ? void 0 : onClose(e, ModalCloseReason.ESCAPE_KEY_DOWN);
45
+ }
46
+ };
47
+ document.addEventListener('keydown', handleKeyDown);
48
+ return () => {
49
+ document.removeEventListener('keydown', handleKeyDown);
50
+ };
51
+ }, [onClose]);
46
52
  const handleBackdropClick = (e) => {
47
53
  if (!backdropClick.current) {
48
54
  return;
@@ -65,6 +71,6 @@ export const Modal = forwardRef(function Modal({ isOpen: open, size = 'medium',
65
71
  const rootClasses = classNames('ndl-modal-root', rootProps === null || rootProps === void 0 ? void 0 : rootProps.className, {
66
72
  'ndl-modal-container': container,
67
73
  });
68
- return (_jsx(Portal, { container: container, children: _jsx(FocusLock, { hasPositiveIndices: true, returnFocus: true, children: _jsx("div", Object.assign({ className: rootClasses, onKeyDown: handleKeyDown, onClick: handleBackdropClick, "data-testid": "ndl-modal-backdrop", role: "presentation" }, htmlAttributes, { children: _jsx("div", Object.assign({ className: "ndl-modal-wrapper", "data-testid": "ndl-modal-wrapper" }, rootProps, { onMouseDown: handleMouseDown, role: "presentation", children: _jsx("div", Object.assign({}, modalProps, { role: "dialog", "aria-modal": "true", className: classes, ref: ref, children: children })) })) })) }) }));
74
+ return (_jsx(Portal, { container: container, children: _jsx(FocusLock, { hasPositiveIndices: true, returnFocus: true, children: _jsx("div", Object.assign({ className: rootClasses, onClick: handleBackdropClick, "data-testid": "ndl-modal-backdrop", role: "presentation" }, htmlAttributes, { children: _jsx("div", Object.assign({ className: "ndl-modal-wrapper", "data-testid": "ndl-modal-wrapper" }, rootProps, { onMouseDown: handleMouseDown, role: "presentation", children: _jsx("div", Object.assign({}, modalProps, { role: "dialog", "aria-modal": "true", className: classes, ref: ref, children: children })) })) })) }) }));
69
75
  });
70
76
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/modal/Modal.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,oDAAgC,CAAA;IAChC,qDAAiC,CAAA;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AmB,IAC3B,SAAS,IACb,WAAW,EAAE,eAAe,EAC5B,IAAI,EAAC,cAAc,YAEnB,8BACM,UAAU,IACd,IAAI,EAAC,QAAQ,gBACF,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,GAAG,YAEP,QAAQ,IACL,IACF,IACF,GACI,GACL,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -19,7 +19,7 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  import { type Cell, type CellContext, type Header as HeaderType, type Row, type RowData, type SortDirection } from '@tanstack/react-table';
22
- import { type IconButtonProps } from '../button';
22
+ import { IconButton } from '../button';
23
23
  import { Menu } from '../context-menu';
24
24
  import { type ColumnAction } from './datagrid-types';
25
25
  import NoDataIllustration from './illustrations/NoData';
@@ -53,7 +53,7 @@ export interface ActionButtonProps {
53
53
  export declare const ActionButton: ({ action, children, onClose, innerProps, }: ActionButtonProps) => import("react/jsx-runtime").JSX.Element;
54
54
  export interface RowActionCellProps<T extends RowData> {
55
55
  cell?: CellContext<T, unknown>;
56
- innerIconButtonProps?: Partial<IconButtonProps>;
56
+ innerIconButtonProps?: Partial<React.ComponentPropsWithoutRef<typeof IconButton>>;
57
57
  innerMenuProps?: Partial<React.ComponentProps<typeof Menu>>;
58
58
  }
59
59
  declare const RowActionCell: <T extends RowData>({ cell, innerIconButtonProps, innerMenuProps, }: RowActionCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
@@ -105,16 +105,19 @@ export declare const NoDataPlaceholderContentWrapper: ({ children, innerProps, }
105
105
  export interface InlineEditCellProps<T extends RowData> {
106
106
  cell: CellContext<T, unknown>;
107
107
  value: string;
108
+ ariaLabel?: string;
108
109
  }
109
- declare const InlineEditCell: <T extends RowData>({ cell, value, }: InlineEditCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
110
+ declare const InlineEditCell: <T extends RowData>({ cell, value, ariaLabel, }: InlineEditCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
110
111
  export interface DropDownCellProps<T extends RowData> {
111
112
  cell: CellContext<T, unknown>;
112
113
  options: {
113
114
  value: string;
114
115
  label: string;
115
116
  }[];
116
- portalTarget?: HTMLElement;
117
+ /** Should be null if the data grid is portaled, e.g. when used in a Dialog */
118
+ portalTarget?: HTMLElement | null;
119
+ ariaLabel?: string;
117
120
  }
118
- declare const DropDownCell: <T extends RowData>({ cell, options, portalTarget, }: DropDownCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
121
+ declare const DropDownCell: <T extends RowData>({ cell, options, portalTarget, ariaLabel, }: DropDownCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
119
122
  declare const NoDataIcon: import("react").ForwardRefExoticComponent<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
120
123
  export { ResizingBar, Header, Body, BodyCell, BodyRow, InlineEditCell, DropDownCell, RowActionCell, HeaderCell, HeaderTitle, Navigation, TableResults, RowsPerPage, Pagination, PaginationNumericButtons, PaginationArrowButton, PaginationNumericButton, NoDataPlaceholder, NoDataIllustration, NoDataIcon, LoadingPlaceholder, Scrollable, };
@@ -29,8 +29,8 @@ export declare const DataGridComponents: {
29
29
  BodyCell: <T extends RowData>({ cell, children, innerProps, }: import("./Components").BodyCellProps<T>) => import("react/jsx-runtime").JSX.Element;
30
30
  BodyRow: <T extends RowData>({ row, children, innerProps, }: import("./Components").BodyRowProps<T>) => import("react/jsx-runtime").JSX.Element;
31
31
  RowActionCell: <T extends RowData>({ cell, innerIconButtonProps, innerMenuProps, }: import("./Components").RowActionCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
32
- InlineEditCell: <T extends RowData>({ cell, value, }: import("./Components").InlineEditCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
33
- DropDownCell: <T extends RowData>({ cell, options, portalTarget, }: import("./Components").DropDownCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
32
+ InlineEditCell: <T extends RowData>({ cell, value, ariaLabel, }: import("./Components").InlineEditCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
33
+ DropDownCell: <T extends RowData>({ cell, options, portalTarget, ariaLabel, }: import("./Components").DropDownCellProps<T>) => import("react/jsx-runtime").JSX.Element | null;
34
34
  HeaderCell: <T extends RowData>({ cell, children, innerProps, }: import("./Components").HeaderCellProps<T>) => import("react/jsx-runtime").JSX.Element;
35
35
  HeaderTitle: <T extends RowData>({ cell, children, innerProps, }: import("./Components").HeaderTitleProps<T>) => import("react/jsx-runtime").JSX.Element;
36
36
  ActionButton: ({ action, children, onClose, innerProps, }: import("./Components").ActionButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -79,7 +79,6 @@ export type DataGridProps<T extends RowData> = {
79
79
  * Enables keyboard navigation.
80
80
  * To control keyboard navigation programmatically
81
81
  * for edge cases, pass a `ref` to `tableNavRef`
82
- * @see {@link https://github.com/konsalex/table-nav }
83
82
  */
84
83
  isKeyboardNavigable?: boolean;
85
84
  /**
@@ -96,7 +95,6 @@ export type DataGridProps<T extends RowData> = {
96
95
  /**
97
96
  * Reference to the tableNav instance
98
97
  * for programmatic control
99
- * @see {@link https://github.com/konsalex/table-nav }
100
98
  */
101
99
  tableNavRef?: React.RefObject<any>;
102
100
  /** Table instance created from `useTable`*/
@@ -20,6 +20,7 @@
20
20
  */
21
21
  import { type Table as DataGridType, type RowData } from '@tanstack/react-table';
22
22
  import { type ActionButton, type Body, type BodyCell, type BodyRow, type ColumnControls, type Header, type HeaderCell, type HeaderTitle, type LoadingPlaceholder, type Navigation, type NoDataPlaceholder, type Pagination, type PaginationArrowButton, type PaginationNumericButton, type PaginationNumericButtons, type ResizingBar, type RowActionCell, type RowsPerPage, type Scrollable, type TableResults } from './Components';
23
+ import { DataGridNav } from './data-grid-nav/data-grid-nav';
23
24
  type Nullable<T> = T | null;
24
25
  export interface DataGridComponentsInterface<T extends RowData> {
25
26
  ResizingBar?: Nullable<typeof ResizingBar<T>>;
@@ -59,6 +60,7 @@ export interface DataGridContextType<T extends RowData> {
59
60
  isLoading: boolean;
60
61
  hasResizeColumns: boolean;
61
62
  isKeyboardNavigationEnabled: boolean;
63
+ dataGridNav: DataGridNav;
62
64
  }
63
65
  export declare const DataGridContext: import("react").Context<DataGridContextType<any>>;
64
66
  export declare function useDataGridContext<T extends RowData>(): DataGridContextType<T>;
@@ -0,0 +1,94 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+
22
+ import { Selectors } from './selectors';
23
+ export type Config = {
24
+ /** Enable debug logs */
25
+ isDebug?: boolean;
26
+ /** CSS Selectors being used to find Rows, Row Groups, Cells and Focusable elements */
27
+ selectors?: Partial<typeof Selectors>;
28
+ /** How many rows to move when pressing page up/down - Default goes to first/last row */
29
+ pageUpDown?: number;
30
+ } | undefined;
31
+ export declare class DataGridNav {
32
+ private selectors;
33
+ readonly pageUpDown: number | undefined;
34
+ private keys;
35
+ private disabled;
36
+ readonly debug: boolean;
37
+ constructor();
38
+ constructor(config: Config);
39
+ private debugLog;
40
+ /**
41
+ * Disables the keyboard listener in cases
42
+ * that elements inside the grid need to use
43
+ * arrows keys etc., like select dropdowns
44
+ */
45
+ disable(): void;
46
+ /**
47
+ * Enables the keyboard listeners
48
+ */
49
+ enable(): void;
50
+ private isFocusable;
51
+ focusParentCell(el: Element): void;
52
+ /** Used as a keyboard listener for key up */
53
+ tableKeyUp(): void;
54
+ /** Used as a keyboard listener for key down */
55
+ tableKeyDown(e: KeyboardEvent): void;
56
+ /**
57
+ * Handles the navigation inside a cell
58
+ */
59
+ cellNavigation(e: KeyboardEvent): void;
60
+ /**
61
+ * Get the valid focusable child of a cell
62
+ * @return {FocusableElement | null} - The valid focusable child, or null if there are none or multiple focusable children
63
+ */
64
+ private getValidFocusableChild;
65
+ /**
66
+ * Handles the navigation outside a cell
67
+ * on the grid level
68
+ */
69
+ gridNavigation(e: KeyboardEvent): void;
70
+ private pageCellNavigation;
71
+ private verticalCellNavigation;
72
+ /**
73
+ * Sending a row `Element` and then the first cell will be focused.
74
+ *
75
+ * If you want to focus the last cell then the row children can be passed in
76
+ * reversed order
77
+ */
78
+ private focusOnFirstCell;
79
+ /**
80
+ * Get the column index of a `cell` based on the first `row` parent.
81
+ * `cellIndex` could be used, but it's not supported in HTML tables.
82
+ */
83
+ private getColumnIndex;
84
+ /**
85
+ * Get the row index of a `row` based
86
+ * on its sibling rows
87
+ */
88
+ private getRowIndex;
89
+ /**
90
+ * Equivalent to prevUntil/nextUntil in jQuery
91
+ * https://api.jquery.com/prevUntil/
92
+ */
93
+ private findUntil;
94
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ /**
22
+ * This function checks that an element is interactive and of a type that doesn't disrupt grid navigation.
23
+ * @param element the element to check
24
+ * @returns true if the element is an interactive element that doesn't disrupt grid navigation
25
+ */
26
+ export declare const isValidInteractiveElement: (element: Element) => boolean;
@@ -0,0 +1,29 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import React from 'react';
22
+ import { DataGridNav, Config } from './data-grid-nav';
23
+ export declare function useTableNav(options?: Config): {
24
+ listeners: {
25
+ onKeyDown: (e: React.KeyboardEvent) => void;
26
+ onKeyUp: () => void;
27
+ };
28
+ tableNav: DataGridNav;
29
+ };
@@ -0,0 +1,37 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export declare enum Keys {
22
+ Enter = "Enter",
23
+ Escape = "Escape",
24
+ Shift = "Shift",
25
+ Control = "Control",
26
+ Home = "Home",
27
+ End = "End",
28
+ /** Page Keys */
29
+ PageUp = "PageUp",
30
+ PageDown = "PageDown",
31
+ /** Arrow Keys */
32
+ ArrowLeft = "ArrowLeft",
33
+ ArrowUp = "ArrowUp",
34
+ ArrowRight = "ArrowRight",
35
+ ArrowDown = "ArrowDown",
36
+ F2 = "F2"
37
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export declare const Selectors: {
22
+ readonly Cell: "[role=\"cell\"],[role=\"gridcell\"],[role=\"columnheader\"],[role=\"rowheader\"],td,th";
23
+ readonly Row: "[role=\"row\"],tr";
24
+ readonly RowGroup: "[role=\"rowgroup\"],thead,tbody,tfoot";
25
+ /** Selector from here: https://github.com/Shopify/polaris/blob/main/polaris-react/src/utilities/focus.ts#L10 */
26
+ readonly Focusable: "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not([aria-disabled=\"true\"]):not([tabindex=\"-1\"]):not(:disabled),*[tabindex]:not(.ndl-data-grid-resizer)";
27
+ };
@@ -18,7 +18,7 @@
18
18
  * You should have received a copy of the GNU General Public License
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
- import { type ColumnDef, type RowData, type Table } from '@tanstack/react-table';
21
+ import { type ColumnDef, type RowData, type Table, type Header as HeaderType } from '@tanstack/react-table';
22
22
  /**
23
23
  * Modified from here: https://gist.github.com/kottenator/9d936eb3e4e3c3e02598
24
24
  *
@@ -43,3 +43,13 @@ export declare const gridGenerator: <T extends RowData>(table: Table<T>) => stri
43
43
  * @param columnDef
44
44
  */
45
45
  export declare const isSizeConstrained: <T extends RowData>(columnDef: ColumnDef<T>) => boolean;
46
+ export declare enum ResizeDirection {
47
+ LEFT = "left",
48
+ RIGHT = "right"
49
+ }
50
+ /**
51
+ * Function to resize the column
52
+ * @param direction direction to resize
53
+ * @param header the header cell that is being resized
54
+ */
55
+ export declare const resizeColumn: <T extends RowData>(direction: ResizeDirection, header: HeaderType<T, unknown>) => void;
@@ -23,3 +23,5 @@ import * as dataGridUtils from './helpers';
23
23
  export { DataGrid, DataGridComponents } from './DataGrid';
24
24
  export { dataGridUtils, useDataGridContext };
25
25
  export type * from './datagrid-types';
26
+ export { useTableNav } from './data-grid-nav';
27
+ export * from './data-grid-nav/data-grid-nav';