@react-stately/data 3.4.5-nightly.3111 → 3.4.5
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.js +56 -46
- package/dist/main.js.map +1 -1
- package/dist/module.js +54 -44
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var $
|
|
1
|
+
var $cSxzT$react = require("react");
|
|
2
2
|
|
|
3
3
|
function $parcel$export(e, n, v, s) {
|
|
4
4
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -20,21 +20,21 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
20
20
|
return dest;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
$parcel$export(module.exports, "useListData", () => $
|
|
24
|
-
var $
|
|
23
|
+
$parcel$export(module.exports, "useListData", () => $24caf63ea8aabd78$export$762f73dccccd255d);
|
|
24
|
+
var $b15c078d9ba52a1f$exports = {};
|
|
25
25
|
|
|
26
|
-
$parcel$export($
|
|
26
|
+
$parcel$export($b15c078d9ba52a1f$exports, "useAsyncList", () => $b15c078d9ba52a1f$export$bc3384a35de93d66);
|
|
27
27
|
|
|
28
|
-
function $
|
|
28
|
+
function $24caf63ea8aabd78$export$762f73dccccd255d(options) {
|
|
29
29
|
let { initialItems: initialItems = [] , initialSelectedKeys: initialSelectedKeys , getKey: getKey = (item)=>item.id || item.key
|
|
30
30
|
, filter: filter , initialFilterText: initialFilterText = '' } = options;
|
|
31
31
|
// Store both items and filteredItems in state so we can go back to the unfiltered list
|
|
32
|
-
let [state, setState] = $
|
|
32
|
+
let [state, setState] = $cSxzT$react.useState({
|
|
33
33
|
items: initialItems,
|
|
34
34
|
selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys || []),
|
|
35
35
|
filterText: initialFilterText
|
|
36
36
|
});
|
|
37
|
-
let filteredItems = $
|
|
37
|
+
let filteredItems = $cSxzT$react.useMemo(()=>filter ? state.items.filter((item)=>filter(item, state.filterText)
|
|
38
38
|
) : state.items
|
|
39
39
|
, [
|
|
40
40
|
state.items,
|
|
@@ -44,7 +44,7 @@ function $7b9b9de8e1e3511c$export$762f73dccccd255d(options) {
|
|
|
44
44
|
return {
|
|
45
45
|
...state,
|
|
46
46
|
items: filteredItems,
|
|
47
|
-
...$
|
|
47
|
+
...$24caf63ea8aabd78$export$79c0c687a5963b0a({
|
|
48
48
|
getKey: getKey
|
|
49
49
|
}, setState),
|
|
50
50
|
getItem (key) {
|
|
@@ -53,7 +53,7 @@ function $7b9b9de8e1e3511c$export$762f73dccccd255d(options) {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function $
|
|
56
|
+
function $24caf63ea8aabd78$export$79c0c687a5963b0a(opts, dispatch) {
|
|
57
57
|
let { cursor: cursor , getKey: getKey } = opts;
|
|
58
58
|
return {
|
|
59
59
|
setSelectedKeys (selectedKeys) {
|
|
@@ -71,7 +71,7 @@ function $7b9b9de8e1e3511c$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
71
71
|
);
|
|
72
72
|
},
|
|
73
73
|
insert (index, ...values) {
|
|
74
|
-
dispatch((state)=>$
|
|
74
|
+
dispatch((state)=>$24caf63ea8aabd78$var$insert(state, index, ...values)
|
|
75
75
|
);
|
|
76
76
|
},
|
|
77
77
|
insertBefore (key, ...values) {
|
|
@@ -79,7 +79,7 @@ function $7b9b9de8e1e3511c$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
79
79
|
let index = state.items.findIndex((item)=>getKey(item) === key
|
|
80
80
|
);
|
|
81
81
|
if (index === -1) return;
|
|
82
|
-
return $
|
|
82
|
+
return $24caf63ea8aabd78$var$insert(state, index, ...values);
|
|
83
83
|
});
|
|
84
84
|
},
|
|
85
85
|
insertAfter (key, ...values) {
|
|
@@ -87,15 +87,15 @@ function $7b9b9de8e1e3511c$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
87
87
|
let index = state.items.findIndex((item)=>getKey(item) === key
|
|
88
88
|
);
|
|
89
89
|
if (index === -1) return;
|
|
90
|
-
return $
|
|
90
|
+
return $24caf63ea8aabd78$var$insert(state, index + 1, ...values);
|
|
91
91
|
});
|
|
92
92
|
},
|
|
93
93
|
prepend (...values) {
|
|
94
|
-
dispatch((state)=>$
|
|
94
|
+
dispatch((state)=>$24caf63ea8aabd78$var$insert(state, 0, ...values)
|
|
95
95
|
);
|
|
96
96
|
},
|
|
97
97
|
append (...values) {
|
|
98
|
-
dispatch((state)=>$
|
|
98
|
+
dispatch((state)=>$24caf63ea8aabd78$var$insert(state, state.items.length, ...values)
|
|
99
99
|
);
|
|
100
100
|
},
|
|
101
101
|
remove (...keys) {
|
|
@@ -156,7 +156,7 @@ function $7b9b9de8e1e3511c$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
156
156
|
let indices = keys.map((key)=>state.items.findIndex((item)=>getKey(item) === key
|
|
157
157
|
)
|
|
158
158
|
).sort();
|
|
159
|
-
return $
|
|
159
|
+
return $24caf63ea8aabd78$var$move(state, indices, toIndex);
|
|
160
160
|
});
|
|
161
161
|
},
|
|
162
162
|
moveAfter (key2, keys) {
|
|
@@ -167,7 +167,7 @@ function $7b9b9de8e1e3511c$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
167
167
|
let indices = keys.map((key)=>state.items.findIndex((item)=>getKey(item) === key
|
|
168
168
|
)
|
|
169
169
|
).sort();
|
|
170
|
-
return $
|
|
170
|
+
return $24caf63ea8aabd78$var$move(state, indices, toIndex + 1);
|
|
171
171
|
});
|
|
172
172
|
},
|
|
173
173
|
update (key, newValue) {
|
|
@@ -187,7 +187,7 @@ function $7b9b9de8e1e3511c$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
-
function $
|
|
190
|
+
function $24caf63ea8aabd78$var$insert(state, index, ...values) {
|
|
191
191
|
return {
|
|
192
192
|
...state,
|
|
193
193
|
items: [
|
|
@@ -197,7 +197,7 @@ function $7b9b9de8e1e3511c$var$insert(state, index, ...values) {
|
|
|
197
197
|
]
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
|
-
function $
|
|
200
|
+
function $24caf63ea8aabd78$var$move(state, indices, toIndex) {
|
|
201
201
|
// Shift the target down by the number of items being moved from before the target
|
|
202
202
|
for (let index of indices)if (index < toIndex) toIndex--;
|
|
203
203
|
let moves = indices.map((from)=>({
|
|
@@ -235,7 +235,7 @@ function $7b9b9de8e1e3511c$var$move(state, indices, toIndex) {
|
|
|
235
235
|
|
|
236
236
|
|
|
237
237
|
|
|
238
|
-
function $
|
|
238
|
+
function $b15c078d9ba52a1f$var$reducer(data, action) {
|
|
239
239
|
let selectedKeys;
|
|
240
240
|
switch(data.state){
|
|
241
241
|
case 'idle':
|
|
@@ -245,13 +245,14 @@ function $2f5ec021128f0372$var$reducer(data, action) {
|
|
|
245
245
|
case 'loadingMore':
|
|
246
246
|
case 'sorting':
|
|
247
247
|
case 'filtering':
|
|
248
|
+
var _filterText, _sortDescriptor;
|
|
248
249
|
return {
|
|
249
250
|
...data,
|
|
250
|
-
filterText: action.filterText
|
|
251
|
+
filterText: (_filterText = action.filterText) !== null && _filterText !== void 0 ? _filterText : data.filterText,
|
|
251
252
|
state: action.type,
|
|
252
253
|
// Reset items to an empty list if loading, but not when sorting.
|
|
253
254
|
items: action.type === 'loading' ? [] : data.items,
|
|
254
|
-
sortDescriptor: action.sortDescriptor
|
|
255
|
+
sortDescriptor: (_sortDescriptor = action.sortDescriptor) !== null && _sortDescriptor !== void 0 ? _sortDescriptor : data.sortDescriptor,
|
|
255
256
|
abortController: action.abortController
|
|
256
257
|
};
|
|
257
258
|
case 'update':
|
|
@@ -274,16 +275,18 @@ function $2f5ec021128f0372$var$reducer(data, action) {
|
|
|
274
275
|
// This means that multiple requests were going at once.
|
|
275
276
|
// We want to take only the latest result.
|
|
276
277
|
if (action.abortController !== data.abortController) return data;
|
|
277
|
-
|
|
278
|
+
var _selectedKeys;
|
|
279
|
+
selectedKeys = (_selectedKeys = action.selectedKeys) !== null && _selectedKeys !== void 0 ? _selectedKeys : data.selectedKeys;
|
|
280
|
+
var _filterText1, _sortDescriptor1;
|
|
278
281
|
return {
|
|
279
282
|
...data,
|
|
280
|
-
filterText: action.filterText
|
|
283
|
+
filterText: (_filterText1 = action.filterText) !== null && _filterText1 !== void 0 ? _filterText1 : data.filterText,
|
|
281
284
|
state: 'idle',
|
|
282
285
|
items: [
|
|
283
286
|
...action.items
|
|
284
287
|
],
|
|
285
288
|
selectedKeys: selectedKeys === 'all' ? 'all' : new Set(selectedKeys),
|
|
286
|
-
sortDescriptor: action.sortDescriptor
|
|
289
|
+
sortDescriptor: (_sortDescriptor1 = action.sortDescriptor) !== null && _sortDescriptor1 !== void 0 ? _sortDescriptor1 : data.sortDescriptor,
|
|
287
290
|
abortController: null,
|
|
288
291
|
cursor: action.cursor
|
|
289
292
|
};
|
|
@@ -302,9 +305,10 @@ function $2f5ec021128f0372$var$reducer(data, action) {
|
|
|
302
305
|
// We're already loading, and another load was triggered at the same time.
|
|
303
306
|
// We need to abort the previous load and start a new one.
|
|
304
307
|
data.abortController.abort();
|
|
308
|
+
var _filterText2;
|
|
305
309
|
return {
|
|
306
310
|
...data,
|
|
307
|
-
filterText: action.filterText
|
|
311
|
+
filterText: (_filterText2 = action.filterText) !== null && _filterText2 !== void 0 ? _filterText2 : data.filterText,
|
|
308
312
|
state: action.type,
|
|
309
313
|
// Reset items to an empty list if loading, but not when sorting.
|
|
310
314
|
items: action.type === 'loading' ? [] : data.items,
|
|
@@ -323,10 +327,12 @@ function $2f5ec021128f0372$var$reducer(data, action) {
|
|
|
323
327
|
case 'loadingMore':
|
|
324
328
|
switch(action.type){
|
|
325
329
|
case 'success':
|
|
330
|
+
var _selectedKeys1;
|
|
326
331
|
selectedKeys = data.selectedKeys === 'all' || action.selectedKeys === 'all' ? 'all' : new Set([
|
|
327
332
|
...data.selectedKeys,
|
|
328
|
-
...action.selectedKeys
|
|
333
|
+
...(_selectedKeys1 = action.selectedKeys) !== null && _selectedKeys1 !== void 0 ? _selectedKeys1 : []
|
|
329
334
|
]);
|
|
335
|
+
var _sortDescriptor2;
|
|
330
336
|
// Append the new items
|
|
331
337
|
return {
|
|
332
338
|
...data,
|
|
@@ -336,7 +342,7 @@ function $2f5ec021128f0372$var$reducer(data, action) {
|
|
|
336
342
|
...action.items
|
|
337
343
|
],
|
|
338
344
|
selectedKeys: selectedKeys,
|
|
339
|
-
sortDescriptor: action.sortDescriptor
|
|
345
|
+
sortDescriptor: (_sortDescriptor2 = action.sortDescriptor) !== null && _sortDescriptor2 !== void 0 ? _sortDescriptor2 : data.sortDescriptor,
|
|
340
346
|
abortController: null,
|
|
341
347
|
cursor: action.cursor
|
|
342
348
|
};
|
|
@@ -353,9 +359,10 @@ function $2f5ec021128f0372$var$reducer(data, action) {
|
|
|
353
359
|
// We're already loading more, and another load was triggered at the same time.
|
|
354
360
|
// We need to abort the previous load more and start a new one.
|
|
355
361
|
data.abortController.abort();
|
|
362
|
+
var _filterText3;
|
|
356
363
|
return {
|
|
357
364
|
...data,
|
|
358
|
-
filterText: action.filterText
|
|
365
|
+
filterText: (_filterText3 = action.filterText) !== null && _filterText3 !== void 0 ? _filterText3 : data.filterText,
|
|
359
366
|
state: action.type,
|
|
360
367
|
// Reset items to an empty list if loading, but not when sorting.
|
|
361
368
|
items: action.type === 'loading' ? [] : data.items,
|
|
@@ -381,10 +388,10 @@ function $2f5ec021128f0372$var$reducer(data, action) {
|
|
|
381
388
|
throw new Error(`Invalid state "${data.state}"`);
|
|
382
389
|
}
|
|
383
390
|
}
|
|
384
|
-
function $
|
|
391
|
+
function $b15c078d9ba52a1f$export$bc3384a35de93d66(options) {
|
|
385
392
|
const { load: load , sort: sort , initialSelectedKeys: initialSelectedKeys , initialSortDescriptor: initialSortDescriptor , getKey: getKey = (item)=>item.id || item.key
|
|
386
393
|
, initialFilterText: initialFilterText = '' } = options;
|
|
387
|
-
let [data, dispatch] = $
|
|
394
|
+
let [data, dispatch] = $cSxzT$react.useReducer($b15c078d9ba52a1f$var$reducer, {
|
|
388
395
|
state: 'idle',
|
|
389
396
|
error: null,
|
|
390
397
|
items: [],
|
|
@@ -399,16 +406,19 @@ function $2f5ec021128f0372$export$bc3384a35de93d66(options) {
|
|
|
399
406
|
...action,
|
|
400
407
|
abortController: abortController
|
|
401
408
|
});
|
|
402
|
-
|
|
409
|
+
var _filterText;
|
|
410
|
+
let previousFilterText = (_filterText = action.filterText) !== null && _filterText !== void 0 ? _filterText : data.filterText;
|
|
411
|
+
var _sortDescriptor;
|
|
403
412
|
let response = await fn({
|
|
404
413
|
items: data.items.slice(),
|
|
405
414
|
selectedKeys: data.selectedKeys,
|
|
406
|
-
sortDescriptor: action.sortDescriptor
|
|
415
|
+
sortDescriptor: (_sortDescriptor = action.sortDescriptor) !== null && _sortDescriptor !== void 0 ? _sortDescriptor : data.sortDescriptor,
|
|
407
416
|
signal: abortController.signal,
|
|
408
417
|
cursor: action.type === 'loadingMore' ? data.cursor : null,
|
|
409
418
|
filterText: previousFilterText
|
|
410
419
|
});
|
|
411
|
-
|
|
420
|
+
var _filterText4;
|
|
421
|
+
let filterText = (_filterText4 = response.filterText) !== null && _filterText4 !== void 0 ? _filterText4 : previousFilterText;
|
|
412
422
|
dispatch({
|
|
413
423
|
type: 'success',
|
|
414
424
|
...response,
|
|
@@ -428,7 +438,7 @@ function $2f5ec021128f0372$export$bc3384a35de93d66(options) {
|
|
|
428
438
|
});
|
|
429
439
|
}
|
|
430
440
|
};
|
|
431
|
-
$
|
|
441
|
+
$cSxzT$react.useEffect(()=>{
|
|
432
442
|
dispatchFetch({
|
|
433
443
|
type: 'loading'
|
|
434
444
|
}, load);
|
|
@@ -464,7 +474,7 @@ function $2f5ec021128f0372$export$bc3384a35de93d66(options) {
|
|
|
464
474
|
sortDescriptor: sortDescriptor
|
|
465
475
|
}, sort || load);
|
|
466
476
|
},
|
|
467
|
-
...$
|
|
477
|
+
...$24caf63ea8aabd78$export$79c0c687a5963b0a({
|
|
468
478
|
...options,
|
|
469
479
|
getKey: getKey,
|
|
470
480
|
cursor: data.cursor
|
|
@@ -484,22 +494,22 @@ function $2f5ec021128f0372$export$bc3384a35de93d66(options) {
|
|
|
484
494
|
}
|
|
485
495
|
|
|
486
496
|
|
|
487
|
-
var $
|
|
497
|
+
var $13e231d04fe8128a$exports = {};
|
|
488
498
|
|
|
489
|
-
$parcel$export($
|
|
499
|
+
$parcel$export($13e231d04fe8128a$exports, "useTreeData", () => $13e231d04fe8128a$export$d14e1352e21f4a16);
|
|
490
500
|
|
|
491
|
-
function $
|
|
501
|
+
function $13e231d04fe8128a$export$d14e1352e21f4a16(options) {
|
|
492
502
|
let { initialItems: initialItems1 = [] , initialSelectedKeys: initialSelectedKeys , getKey: getKey = (item)=>item.id || item.key
|
|
493
503
|
, getChildren: getChildren = (item)=>item.children
|
|
494
504
|
} = options;
|
|
495
|
-
let map = $
|
|
505
|
+
let map = $cSxzT$react.useMemo(()=>new Map()
|
|
496
506
|
, []);
|
|
497
507
|
// We only want to compute this on initial render.
|
|
498
508
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
499
|
-
let initialNodes = $
|
|
509
|
+
let initialNodes = $cSxzT$react.useMemo(()=>buildTree(initialItems1)
|
|
500
510
|
, []);
|
|
501
|
-
let [items1, setItems] = $
|
|
502
|
-
let [selectedKeys, setSelectedKeys] = $
|
|
511
|
+
let [items1, setItems] = $cSxzT$react.useState(initialNodes);
|
|
512
|
+
let [selectedKeys, setSelectedKeys] = $cSxzT$react.useState(new Set(initialSelectedKeys || []));
|
|
503
513
|
function buildTree(initialItems = [], parentKey) {
|
|
504
514
|
return initialItems.map((item)=>{
|
|
505
515
|
let node = {
|
|
@@ -591,7 +601,7 @@ function $f247fda98e0c40be$export$d14e1352e21f4a16(options) {
|
|
|
591
601
|
let parentNode = map.get(node.parentKey);
|
|
592
602
|
let nodes = parentNode ? parentNode.children : items1;
|
|
593
603
|
let index = nodes.indexOf(node);
|
|
594
|
-
this.insert(parentNode
|
|
604
|
+
this.insert(parentNode === null || parentNode === void 0 ? void 0 : parentNode.key, index, ...values);
|
|
595
605
|
},
|
|
596
606
|
insertAfter (key, ...values) {
|
|
597
607
|
let node = map.get(key);
|
|
@@ -599,7 +609,7 @@ function $f247fda98e0c40be$export$d14e1352e21f4a16(options) {
|
|
|
599
609
|
let parentNode = map.get(node.parentKey);
|
|
600
610
|
let nodes = parentNode ? parentNode.children : items1;
|
|
601
611
|
let index = nodes.indexOf(node);
|
|
602
|
-
this.insert(parentNode
|
|
612
|
+
this.insert(parentNode === null || parentNode === void 0 ? void 0 : parentNode.key, index + 1, ...values);
|
|
603
613
|
},
|
|
604
614
|
prepend (parentKey, ...values) {
|
|
605
615
|
this.insert(parentKey, 0, ...values);
|
|
@@ -665,8 +675,8 @@ function $f247fda98e0c40be$export$d14e1352e21f4a16(options) {
|
|
|
665
675
|
|
|
666
676
|
|
|
667
677
|
|
|
668
|
-
$parcel$exportWildcard(module.exports, $
|
|
669
|
-
$parcel$exportWildcard(module.exports, $
|
|
678
|
+
$parcel$exportWildcard(module.exports, $b15c078d9ba52a1f$exports);
|
|
679
|
+
$parcel$exportWildcard(module.exports, $13e231d04fe8128a$exports);
|
|
670
680
|
|
|
671
681
|
|
|
672
682
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;SE0IgB,yCAAW,CAAI,OAAuB,EAAe,CAAC;IACpE,GAAG,CAAC,CAAC,eACH,YAAY,GAAG,CAAC,CAAC,wBACjB,mBAAmB,WACnB,MAAM,IAAI,IAAS,GAAK,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG;eAC3C,MAAM,sBACN,iBAAiB,GAAG,CAAE,GACxB,CAAC,GAAG,OAA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W,EAAE,QAAW,EAAE,CAAC;YAChC,QAAQ,EAAC,KAAK,GAAI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAE,OAAO,GAAI,CAAC;oBACtD,GAAG,CAAC,IAAI,GAAgB,CAAC;wBACvB,GAAG,EAAE,OAAO,CAAC,GAAG;wBAChB,SAAS,EAAE,OAAO,CAAC,SAAS;wBAC5B,KAAK,EAAE,QAAQ;wBACf,QAAQ,EAAE,IAAI;oBAChB,CAAC;oBAED,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG;oBACzD,MAAM,CAAC,IAAI;gBACb,CAAC;;QACH,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-stately/data/src/index.ts","packages/@react-stately/data/src/useAsyncList.ts","packages/@react-stately/data/src/useListData.ts","packages/@react-stately/data/src/useTreeData.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useAsyncList';\nexport * from './useTreeData';\nexport {useListData} from './useListData';\nexport type {ListData} from './useListData';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {createListActions, ListData, ListState} from './useListData';\nimport {Key, Reducer, useEffect, useReducer} from 'react';\nimport {LoadingState, Selection, SortDescriptor} from '@react-types/shared';\n\nexport interface AsyncListOptions<T, C> {\n /** The keys for the initially selected items. */\n initialSelectedKeys?: Iterable<Key>,\n /** The initial sort descriptor. */\n initialSortDescriptor?: SortDescriptor,\n /** The initial filter text. */\n initialFilterText?: string,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that loads the data for the items in the list. */\n load: AsyncListLoadFunction<T, C>,\n /**\n * An optional function that performs sorting. If not provided,\n * then `sortDescriptor` is passed to the `load` function.\n */\n sort?: AsyncListLoadFunction<T, C>\n}\n\ntype AsyncListLoadFunction<T, C> = (state: AsyncListLoadOptions<T, C>) => AsyncListStateUpdate<T, C> | Promise<AsyncListStateUpdate<T, C>>;\n\ninterface AsyncListLoadOptions<T, C> {\n /** The items currently in the list. */\n items: T[],\n /** The keys of the currently selected items in the list. */\n selectedKeys: Selection,\n /** The current sort descriptor for the list. */\n sortDescriptor: SortDescriptor,\n /** An abort signal used to notify the load function that the request has been aborted. */\n signal: AbortSignal,\n /** The pagination cursor returned from the last page load. */\n cursor?: C,\n /** The current filter text used to perform server side filtering. */\n filterText?: string,\n /** The current loading state of the list. */\n loadingState?: LoadingState\n}\n\ninterface AsyncListStateUpdate<T, C> {\n /** The new items to append to the list. */\n items: Iterable<T>,\n /** The keys to add to the selection. */\n selectedKeys?: Iterable<Key>,\n /** The sort descriptor to set. */\n sortDescriptor?: SortDescriptor,\n /** The pagination cursor to be used for the next page load. */\n cursor?: C,\n /** The updated filter text for the list. */\n filterText?: string\n}\n\ninterface AsyncListState<T, C> extends ListState<T> {\n state: LoadingState,\n items: T[],\n // disabledKeys?: Iterable<Key>,\n selectedKeys: Selection,\n // selectedKey?: Key,\n // expandedKeys?: Iterable<Key>,\n sortDescriptor?: SortDescriptor,\n error?: Error,\n abortController?: AbortController,\n cursor?: C\n}\n\ntype ActionType = 'success' | 'error' | 'loading' | 'loadingMore' | 'sorting' | 'update' | 'filtering';\ninterface Action<T, C> {\n type: ActionType,\n items?: Iterable<T>,\n selectedKeys?: Iterable<Key>,\n sortDescriptor?: SortDescriptor,\n error?: Error,\n abortController?: AbortController,\n updater?: (state: ListState<T>) => ListState<T>,\n cursor?: C,\n filterText?: string\n}\n\ninterface AsyncListData<T> extends ListData<T> {\n /** Whether data is currently being loaded. */\n isLoading: boolean,\n /** If loading data failed, then this contains the error that occurred. */\n error?: Error,\n // disabledKeys?: Set<Key>,\n // selectedKey?: Key,\n // expandedKeys?: Set<Key>,\n /** The current sort descriptor for the list. */\n sortDescriptor?: SortDescriptor,\n\n /** Reloads the data in the list. */\n reload(): void,\n /** Loads the next page of data in the list. */\n loadMore(): void,\n /** Triggers sorting for the list. */\n sort(descriptor: SortDescriptor): void,\n /** The current loading state for the list. */\n loadingState: LoadingState\n}\n\nfunction reducer<T, C>(data: AsyncListState<T, C>, action: Action<T, C>): AsyncListState<T, C> {\n let selectedKeys;\n switch (data.state) {\n case 'idle':\n case 'error':\n switch (action.type) {\n case 'loading':\n case 'loadingMore':\n case 'sorting':\n case 'filtering':\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: action.abortController\n };\n case 'update':\n return {\n ...data,\n ...action.updater(data)\n };\n case 'success':\n case 'error':\n return data;\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n case 'loading':\n case 'sorting':\n case 'filtering':\n switch (action.type) {\n case 'success':\n // Ignore if there is a newer abortcontroller in state.\n // This means that multiple requests were going at once.\n // We want to take only the latest result.\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n selectedKeys = action.selectedKeys ?? data.selectedKeys;\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: 'idle',\n items: [...action.items],\n selectedKeys: selectedKeys === 'all' ? 'all' : new Set(selectedKeys),\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: null,\n cursor: action.cursor\n };\n case 'error':\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n return {\n ...data,\n state: 'error',\n error: action.error,\n abortController: null\n };\n case 'loading':\n case 'loadingMore':\n case 'sorting':\n case 'filtering':\n // We're already loading, and another load was triggered at the same time.\n // We need to abort the previous load and start a new one.\n data.abortController.abort();\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n abortController: action.abortController\n };\n case 'update':\n // We're already loading, and an update happened at the same time (e.g. selectedKey changed).\n // Update data but don't abort previous load.\n return {\n ...data,\n ...action.updater(data)\n };\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n case 'loadingMore':\n switch (action.type) {\n case 'success':\n selectedKeys = (data.selectedKeys === 'all' || action.selectedKeys === 'all')\n ? 'all'\n : new Set([...data.selectedKeys, ...(action.selectedKeys ?? [])]);\n // Append the new items\n return {\n ...data,\n state: 'idle',\n items: [...data.items, ...action.items],\n selectedKeys,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: null,\n cursor: action.cursor\n };\n case 'error':\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n return {\n ...data,\n state: 'error',\n error: action.error\n };\n case 'loading':\n case 'sorting':\n case 'filtering':\n // We're already loading more, and another load was triggered at the same time.\n // We need to abort the previous load more and start a new one.\n data.abortController.abort();\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n abortController: action.abortController\n };\n case 'loadingMore':\n // If already loading more and another loading more is triggered, abort the new load more since\n // it is a duplicate request since the cursor hasn't been updated.\n // Do not overwrite the data.abortController\n action.abortController.abort();\n\n return data;\n case 'update':\n // We're already loading, and an update happened at the same time (e.g. selectedKey changed).\n // Update data but don't abort previous load.\n return {\n ...data,\n ...action.updater(data)\n };\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n default:\n throw new Error(`Invalid state \"${data.state}\"`);\n }\n}\n\n/**\n * Manages state for an immutable async loaded list data structure, and provides convenience methods to\n * update the data over time. Manages loading and error states, pagination, and sorting.\n */\nexport function useAsyncList<T, C = string>(options: AsyncListOptions<T, C>): AsyncListData<T> {\n const {\n load,\n sort,\n initialSelectedKeys,\n initialSortDescriptor,\n getKey = (item: any) => item.id || item.key,\n initialFilterText = ''\n } = options;\n\n let [data, dispatch] = useReducer<Reducer<AsyncListState<T, C>, Action<T, C>>>(reducer, {\n state: 'idle',\n error: null,\n items: [],\n selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys),\n sortDescriptor: initialSortDescriptor,\n filterText: initialFilterText\n });\n\n const dispatchFetch = async (action: Action<T, C>, fn: AsyncListLoadFunction<T, C>) => {\n let abortController = new AbortController();\n try {\n dispatch({...action, abortController});\n let previousFilterText = action.filterText ?? data.filterText;\n\n let response = await fn({\n items: data.items.slice(),\n selectedKeys: data.selectedKeys,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n signal: abortController.signal,\n cursor: action.type === 'loadingMore' ? data.cursor : null,\n filterText: previousFilterText\n });\n\n let filterText = response.filterText ?? previousFilterText;\n dispatch({type: 'success', ...response, abortController});\n\n // Fetch a new filtered list if filterText is updated via `load` response func rather than list.setFilterText\n // Only do this if not aborted (e.g. user triggers another filter action before load completes)\n if (filterText && (filterText !== previousFilterText) && !abortController.signal.aborted) {\n dispatchFetch({type: 'filtering', filterText}, load);\n }\n } catch (e) {\n dispatch({type: 'error', error: e, abortController});\n }\n };\n\n useEffect(() => {\n dispatchFetch({type: 'loading'}, load);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return {\n items: data.items,\n selectedKeys: data.selectedKeys,\n sortDescriptor: data.sortDescriptor,\n isLoading: data.state === 'loading' || data.state === 'loadingMore' || data.state === 'sorting' || data.state === 'filtering',\n loadingState: data.state,\n error: data.error,\n filterText: data.filterText,\n getItem(key: Key) {\n return data.items.find(item => getKey(item) === key);\n },\n reload() {\n dispatchFetch({type: 'loading'}, load);\n },\n loadMore() {\n // Ignore if already loading more or if performing server side filtering.\n if (data.state === 'loadingMore' || data.state === 'filtering' || data.cursor == null) {\n return;\n }\n\n dispatchFetch({type: 'loadingMore'}, load);\n },\n sort(sortDescriptor: SortDescriptor) {\n dispatchFetch({type: 'sorting', sortDescriptor}, sort || load);\n },\n ...createListActions({...options, getKey, cursor: data.cursor}, fn => {\n dispatch({type: 'update', updater: fn});\n }),\n setFilterText(filterText: string) {\n dispatchFetch({type: 'filtering', filterText}, load);\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, useMemo, useState} from 'react';\nimport {Selection} from '@react-types/shared';\n\ninterface ListOptions<T> {\n /** Initial items in the list. */\n initialItems?: T[],\n /** The keys for the initially selected items. */\n initialSelectedKeys?: 'all' | Iterable<Key>,\n /** The initial text to filter the list by. */\n initialFilterText?: string,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that returns whether a item matches the current filter text. */\n filter?: (item: T, filterText: string) => boolean\n}\n\nexport interface ListData<T> {\n /** The items in the list. */\n items: T[],\n\n /** The keys of the currently selected items in the list. */\n selectedKeys: Selection,\n\n /** Sets the selected keys. */\n setSelectedKeys(keys: Selection): void,\n\n /** The current filter text. */\n filterText: string,\n\n /** Sets the filter text. */\n setFilterText(filterText: string): void,\n\n /**\n * Gets an item from the list by key.\n * @param key - The key of the item to retrieve.\n */\n getItem(key: Key): T,\n\n /**\n * Inserts items into the list at the given index.\n * @param index - The index to insert into.\n * @param values - The values to insert.\n */\n insert(index: number, ...values: T[]): void,\n\n /**\n * Inserts items into the list before the item at the given key.\n * @param key - The key of the item to insert before.\n * @param values - The values to insert.\n */\n insertBefore(key: Key, ...values: T[]): void,\n\n /**\n * Inserts items into the list after the item at the given key.\n * @param key - The key of the item to insert after.\n * @param values - The values to insert.\n */\n insertAfter(key: Key, ...values: T[]): void,\n\n /**\n * Appends items to the list.\n * @param values - The values to insert.\n */\n append(...values: T[]): void,\n\n /**\n * Prepends items to the list.\n * @param value - The value to insert.\n */\n prepend(...values: T[]): void,\n\n /**\n * Removes items from the list by their keys.\n * @param keys - The keys of the item to remove.\n */\n remove(...keys: Key[]): void,\n\n /**\n * Removes all items from the list that are currently\n * in the set of selected items.\n */\n removeSelectedItems(): void,\n\n /**\n * Moves an item within the list.\n * @param key - The key of the item to move.\n * @param toIndex - The index to move the item to.\n */\n move(key: Key, toIndex: number): void,\n\n /**\n * Moves one or more items before a given key.\n * @param key - The key of the item to move the items before.\n * @param keys - The keys of the items to move.\n */\n moveBefore(key: Key, keys: Key[]): void,\n\n /**\n * Moves one or more items after a given key.\n * @param key - The key of the item to move the items after.\n * @param keys - The keys of the items to move.\n */\n moveAfter(key: Key, keys: Key[]): void,\n\n /**\n * Updates an item in the list.\n * @param key - The key of the item to update.\n * @param newValue - The new value for the item.\n */\n update(key: Key, newValue: T): void\n}\n\nexport interface ListState<T> {\n items: T[],\n selectedKeys: Selection,\n filterText: string\n}\n\ninterface CreateListOptions<T, C> extends ListOptions<T> {\n cursor?: C\n}\n\n/**\n * Manages state for an immutable list data structure, and provides convenience methods to\n * update the data over time.\n */\nexport function useListData<T>(options: ListOptions<T>): ListData<T> {\n let {\n initialItems = [],\n initialSelectedKeys,\n getKey = (item: any) => item.id || item.key,\n filter,\n initialFilterText = ''\n } = options;\n\n // Store both items and filteredItems in state so we can go back to the unfiltered list\n let [state, setState] = useState<ListState<T>>({\n items: initialItems,\n selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys || []),\n filterText: initialFilterText\n });\n\n let filteredItems = useMemo(\n () => filter ? state.items.filter(item => filter(item, state.filterText)) : state.items,\n [state.items, state.filterText, filter]);\n\n return {\n ...state,\n items: filteredItems,\n ...createListActions({getKey}, setState),\n getItem(key: Key) {\n return state.items.find(item => getKey(item) === key);\n }\n };\n}\n\nexport function createListActions<T, C>(opts: CreateListOptions<T, C>, dispatch: (updater: (state: ListState<T>) => ListState<T>) => void): Omit<ListData<T>, 'items' | 'selectedKeys' | 'getItem' | 'filterText'> {\n let {cursor, getKey} = opts;\n return {\n setSelectedKeys(selectedKeys: Selection) {\n dispatch(state => ({\n ...state,\n selectedKeys\n }));\n },\n setFilterText(filterText: string) {\n dispatch(state => ({\n ...state,\n filterText\n }));\n },\n insert(index: number, ...values: T[]) {\n dispatch(state => insert(state, index, ...values));\n },\n insertBefore(key: Key, ...values: T[]) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return;\n }\n\n return insert(state, index, ...values);\n });\n },\n insertAfter(key: Key, ...values: T[]) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return;\n }\n\n return insert(state, index + 1, ...values);\n });\n },\n prepend(...values: T[]) {\n dispatch(state => insert(state, 0, ...values));\n },\n append(...values: T[]) {\n dispatch(state => insert(state, state.items.length, ...values));\n },\n remove(...keys: Key[]) {\n dispatch(state => {\n let keySet = new Set(keys);\n let items = state.items.filter(item => !keySet.has(getKey(item)));\n\n let selection: Selection = 'all';\n if (state.selectedKeys !== 'all') {\n selection = new Set(state.selectedKeys);\n for (let key of keys) {\n selection.delete(key);\n }\n }\n if (cursor == null && items.length === 0) {\n selection = new Set();\n }\n\n return {\n ...state,\n items,\n selectedKeys: selection\n };\n });\n },\n removeSelectedItems() {\n dispatch(state => {\n if (state.selectedKeys === 'all') {\n return {\n ...state,\n items: [],\n selectedKeys: new Set()\n };\n }\n\n let selectedKeys = state.selectedKeys;\n let items = state.items.filter(item => !selectedKeys.has(getKey(item)));\n return {\n ...state,\n items,\n selectedKeys: new Set()\n };\n });\n },\n move(key: Key, toIndex: number) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return state;\n }\n\n let copy = state.items.slice();\n let [item] = copy.splice(index, 1);\n copy.splice(toIndex, 0, item);\n return {\n ...state,\n items: copy\n };\n });\n },\n moveBefore(key: Key, keys: Key[]) {\n dispatch(state => {\n let toIndex = state.items.findIndex(item => getKey(item) === key);\n if (toIndex === -1) {\n return state;\n }\n\n // Find indices of keys to move. Sort them so that the order in the list is retained.\n let indices = keys.map(key => state.items.findIndex(item => getKey(item) === key)).sort();\n return move(state, indices, toIndex);\n });\n },\n moveAfter(key: Key, keys: Key[]) {\n dispatch(state => {\n let toIndex = state.items.findIndex(item => getKey(item) === key);\n if (toIndex === -1) {\n return state;\n }\n\n let indices = keys.map(key => state.items.findIndex(item => getKey(item) === key)).sort();\n return move(state, indices, toIndex + 1);\n });\n },\n update(key: Key, newValue: T) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return state;\n }\n\n return {\n ...state,\n items: [\n ...state.items.slice(0, index),\n newValue,\n ...state.items.slice(index + 1)\n ]\n };\n });\n }\n };\n}\n\nfunction insert<T>(state: ListState<T>, index: number, ...values: T[]): ListState<T> {\n return {\n ...state,\n items: [\n ...state.items.slice(0, index),\n ...values,\n ...state.items.slice(index)\n ]\n };\n}\n\nfunction move<T>(state: ListState<T>, indices: number[], toIndex: number): ListState<T> {\n // Shift the target down by the number of items being moved from before the target\n for (let index of indices) {\n if (index < toIndex) {\n toIndex--;\n }\n }\n\n let moves = indices.map(from => ({\n from,\n to: toIndex++\n }));\n\n // Shift later from indices down if they have a larger index\n for (let i = 0; i < moves.length; i++) {\n let a = moves[i].from;\n for (let j = i; j < moves.length; j++) {\n let b = moves[j].from;\n\n if (b > a) {\n moves[j].from--;\n }\n }\n }\n\n // Interleave the moves so they can be applied one by one rather than all at once\n for (let i = 0; i < moves.length; i++) {\n let a = moves[i];\n for (let j = moves.length - 1; j > i; j--) {\n let b = moves[j];\n\n if (b.from < a.to) {\n a.to++;\n } else {\n b.from++;\n }\n }\n }\n\n let copy = state.items.slice();\n for (let move of moves) {\n let [item] = copy.splice(move.from, 1);\n copy.splice(move.to, 0, item);\n }\n\n return {\n ...state,\n items: copy\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, useMemo, useState} from 'react';\n\ninterface TreeOptions<T extends object> {\n /** Initial root items in the tree. */\n initialItems?: T[],\n /** The keys for the initially selected items. */\n initialSelectedKeys?: Iterable<Key>,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that returns the children for an item object. */\n getChildren?: (item: T) => T[]\n}\n\ninterface TreeNode<T extends object> {\n /** A unique key for the tree node. */\n key: Key,\n /** The key of the parent node. */\n parentKey: Key,\n /** The value object for the tree node. */\n value: T,\n /** Children of the tree node. */\n children: TreeNode<T>[]\n}\n\ninterface TreeData<T extends object> {\n /** The root nodes in the tree. */\n items: TreeNode<T>[],\n\n /** The keys of the currently selected items in the tree. */\n selectedKeys: Set<Key>,\n\n /** Sets the selected keys. */\n setSelectedKeys(keys: Set<Key>): void,\n\n /**\n * Gets a node from the tree by key.\n * @param key - The key of the item to retrieve.\n */\n getItem(key: Key): TreeNode<T>,\n\n /**\n * Inserts an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param index - The index within the parent to insert into.\n * @param value - The value to insert.\n */\n insert(parentKey: Key | null, index: number, ...values: T[]): void,\n\n /**\n * Inserts items into the list before the item at the given key.\n * @param key - The key of the item to insert before.\n * @param values - The values to insert.\n */\n insertBefore(key: Key, ...values: T[]): void,\n\n /**\n * Inserts items into the list after the item at the given key.\n * @param key - The key of the item to insert after.\n * @param values - The values to insert.\n */\n insertAfter(key: Key, ...values: T[]): void,\n\n /**\n * Appends an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n append(parentKey: Key | null, ...values: T[]): void,\n\n /**\n * Prepends an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n prepend(parentKey: Key | null, ...value: T[]): void,\n\n /**\n * Removes an item from the tree by its key.\n * @param key - The key of the item to remove.\n */\n remove(...keys: Key[]): void,\n\n /**\n * Removes all items from the tree that are currently\n * in the set of selected items.\n */\n removeSelectedItems(): void,\n\n /**\n * Moves an item within the tree.\n * @param key - The key of the item to move.\n * @param toParentKey - The key of the new parent to insert into.\n * @param index - The index within the new parent to insert at.\n */\n move(key: Key, toParentKey: Key, index: number): void,\n\n /**\n * Updates an item in the tree.\n * @param key - The key of the item to update.\n * @param newValue - The new value for the item.\n */\n update(key: Key, newValue: T): void\n}\n\n/**\n * Manages state for an immutable tree data structure, and provides convenience methods to\n * update the data over time.\n */\nexport function useTreeData<T extends object>(options: TreeOptions<T>): TreeData<T> {\n let {\n initialItems = [],\n initialSelectedKeys,\n getKey = (item: any) => item.id || item.key,\n getChildren = (item: any) => item.children\n } = options;\n let map = useMemo(() => new Map<Key, TreeNode<T>>(), []);\n\n // We only want to compute this on initial render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let initialNodes = useMemo(() => buildTree(initialItems), []);\n let [items, setItems] = useState(initialNodes);\n let [selectedKeys, setSelectedKeys] = useState(new Set<Key>(initialSelectedKeys || []));\n\n function buildTree(initialItems: T[] = [], parentKey?: Key | null) {\n return initialItems.map(item => {\n let node: TreeNode<T> = {\n key: getKey(item),\n parentKey: parentKey,\n value: item,\n children: null\n };\n\n node.children = buildTree(getChildren(item), node.key);\n map.set(node.key, node);\n return node;\n });\n }\n\n function updateTree(items: TreeNode<T>[], key: Key, update: (node: TreeNode<T>) => TreeNode<T>) {\n let node = map.get(key);\n if (!node) {\n return items;\n }\n\n // Create a new node. If null, then delete the node, otherwise replace.\n let newNode = update(node);\n if (newNode == null) {\n deleteNode(node);\n } else {\n addNode(newNode);\n }\n\n // Walk up the tree and update each parent to refer to the new chilren.\n while (node.parentKey) {\n let nextParent = map.get(node.parentKey);\n let copy: TreeNode<T> = {\n key: nextParent.key,\n parentKey: nextParent.parentKey,\n value: nextParent.value,\n children: null\n };\n\n let children = nextParent.children;\n if (newNode == null) {\n children = children.filter(c => c !== node);\n }\n\n copy.children = children.map(child => {\n if (child === node) {\n return newNode;\n }\n\n return child;\n });\n\n map.set(copy.key, copy);\n\n newNode = copy;\n node = nextParent;\n }\n\n if (newNode == null) {\n items = items.filter(c => c !== node);\n }\n\n return items.map(item => {\n if (item === node) {\n return newNode;\n }\n\n return item;\n });\n }\n\n function addNode(node: TreeNode<T>) {\n map.set(node.key, node);\n for (let child of node.children) {\n addNode(child);\n }\n }\n\n function deleteNode(node: TreeNode<T>) {\n map.delete(node.key);\n for (let child of node.children) {\n deleteNode(child);\n }\n }\n\n return {\n items,\n selectedKeys,\n setSelectedKeys,\n getItem(key: Key) {\n return map.get(key);\n },\n insert(parentKey: Key | null, index: number, ...values: T[]) {\n setItems(items => {\n let nodes = buildTree(values, parentKey);\n\n // If parentKey is null, insert into the root.\n if (parentKey == null) {\n return [\n ...items.slice(0, index),\n ...nodes,\n ...items.slice(index)\n ];\n }\n\n // Otherwise, update the parent node and its ancestors.\n return updateTree(items, parentKey, parentNode => ({\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n children: [\n ...parentNode.children.slice(0, index),\n ...nodes,\n ...parentNode.children.slice(index)\n ]\n }));\n });\n },\n insertBefore(key: Key, ...values: T[]): void {\n let node = map.get(key);\n if (!node) {\n return;\n }\n\n let parentNode = map.get(node.parentKey);\n let nodes = parentNode ? parentNode.children : items;\n let index = nodes.indexOf(node);\n this.insert(parentNode?.key, index, ...values);\n },\n insertAfter(key: Key, ...values: T[]): void {\n let node = map.get(key);\n if (!node) {\n return;\n }\n\n let parentNode = map.get(node.parentKey);\n let nodes = parentNode ? parentNode.children : items;\n let index = nodes.indexOf(node);\n this.insert(parentNode?.key, index + 1, ...values);\n },\n prepend(parentKey: Key | null, ...values: T[]) {\n this.insert(parentKey, 0, ...values);\n },\n append(parentKey: Key | null, ...values: T[]) {\n if (parentKey == null) {\n this.insert(null, items.length, ...values);\n } else {\n let parentNode = map.get(parentKey);\n if (!parentNode) {\n return;\n }\n\n this.insert(parentKey, parentNode.children.length, ...values);\n }\n },\n remove(...keys: Key[]) {\n let newItems = items;\n for (let key of keys) {\n newItems = updateTree(newItems, key, () => null);\n }\n\n setItems(newItems);\n\n let selection = new Set(selectedKeys);\n for (let key of selectedKeys) {\n if (!map.has(key)) {\n selection.delete(key);\n }\n }\n\n setSelectedKeys(selection);\n },\n removeSelectedItems() {\n this.remove(...selectedKeys);\n },\n move(key: Key, toParentKey: Key, index: number) {\n setItems(items => {\n let node = map.get(key);\n if (!node) {\n return items;\n }\n\n items = updateTree(items, key, () => null);\n\n const movedNode = {\n ...node,\n parentKey: toParentKey\n };\n\n return updateTree(items, toParentKey, parentNode => ({\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n children: [\n ...parentNode.children.slice(0, index),\n movedNode,\n ...parentNode.children.slice(index)\n ]\n }));\n });\n },\n update(oldKey: Key, newValue: T) {\n setItems(items => updateTree(items, oldKey, oldNode => {\n let node: TreeNode<T> = {\n key: oldNode.key,\n parentKey: oldNode.parentKey,\n value: newValue,\n children: null\n };\n\n node.children = buildTree(getChildren(newValue), node.key);\n return node;\n }));\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;SE0IgB,yCAAW,CAAI,OAAuB,EAAe,CAAC;IACpE,GAAG,CAAC,CAAC,eACH,YAAY,GAAG,CAAC,CAAC,wBACjB,mBAAmB,WACnB,MAAM,IAAI,IAAS,GAAK,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG;eAC3C,MAAM,sBACN,iBAAiB,GAAG,CAAE,GACxB,CAAC,GAAG,OAAO;IAEX,EAAuF,AAAvF,qFAAuF;IACvF,GAAG,EAAE,KAAK,EAAE,QAAQ,IAAI,qBAAQ,CAAe,CAAC;QAC9C,KAAK,EAAE,YAAY;QACnB,YAAY,EAAE,mBAAmB,KAAK,CAAK,OAAG,CAAK,OAAG,GAAG,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,CAAC;QACvF,UAAU,EAAE,iBAAiB;IAC/B,CAAC;IAED,GAAG,CAAC,aAAa,GAAG,oBAAO,KACnB,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,EAAC,IAAI,GAAI,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU;YAAK,KAAK,CAAC,KAAK;MACvF,CAAC;QAAA,KAAK,CAAC,KAAK;QAAE,KAAK,CAAC,UAAU;QAAE,MAAM;IAAA,CAAC;IAEzC,MAAM,CAAC,CAAC;WACH,KAAK;QACR,KAAK,EAAE,aAAa;WACjB,yCAAiB,CAAC,CAAC;oBAAA,MAAM;QAAA,CAAC,EAAE,QAAQ;QACvC,OAAO,EAAC,GAAQ,EAAE,CAAC;YACjB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAC,IAAI,GAAI,MAAM,CAAC,IAAI,MAAM,GAAG;;QACtD,CAAC;IACH,CAAC;AACH,CAAC;SAEe,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QACH,CAAC;QACD,MAAM,EAAC,MAAW,EAAE,QAAW,EAAE,CAAC;YAChC,QAAQ,EAAC,KAAK,GAAI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAE,OAAO,GAAI,CAAC;oBACtD,GAAG,CAAC,IAAI,GAAgB,CAAC;wBACvB,GAAG,EAAE,OAAO,CAAC,GAAG;wBAChB,SAAS,EAAE,OAAO,CAAC,SAAS;wBAC5B,KAAK,EAAE,QAAQ;wBACf,QAAQ,EAAE,IAAI;oBAChB,CAAC;oBAED,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG;oBACzD,MAAM,CAAC,IAAI;gBACb,CAAC;;QACH,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-stately/data/src/index.ts","packages/@react-stately/data/src/useAsyncList.ts","packages/@react-stately/data/src/useListData.ts","packages/@react-stately/data/src/useTreeData.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useAsyncList';\nexport * from './useTreeData';\nexport {useListData} from './useListData';\nexport type {ListData} from './useListData';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {createListActions, ListData, ListState} from './useListData';\nimport {Key, Reducer, useEffect, useReducer} from 'react';\nimport {LoadingState, Selection, SortDescriptor} from '@react-types/shared';\n\nexport interface AsyncListOptions<T, C> {\n /** The keys for the initially selected items. */\n initialSelectedKeys?: Iterable<Key>,\n /** The initial sort descriptor. */\n initialSortDescriptor?: SortDescriptor,\n /** The initial filter text. */\n initialFilterText?: string,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that loads the data for the items in the list. */\n load: AsyncListLoadFunction<T, C>,\n /**\n * An optional function that performs sorting. If not provided,\n * then `sortDescriptor` is passed to the `load` function.\n */\n sort?: AsyncListLoadFunction<T, C>\n}\n\ntype AsyncListLoadFunction<T, C> = (state: AsyncListLoadOptions<T, C>) => AsyncListStateUpdate<T, C> | Promise<AsyncListStateUpdate<T, C>>;\n\ninterface AsyncListLoadOptions<T, C> {\n /** The items currently in the list. */\n items: T[],\n /** The keys of the currently selected items in the list. */\n selectedKeys: Selection,\n /** The current sort descriptor for the list. */\n sortDescriptor: SortDescriptor,\n /** An abort signal used to notify the load function that the request has been aborted. */\n signal: AbortSignal,\n /** The pagination cursor returned from the last page load. */\n cursor?: C,\n /** The current filter text used to perform server side filtering. */\n filterText?: string,\n /** The current loading state of the list. */\n loadingState?: LoadingState\n}\n\ninterface AsyncListStateUpdate<T, C> {\n /** The new items to append to the list. */\n items: Iterable<T>,\n /** The keys to add to the selection. */\n selectedKeys?: Iterable<Key>,\n /** The sort descriptor to set. */\n sortDescriptor?: SortDescriptor,\n /** The pagination cursor to be used for the next page load. */\n cursor?: C,\n /** The updated filter text for the list. */\n filterText?: string\n}\n\ninterface AsyncListState<T, C> extends ListState<T> {\n state: LoadingState,\n items: T[],\n // disabledKeys?: Iterable<Key>,\n selectedKeys: Selection,\n // selectedKey?: Key,\n // expandedKeys?: Iterable<Key>,\n sortDescriptor?: SortDescriptor,\n error?: Error,\n abortController?: AbortController,\n cursor?: C\n}\n\ntype ActionType = 'success' | 'error' | 'loading' | 'loadingMore' | 'sorting' | 'update' | 'filtering';\ninterface Action<T, C> {\n type: ActionType,\n items?: Iterable<T>,\n selectedKeys?: Iterable<Key>,\n sortDescriptor?: SortDescriptor,\n error?: Error,\n abortController?: AbortController,\n updater?: (state: ListState<T>) => ListState<T>,\n cursor?: C,\n filterText?: string\n}\n\ninterface AsyncListData<T> extends ListData<T> {\n /** Whether data is currently being loaded. */\n isLoading: boolean,\n /** If loading data failed, then this contains the error that occurred. */\n error?: Error,\n // disabledKeys?: Set<Key>,\n // selectedKey?: Key,\n // expandedKeys?: Set<Key>,\n /** The current sort descriptor for the list. */\n sortDescriptor?: SortDescriptor,\n\n /** Reloads the data in the list. */\n reload(): void,\n /** Loads the next page of data in the list. */\n loadMore(): void,\n /** Triggers sorting for the list. */\n sort(descriptor: SortDescriptor): void,\n /** The current loading state for the list. */\n loadingState: LoadingState\n}\n\nfunction reducer<T, C>(data: AsyncListState<T, C>, action: Action<T, C>): AsyncListState<T, C> {\n let selectedKeys;\n switch (data.state) {\n case 'idle':\n case 'error':\n switch (action.type) {\n case 'loading':\n case 'loadingMore':\n case 'sorting':\n case 'filtering':\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: action.abortController\n };\n case 'update':\n return {\n ...data,\n ...action.updater(data)\n };\n case 'success':\n case 'error':\n return data;\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n case 'loading':\n case 'sorting':\n case 'filtering':\n switch (action.type) {\n case 'success':\n // Ignore if there is a newer abortcontroller in state.\n // This means that multiple requests were going at once.\n // We want to take only the latest result.\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n selectedKeys = action.selectedKeys ?? data.selectedKeys;\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: 'idle',\n items: [...action.items],\n selectedKeys: selectedKeys === 'all' ? 'all' : new Set(selectedKeys),\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: null,\n cursor: action.cursor\n };\n case 'error':\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n return {\n ...data,\n state: 'error',\n error: action.error,\n abortController: null\n };\n case 'loading':\n case 'loadingMore':\n case 'sorting':\n case 'filtering':\n // We're already loading, and another load was triggered at the same time.\n // We need to abort the previous load and start a new one.\n data.abortController.abort();\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n abortController: action.abortController\n };\n case 'update':\n // We're already loading, and an update happened at the same time (e.g. selectedKey changed).\n // Update data but don't abort previous load.\n return {\n ...data,\n ...action.updater(data)\n };\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n case 'loadingMore':\n switch (action.type) {\n case 'success':\n selectedKeys = (data.selectedKeys === 'all' || action.selectedKeys === 'all')\n ? 'all'\n : new Set([...data.selectedKeys, ...(action.selectedKeys ?? [])]);\n // Append the new items\n return {\n ...data,\n state: 'idle',\n items: [...data.items, ...action.items],\n selectedKeys,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: null,\n cursor: action.cursor\n };\n case 'error':\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n return {\n ...data,\n state: 'error',\n error: action.error\n };\n case 'loading':\n case 'sorting':\n case 'filtering':\n // We're already loading more, and another load was triggered at the same time.\n // We need to abort the previous load more and start a new one.\n data.abortController.abort();\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n abortController: action.abortController\n };\n case 'loadingMore':\n // If already loading more and another loading more is triggered, abort the new load more since\n // it is a duplicate request since the cursor hasn't been updated.\n // Do not overwrite the data.abortController\n action.abortController.abort();\n\n return data;\n case 'update':\n // We're already loading, and an update happened at the same time (e.g. selectedKey changed).\n // Update data but don't abort previous load.\n return {\n ...data,\n ...action.updater(data)\n };\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n default:\n throw new Error(`Invalid state \"${data.state}\"`);\n }\n}\n\n/**\n * Manages state for an immutable async loaded list data structure, and provides convenience methods to\n * update the data over time. Manages loading and error states, pagination, and sorting.\n */\nexport function useAsyncList<T, C = string>(options: AsyncListOptions<T, C>): AsyncListData<T> {\n const {\n load,\n sort,\n initialSelectedKeys,\n initialSortDescriptor,\n getKey = (item: any) => item.id || item.key,\n initialFilterText = ''\n } = options;\n\n let [data, dispatch] = useReducer<Reducer<AsyncListState<T, C>, Action<T, C>>>(reducer, {\n state: 'idle',\n error: null,\n items: [],\n selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys),\n sortDescriptor: initialSortDescriptor,\n filterText: initialFilterText\n });\n\n const dispatchFetch = async (action: Action<T, C>, fn: AsyncListLoadFunction<T, C>) => {\n let abortController = new AbortController();\n try {\n dispatch({...action, abortController});\n let previousFilterText = action.filterText ?? data.filterText;\n\n let response = await fn({\n items: data.items.slice(),\n selectedKeys: data.selectedKeys,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n signal: abortController.signal,\n cursor: action.type === 'loadingMore' ? data.cursor : null,\n filterText: previousFilterText\n });\n\n let filterText = response.filterText ?? previousFilterText;\n dispatch({type: 'success', ...response, abortController});\n\n // Fetch a new filtered list if filterText is updated via `load` response func rather than list.setFilterText\n // Only do this if not aborted (e.g. user triggers another filter action before load completes)\n if (filterText && (filterText !== previousFilterText) && !abortController.signal.aborted) {\n dispatchFetch({type: 'filtering', filterText}, load);\n }\n } catch (e) {\n dispatch({type: 'error', error: e, abortController});\n }\n };\n\n useEffect(() => {\n dispatchFetch({type: 'loading'}, load);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return {\n items: data.items,\n selectedKeys: data.selectedKeys,\n sortDescriptor: data.sortDescriptor,\n isLoading: data.state === 'loading' || data.state === 'loadingMore' || data.state === 'sorting' || data.state === 'filtering',\n loadingState: data.state,\n error: data.error,\n filterText: data.filterText,\n getItem(key: Key) {\n return data.items.find(item => getKey(item) === key);\n },\n reload() {\n dispatchFetch({type: 'loading'}, load);\n },\n loadMore() {\n // Ignore if already loading more or if performing server side filtering.\n if (data.state === 'loadingMore' || data.state === 'filtering' || data.cursor == null) {\n return;\n }\n\n dispatchFetch({type: 'loadingMore'}, load);\n },\n sort(sortDescriptor: SortDescriptor) {\n dispatchFetch({type: 'sorting', sortDescriptor}, sort || load);\n },\n ...createListActions({...options, getKey, cursor: data.cursor}, fn => {\n dispatch({type: 'update', updater: fn});\n }),\n setFilterText(filterText: string) {\n dispatchFetch({type: 'filtering', filterText}, load);\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, useMemo, useState} from 'react';\nimport {Selection} from '@react-types/shared';\n\ninterface ListOptions<T> {\n /** Initial items in the list. */\n initialItems?: T[],\n /** The keys for the initially selected items. */\n initialSelectedKeys?: 'all' | Iterable<Key>,\n /** The initial text to filter the list by. */\n initialFilterText?: string,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that returns whether a item matches the current filter text. */\n filter?: (item: T, filterText: string) => boolean\n}\n\nexport interface ListData<T> {\n /** The items in the list. */\n items: T[],\n\n /** The keys of the currently selected items in the list. */\n selectedKeys: Selection,\n\n /** Sets the selected keys. */\n setSelectedKeys(keys: Selection): void,\n\n /** The current filter text. */\n filterText: string,\n\n /** Sets the filter text. */\n setFilterText(filterText: string): void,\n\n /**\n * Gets an item from the list by key.\n * @param key - The key of the item to retrieve.\n */\n getItem(key: Key): T,\n\n /**\n * Inserts items into the list at the given index.\n * @param index - The index to insert into.\n * @param values - The values to insert.\n */\n insert(index: number, ...values: T[]): void,\n\n /**\n * Inserts items into the list before the item at the given key.\n * @param key - The key of the item to insert before.\n * @param values - The values to insert.\n */\n insertBefore(key: Key, ...values: T[]): void,\n\n /**\n * Inserts items into the list after the item at the given key.\n * @param key - The key of the item to insert after.\n * @param values - The values to insert.\n */\n insertAfter(key: Key, ...values: T[]): void,\n\n /**\n * Appends items to the list.\n * @param values - The values to insert.\n */\n append(...values: T[]): void,\n\n /**\n * Prepends items to the list.\n * @param value - The value to insert.\n */\n prepend(...values: T[]): void,\n\n /**\n * Removes items from the list by their keys.\n * @param keys - The keys of the item to remove.\n */\n remove(...keys: Key[]): void,\n\n /**\n * Removes all items from the list that are currently\n * in the set of selected items.\n */\n removeSelectedItems(): void,\n\n /**\n * Moves an item within the list.\n * @param key - The key of the item to move.\n * @param toIndex - The index to move the item to.\n */\n move(key: Key, toIndex: number): void,\n\n /**\n * Moves one or more items before a given key.\n * @param key - The key of the item to move the items before.\n * @param keys - The keys of the items to move.\n */\n moveBefore(key: Key, keys: Key[]): void,\n\n /**\n * Moves one or more items after a given key.\n * @param key - The key of the item to move the items after.\n * @param keys - The keys of the items to move.\n */\n moveAfter(key: Key, keys: Key[]): void,\n\n /**\n * Updates an item in the list.\n * @param key - The key of the item to update.\n * @param newValue - The new value for the item.\n */\n update(key: Key, newValue: T): void\n}\n\nexport interface ListState<T> {\n items: T[],\n selectedKeys: Selection,\n filterText: string\n}\n\ninterface CreateListOptions<T, C> extends ListOptions<T> {\n cursor?: C\n}\n\n/**\n * Manages state for an immutable list data structure, and provides convenience methods to\n * update the data over time.\n */\nexport function useListData<T>(options: ListOptions<T>): ListData<T> {\n let {\n initialItems = [],\n initialSelectedKeys,\n getKey = (item: any) => item.id || item.key,\n filter,\n initialFilterText = ''\n } = options;\n\n // Store both items and filteredItems in state so we can go back to the unfiltered list\n let [state, setState] = useState<ListState<T>>({\n items: initialItems,\n selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys || []),\n filterText: initialFilterText\n });\n\n let filteredItems = useMemo(\n () => filter ? state.items.filter(item => filter(item, state.filterText)) : state.items,\n [state.items, state.filterText, filter]);\n\n return {\n ...state,\n items: filteredItems,\n ...createListActions({getKey}, setState),\n getItem(key: Key) {\n return state.items.find(item => getKey(item) === key);\n }\n };\n}\n\nexport function createListActions<T, C>(opts: CreateListOptions<T, C>, dispatch: (updater: (state: ListState<T>) => ListState<T>) => void): Omit<ListData<T>, 'items' | 'selectedKeys' | 'getItem' | 'filterText'> {\n let {cursor, getKey} = opts;\n return {\n setSelectedKeys(selectedKeys: Selection) {\n dispatch(state => ({\n ...state,\n selectedKeys\n }));\n },\n setFilterText(filterText: string) {\n dispatch(state => ({\n ...state,\n filterText\n }));\n },\n insert(index: number, ...values: T[]) {\n dispatch(state => insert(state, index, ...values));\n },\n insertBefore(key: Key, ...values: T[]) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return;\n }\n\n return insert(state, index, ...values);\n });\n },\n insertAfter(key: Key, ...values: T[]) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return;\n }\n\n return insert(state, index + 1, ...values);\n });\n },\n prepend(...values: T[]) {\n dispatch(state => insert(state, 0, ...values));\n },\n append(...values: T[]) {\n dispatch(state => insert(state, state.items.length, ...values));\n },\n remove(...keys: Key[]) {\n dispatch(state => {\n let keySet = new Set(keys);\n let items = state.items.filter(item => !keySet.has(getKey(item)));\n\n let selection: Selection = 'all';\n if (state.selectedKeys !== 'all') {\n selection = new Set(state.selectedKeys);\n for (let key of keys) {\n selection.delete(key);\n }\n }\n if (cursor == null && items.length === 0) {\n selection = new Set();\n }\n\n return {\n ...state,\n items,\n selectedKeys: selection\n };\n });\n },\n removeSelectedItems() {\n dispatch(state => {\n if (state.selectedKeys === 'all') {\n return {\n ...state,\n items: [],\n selectedKeys: new Set()\n };\n }\n\n let selectedKeys = state.selectedKeys;\n let items = state.items.filter(item => !selectedKeys.has(getKey(item)));\n return {\n ...state,\n items,\n selectedKeys: new Set()\n };\n });\n },\n move(key: Key, toIndex: number) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return state;\n }\n\n let copy = state.items.slice();\n let [item] = copy.splice(index, 1);\n copy.splice(toIndex, 0, item);\n return {\n ...state,\n items: copy\n };\n });\n },\n moveBefore(key: Key, keys: Key[]) {\n dispatch(state => {\n let toIndex = state.items.findIndex(item => getKey(item) === key);\n if (toIndex === -1) {\n return state;\n }\n\n // Find indices of keys to move. Sort them so that the order in the list is retained.\n let indices = keys.map(key => state.items.findIndex(item => getKey(item) === key)).sort();\n return move(state, indices, toIndex);\n });\n },\n moveAfter(key: Key, keys: Key[]) {\n dispatch(state => {\n let toIndex = state.items.findIndex(item => getKey(item) === key);\n if (toIndex === -1) {\n return state;\n }\n\n let indices = keys.map(key => state.items.findIndex(item => getKey(item) === key)).sort();\n return move(state, indices, toIndex + 1);\n });\n },\n update(key: Key, newValue: T) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return state;\n }\n\n return {\n ...state,\n items: [\n ...state.items.slice(0, index),\n newValue,\n ...state.items.slice(index + 1)\n ]\n };\n });\n }\n };\n}\n\nfunction insert<T>(state: ListState<T>, index: number, ...values: T[]): ListState<T> {\n return {\n ...state,\n items: [\n ...state.items.slice(0, index),\n ...values,\n ...state.items.slice(index)\n ]\n };\n}\n\nfunction move<T>(state: ListState<T>, indices: number[], toIndex: number): ListState<T> {\n // Shift the target down by the number of items being moved from before the target\n for (let index of indices) {\n if (index < toIndex) {\n toIndex--;\n }\n }\n\n let moves = indices.map(from => ({\n from,\n to: toIndex++\n }));\n\n // Shift later from indices down if they have a larger index\n for (let i = 0; i < moves.length; i++) {\n let a = moves[i].from;\n for (let j = i; j < moves.length; j++) {\n let b = moves[j].from;\n\n if (b > a) {\n moves[j].from--;\n }\n }\n }\n\n // Interleave the moves so they can be applied one by one rather than all at once\n for (let i = 0; i < moves.length; i++) {\n let a = moves[i];\n for (let j = moves.length - 1; j > i; j--) {\n let b = moves[j];\n\n if (b.from < a.to) {\n a.to++;\n } else {\n b.from++;\n }\n }\n }\n\n let copy = state.items.slice();\n for (let move of moves) {\n let [item] = copy.splice(move.from, 1);\n copy.splice(move.to, 0, item);\n }\n\n return {\n ...state,\n items: copy\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, useMemo, useState} from 'react';\n\ninterface TreeOptions<T extends object> {\n /** Initial root items in the tree. */\n initialItems?: T[],\n /** The keys for the initially selected items. */\n initialSelectedKeys?: Iterable<Key>,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that returns the children for an item object. */\n getChildren?: (item: T) => T[]\n}\n\ninterface TreeNode<T extends object> {\n /** A unique key for the tree node. */\n key: Key,\n /** The key of the parent node. */\n parentKey: Key,\n /** The value object for the tree node. */\n value: T,\n /** Children of the tree node. */\n children: TreeNode<T>[]\n}\n\ninterface TreeData<T extends object> {\n /** The root nodes in the tree. */\n items: TreeNode<T>[],\n\n /** The keys of the currently selected items in the tree. */\n selectedKeys: Set<Key>,\n\n /** Sets the selected keys. */\n setSelectedKeys(keys: Set<Key>): void,\n\n /**\n * Gets a node from the tree by key.\n * @param key - The key of the item to retrieve.\n */\n getItem(key: Key): TreeNode<T>,\n\n /**\n * Inserts an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param index - The index within the parent to insert into.\n * @param value - The value to insert.\n */\n insert(parentKey: Key | null, index: number, ...values: T[]): void,\n\n /**\n * Inserts items into the list before the item at the given key.\n * @param key - The key of the item to insert before.\n * @param values - The values to insert.\n */\n insertBefore(key: Key, ...values: T[]): void,\n\n /**\n * Inserts items into the list after the item at the given key.\n * @param key - The key of the item to insert after.\n * @param values - The values to insert.\n */\n insertAfter(key: Key, ...values: T[]): void,\n\n /**\n * Appends an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n append(parentKey: Key | null, ...values: T[]): void,\n\n /**\n * Prepends an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n prepend(parentKey: Key | null, ...value: T[]): void,\n\n /**\n * Removes an item from the tree by its key.\n * @param key - The key of the item to remove.\n */\n remove(...keys: Key[]): void,\n\n /**\n * Removes all items from the tree that are currently\n * in the set of selected items.\n */\n removeSelectedItems(): void,\n\n /**\n * Moves an item within the tree.\n * @param key - The key of the item to move.\n * @param toParentKey - The key of the new parent to insert into.\n * @param index - The index within the new parent to insert at.\n */\n move(key: Key, toParentKey: Key, index: number): void,\n\n /**\n * Updates an item in the tree.\n * @param key - The key of the item to update.\n * @param newValue - The new value for the item.\n */\n update(key: Key, newValue: T): void\n}\n\n/**\n * Manages state for an immutable tree data structure, and provides convenience methods to\n * update the data over time.\n */\nexport function useTreeData<T extends object>(options: TreeOptions<T>): TreeData<T> {\n let {\n initialItems = [],\n initialSelectedKeys,\n getKey = (item: any) => item.id || item.key,\n getChildren = (item: any) => item.children\n } = options;\n let map = useMemo(() => new Map<Key, TreeNode<T>>(), []);\n\n // We only want to compute this on initial render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let initialNodes = useMemo(() => buildTree(initialItems), []);\n let [items, setItems] = useState(initialNodes);\n let [selectedKeys, setSelectedKeys] = useState(new Set<Key>(initialSelectedKeys || []));\n\n function buildTree(initialItems: T[] = [], parentKey?: Key | null) {\n return initialItems.map(item => {\n let node: TreeNode<T> = {\n key: getKey(item),\n parentKey: parentKey,\n value: item,\n children: null\n };\n\n node.children = buildTree(getChildren(item), node.key);\n map.set(node.key, node);\n return node;\n });\n }\n\n function updateTree(items: TreeNode<T>[], key: Key, update: (node: TreeNode<T>) => TreeNode<T>) {\n let node = map.get(key);\n if (!node) {\n return items;\n }\n\n // Create a new node. If null, then delete the node, otherwise replace.\n let newNode = update(node);\n if (newNode == null) {\n deleteNode(node);\n } else {\n addNode(newNode);\n }\n\n // Walk up the tree and update each parent to refer to the new chilren.\n while (node.parentKey) {\n let nextParent = map.get(node.parentKey);\n let copy: TreeNode<T> = {\n key: nextParent.key,\n parentKey: nextParent.parentKey,\n value: nextParent.value,\n children: null\n };\n\n let children = nextParent.children;\n if (newNode == null) {\n children = children.filter(c => c !== node);\n }\n\n copy.children = children.map(child => {\n if (child === node) {\n return newNode;\n }\n\n return child;\n });\n\n map.set(copy.key, copy);\n\n newNode = copy;\n node = nextParent;\n }\n\n if (newNode == null) {\n items = items.filter(c => c !== node);\n }\n\n return items.map(item => {\n if (item === node) {\n return newNode;\n }\n\n return item;\n });\n }\n\n function addNode(node: TreeNode<T>) {\n map.set(node.key, node);\n for (let child of node.children) {\n addNode(child);\n }\n }\n\n function deleteNode(node: TreeNode<T>) {\n map.delete(node.key);\n for (let child of node.children) {\n deleteNode(child);\n }\n }\n\n return {\n items,\n selectedKeys,\n setSelectedKeys,\n getItem(key: Key) {\n return map.get(key);\n },\n insert(parentKey: Key | null, index: number, ...values: T[]) {\n setItems(items => {\n let nodes = buildTree(values, parentKey);\n\n // If parentKey is null, insert into the root.\n if (parentKey == null) {\n return [\n ...items.slice(0, index),\n ...nodes,\n ...items.slice(index)\n ];\n }\n\n // Otherwise, update the parent node and its ancestors.\n return updateTree(items, parentKey, parentNode => ({\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n children: [\n ...parentNode.children.slice(0, index),\n ...nodes,\n ...parentNode.children.slice(index)\n ]\n }));\n });\n },\n insertBefore(key: Key, ...values: T[]): void {\n let node = map.get(key);\n if (!node) {\n return;\n }\n\n let parentNode = map.get(node.parentKey);\n let nodes = parentNode ? parentNode.children : items;\n let index = nodes.indexOf(node);\n this.insert(parentNode?.key, index, ...values);\n },\n insertAfter(key: Key, ...values: T[]): void {\n let node = map.get(key);\n if (!node) {\n return;\n }\n\n let parentNode = map.get(node.parentKey);\n let nodes = parentNode ? parentNode.children : items;\n let index = nodes.indexOf(node);\n this.insert(parentNode?.key, index + 1, ...values);\n },\n prepend(parentKey: Key | null, ...values: T[]) {\n this.insert(parentKey, 0, ...values);\n },\n append(parentKey: Key | null, ...values: T[]) {\n if (parentKey == null) {\n this.insert(null, items.length, ...values);\n } else {\n let parentNode = map.get(parentKey);\n if (!parentNode) {\n return;\n }\n\n this.insert(parentKey, parentNode.children.length, ...values);\n }\n },\n remove(...keys: Key[]) {\n let newItems = items;\n for (let key of keys) {\n newItems = updateTree(newItems, key, () => null);\n }\n\n setItems(newItems);\n\n let selection = new Set(selectedKeys);\n for (let key of selectedKeys) {\n if (!map.has(key)) {\n selection.delete(key);\n }\n }\n\n setSelectedKeys(selection);\n },\n removeSelectedItems() {\n this.remove(...selectedKeys);\n },\n move(key: Key, toParentKey: Key, index: number) {\n setItems(items => {\n let node = map.get(key);\n if (!node) {\n return items;\n }\n\n items = updateTree(items, key, () => null);\n\n const movedNode = {\n ...node,\n parentKey: toParentKey\n };\n\n return updateTree(items, toParentKey, parentNode => ({\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n children: [\n ...parentNode.children.slice(0, index),\n movedNode,\n ...parentNode.children.slice(index)\n ]\n }));\n });\n },\n update(oldKey: Key, newValue: T) {\n setItems(items => updateTree(items, oldKey, oldNode => {\n let node: TreeNode<T> = {\n key: oldNode.key,\n parentKey: oldNode.parentKey,\n value: newValue,\n children: null\n };\n\n node.children = buildTree(getChildren(newValue), node.key);\n return node;\n }));\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {useReducer as $
|
|
1
|
+
import {useReducer as $kPu1K$useReducer, useEffect as $kPu1K$useEffect, useState as $kPu1K$useState, useMemo as $kPu1K$useMemo} from "react";
|
|
2
2
|
|
|
3
3
|
function $parcel$export(e, n, v, s) {
|
|
4
4
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
5
5
|
}
|
|
6
|
-
var $
|
|
6
|
+
var $a3d5ea29a1945d34$exports = {};
|
|
7
7
|
|
|
8
|
-
$parcel$export($
|
|
8
|
+
$parcel$export($a3d5ea29a1945d34$exports, "useAsyncList", () => $a3d5ea29a1945d34$export$bc3384a35de93d66);
|
|
9
9
|
|
|
10
|
-
function $
|
|
10
|
+
function $591e64c1b48762ea$export$762f73dccccd255d(options) {
|
|
11
11
|
let { initialItems: initialItems = [] , initialSelectedKeys: initialSelectedKeys , getKey: getKey = (item)=>item.id || item.key
|
|
12
12
|
, filter: filter , initialFilterText: initialFilterText = '' } = options;
|
|
13
13
|
// Store both items and filteredItems in state so we can go back to the unfiltered list
|
|
14
|
-
let [state, setState] = $
|
|
14
|
+
let [state, setState] = $kPu1K$useState({
|
|
15
15
|
items: initialItems,
|
|
16
16
|
selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys || []),
|
|
17
17
|
filterText: initialFilterText
|
|
18
18
|
});
|
|
19
|
-
let filteredItems = $
|
|
19
|
+
let filteredItems = $kPu1K$useMemo(()=>filter ? state.items.filter((item)=>filter(item, state.filterText)
|
|
20
20
|
) : state.items
|
|
21
21
|
, [
|
|
22
22
|
state.items,
|
|
@@ -26,7 +26,7 @@ function $417961c6360ea401$export$762f73dccccd255d(options) {
|
|
|
26
26
|
return {
|
|
27
27
|
...state,
|
|
28
28
|
items: filteredItems,
|
|
29
|
-
...$
|
|
29
|
+
...$591e64c1b48762ea$export$79c0c687a5963b0a({
|
|
30
30
|
getKey: getKey
|
|
31
31
|
}, setState),
|
|
32
32
|
getItem (key) {
|
|
@@ -35,7 +35,7 @@ function $417961c6360ea401$export$762f73dccccd255d(options) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function $
|
|
38
|
+
function $591e64c1b48762ea$export$79c0c687a5963b0a(opts, dispatch) {
|
|
39
39
|
let { cursor: cursor , getKey: getKey } = opts;
|
|
40
40
|
return {
|
|
41
41
|
setSelectedKeys (selectedKeys) {
|
|
@@ -53,7 +53,7 @@ function $417961c6360ea401$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
53
53
|
);
|
|
54
54
|
},
|
|
55
55
|
insert (index, ...values) {
|
|
56
|
-
dispatch((state)=>$
|
|
56
|
+
dispatch((state)=>$591e64c1b48762ea$var$insert(state, index, ...values)
|
|
57
57
|
);
|
|
58
58
|
},
|
|
59
59
|
insertBefore (key, ...values) {
|
|
@@ -61,7 +61,7 @@ function $417961c6360ea401$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
61
61
|
let index = state.items.findIndex((item)=>getKey(item) === key
|
|
62
62
|
);
|
|
63
63
|
if (index === -1) return;
|
|
64
|
-
return $
|
|
64
|
+
return $591e64c1b48762ea$var$insert(state, index, ...values);
|
|
65
65
|
});
|
|
66
66
|
},
|
|
67
67
|
insertAfter (key, ...values) {
|
|
@@ -69,15 +69,15 @@ function $417961c6360ea401$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
69
69
|
let index = state.items.findIndex((item)=>getKey(item) === key
|
|
70
70
|
);
|
|
71
71
|
if (index === -1) return;
|
|
72
|
-
return $
|
|
72
|
+
return $591e64c1b48762ea$var$insert(state, index + 1, ...values);
|
|
73
73
|
});
|
|
74
74
|
},
|
|
75
75
|
prepend (...values) {
|
|
76
|
-
dispatch((state)=>$
|
|
76
|
+
dispatch((state)=>$591e64c1b48762ea$var$insert(state, 0, ...values)
|
|
77
77
|
);
|
|
78
78
|
},
|
|
79
79
|
append (...values) {
|
|
80
|
-
dispatch((state)=>$
|
|
80
|
+
dispatch((state)=>$591e64c1b48762ea$var$insert(state, state.items.length, ...values)
|
|
81
81
|
);
|
|
82
82
|
},
|
|
83
83
|
remove (...keys) {
|
|
@@ -138,7 +138,7 @@ function $417961c6360ea401$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
138
138
|
let indices = keys.map((key)=>state.items.findIndex((item)=>getKey(item) === key
|
|
139
139
|
)
|
|
140
140
|
).sort();
|
|
141
|
-
return $
|
|
141
|
+
return $591e64c1b48762ea$var$move(state, indices, toIndex);
|
|
142
142
|
});
|
|
143
143
|
},
|
|
144
144
|
moveAfter (key2, keys) {
|
|
@@ -149,7 +149,7 @@ function $417961c6360ea401$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
149
149
|
let indices = keys.map((key)=>state.items.findIndex((item)=>getKey(item) === key
|
|
150
150
|
)
|
|
151
151
|
).sort();
|
|
152
|
-
return $
|
|
152
|
+
return $591e64c1b48762ea$var$move(state, indices, toIndex + 1);
|
|
153
153
|
});
|
|
154
154
|
},
|
|
155
155
|
update (key, newValue) {
|
|
@@ -169,7 +169,7 @@ function $417961c6360ea401$export$79c0c687a5963b0a(opts, dispatch) {
|
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
function $
|
|
172
|
+
function $591e64c1b48762ea$var$insert(state, index, ...values) {
|
|
173
173
|
return {
|
|
174
174
|
...state,
|
|
175
175
|
items: [
|
|
@@ -179,7 +179,7 @@ function $417961c6360ea401$var$insert(state, index, ...values) {
|
|
|
179
179
|
]
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
function $
|
|
182
|
+
function $591e64c1b48762ea$var$move(state, indices, toIndex) {
|
|
183
183
|
// Shift the target down by the number of items being moved from before the target
|
|
184
184
|
for (let index of indices)if (index < toIndex) toIndex--;
|
|
185
185
|
let moves = indices.map((from)=>({
|
|
@@ -217,7 +217,7 @@ function $417961c6360ea401$var$move(state, indices, toIndex) {
|
|
|
217
217
|
|
|
218
218
|
|
|
219
219
|
|
|
220
|
-
function $
|
|
220
|
+
function $a3d5ea29a1945d34$var$reducer(data, action) {
|
|
221
221
|
let selectedKeys;
|
|
222
222
|
switch(data.state){
|
|
223
223
|
case 'idle':
|
|
@@ -227,13 +227,14 @@ function $5ab7df242373b1d6$var$reducer(data, action) {
|
|
|
227
227
|
case 'loadingMore':
|
|
228
228
|
case 'sorting':
|
|
229
229
|
case 'filtering':
|
|
230
|
+
var _filterText, _sortDescriptor;
|
|
230
231
|
return {
|
|
231
232
|
...data,
|
|
232
|
-
filterText: action.filterText
|
|
233
|
+
filterText: (_filterText = action.filterText) !== null && _filterText !== void 0 ? _filterText : data.filterText,
|
|
233
234
|
state: action.type,
|
|
234
235
|
// Reset items to an empty list if loading, but not when sorting.
|
|
235
236
|
items: action.type === 'loading' ? [] : data.items,
|
|
236
|
-
sortDescriptor: action.sortDescriptor
|
|
237
|
+
sortDescriptor: (_sortDescriptor = action.sortDescriptor) !== null && _sortDescriptor !== void 0 ? _sortDescriptor : data.sortDescriptor,
|
|
237
238
|
abortController: action.abortController
|
|
238
239
|
};
|
|
239
240
|
case 'update':
|
|
@@ -256,16 +257,18 @@ function $5ab7df242373b1d6$var$reducer(data, action) {
|
|
|
256
257
|
// This means that multiple requests were going at once.
|
|
257
258
|
// We want to take only the latest result.
|
|
258
259
|
if (action.abortController !== data.abortController) return data;
|
|
259
|
-
|
|
260
|
+
var _selectedKeys;
|
|
261
|
+
selectedKeys = (_selectedKeys = action.selectedKeys) !== null && _selectedKeys !== void 0 ? _selectedKeys : data.selectedKeys;
|
|
262
|
+
var _filterText1, _sortDescriptor1;
|
|
260
263
|
return {
|
|
261
264
|
...data,
|
|
262
|
-
filterText: action.filterText
|
|
265
|
+
filterText: (_filterText1 = action.filterText) !== null && _filterText1 !== void 0 ? _filterText1 : data.filterText,
|
|
263
266
|
state: 'idle',
|
|
264
267
|
items: [
|
|
265
268
|
...action.items
|
|
266
269
|
],
|
|
267
270
|
selectedKeys: selectedKeys === 'all' ? 'all' : new Set(selectedKeys),
|
|
268
|
-
sortDescriptor: action.sortDescriptor
|
|
271
|
+
sortDescriptor: (_sortDescriptor1 = action.sortDescriptor) !== null && _sortDescriptor1 !== void 0 ? _sortDescriptor1 : data.sortDescriptor,
|
|
269
272
|
abortController: null,
|
|
270
273
|
cursor: action.cursor
|
|
271
274
|
};
|
|
@@ -284,9 +287,10 @@ function $5ab7df242373b1d6$var$reducer(data, action) {
|
|
|
284
287
|
// We're already loading, and another load was triggered at the same time.
|
|
285
288
|
// We need to abort the previous load and start a new one.
|
|
286
289
|
data.abortController.abort();
|
|
290
|
+
var _filterText2;
|
|
287
291
|
return {
|
|
288
292
|
...data,
|
|
289
|
-
filterText: action.filterText
|
|
293
|
+
filterText: (_filterText2 = action.filterText) !== null && _filterText2 !== void 0 ? _filterText2 : data.filterText,
|
|
290
294
|
state: action.type,
|
|
291
295
|
// Reset items to an empty list if loading, but not when sorting.
|
|
292
296
|
items: action.type === 'loading' ? [] : data.items,
|
|
@@ -305,10 +309,12 @@ function $5ab7df242373b1d6$var$reducer(data, action) {
|
|
|
305
309
|
case 'loadingMore':
|
|
306
310
|
switch(action.type){
|
|
307
311
|
case 'success':
|
|
312
|
+
var _selectedKeys1;
|
|
308
313
|
selectedKeys = data.selectedKeys === 'all' || action.selectedKeys === 'all' ? 'all' : new Set([
|
|
309
314
|
...data.selectedKeys,
|
|
310
|
-
...action.selectedKeys
|
|
315
|
+
...(_selectedKeys1 = action.selectedKeys) !== null && _selectedKeys1 !== void 0 ? _selectedKeys1 : []
|
|
311
316
|
]);
|
|
317
|
+
var _sortDescriptor2;
|
|
312
318
|
// Append the new items
|
|
313
319
|
return {
|
|
314
320
|
...data,
|
|
@@ -318,7 +324,7 @@ function $5ab7df242373b1d6$var$reducer(data, action) {
|
|
|
318
324
|
...action.items
|
|
319
325
|
],
|
|
320
326
|
selectedKeys: selectedKeys,
|
|
321
|
-
sortDescriptor: action.sortDescriptor
|
|
327
|
+
sortDescriptor: (_sortDescriptor2 = action.sortDescriptor) !== null && _sortDescriptor2 !== void 0 ? _sortDescriptor2 : data.sortDescriptor,
|
|
322
328
|
abortController: null,
|
|
323
329
|
cursor: action.cursor
|
|
324
330
|
};
|
|
@@ -335,9 +341,10 @@ function $5ab7df242373b1d6$var$reducer(data, action) {
|
|
|
335
341
|
// We're already loading more, and another load was triggered at the same time.
|
|
336
342
|
// We need to abort the previous load more and start a new one.
|
|
337
343
|
data.abortController.abort();
|
|
344
|
+
var _filterText3;
|
|
338
345
|
return {
|
|
339
346
|
...data,
|
|
340
|
-
filterText: action.filterText
|
|
347
|
+
filterText: (_filterText3 = action.filterText) !== null && _filterText3 !== void 0 ? _filterText3 : data.filterText,
|
|
341
348
|
state: action.type,
|
|
342
349
|
// Reset items to an empty list if loading, but not when sorting.
|
|
343
350
|
items: action.type === 'loading' ? [] : data.items,
|
|
@@ -363,10 +370,10 @@ function $5ab7df242373b1d6$var$reducer(data, action) {
|
|
|
363
370
|
throw new Error(`Invalid state "${data.state}"`);
|
|
364
371
|
}
|
|
365
372
|
}
|
|
366
|
-
function $
|
|
373
|
+
function $a3d5ea29a1945d34$export$bc3384a35de93d66(options) {
|
|
367
374
|
const { load: load , sort: sort , initialSelectedKeys: initialSelectedKeys , initialSortDescriptor: initialSortDescriptor , getKey: getKey = (item)=>item.id || item.key
|
|
368
375
|
, initialFilterText: initialFilterText = '' } = options;
|
|
369
|
-
let [data, dispatch] = $
|
|
376
|
+
let [data, dispatch] = $kPu1K$useReducer($a3d5ea29a1945d34$var$reducer, {
|
|
370
377
|
state: 'idle',
|
|
371
378
|
error: null,
|
|
372
379
|
items: [],
|
|
@@ -381,16 +388,19 @@ function $5ab7df242373b1d6$export$bc3384a35de93d66(options) {
|
|
|
381
388
|
...action,
|
|
382
389
|
abortController: abortController
|
|
383
390
|
});
|
|
384
|
-
|
|
391
|
+
var _filterText;
|
|
392
|
+
let previousFilterText = (_filterText = action.filterText) !== null && _filterText !== void 0 ? _filterText : data.filterText;
|
|
393
|
+
var _sortDescriptor;
|
|
385
394
|
let response = await fn({
|
|
386
395
|
items: data.items.slice(),
|
|
387
396
|
selectedKeys: data.selectedKeys,
|
|
388
|
-
sortDescriptor: action.sortDescriptor
|
|
397
|
+
sortDescriptor: (_sortDescriptor = action.sortDescriptor) !== null && _sortDescriptor !== void 0 ? _sortDescriptor : data.sortDescriptor,
|
|
389
398
|
signal: abortController.signal,
|
|
390
399
|
cursor: action.type === 'loadingMore' ? data.cursor : null,
|
|
391
400
|
filterText: previousFilterText
|
|
392
401
|
});
|
|
393
|
-
|
|
402
|
+
var _filterText4;
|
|
403
|
+
let filterText = (_filterText4 = response.filterText) !== null && _filterText4 !== void 0 ? _filterText4 : previousFilterText;
|
|
394
404
|
dispatch({
|
|
395
405
|
type: 'success',
|
|
396
406
|
...response,
|
|
@@ -410,7 +420,7 @@ function $5ab7df242373b1d6$export$bc3384a35de93d66(options) {
|
|
|
410
420
|
});
|
|
411
421
|
}
|
|
412
422
|
};
|
|
413
|
-
$
|
|
423
|
+
$kPu1K$useEffect(()=>{
|
|
414
424
|
dispatchFetch({
|
|
415
425
|
type: 'loading'
|
|
416
426
|
}, load);
|
|
@@ -446,7 +456,7 @@ function $5ab7df242373b1d6$export$bc3384a35de93d66(options) {
|
|
|
446
456
|
sortDescriptor: sortDescriptor
|
|
447
457
|
}, sort || load);
|
|
448
458
|
},
|
|
449
|
-
...$
|
|
459
|
+
...$591e64c1b48762ea$export$79c0c687a5963b0a({
|
|
450
460
|
...options,
|
|
451
461
|
getKey: getKey,
|
|
452
462
|
cursor: data.cursor
|
|
@@ -466,22 +476,22 @@ function $5ab7df242373b1d6$export$bc3384a35de93d66(options) {
|
|
|
466
476
|
}
|
|
467
477
|
|
|
468
478
|
|
|
469
|
-
var $
|
|
479
|
+
var $1a2469058070f762$exports = {};
|
|
470
480
|
|
|
471
|
-
$parcel$export($
|
|
481
|
+
$parcel$export($1a2469058070f762$exports, "useTreeData", () => $1a2469058070f762$export$d14e1352e21f4a16);
|
|
472
482
|
|
|
473
|
-
function $
|
|
483
|
+
function $1a2469058070f762$export$d14e1352e21f4a16(options) {
|
|
474
484
|
let { initialItems: initialItems1 = [] , initialSelectedKeys: initialSelectedKeys , getKey: getKey = (item)=>item.id || item.key
|
|
475
485
|
, getChildren: getChildren = (item)=>item.children
|
|
476
486
|
} = options;
|
|
477
|
-
let map = $
|
|
487
|
+
let map = $kPu1K$useMemo(()=>new Map()
|
|
478
488
|
, []);
|
|
479
489
|
// We only want to compute this on initial render.
|
|
480
490
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
481
|
-
let initialNodes = $
|
|
491
|
+
let initialNodes = $kPu1K$useMemo(()=>buildTree(initialItems1)
|
|
482
492
|
, []);
|
|
483
|
-
let [items1, setItems] = $
|
|
484
|
-
let [selectedKeys, setSelectedKeys] = $
|
|
493
|
+
let [items1, setItems] = $kPu1K$useState(initialNodes);
|
|
494
|
+
let [selectedKeys, setSelectedKeys] = $kPu1K$useState(new Set(initialSelectedKeys || []));
|
|
485
495
|
function buildTree(initialItems = [], parentKey) {
|
|
486
496
|
return initialItems.map((item)=>{
|
|
487
497
|
let node = {
|
|
@@ -573,7 +583,7 @@ function $eb09c7039a20c675$export$d14e1352e21f4a16(options) {
|
|
|
573
583
|
let parentNode = map.get(node.parentKey);
|
|
574
584
|
let nodes = parentNode ? parentNode.children : items1;
|
|
575
585
|
let index = nodes.indexOf(node);
|
|
576
|
-
this.insert(parentNode
|
|
586
|
+
this.insert(parentNode === null || parentNode === void 0 ? void 0 : parentNode.key, index, ...values);
|
|
577
587
|
},
|
|
578
588
|
insertAfter (key, ...values) {
|
|
579
589
|
let node = map.get(key);
|
|
@@ -581,7 +591,7 @@ function $eb09c7039a20c675$export$d14e1352e21f4a16(options) {
|
|
|
581
591
|
let parentNode = map.get(node.parentKey);
|
|
582
592
|
let nodes = parentNode ? parentNode.children : items1;
|
|
583
593
|
let index = nodes.indexOf(node);
|
|
584
|
-
this.insert(parentNode
|
|
594
|
+
this.insert(parentNode === null || parentNode === void 0 ? void 0 : parentNode.key, index + 1, ...values);
|
|
585
595
|
},
|
|
586
596
|
prepend (parentKey, ...values) {
|
|
587
597
|
this.insert(parentKey, 0, ...values);
|
|
@@ -649,5 +659,5 @@ function $eb09c7039a20c675$export$d14e1352e21f4a16(options) {
|
|
|
649
659
|
|
|
650
660
|
|
|
651
661
|
|
|
652
|
-
export {$
|
|
662
|
+
export {$591e64c1b48762ea$export$762f73dccccd255d as useListData, $a3d5ea29a1945d34$export$bc3384a35de93d66 as useAsyncList, $1a2469058070f762$export$d14e1352e21f4a16 as useTreeData};
|
|
653
663
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;SE0IgB,yCAAW,CAAI,OAAuB,EAAe,CAAC;IACpE,GAAG,CAAC,CAAC,eACH,YAAY,GAAG,CAAC,CAAC,wBACjB,mBAAmB,WACnB,MAAM,IAAI,IAAS,GAAK,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG;eAC3C,MAAM,sBACN,iBAAiB,GAAG,CAAE,GACxB,CAAC,GAAG,OAAO;IAEX,EAAuF,AAAvF,qFAAuF;IACvF,GAAG,EAAE,KAAK,EAAE,QAAQ,IAAI,eAAQ,CAAe,CAAC;QAC9C,KAAK,EAAE,YAAY;QACnB,YAAY,EAAE,mBAAmB,KAAK,CAAK,OAAG,CAAK,OAAG,GAAG,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,CAAC;QACvF,UAAU,EAAE,iBAAiB;IAC/B,CAAC;IAED,GAAG,CAAC,aAAa,GAAG,cAAO,KACnB,MAAM,GAAG,KAAK,CAAC,KA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CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG;oBACzD,MAAM,CAAC,IAAI;gBACb,CAAC;;QACH,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-stately/data/src/index.ts","packages/@react-stately/data/src/useAsyncList.ts","packages/@react-stately/data/src/useListData.ts","packages/@react-stately/data/src/useTreeData.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useAsyncList';\nexport * from './useTreeData';\nexport {useListData} from './useListData';\nexport type {ListData} from './useListData';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {createListActions, ListData, ListState} from './useListData';\nimport {Key, Reducer, useEffect, useReducer} from 'react';\nimport {LoadingState, Selection, SortDescriptor} from '@react-types/shared';\n\nexport interface AsyncListOptions<T, C> {\n /** The keys for the initially selected items. */\n initialSelectedKeys?: Iterable<Key>,\n /** The initial sort descriptor. */\n initialSortDescriptor?: SortDescriptor,\n /** The initial filter text. */\n initialFilterText?: string,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that loads the data for the items in the list. */\n load: AsyncListLoadFunction<T, C>,\n /**\n * An optional function that performs sorting. If not provided,\n * then `sortDescriptor` is passed to the `load` function.\n */\n sort?: AsyncListLoadFunction<T, C>\n}\n\ntype AsyncListLoadFunction<T, C> = (state: AsyncListLoadOptions<T, C>) => AsyncListStateUpdate<T, C> | Promise<AsyncListStateUpdate<T, C>>;\n\ninterface AsyncListLoadOptions<T, C> {\n /** The items currently in the list. */\n items: T[],\n /** The keys of the currently selected items in the list. */\n selectedKeys: Selection,\n /** The current sort descriptor for the list. */\n sortDescriptor: SortDescriptor,\n /** An abort signal used to notify the load function that the request has been aborted. */\n signal: AbortSignal,\n /** The pagination cursor returned from the last page load. */\n cursor?: C,\n /** The current filter text used to perform server side filtering. */\n filterText?: string,\n /** The current loading state of the list. */\n loadingState?: LoadingState\n}\n\ninterface AsyncListStateUpdate<T, C> {\n /** The new items to append to the list. */\n items: Iterable<T>,\n /** The keys to add to the selection. */\n selectedKeys?: Iterable<Key>,\n /** The sort descriptor to set. */\n sortDescriptor?: SortDescriptor,\n /** The pagination cursor to be used for the next page load. */\n cursor?: C,\n /** The updated filter text for the list. */\n filterText?: string\n}\n\ninterface AsyncListState<T, C> extends ListState<T> {\n state: LoadingState,\n items: T[],\n // disabledKeys?: Iterable<Key>,\n selectedKeys: Selection,\n // selectedKey?: Key,\n // expandedKeys?: Iterable<Key>,\n sortDescriptor?: SortDescriptor,\n error?: Error,\n abortController?: AbortController,\n cursor?: C\n}\n\ntype ActionType = 'success' | 'error' | 'loading' | 'loadingMore' | 'sorting' | 'update' | 'filtering';\ninterface Action<T, C> {\n type: ActionType,\n items?: Iterable<T>,\n selectedKeys?: Iterable<Key>,\n sortDescriptor?: SortDescriptor,\n error?: Error,\n abortController?: AbortController,\n updater?: (state: ListState<T>) => ListState<T>,\n cursor?: C,\n filterText?: string\n}\n\ninterface AsyncListData<T> extends ListData<T> {\n /** Whether data is currently being loaded. */\n isLoading: boolean,\n /** If loading data failed, then this contains the error that occurred. */\n error?: Error,\n // disabledKeys?: Set<Key>,\n // selectedKey?: Key,\n // expandedKeys?: Set<Key>,\n /** The current sort descriptor for the list. */\n sortDescriptor?: SortDescriptor,\n\n /** Reloads the data in the list. */\n reload(): void,\n /** Loads the next page of data in the list. */\n loadMore(): void,\n /** Triggers sorting for the list. */\n sort(descriptor: SortDescriptor): void,\n /** The current loading state for the list. */\n loadingState: LoadingState\n}\n\nfunction reducer<T, C>(data: AsyncListState<T, C>, action: Action<T, C>): AsyncListState<T, C> {\n let selectedKeys;\n switch (data.state) {\n case 'idle':\n case 'error':\n switch (action.type) {\n case 'loading':\n case 'loadingMore':\n case 'sorting':\n case 'filtering':\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: action.abortController\n };\n case 'update':\n return {\n ...data,\n ...action.updater(data)\n };\n case 'success':\n case 'error':\n return data;\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n case 'loading':\n case 'sorting':\n case 'filtering':\n switch (action.type) {\n case 'success':\n // Ignore if there is a newer abortcontroller in state.\n // This means that multiple requests were going at once.\n // We want to take only the latest result.\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n selectedKeys = action.selectedKeys ?? data.selectedKeys;\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: 'idle',\n items: [...action.items],\n selectedKeys: selectedKeys === 'all' ? 'all' : new Set(selectedKeys),\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: null,\n cursor: action.cursor\n };\n case 'error':\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n return {\n ...data,\n state: 'error',\n error: action.error,\n abortController: null\n };\n case 'loading':\n case 'loadingMore':\n case 'sorting':\n case 'filtering':\n // We're already loading, and another load was triggered at the same time.\n // We need to abort the previous load and start a new one.\n data.abortController.abort();\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n abortController: action.abortController\n };\n case 'update':\n // We're already loading, and an update happened at the same time (e.g. selectedKey changed).\n // Update data but don't abort previous load.\n return {\n ...data,\n ...action.updater(data)\n };\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n case 'loadingMore':\n switch (action.type) {\n case 'success':\n selectedKeys = (data.selectedKeys === 'all' || action.selectedKeys === 'all')\n ? 'all'\n : new Set([...data.selectedKeys, ...(action.selectedKeys ?? [])]);\n // Append the new items\n return {\n ...data,\n state: 'idle',\n items: [...data.items, ...action.items],\n selectedKeys,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: null,\n cursor: action.cursor\n };\n case 'error':\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n return {\n ...data,\n state: 'error',\n error: action.error\n };\n case 'loading':\n case 'sorting':\n case 'filtering':\n // We're already loading more, and another load was triggered at the same time.\n // We need to abort the previous load more and start a new one.\n data.abortController.abort();\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n abortController: action.abortController\n };\n case 'loadingMore':\n // If already loading more and another loading more is triggered, abort the new load more since\n // it is a duplicate request since the cursor hasn't been updated.\n // Do not overwrite the data.abortController\n action.abortController.abort();\n\n return data;\n case 'update':\n // We're already loading, and an update happened at the same time (e.g. selectedKey changed).\n // Update data but don't abort previous load.\n return {\n ...data,\n ...action.updater(data)\n };\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n default:\n throw new Error(`Invalid state \"${data.state}\"`);\n }\n}\n\n/**\n * Manages state for an immutable async loaded list data structure, and provides convenience methods to\n * update the data over time. Manages loading and error states, pagination, and sorting.\n */\nexport function useAsyncList<T, C = string>(options: AsyncListOptions<T, C>): AsyncListData<T> {\n const {\n load,\n sort,\n initialSelectedKeys,\n initialSortDescriptor,\n getKey = (item: any) => item.id || item.key,\n initialFilterText = ''\n } = options;\n\n let [data, dispatch] = useReducer<Reducer<AsyncListState<T, C>, Action<T, C>>>(reducer, {\n state: 'idle',\n error: null,\n items: [],\n selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys),\n sortDescriptor: initialSortDescriptor,\n filterText: initialFilterText\n });\n\n const dispatchFetch = async (action: Action<T, C>, fn: AsyncListLoadFunction<T, C>) => {\n let abortController = new AbortController();\n try {\n dispatch({...action, abortController});\n let previousFilterText = action.filterText ?? data.filterText;\n\n let response = await fn({\n items: data.items.slice(),\n selectedKeys: data.selectedKeys,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n signal: abortController.signal,\n cursor: action.type === 'loadingMore' ? data.cursor : null,\n filterText: previousFilterText\n });\n\n let filterText = response.filterText ?? previousFilterText;\n dispatch({type: 'success', ...response, abortController});\n\n // Fetch a new filtered list if filterText is updated via `load` response func rather than list.setFilterText\n // Only do this if not aborted (e.g. user triggers another filter action before load completes)\n if (filterText && (filterText !== previousFilterText) && !abortController.signal.aborted) {\n dispatchFetch({type: 'filtering', filterText}, load);\n }\n } catch (e) {\n dispatch({type: 'error', error: e, abortController});\n }\n };\n\n useEffect(() => {\n dispatchFetch({type: 'loading'}, load);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return {\n items: data.items,\n selectedKeys: data.selectedKeys,\n sortDescriptor: data.sortDescriptor,\n isLoading: data.state === 'loading' || data.state === 'loadingMore' || data.state === 'sorting' || data.state === 'filtering',\n loadingState: data.state,\n error: data.error,\n filterText: data.filterText,\n getItem(key: Key) {\n return data.items.find(item => getKey(item) === key);\n },\n reload() {\n dispatchFetch({type: 'loading'}, load);\n },\n loadMore() {\n // Ignore if already loading more or if performing server side filtering.\n if (data.state === 'loadingMore' || data.state === 'filtering' || data.cursor == null) {\n return;\n }\n\n dispatchFetch({type: 'loadingMore'}, load);\n },\n sort(sortDescriptor: SortDescriptor) {\n dispatchFetch({type: 'sorting', sortDescriptor}, sort || load);\n },\n ...createListActions({...options, getKey, cursor: data.cursor}, fn => {\n dispatch({type: 'update', updater: fn});\n }),\n setFilterText(filterText: string) {\n dispatchFetch({type: 'filtering', filterText}, load);\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, useMemo, useState} from 'react';\nimport {Selection} from '@react-types/shared';\n\ninterface ListOptions<T> {\n /** Initial items in the list. */\n initialItems?: T[],\n /** The keys for the initially selected items. */\n initialSelectedKeys?: 'all' | Iterable<Key>,\n /** The initial text to filter the list by. */\n initialFilterText?: string,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that returns whether a item matches the current filter text. */\n filter?: (item: T, filterText: string) => boolean\n}\n\nexport interface ListData<T> {\n /** The items in the list. */\n items: T[],\n\n /** The keys of the currently selected items in the list. */\n selectedKeys: Selection,\n\n /** Sets the selected keys. */\n setSelectedKeys(keys: Selection): void,\n\n /** The current filter text. */\n filterText: string,\n\n /** Sets the filter text. */\n setFilterText(filterText: string): void,\n\n /**\n * Gets an item from the list by key.\n * @param key - The key of the item to retrieve.\n */\n getItem(key: Key): T,\n\n /**\n * Inserts items into the list at the given index.\n * @param index - The index to insert into.\n * @param values - The values to insert.\n */\n insert(index: number, ...values: T[]): void,\n\n /**\n * Inserts items into the list before the item at the given key.\n * @param key - The key of the item to insert before.\n * @param values - The values to insert.\n */\n insertBefore(key: Key, ...values: T[]): void,\n\n /**\n * Inserts items into the list after the item at the given key.\n * @param key - The key of the item to insert after.\n * @param values - The values to insert.\n */\n insertAfter(key: Key, ...values: T[]): void,\n\n /**\n * Appends items to the list.\n * @param values - The values to insert.\n */\n append(...values: T[]): void,\n\n /**\n * Prepends items to the list.\n * @param value - The value to insert.\n */\n prepend(...values: T[]): void,\n\n /**\n * Removes items from the list by their keys.\n * @param keys - The keys of the item to remove.\n */\n remove(...keys: Key[]): void,\n\n /**\n * Removes all items from the list that are currently\n * in the set of selected items.\n */\n removeSelectedItems(): void,\n\n /**\n * Moves an item within the list.\n * @param key - The key of the item to move.\n * @param toIndex - The index to move the item to.\n */\n move(key: Key, toIndex: number): void,\n\n /**\n * Moves one or more items before a given key.\n * @param key - The key of the item to move the items before.\n * @param keys - The keys of the items to move.\n */\n moveBefore(key: Key, keys: Key[]): void,\n\n /**\n * Moves one or more items after a given key.\n * @param key - The key of the item to move the items after.\n * @param keys - The keys of the items to move.\n */\n moveAfter(key: Key, keys: Key[]): void,\n\n /**\n * Updates an item in the list.\n * @param key - The key of the item to update.\n * @param newValue - The new value for the item.\n */\n update(key: Key, newValue: T): void\n}\n\nexport interface ListState<T> {\n items: T[],\n selectedKeys: Selection,\n filterText: string\n}\n\ninterface CreateListOptions<T, C> extends ListOptions<T> {\n cursor?: C\n}\n\n/**\n * Manages state for an immutable list data structure, and provides convenience methods to\n * update the data over time.\n */\nexport function useListData<T>(options: ListOptions<T>): ListData<T> {\n let {\n initialItems = [],\n initialSelectedKeys,\n getKey = (item: any) => item.id || item.key,\n filter,\n initialFilterText = ''\n } = options;\n\n // Store both items and filteredItems in state so we can go back to the unfiltered list\n let [state, setState] = useState<ListState<T>>({\n items: initialItems,\n selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys || []),\n filterText: initialFilterText\n });\n\n let filteredItems = useMemo(\n () => filter ? state.items.filter(item => filter(item, state.filterText)) : state.items,\n [state.items, state.filterText, filter]);\n\n return {\n ...state,\n items: filteredItems,\n ...createListActions({getKey}, setState),\n getItem(key: Key) {\n return state.items.find(item => getKey(item) === key);\n }\n };\n}\n\nexport function createListActions<T, C>(opts: CreateListOptions<T, C>, dispatch: (updater: (state: ListState<T>) => ListState<T>) => void): Omit<ListData<T>, 'items' | 'selectedKeys' | 'getItem' | 'filterText'> {\n let {cursor, getKey} = opts;\n return {\n setSelectedKeys(selectedKeys: Selection) {\n dispatch(state => ({\n ...state,\n selectedKeys\n }));\n },\n setFilterText(filterText: string) {\n dispatch(state => ({\n ...state,\n filterText\n }));\n },\n insert(index: number, ...values: T[]) {\n dispatch(state => insert(state, index, ...values));\n },\n insertBefore(key: Key, ...values: T[]) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return;\n }\n\n return insert(state, index, ...values);\n });\n },\n insertAfter(key: Key, ...values: T[]) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return;\n }\n\n return insert(state, index + 1, ...values);\n });\n },\n prepend(...values: T[]) {\n dispatch(state => insert(state, 0, ...values));\n },\n append(...values: T[]) {\n dispatch(state => insert(state, state.items.length, ...values));\n },\n remove(...keys: Key[]) {\n dispatch(state => {\n let keySet = new Set(keys);\n let items = state.items.filter(item => !keySet.has(getKey(item)));\n\n let selection: Selection = 'all';\n if (state.selectedKeys !== 'all') {\n selection = new Set(state.selectedKeys);\n for (let key of keys) {\n selection.delete(key);\n }\n }\n if (cursor == null && items.length === 0) {\n selection = new Set();\n }\n\n return {\n ...state,\n items,\n selectedKeys: selection\n };\n });\n },\n removeSelectedItems() {\n dispatch(state => {\n if (state.selectedKeys === 'all') {\n return {\n ...state,\n items: [],\n selectedKeys: new Set()\n };\n }\n\n let selectedKeys = state.selectedKeys;\n let items = state.items.filter(item => !selectedKeys.has(getKey(item)));\n return {\n ...state,\n items,\n selectedKeys: new Set()\n };\n });\n },\n move(key: Key, toIndex: number) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return state;\n }\n\n let copy = state.items.slice();\n let [item] = copy.splice(index, 1);\n copy.splice(toIndex, 0, item);\n return {\n ...state,\n items: copy\n };\n });\n },\n moveBefore(key: Key, keys: Key[]) {\n dispatch(state => {\n let toIndex = state.items.findIndex(item => getKey(item) === key);\n if (toIndex === -1) {\n return state;\n }\n\n // Find indices of keys to move. Sort them so that the order in the list is retained.\n let indices = keys.map(key => state.items.findIndex(item => getKey(item) === key)).sort();\n return move(state, indices, toIndex);\n });\n },\n moveAfter(key: Key, keys: Key[]) {\n dispatch(state => {\n let toIndex = state.items.findIndex(item => getKey(item) === key);\n if (toIndex === -1) {\n return state;\n }\n\n let indices = keys.map(key => state.items.findIndex(item => getKey(item) === key)).sort();\n return move(state, indices, toIndex + 1);\n });\n },\n update(key: Key, newValue: T) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return state;\n }\n\n return {\n ...state,\n items: [\n ...state.items.slice(0, index),\n newValue,\n ...state.items.slice(index + 1)\n ]\n };\n });\n }\n };\n}\n\nfunction insert<T>(state: ListState<T>, index: number, ...values: T[]): ListState<T> {\n return {\n ...state,\n items: [\n ...state.items.slice(0, index),\n ...values,\n ...state.items.slice(index)\n ]\n };\n}\n\nfunction move<T>(state: ListState<T>, indices: number[], toIndex: number): ListState<T> {\n // Shift the target down by the number of items being moved from before the target\n for (let index of indices) {\n if (index < toIndex) {\n toIndex--;\n }\n }\n\n let moves = indices.map(from => ({\n from,\n to: toIndex++\n }));\n\n // Shift later from indices down if they have a larger index\n for (let i = 0; i < moves.length; i++) {\n let a = moves[i].from;\n for (let j = i; j < moves.length; j++) {\n let b = moves[j].from;\n\n if (b > a) {\n moves[j].from--;\n }\n }\n }\n\n // Interleave the moves so they can be applied one by one rather than all at once\n for (let i = 0; i < moves.length; i++) {\n let a = moves[i];\n for (let j = moves.length - 1; j > i; j--) {\n let b = moves[j];\n\n if (b.from < a.to) {\n a.to++;\n } else {\n b.from++;\n }\n }\n }\n\n let copy = state.items.slice();\n for (let move of moves) {\n let [item] = copy.splice(move.from, 1);\n copy.splice(move.to, 0, item);\n }\n\n return {\n ...state,\n items: copy\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, useMemo, useState} from 'react';\n\ninterface TreeOptions<T extends object> {\n /** Initial root items in the tree. */\n initialItems?: T[],\n /** The keys for the initially selected items. */\n initialSelectedKeys?: Iterable<Key>,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that returns the children for an item object. */\n getChildren?: (item: T) => T[]\n}\n\ninterface TreeNode<T extends object> {\n /** A unique key for the tree node. */\n key: Key,\n /** The key of the parent node. */\n parentKey: Key,\n /** The value object for the tree node. */\n value: T,\n /** Children of the tree node. */\n children: TreeNode<T>[]\n}\n\ninterface TreeData<T extends object> {\n /** The root nodes in the tree. */\n items: TreeNode<T>[],\n\n /** The keys of the currently selected items in the tree. */\n selectedKeys: Set<Key>,\n\n /** Sets the selected keys. */\n setSelectedKeys(keys: Set<Key>): void,\n\n /**\n * Gets a node from the tree by key.\n * @param key - The key of the item to retrieve.\n */\n getItem(key: Key): TreeNode<T>,\n\n /**\n * Inserts an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param index - The index within the parent to insert into.\n * @param value - The value to insert.\n */\n insert(parentKey: Key | null, index: number, ...values: T[]): void,\n\n /**\n * Inserts items into the list before the item at the given key.\n * @param key - The key of the item to insert before.\n * @param values - The values to insert.\n */\n insertBefore(key: Key, ...values: T[]): void,\n\n /**\n * Inserts items into the list after the item at the given key.\n * @param key - The key of the item to insert after.\n * @param values - The values to insert.\n */\n insertAfter(key: Key, ...values: T[]): void,\n\n /**\n * Appends an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n append(parentKey: Key | null, ...values: T[]): void,\n\n /**\n * Prepends an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n prepend(parentKey: Key | null, ...value: T[]): void,\n\n /**\n * Removes an item from the tree by its key.\n * @param key - The key of the item to remove.\n */\n remove(...keys: Key[]): void,\n\n /**\n * Removes all items from the tree that are currently\n * in the set of selected items.\n */\n removeSelectedItems(): void,\n\n /**\n * Moves an item within the tree.\n * @param key - The key of the item to move.\n * @param toParentKey - The key of the new parent to insert into.\n * @param index - The index within the new parent to insert at.\n */\n move(key: Key, toParentKey: Key, index: number): void,\n\n /**\n * Updates an item in the tree.\n * @param key - The key of the item to update.\n * @param newValue - The new value for the item.\n */\n update(key: Key, newValue: T): void\n}\n\n/**\n * Manages state for an immutable tree data structure, and provides convenience methods to\n * update the data over time.\n */\nexport function useTreeData<T extends object>(options: TreeOptions<T>): TreeData<T> {\n let {\n initialItems = [],\n initialSelectedKeys,\n getKey = (item: any) => item.id || item.key,\n getChildren = (item: any) => item.children\n } = options;\n let map = useMemo(() => new Map<Key, TreeNode<T>>(), []);\n\n // We only want to compute this on initial render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let initialNodes = useMemo(() => buildTree(initialItems), []);\n let [items, setItems] = useState(initialNodes);\n let [selectedKeys, setSelectedKeys] = useState(new Set<Key>(initialSelectedKeys || []));\n\n function buildTree(initialItems: T[] = [], parentKey?: Key | null) {\n return initialItems.map(item => {\n let node: TreeNode<T> = {\n key: getKey(item),\n parentKey: parentKey,\n value: item,\n children: null\n };\n\n node.children = buildTree(getChildren(item), node.key);\n map.set(node.key, node);\n return node;\n });\n }\n\n function updateTree(items: TreeNode<T>[], key: Key, update: (node: TreeNode<T>) => TreeNode<T>) {\n let node = map.get(key);\n if (!node) {\n return items;\n }\n\n // Create a new node. If null, then delete the node, otherwise replace.\n let newNode = update(node);\n if (newNode == null) {\n deleteNode(node);\n } else {\n addNode(newNode);\n }\n\n // Walk up the tree and update each parent to refer to the new chilren.\n while (node.parentKey) {\n let nextParent = map.get(node.parentKey);\n let copy: TreeNode<T> = {\n key: nextParent.key,\n parentKey: nextParent.parentKey,\n value: nextParent.value,\n children: null\n };\n\n let children = nextParent.children;\n if (newNode == null) {\n children = children.filter(c => c !== node);\n }\n\n copy.children = children.map(child => {\n if (child === node) {\n return newNode;\n }\n\n return child;\n });\n\n map.set(copy.key, copy);\n\n newNode = copy;\n node = nextParent;\n }\n\n if (newNode == null) {\n items = items.filter(c => c !== node);\n }\n\n return items.map(item => {\n if (item === node) {\n return newNode;\n }\n\n return item;\n });\n }\n\n function addNode(node: TreeNode<T>) {\n map.set(node.key, node);\n for (let child of node.children) {\n addNode(child);\n }\n }\n\n function deleteNode(node: TreeNode<T>) {\n map.delete(node.key);\n for (let child of node.children) {\n deleteNode(child);\n }\n }\n\n return {\n items,\n selectedKeys,\n setSelectedKeys,\n getItem(key: Key) {\n return map.get(key);\n },\n insert(parentKey: Key | null, index: number, ...values: T[]) {\n setItems(items => {\n let nodes = buildTree(values, parentKey);\n\n // If parentKey is null, insert into the root.\n if (parentKey == null) {\n return [\n ...items.slice(0, index),\n ...nodes,\n ...items.slice(index)\n ];\n }\n\n // Otherwise, update the parent node and its ancestors.\n return updateTree(items, parentKey, parentNode => ({\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n children: [\n ...parentNode.children.slice(0, index),\n ...nodes,\n ...parentNode.children.slice(index)\n ]\n }));\n });\n },\n insertBefore(key: Key, ...values: T[]): void {\n let node = map.get(key);\n if (!node) {\n return;\n }\n\n let parentNode = map.get(node.parentKey);\n let nodes = parentNode ? parentNode.children : items;\n let index = nodes.indexOf(node);\n this.insert(parentNode?.key, index, ...values);\n },\n insertAfter(key: Key, ...values: T[]): void {\n let node = map.get(key);\n if (!node) {\n return;\n }\n\n let parentNode = map.get(node.parentKey);\n let nodes = parentNode ? parentNode.children : items;\n let index = nodes.indexOf(node);\n this.insert(parentNode?.key, index + 1, ...values);\n },\n prepend(parentKey: Key | null, ...values: T[]) {\n this.insert(parentKey, 0, ...values);\n },\n append(parentKey: Key | null, ...values: T[]) {\n if (parentKey == null) {\n this.insert(null, items.length, ...values);\n } else {\n let parentNode = map.get(parentKey);\n if (!parentNode) {\n return;\n }\n\n this.insert(parentKey, parentNode.children.length, ...values);\n }\n },\n remove(...keys: Key[]) {\n let newItems = items;\n for (let key of keys) {\n newItems = updateTree(newItems, key, () => null);\n }\n\n setItems(newItems);\n\n let selection = new Set(selectedKeys);\n for (let key of selectedKeys) {\n if (!map.has(key)) {\n selection.delete(key);\n }\n }\n\n setSelectedKeys(selection);\n },\n removeSelectedItems() {\n this.remove(...selectedKeys);\n },\n move(key: Key, toParentKey: Key, index: number) {\n setItems(items => {\n let node = map.get(key);\n if (!node) {\n return items;\n }\n\n items = updateTree(items, key, () => null);\n\n const movedNode = {\n ...node,\n parentKey: toParentKey\n };\n\n return updateTree(items, toParentKey, parentNode => ({\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n children: [\n ...parentNode.children.slice(0, index),\n movedNode,\n ...parentNode.children.slice(index)\n ]\n }));\n });\n },\n update(oldKey: Key, newValue: T) {\n setItems(items => updateTree(items, oldKey, oldNode => {\n let node: TreeNode<T> = {\n key: oldNode.key,\n parentKey: oldNode.parentKey,\n value: newValue,\n children: null\n };\n\n node.children = buildTree(getChildren(newValue), node.key);\n return node;\n }));\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;SE0IgB,yCAAW,CAAI,OAAuB,EAAe,CAAC;IACpE,GAAG,CAAC,CAAC,eACH,YAAY,GAAG,CAAC,CAAC,wBACjB,mBAAmB,WACnB,MAAM,IAAI,IAAS,GAAK,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG;eAC3C,MA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W,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG;oBACzD,MAAM,CAAC,IAAI;gBACb,CAAC;;QACH,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-stately/data/src/index.ts","packages/@react-stately/data/src/useAsyncList.ts","packages/@react-stately/data/src/useListData.ts","packages/@react-stately/data/src/useTreeData.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useAsyncList';\nexport * from './useTreeData';\nexport {useListData} from './useListData';\nexport type {ListData} from './useListData';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {createListActions, ListData, ListState} from './useListData';\nimport {Key, Reducer, useEffect, useReducer} from 'react';\nimport {LoadingState, Selection, SortDescriptor} from '@react-types/shared';\n\nexport interface AsyncListOptions<T, C> {\n /** The keys for the initially selected items. */\n initialSelectedKeys?: Iterable<Key>,\n /** The initial sort descriptor. */\n initialSortDescriptor?: SortDescriptor,\n /** The initial filter text. */\n initialFilterText?: string,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that loads the data for the items in the list. */\n load: AsyncListLoadFunction<T, C>,\n /**\n * An optional function that performs sorting. If not provided,\n * then `sortDescriptor` is passed to the `load` function.\n */\n sort?: AsyncListLoadFunction<T, C>\n}\n\ntype AsyncListLoadFunction<T, C> = (state: AsyncListLoadOptions<T, C>) => AsyncListStateUpdate<T, C> | Promise<AsyncListStateUpdate<T, C>>;\n\ninterface AsyncListLoadOptions<T, C> {\n /** The items currently in the list. */\n items: T[],\n /** The keys of the currently selected items in the list. */\n selectedKeys: Selection,\n /** The current sort descriptor for the list. */\n sortDescriptor: SortDescriptor,\n /** An abort signal used to notify the load function that the request has been aborted. */\n signal: AbortSignal,\n /** The pagination cursor returned from the last page load. */\n cursor?: C,\n /** The current filter text used to perform server side filtering. */\n filterText?: string,\n /** The current loading state of the list. */\n loadingState?: LoadingState\n}\n\ninterface AsyncListStateUpdate<T, C> {\n /** The new items to append to the list. */\n items: Iterable<T>,\n /** The keys to add to the selection. */\n selectedKeys?: Iterable<Key>,\n /** The sort descriptor to set. */\n sortDescriptor?: SortDescriptor,\n /** The pagination cursor to be used for the next page load. */\n cursor?: C,\n /** The updated filter text for the list. */\n filterText?: string\n}\n\ninterface AsyncListState<T, C> extends ListState<T> {\n state: LoadingState,\n items: T[],\n // disabledKeys?: Iterable<Key>,\n selectedKeys: Selection,\n // selectedKey?: Key,\n // expandedKeys?: Iterable<Key>,\n sortDescriptor?: SortDescriptor,\n error?: Error,\n abortController?: AbortController,\n cursor?: C\n}\n\ntype ActionType = 'success' | 'error' | 'loading' | 'loadingMore' | 'sorting' | 'update' | 'filtering';\ninterface Action<T, C> {\n type: ActionType,\n items?: Iterable<T>,\n selectedKeys?: Iterable<Key>,\n sortDescriptor?: SortDescriptor,\n error?: Error,\n abortController?: AbortController,\n updater?: (state: ListState<T>) => ListState<T>,\n cursor?: C,\n filterText?: string\n}\n\ninterface AsyncListData<T> extends ListData<T> {\n /** Whether data is currently being loaded. */\n isLoading: boolean,\n /** If loading data failed, then this contains the error that occurred. */\n error?: Error,\n // disabledKeys?: Set<Key>,\n // selectedKey?: Key,\n // expandedKeys?: Set<Key>,\n /** The current sort descriptor for the list. */\n sortDescriptor?: SortDescriptor,\n\n /** Reloads the data in the list. */\n reload(): void,\n /** Loads the next page of data in the list. */\n loadMore(): void,\n /** Triggers sorting for the list. */\n sort(descriptor: SortDescriptor): void,\n /** The current loading state for the list. */\n loadingState: LoadingState\n}\n\nfunction reducer<T, C>(data: AsyncListState<T, C>, action: Action<T, C>): AsyncListState<T, C> {\n let selectedKeys;\n switch (data.state) {\n case 'idle':\n case 'error':\n switch (action.type) {\n case 'loading':\n case 'loadingMore':\n case 'sorting':\n case 'filtering':\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: action.abortController\n };\n case 'update':\n return {\n ...data,\n ...action.updater(data)\n };\n case 'success':\n case 'error':\n return data;\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n case 'loading':\n case 'sorting':\n case 'filtering':\n switch (action.type) {\n case 'success':\n // Ignore if there is a newer abortcontroller in state.\n // This means that multiple requests were going at once.\n // We want to take only the latest result.\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n selectedKeys = action.selectedKeys ?? data.selectedKeys;\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: 'idle',\n items: [...action.items],\n selectedKeys: selectedKeys === 'all' ? 'all' : new Set(selectedKeys),\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: null,\n cursor: action.cursor\n };\n case 'error':\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n return {\n ...data,\n state: 'error',\n error: action.error,\n abortController: null\n };\n case 'loading':\n case 'loadingMore':\n case 'sorting':\n case 'filtering':\n // We're already loading, and another load was triggered at the same time.\n // We need to abort the previous load and start a new one.\n data.abortController.abort();\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n abortController: action.abortController\n };\n case 'update':\n // We're already loading, and an update happened at the same time (e.g. selectedKey changed).\n // Update data but don't abort previous load.\n return {\n ...data,\n ...action.updater(data)\n };\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n case 'loadingMore':\n switch (action.type) {\n case 'success':\n selectedKeys = (data.selectedKeys === 'all' || action.selectedKeys === 'all')\n ? 'all'\n : new Set([...data.selectedKeys, ...(action.selectedKeys ?? [])]);\n // Append the new items\n return {\n ...data,\n state: 'idle',\n items: [...data.items, ...action.items],\n selectedKeys,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n abortController: null,\n cursor: action.cursor\n };\n case 'error':\n if (action.abortController !== data.abortController) {\n return data;\n }\n\n return {\n ...data,\n state: 'error',\n error: action.error\n };\n case 'loading':\n case 'sorting':\n case 'filtering':\n // We're already loading more, and another load was triggered at the same time.\n // We need to abort the previous load more and start a new one.\n data.abortController.abort();\n return {\n ...data,\n filterText: action.filterText ?? data.filterText,\n state: action.type,\n // Reset items to an empty list if loading, but not when sorting.\n items: action.type === 'loading' ? [] : data.items,\n abortController: action.abortController\n };\n case 'loadingMore':\n // If already loading more and another loading more is triggered, abort the new load more since\n // it is a duplicate request since the cursor hasn't been updated.\n // Do not overwrite the data.abortController\n action.abortController.abort();\n\n return data;\n case 'update':\n // We're already loading, and an update happened at the same time (e.g. selectedKey changed).\n // Update data but don't abort previous load.\n return {\n ...data,\n ...action.updater(data)\n };\n default:\n throw new Error(`Invalid action \"${action.type}\" in state \"${data.state}\"`);\n }\n default:\n throw new Error(`Invalid state \"${data.state}\"`);\n }\n}\n\n/**\n * Manages state for an immutable async loaded list data structure, and provides convenience methods to\n * update the data over time. Manages loading and error states, pagination, and sorting.\n */\nexport function useAsyncList<T, C = string>(options: AsyncListOptions<T, C>): AsyncListData<T> {\n const {\n load,\n sort,\n initialSelectedKeys,\n initialSortDescriptor,\n getKey = (item: any) => item.id || item.key,\n initialFilterText = ''\n } = options;\n\n let [data, dispatch] = useReducer<Reducer<AsyncListState<T, C>, Action<T, C>>>(reducer, {\n state: 'idle',\n error: null,\n items: [],\n selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys),\n sortDescriptor: initialSortDescriptor,\n filterText: initialFilterText\n });\n\n const dispatchFetch = async (action: Action<T, C>, fn: AsyncListLoadFunction<T, C>) => {\n let abortController = new AbortController();\n try {\n dispatch({...action, abortController});\n let previousFilterText = action.filterText ?? data.filterText;\n\n let response = await fn({\n items: data.items.slice(),\n selectedKeys: data.selectedKeys,\n sortDescriptor: action.sortDescriptor ?? data.sortDescriptor,\n signal: abortController.signal,\n cursor: action.type === 'loadingMore' ? data.cursor : null,\n filterText: previousFilterText\n });\n\n let filterText = response.filterText ?? previousFilterText;\n dispatch({type: 'success', ...response, abortController});\n\n // Fetch a new filtered list if filterText is updated via `load` response func rather than list.setFilterText\n // Only do this if not aborted (e.g. user triggers another filter action before load completes)\n if (filterText && (filterText !== previousFilterText) && !abortController.signal.aborted) {\n dispatchFetch({type: 'filtering', filterText}, load);\n }\n } catch (e) {\n dispatch({type: 'error', error: e, abortController});\n }\n };\n\n useEffect(() => {\n dispatchFetch({type: 'loading'}, load);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return {\n items: data.items,\n selectedKeys: data.selectedKeys,\n sortDescriptor: data.sortDescriptor,\n isLoading: data.state === 'loading' || data.state === 'loadingMore' || data.state === 'sorting' || data.state === 'filtering',\n loadingState: data.state,\n error: data.error,\n filterText: data.filterText,\n getItem(key: Key) {\n return data.items.find(item => getKey(item) === key);\n },\n reload() {\n dispatchFetch({type: 'loading'}, load);\n },\n loadMore() {\n // Ignore if already loading more or if performing server side filtering.\n if (data.state === 'loadingMore' || data.state === 'filtering' || data.cursor == null) {\n return;\n }\n\n dispatchFetch({type: 'loadingMore'}, load);\n },\n sort(sortDescriptor: SortDescriptor) {\n dispatchFetch({type: 'sorting', sortDescriptor}, sort || load);\n },\n ...createListActions({...options, getKey, cursor: data.cursor}, fn => {\n dispatch({type: 'update', updater: fn});\n }),\n setFilterText(filterText: string) {\n dispatchFetch({type: 'filtering', filterText}, load);\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, useMemo, useState} from 'react';\nimport {Selection} from '@react-types/shared';\n\ninterface ListOptions<T> {\n /** Initial items in the list. */\n initialItems?: T[],\n /** The keys for the initially selected items. */\n initialSelectedKeys?: 'all' | Iterable<Key>,\n /** The initial text to filter the list by. */\n initialFilterText?: string,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that returns whether a item matches the current filter text. */\n filter?: (item: T, filterText: string) => boolean\n}\n\nexport interface ListData<T> {\n /** The items in the list. */\n items: T[],\n\n /** The keys of the currently selected items in the list. */\n selectedKeys: Selection,\n\n /** Sets the selected keys. */\n setSelectedKeys(keys: Selection): void,\n\n /** The current filter text. */\n filterText: string,\n\n /** Sets the filter text. */\n setFilterText(filterText: string): void,\n\n /**\n * Gets an item from the list by key.\n * @param key - The key of the item to retrieve.\n */\n getItem(key: Key): T,\n\n /**\n * Inserts items into the list at the given index.\n * @param index - The index to insert into.\n * @param values - The values to insert.\n */\n insert(index: number, ...values: T[]): void,\n\n /**\n * Inserts items into the list before the item at the given key.\n * @param key - The key of the item to insert before.\n * @param values - The values to insert.\n */\n insertBefore(key: Key, ...values: T[]): void,\n\n /**\n * Inserts items into the list after the item at the given key.\n * @param key - The key of the item to insert after.\n * @param values - The values to insert.\n */\n insertAfter(key: Key, ...values: T[]): void,\n\n /**\n * Appends items to the list.\n * @param values - The values to insert.\n */\n append(...values: T[]): void,\n\n /**\n * Prepends items to the list.\n * @param value - The value to insert.\n */\n prepend(...values: T[]): void,\n\n /**\n * Removes items from the list by their keys.\n * @param keys - The keys of the item to remove.\n */\n remove(...keys: Key[]): void,\n\n /**\n * Removes all items from the list that are currently\n * in the set of selected items.\n */\n removeSelectedItems(): void,\n\n /**\n * Moves an item within the list.\n * @param key - The key of the item to move.\n * @param toIndex - The index to move the item to.\n */\n move(key: Key, toIndex: number): void,\n\n /**\n * Moves one or more items before a given key.\n * @param key - The key of the item to move the items before.\n * @param keys - The keys of the items to move.\n */\n moveBefore(key: Key, keys: Key[]): void,\n\n /**\n * Moves one or more items after a given key.\n * @param key - The key of the item to move the items after.\n * @param keys - The keys of the items to move.\n */\n moveAfter(key: Key, keys: Key[]): void,\n\n /**\n * Updates an item in the list.\n * @param key - The key of the item to update.\n * @param newValue - The new value for the item.\n */\n update(key: Key, newValue: T): void\n}\n\nexport interface ListState<T> {\n items: T[],\n selectedKeys: Selection,\n filterText: string\n}\n\ninterface CreateListOptions<T, C> extends ListOptions<T> {\n cursor?: C\n}\n\n/**\n * Manages state for an immutable list data structure, and provides convenience methods to\n * update the data over time.\n */\nexport function useListData<T>(options: ListOptions<T>): ListData<T> {\n let {\n initialItems = [],\n initialSelectedKeys,\n getKey = (item: any) => item.id || item.key,\n filter,\n initialFilterText = ''\n } = options;\n\n // Store both items and filteredItems in state so we can go back to the unfiltered list\n let [state, setState] = useState<ListState<T>>({\n items: initialItems,\n selectedKeys: initialSelectedKeys === 'all' ? 'all' : new Set(initialSelectedKeys || []),\n filterText: initialFilterText\n });\n\n let filteredItems = useMemo(\n () => filter ? state.items.filter(item => filter(item, state.filterText)) : state.items,\n [state.items, state.filterText, filter]);\n\n return {\n ...state,\n items: filteredItems,\n ...createListActions({getKey}, setState),\n getItem(key: Key) {\n return state.items.find(item => getKey(item) === key);\n }\n };\n}\n\nexport function createListActions<T, C>(opts: CreateListOptions<T, C>, dispatch: (updater: (state: ListState<T>) => ListState<T>) => void): Omit<ListData<T>, 'items' | 'selectedKeys' | 'getItem' | 'filterText'> {\n let {cursor, getKey} = opts;\n return {\n setSelectedKeys(selectedKeys: Selection) {\n dispatch(state => ({\n ...state,\n selectedKeys\n }));\n },\n setFilterText(filterText: string) {\n dispatch(state => ({\n ...state,\n filterText\n }));\n },\n insert(index: number, ...values: T[]) {\n dispatch(state => insert(state, index, ...values));\n },\n insertBefore(key: Key, ...values: T[]) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return;\n }\n\n return insert(state, index, ...values);\n });\n },\n insertAfter(key: Key, ...values: T[]) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return;\n }\n\n return insert(state, index + 1, ...values);\n });\n },\n prepend(...values: T[]) {\n dispatch(state => insert(state, 0, ...values));\n },\n append(...values: T[]) {\n dispatch(state => insert(state, state.items.length, ...values));\n },\n remove(...keys: Key[]) {\n dispatch(state => {\n let keySet = new Set(keys);\n let items = state.items.filter(item => !keySet.has(getKey(item)));\n\n let selection: Selection = 'all';\n if (state.selectedKeys !== 'all') {\n selection = new Set(state.selectedKeys);\n for (let key of keys) {\n selection.delete(key);\n }\n }\n if (cursor == null && items.length === 0) {\n selection = new Set();\n }\n\n return {\n ...state,\n items,\n selectedKeys: selection\n };\n });\n },\n removeSelectedItems() {\n dispatch(state => {\n if (state.selectedKeys === 'all') {\n return {\n ...state,\n items: [],\n selectedKeys: new Set()\n };\n }\n\n let selectedKeys = state.selectedKeys;\n let items = state.items.filter(item => !selectedKeys.has(getKey(item)));\n return {\n ...state,\n items,\n selectedKeys: new Set()\n };\n });\n },\n move(key: Key, toIndex: number) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return state;\n }\n\n let copy = state.items.slice();\n let [item] = copy.splice(index, 1);\n copy.splice(toIndex, 0, item);\n return {\n ...state,\n items: copy\n };\n });\n },\n moveBefore(key: Key, keys: Key[]) {\n dispatch(state => {\n let toIndex = state.items.findIndex(item => getKey(item) === key);\n if (toIndex === -1) {\n return state;\n }\n\n // Find indices of keys to move. Sort them so that the order in the list is retained.\n let indices = keys.map(key => state.items.findIndex(item => getKey(item) === key)).sort();\n return move(state, indices, toIndex);\n });\n },\n moveAfter(key: Key, keys: Key[]) {\n dispatch(state => {\n let toIndex = state.items.findIndex(item => getKey(item) === key);\n if (toIndex === -1) {\n return state;\n }\n\n let indices = keys.map(key => state.items.findIndex(item => getKey(item) === key)).sort();\n return move(state, indices, toIndex + 1);\n });\n },\n update(key: Key, newValue: T) {\n dispatch(state => {\n let index = state.items.findIndex(item => getKey(item) === key);\n if (index === -1) {\n return state;\n }\n\n return {\n ...state,\n items: [\n ...state.items.slice(0, index),\n newValue,\n ...state.items.slice(index + 1)\n ]\n };\n });\n }\n };\n}\n\nfunction insert<T>(state: ListState<T>, index: number, ...values: T[]): ListState<T> {\n return {\n ...state,\n items: [\n ...state.items.slice(0, index),\n ...values,\n ...state.items.slice(index)\n ]\n };\n}\n\nfunction move<T>(state: ListState<T>, indices: number[], toIndex: number): ListState<T> {\n // Shift the target down by the number of items being moved from before the target\n for (let index of indices) {\n if (index < toIndex) {\n toIndex--;\n }\n }\n\n let moves = indices.map(from => ({\n from,\n to: toIndex++\n }));\n\n // Shift later from indices down if they have a larger index\n for (let i = 0; i < moves.length; i++) {\n let a = moves[i].from;\n for (let j = i; j < moves.length; j++) {\n let b = moves[j].from;\n\n if (b > a) {\n moves[j].from--;\n }\n }\n }\n\n // Interleave the moves so they can be applied one by one rather than all at once\n for (let i = 0; i < moves.length; i++) {\n let a = moves[i];\n for (let j = moves.length - 1; j > i; j--) {\n let b = moves[j];\n\n if (b.from < a.to) {\n a.to++;\n } else {\n b.from++;\n }\n }\n }\n\n let copy = state.items.slice();\n for (let move of moves) {\n let [item] = copy.splice(move.from, 1);\n copy.splice(move.to, 0, item);\n }\n\n return {\n ...state,\n items: copy\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, useMemo, useState} from 'react';\n\ninterface TreeOptions<T extends object> {\n /** Initial root items in the tree. */\n initialItems?: T[],\n /** The keys for the initially selected items. */\n initialSelectedKeys?: Iterable<Key>,\n /** A function that returns a unique key for an item object. */\n getKey?: (item: T) => Key,\n /** A function that returns the children for an item object. */\n getChildren?: (item: T) => T[]\n}\n\ninterface TreeNode<T extends object> {\n /** A unique key for the tree node. */\n key: Key,\n /** The key of the parent node. */\n parentKey: Key,\n /** The value object for the tree node. */\n value: T,\n /** Children of the tree node. */\n children: TreeNode<T>[]\n}\n\ninterface TreeData<T extends object> {\n /** The root nodes in the tree. */\n items: TreeNode<T>[],\n\n /** The keys of the currently selected items in the tree. */\n selectedKeys: Set<Key>,\n\n /** Sets the selected keys. */\n setSelectedKeys(keys: Set<Key>): void,\n\n /**\n * Gets a node from the tree by key.\n * @param key - The key of the item to retrieve.\n */\n getItem(key: Key): TreeNode<T>,\n\n /**\n * Inserts an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param index - The index within the parent to insert into.\n * @param value - The value to insert.\n */\n insert(parentKey: Key | null, index: number, ...values: T[]): void,\n\n /**\n * Inserts items into the list before the item at the given key.\n * @param key - The key of the item to insert before.\n * @param values - The values to insert.\n */\n insertBefore(key: Key, ...values: T[]): void,\n\n /**\n * Inserts items into the list after the item at the given key.\n * @param key - The key of the item to insert after.\n * @param values - The values to insert.\n */\n insertAfter(key: Key, ...values: T[]): void,\n\n /**\n * Appends an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n append(parentKey: Key | null, ...values: T[]): void,\n\n /**\n * Prepends an item into a parent node as a child.\n * @param parentKey - The key of the parent item to insert into. `null` for the root.\n * @param value - The value to insert.\n */\n prepend(parentKey: Key | null, ...value: T[]): void,\n\n /**\n * Removes an item from the tree by its key.\n * @param key - The key of the item to remove.\n */\n remove(...keys: Key[]): void,\n\n /**\n * Removes all items from the tree that are currently\n * in the set of selected items.\n */\n removeSelectedItems(): void,\n\n /**\n * Moves an item within the tree.\n * @param key - The key of the item to move.\n * @param toParentKey - The key of the new parent to insert into.\n * @param index - The index within the new parent to insert at.\n */\n move(key: Key, toParentKey: Key, index: number): void,\n\n /**\n * Updates an item in the tree.\n * @param key - The key of the item to update.\n * @param newValue - The new value for the item.\n */\n update(key: Key, newValue: T): void\n}\n\n/**\n * Manages state for an immutable tree data structure, and provides convenience methods to\n * update the data over time.\n */\nexport function useTreeData<T extends object>(options: TreeOptions<T>): TreeData<T> {\n let {\n initialItems = [],\n initialSelectedKeys,\n getKey = (item: any) => item.id || item.key,\n getChildren = (item: any) => item.children\n } = options;\n let map = useMemo(() => new Map<Key, TreeNode<T>>(), []);\n\n // We only want to compute this on initial render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let initialNodes = useMemo(() => buildTree(initialItems), []);\n let [items, setItems] = useState(initialNodes);\n let [selectedKeys, setSelectedKeys] = useState(new Set<Key>(initialSelectedKeys || []));\n\n function buildTree(initialItems: T[] = [], parentKey?: Key | null) {\n return initialItems.map(item => {\n let node: TreeNode<T> = {\n key: getKey(item),\n parentKey: parentKey,\n value: item,\n children: null\n };\n\n node.children = buildTree(getChildren(item), node.key);\n map.set(node.key, node);\n return node;\n });\n }\n\n function updateTree(items: TreeNode<T>[], key: Key, update: (node: TreeNode<T>) => TreeNode<T>) {\n let node = map.get(key);\n if (!node) {\n return items;\n }\n\n // Create a new node. If null, then delete the node, otherwise replace.\n let newNode = update(node);\n if (newNode == null) {\n deleteNode(node);\n } else {\n addNode(newNode);\n }\n\n // Walk up the tree and update each parent to refer to the new chilren.\n while (node.parentKey) {\n let nextParent = map.get(node.parentKey);\n let copy: TreeNode<T> = {\n key: nextParent.key,\n parentKey: nextParent.parentKey,\n value: nextParent.value,\n children: null\n };\n\n let children = nextParent.children;\n if (newNode == null) {\n children = children.filter(c => c !== node);\n }\n\n copy.children = children.map(child => {\n if (child === node) {\n return newNode;\n }\n\n return child;\n });\n\n map.set(copy.key, copy);\n\n newNode = copy;\n node = nextParent;\n }\n\n if (newNode == null) {\n items = items.filter(c => c !== node);\n }\n\n return items.map(item => {\n if (item === node) {\n return newNode;\n }\n\n return item;\n });\n }\n\n function addNode(node: TreeNode<T>) {\n map.set(node.key, node);\n for (let child of node.children) {\n addNode(child);\n }\n }\n\n function deleteNode(node: TreeNode<T>) {\n map.delete(node.key);\n for (let child of node.children) {\n deleteNode(child);\n }\n }\n\n return {\n items,\n selectedKeys,\n setSelectedKeys,\n getItem(key: Key) {\n return map.get(key);\n },\n insert(parentKey: Key | null, index: number, ...values: T[]) {\n setItems(items => {\n let nodes = buildTree(values, parentKey);\n\n // If parentKey is null, insert into the root.\n if (parentKey == null) {\n return [\n ...items.slice(0, index),\n ...nodes,\n ...items.slice(index)\n ];\n }\n\n // Otherwise, update the parent node and its ancestors.\n return updateTree(items, parentKey, parentNode => ({\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n children: [\n ...parentNode.children.slice(0, index),\n ...nodes,\n ...parentNode.children.slice(index)\n ]\n }));\n });\n },\n insertBefore(key: Key, ...values: T[]): void {\n let node = map.get(key);\n if (!node) {\n return;\n }\n\n let parentNode = map.get(node.parentKey);\n let nodes = parentNode ? parentNode.children : items;\n let index = nodes.indexOf(node);\n this.insert(parentNode?.key, index, ...values);\n },\n insertAfter(key: Key, ...values: T[]): void {\n let node = map.get(key);\n if (!node) {\n return;\n }\n\n let parentNode = map.get(node.parentKey);\n let nodes = parentNode ? parentNode.children : items;\n let index = nodes.indexOf(node);\n this.insert(parentNode?.key, index + 1, ...values);\n },\n prepend(parentKey: Key | null, ...values: T[]) {\n this.insert(parentKey, 0, ...values);\n },\n append(parentKey: Key | null, ...values: T[]) {\n if (parentKey == null) {\n this.insert(null, items.length, ...values);\n } else {\n let parentNode = map.get(parentKey);\n if (!parentNode) {\n return;\n }\n\n this.insert(parentKey, parentNode.children.length, ...values);\n }\n },\n remove(...keys: Key[]) {\n let newItems = items;\n for (let key of keys) {\n newItems = updateTree(newItems, key, () => null);\n }\n\n setItems(newItems);\n\n let selection = new Set(selectedKeys);\n for (let key of selectedKeys) {\n if (!map.has(key)) {\n selection.delete(key);\n }\n }\n\n setSelectedKeys(selection);\n },\n removeSelectedItems() {\n this.remove(...selectedKeys);\n },\n move(key: Key, toParentKey: Key, index: number) {\n setItems(items => {\n let node = map.get(key);\n if (!node) {\n return items;\n }\n\n items = updateTree(items, key, () => null);\n\n const movedNode = {\n ...node,\n parentKey: toParentKey\n };\n\n return updateTree(items, toParentKey, parentNode => ({\n key: parentNode.key,\n parentKey: parentNode.parentKey,\n value: parentNode.value,\n children: [\n ...parentNode.children.slice(0, index),\n movedNode,\n ...parentNode.children.slice(index)\n ]\n }));\n });\n },\n update(oldKey: Key, newValue: T) {\n setItems(items => updateTree(items, oldKey, oldNode => {\n let node: TreeNode<T> = {\n key: oldNode.key,\n parentKey: oldNode.parentKey,\n value: newValue,\n children: null\n };\n\n node.children = buildTree(getChildren(newValue), node.key);\n return node;\n }));\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/data",
|
|
3
|
-
"version": "3.4.5
|
|
3
|
+
"version": "3.4.5",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-types/shared": "3.
|
|
21
|
+
"@react-types/shared": "^3.11.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
|
|
30
30
|
}
|