@neo4j-ndl/react 2.9.4 → 2.10.0

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 (66) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/LICENSES.txt +26 -0
  3. package/lib/NOTICE.txt +6 -0
  4. package/lib/cjs/_common/utils.js +41 -1
  5. package/lib/cjs/_common/utils.js.map +1 -1
  6. package/lib/cjs/index.js +1 -0
  7. package/lib/cjs/index.js.map +1 -1
  8. package/lib/cjs/tree-view/TreeItemWrapper.js +201 -0
  9. package/lib/cjs/tree-view/TreeItemWrapper.js.map +1 -0
  10. package/lib/cjs/tree-view/TreeView.js +314 -0
  11. package/lib/cjs/tree-view/TreeView.js.map +1 -0
  12. package/lib/cjs/tree-view/TreeViewItem.js +89 -0
  13. package/lib/cjs/tree-view/TreeViewItem.js.map +1 -0
  14. package/lib/cjs/tree-view/TreeViewTextItem.js +153 -0
  15. package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -0
  16. package/lib/cjs/tree-view/TreeViewTrail.js +30 -0
  17. package/lib/cjs/tree-view/TreeViewTrail.js.map +1 -0
  18. package/lib/cjs/tree-view/index.js +26 -0
  19. package/lib/cjs/tree-view/index.js.map +1 -0
  20. package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js +119 -0
  21. package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js.map +1 -0
  22. package/lib/cjs/tree-view/tree-view-keyboard-helpers.js +75 -0
  23. package/lib/cjs/tree-view/tree-view-keyboard-helpers.js.map +1 -0
  24. package/lib/cjs/tree-view/tree-view-types.js +24 -0
  25. package/lib/cjs/tree-view/tree-view-types.js.map +1 -0
  26. package/lib/cjs/tree-view/tree-view-utils.js +187 -0
  27. package/lib/cjs/tree-view/tree-view-utils.js.map +1 -0
  28. package/lib/esm/_common/utils.js +38 -0
  29. package/lib/esm/_common/utils.js.map +1 -1
  30. package/lib/esm/index.js +1 -0
  31. package/lib/esm/index.js.map +1 -1
  32. package/lib/esm/tree-view/TreeItemWrapper.js +172 -0
  33. package/lib/esm/tree-view/TreeItemWrapper.js.map +1 -0
  34. package/lib/esm/tree-view/TreeView.js +310 -0
  35. package/lib/esm/tree-view/TreeView.js.map +1 -0
  36. package/lib/esm/tree-view/TreeViewItem.js +63 -0
  37. package/lib/esm/tree-view/TreeViewItem.js.map +1 -0
  38. package/lib/esm/tree-view/TreeViewTextItem.js +147 -0
  39. package/lib/esm/tree-view/TreeViewTextItem.js.map +1 -0
  40. package/lib/esm/tree-view/TreeViewTrail.js +26 -0
  41. package/lib/esm/tree-view/TreeViewTrail.js.map +1 -0
  42. package/lib/esm/tree-view/index.js +22 -0
  43. package/lib/esm/tree-view/index.js.map +1 -0
  44. package/lib/esm/tree-view/tree-view-keyboard-coordinates.js +115 -0
  45. package/lib/esm/tree-view/tree-view-keyboard-coordinates.js.map +1 -0
  46. package/lib/esm/tree-view/tree-view-keyboard-helpers.js +68 -0
  47. package/lib/esm/tree-view/tree-view-keyboard-helpers.js.map +1 -0
  48. package/lib/esm/tree-view/tree-view-types.js +23 -0
  49. package/lib/esm/tree-view/tree-view-types.js.map +1 -0
  50. package/lib/esm/tree-view/tree-view-utils.js +179 -0
  51. package/lib/esm/tree-view/tree-view-utils.js.map +1 -0
  52. package/lib/types/_common/utils.d.ts +12 -0
  53. package/lib/types/index.d.ts +1 -0
  54. package/lib/types/table/Table.d.ts +1 -1
  55. package/lib/types/tree-view/TreeItemWrapper.d.ts +32 -0
  56. package/lib/types/tree-view/TreeView.d.ts +34 -0
  57. package/lib/types/tree-view/TreeViewItem.d.ts +52 -0
  58. package/lib/types/tree-view/TreeViewTextItem.d.ts +23 -0
  59. package/lib/types/tree-view/TreeViewTrail.d.ts +24 -0
  60. package/lib/types/tree-view/index.d.ts +23 -0
  61. package/lib/types/tree-view/tree-view-keyboard-coordinates.d.ts +23 -0
  62. package/lib/types/tree-view/tree-view-keyboard-helpers.d.ts +25 -0
  63. package/lib/types/tree-view/tree-view-types.d.ts +80 -0
  64. package/lib/types/tree-view/tree-view-utils.d.ts +77 -0
  65. package/lib/types/typography/Typography.d.ts +1 -1
  66. package/package.json +3 -1
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TreeView = void 0;
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ var TreeView_1 = require("./TreeView");
25
+ Object.defineProperty(exports, "TreeView", { enumerable: true, get: function () { return TreeView_1.TreeView; } });
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tree-view/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortableTreeKeyboardCoordinates = void 0;
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ const core_1 = require("@dnd-kit/core");
25
+ const tree_view_utils_1 = require("./tree-view-utils");
26
+ const directions = [
27
+ core_1.KeyboardCode.Down,
28
+ core_1.KeyboardCode.Right,
29
+ core_1.KeyboardCode.Up,
30
+ core_1.KeyboardCode.Left,
31
+ ];
32
+ const horizontal = [core_1.KeyboardCode.Left, core_1.KeyboardCode.Right];
33
+ const sortableTreeKeyboardCoordinates = (context, indicator, indentationWidth) => (event, { currentCoordinates, context: { active, over, collisionRect, droppableRects, droppableContainers, }, }) => {
34
+ if (directions.includes(event.code)) {
35
+ if (!active || !collisionRect) {
36
+ return;
37
+ }
38
+ event.preventDefault();
39
+ const { current: { items, offset }, } = context;
40
+ if (horizontal.includes(event.code) && (over === null || over === void 0 ? void 0 : over.id)) {
41
+ const { depth, maxDepth, minDepth } = (0, tree_view_utils_1.getProjection)(items, active.id, over.id, offset, indentationWidth);
42
+ switch (event.code) {
43
+ case core_1.KeyboardCode.Left:
44
+ if (depth > minDepth) {
45
+ return Object.assign(Object.assign({}, currentCoordinates), { x: currentCoordinates.x - indentationWidth });
46
+ }
47
+ break;
48
+ case core_1.KeyboardCode.Right:
49
+ if (depth < maxDepth) {
50
+ return Object.assign(Object.assign({}, currentCoordinates), { x: currentCoordinates.x + indentationWidth });
51
+ }
52
+ break;
53
+ }
54
+ return undefined;
55
+ }
56
+ const containers = [];
57
+ droppableContainers.forEach((container) => {
58
+ if ((container === null || container === void 0 ? void 0 : container.disabled) ||
59
+ container.id === (over === null || over === void 0 ? void 0 : over.id) ||
60
+ (container === null || container === void 0 ? void 0 : container.id) === 'ndl-active-tree-item') {
61
+ return;
62
+ }
63
+ const rect = droppableRects.get(container.id);
64
+ if (!rect) {
65
+ return;
66
+ }
67
+ switch (event.code) {
68
+ case core_1.KeyboardCode.Down:
69
+ if (collisionRect.top < rect.top) {
70
+ containers.push(container);
71
+ }
72
+ break;
73
+ case core_1.KeyboardCode.Up:
74
+ if (collisionRect.top > rect.top) {
75
+ containers.push(container);
76
+ }
77
+ break;
78
+ }
79
+ });
80
+ const collisions = (0, core_1.closestCorners)({
81
+ active,
82
+ collisionRect,
83
+ pointerCoordinates: null,
84
+ droppableRects,
85
+ droppableContainers: containers,
86
+ });
87
+ let closestId = (0, core_1.getFirstCollision)(collisions, 'id');
88
+ if (closestId === (over === null || over === void 0 ? void 0 : over.id) && collisions.length > 1) {
89
+ closestId = collisions[1].id;
90
+ }
91
+ if (closestId && (over === null || over === void 0 ? void 0 : over.id)) {
92
+ const activeRect = droppableRects.get(active.id);
93
+ const newRect = droppableRects.get(closestId);
94
+ const newDroppable = droppableContainers.get(closestId);
95
+ if (activeRect && newRect && newDroppable) {
96
+ const newIndex = items.findIndex(({ id }) => id === closestId);
97
+ const newItem = items[newIndex];
98
+ const activeIndex = items.findIndex(({ id }) => id === active.id);
99
+ const activeItem = items[activeIndex];
100
+ if (newItem && activeItem) {
101
+ const { depth } = (0, tree_view_utils_1.getProjection)(items, active.id, closestId, (newItem.depth - activeItem.depth) * indentationWidth, indentationWidth);
102
+ const isBelow = newIndex > activeIndex;
103
+ const modifier = isBelow ? 1 : -1;
104
+ const offset = indicator
105
+ ? (collisionRect.height - activeRect.height) / 2
106
+ : 0;
107
+ const newCoordinates = {
108
+ x: newRect.left + depth * indentationWidth,
109
+ y: newRect.top + modifier * offset,
110
+ };
111
+ return newCoordinates;
112
+ }
113
+ }
114
+ }
115
+ }
116
+ return undefined;
117
+ };
118
+ exports.sortableTreeKeyboardCoordinates = sortableTreeKeyboardCoordinates;
119
+ //# sourceMappingURL=tree-view-keyboard-coordinates.js.map
@@ -0,0 +1 @@
1
+ {"version":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,CAAC,KAAK,CAAC,GAAG,gBAAgB,EACrD,gBAAgB,CACjB,CAAC;oBACF,MAAM,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;oBACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAClC,MAAM,MAAM,GAAG,SAAS;wBACtB,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC;wBAChD,CAAC,CAAC,CAAC,CAAC;oBAEN,MAAM,cAAc,GAAG;wBACrB,CAAC,EAAE,OAAO,CAAC,IAAI,GAAG,KAAK,GAAG,gBAAgB;wBAC1C,CAAC,EAAE,OAAO,CAAC,GAAG,GAAG,QAAQ,GAAG,MAAM;qBACnC,CAAC;oBAEF,OAAO,cAAc,CAAC;iBACvB;aACF;SACF;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AA1IS,QAAA,+BAA+B,mCA0IxC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.focusCellInPreviousRow = exports.focusCellInNextRow = exports.focusPreviousRow = exports.focusNextRow = void 0;
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ const utils_1 = require("../_common/utils");
25
+ const focusElementInElement = (parentElement, newParentElement, activeElement) => {
26
+ const focusable = (0, utils_1.findFocusableChildren)(newParentElement);
27
+ const focusableCurrent = (0, utils_1.findFocusableChildren)(parentElement);
28
+ const cellIndex = focusableCurrent.indexOf(activeElement);
29
+ let newIndex = cellIndex;
30
+ if (cellIndex >= focusable.length) {
31
+ newIndex = focusable.length - 1;
32
+ }
33
+ else if (cellIndex < 0) {
34
+ newIndex = 0;
35
+ }
36
+ const element = focusable[newIndex];
37
+ if (element instanceof HTMLElement) {
38
+ element.focus();
39
+ }
40
+ };
41
+ const focusNextRow = (parentElement) => {
42
+ const { nextElementSibling } = parentElement;
43
+ if (nextElementSibling instanceof HTMLElement) {
44
+ nextElementSibling.focus();
45
+ }
46
+ };
47
+ exports.focusNextRow = focusNextRow;
48
+ const focusPreviousRow = (parentElement) => {
49
+ const { previousElementSibling } = parentElement;
50
+ if (previousElementSibling instanceof HTMLElement) {
51
+ previousElementSibling.focus();
52
+ }
53
+ };
54
+ exports.focusPreviousRow = focusPreviousRow;
55
+ const focusCellInNextRow = (parentElement) => {
56
+ const { nextElementSibling } = parentElement;
57
+ const { activeElement } = document;
58
+ if (!(nextElementSibling instanceof HTMLElement) ||
59
+ !(activeElement instanceof HTMLElement)) {
60
+ return;
61
+ }
62
+ focusElementInElement(parentElement, nextElementSibling, activeElement);
63
+ };
64
+ exports.focusCellInNextRow = focusCellInNextRow;
65
+ const focusCellInPreviousRow = (parentElement) => {
66
+ const { previousElementSibling } = parentElement;
67
+ const { activeElement } = document;
68
+ if (!(previousElementSibling instanceof HTMLElement) ||
69
+ !(activeElement instanceof HTMLElement)) {
70
+ return;
71
+ }
72
+ focusElementInElement(parentElement, previousElementSibling, activeElement);
73
+ };
74
+ exports.focusCellInPreviousRow = focusCellInPreviousRow;
75
+ //# sourceMappingURL=tree-view-keyboard-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-keyboard-helpers.js","sourceRoot":"","sources":["../../../src/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,CAAC,aAA0B,EAAE,EAAE;IAC/D,MAAM,EAAE,kBAAkB,EAAE,GAAG,aAAa,CAAC;IAC7C,MAAM,EAAE,aAAa,EAAE,GAAG,QAAQ,CAAC;IACnC,IACE,CAAC,CAAC,kBAAkB,YAAY,WAAW,CAAC;QAC5C,CAAC,CAAC,aAAa,YAAY,WAAW,CAAC,EACvC;QACA,OAAO;KACR;IAED,qBAAqB,CAAC,aAAa,EAAE,kBAAkB,EAAE,aAAa,CAAC,CAAC;AAC1E,CAAC,CAAC;AAXW,QAAA,kBAAkB,sBAW7B;AAEK,MAAM,sBAAsB,GAAG,CAAC,aAA0B,EAAE,EAAE;IACnE,MAAM,EAAE,sBAAsB,EAAE,GAAG,aAAa,CAAC;IACjD,MAAM,EAAE,aAAa,EAAE,GAAG,QAAQ,CAAC;IACnC,IACE,CAAC,CAAC,sBAAsB,YAAY,WAAW,CAAC;QAChD,CAAC,CAAC,aAAa,YAAY,WAAW,CAAC,EACvC;QACA,OAAO;KACR;IAED,qBAAqB,CAAC,aAAa,EAAE,sBAAsB,EAAE,aAAa,CAAC,CAAC;AAC9E,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC"}
@@ -0,0 +1,24 @@
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
+ "use strict";
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ //# sourceMappingURL=tree-view-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-types.js","sourceRoot":"","sources":["../../../src/tree-view/tree-view-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,187 @@
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
+ "use strict";
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.transformToString = exports.getProjection = exports.buildTree = exports.removeChildrenOf = exports.flattenTree = void 0;
25
+ const sortable_1 = require("@dnd-kit/sortable");
26
+ /**
27
+ * Takes a tree and flattens it into a list of item
28
+ * where each item has a depth and a parentId.
29
+ * @param tree the tree to flatten
30
+ * @param depth the depth of the root of the tree (default 0)
31
+ * @param parentId the id of the parent of the root of the tree (default null)
32
+ * @returns a list of items with depth and parentId
33
+ */
34
+ const flattenTree = (tree, depth = 0, parentId = null) => {
35
+ const flattened = [];
36
+ tree.forEach((item) => {
37
+ flattened.push(Object.assign(Object.assign({}, item), { depth: depth, parentId: parentId }));
38
+ if (item.canHaveSubItems) {
39
+ (0, exports.flattenTree)(item.subItems, depth + 1, item.id).forEach((subItem) => flattened.push(Object.assign({}, subItem)));
40
+ }
41
+ });
42
+ return flattened;
43
+ };
44
+ exports.flattenTree = flattenTree;
45
+ /**
46
+ * Removes the children of the items with the given ids
47
+ * @param items the flattened tree items to remove the children from
48
+ * @param ids the ids of the items to remove the children from
49
+ * @returns a new list of items with the children of the items with the given ids removed
50
+ */
51
+ function removeChildrenOf(items, ids) {
52
+ const excludeParentIds = [...ids];
53
+ return items.filter((item) => {
54
+ if (item.parentId !== null && excludeParentIds.includes(item.parentId)) {
55
+ if (item.canHaveSubItems && item.subItems.length > 0) {
56
+ excludeParentIds.push(item.id);
57
+ }
58
+ return false;
59
+ }
60
+ return true;
61
+ });
62
+ }
63
+ exports.removeChildrenOf = removeChildrenOf;
64
+ /**
65
+ * Builds a tree from a list of flattened tree items
66
+ * @param items the flattened tree items
67
+ * @returns the items as a tree data structure
68
+ */
69
+ function buildTree(items) {
70
+ const tree = [];
71
+ const itemMap = {};
72
+ items.forEach((item) => {
73
+ const { id } = item;
74
+ if (item.canHaveSubItems) {
75
+ itemMap[id] = {
76
+ id: id,
77
+ canHaveSubItems: true,
78
+ isCollapsed: item.isCollapsed,
79
+ subItems: [],
80
+ data: item.data,
81
+ isSelected: item.isSelected,
82
+ isSortable: item.isSortable,
83
+ };
84
+ }
85
+ else {
86
+ itemMap[id] = {
87
+ id: id,
88
+ canHaveSubItems: false,
89
+ data: item.data,
90
+ isSortable: item.isSortable,
91
+ isSelected: item.isSelected,
92
+ };
93
+ }
94
+ });
95
+ // Build the tree structure by assigning children to their parent items
96
+ items.forEach((item) => {
97
+ const { id, parentId } = item;
98
+ if (parentId !== null) {
99
+ const parentItem = itemMap[parentId];
100
+ if (parentItem && parentItem.canHaveSubItems) {
101
+ parentItem.subItems.push(itemMap[id]);
102
+ }
103
+ }
104
+ else {
105
+ tree.push(itemMap[id]);
106
+ }
107
+ });
108
+ return tree;
109
+ }
110
+ exports.buildTree = buildTree;
111
+ function getDragDepth(offset, indentationWidth) {
112
+ return Math.round(offset / indentationWidth);
113
+ }
114
+ function getMaxDepth({ previousItem, }) {
115
+ var _a;
116
+ if (previousItem && previousItem.canHaveSubItems === true) {
117
+ return previousItem.depth + 1;
118
+ }
119
+ return (_a = previousItem === null || previousItem === void 0 ? void 0 : previousItem.depth) !== null && _a !== void 0 ? _a : 0;
120
+ }
121
+ function getMinDepth({ nextItem }) {
122
+ if (nextItem) {
123
+ return nextItem.depth;
124
+ }
125
+ return 0;
126
+ }
127
+ /**
128
+ * Calculates the new depth, max depth, min depth and parent id of the item being dragged
129
+ * Used to project the position of the dragged item. For example, to convert the item being dragged into a placeholder.
130
+ * such as the line that appears when dragging an item in a tree view.
131
+ * @param items the flattened tree items
132
+ * @param activeId the id of the item being dragged
133
+ * @param overId the id of the item that the dragged item is being dragged over
134
+ * @param dragOffset the offset of the drag in pixels
135
+ * @param indentationWidth the width of the indentation in pixels
136
+ * @returns the depth, max depth, min depth and parent id of the item being dragged
137
+ */
138
+ function getProjection(items, activeId, overId, dragOffset, indentationWidth) {
139
+ const overItemIndex = items.findIndex(({ id }) => id === overId);
140
+ const activeItemIndex = items.findIndex(({ id }) => id === activeId);
141
+ const activeItem = items[activeItemIndex];
142
+ const newItems = (0, sortable_1.arrayMove)(items, activeItemIndex, overItemIndex);
143
+ const previousItem = newItems[overItemIndex - 1];
144
+ const nextItem = newItems[overItemIndex + 1];
145
+ const dragDepth = getDragDepth(dragOffset, indentationWidth);
146
+ const projectedDepth = activeItem.depth + dragDepth;
147
+ const maxDepth = getMaxDepth({
148
+ previousItem,
149
+ });
150
+ const minDepth = getMinDepth({ nextItem });
151
+ let depth = projectedDepth;
152
+ if (projectedDepth >= maxDepth) {
153
+ depth = maxDepth;
154
+ }
155
+ else if (projectedDepth < minDepth) {
156
+ depth = minDepth;
157
+ }
158
+ return { depth, maxDepth, minDepth, parentId: getParentId() };
159
+ function getParentId() {
160
+ var _a;
161
+ if (depth === 0 || !previousItem) {
162
+ return null;
163
+ }
164
+ if (depth === previousItem.depth) {
165
+ return previousItem.parentId;
166
+ }
167
+ if (depth > previousItem.depth) {
168
+ return previousItem.id;
169
+ }
170
+ const newParent = (_a = newItems
171
+ .slice(0, overItemIndex)
172
+ .reverse()
173
+ .find((item) => item.depth === depth)) === null || _a === void 0 ? void 0 : _a.parentId;
174
+ return newParent !== null && newParent !== void 0 ? newParent : null;
175
+ }
176
+ }
177
+ exports.getProjection = getProjection;
178
+ /**
179
+ *
180
+ * @param transform a transform object
181
+ * @returns a css transform string
182
+ */
183
+ const transformToString = (transform) => {
184
+ return `scaleX(${transform.scaleX}) scaleY(${transform.scaleY}) translate3d(${transform.x}px, ${transform.y}px, 0)`;
185
+ };
186
+ exports.transformToString = transformToString;
187
+ //# sourceMappingURL=tree-view-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-utils.js","sourceRoot":"","sources":["../../../src/tree-view/tree-view-utils.ts"],"names":[],"mappings":";;;AAqBA,gDAA8C;AAU9C;;;;;;;GAOG;AACI,MAAM,WAAW,GAAG,CACzB,IAAmB,EACnB,KAAK,GAAG,CAAC,EACT,WAAoC,IAAI,EAChB,EAAE;IAC1B,MAAM,SAAS,GAA2B,EAAE,CAAC;IAE7C,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACpB,SAAS,CAAC,IAAI,iCACT,IAAI,KACP,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,IAClB,CAAC;QAEH,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,IAAA,mBAAW,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACjE,SAAS,CAAC,IAAI,mBAAM,OAAO,EAAG,CAC/B,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAtBW,QAAA,WAAW,eAsBtB;AAEF;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,KAA6B,EAC7B,GAAuB;IAEvB,MAAM,gBAAgB,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IAClC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SACxB;QAED,MAAM,SAAS,GAAG,MAAA,QAAQ;aACvB,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC;aACvB,OAAO,EAAE;aACT,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,0CAAE,QAAQ,CAAC;QAElD,OAAO,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAI,CAAC;IAC3B,CAAC;AACH,CAAC;AAjDD,sCAiDC;AACD;;;;GAIG;AAEI,MAAM,iBAAiB,GAAG,CAAC,SAKjC,EAAE,EAAE;IACH,OAAO,UAAU,SAAS,CAAC,MAAM,YAAY,SAAS,CAAC,MAAM,iBAAiB,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC,CAAC,QAAQ,CAAC;AACtH,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B"}
@@ -108,4 +108,42 @@ export function findUntil(direction, el, matchSelector) {
108
108
  : (index - 1 + allSiblings.length) % allSiblings.length;
109
109
  return allSiblings[newIndex];
110
110
  }
111
+ /**
112
+ * Find all html elements that are focusable given a parent element
113
+ * @param parentElement the parent element
114
+ * @returns an array of HTML elements
115
+ */
116
+ export const findFocusableChildren = (parentElement) => {
117
+ const focusableElements = 'a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])';
118
+ const focusable = Array.from(parentElement.querySelectorAll(focusableElements)).filter((element) => {
119
+ if (element instanceof HTMLElement) {
120
+ return true;
121
+ }
122
+ return false;
123
+ });
124
+ return focusable;
125
+ };
126
+ /**
127
+ * Using the element that currently has focus, finds the previous sibling of the currently focused element that is focusable
128
+ * @param parentRef the parent element
129
+ * @returns the previous focusable element
130
+ */
131
+ export const findFocusableSibling = (parentRef, direction) => {
132
+ const { current } = parentRef;
133
+ const { activeElement } = document;
134
+ if (current === null || activeElement === null) {
135
+ return undefined;
136
+ }
137
+ const focusable = findFocusableChildren(current);
138
+ const index = focusable.indexOf(activeElement);
139
+ if (index > -1) {
140
+ const siblingElement = focusable[index + (direction === 'next' ? 1 : -1)];
141
+ if (siblingElement === undefined ||
142
+ !(siblingElement instanceof HTMLElement)) {
143
+ return undefined;
144
+ }
145
+ return siblingElement;
146
+ }
147
+ return undefined;
148
+ };
111
149
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/_common/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAGL,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AAEf,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAC9C,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAEtC,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAC5C,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAEpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE,CACtD,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;AAE3C,MAAM,gBAAgB,GAAG,CAAC,GAAa,EAAU,EAAE;IACjD,iFAAiF;IACjF,MAAM,aAAa,GAAG,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC;IACtD,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,aAAa,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAU,EAAE,CACnD,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAEnE;;;GAGG;AACH,MAAM,CAAC,MAA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AAS,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/C,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE;QACd,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,IACE,cAAc,KAAK,SAAS;YAC5B,CAAC,CAAC,cAAc,YAAY,WAAW,CAAC,EACxC;YACA,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,cAAc,CAAC;KACvB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
package/lib/esm/index.js CHANGED
@@ -61,4 +61,5 @@ export * from './logo';
61
61
  export * from './clipboard-copier';
62
62
  export * from './slider';
63
63
  export * from './inline-edit';
64
+ export * from './tree-view';
64
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,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