@workday/canvas-kit-react 9.0.0-alpha.416-next.18 → 9.0.0-alpha.417-next.19
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/collection/index.ts +1 -0
- package/collection/lib/useCursorListModel.tsx +17 -3
- package/collection/lib/useListItemAllowChildStrings.ts +3 -3
- package/collection/lib/useListItemRovingFocus.tsx +19 -7
- package/collection/lib/useListLoader.ts +313 -0
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts +303 -0
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts +9 -0
- package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarList.d.ts +9 -0
- package/dist/commonjs/action-bar/lib/ActionBarList.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarOverflowButton.d.ts +12 -0
- package/dist/commonjs/action-bar/lib/ActionBarOverflowButton.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/useActionBarModel.d.ts +153 -0
- package/dist/commonjs/action-bar/lib/useActionBarModel.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs.d.ts +312 -0
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts +12 -0
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.d.ts +9 -0
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsList.d.ts +6 -0
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsList.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsMenu.d.ts +144 -0
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsMenu.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsOverflowButton.d.ts +12 -0
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsOverflowButton.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/hooks/useBreadcrumbsModel.d.ts +153 -0
- package/dist/commonjs/breadcrumbs/lib/hooks/useBreadcrumbsModel.d.ts.map +1 -1
- package/dist/commonjs/collection/index.d.ts +1 -0
- package/dist/commonjs/collection/index.d.ts.map +1 -1
- package/dist/commonjs/collection/index.js +1 -0
- package/dist/commonjs/collection/lib/ListBox.d.ts +114 -0
- package/dist/commonjs/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts +310 -0
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.js +10 -0
- package/dist/commonjs/collection/lib/useGridModel.d.ts +111 -0
- package/dist/commonjs/collection/lib/useGridModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListItemAllowChildStrings.d.ts +6 -3
- package/dist/commonjs/collection/lib/useListItemAllowChildStrings.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListItemAllowChildStrings.js +3 -3
- package/dist/commonjs/collection/lib/useListItemRegister.d.ts +3 -0
- package/dist/commonjs/collection/lib/useListItemRegister.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListItemRovingFocus.d.ts +3 -1
- package/dist/commonjs/collection/lib/useListItemRovingFocus.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListItemRovingFocus.js +15 -8
- package/dist/commonjs/collection/lib/useListItemSelect.d.ts +3 -0
- package/dist/commonjs/collection/lib/useListItemSelect.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListLoader.d.ts +67 -0
- package/dist/commonjs/collection/lib/useListLoader.d.ts.map +1 -0
- package/dist/commonjs/collection/lib/useListLoader.js +213 -0
- package/dist/commonjs/collection/lib/useListModel.d.ts +111 -0
- package/dist/commonjs/collection/lib/useListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListResetCursorOnBlur.d.ts +3 -0
- package/dist/commonjs/collection/lib/useListResetCursorOnBlur.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListItemMeasure.d.ts +3 -0
- package/dist/commonjs/collection/lib/useOverflowListItemMeasure.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListMeasure.d.ts +3 -0
- package/dist/commonjs/collection/lib/useOverflowListMeasure.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListModel.d.ts +147 -0
- package/dist/commonjs/collection/lib/useOverflowListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListTarget.d.ts +3 -0
- package/dist/commonjs/collection/lib/useOverflowListTarget.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useSelectionListModel.d.ts +111 -0
- package/dist/commonjs/collection/lib/useSelectionListModel.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/Menu.d.ts +141 -0
- package/dist/commonjs/menu/lib/Menu.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuCard.d.ts +6 -0
- package/dist/commonjs/menu/lib/MenuCard.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuContextTarget.d.ts +9 -0
- package/dist/commonjs/menu/lib/MenuContextTarget.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuItem.d.ts +6 -1
- package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuList.d.ts +6 -0
- package/dist/commonjs/menu/lib/MenuList.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuPopper.d.ts +3 -0
- package/dist/commonjs/menu/lib/MenuPopper.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuTarget.d.ts +15 -0
- package/dist/commonjs/menu/lib/MenuTarget.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/useMenuModel.d.ts +129 -0
- package/dist/commonjs/menu/lib/useMenuModel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/Tabs.d.ts +450 -0
- package/dist/commonjs/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +12 -1
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsList.d.ts +12 -0
- package/dist/commonjs/tabs/lib/TabsList.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsMenuPopper.d.ts +3 -0
- package/dist/commonjs/tabs/lib/TabsMenuPopper.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsOverflowButton.d.ts +12 -0
- package/dist/commonjs/tabs/lib/TabsOverflowButton.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsPanel.d.ts +12 -0
- package/dist/commonjs/tabs/lib/TabsPanel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsPanels.d.ts +6 -0
- package/dist/commonjs/tabs/lib/TabsPanels.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts +405 -0
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/ActionBar.d.ts +303 -0
- package/dist/es6/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/ActionBarItem.d.ts +9 -0
- package/dist/es6/action-bar/lib/ActionBarItem.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/ActionBarList.d.ts +9 -0
- package/dist/es6/action-bar/lib/ActionBarList.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/ActionBarOverflowButton.d.ts +12 -0
- package/dist/es6/action-bar/lib/ActionBarOverflowButton.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/useActionBarModel.d.ts +153 -0
- package/dist/es6/action-bar/lib/useActionBarModel.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/Breadcrumbs.d.ts +312 -0
- package/dist/es6/breadcrumbs/lib/Breadcrumbs.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts +12 -0
- package/dist/es6/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.d.ts +9 -0
- package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsList.d.ts +6 -0
- package/dist/es6/breadcrumbs/lib/BreadcrumbsList.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsMenu.d.ts +144 -0
- package/dist/es6/breadcrumbs/lib/BreadcrumbsMenu.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsOverflowButton.d.ts +12 -0
- package/dist/es6/breadcrumbs/lib/BreadcrumbsOverflowButton.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/hooks/useBreadcrumbsModel.d.ts +153 -0
- package/dist/es6/breadcrumbs/lib/hooks/useBreadcrumbsModel.d.ts.map +1 -1
- package/dist/es6/collection/index.d.ts +1 -0
- package/dist/es6/collection/index.d.ts.map +1 -1
- package/dist/es6/collection/index.js +1 -0
- package/dist/es6/collection/lib/ListBox.d.ts +114 -0
- package/dist/es6/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/es6/collection/lib/useCursorListModel.d.ts +310 -0
- package/dist/es6/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useCursorListModel.js +10 -0
- package/dist/es6/collection/lib/useGridModel.d.ts +111 -0
- package/dist/es6/collection/lib/useGridModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListItemAllowChildStrings.d.ts +6 -3
- package/dist/es6/collection/lib/useListItemAllowChildStrings.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListItemAllowChildStrings.js +3 -3
- package/dist/es6/collection/lib/useListItemRegister.d.ts +3 -0
- package/dist/es6/collection/lib/useListItemRegister.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListItemRovingFocus.d.ts +3 -1
- package/dist/es6/collection/lib/useListItemRovingFocus.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListItemRovingFocus.js +15 -8
- package/dist/es6/collection/lib/useListItemSelect.d.ts +3 -0
- package/dist/es6/collection/lib/useListItemSelect.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListLoader.d.ts +67 -0
- package/dist/es6/collection/lib/useListLoader.d.ts.map +1 -0
- package/dist/es6/collection/lib/useListLoader.js +204 -0
- package/dist/es6/collection/lib/useListModel.d.ts +111 -0
- package/dist/es6/collection/lib/useListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListResetCursorOnBlur.d.ts +3 -0
- package/dist/es6/collection/lib/useListResetCursorOnBlur.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListItemMeasure.d.ts +3 -0
- package/dist/es6/collection/lib/useOverflowListItemMeasure.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListMeasure.d.ts +3 -0
- package/dist/es6/collection/lib/useOverflowListMeasure.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListModel.d.ts +147 -0
- package/dist/es6/collection/lib/useOverflowListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListTarget.d.ts +3 -0
- package/dist/es6/collection/lib/useOverflowListTarget.d.ts.map +1 -1
- package/dist/es6/collection/lib/useSelectionListModel.d.ts +111 -0
- package/dist/es6/collection/lib/useSelectionListModel.d.ts.map +1 -1
- package/dist/es6/menu/lib/Menu.d.ts +141 -0
- package/dist/es6/menu/lib/Menu.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuCard.d.ts +6 -0
- package/dist/es6/menu/lib/MenuCard.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuContextTarget.d.ts +9 -0
- package/dist/es6/menu/lib/MenuContextTarget.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuItem.d.ts +6 -1
- package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuList.d.ts +6 -0
- package/dist/es6/menu/lib/MenuList.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuPopper.d.ts +3 -0
- package/dist/es6/menu/lib/MenuPopper.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuTarget.d.ts +15 -0
- package/dist/es6/menu/lib/MenuTarget.d.ts.map +1 -1
- package/dist/es6/menu/lib/useMenuModel.d.ts +129 -0
- package/dist/es6/menu/lib/useMenuModel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/Tabs.d.ts +450 -0
- package/dist/es6/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.d.ts +12 -1
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsList.d.ts +12 -0
- package/dist/es6/tabs/lib/TabsList.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsMenuPopper.d.ts +3 -0
- package/dist/es6/tabs/lib/TabsMenuPopper.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsOverflowButton.d.ts +12 -0
- package/dist/es6/tabs/lib/TabsOverflowButton.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsPanel.d.ts +12 -0
- package/dist/es6/tabs/lib/TabsPanel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsPanels.d.ts +6 -0
- package/dist/es6/tabs/lib/TabsPanels.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.d.ts +405 -0
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useListLoader = exports.getPagesToLoad = exports.getPageNumber = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
/**
|
|
9
|
+
* A loading buffer is how many items we want to look at ahead of the current virtual window. A
|
|
10
|
+
* higher amount can load too many pages initially. A lower number can cause items to not be loaded
|
|
11
|
+
* yet when scrolling. This will probably become a floating number later based on scrolling speed.
|
|
12
|
+
* Ideally the faster the user scrolls, this number will be higher or "predict" where to focus loading
|
|
13
|
+
* so the user doesn't see unloaded items. But if the user is scrolling too fast, we may simply delay
|
|
14
|
+
* data loading. That logic would be based on timers. For now, we'll just hardcode.
|
|
15
|
+
*/
|
|
16
|
+
const loadingBuffer = 3;
|
|
17
|
+
function updateItems(newItems, startIndex = 0) {
|
|
18
|
+
return function itemStateUpdater(items) {
|
|
19
|
+
// replace existing indexes with data from external service
|
|
20
|
+
newItems.forEach((item, index) => {
|
|
21
|
+
items[index + startIndex] = item;
|
|
22
|
+
});
|
|
23
|
+
const returnedItems = items.concat([]);
|
|
24
|
+
return returnedItems; // return a new reference
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function load(params, loadCb, loadingCache) {
|
|
28
|
+
if (loadingCache[params.pageNumber]) {
|
|
29
|
+
return Promise.resolve({ updater: items => items });
|
|
30
|
+
}
|
|
31
|
+
loadingCache[params.pageNumber] = true;
|
|
32
|
+
return Promise.resolve(loadCb(params)).then(({ items, total }) => {
|
|
33
|
+
loadingCache[params.pageNumber] = false;
|
|
34
|
+
return { total, updater: updateItems(items, (params.pageNumber - 1) * params.pageSize) };
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function getPageNumber(index, pageSize) {
|
|
38
|
+
if (index <= 0) {
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
return Math.ceil((index + 1) / pageSize);
|
|
42
|
+
}
|
|
43
|
+
exports.getPageNumber = getPageNumber;
|
|
44
|
+
function clamp(input, min, max) {
|
|
45
|
+
return Math.max(Math.min(input, max), min);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param start The start index of the virtual window
|
|
50
|
+
* @param end The end index of the virtual window
|
|
51
|
+
* @param pageSize Expected load page size
|
|
52
|
+
* @param items Sparse array of all loaded items
|
|
53
|
+
* @param overScan How many items ahead we want to look ahead to trigger loading. Unloaded items
|
|
54
|
+
* that are this many items outside the current start and end numbers will trigger a loading of
|
|
55
|
+
* a page
|
|
56
|
+
*/
|
|
57
|
+
function getPagesToLoad(start, end, pageSize, items, overScan = 3) {
|
|
58
|
+
const pagesToLoad = [];
|
|
59
|
+
const lookBehindIndex = clamp(start - overScan, 0, items.length - 1);
|
|
60
|
+
if (start >= 0 && !items[lookBehindIndex]) {
|
|
61
|
+
const pageNumber = getPageNumber(lookBehindIndex, pageSize);
|
|
62
|
+
pagesToLoad.push(pageNumber);
|
|
63
|
+
}
|
|
64
|
+
const lookaheadIndex = clamp(end + overScan - 1, 0, items.length - 1);
|
|
65
|
+
if (end < items.length - 1 && !items[lookaheadIndex]) {
|
|
66
|
+
const pageNumber = getPageNumber(lookaheadIndex, pageSize);
|
|
67
|
+
if (!pagesToLoad.includes(pageNumber)) {
|
|
68
|
+
pagesToLoad.push(pageNumber);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return pagesToLoad;
|
|
72
|
+
}
|
|
73
|
+
exports.getPagesToLoad = getPagesToLoad;
|
|
74
|
+
const resetItems = (total) => Array(total).fill(undefined);
|
|
75
|
+
/**
|
|
76
|
+
* Create a data loader and a model. The model should be passed to a collection component. The
|
|
77
|
+
* loader can be used to manipulate filters, sorters, and clear cache.
|
|
78
|
+
*
|
|
79
|
+
* A simple loader using [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
|
80
|
+
* could look like the following:
|
|
81
|
+
*
|
|
82
|
+
* ```ts
|
|
83
|
+
* const {model, loader} = useListLoader(
|
|
84
|
+
* {
|
|
85
|
+
* total: 1000,
|
|
86
|
+
* pageSize: 20,
|
|
87
|
+
* async load({pageNumber, pageSize}) {
|
|
88
|
+
* return fetch('/myUrl')
|
|
89
|
+
* .then(response => response.json())
|
|
90
|
+
* .then(response => {
|
|
91
|
+
* return {total: response.total, items: response.items};
|
|
92
|
+
* });
|
|
93
|
+
* },
|
|
94
|
+
* },
|
|
95
|
+
* useListModel
|
|
96
|
+
* );
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @param config Config that contains the loader config and the model config
|
|
100
|
+
* @param modelHook A model hook that describes which model should be returned.
|
|
101
|
+
*/
|
|
102
|
+
function useListLoader(config, modelHook) {
|
|
103
|
+
const [total, setTotal] = react_1.default.useState(config.total);
|
|
104
|
+
const [items, setItems] = react_1.default.useState(() => {
|
|
105
|
+
return resetItems(config.total);
|
|
106
|
+
});
|
|
107
|
+
// keep track of pages that are currently loading
|
|
108
|
+
const loadingRef = react_1.default.useRef({});
|
|
109
|
+
const [filter, setFilter] = react_1.default.useState('');
|
|
110
|
+
const [sorter, setSorter] = react_1.default.useState('');
|
|
111
|
+
const updateItems = react_1.default.useCallback(({ updater, total: newTotal }) => {
|
|
112
|
+
if (newTotal !== undefined && total !== newTotal) {
|
|
113
|
+
setTotal(newTotal);
|
|
114
|
+
setItems(() => {
|
|
115
|
+
const items = resetItems(newTotal);
|
|
116
|
+
return updater(items);
|
|
117
|
+
});
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
setItems(updater);
|
|
121
|
+
}, [total]);
|
|
122
|
+
const updateFilter = (filter) => {
|
|
123
|
+
loadingRef.current = {};
|
|
124
|
+
setFilter(filter);
|
|
125
|
+
const params = {
|
|
126
|
+
pageNumber: 1,
|
|
127
|
+
pageSize: config.pageSize,
|
|
128
|
+
filter,
|
|
129
|
+
sorter,
|
|
130
|
+
};
|
|
131
|
+
load(params, loadRef.current, loadingRef.current).then(updateItems);
|
|
132
|
+
};
|
|
133
|
+
const updateSorter = (sorter) => {
|
|
134
|
+
loadingRef.current = {};
|
|
135
|
+
setSorter(sorter);
|
|
136
|
+
load({
|
|
137
|
+
pageNumber: 1,
|
|
138
|
+
pageSize: config.pageSize,
|
|
139
|
+
filter,
|
|
140
|
+
sorter,
|
|
141
|
+
}, loadRef.current, loadingRef.current).then(updateItems);
|
|
142
|
+
};
|
|
143
|
+
// Our `useEffect` functions use `config.load`, but we don't want to rerun the effects if the user
|
|
144
|
+
// sends a different load function every render
|
|
145
|
+
const loadRef = react_1.default.useRef(config.load);
|
|
146
|
+
loadRef.current = config.load;
|
|
147
|
+
const itemsRef = react_1.default.useRef(items);
|
|
148
|
+
itemsRef.current = items;
|
|
149
|
+
const requestAnimationFrameRef = react_1.default.useRef(0);
|
|
150
|
+
const shouldLoadIndex = (navigationMethod, eventKey) => {
|
|
151
|
+
return (data) => {
|
|
152
|
+
const index = model.navigation[navigationMethod](model.state.cursorIndexRef.current, model);
|
|
153
|
+
if (!items[index]) {
|
|
154
|
+
load({
|
|
155
|
+
pageNumber: Math.floor(index / config.pageSize) + 1,
|
|
156
|
+
pageSize: config.pageSize,
|
|
157
|
+
filter,
|
|
158
|
+
sorter,
|
|
159
|
+
}, loadRef.current, loadingRef.current)
|
|
160
|
+
.then(updateItems)
|
|
161
|
+
.then(() => {
|
|
162
|
+
cancelAnimationFrame(requestAnimationFrameRef.current);
|
|
163
|
+
requestAnimationFrameRef.current = requestAnimationFrame(() => {
|
|
164
|
+
model.events[eventKey](data);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
return true;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
const model = modelHook(modelHook.mergeConfig(config, {
|
|
173
|
+
items,
|
|
174
|
+
shouldGoToNext: shouldLoadIndex('getNext', 'goToNext'),
|
|
175
|
+
shouldGoToPrevious: shouldLoadIndex('getPrevious', 'goToPrevious'),
|
|
176
|
+
shouldGoToLast: shouldLoadIndex('getLast', 'goToLast'),
|
|
177
|
+
shouldGoToFirst: shouldLoadIndex('getFirst', 'goToFirst'),
|
|
178
|
+
shouldGoToNextPage: shouldLoadIndex('getNextPage', 'goToNextPage'),
|
|
179
|
+
shouldGoToPreviousPage: shouldLoadIndex('getPreviousPage', 'goToPreviousPage'),
|
|
180
|
+
}));
|
|
181
|
+
const { virtualItems } = model.state.UNSTABLE_virtual;
|
|
182
|
+
// Our only signal to trigger loading is if our virtual indexes are too close to boundaries.
|
|
183
|
+
react_1.default.useEffect(() => {
|
|
184
|
+
if (!virtualItems.length) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const firstItem = virtualItems[0];
|
|
188
|
+
const lastItem = virtualItems[virtualItems.length - 1];
|
|
189
|
+
const pagesToLoad = getPagesToLoad(firstItem.index, lastItem.index, config.pageSize, itemsRef.current, loadingBuffer);
|
|
190
|
+
pagesToLoad.forEach(pageNumber => {
|
|
191
|
+
load({ pageNumber, pageSize: config.pageSize, filter, sorter }, loadRef.current, loadingRef.current).then(updateItems);
|
|
192
|
+
});
|
|
193
|
+
return () => {
|
|
194
|
+
cancelAnimationFrame(requestAnimationFrameRef.current);
|
|
195
|
+
};
|
|
196
|
+
}, [virtualItems, config.pageSize, filter, sorter, updateItems]);
|
|
197
|
+
// Typescript won't allow me to say the included model extends `useListModel` for some reason, so
|
|
198
|
+
// we have no way to type check it. Without the constraint, Typescript doesn't know how type it
|
|
199
|
+
// properly, so we have an `as any`.
|
|
200
|
+
return {
|
|
201
|
+
model: model,
|
|
202
|
+
loader: {
|
|
203
|
+
filter,
|
|
204
|
+
updateFilter,
|
|
205
|
+
sorter,
|
|
206
|
+
updateSorter,
|
|
207
|
+
// we reduce the ref instead of a state variable because the loader mutates this ref and
|
|
208
|
+
// triggers state changes when loading is finished.
|
|
209
|
+
isLoading: Object.values(loadingRef.current).reduce((loading, result) => loading || result, false),
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
exports.useListLoader = useListLoader;
|
|
@@ -61,6 +61,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
61
61
|
cursorId: string;
|
|
62
62
|
columnCount: number;
|
|
63
63
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
64
|
+
cursorIndexRef: {
|
|
65
|
+
readonly current: number;
|
|
66
|
+
};
|
|
64
67
|
UNSTABLE_virtual: {
|
|
65
68
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
66
69
|
totalSize: number;
|
|
@@ -83,6 +86,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
83
86
|
cursorId: string;
|
|
84
87
|
columnCount: number;
|
|
85
88
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
89
|
+
cursorIndexRef: {
|
|
90
|
+
readonly current: number;
|
|
91
|
+
};
|
|
86
92
|
UNSTABLE_virtual: {
|
|
87
93
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
88
94
|
totalSize: number;
|
|
@@ -105,6 +111,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
105
111
|
cursorId: string;
|
|
106
112
|
columnCount: number;
|
|
107
113
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
114
|
+
cursorIndexRef: {
|
|
115
|
+
readonly current: number;
|
|
116
|
+
};
|
|
108
117
|
UNSTABLE_virtual: {
|
|
109
118
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
110
119
|
totalSize: number;
|
|
@@ -129,6 +138,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
129
138
|
cursorId: string;
|
|
130
139
|
columnCount: number;
|
|
131
140
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
141
|
+
cursorIndexRef: {
|
|
142
|
+
readonly current: number;
|
|
143
|
+
};
|
|
132
144
|
UNSTABLE_virtual: {
|
|
133
145
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
134
146
|
totalSize: number;
|
|
@@ -151,6 +163,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
151
163
|
cursorId: string;
|
|
152
164
|
columnCount: number;
|
|
153
165
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
166
|
+
cursorIndexRef: {
|
|
167
|
+
readonly current: number;
|
|
168
|
+
};
|
|
154
169
|
UNSTABLE_virtual: {
|
|
155
170
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
156
171
|
totalSize: number;
|
|
@@ -173,6 +188,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
173
188
|
cursorId: string;
|
|
174
189
|
columnCount: number;
|
|
175
190
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
191
|
+
cursorIndexRef: {
|
|
192
|
+
readonly current: number;
|
|
193
|
+
};
|
|
176
194
|
UNSTABLE_virtual: {
|
|
177
195
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
178
196
|
totalSize: number;
|
|
@@ -195,6 +213,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
195
213
|
cursorId: string;
|
|
196
214
|
columnCount: number;
|
|
197
215
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
216
|
+
cursorIndexRef: {
|
|
217
|
+
readonly current: number;
|
|
218
|
+
};
|
|
198
219
|
UNSTABLE_virtual: {
|
|
199
220
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
200
221
|
totalSize: number;
|
|
@@ -217,6 +238,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
217
238
|
cursorId: string;
|
|
218
239
|
columnCount: number;
|
|
219
240
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
241
|
+
cursorIndexRef: {
|
|
242
|
+
readonly current: number;
|
|
243
|
+
};
|
|
220
244
|
UNSTABLE_virtual: {
|
|
221
245
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
222
246
|
totalSize: number;
|
|
@@ -239,6 +263,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
239
263
|
cursorId: string;
|
|
240
264
|
columnCount: number;
|
|
241
265
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
266
|
+
cursorIndexRef: {
|
|
267
|
+
readonly current: number;
|
|
268
|
+
};
|
|
242
269
|
UNSTABLE_virtual: {
|
|
243
270
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
244
271
|
totalSize: number;
|
|
@@ -261,6 +288,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
261
288
|
cursorId: string;
|
|
262
289
|
columnCount: number;
|
|
263
290
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
291
|
+
cursorIndexRef: {
|
|
292
|
+
readonly current: number;
|
|
293
|
+
};
|
|
264
294
|
UNSTABLE_virtual: {
|
|
265
295
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
266
296
|
totalSize: number;
|
|
@@ -283,6 +313,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
283
313
|
cursorId: string;
|
|
284
314
|
columnCount: number;
|
|
285
315
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
316
|
+
cursorIndexRef: {
|
|
317
|
+
readonly current: number;
|
|
318
|
+
};
|
|
286
319
|
UNSTABLE_virtual: {
|
|
287
320
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
288
321
|
totalSize: number;
|
|
@@ -305,6 +338,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
305
338
|
cursorId: string;
|
|
306
339
|
columnCount: number;
|
|
307
340
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
341
|
+
cursorIndexRef: {
|
|
342
|
+
readonly current: number;
|
|
343
|
+
};
|
|
308
344
|
UNSTABLE_virtual: {
|
|
309
345
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
310
346
|
totalSize: number;
|
|
@@ -327,6 +363,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
327
363
|
cursorId: string;
|
|
328
364
|
columnCount: number;
|
|
329
365
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
366
|
+
cursorIndexRef: {
|
|
367
|
+
readonly current: number;
|
|
368
|
+
};
|
|
330
369
|
UNSTABLE_virtual: {
|
|
331
370
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
332
371
|
totalSize: number;
|
|
@@ -349,6 +388,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
349
388
|
cursorId: string;
|
|
350
389
|
columnCount: number;
|
|
351
390
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
391
|
+
cursorIndexRef: {
|
|
392
|
+
readonly current: number;
|
|
393
|
+
};
|
|
352
394
|
UNSTABLE_virtual: {
|
|
353
395
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
354
396
|
totalSize: number;
|
|
@@ -374,6 +416,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
374
416
|
cursorId: string;
|
|
375
417
|
columnCount: number;
|
|
376
418
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
419
|
+
cursorIndexRef: {
|
|
420
|
+
readonly current: number;
|
|
421
|
+
};
|
|
377
422
|
UNSTABLE_virtual: {
|
|
378
423
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
379
424
|
totalSize: number;
|
|
@@ -398,6 +443,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
398
443
|
cursorId: string;
|
|
399
444
|
columnCount: number;
|
|
400
445
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
446
|
+
cursorIndexRef: {
|
|
447
|
+
readonly current: number;
|
|
448
|
+
};
|
|
401
449
|
UNSTABLE_virtual: {
|
|
402
450
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
403
451
|
totalSize: number;
|
|
@@ -422,6 +470,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
422
470
|
cursorId: string;
|
|
423
471
|
columnCount: number;
|
|
424
472
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
473
|
+
cursorIndexRef: {
|
|
474
|
+
readonly current: number;
|
|
475
|
+
};
|
|
425
476
|
UNSTABLE_virtual: {
|
|
426
477
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
427
478
|
totalSize: number;
|
|
@@ -447,6 +498,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
447
498
|
cursorId: string;
|
|
448
499
|
columnCount: number;
|
|
449
500
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
501
|
+
cursorIndexRef: {
|
|
502
|
+
readonly current: number;
|
|
503
|
+
};
|
|
450
504
|
UNSTABLE_virtual: {
|
|
451
505
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
452
506
|
totalSize: number;
|
|
@@ -469,6 +523,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
469
523
|
cursorId: string;
|
|
470
524
|
columnCount: number;
|
|
471
525
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
526
|
+
cursorIndexRef: {
|
|
527
|
+
readonly current: number;
|
|
528
|
+
};
|
|
472
529
|
UNSTABLE_virtual: {
|
|
473
530
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
474
531
|
totalSize: number;
|
|
@@ -491,6 +548,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
491
548
|
cursorId: string;
|
|
492
549
|
columnCount: number;
|
|
493
550
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
551
|
+
cursorIndexRef: {
|
|
552
|
+
readonly current: number;
|
|
553
|
+
};
|
|
494
554
|
UNSTABLE_virtual: {
|
|
495
555
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
496
556
|
totalSize: number;
|
|
@@ -515,6 +575,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
515
575
|
cursorId: string;
|
|
516
576
|
columnCount: number;
|
|
517
577
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
578
|
+
cursorIndexRef: {
|
|
579
|
+
readonly current: number;
|
|
580
|
+
};
|
|
518
581
|
UNSTABLE_virtual: {
|
|
519
582
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
520
583
|
totalSize: number;
|
|
@@ -537,6 +600,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
537
600
|
cursorId: string;
|
|
538
601
|
columnCount: number;
|
|
539
602
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
603
|
+
cursorIndexRef: {
|
|
604
|
+
readonly current: number;
|
|
605
|
+
};
|
|
540
606
|
UNSTABLE_virtual: {
|
|
541
607
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
542
608
|
totalSize: number;
|
|
@@ -559,6 +625,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
559
625
|
cursorId: string;
|
|
560
626
|
columnCount: number;
|
|
561
627
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
628
|
+
cursorIndexRef: {
|
|
629
|
+
readonly current: number;
|
|
630
|
+
};
|
|
562
631
|
UNSTABLE_virtual: {
|
|
563
632
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
564
633
|
totalSize: number;
|
|
@@ -581,6 +650,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
581
650
|
cursorId: string;
|
|
582
651
|
columnCount: number;
|
|
583
652
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
653
|
+
cursorIndexRef: {
|
|
654
|
+
readonly current: number;
|
|
655
|
+
};
|
|
584
656
|
UNSTABLE_virtual: {
|
|
585
657
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
586
658
|
totalSize: number;
|
|
@@ -603,6 +675,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
603
675
|
cursorId: string;
|
|
604
676
|
columnCount: number;
|
|
605
677
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
678
|
+
cursorIndexRef: {
|
|
679
|
+
readonly current: number;
|
|
680
|
+
};
|
|
606
681
|
UNSTABLE_virtual: {
|
|
607
682
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
608
683
|
totalSize: number;
|
|
@@ -625,6 +700,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
625
700
|
cursorId: string;
|
|
626
701
|
columnCount: number;
|
|
627
702
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
703
|
+
cursorIndexRef: {
|
|
704
|
+
readonly current: number;
|
|
705
|
+
};
|
|
628
706
|
UNSTABLE_virtual: {
|
|
629
707
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
630
708
|
totalSize: number;
|
|
@@ -647,6 +725,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
647
725
|
cursorId: string;
|
|
648
726
|
columnCount: number;
|
|
649
727
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
728
|
+
cursorIndexRef: {
|
|
729
|
+
readonly current: number;
|
|
730
|
+
};
|
|
650
731
|
UNSTABLE_virtual: {
|
|
651
732
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
652
733
|
totalSize: number;
|
|
@@ -669,6 +750,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
669
750
|
cursorId: string;
|
|
670
751
|
columnCount: number;
|
|
671
752
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
753
|
+
cursorIndexRef: {
|
|
754
|
+
readonly current: number;
|
|
755
|
+
};
|
|
672
756
|
UNSTABLE_virtual: {
|
|
673
757
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
674
758
|
totalSize: number;
|
|
@@ -691,6 +775,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
691
775
|
cursorId: string;
|
|
692
776
|
columnCount: number;
|
|
693
777
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
778
|
+
cursorIndexRef: {
|
|
779
|
+
readonly current: number;
|
|
780
|
+
};
|
|
694
781
|
UNSTABLE_virtual: {
|
|
695
782
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
696
783
|
totalSize: number;
|
|
@@ -713,6 +800,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
713
800
|
cursorId: string;
|
|
714
801
|
columnCount: number;
|
|
715
802
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
803
|
+
cursorIndexRef: {
|
|
804
|
+
readonly current: number;
|
|
805
|
+
};
|
|
716
806
|
UNSTABLE_virtual: {
|
|
717
807
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
718
808
|
totalSize: number;
|
|
@@ -735,6 +825,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
735
825
|
cursorId: string;
|
|
736
826
|
columnCount: number;
|
|
737
827
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
828
|
+
cursorIndexRef: {
|
|
829
|
+
readonly current: number;
|
|
830
|
+
};
|
|
738
831
|
UNSTABLE_virtual: {
|
|
739
832
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
740
833
|
totalSize: number;
|
|
@@ -760,6 +853,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
760
853
|
cursorId: string;
|
|
761
854
|
columnCount: number;
|
|
762
855
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
856
|
+
cursorIndexRef: {
|
|
857
|
+
readonly current: number;
|
|
858
|
+
};
|
|
763
859
|
UNSTABLE_virtual: {
|
|
764
860
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
765
861
|
totalSize: number;
|
|
@@ -784,6 +880,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
784
880
|
cursorId: string;
|
|
785
881
|
columnCount: number;
|
|
786
882
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
883
|
+
cursorIndexRef: {
|
|
884
|
+
readonly current: number;
|
|
885
|
+
};
|
|
787
886
|
UNSTABLE_virtual: {
|
|
788
887
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
789
888
|
totalSize: number;
|
|
@@ -808,6 +907,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
808
907
|
cursorId: string;
|
|
809
908
|
columnCount: number;
|
|
810
909
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
910
|
+
cursorIndexRef: {
|
|
911
|
+
readonly current: number;
|
|
912
|
+
};
|
|
811
913
|
UNSTABLE_virtual: {
|
|
812
914
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
813
915
|
totalSize: number;
|
|
@@ -831,6 +933,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
831
933
|
cursorId: string;
|
|
832
934
|
columnCount: number;
|
|
833
935
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
936
|
+
cursorIndexRef: {
|
|
937
|
+
readonly current: number;
|
|
938
|
+
};
|
|
834
939
|
UNSTABLE_virtual: {
|
|
835
940
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
836
941
|
totalSize: number;
|
|
@@ -902,6 +1007,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
902
1007
|
cursorId: string;
|
|
903
1008
|
columnCount: number;
|
|
904
1009
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
1010
|
+
cursorIndexRef: {
|
|
1011
|
+
readonly current: number;
|
|
1012
|
+
};
|
|
905
1013
|
UNSTABLE_virtual: {
|
|
906
1014
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
907
1015
|
totalSize: number;
|
|
@@ -953,6 +1061,9 @@ export declare const useListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
953
1061
|
cursorId: string;
|
|
954
1062
|
columnCount: number;
|
|
955
1063
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
1064
|
+
cursorIndexRef: {
|
|
1065
|
+
readonly current: number;
|
|
1066
|
+
};
|
|
956
1067
|
UNSTABLE_virtual: {
|
|
957
1068
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
958
1069
|
totalSize: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListModel.tsx"],"names":[],"mappings":"AAOA,oBAAY,SAAS,CAAC,CAAC,GAAG,OAAO,IAAI;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;CAC5D,CAAC;AAEF,oBAAY,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"useListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListModel.tsx"],"names":[],"mappings":"AAOA,oBAAY,SAAS,CAAC,CAAC,GAAG,OAAO,IAAI;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;CAC5D,CAAC;AAEF,oBAAY,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA,CAAC"}
|
|
@@ -20,6 +20,9 @@ export declare const useListResetCursorOnBlur: import("@workday/canvas-kit-react
|
|
|
20
20
|
cursorId: string;
|
|
21
21
|
columnCount: number;
|
|
22
22
|
pageSizeRef: React.MutableRefObject<number>;
|
|
23
|
+
cursorIndexRef: {
|
|
24
|
+
readonly current: number;
|
|
25
|
+
};
|
|
23
26
|
UNSTABLE_virtual: {
|
|
24
27
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
25
28
|
totalSize: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListResetCursorOnBlur.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListResetCursorOnBlur.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"useListResetCursorOnBlur.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListResetCursorOnBlur.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAGhB,mBAAmB;;;EAetC,CAAC"}
|
|
@@ -20,6 +20,9 @@ export declare const useOverflowListItemMeasure: import("@workday/canvas-kit-rea
|
|
|
20
20
|
cursorId: string;
|
|
21
21
|
columnCount: number;
|
|
22
22
|
pageSizeRef: import("react").MutableRefObject<number>;
|
|
23
|
+
cursorIndexRef: {
|
|
24
|
+
readonly current: number;
|
|
25
|
+
};
|
|
23
26
|
UNSTABLE_virtual: {
|
|
24
27
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
25
28
|
totalSize: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverflowListItemMeasure.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useOverflowListItemMeasure.tsx"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"useOverflowListItemMeasure.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useOverflowListItemMeasure.tsx"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BtC,CAAC"}
|
|
@@ -14,6 +14,9 @@ export declare const useOverflowListMeasure: import("@workday/canvas-kit-react/c
|
|
|
14
14
|
cursorId: string;
|
|
15
15
|
columnCount: number;
|
|
16
16
|
pageSizeRef: React.MutableRefObject<number>;
|
|
17
|
+
cursorIndexRef: {
|
|
18
|
+
readonly current: number;
|
|
19
|
+
};
|
|
17
20
|
UNSTABLE_virtual: {
|
|
18
21
|
virtualItems: import("./react-virtual").VirtualItem[];
|
|
19
22
|
totalSize: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverflowListMeasure.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useOverflowListMeasure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;GAGG;AACH,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"useOverflowListMeasure.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useOverflowListMeasure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAalC,CAAC"}
|