react-arborist 3.3.0-rc.1 → 3.3.1
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/dist/main/components/cursor.d.ts +1 -0
- package/dist/main/components/cursor.js +20 -0
- package/dist/{components → main/components}/default-container.d.ts +1 -2
- package/dist/main/components/default-container.js +238 -0
- package/dist/main/components/default-cursor.js +35 -0
- package/dist/{components → main/components}/default-drag-preview.d.ts +1 -2
- package/dist/main/components/default-drag-preview.js +57 -0
- package/dist/{components → main/components}/default-node.d.ts +1 -2
- package/dist/main/components/default-node.js +32 -0
- package/dist/{components → main/components}/default-row.d.ts +1 -2
- package/dist/main/components/default-row.js +8 -0
- package/dist/main/components/drag-preview-container.d.ts +1 -0
- package/dist/main/components/drag-preview-container.js +21 -0
- package/dist/{components → main/components}/list-inner-element.d.ts +1 -1
- package/dist/main/components/list-inner-element.js +25 -0
- package/dist/main/components/list-outer-element.d.ts +2 -0
- package/dist/main/components/list-outer-element.js +38 -0
- package/dist/main/components/outer-drop.js +9 -0
- package/dist/{components → main/components}/provider.d.ts +2 -2
- package/dist/main/components/provider.js +52 -0
- package/dist/{components → main/components}/row-container.d.ts +2 -2
- package/dist/main/components/row-container.js +84 -0
- package/dist/main/components/tree-container.d.ts +1 -0
- package/dist/main/components/tree-container.js +12 -0
- package/dist/{components → main/components}/tree.d.ts +1 -1
- package/dist/main/components/tree.js +15 -0
- package/dist/{context.d.ts → main/context.d.ts} +4 -4
- package/dist/main/context.js +33 -0
- package/dist/main/data/create-index.js +10 -0
- package/dist/main/data/create-list.js +62 -0
- package/dist/main/data/create-root.js +43 -0
- package/dist/main/data/make-tree.d.ts +5 -0
- package/dist/main/data/make-tree.js +40 -0
- package/dist/{data → main/data}/simple-tree.d.ts +1 -1
- package/dist/main/data/simple-tree.js +100 -0
- package/dist/{dnd → main/dnd}/compute-drop.d.ts +6 -6
- package/dist/main/dnd/compute-drop.js +129 -0
- package/dist/main/dnd/drag-hook.js +46 -0
- package/dist/{dnd → main/dnd}/drop-hook.d.ts +1 -1
- package/dist/main/dnd/drop-hook.js +42 -0
- package/dist/main/dnd/measure-hover.d.ts +8 -0
- package/dist/main/dnd/measure-hover.js +21 -0
- package/dist/main/dnd/outer-drop-hook.js +45 -0
- package/dist/main/hooks/use-fresh-node.js +18 -0
- package/dist/{hooks → main/hooks}/use-simple-tree.d.ts +1 -1
- package/dist/main/hooks/use-simple-tree.js +35 -0
- package/dist/main/hooks/use-validated-props.js +29 -0
- package/dist/main/index.js +27 -0
- package/dist/{interfaces → main/interfaces}/node-api.d.ts +1 -1
- package/dist/main/interfaces/node-api.js +164 -0
- package/dist/{interfaces → main/interfaces}/tree-api.d.ts +88 -8
- package/dist/main/interfaces/tree-api.js +649 -0
- package/dist/main/interfaces/tree-api.test.d.ts +1 -0
- package/dist/main/interfaces/tree-api.test.js +14 -0
- package/dist/{state → main/state}/dnd-slice.d.ts +1 -1
- package/dist/main/state/dnd-slice.js +35 -0
- package/dist/{state → main/state}/drag-slice.d.ts +1 -1
- package/dist/main/state/drag-slice.js +24 -0
- package/dist/{state → main/state}/edit-slice.d.ts +1 -1
- package/dist/main/state/edit-slice.js +18 -0
- package/dist/{state → main/state}/focus-slice.d.ts +1 -1
- package/dist/main/state/focus-slice.js +26 -0
- package/dist/main/state/initial.js +29 -0
- package/dist/{state → main/state}/open-slice.d.ts +2 -2
- package/dist/main/state/open-slice.js +48 -0
- package/dist/main/state/root-reducer.d.ts +96 -0
- package/dist/main/state/root-reducer.js +20 -0
- package/dist/{state → main/state}/selection-slice.d.ts +1 -1
- package/dist/main/state/selection-slice.js +59 -0
- package/dist/{types → main/types}/dnd.d.ts +2 -2
- package/dist/main/types/dnd.js +2 -0
- package/dist/{types → main/types}/handlers.d.ts +5 -5
- package/dist/main/types/handlers.js +2 -0
- package/dist/{types → main/types}/renderers.d.ts +4 -4
- package/dist/main/types/renderers.js +2 -0
- package/dist/main/types/state.d.ts +2 -0
- package/dist/main/types/state.js +2 -0
- package/dist/{types → main/types}/tree-props.d.ts +1 -1
- package/dist/main/types/tree-props.js +2 -0
- package/dist/{types → main/types}/utils.d.ts +5 -5
- package/dist/main/types/utils.js +2 -0
- package/dist/main/utils.js +183 -0
- package/dist/module/components/cursor.d.ts +1 -0
- package/dist/module/components/cursor.js +16 -0
- package/dist/module/components/default-container.d.ts +6 -0
- package/dist/module/components/default-container.js +234 -0
- package/dist/module/components/default-cursor.d.ts +3 -0
- package/dist/module/components/default-cursor.js +29 -0
- package/dist/module/components/default-drag-preview.d.ts +2 -0
- package/dist/module/components/default-drag-preview.js +53 -0
- package/dist/module/components/default-node.d.ts +2 -0
- package/dist/module/components/default-node.js +28 -0
- package/dist/module/components/default-row.d.ts +2 -0
- package/dist/module/components/default-row.js +4 -0
- package/dist/module/components/drag-preview-container.d.ts +1 -0
- package/dist/module/components/drag-preview-container.js +17 -0
- package/dist/module/components/list-inner-element.d.ts +2 -0
- package/dist/module/components/list-inner-element.js +22 -0
- package/dist/module/components/list-outer-element.d.ts +2 -0
- package/dist/module/components/list-outer-element.js +35 -0
- package/dist/module/components/outer-drop.d.ts +4 -0
- package/dist/module/components/outer-drop.js +5 -0
- package/dist/module/components/provider.d.ts +10 -0
- package/dist/module/components/provider.js +48 -0
- package/dist/module/components/row-container.d.ts +7 -0
- package/dist/module/components/row-container.js +58 -0
- package/dist/module/components/tree-container.d.ts +1 -0
- package/dist/module/components/tree-container.js +8 -0
- package/dist/module/components/tree.d.ts +8 -0
- package/dist/module/components/tree.js +12 -0
- package/dist/module/context.d.ts +22 -0
- package/dist/module/context.js +26 -0
- package/dist/module/data/create-index.d.ts +4 -0
- package/dist/module/data/create-index.js +6 -0
- package/dist/module/data/create-list.d.ts +3 -0
- package/dist/module/data/create-list.js +58 -0
- package/dist/module/data/create-root.d.ts +4 -0
- package/dist/module/data/create-root.js +39 -0
- package/dist/module/data/make-tree.d.ts +5 -0
- package/dist/module/data/make-tree.js +36 -0
- package/dist/module/data/simple-tree.d.ts +44 -0
- package/dist/module/data/simple-tree.js +96 -0
- package/dist/module/dnd/compute-drop.d.ts +37 -0
- package/dist/module/dnd/compute-drop.js +125 -0
- package/dist/module/dnd/drag-hook.d.ts +3 -0
- package/dist/module/dnd/drag-hook.js +42 -0
- package/dist/module/dnd/drop-hook.d.ts +8 -0
- package/dist/module/dnd/drop-hook.js +38 -0
- package/dist/module/dnd/measure-hover.d.ts +8 -0
- package/dist/module/dnd/measure-hover.js +17 -0
- package/dist/module/dnd/outer-drop-hook.d.ts +1 -0
- package/dist/module/dnd/outer-drop-hook.js +41 -0
- package/dist/module/hooks/use-fresh-node.d.ts +1 -0
- package/dist/module/hooks/use-fresh-node.js +14 -0
- package/dist/module/hooks/use-simple-tree.d.ts +12 -0
- package/dist/module/hooks/use-simple-tree.js +31 -0
- package/dist/module/hooks/use-validated-props.d.ts +2 -0
- package/dist/module/hooks/use-validated-props.js +25 -0
- package/dist/module/index.d.ts +8 -0
- package/dist/module/index.js +9 -0
- package/dist/module/interfaces/node-api.d.ts +71 -0
- package/dist/module/interfaces/node-api.js +160 -0
- package/dist/module/interfaces/tree-api.d.ts +214 -0
- package/dist/module/interfaces/tree-api.js +622 -0
- package/dist/module/interfaces/tree-api.test.d.ts +1 -0
- package/dist/module/interfaces/tree-api.test.js +12 -0
- package/dist/module/state/dnd-slice.d.ts +29 -0
- package/dist/module/state/dnd-slice.js +31 -0
- package/dist/module/state/drag-slice.d.ts +9 -0
- package/dist/module/state/drag-slice.js +20 -0
- package/dist/module/state/edit-slice.d.ts +8 -0
- package/dist/module/state/edit-slice.js +13 -0
- package/dist/module/state/focus-slice.d.ts +12 -0
- package/dist/module/state/focus-slice.js +20 -0
- package/dist/module/state/initial.d.ts +3 -0
- package/dist/module/state/initial.js +25 -0
- package/dist/module/state/open-slice.d.ts +30 -0
- package/dist/module/state/open-slice.js +44 -0
- package/dist/module/state/root-reducer.d.ts +96 -0
- package/dist/module/state/root-reducer.js +17 -0
- package/dist/module/state/selection-slice.d.ts +42 -0
- package/dist/module/state/selection-slice.js +55 -0
- package/dist/module/types/dnd.d.ts +8 -0
- package/dist/module/types/dnd.js +1 -0
- package/dist/module/types/handlers.d.ts +30 -0
- package/dist/module/types/handlers.js +1 -0
- package/dist/module/types/renderers.d.ts +29 -0
- package/dist/module/types/renderers.js +1 -0
- package/dist/module/types/state.d.ts +2 -0
- package/dist/module/types/state.js +1 -0
- package/dist/module/types/tree-props.d.ts +56 -0
- package/dist/module/types/tree-props.js +1 -0
- package/dist/module/types/utils.d.ts +17 -0
- package/dist/module/types/utils.js +1 -0
- package/dist/module/utils.d.ts +24 -0
- package/dist/module/utils.js +162 -0
- package/package.json +24 -24
- package/src/components/default-container.tsx +2 -0
- package/src/components/provider.tsx +3 -2
- package/src/components/row-container.tsx +1 -1
- package/src/interfaces/tree-api.ts +1 -1
- package/src/types/tree-props.ts +1 -1
- package/dist/components/cursor.d.ts +0 -2
- package/dist/components/drag-preview-container.d.ts +0 -2
- package/dist/components/list-outer-element.d.ts +0 -2
- package/dist/components/tree-container.d.ts +0 -2
- package/dist/index.js +0 -2433
- package/dist/index.js.map +0 -1
- package/dist/module.js +0 -2406
- package/dist/module.js.map +0 -1
- package/dist/state/root-reducer.d.ts +0 -13
- package/dist/types/state.d.ts +0 -2
- package/jest.config.js +0 -5
- package/tsconfig.json +0 -4
- /package/dist/{components → main/components}/default-cursor.d.ts +0 -0
- /package/dist/{components → main/components}/outer-drop.d.ts +0 -0
- /package/dist/{data → main/data}/create-index.d.ts +0 -0
- /package/dist/{data → main/data}/create-list.d.ts +0 -0
- /package/dist/{data → main/data}/create-root.d.ts +0 -0
- /package/dist/{dnd → main/dnd}/drag-hook.d.ts +0 -0
- /package/dist/{dnd → main/dnd}/outer-drop-hook.d.ts +0 -0
- /package/dist/{hooks → main/hooks}/use-fresh-node.d.ts +0 -0
- /package/dist/{hooks → main/hooks}/use-validated-props.d.ts +0 -0
- /package/dist/{index.d.ts → main/index.d.ts} +0 -0
- /package/dist/{state → main/state}/initial.d.ts +0 -0
- /package/dist/{utils.d.ts → main/utils.d.ts} +0 -0
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import * as utils from "../utils";
|
|
11
|
+
import { DefaultCursor } from "../components/default-cursor";
|
|
12
|
+
import { DefaultRow } from "../components/default-row";
|
|
13
|
+
import { DefaultNode } from "../components/default-node";
|
|
14
|
+
import { edit } from "../state/edit-slice";
|
|
15
|
+
import { focus, treeBlur } from "../state/focus-slice";
|
|
16
|
+
import { createRoot, ROOT_ID } from "../data/create-root";
|
|
17
|
+
import { actions as visibility } from "../state/open-slice";
|
|
18
|
+
import { actions as selection } from "../state/selection-slice";
|
|
19
|
+
import { actions as dnd } from "../state/dnd-slice";
|
|
20
|
+
import { DefaultDragPreview } from "../components/default-drag-preview";
|
|
21
|
+
import { DefaultContainer } from "../components/default-container";
|
|
22
|
+
import { createList } from "../data/create-list";
|
|
23
|
+
import { createIndex } from "../data/create-index";
|
|
24
|
+
const { safeRun, identify, identifyNull } = utils;
|
|
25
|
+
export class TreeApi {
|
|
26
|
+
constructor(store, props, list, listEl) {
|
|
27
|
+
this.store = store;
|
|
28
|
+
this.props = props;
|
|
29
|
+
this.list = list;
|
|
30
|
+
this.listEl = listEl;
|
|
31
|
+
this.visibleStartIndex = 0;
|
|
32
|
+
this.visibleStopIndex = 0;
|
|
33
|
+
/* Changes here must also be made in update() */
|
|
34
|
+
this.root = createRoot(this);
|
|
35
|
+
this.visibleNodes = createList(this);
|
|
36
|
+
this.idToIndex = createIndex(this.visibleNodes);
|
|
37
|
+
}
|
|
38
|
+
/* Changes here must also be made in constructor() */
|
|
39
|
+
update(props) {
|
|
40
|
+
this.props = props;
|
|
41
|
+
this.root = createRoot(this);
|
|
42
|
+
this.visibleNodes = createList(this);
|
|
43
|
+
this.idToIndex = createIndex(this.visibleNodes);
|
|
44
|
+
}
|
|
45
|
+
/* Store helpers */
|
|
46
|
+
dispatch(action) {
|
|
47
|
+
return this.store.dispatch(action);
|
|
48
|
+
}
|
|
49
|
+
get state() {
|
|
50
|
+
return this.store.getState();
|
|
51
|
+
}
|
|
52
|
+
get openState() {
|
|
53
|
+
return this.state.nodes.open.unfiltered;
|
|
54
|
+
}
|
|
55
|
+
/* Tree Props */
|
|
56
|
+
get width() {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = this.props.width) !== null && _a !== void 0 ? _a : 300;
|
|
59
|
+
}
|
|
60
|
+
get height() {
|
|
61
|
+
var _a;
|
|
62
|
+
return (_a = this.props.height) !== null && _a !== void 0 ? _a : 500;
|
|
63
|
+
}
|
|
64
|
+
get indent() {
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = this.props.indent) !== null && _a !== void 0 ? _a : 24;
|
|
67
|
+
}
|
|
68
|
+
get rowHeight() {
|
|
69
|
+
var _a;
|
|
70
|
+
return (_a = this.props.rowHeight) !== null && _a !== void 0 ? _a : 24;
|
|
71
|
+
}
|
|
72
|
+
get overscanCount() {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = this.props.overscanCount) !== null && _a !== void 0 ? _a : 1;
|
|
75
|
+
}
|
|
76
|
+
get searchTerm() {
|
|
77
|
+
return (this.props.searchTerm || "").trim();
|
|
78
|
+
}
|
|
79
|
+
get matchFn() {
|
|
80
|
+
var _a;
|
|
81
|
+
const match = (_a = this.props.searchMatch) !== null && _a !== void 0 ? _a : ((node, term) => {
|
|
82
|
+
const string = JSON.stringify(Object.values(node.data));
|
|
83
|
+
return string.toLocaleLowerCase().includes(term.toLocaleLowerCase());
|
|
84
|
+
});
|
|
85
|
+
return (node) => match(node, this.searchTerm);
|
|
86
|
+
}
|
|
87
|
+
accessChildren(data) {
|
|
88
|
+
var _a;
|
|
89
|
+
const get = this.props.childrenAccessor || "children";
|
|
90
|
+
return (_a = utils.access(data, get)) !== null && _a !== void 0 ? _a : null;
|
|
91
|
+
}
|
|
92
|
+
accessId(data) {
|
|
93
|
+
const get = this.props.idAccessor || "id";
|
|
94
|
+
const id = utils.access(data, get);
|
|
95
|
+
if (!id)
|
|
96
|
+
throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");
|
|
97
|
+
return id;
|
|
98
|
+
}
|
|
99
|
+
/* Node Access */
|
|
100
|
+
get firstNode() {
|
|
101
|
+
var _a;
|
|
102
|
+
return (_a = this.visibleNodes[0]) !== null && _a !== void 0 ? _a : null;
|
|
103
|
+
}
|
|
104
|
+
get lastNode() {
|
|
105
|
+
var _a;
|
|
106
|
+
return (_a = this.visibleNodes[this.visibleNodes.length - 1]) !== null && _a !== void 0 ? _a : null;
|
|
107
|
+
}
|
|
108
|
+
get focusedNode() {
|
|
109
|
+
var _a;
|
|
110
|
+
return (_a = this.get(this.state.nodes.focus.id)) !== null && _a !== void 0 ? _a : null;
|
|
111
|
+
}
|
|
112
|
+
get mostRecentNode() {
|
|
113
|
+
var _a;
|
|
114
|
+
return (_a = this.get(this.state.nodes.selection.mostRecent)) !== null && _a !== void 0 ? _a : null;
|
|
115
|
+
}
|
|
116
|
+
get nextNode() {
|
|
117
|
+
const index = this.indexOf(this.focusedNode);
|
|
118
|
+
if (index === null)
|
|
119
|
+
return null;
|
|
120
|
+
else
|
|
121
|
+
return this.at(index + 1);
|
|
122
|
+
}
|
|
123
|
+
get prevNode() {
|
|
124
|
+
const index = this.indexOf(this.focusedNode);
|
|
125
|
+
if (index === null)
|
|
126
|
+
return null;
|
|
127
|
+
else
|
|
128
|
+
return this.at(index - 1);
|
|
129
|
+
}
|
|
130
|
+
get(id) {
|
|
131
|
+
if (!id)
|
|
132
|
+
return null;
|
|
133
|
+
if (id in this.idToIndex)
|
|
134
|
+
return this.visibleNodes[this.idToIndex[id]] || null;
|
|
135
|
+
else
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
at(index) {
|
|
139
|
+
return this.visibleNodes[index] || null;
|
|
140
|
+
}
|
|
141
|
+
nodesBetween(startId, endId) {
|
|
142
|
+
var _a;
|
|
143
|
+
if (startId === null || endId === null)
|
|
144
|
+
return [];
|
|
145
|
+
const index1 = (_a = this.indexOf(startId)) !== null && _a !== void 0 ? _a : 0;
|
|
146
|
+
const index2 = this.indexOf(endId);
|
|
147
|
+
if (index2 === null)
|
|
148
|
+
return [];
|
|
149
|
+
const start = Math.min(index1, index2);
|
|
150
|
+
const end = Math.max(index1, index2);
|
|
151
|
+
return this.visibleNodes.slice(start, end + 1);
|
|
152
|
+
}
|
|
153
|
+
indexOf(id) {
|
|
154
|
+
const key = utils.identifyNull(id);
|
|
155
|
+
if (!key)
|
|
156
|
+
return null;
|
|
157
|
+
return this.idToIndex[key];
|
|
158
|
+
}
|
|
159
|
+
/* Data Operations */
|
|
160
|
+
get editingId() {
|
|
161
|
+
return this.state.nodes.edit.id;
|
|
162
|
+
}
|
|
163
|
+
createInternal() {
|
|
164
|
+
return this.create({ type: "internal" });
|
|
165
|
+
}
|
|
166
|
+
createLeaf() {
|
|
167
|
+
return this.create({ type: "leaf" });
|
|
168
|
+
}
|
|
169
|
+
create(opts = {}) {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
const parentId = opts.parentId === undefined
|
|
173
|
+
? utils.getInsertParentId(this)
|
|
174
|
+
: opts.parentId;
|
|
175
|
+
const index = (_a = opts.index) !== null && _a !== void 0 ? _a : utils.getInsertIndex(this);
|
|
176
|
+
const type = (_b = opts.type) !== null && _b !== void 0 ? _b : "leaf";
|
|
177
|
+
const data = yield safeRun(this.props.onCreate, {
|
|
178
|
+
type,
|
|
179
|
+
parentId,
|
|
180
|
+
index,
|
|
181
|
+
parentNode: this.get(parentId),
|
|
182
|
+
});
|
|
183
|
+
if (data) {
|
|
184
|
+
this.focus(data);
|
|
185
|
+
setTimeout(() => {
|
|
186
|
+
this.edit(data).then(() => {
|
|
187
|
+
this.select(data);
|
|
188
|
+
this.activate(data);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
delete(node) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
if (!node)
|
|
197
|
+
return;
|
|
198
|
+
const idents = Array.isArray(node) ? node : [node];
|
|
199
|
+
const ids = idents.map(identify);
|
|
200
|
+
const nodes = ids.map((id) => this.get(id)).filter((n) => !!n);
|
|
201
|
+
yield safeRun(this.props.onDelete, { nodes, ids });
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
edit(node) {
|
|
205
|
+
const id = identify(node);
|
|
206
|
+
this.resolveEdit({ cancelled: true });
|
|
207
|
+
this.scrollTo(id);
|
|
208
|
+
this.dispatch(edit(id));
|
|
209
|
+
return new Promise((resolve) => {
|
|
210
|
+
TreeApi.editPromise = resolve;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
submit(identity, value) {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
if (!identity)
|
|
216
|
+
return;
|
|
217
|
+
const id = identify(identity);
|
|
218
|
+
yield safeRun(this.props.onRename, {
|
|
219
|
+
id,
|
|
220
|
+
name: value,
|
|
221
|
+
node: this.get(id),
|
|
222
|
+
});
|
|
223
|
+
this.dispatch(edit(null));
|
|
224
|
+
this.resolveEdit({ cancelled: false, value });
|
|
225
|
+
setTimeout(() => this.onFocus()); // Return focus to element;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
reset() {
|
|
229
|
+
this.dispatch(edit(null));
|
|
230
|
+
this.resolveEdit({ cancelled: true });
|
|
231
|
+
setTimeout(() => this.onFocus()); // Return focus to element;
|
|
232
|
+
}
|
|
233
|
+
activate(id) {
|
|
234
|
+
const node = this.get(identifyNull(id));
|
|
235
|
+
if (!node)
|
|
236
|
+
return;
|
|
237
|
+
safeRun(this.props.onActivate, node);
|
|
238
|
+
}
|
|
239
|
+
resolveEdit(value) {
|
|
240
|
+
const resolve = TreeApi.editPromise;
|
|
241
|
+
if (resolve)
|
|
242
|
+
resolve(value);
|
|
243
|
+
TreeApi.editPromise = null;
|
|
244
|
+
}
|
|
245
|
+
/* Focus and Selection */
|
|
246
|
+
get selectedIds() {
|
|
247
|
+
return this.state.nodes.selection.ids;
|
|
248
|
+
}
|
|
249
|
+
get selectedNodes() {
|
|
250
|
+
let nodes = [];
|
|
251
|
+
for (let id of Array.from(this.selectedIds)) {
|
|
252
|
+
const node = this.get(id);
|
|
253
|
+
if (node)
|
|
254
|
+
nodes.push(node);
|
|
255
|
+
}
|
|
256
|
+
return nodes;
|
|
257
|
+
}
|
|
258
|
+
focus(node, opts = {}) {
|
|
259
|
+
if (!node)
|
|
260
|
+
return;
|
|
261
|
+
/* Focus is responsible for scrolling, while selection is
|
|
262
|
+
* responsible for focus. If selectionFollowsFocus, then
|
|
263
|
+
* just select it. */
|
|
264
|
+
if (this.props.selectionFollowsFocus) {
|
|
265
|
+
this.select(node);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
this.dispatch(focus(identify(node)));
|
|
269
|
+
if (opts.scroll !== false)
|
|
270
|
+
this.scrollTo(node);
|
|
271
|
+
if (this.focusedNode)
|
|
272
|
+
safeRun(this.props.onFocus, this.focusedNode);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
pageUp() {
|
|
276
|
+
var _a, _b;
|
|
277
|
+
const start = this.visibleStartIndex;
|
|
278
|
+
const stop = this.visibleStopIndex;
|
|
279
|
+
const page = stop - start;
|
|
280
|
+
let index = (_b = (_a = this.focusedNode) === null || _a === void 0 ? void 0 : _a.rowIndex) !== null && _b !== void 0 ? _b : 0;
|
|
281
|
+
if (index > start) {
|
|
282
|
+
index = start;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
index = Math.max(start - page, 0);
|
|
286
|
+
}
|
|
287
|
+
this.focus(this.at(index));
|
|
288
|
+
}
|
|
289
|
+
pageDown() {
|
|
290
|
+
var _a, _b;
|
|
291
|
+
const start = this.visibleStartIndex;
|
|
292
|
+
const stop = this.visibleStopIndex;
|
|
293
|
+
const page = stop - start;
|
|
294
|
+
let index = (_b = (_a = this.focusedNode) === null || _a === void 0 ? void 0 : _a.rowIndex) !== null && _b !== void 0 ? _b : 0;
|
|
295
|
+
if (index < stop) {
|
|
296
|
+
index = stop;
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
index = Math.min(index + page, this.visibleNodes.length - 1);
|
|
300
|
+
}
|
|
301
|
+
this.focus(this.at(index));
|
|
302
|
+
}
|
|
303
|
+
select(node, opts = {}) {
|
|
304
|
+
if (!node)
|
|
305
|
+
return;
|
|
306
|
+
const changeFocus = opts.focus !== false;
|
|
307
|
+
const id = identify(node);
|
|
308
|
+
if (changeFocus)
|
|
309
|
+
this.dispatch(focus(id));
|
|
310
|
+
this.dispatch(selection.only(id));
|
|
311
|
+
this.dispatch(selection.anchor(id));
|
|
312
|
+
this.dispatch(selection.mostRecent(id));
|
|
313
|
+
this.scrollTo(id, opts.align);
|
|
314
|
+
if (this.focusedNode && changeFocus) {
|
|
315
|
+
safeRun(this.props.onFocus, this.focusedNode);
|
|
316
|
+
}
|
|
317
|
+
safeRun(this.props.onSelect, this.selectedNodes);
|
|
318
|
+
}
|
|
319
|
+
deselect(node) {
|
|
320
|
+
if (!node)
|
|
321
|
+
return;
|
|
322
|
+
const id = identify(node);
|
|
323
|
+
this.dispatch(selection.remove(id));
|
|
324
|
+
}
|
|
325
|
+
selectMulti(identity) {
|
|
326
|
+
const node = this.get(identifyNull(identity));
|
|
327
|
+
if (!node)
|
|
328
|
+
return;
|
|
329
|
+
this.dispatch(focus(node.id));
|
|
330
|
+
this.dispatch(selection.add(node.id));
|
|
331
|
+
this.dispatch(selection.anchor(node.id));
|
|
332
|
+
this.dispatch(selection.mostRecent(node.id));
|
|
333
|
+
this.scrollTo(node);
|
|
334
|
+
if (this.focusedNode)
|
|
335
|
+
safeRun(this.props.onFocus, this.focusedNode);
|
|
336
|
+
safeRun(this.props.onSelect, this.selectedNodes);
|
|
337
|
+
}
|
|
338
|
+
selectContiguous(identity) {
|
|
339
|
+
if (!identity)
|
|
340
|
+
return;
|
|
341
|
+
const id = identify(identity);
|
|
342
|
+
const { anchor, mostRecent } = this.state.nodes.selection;
|
|
343
|
+
this.dispatch(focus(id));
|
|
344
|
+
this.dispatch(selection.remove(this.nodesBetween(anchor, mostRecent)));
|
|
345
|
+
this.dispatch(selection.add(this.nodesBetween(anchor, identifyNull(id))));
|
|
346
|
+
this.dispatch(selection.mostRecent(id));
|
|
347
|
+
this.scrollTo(id);
|
|
348
|
+
if (this.focusedNode)
|
|
349
|
+
safeRun(this.props.onFocus, this.focusedNode);
|
|
350
|
+
safeRun(this.props.onSelect, this.selectedNodes);
|
|
351
|
+
}
|
|
352
|
+
deselectAll() {
|
|
353
|
+
this.setSelection({ ids: [], anchor: null, mostRecent: null });
|
|
354
|
+
safeRun(this.props.onSelect, this.selectedNodes);
|
|
355
|
+
}
|
|
356
|
+
selectAll() {
|
|
357
|
+
var _a;
|
|
358
|
+
this.setSelection({
|
|
359
|
+
ids: Object.keys(this.idToIndex),
|
|
360
|
+
anchor: this.firstNode,
|
|
361
|
+
mostRecent: this.lastNode,
|
|
362
|
+
});
|
|
363
|
+
this.dispatch(focus((_a = this.lastNode) === null || _a === void 0 ? void 0 : _a.id));
|
|
364
|
+
if (this.focusedNode)
|
|
365
|
+
safeRun(this.props.onFocus, this.focusedNode);
|
|
366
|
+
safeRun(this.props.onSelect, this.selectedNodes);
|
|
367
|
+
}
|
|
368
|
+
setSelection(args) {
|
|
369
|
+
var _a;
|
|
370
|
+
const ids = new Set((_a = args.ids) === null || _a === void 0 ? void 0 : _a.map(identify));
|
|
371
|
+
const anchor = identifyNull(args.anchor);
|
|
372
|
+
const mostRecent = identifyNull(args.mostRecent);
|
|
373
|
+
this.dispatch(selection.set({ ids, anchor, mostRecent }));
|
|
374
|
+
safeRun(this.props.onSelect, this.selectedNodes);
|
|
375
|
+
}
|
|
376
|
+
/* Drag and Drop */
|
|
377
|
+
get cursorParentId() {
|
|
378
|
+
const { cursor } = this.state.dnd;
|
|
379
|
+
switch (cursor.type) {
|
|
380
|
+
case "highlight":
|
|
381
|
+
return cursor.id;
|
|
382
|
+
default:
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
get cursorOverFolder() {
|
|
387
|
+
return this.state.dnd.cursor.type === "highlight";
|
|
388
|
+
}
|
|
389
|
+
get dragNodes() {
|
|
390
|
+
return this.state.dnd.dragIds
|
|
391
|
+
.map((id) => this.get(id))
|
|
392
|
+
.filter((n) => !!n);
|
|
393
|
+
}
|
|
394
|
+
get dragNode() {
|
|
395
|
+
return this.get(this.state.nodes.drag.id);
|
|
396
|
+
}
|
|
397
|
+
get dragDestinationParent() {
|
|
398
|
+
return this.get(this.state.nodes.drag.destinationParentId);
|
|
399
|
+
}
|
|
400
|
+
get dragDestinationIndex() {
|
|
401
|
+
return this.state.nodes.drag.destinationIndex;
|
|
402
|
+
}
|
|
403
|
+
canDrop() {
|
|
404
|
+
var _a;
|
|
405
|
+
if (this.isFiltered)
|
|
406
|
+
return false;
|
|
407
|
+
const parentNode = (_a = this.get(this.state.dnd.parentId)) !== null && _a !== void 0 ? _a : this.root;
|
|
408
|
+
const dragNodes = this.dragNodes;
|
|
409
|
+
const isDisabled = this.props.disableDrop;
|
|
410
|
+
for (const drag of dragNodes) {
|
|
411
|
+
if (!drag)
|
|
412
|
+
return false;
|
|
413
|
+
if (!parentNode)
|
|
414
|
+
return false;
|
|
415
|
+
if (drag.isInternal && utils.isDescendant(parentNode, drag))
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
// Allow the user to insert their own logic
|
|
419
|
+
if (typeof isDisabled == "function") {
|
|
420
|
+
return !isDisabled({
|
|
421
|
+
parentNode,
|
|
422
|
+
dragNodes: this.dragNodes,
|
|
423
|
+
index: this.state.dnd.index || 0,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
else if (typeof isDisabled == "string") {
|
|
427
|
+
// @ts-ignore
|
|
428
|
+
return !parentNode.data[isDisabled];
|
|
429
|
+
}
|
|
430
|
+
else if (typeof isDisabled === "boolean") {
|
|
431
|
+
return !isDisabled;
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
return true;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
hideCursor() {
|
|
438
|
+
this.dispatch(dnd.cursor({ type: "none" }));
|
|
439
|
+
}
|
|
440
|
+
showCursor(cursor) {
|
|
441
|
+
this.dispatch(dnd.cursor(cursor));
|
|
442
|
+
}
|
|
443
|
+
/* Visibility */
|
|
444
|
+
open(identity) {
|
|
445
|
+
const id = identifyNull(identity);
|
|
446
|
+
if (!id)
|
|
447
|
+
return;
|
|
448
|
+
if (this.isOpen(id))
|
|
449
|
+
return;
|
|
450
|
+
this.dispatch(visibility.open(id, this.isFiltered));
|
|
451
|
+
safeRun(this.props.onToggle, id);
|
|
452
|
+
}
|
|
453
|
+
close(identity) {
|
|
454
|
+
const id = identifyNull(identity);
|
|
455
|
+
if (!id)
|
|
456
|
+
return;
|
|
457
|
+
if (!this.isOpen(id))
|
|
458
|
+
return;
|
|
459
|
+
this.dispatch(visibility.close(id, this.isFiltered));
|
|
460
|
+
safeRun(this.props.onToggle, id);
|
|
461
|
+
}
|
|
462
|
+
toggle(identity) {
|
|
463
|
+
const id = identifyNull(identity);
|
|
464
|
+
if (!id)
|
|
465
|
+
return;
|
|
466
|
+
return this.isOpen(id) ? this.close(id) : this.open(id);
|
|
467
|
+
}
|
|
468
|
+
openParents(identity) {
|
|
469
|
+
const id = identifyNull(identity);
|
|
470
|
+
if (!id)
|
|
471
|
+
return;
|
|
472
|
+
const node = utils.dfs(this.root, id);
|
|
473
|
+
let parent = node === null || node === void 0 ? void 0 : node.parent;
|
|
474
|
+
while (parent) {
|
|
475
|
+
this.open(parent.id);
|
|
476
|
+
parent = parent.parent;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
openSiblings(node) {
|
|
480
|
+
const parent = node.parent;
|
|
481
|
+
if (!parent) {
|
|
482
|
+
this.toggle(node.id);
|
|
483
|
+
}
|
|
484
|
+
else if (parent.children) {
|
|
485
|
+
const isOpen = node.isOpen;
|
|
486
|
+
for (let sibling of parent.children) {
|
|
487
|
+
if (sibling.isInternal) {
|
|
488
|
+
isOpen ? this.close(sibling.id) : this.open(sibling.id);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
this.scrollTo(this.focusedNode);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
openAll() {
|
|
495
|
+
utils.walk(this.root, (node) => {
|
|
496
|
+
if (node.isInternal)
|
|
497
|
+
node.open();
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
closeAll() {
|
|
501
|
+
utils.walk(this.root, (node) => {
|
|
502
|
+
if (node.isInternal)
|
|
503
|
+
node.close();
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
/* Scrolling */
|
|
507
|
+
scrollTo(identity, align = "smart") {
|
|
508
|
+
if (!identity)
|
|
509
|
+
return;
|
|
510
|
+
const id = identify(identity);
|
|
511
|
+
this.openParents(id);
|
|
512
|
+
return utils
|
|
513
|
+
.waitFor(() => id in this.idToIndex)
|
|
514
|
+
.then(() => {
|
|
515
|
+
var _a;
|
|
516
|
+
const index = this.idToIndex[id];
|
|
517
|
+
if (index === undefined)
|
|
518
|
+
return;
|
|
519
|
+
(_a = this.list.current) === null || _a === void 0 ? void 0 : _a.scrollToItem(index, align);
|
|
520
|
+
})
|
|
521
|
+
.catch(() => {
|
|
522
|
+
// Id: ${id} never appeared in the list.
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
/* State Checks */
|
|
526
|
+
get isEditing() {
|
|
527
|
+
return this.state.nodes.edit.id !== null;
|
|
528
|
+
}
|
|
529
|
+
get isFiltered() {
|
|
530
|
+
var _a;
|
|
531
|
+
return !!((_a = this.props.searchTerm) === null || _a === void 0 ? void 0 : _a.trim());
|
|
532
|
+
}
|
|
533
|
+
get hasFocus() {
|
|
534
|
+
return this.state.nodes.focus.treeFocused;
|
|
535
|
+
}
|
|
536
|
+
get hasNoSelection() {
|
|
537
|
+
return this.state.nodes.selection.ids.size === 0;
|
|
538
|
+
}
|
|
539
|
+
get hasOneSelection() {
|
|
540
|
+
return this.state.nodes.selection.ids.size === 1;
|
|
541
|
+
}
|
|
542
|
+
get hasMultipleSelections() {
|
|
543
|
+
return this.state.nodes.selection.ids.size > 1;
|
|
544
|
+
}
|
|
545
|
+
isSelected(id) {
|
|
546
|
+
if (!id)
|
|
547
|
+
return false;
|
|
548
|
+
return this.state.nodes.selection.ids.has(id);
|
|
549
|
+
}
|
|
550
|
+
isOpen(id) {
|
|
551
|
+
var _a, _b, _c;
|
|
552
|
+
if (!id)
|
|
553
|
+
return false;
|
|
554
|
+
if (id === ROOT_ID)
|
|
555
|
+
return true;
|
|
556
|
+
const def = (_a = this.props.openByDefault) !== null && _a !== void 0 ? _a : true;
|
|
557
|
+
if (this.isFiltered) {
|
|
558
|
+
return (_b = this.state.nodes.open.filtered[id]) !== null && _b !== void 0 ? _b : true; // Filtered folders are always opened by default
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
return (_c = this.state.nodes.open.unfiltered[id]) !== null && _c !== void 0 ? _c : def;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
isEditable(data) {
|
|
565
|
+
var _a;
|
|
566
|
+
const check = this.props.disableEdit || (() => false);
|
|
567
|
+
return (_a = !utils.access(data, check)) !== null && _a !== void 0 ? _a : true;
|
|
568
|
+
}
|
|
569
|
+
isDraggable(data) {
|
|
570
|
+
var _a;
|
|
571
|
+
const check = this.props.disableDrag || (() => false);
|
|
572
|
+
return (_a = !utils.access(data, check)) !== null && _a !== void 0 ? _a : true;
|
|
573
|
+
}
|
|
574
|
+
isDragging(node) {
|
|
575
|
+
const id = identifyNull(node);
|
|
576
|
+
if (!id)
|
|
577
|
+
return false;
|
|
578
|
+
return this.state.nodes.drag.id === id;
|
|
579
|
+
}
|
|
580
|
+
isFocused(id) {
|
|
581
|
+
return this.hasFocus && this.state.nodes.focus.id === id;
|
|
582
|
+
}
|
|
583
|
+
isMatch(node) {
|
|
584
|
+
return this.matchFn(node);
|
|
585
|
+
}
|
|
586
|
+
willReceiveDrop(node) {
|
|
587
|
+
const id = identifyNull(node);
|
|
588
|
+
if (!id)
|
|
589
|
+
return false;
|
|
590
|
+
const { destinationParentId, destinationIndex } = this.state.nodes.drag;
|
|
591
|
+
return id === destinationParentId && destinationIndex === null;
|
|
592
|
+
}
|
|
593
|
+
/* Tree Event Handlers */
|
|
594
|
+
onFocus() {
|
|
595
|
+
const node = this.focusedNode || this.firstNode;
|
|
596
|
+
if (node)
|
|
597
|
+
this.dispatch(focus(node.id));
|
|
598
|
+
}
|
|
599
|
+
onBlur() {
|
|
600
|
+
this.dispatch(treeBlur());
|
|
601
|
+
}
|
|
602
|
+
onItemsRendered(args) {
|
|
603
|
+
this.visibleStartIndex = args.visibleStartIndex;
|
|
604
|
+
this.visibleStopIndex = args.visibleStopIndex;
|
|
605
|
+
}
|
|
606
|
+
/* Get Renderers */
|
|
607
|
+
get renderContainer() {
|
|
608
|
+
return this.props.renderContainer || DefaultContainer;
|
|
609
|
+
}
|
|
610
|
+
get renderRow() {
|
|
611
|
+
return this.props.renderRow || DefaultRow;
|
|
612
|
+
}
|
|
613
|
+
get renderNode() {
|
|
614
|
+
return this.props.children || DefaultNode;
|
|
615
|
+
}
|
|
616
|
+
get renderDragPreview() {
|
|
617
|
+
return this.props.renderDragPreview || DefaultDragPreview;
|
|
618
|
+
}
|
|
619
|
+
get renderCursor() {
|
|
620
|
+
return this.props.renderCursor || DefaultCursor;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createStore } from "redux";
|
|
2
|
+
import { rootReducer } from "../state/root-reducer";
|
|
3
|
+
import { TreeApi } from "./tree-api";
|
|
4
|
+
function setupApi(props) {
|
|
5
|
+
const store = createStore(rootReducer);
|
|
6
|
+
return new TreeApi(store, props, { current: null }, { current: null });
|
|
7
|
+
}
|
|
8
|
+
test("tree.canDrop()", () => {
|
|
9
|
+
expect(setupApi({ disableDrop: true }).canDrop()).toBe(false);
|
|
10
|
+
expect(setupApi({ disableDrop: () => false }).canDrop()).toBe(true);
|
|
11
|
+
expect(setupApi({ disableDrop: false }).canDrop()).toBe(true);
|
|
12
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Cursor } from "../dnd/compute-drop";
|
|
2
|
+
import { ActionTypes } from "../types/utils";
|
|
3
|
+
export type DndState = {
|
|
4
|
+
dragId: null | string;
|
|
5
|
+
cursor: Cursor;
|
|
6
|
+
dragIds: string[];
|
|
7
|
+
parentId: null | string;
|
|
8
|
+
index: number | null;
|
|
9
|
+
};
|
|
10
|
+
export declare const actions: {
|
|
11
|
+
cursor(cursor: Cursor): {
|
|
12
|
+
type: "DND_CURSOR";
|
|
13
|
+
cursor: Cursor;
|
|
14
|
+
};
|
|
15
|
+
dragStart(id: string, dragIds: string[]): {
|
|
16
|
+
type: "DND_DRAG_START";
|
|
17
|
+
id: string;
|
|
18
|
+
dragIds: string[];
|
|
19
|
+
};
|
|
20
|
+
dragEnd(): {
|
|
21
|
+
type: "DND_DRAG_END";
|
|
22
|
+
};
|
|
23
|
+
hovering(parentId: string | null, index: number | null): {
|
|
24
|
+
type: "DND_HOVERING";
|
|
25
|
+
parentId: string | null;
|
|
26
|
+
index: number | null;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare function reducer(state: DndState | undefined, action: ActionTypes<typeof actions>): DndState;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { initialState } from "./initial";
|
|
2
|
+
/* Actions */
|
|
3
|
+
export const actions = {
|
|
4
|
+
cursor(cursor) {
|
|
5
|
+
return { type: "DND_CURSOR", cursor };
|
|
6
|
+
},
|
|
7
|
+
dragStart(id, dragIds) {
|
|
8
|
+
return { type: "DND_DRAG_START", id, dragIds };
|
|
9
|
+
},
|
|
10
|
+
dragEnd() {
|
|
11
|
+
return { type: "DND_DRAG_END" };
|
|
12
|
+
},
|
|
13
|
+
hovering(parentId, index) {
|
|
14
|
+
return { type: "DND_HOVERING", parentId, index };
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
/* Reducer */
|
|
18
|
+
export function reducer(state = initialState()["dnd"], action) {
|
|
19
|
+
switch (action.type) {
|
|
20
|
+
case "DND_CURSOR":
|
|
21
|
+
return Object.assign(Object.assign({}, state), { cursor: action.cursor });
|
|
22
|
+
case "DND_DRAG_START":
|
|
23
|
+
return Object.assign(Object.assign({}, state), { dragId: action.id, dragIds: action.dragIds });
|
|
24
|
+
case "DND_DRAG_END":
|
|
25
|
+
return initialState()["dnd"];
|
|
26
|
+
case "DND_HOVERING":
|
|
27
|
+
return Object.assign(Object.assign({}, state), { parentId: action.parentId, index: action.index });
|
|
28
|
+
default:
|
|
29
|
+
return state;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionTypes } from "../types/utils";
|
|
2
|
+
import { actions as dnd } from "./dnd-slice";
|
|
3
|
+
export type DragSlice = {
|
|
4
|
+
id: string | null;
|
|
5
|
+
selectedIds: string[];
|
|
6
|
+
destinationParentId: string | null;
|
|
7
|
+
destinationIndex: number | null;
|
|
8
|
+
};
|
|
9
|
+
export declare function reducer(state: DragSlice | undefined, action: ActionTypes<typeof dnd>): DragSlice;
|