@navikt/ds-react 8.10.4 → 8.10.6
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.
- package/cjs/data/data-grid/index.d.ts +2 -0
- package/cjs/data/data-grid/index.js +7 -0
- package/cjs/data/data-grid/index.js.map +1 -0
- package/cjs/data/data-grid/root/DataGridRoot.context.d.ts +11 -0
- package/cjs/data/data-grid/root/DataGridRoot.context.js +11 -0
- package/cjs/data/data-grid/root/DataGridRoot.context.js.map +1 -0
- package/cjs/data/data-grid/root/DataGridRoot.d.ts +38 -0
- package/cjs/data/data-grid/root/DataGridRoot.js +68 -0
- package/cjs/data/data-grid/root/DataGridRoot.js.map +1 -0
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +11 -13
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -1
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.d.ts +4 -2
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.js.map +1 -1
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js +44 -46
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -1
- package/cjs/data/drag-and-drop/types.d.ts +0 -4
- package/cjs/data/stories/Data.test-data.d.ts +2 -5
- package/cjs/data/stories/Data.test-data.js +30 -39
- package/cjs/data/stories/Data.test-data.js.map +1 -1
- package/cjs/data/table/base-cell/DataTableBaseCell.d.ts +15 -15
- package/cjs/data/table/base-cell/DataTableBaseCell.js +4 -8
- package/cjs/data/table/base-cell/DataTableBaseCell.js.map +1 -1
- package/cjs/data/table/column-header/DataTableColumnHeader.d.ts +24 -6
- package/cjs/data/table/column-header/DataTableColumnHeader.js +22 -27
- package/cjs/data/table/column-header/DataTableColumnHeader.js.map +1 -1
- package/cjs/data/table/column-header/useTableColumnResize.d.ts +19 -29
- package/cjs/data/table/column-header/useTableColumnResize.js +24 -22
- package/cjs/data/table/column-header/useTableColumnResize.js.map +1 -1
- package/cjs/data/table/details-panel-row/DataTableDetailsPanelRow.d.ts +1 -1
- package/cjs/data/table/details-panel-row/DataTableDetailsPanelRow.js +2 -2
- package/cjs/data/table/details-panel-row/DataTableDetailsPanelRow.js.map +1 -1
- package/cjs/data/table/helpers/collectTableRowEntries.d.ts +9 -7
- package/cjs/data/table/helpers/collectTableRowEntries.js +18 -10
- package/cjs/data/table/helpers/collectTableRowEntries.js.map +1 -1
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.d.ts +13 -11
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js +43 -53
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -1
- package/cjs/data/table/helpers/selection/getSingleSelectProps.d.ts +9 -8
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js +23 -10
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js.map +1 -1
- package/cjs/data/table/helpers/selection/selection.types.d.ts +19 -19
- package/cjs/data/table/helpers/selection/selection.utils.d.ts +21 -0
- package/cjs/data/table/helpers/selection/selection.utils.js +46 -0
- package/cjs/data/table/helpers/selection/selection.utils.js.map +1 -0
- package/cjs/data/table/helpers/table-focus.d.ts +0 -3
- package/cjs/data/table/helpers/table-focus.js +38 -8
- package/cjs/data/table/helpers/table-focus.js.map +1 -1
- package/cjs/data/table/hooks/useColumnOptions.d.ts +16 -5
- package/cjs/data/table/hooks/useColumnOptions.js +26 -8
- package/cjs/data/table/hooks/useColumnOptions.js.map +1 -1
- package/cjs/data/table/hooks/useGridCache.js +2 -2
- package/cjs/data/table/hooks/useGridCache.js.map +1 -1
- package/cjs/data/table/hooks/useTableDetailsPanel.d.ts +10 -13
- package/cjs/data/table/hooks/useTableDetailsPanel.js +7 -6
- package/cjs/data/table/hooks/useTableDetailsPanel.js.map +1 -1
- package/cjs/data/table/hooks/useTableItems.d.ts +31 -17
- package/cjs/data/table/hooks/useTableItems.js +10 -20
- package/cjs/data/table/hooks/useTableItems.js.map +1 -1
- package/cjs/data/table/hooks/useTableKeyboardNav.d.ts +1 -6
- package/cjs/data/table/hooks/useTableKeyboardNav.js +6 -5
- package/cjs/data/table/hooks/useTableKeyboardNav.js.map +1 -1
- package/cjs/data/table/hooks/useTableSelection.d.ts +6 -6
- package/cjs/data/table/hooks/useTableSelection.js +13 -13
- package/cjs/data/table/hooks/useTableSelection.js.map +1 -1
- package/cjs/data/table/hooks/useTableSort.d.ts +2 -2
- package/cjs/data/table/hooks/useTableSort.js +4 -5
- package/cjs/data/table/hooks/useTableSort.js.map +1 -1
- package/cjs/data/table/root/DataTable.types.d.ts +22 -13
- package/cjs/data/table/root/DataTableRoot.context.d.ts +13 -7
- package/cjs/data/table/root/DataTableRoot.context.js.map +1 -1
- package/cjs/data/table/root/DataTableRoot.d.ts +49 -72
- package/cjs/data/table/root/DataTableRoot.js +56 -72
- package/cjs/data/table/root/DataTableRoot.js.map +1 -1
- package/cjs/data/table/root/DataTableRoot.legacy.d.ts +2 -7
- package/cjs/data/table/root/DataTableRoot.legacy.js +17 -3
- package/cjs/data/table/root/DataTableRoot.legacy.js.map +1 -1
- package/cjs/data/table/sub-row-toggle/DataTableSubRowToggle.js +4 -4
- package/cjs/data/table/sub-row-toggle/DataTableSubRowToggle.js.map +1 -1
- package/cjs/data/table/tbody/DataTableTbody.js +4 -2
- package/cjs/data/table/tbody/DataTableTbody.js.map +1 -1
- package/cjs/data/table/tr/DataTableTr.d.ts +5 -3
- package/cjs/data/table/tr/DataTableTr.js +36 -23
- package/cjs/data/table/tr/DataTableTr.js.map +1 -1
- package/cjs/table/ColumnHeader.js +2 -1
- package/cjs/table/ColumnHeader.js.map +1 -1
- package/esm/data/data-grid/index.d.ts +2 -0
- package/esm/data/data-grid/index.js +3 -0
- package/esm/data/data-grid/index.js.map +1 -0
- package/esm/data/data-grid/root/DataGridRoot.context.d.ts +11 -0
- package/esm/data/data-grid/root/DataGridRoot.context.js +7 -0
- package/esm/data/data-grid/root/DataGridRoot.context.js.map +1 -0
- package/esm/data/data-grid/root/DataGridRoot.d.ts +38 -0
- package/esm/data/data-grid/root/DataGridRoot.js +32 -0
- package/esm/data/data-grid/root/DataGridRoot.js.map +1 -0
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +11 -13
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -1
- package/esm/data/drag-and-drop/root/DragAndDrop.context.d.ts +4 -2
- package/esm/data/drag-and-drop/root/DragAndDrop.context.js.map +1 -1
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js +44 -46
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -1
- package/esm/data/drag-and-drop/types.d.ts +0 -4
- package/esm/data/stories/Data.test-data.d.ts +2 -5
- package/esm/data/stories/Data.test-data.js +30 -39
- package/esm/data/stories/Data.test-data.js.map +1 -1
- package/esm/data/table/base-cell/DataTableBaseCell.d.ts +15 -15
- package/esm/data/table/base-cell/DataTableBaseCell.js +4 -8
- package/esm/data/table/base-cell/DataTableBaseCell.js.map +1 -1
- package/esm/data/table/column-header/DataTableColumnHeader.d.ts +24 -6
- package/esm/data/table/column-header/DataTableColumnHeader.js +23 -28
- package/esm/data/table/column-header/DataTableColumnHeader.js.map +1 -1
- package/esm/data/table/column-header/useTableColumnResize.d.ts +19 -29
- package/esm/data/table/column-header/useTableColumnResize.js +24 -22
- package/esm/data/table/column-header/useTableColumnResize.js.map +1 -1
- package/esm/data/table/details-panel-row/DataTableDetailsPanelRow.d.ts +1 -1
- package/esm/data/table/details-panel-row/DataTableDetailsPanelRow.js +2 -2
- package/esm/data/table/details-panel-row/DataTableDetailsPanelRow.js.map +1 -1
- package/esm/data/table/helpers/collectTableRowEntries.d.ts +9 -7
- package/esm/data/table/helpers/collectTableRowEntries.js +18 -10
- package/esm/data/table/helpers/collectTableRowEntries.js.map +1 -1
- package/esm/data/table/helpers/selection/getMultipleSelectProps.d.ts +13 -11
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js +43 -53
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -1
- package/esm/data/table/helpers/selection/getSingleSelectProps.d.ts +9 -8
- package/esm/data/table/helpers/selection/getSingleSelectProps.js +23 -10
- package/esm/data/table/helpers/selection/getSingleSelectProps.js.map +1 -1
- package/esm/data/table/helpers/selection/selection.types.d.ts +19 -19
- package/esm/data/table/helpers/selection/selection.utils.d.ts +21 -0
- package/esm/data/table/helpers/selection/selection.utils.js +43 -0
- package/esm/data/table/helpers/selection/selection.utils.js.map +1 -0
- package/esm/data/table/helpers/table-focus.d.ts +0 -3
- package/esm/data/table/helpers/table-focus.js +38 -8
- package/esm/data/table/helpers/table-focus.js.map +1 -1
- package/esm/data/table/hooks/useColumnOptions.d.ts +16 -5
- package/esm/data/table/hooks/useColumnOptions.js +26 -8
- package/esm/data/table/hooks/useColumnOptions.js.map +1 -1
- package/esm/data/table/hooks/useGridCache.js +2 -2
- package/esm/data/table/hooks/useGridCache.js.map +1 -1
- package/esm/data/table/hooks/useTableDetailsPanel.d.ts +10 -13
- package/esm/data/table/hooks/useTableDetailsPanel.js +7 -6
- package/esm/data/table/hooks/useTableDetailsPanel.js.map +1 -1
- package/esm/data/table/hooks/useTableItems.d.ts +31 -17
- package/esm/data/table/hooks/useTableItems.js +11 -18
- package/esm/data/table/hooks/useTableItems.js.map +1 -1
- package/esm/data/table/hooks/useTableKeyboardNav.d.ts +1 -6
- package/esm/data/table/hooks/useTableKeyboardNav.js +7 -6
- package/esm/data/table/hooks/useTableKeyboardNav.js.map +1 -1
- package/esm/data/table/hooks/useTableSelection.d.ts +6 -6
- package/esm/data/table/hooks/useTableSelection.js +13 -13
- package/esm/data/table/hooks/useTableSelection.js.map +1 -1
- package/esm/data/table/hooks/useTableSort.d.ts +2 -2
- package/esm/data/table/hooks/useTableSort.js +4 -5
- package/esm/data/table/hooks/useTableSort.js.map +1 -1
- package/esm/data/table/root/DataTable.types.d.ts +22 -13
- package/esm/data/table/root/DataTableRoot.context.d.ts +13 -7
- package/esm/data/table/root/DataTableRoot.context.js.map +1 -1
- package/esm/data/table/root/DataTableRoot.d.ts +49 -72
- package/esm/data/table/root/DataTableRoot.js +58 -74
- package/esm/data/table/root/DataTableRoot.js.map +1 -1
- package/esm/data/table/root/DataTableRoot.legacy.d.ts +2 -7
- package/esm/data/table/root/DataTableRoot.legacy.js +17 -3
- package/esm/data/table/root/DataTableRoot.legacy.js.map +1 -1
- package/esm/data/table/sub-row-toggle/DataTableSubRowToggle.js +4 -4
- package/esm/data/table/sub-row-toggle/DataTableSubRowToggle.js.map +1 -1
- package/esm/data/table/tbody/DataTableTbody.js +4 -2
- package/esm/data/table/tbody/DataTableTbody.js.map +1 -1
- package/esm/data/table/tr/DataTableTr.d.ts +5 -3
- package/esm/data/table/tr/DataTableTr.js +35 -23
- package/esm/data/table/tr/DataTableTr.js.map +1 -1
- package/esm/table/ColumnHeader.js +2 -1
- package/esm/table/ColumnHeader.js.map +1 -1
- package/package.json +8 -7
- package/src/data/data-grid/index.ts +3 -0
- package/src/data/data-grid/root/DataGridRoot.context.ts +16 -0
- package/src/data/data-grid/root/DataGridRoot.tsx +71 -0
- package/src/data/drag-and-drop/drag-handler/DragAndDropDragHandler.tsx +11 -17
- package/src/data/drag-and-drop/root/DragAndDrop.context.tsx +4 -2
- package/src/data/drag-and-drop/root/DragAndDropRoot.tsx +63 -52
- package/src/data/drag-and-drop/types.ts +0 -5
- package/src/data/stories/Data.test-data.tsx +52 -44
- package/src/data/table/agent-component-review.md +175 -0
- package/src/data/table/base-cell/DataTableBaseCell.tsx +31 -21
- package/src/data/table/column-header/DataTableColumnHeader.tsx +63 -58
- package/src/data/table/column-header/useTableColumnResize.ts +55 -71
- package/src/data/table/details-panel-row/DataTableDetailsPanelRow.tsx +7 -3
- package/src/data/table/helpers/collectTableRowEntries.ts +32 -19
- package/src/data/table/helpers/selection/getMultipleSelectProps.ts +65 -85
- package/src/data/table/helpers/selection/getSingleSelectProps.ts +35 -17
- package/src/data/table/helpers/selection/selection.types.ts +19 -19
- package/src/data/table/helpers/selection/selection.utils.test.ts +161 -0
- package/src/data/table/helpers/selection/selection.utils.ts +73 -0
- package/src/data/table/helpers/table-focus.ts +63 -9
- package/src/data/table/hooks/__tests__/useTableItems.test.ts +48 -8
- package/src/data/table/hooks/useColumnOptions.ts +48 -14
- package/src/data/table/hooks/useGridCache.ts +3 -2
- package/src/data/table/hooks/useTableDetailsPanel.tsx +25 -25
- package/src/data/table/hooks/useTableItems.ts +51 -42
- package/src/data/table/hooks/useTableKeyboardNav.ts +7 -15
- package/src/data/table/hooks/useTableSelection.ts +26 -31
- package/src/data/table/hooks/useTableSort.ts +10 -9
- package/src/data/table/root/DataTable.types.ts +30 -25
- package/src/data/table/root/DataTableRoot.context.ts +19 -7
- package/src/data/table/root/DataTableRoot.legacy.tsx +22 -14
- package/src/data/table/root/DataTableRoot.tsx +271 -320
- package/src/data/table/sub-row-toggle/DataTableSubRowToggle.tsx +5 -4
- package/src/data/table/tbody/DataTableTbody.tsx +6 -2
- package/src/data/table/tr/DataTableTr.tsx +98 -35
- package/src/table/ColumnHeader.tsx +2 -1
- package/cjs/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.d.ts +0 -22
- package/cjs/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js +0 -35
- package/cjs/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js.map +0 -1
- package/cjs/data/drag-and-drop-old/item/DataDragAndDropItem.d.ts +0 -27
- package/cjs/data/drag-and-drop-old/item/DataDragAndDropItem.js +0 -86
- package/cjs/data/drag-and-drop-old/item/DataDragAndDropItem.js.map +0 -1
- package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.d.ts +0 -5
- package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.js +0 -6
- package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.js.map +0 -1
- package/cjs/data/drag-and-drop-old/root/DataDragAndDropRoot.d.ts +0 -24
- package/cjs/data/drag-and-drop-old/root/DataDragAndDropRoot.js +0 -108
- package/cjs/data/drag-and-drop-old/root/DataDragAndDropRoot.js.map +0 -1
- package/cjs/data/table/helpers/selection/SelectionSubtreeHelper.d.ts +0 -46
- package/cjs/data/table/helpers/selection/SelectionSubtreeHelper.js +0 -112
- package/cjs/data/table/helpers/selection/SelectionSubtreeHelper.js.map +0 -1
- package/esm/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.d.ts +0 -22
- package/esm/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js +0 -29
- package/esm/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js.map +0 -1
- package/esm/data/drag-and-drop-old/item/DataDragAndDropItem.d.ts +0 -27
- package/esm/data/drag-and-drop-old/item/DataDragAndDropItem.js +0 -50
- package/esm/data/drag-and-drop-old/item/DataDragAndDropItem.js.map +0 -1
- package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.d.ts +0 -5
- package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.js +0 -3
- package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.js.map +0 -1
- package/esm/data/drag-and-drop-old/root/DataDragAndDropRoot.d.ts +0 -24
- package/esm/data/drag-and-drop-old/root/DataDragAndDropRoot.js +0 -68
- package/esm/data/drag-and-drop-old/root/DataDragAndDropRoot.js.map +0 -1
- package/esm/data/table/helpers/selection/SelectionSubtreeHelper.d.ts +0 -46
- package/esm/data/table/helpers/selection/SelectionSubtreeHelper.js +0 -109
- package/esm/data/table/helpers/selection/SelectionSubtreeHelper.js.map +0 -1
- package/src/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.tsx +0 -104
- package/src/data/drag-and-drop-old/item/DataDragAndDropItem.tsx +0 -74
- package/src/data/drag-and-drop-old/root/DataDragAndDrop.context.tsx +0 -11
- package/src/data/drag-and-drop-old/root/DataDragAndDropRoot.tsx +0 -96
- package/src/data/table/helpers/selection/SelectionSubtreeHelper.test.ts +0 -66
- package/src/data/table/helpers/selection/SelectionSubtreeHelper.ts +0 -162
- package/src/data/table/hooks/__tests__/useTableSelection.test.ts +0 -488
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
-
var t = {};
|
|
37
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
-
t[p] = s[p];
|
|
39
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
-
t[p[i]] = s[p[i]];
|
|
43
|
-
}
|
|
44
|
-
return t;
|
|
45
|
-
};
|
|
46
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.DataDragAndDropItem = exports.DataDragAndDrop = void 0;
|
|
51
|
-
const react_1 = require("@dnd-kit/react");
|
|
52
|
-
const sortable_1 = require("@dnd-kit/react/sortable");
|
|
53
|
-
const react_2 = __importStar(require("react"));
|
|
54
|
-
const stack_1 = require("../../../primitives/stack");
|
|
55
|
-
const DataDragAndDropItem_1 = __importDefault(require("../item/DataDragAndDropItem"));
|
|
56
|
-
exports.DataDragAndDropItem = DataDragAndDropItem_1.default;
|
|
57
|
-
const DataDragAndDrop_context_1 = require("./DataDragAndDrop.context");
|
|
58
|
-
const DataDragAndDrop = (0, react_2.forwardRef)((_a, forwardedRef) => {
|
|
59
|
-
var { setItems, children } = _a, rest = __rest(_a, ["setItems", "children"]);
|
|
60
|
-
const [inputMethod, setInputMethod] = react_2.default.useState(null);
|
|
61
|
-
const setItemOrder = (initalIndex, targetIndex) => {
|
|
62
|
-
setItems((items) => {
|
|
63
|
-
const newItems = [...items];
|
|
64
|
-
const [movedItem] = newItems.splice(initalIndex, 1);
|
|
65
|
-
newItems.splice(targetIndex, 0, movedItem);
|
|
66
|
-
return newItems;
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
return (react_2.default.createElement(DataDragAndDrop_context_1.DataDragAndDropContext.Provider, { value: { inputMethod } },
|
|
70
|
-
react_2.default.createElement(react_1.DragDropProvider
|
|
71
|
-
// TODO Look into overriding default keybinds, might eliminate context need
|
|
72
|
-
, {
|
|
73
|
-
// TODO Look into overriding default keybinds, might eliminate context need
|
|
74
|
-
onBeforeDragStart: (event) => {
|
|
75
|
-
var _a;
|
|
76
|
-
return setInputMethod(((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown"
|
|
77
|
-
? "mouse"
|
|
78
|
-
: "keyboard");
|
|
79
|
-
}, onDragOver: (event) => {
|
|
80
|
-
var _a;
|
|
81
|
-
if (((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown") {
|
|
82
|
-
// Prevents items to rearrange while dragging with mouse, but allows keyboard dragging to work as intended
|
|
83
|
-
event.preventDefault();
|
|
84
|
-
}
|
|
85
|
-
}, onDragEnd: (event) => {
|
|
86
|
-
const { source, target } = event.operation;
|
|
87
|
-
if (!(0, sortable_1.isSortable)(source) || !(0, sortable_1.isSortable)(target))
|
|
88
|
-
return;
|
|
89
|
-
setItemOrder(source.initialIndex, target.index);
|
|
90
|
-
} },
|
|
91
|
-
react_2.default.createElement(stack_1.VStack, { asChild: true, gap: "space-12" },
|
|
92
|
-
react_2.default.createElement("div", Object.assign({}, rest, { ref: forwardedRef }), children)),
|
|
93
|
-
react_2.default.createElement(react_1.DragOverlay, { dropAnimation: null }, (source) => {
|
|
94
|
-
// Overlay not needed and causes glitching when using keyboard
|
|
95
|
-
if (inputMethod === "keyboard")
|
|
96
|
-
return null;
|
|
97
|
-
if (!(0, sortable_1.isSortable)(source))
|
|
98
|
-
return null;
|
|
99
|
-
if ((0, react_2.isValidElement)(children[source.initialIndex])) {
|
|
100
|
-
return children[source.initialIndex];
|
|
101
|
-
}
|
|
102
|
-
return null;
|
|
103
|
-
}))));
|
|
104
|
-
});
|
|
105
|
-
exports.DataDragAndDrop = DataDragAndDrop;
|
|
106
|
-
DataDragAndDrop.Item = DataDragAndDropItem_1.default;
|
|
107
|
-
exports.default = DataDragAndDrop;
|
|
108
|
-
//# sourceMappingURL=DataDragAndDropRoot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataDragAndDropRoot.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-old/root/DataDragAndDropRoot.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA+D;AAC/D,sDAAqD;AACrD,+CAA0D;AAC1D,qDAAmD;AACnD,sFAEqC;AAuFX,8BAzFnB,6BAAmB,CAyFmB;AAtF7C,uEAAmE;AAwBnE,MAAM,eAAe,GAAG,IAAA,kBAAU,EAChC,CAAC,EAA+B,EAAE,YAAY,EAAE,EAAE;QAAjD,EAAE,QAAQ,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA7B,wBAA+B,CAAF;IAC5B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,eAAK,CAAC,QAAQ,CAElD,IAAI,CAAC,CAAC;IAER,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAE,WAAmB,EAAE,EAAE;QAChE,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;YACjB,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;YAC5B,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;YACpD,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YAC3C,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACL,8BAAC,gDAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,WAAW,EAAE;QACrD,8BAAC,wBAAgB;QACf,2EAA2E;;YAA3E,2EAA2E;YAC3E,iBAAiB,EAAE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,CAAC;YACd,CAAC,CACW,CACG,CACa,CACnC,CAAC;AACJ,CAAC,CAC8B,CAAC;AAIzB,0CAAe;AAFxB,eAAe,CAAC,IAAI,GAAG,6BAAmB,CAAC;AAG3C,kBAAe,eAAe,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
type SelectionKey = string | number;
|
|
2
|
-
type SelectionStats = {
|
|
3
|
-
selectableCount: number;
|
|
4
|
-
selectedCount: number;
|
|
5
|
-
};
|
|
6
|
-
type SelectionSubtreeHelperArgs = {
|
|
7
|
-
childRowIdsById?: Map<SelectionKey, SelectionKey[]>;
|
|
8
|
-
disabledKeysSet: Set<SelectionKey>;
|
|
9
|
-
selectedKeysSet: Set<SelectionKey>;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Helper class for managing selection state in a tree structure.
|
|
13
|
-
* - It provides methods to get selectable keys in a subtree
|
|
14
|
-
* - Compute selection statistics for a subtree
|
|
15
|
-
* - Determine if a subtree is fully selected.
|
|
16
|
-
*
|
|
17
|
-
* Results of selection statistics are cached to optimize performance for repeated calls on the same subtree.
|
|
18
|
-
*/
|
|
19
|
-
declare class SelectionSubtreeHelper {
|
|
20
|
-
private childRowIdsById;
|
|
21
|
-
private disabledKeysSet;
|
|
22
|
-
private selectedKeysSet;
|
|
23
|
-
private selectionStatsCache;
|
|
24
|
-
constructor({ childRowIdsById, disabledKeysSet, selectedKeysSet, }: SelectionSubtreeHelperArgs);
|
|
25
|
-
getSelectableKeys(rootIds: SelectionKey[]): SelectionKey[];
|
|
26
|
-
/**
|
|
27
|
-
* Returns the number of selectable and selected rows in the subtree of the given root ID.
|
|
28
|
-
* Results are cached after the first computation to optimize repeated calls for the same root ID.
|
|
29
|
-
*
|
|
30
|
-
* The selectable count excludes disabled rows, and the selected count excludes disabled rows that are selected.
|
|
31
|
-
* The method is implemented iteratively to handle deep trees without hitting call stack limits.
|
|
32
|
-
*
|
|
33
|
-
* How it works:
|
|
34
|
-
* - Manually add root ID to stack to get processing going. Note that the ready-flag is `false`.
|
|
35
|
-
* - Pop stack until empty. For each entry:
|
|
36
|
-
* - - If entry is already cached, skip it.
|
|
37
|
-
* - - If entry is not ready, push it back as ready and push all its children as not ready.
|
|
38
|
-
* - - If entry is ready, compute its stats based on its own state and the stats of its children, then cache the result.
|
|
39
|
-
* - Since we add all the children to the stack after pushing element with ready: true, while "popping" the stack we will always encounter the children before their parent is ready, ensuring that the stats for all children are computed and cached before computing the stats for their parent.
|
|
40
|
-
* - Finally, return the cached stats for the root ID.
|
|
41
|
-
*/
|
|
42
|
-
getSelectionStats(rootId: SelectionKey): SelectionStats;
|
|
43
|
-
isFullySelected(rootId: SelectionKey): boolean;
|
|
44
|
-
}
|
|
45
|
-
export { SelectionSubtreeHelper };
|
|
46
|
-
export type { SelectionKey, SelectionStats, SelectionSubtreeHelperArgs };
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectionSubtreeHelper = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Helper class for managing selection state in a tree structure.
|
|
6
|
-
* - It provides methods to get selectable keys in a subtree
|
|
7
|
-
* - Compute selection statistics for a subtree
|
|
8
|
-
* - Determine if a subtree is fully selected.
|
|
9
|
-
*
|
|
10
|
-
* Results of selection statistics are cached to optimize performance for repeated calls on the same subtree.
|
|
11
|
-
*/
|
|
12
|
-
class SelectionSubtreeHelper {
|
|
13
|
-
constructor({ childRowIdsById, disabledKeysSet, selectedKeysSet, }) {
|
|
14
|
-
this.selectionStatsCache = new Map();
|
|
15
|
-
this.childRowIdsById = childRowIdsById !== null && childRowIdsById !== void 0 ? childRowIdsById : new Map();
|
|
16
|
-
this.disabledKeysSet = disabledKeysSet;
|
|
17
|
-
this.selectedKeysSet = selectedKeysSet;
|
|
18
|
-
}
|
|
19
|
-
getSelectableKeys(rootIds) {
|
|
20
|
-
var _a;
|
|
21
|
-
const visitedKeys = new Set();
|
|
22
|
-
const selectableKeys = [];
|
|
23
|
-
const stack = [...rootIds].reverse();
|
|
24
|
-
while (stack.length > 0) {
|
|
25
|
-
const key = stack.pop();
|
|
26
|
-
if (key == null || visitedKeys.has(key)) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
visitedKeys.add(key);
|
|
30
|
-
if (!this.disabledKeysSet.has(key)) {
|
|
31
|
-
selectableKeys.push(key);
|
|
32
|
-
}
|
|
33
|
-
const childRowIds = (_a = this.childRowIdsById.get(key)) !== null && _a !== void 0 ? _a : [];
|
|
34
|
-
for (let childIndex = childRowIds.length - 1; childIndex >= 0; childIndex--) {
|
|
35
|
-
stack.push(childRowIds[childIndex]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return selectableKeys;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Returns the number of selectable and selected rows in the subtree of the given root ID.
|
|
42
|
-
* Results are cached after the first computation to optimize repeated calls for the same root ID.
|
|
43
|
-
*
|
|
44
|
-
* The selectable count excludes disabled rows, and the selected count excludes disabled rows that are selected.
|
|
45
|
-
* The method is implemented iteratively to handle deep trees without hitting call stack limits.
|
|
46
|
-
*
|
|
47
|
-
* How it works:
|
|
48
|
-
* - Manually add root ID to stack to get processing going. Note that the ready-flag is `false`.
|
|
49
|
-
* - Pop stack until empty. For each entry:
|
|
50
|
-
* - - If entry is already cached, skip it.
|
|
51
|
-
* - - If entry is not ready, push it back as ready and push all its children as not ready.
|
|
52
|
-
* - - If entry is ready, compute its stats based on its own state and the stats of its children, then cache the result.
|
|
53
|
-
* - Since we add all the children to the stack after pushing element with ready: true, while "popping" the stack we will always encounter the children before their parent is ready, ensuring that the stats for all children are computed and cached before computing the stats for their parent.
|
|
54
|
-
* - Finally, return the cached stats for the root ID.
|
|
55
|
-
*/
|
|
56
|
-
getSelectionStats(rootId) {
|
|
57
|
-
var _a, _b, _c;
|
|
58
|
-
const cachedStats = this.selectionStatsCache.get(rootId);
|
|
59
|
-
if (cachedStats) {
|
|
60
|
-
return cachedStats;
|
|
61
|
-
}
|
|
62
|
-
/* Compute subtree totals iteratively so deep trees do not depend on call stack depth. */
|
|
63
|
-
const stack = [
|
|
64
|
-
{ key: rootId, ready: false },
|
|
65
|
-
];
|
|
66
|
-
while (stack.length > 0) {
|
|
67
|
-
const entry = stack.pop();
|
|
68
|
-
if (!entry) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
if (this.selectionStatsCache.has(entry.key)) {
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
if (entry.ready) {
|
|
75
|
-
let selectableCount = this.disabledKeysSet.has(entry.key) ? 0 : 1;
|
|
76
|
-
let selectedCount = !this.disabledKeysSet.has(entry.key) &&
|
|
77
|
-
this.selectedKeysSet.has(entry.key)
|
|
78
|
-
? 1
|
|
79
|
-
: 0;
|
|
80
|
-
for (const childKey of (_a = this.childRowIdsById.get(entry.key)) !== null && _a !== void 0 ? _a : []) {
|
|
81
|
-
const childStats = this.selectionStatsCache.get(childKey);
|
|
82
|
-
if (!childStats) {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
selectableCount += childStats.selectableCount;
|
|
86
|
-
selectedCount += childStats.selectedCount;
|
|
87
|
-
}
|
|
88
|
-
this.selectionStatsCache.set(entry.key, {
|
|
89
|
-
selectableCount,
|
|
90
|
-
selectedCount,
|
|
91
|
-
});
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
stack.push({ key: entry.key, ready: true });
|
|
95
|
-
for (const childKey of (_b = this.childRowIdsById.get(entry.key)) !== null && _b !== void 0 ? _b : []) {
|
|
96
|
-
if (!this.selectionStatsCache.has(childKey)) {
|
|
97
|
-
stack.push({ key: childKey, ready: false });
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return ((_c = this.selectionStatsCache.get(rootId)) !== null && _c !== void 0 ? _c : {
|
|
102
|
-
selectableCount: 0,
|
|
103
|
-
selectedCount: 0,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
isFullySelected(rootId) {
|
|
107
|
-
const stats = this.getSelectionStats(rootId);
|
|
108
|
-
return (stats.selectableCount > 0 && stats.selectedCount === stats.selectableCount);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.SelectionSubtreeHelper = SelectionSubtreeHelper;
|
|
112
|
-
//# sourceMappingURL=SelectionSubtreeHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionSubtreeHelper.js","sourceRoot":"","sources":["../../../../../src/data/table/helpers/selection/SelectionSubtreeHelper.ts"],"names":[],"mappings":";;;AAaA;;;;;;;GAOG;AACH,MAAM,sBAAsB;IAM1B,YAAY,EACV,eAAe,EACf,eAAe,EACf,eAAe,GACY;QANrB,wBAAmB,GAAG,IAAI,GAAG,EAAgC,CAAC;QAOpE,IAAI,CAAC,eAAe,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAI,GAAG,EAAE,CAAC;QACpD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED,iBAAiB,CAAC,OAAuB;;QACvC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAgB,CAAC;QAC5C,MAAM,cAAc,GAAmB,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;QAErC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;YAExB,IAAI,GAAG,IAAI,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACxC,SAAS;YACX,CAAC;YAED,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAErB,IAAI,CAAC,IAAI,CAAC,eAAe,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,eAAe,EAAE,CAAC;YAClB,aAAa,EAAE,CAAC;SACjB,CACF,CAAC;IACJ,CAAC;IAED,eAAe,CAAC,MAAoB;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAE7C,OAAO,CACL,KAAK,CAAC,eAAe,GAAG,CAAC,IAAI,KAAK,CAAC,aAAa,KAAK,KAAK,CAAC,eAAe,CAC3E,CAAC;IACJ,CAAC;CACF;AAEQ,wDAAsB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface DataDragAndDropDragHandlerProps {
|
|
3
|
-
/**
|
|
4
|
-
* Whether the drag handler is disabled
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Wether dragging is done by keyboard. Used to conditionally render drag indicators.
|
|
8
|
-
*/
|
|
9
|
-
keyboardDragging?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Handle ref is forwarded to the button element serving as drag handle.
|
|
12
|
-
*/
|
|
13
|
-
handleRef: React.Ref<HTMLDivElement>;
|
|
14
|
-
alt?: boolean;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* DataDragAndDropDragHandler
|
|
18
|
-
*
|
|
19
|
-
* A button component that serves as a drag handle for drag and drop operations.
|
|
20
|
-
* Can be used to initiate dragging of elements in a data table or list.
|
|
21
|
-
*/
|
|
22
|
-
export declare const DataDragAndDropDragHandler: React.ForwardRefExoticComponent<DataDragAndDropDragHandlerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { CaretDownCircleFillIcon, CaretUpCircleFillIcon, DragVerticalIcon, } from "@navikt/aksel-icons";
|
|
3
|
-
import { Floating } from "../../../utils/components/floating/Floating.js";
|
|
4
|
-
/**
|
|
5
|
-
* DataDragAndDropDragHandler
|
|
6
|
-
*
|
|
7
|
-
* A button component that serves as a drag handle for drag and drop operations.
|
|
8
|
-
* Can be used to initiate dragging of elements in a data table or list.
|
|
9
|
-
*/
|
|
10
|
-
export const DataDragAndDropDragHandler = React.forwardRef(({ keyboardDragging, handleRef, alt }) => {
|
|
11
|
-
if (alt) {
|
|
12
|
-
return (React.createElement("div", { className: "aksel-data-drag-and-drop__drag-handler__alt" },
|
|
13
|
-
keyboardDragging && (React.createElement("span", { className: "aksel-data-drag-and-drop__drag-handler__arrow", "data-direction": "up" },
|
|
14
|
-
React.createElement(CaretUpCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" }))),
|
|
15
|
-
React.createElement("div", { ref: handleRef, className: "aksel-data-drag-and-drop__drag-handler__button" },
|
|
16
|
-
React.createElement(DragVerticalIcon, { "aria-hidden": true, title: "Dra for \u00E5 flytte", fontSize: "1.5rem" })),
|
|
17
|
-
keyboardDragging && (React.createElement("span", { className: "aksel-data-drag-and-drop__drag-handler__arrow", "data-direction": "down" },
|
|
18
|
-
React.createElement(CaretDownCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" })))));
|
|
19
|
-
}
|
|
20
|
-
return (React.createElement(Floating, null,
|
|
21
|
-
keyboardDragging && (React.createElement(Floating.Content, { side: "top", avoidCollisions: false, updatePositionStrategy: "always", className: "aksel-data-drag-and-drop__drag-handler__arrow" },
|
|
22
|
-
React.createElement(CaretUpCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" }))),
|
|
23
|
-
React.createElement(Floating.Anchor, { asChild: true },
|
|
24
|
-
React.createElement("div", { ref: handleRef, className: "aksel-data-drag-and-drop__drag-handler__button" },
|
|
25
|
-
React.createElement(DragVerticalIcon, { "aria-hidden": true, title: "Dra for \u00E5 flytte", fontSize: "1.5rem" }))),
|
|
26
|
-
keyboardDragging && (React.createElement(Floating.Content, { avoidCollisions: false, updatePositionStrategy: "always", className: "aksel-data-drag-and-drop__drag-handler__arrow" },
|
|
27
|
-
React.createElement(CaretDownCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" })))));
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=DataDragAndDropDragHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataDragAndDropDragHandler.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAmBvE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC,UAAU,CAGxD,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE;IACzC,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,CACL,6BAAK,SAAS,EAAC,6CAA6C;YACzD,gBAAgB,IAAI,CACnB,8BACE,SAAS,EAAC,+CAA+C,oBAC1C,IAAI;gBAEnB,oBAAC,qBAAqB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CAClD,CACR;YACD,6BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAC,gDAAgD;gBAE1D,oBAAC,gBAAgB,yBAEf,KAAK,EAAC,uBAAkB,EACxB,QAAQ,EAAC,QAAQ,GACjB,CACE;YACL,gBAAgB,IAAI,CACnB,8BACE,SAAS,EAAC,+CAA+C,oBAC1C,MAAM;gBAErB,oBAAC,uBAAuB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CACpD,CACR,CACG,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,oBAAC,QAAQ;QACN,gBAAgB,IAAI,CACnB,oBAAC,QAAQ,CAAC,OAAO,IACf,IAAI,EAAC,KAAK,EACV,eAAe,EAAE,KAAK,EACtB,sBAAsB,EAAC,QAAQ,EAC/B,SAAS,EAAC,+CAA+C;YAEzD,oBAAC,qBAAqB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CACtC,CACpB;QACD,oBAAC,QAAQ,CAAC,MAAM,IAAC,OAAO;YACtB,6BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAC,gDAAgD;gBAE1D,oBAAC,gBAAgB,yBAEf,KAAK,EAAC,uBAAkB,EACxB,QAAQ,EAAC,QAAQ,GACjB,CACE,CACU;QACjB,gBAAgB,IAAI,CACnB,oBAAC,QAAQ,CAAC,OAAO,IACf,eAAe,EAAE,KAAK,EACtB,sBAAsB,EAAC,QAAQ,EAC/B,SAAS,EAAC,+CAA+C;YAEzD,oBAAC,uBAAuB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CACxC,CACpB,CACQ,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface DataDragAndDropItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
/**
|
|
5
|
-
* Unique id
|
|
6
|
-
*/
|
|
7
|
-
id: string;
|
|
8
|
-
/**
|
|
9
|
-
* Index of the item being dragged
|
|
10
|
-
*/
|
|
11
|
-
index: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* TODO
|
|
15
|
-
*
|
|
16
|
-
* @see 🏷️ {@link DataDragAndDropItemProps}
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* <DragAndDrop.Item numOfSelectedRows={selectedRows.length} onClear={handleClear}>
|
|
20
|
-
* TODO
|
|
21
|
-
* </DragAndDrop.Item>
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
declare const DataDragAndDropItem: React.ForwardRefExoticComponent<DataDragAndDropItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
-
export default DataDragAndDropItem;
|
|
26
|
-
export { DataDragAndDropItem };
|
|
27
|
-
export type { DataDragAndDropItemProps };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { useSortable } from "@dnd-kit/react/sortable";
|
|
13
|
-
import React, { useRef } from "react";
|
|
14
|
-
import { HStack } from "../../../primitives/stack/index.js";
|
|
15
|
-
import { cl } from "../../../utils/helpers/index.js";
|
|
16
|
-
import { useMergeRefs } from "../../../utils/hooks/index.js";
|
|
17
|
-
import { DataDragAndDropDragHandler } from "../drag-handler/DataDragAndDropDragHandler.js";
|
|
18
|
-
import { DataDragAndDropContext } from "../root/DataDragAndDrop.context.js";
|
|
19
|
-
/**
|
|
20
|
-
* TODO
|
|
21
|
-
*
|
|
22
|
-
* @see 🏷️ {@link DataDragAndDropItemProps}
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* <DragAndDrop.Item numOfSelectedRows={selectedRows.length} onClear={handleClear}>
|
|
26
|
-
* TODO
|
|
27
|
-
* </DragAndDrop.Item>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
const DataDragAndDropItem = React.forwardRef((_a, forwardedRef) => {
|
|
31
|
-
var { children, id, index, className } = _a, rest = __rest(_a, ["children", "id", "index", "className"]);
|
|
32
|
-
const handleRef = useRef(null);
|
|
33
|
-
const { ref, isDragging, isDropTarget } = useSortable({
|
|
34
|
-
id,
|
|
35
|
-
index,
|
|
36
|
-
handle: handleRef,
|
|
37
|
-
});
|
|
38
|
-
const mergedRef = useMergeRefs(ref, forwardedRef);
|
|
39
|
-
const context = React.useContext(DataDragAndDropContext);
|
|
40
|
-
const mouseDragging = isDragging && (context === null || context === void 0 ? void 0 : context.inputMethod) === "mouse";
|
|
41
|
-
const mouseDropTarget = isDropTarget && (context === null || context === void 0 ? void 0 : context.inputMethod) === "mouse";
|
|
42
|
-
const keyboardDragging = isDragging && (context === null || context === void 0 ? void 0 : context.inputMethod) === "keyboard";
|
|
43
|
-
return (React.createElement(HStack, { gap: "space-8", align: "center", wrap: false, asChild: true },
|
|
44
|
-
React.createElement("div", Object.assign({ ref: mergedRef }, rest, { className: cl("aksel-data-table__drag-and-drop-item", className), "data-dragging": isDragging, "data-mouse-dragging": mouseDragging, "data-keyboard-dragging": keyboardDragging, "data-drop-target": mouseDropTarget, tabIndex: -1 }),
|
|
45
|
-
React.createElement(DataDragAndDropDragHandler, { handleRef: handleRef, keyboardDragging: keyboardDragging, alt: true }),
|
|
46
|
-
React.createElement("div", null, children))));
|
|
47
|
-
});
|
|
48
|
-
export default DataDragAndDropItem;
|
|
49
|
-
export { DataDragAndDropItem };
|
|
50
|
-
//# sourceMappingURL=DataDragAndDropItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataDragAndDropItem.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-old/item/DataDragAndDropItem.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,E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,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,SACH;YACF,iCAAM,QAAQ,CAAO,CACjB,CACC,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataDragAndDrop.context.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-old/root/DataDragAndDrop.context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAQtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAEjD,SAAS,CAAC,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import DataDragAndDropItem, { DataDragAndDropItemProps } from "../item/DataDragAndDropItem.js";
|
|
3
|
-
interface DataDragAndDropProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
children: any[];
|
|
5
|
-
setItems: React.Dispatch<React.SetStateAction<any[]>>;
|
|
6
|
-
}
|
|
7
|
-
interface DataDragAndDropRootComponent extends React.ForwardRefExoticComponent<DataDragAndDropProps & React.RefAttributes<HTMLDivElement>> {
|
|
8
|
-
/**
|
|
9
|
-
* @see 🏷️ {@link DataDragAndDropItemProps}
|
|
10
|
-
* * @example
|
|
11
|
-
* ```jsx
|
|
12
|
-
* <DragAndDrop>
|
|
13
|
-
* <DragAndDrop.Item id="1" index={0}>
|
|
14
|
-
* ...
|
|
15
|
-
* </DragAndDrop.Item>
|
|
16
|
-
* </DragAndDrop>
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
Item: typeof DataDragAndDropItem;
|
|
20
|
-
}
|
|
21
|
-
declare const DataDragAndDrop: DataDragAndDropRootComponent;
|
|
22
|
-
export { DataDragAndDrop, DataDragAndDropItem };
|
|
23
|
-
export default DataDragAndDrop;
|
|
24
|
-
export type { DataDragAndDropItemProps, DataDragAndDropProps };
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { DragDropProvider, DragOverlay } from "@dnd-kit/react";
|
|
13
|
-
import { isSortable } from "@dnd-kit/react/sortable";
|
|
14
|
-
import React, { forwardRef, isValidElement } from "react";
|
|
15
|
-
import { VStack } from "../../../primitives/stack/index.js";
|
|
16
|
-
import DataDragAndDropItem from "../item/DataDragAndDropItem.js";
|
|
17
|
-
import { DataDragAndDropContext } from "./DataDragAndDrop.context.js";
|
|
18
|
-
const DataDragAndDrop = forwardRef((_a, forwardedRef) => {
|
|
19
|
-
var { setItems, children } = _a, rest = __rest(_a, ["setItems", "children"]);
|
|
20
|
-
const [inputMethod, setInputMethod] = React.useState(null);
|
|
21
|
-
const setItemOrder = (initalIndex, targetIndex) => {
|
|
22
|
-
setItems((items) => {
|
|
23
|
-
const newItems = [...items];
|
|
24
|
-
const [movedItem] = newItems.splice(initalIndex, 1);
|
|
25
|
-
newItems.splice(targetIndex, 0, movedItem);
|
|
26
|
-
return newItems;
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
return (React.createElement(DataDragAndDropContext.Provider, { value: { inputMethod } },
|
|
30
|
-
React.createElement(DragDropProvider
|
|
31
|
-
// TODO Look into overriding default keybinds, might eliminate context need
|
|
32
|
-
, {
|
|
33
|
-
// TODO Look into overriding default keybinds, might eliminate context need
|
|
34
|
-
onBeforeDragStart: (event) => {
|
|
35
|
-
var _a;
|
|
36
|
-
return setInputMethod(((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown"
|
|
37
|
-
? "mouse"
|
|
38
|
-
: "keyboard");
|
|
39
|
-
}, onDragOver: (event) => {
|
|
40
|
-
var _a;
|
|
41
|
-
if (((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown") {
|
|
42
|
-
// Prevents items to rearrange while dragging with mouse, but allows keyboard dragging to work as intended
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
}
|
|
45
|
-
}, onDragEnd: (event) => {
|
|
46
|
-
const { source, target } = event.operation;
|
|
47
|
-
if (!isSortable(source) || !isSortable(target))
|
|
48
|
-
return;
|
|
49
|
-
setItemOrder(source.initialIndex, target.index);
|
|
50
|
-
} },
|
|
51
|
-
React.createElement(VStack, { asChild: true, gap: "space-12" },
|
|
52
|
-
React.createElement("div", Object.assign({}, rest, { ref: forwardedRef }), children)),
|
|
53
|
-
React.createElement(DragOverlay, { dropAnimation: null }, (source) => {
|
|
54
|
-
// Overlay not needed and causes glitching when using keyboard
|
|
55
|
-
if (inputMethod === "keyboard")
|
|
56
|
-
return null;
|
|
57
|
-
if (!isSortable(source))
|
|
58
|
-
return null;
|
|
59
|
-
if (isValidElement(children[source.initialIndex])) {
|
|
60
|
-
return children[source.initialIndex];
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}))));
|
|
64
|
-
});
|
|
65
|
-
DataDragAndDrop.Item = DataDragAndDropItem;
|
|
66
|
-
export { DataDragAndDrop, DataDragAndDropItem };
|
|
67
|
-
export default DataDragAndDrop;
|
|
68
|
-
//# sourceMappingURL=DataDragAndDropRoot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataDragAndDropRoot.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-old/root/DataDragAndDropR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mB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC;AAChD,eAAe,eAAe,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
type SelectionKey = string | number;
|
|
2
|
-
type SelectionStats = {
|
|
3
|
-
selectableCount: number;
|
|
4
|
-
selectedCount: number;
|
|
5
|
-
};
|
|
6
|
-
type SelectionSubtreeHelperArgs = {
|
|
7
|
-
childRowIdsById?: Map<SelectionKey, SelectionKey[]>;
|
|
8
|
-
disabledKeysSet: Set<SelectionKey>;
|
|
9
|
-
selectedKeysSet: Set<SelectionKey>;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Helper class for managing selection state in a tree structure.
|
|
13
|
-
* - It provides methods to get selectable keys in a subtree
|
|
14
|
-
* - Compute selection statistics for a subtree
|
|
15
|
-
* - Determine if a subtree is fully selected.
|
|
16
|
-
*
|
|
17
|
-
* Results of selection statistics are cached to optimize performance for repeated calls on the same subtree.
|
|
18
|
-
*/
|
|
19
|
-
declare class SelectionSubtreeHelper {
|
|
20
|
-
private childRowIdsById;
|
|
21
|
-
private disabledKeysSet;
|
|
22
|
-
private selectedKeysSet;
|
|
23
|
-
private selectionStatsCache;
|
|
24
|
-
constructor({ childRowIdsById, disabledKeysSet, selectedKeysSet, }: SelectionSubtreeHelperArgs);
|
|
25
|
-
getSelectableKeys(rootIds: SelectionKey[]): SelectionKey[];
|
|
26
|
-
/**
|
|
27
|
-
* Returns the number of selectable and selected rows in the subtree of the given root ID.
|
|
28
|
-
* Results are cached after the first computation to optimize repeated calls for the same root ID.
|
|
29
|
-
*
|
|
30
|
-
* The selectable count excludes disabled rows, and the selected count excludes disabled rows that are selected.
|
|
31
|
-
* The method is implemented iteratively to handle deep trees without hitting call stack limits.
|
|
32
|
-
*
|
|
33
|
-
* How it works:
|
|
34
|
-
* - Manually add root ID to stack to get processing going. Note that the ready-flag is `false`.
|
|
35
|
-
* - Pop stack until empty. For each entry:
|
|
36
|
-
* - - If entry is already cached, skip it.
|
|
37
|
-
* - - If entry is not ready, push it back as ready and push all its children as not ready.
|
|
38
|
-
* - - If entry is ready, compute its stats based on its own state and the stats of its children, then cache the result.
|
|
39
|
-
* - Since we add all the children to the stack after pushing element with ready: true, while "popping" the stack we will always encounter the children before their parent is ready, ensuring that the stats for all children are computed and cached before computing the stats for their parent.
|
|
40
|
-
* - Finally, return the cached stats for the root ID.
|
|
41
|
-
*/
|
|
42
|
-
getSelectionStats(rootId: SelectionKey): SelectionStats;
|
|
43
|
-
isFullySelected(rootId: SelectionKey): boolean;
|
|
44
|
-
}
|
|
45
|
-
export { SelectionSubtreeHelper };
|
|
46
|
-
export type { SelectionKey, SelectionStats, SelectionSubtreeHelperArgs };
|