@elliemae/ds-shared 2.3.0-alpha.9 → 2.3.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Animations/BaseAnimation.js +36 -0
- package/cjs/Animations/Grow.js +42 -0
- package/cjs/Animations/GrowRight.js +42 -0
- package/cjs/Animations/GrowVertical.js +7 -0
- package/cjs/CheckableGroup.js +74 -0
- package/cjs/DeferRenderAfterComputation.js +28 -0
- package/cjs/FocusGroup/FocusGrid.js +215 -0
- package/cjs/FocusGroup/FocusGroup.js +308 -0
- package/cjs/FocusGroup/FocusGroupContext.js +11 -0
- package/cjs/FocusGroup/FocusGroupManager.js +117 -0
- package/cjs/FocusGroup/focusGroupManagerHoc.js +44 -0
- package/cjs/FocusGroup/index.js +21 -0
- package/cjs/FocusGroup/useFocusGroupItem.js +59 -0
- package/cjs/FocusGroup/utils/getNextCellPosition.js +60 -0
- package/cjs/GroupContext/Group.js +124 -0
- package/cjs/GroupContext/GroupContext.js +13 -0
- package/cjs/GroupContext/GroupItem.js +22 -0
- package/cjs/GroupContext/index.js +13 -0
- package/cjs/ScrollSync/ScrollSync.js +153 -0
- package/cjs/ScrollSync/ScrollSyncPane.js +81 -0
- package/cjs/ScrollSync/ScrollSyncProvider.js +67 -0
- package/cjs/ScrollSync/index.js +11 -0
- package/cjs/ScrollSync/useScrollSync.js +10 -0
- package/cjs/constants.js +51 -0
- package/cjs/createDataInstance/createInstancePlugin.js +36 -0
- package/cjs/createDataInstance/createInstanceRef.js +97 -0
- package/cjs/createDataInstance/utils.js +123 -0
- package/cjs/defer-render-hoc/index.js +49 -0
- package/cjs/dimsum.config.js +7 -0
- package/cjs/index.js +17 -0
- package/cjs/prop-types.js +59 -0
- package/cjs/react-spring/index.js +14 -0
- package/cjs/react-spring/renderprops.js +14 -0
- package/cjs/toolbar/ToolbarProvider.js +123 -0
- package/cjs/useDataGrid/VolatileRowsListener.js +24 -0
- package/cjs/useDataGrid/index.js +7 -0
- package/cjs/useDataGrid/initColumnDefinition.js +146 -0
- package/cjs/useDataGrid/useDataGrid.js +220 -0
- package/cjs/useDataList/index.js +7 -0
- package/cjs/useDataList/recordIterator.js +31 -0
- package/cjs/useDataList/useDataList.js +102 -0
- package/cjs/utils.js +116 -0
- package/cjs/virtualization/AutoHeightList.js +61 -0
- package/cjs/virtualization/FluidHeightList.js +49 -0
- package/cjs/virtualization/index.js +22 -0
- package/esm/Animations/BaseAnimation.js +30 -0
- package/esm/Animations/Grow.js +36 -0
- package/esm/Animations/GrowRight.js +36 -0
- package/esm/Animations/GrowVertical.js +4 -0
- package/esm/CheckableGroup.js +64 -0
- package/esm/DeferRenderAfterComputation.js +22 -0
- package/esm/FocusGroup/FocusGrid.js +204 -0
- package/{dist/esm → esm}/FocusGroup/FocusGroup.js +137 -56
- package/esm/FocusGroup/FocusGroupContext.js +5 -0
- package/{dist/esm → esm}/FocusGroup/FocusGroupManager.js +38 -24
- package/esm/FocusGroup/focusGroupManagerHoc.js +37 -0
- package/esm/FocusGroup/index.js +6 -0
- package/esm/FocusGroup/useFocusGroupItem.js +50 -0
- package/{dist/esm → esm}/FocusGroup/utils/getNextCellPosition.js +25 -18
- package/esm/GroupContext/Group.js +118 -0
- package/esm/GroupContext/GroupContext.js +5 -0
- package/esm/GroupContext/GroupItem.js +16 -0
- package/esm/GroupContext/index.js +3 -0
- package/{dist/esm → esm}/ScrollSync/ScrollSync.js +64 -30
- package/esm/ScrollSync/ScrollSyncPane.js +74 -0
- package/esm/ScrollSync/ScrollSyncProvider.js +59 -0
- package/esm/ScrollSync/index.js +2 -0
- package/esm/ScrollSync/useScrollSync.js +8 -0
- package/esm/constants.js +32 -0
- package/esm/createDataInstance/createInstancePlugin.js +30 -0
- package/esm/createDataInstance/createInstanceRef.js +90 -0
- package/esm/createDataInstance/utils.js +107 -0
- package/esm/defer-render-hoc/index.js +41 -0
- package/esm/dimsum.config.js +5 -0
- package/esm/index.js +5 -0
- package/esm/prop-types.js +43 -0
- package/{dist/types/react-spring/index.d.ts → esm/react-spring/index.js} +0 -0
- package/{dist/types/react-spring/renderprops.d.ts → esm/react-spring/renderprops.js} +0 -0
- package/esm/toolbar/ToolbarProvider.js +111 -0
- package/esm/useDataGrid/VolatileRowsListener.js +22 -0
- package/esm/useDataGrid/index.js +1 -0
- package/esm/useDataGrid/initColumnDefinition.js +134 -0
- package/esm/useDataGrid/useDataGrid.js +194 -0
- package/esm/useDataList/index.js +1 -0
- package/esm/useDataList/recordIterator.js +27 -0
- package/esm/useDataList/useDataList.js +90 -0
- package/esm/utils.js +95 -0
- package/esm/virtualization/AutoHeightList.js +52 -0
- package/esm/virtualization/FluidHeightList.js +38 -0
- package/esm/virtualization/index.js +18 -0
- package/package.json +108 -110
- package/{dist/types → types}/Animations/BaseAnimation.d.ts +0 -1
- package/{dist/types → types}/Animations/Grow.d.ts +0 -1
- package/{dist/types → types}/Animations/GrowRight.d.ts +0 -1
- package/{dist/types → types}/Animations/GrowVertical.d.ts +0 -0
- package/{dist/types → types}/CheckableGroup.d.ts +0 -1
- package/types/DeferRenderAfterComputation.d.ts +6 -0
- package/types/FocusGroup/FocusGrid.d.ts +10 -0
- package/{dist/types → types}/FocusGroup/FocusGroup.d.ts +1 -3
- package/types/FocusGroup/FocusGroupContext.d.ts +3 -0
- package/{dist/types → types}/FocusGroup/FocusGroupManager.d.ts +1 -3
- package/types/FocusGroup/focusGroupManagerHoc.d.ts +7 -0
- package/types/FocusGroup/index.d.ts +6 -0
- package/types/FocusGroup/useFocusGroupItem.d.ts +2 -0
- package/{dist/types → types}/FocusGroup/utils/getNextCellPosition.d.ts +1 -3
- package/{dist/types → types}/GroupContext/Group.d.ts +0 -1
- package/{dist/types → types}/GroupContext/GroupContext.d.ts +0 -0
- package/{dist/types → types}/GroupContext/GroupItem.d.ts +0 -1
- package/types/GroupContext/index.d.ts +3 -0
- package/{dist/types → types}/ScrollSync/ScrollSync.d.ts +2 -4
- package/types/ScrollSync/ScrollSyncPane.d.ts +3 -0
- package/{dist/types → types}/ScrollSync/ScrollSyncProvider.d.ts +0 -0
- package/types/ScrollSync/index.d.ts +2 -0
- package/types/ScrollSync/useScrollSync.d.ts +6 -0
- package/{dist/types → types}/constants.d.ts +0 -0
- package/types/createDataInstance/createInstancePlugin.d.ts +1 -0
- package/{dist/types → types}/createDataInstance/createInstanceRef.d.ts +1 -3
- package/{dist/types → types}/createDataInstance/tests/createInstanceRef.test.d.ts +0 -0
- package/{dist/types → types}/createDataInstance/utils.d.ts +0 -0
- package/types/dimsum.config.d.ts +4 -0
- package/types/index.d.ts +2 -0
- package/{dist/types → types}/prop-types.d.ts +0 -0
- package/types/react-spring/index.d.ts +1 -0
- package/types/react-spring/renderprops.d.ts +1 -0
- package/types/toolbar/ToolbarProvider.d.ts +10 -0
- package/types/useDataGrid/VolatileRowsListener.d.ts +5 -0
- package/types/useDataGrid/index.d.ts +1 -0
- package/{dist/types → types}/useDataGrid/initColumnDefinition.d.ts +1 -2
- package/types/useDataGrid/useDataGrid.d.ts +8 -0
- package/types/useDataList/index.d.ts +1 -0
- package/{dist/types → types}/useDataList/recordIterator.d.ts +0 -0
- package/{dist/types → types}/useDataList/useDataList.d.ts +2 -3
- package/{dist/types → types}/utils.d.ts +0 -0
- package/{dist/types → types}/virtualization/AutoHeightList.d.ts +0 -0
- package/{dist/types → types}/virtualization/FluidHeightList.d.ts +0 -0
- package/{dist/types → types}/virtualization/index.d.ts +0 -0
- package/dist/cjs/Animations/BaseAnimation.js +0 -56
- package/dist/cjs/Animations/BaseAnimation.js.map +0 -7
- package/dist/cjs/Animations/Grow.js +0 -55
- package/dist/cjs/Animations/Grow.js.map +0 -7
- package/dist/cjs/Animations/GrowRight.js +0 -64
- package/dist/cjs/Animations/GrowRight.js.map +0 -7
- package/dist/cjs/Animations/GrowVertical.js +0 -47
- package/dist/cjs/Animations/GrowVertical.js.map +0 -7
- package/dist/cjs/CheckableGroup.js +0 -76
- package/dist/cjs/CheckableGroup.js.map +0 -7
- package/dist/cjs/DeferRenderAfterComputation.js +0 -52
- package/dist/cjs/DeferRenderAfterComputation.js.map +0 -7
- package/dist/cjs/FocusGroup/FocusGrid.js +0 -180
- package/dist/cjs/FocusGroup/FocusGrid.js.map +0 -7
- package/dist/cjs/FocusGroup/FocusGroup.js +0 -249
- package/dist/cjs/FocusGroup/FocusGroup.js.map +0 -7
- package/dist/cjs/FocusGroup/FocusGroupContext.js +0 -38
- package/dist/cjs/FocusGroup/FocusGroupContext.js.map +0 -7
- package/dist/cjs/FocusGroup/FocusGroupManager.js +0 -126
- package/dist/cjs/FocusGroup/FocusGroupManager.js.map +0 -7
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js +0 -54
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js.map +0 -7
- package/dist/cjs/FocusGroup/index.js +0 -47
- package/dist/cjs/FocusGroup/index.js.map +0 -7
- package/dist/cjs/FocusGroup/useFocusGroupItem.js +0 -67
- package/dist/cjs/FocusGroup/useFocusGroupItem.js.map +0 -7
- package/dist/cjs/FocusGroup/utils/getNextCellPosition.js +0 -80
- package/dist/cjs/FocusGroup/utils/getNextCellPosition.js.map +0 -7
- package/dist/cjs/GroupContext/Group.js +0 -115
- package/dist/cjs/GroupContext/Group.js.map +0 -7
- package/dist/cjs/GroupContext/GroupContext.js +0 -36
- package/dist/cjs/GroupContext/GroupContext.js.map +0 -7
- package/dist/cjs/GroupContext/GroupItem.js +0 -40
- package/dist/cjs/GroupContext/GroupItem.js.map +0 -7
- package/dist/cjs/GroupContext/index.js +0 -39
- package/dist/cjs/GroupContext/index.js.map +0 -7
- package/dist/cjs/ScrollSync/ScrollSync.js +0 -138
- package/dist/cjs/ScrollSync/ScrollSync.js.map +0 -7
- package/dist/cjs/ScrollSync/ScrollSyncPane.js +0 -73
- package/dist/cjs/ScrollSync/ScrollSyncPane.js.map +0 -7
- package/dist/cjs/ScrollSync/ScrollSyncProvider.js +0 -120
- package/dist/cjs/ScrollSync/ScrollSyncProvider.js.map +0 -7
- package/dist/cjs/ScrollSync/index.js +0 -37
- package/dist/cjs/ScrollSync/index.js.map +0 -7
- package/dist/cjs/ScrollSync/useScrollSync.js +0 -41
- package/dist/cjs/ScrollSync/useScrollSync.js.map +0 -7
- package/dist/cjs/constants.js +0 -70
- package/dist/cjs/constants.js.map +0 -7
- package/dist/cjs/createDataInstance/createInstancePlugin.js +0 -48
- package/dist/cjs/createDataInstance/createInstancePlugin.js.map +0 -7
- package/dist/cjs/createDataInstance/createInstanceRef.js +0 -92
- package/dist/cjs/createDataInstance/createInstanceRef.js.map +0 -7
- package/dist/cjs/createDataInstance/utils.js +0 -99
- package/dist/cjs/createDataInstance/utils.js.map +0 -7
- package/dist/cjs/defer-render-hoc/index.js +0 -56
- package/dist/cjs/defer-render-hoc/index.js.map +0 -7
- package/dist/cjs/dimsum.config.js +0 -39
- package/dist/cjs/dimsum.config.js.map +0 -7
- package/dist/cjs/index.js +0 -40
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/prop-types.js +0 -116
- package/dist/cjs/prop-types.js.map +0 -7
- package/dist/cjs/react-spring/index.js +0 -28
- package/dist/cjs/react-spring/index.js.map +0 -7
- package/dist/cjs/react-spring/renderprops.js +0 -28
- package/dist/cjs/react-spring/renderprops.js.map +0 -7
- package/dist/cjs/toolbar/ToolbarProvider.js +0 -111
- package/dist/cjs/toolbar/ToolbarProvider.js.map +0 -7
- package/dist/cjs/useDataGrid/VolatileRowsListener.js +0 -49
- package/dist/cjs/useDataGrid/VolatileRowsListener.js.map +0 -7
- package/dist/cjs/useDataGrid/index.js +0 -36
- package/dist/cjs/useDataGrid/index.js.map +0 -7
- package/dist/cjs/useDataGrid/initColumnDefinition.js +0 -141
- package/dist/cjs/useDataGrid/initColumnDefinition.js.map +0 -7
- package/dist/cjs/useDataGrid/useDataGrid.js +0 -194
- package/dist/cjs/useDataGrid/useDataGrid.js.map +0 -7
- package/dist/cjs/useDataList/index.js +0 -36
- package/dist/cjs/useDataList/index.js.map +0 -7
- package/dist/cjs/useDataList/recordIterator.js +0 -55
- package/dist/cjs/useDataList/recordIterator.js.map +0 -7
- package/dist/cjs/useDataList/useDataList.js +0 -93
- package/dist/cjs/useDataList/useDataList.js.map +0 -7
- package/dist/cjs/utils.js +0 -107
- package/dist/cjs/utils.js.map +0 -7
- package/dist/cjs/virtualization/AutoHeightList.js +0 -69
- package/dist/cjs/virtualization/AutoHeightList.js.map +0 -7
- package/dist/cjs/virtualization/FluidHeightList.js +0 -43
- package/dist/cjs/virtualization/FluidHeightList.js.map +0 -7
- package/dist/cjs/virtualization/index.js +0 -50
- package/dist/cjs/virtualization/index.js.map +0 -7
- package/dist/esm/Animations/BaseAnimation.js +0 -27
- package/dist/esm/Animations/BaseAnimation.js.map +0 -7
- package/dist/esm/Animations/Grow.js +0 -26
- package/dist/esm/Animations/Grow.js.map +0 -7
- package/dist/esm/Animations/GrowRight.js +0 -35
- package/dist/esm/Animations/GrowRight.js.map +0 -7
- package/dist/esm/Animations/GrowVertical.js +0 -29
- package/dist/esm/Animations/GrowVertical.js.map +0 -7
- package/dist/esm/CheckableGroup.js +0 -47
- package/dist/esm/CheckableGroup.js.map +0 -7
- package/dist/esm/DeferRenderAfterComputation.js +0 -23
- package/dist/esm/DeferRenderAfterComputation.js.map +0 -7
- package/dist/esm/FocusGroup/FocusGrid.js +0 -151
- package/dist/esm/FocusGroup/FocusGrid.js.map +0 -7
- package/dist/esm/FocusGroup/FocusGroup.js.map +0 -7
- package/dist/esm/FocusGroup/FocusGroupContext.js +0 -9
- package/dist/esm/FocusGroup/FocusGroupContext.js.map +0 -7
- package/dist/esm/FocusGroup/FocusGroupManager.js.map +0 -7
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js +0 -25
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js.map +0 -7
- package/dist/esm/FocusGroup/index.js +0 -18
- package/dist/esm/FocusGroup/index.js.map +0 -7
- package/dist/esm/FocusGroup/useFocusGroupItem.js +0 -38
- package/dist/esm/FocusGroup/useFocusGroupItem.js.map +0 -7
- package/dist/esm/FocusGroup/utils/getNextCellPosition.js.map +0 -7
- package/dist/esm/GroupContext/Group.js +0 -86
- package/dist/esm/GroupContext/Group.js.map +0 -7
- package/dist/esm/GroupContext/GroupContext.js +0 -7
- package/dist/esm/GroupContext/GroupContext.js.map +0 -7
- package/dist/esm/GroupContext/GroupItem.js +0 -11
- package/dist/esm/GroupContext/GroupItem.js.map +0 -7
- package/dist/esm/GroupContext/index.js +0 -10
- package/dist/esm/GroupContext/index.js.map +0 -7
- package/dist/esm/ScrollSync/ScrollSync.js.map +0 -7
- package/dist/esm/ScrollSync/ScrollSyncPane.js +0 -44
- package/dist/esm/ScrollSync/ScrollSyncPane.js.map +0 -7
- package/dist/esm/ScrollSync/ScrollSyncProvider.js +0 -91
- package/dist/esm/ScrollSync/ScrollSyncProvider.js.map +0 -7
- package/dist/esm/ScrollSync/index.js +0 -8
- package/dist/esm/ScrollSync/index.js.map +0 -7
- package/dist/esm/ScrollSync/useScrollSync.js +0 -12
- package/dist/esm/ScrollSync/useScrollSync.js.map +0 -7
- package/dist/esm/constants.js +0 -41
- package/dist/esm/constants.js.map +0 -7
- package/dist/esm/createDataInstance/createInstancePlugin.js +0 -19
- package/dist/esm/createDataInstance/createInstancePlugin.js.map +0 -7
- package/dist/esm/createDataInstance/createInstanceRef.js +0 -67
- package/dist/esm/createDataInstance/createInstanceRef.js.map +0 -7
- package/dist/esm/createDataInstance/utils.js +0 -70
- package/dist/esm/createDataInstance/utils.js.map +0 -7
- package/dist/esm/defer-render-hoc/index.js +0 -27
- package/dist/esm/defer-render-hoc/index.js.map +0 -7
- package/dist/esm/dimsum.config.js +0 -10
- package/dist/esm/dimsum.config.js.map +0 -7
- package/dist/esm/index.js +0 -11
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/prop-types.js +0 -87
- package/dist/esm/prop-types.js.map +0 -7
- package/dist/esm/react-spring/index.js +0 -3
- package/dist/esm/react-spring/index.js.map +0 -7
- package/dist/esm/react-spring/renderprops.js +0 -3
- package/dist/esm/react-spring/renderprops.js.map +0 -7
- package/dist/esm/toolbar/ToolbarProvider.js +0 -82
- package/dist/esm/toolbar/ToolbarProvider.js.map +0 -7
- package/dist/esm/useDataGrid/VolatileRowsListener.js +0 -20
- package/dist/esm/useDataGrid/VolatileRowsListener.js.map +0 -7
- package/dist/esm/useDataGrid/index.js +0 -7
- package/dist/esm/useDataGrid/index.js.map +0 -7
- package/dist/esm/useDataGrid/initColumnDefinition.js +0 -118
- package/dist/esm/useDataGrid/initColumnDefinition.js.map +0 -7
- package/dist/esm/useDataGrid/useDataGrid.js +0 -177
- package/dist/esm/useDataGrid/useDataGrid.js.map +0 -7
- package/dist/esm/useDataList/index.js +0 -7
- package/dist/esm/useDataList/index.js.map +0 -7
- package/dist/esm/useDataList/recordIterator.js +0 -26
- package/dist/esm/useDataList/recordIterator.js.map +0 -7
- package/dist/esm/useDataList/useDataList.js +0 -67
- package/dist/esm/useDataList/useDataList.js.map +0 -7
- package/dist/esm/utils.js +0 -78
- package/dist/esm/utils.js.map +0 -7
- package/dist/esm/virtualization/AutoHeightList.js +0 -40
- package/dist/esm/virtualization/AutoHeightList.js.map +0 -7
- package/dist/esm/virtualization/FluidHeightList.js +0 -14
- package/dist/esm/virtualization/FluidHeightList.js.map +0 -7
- package/dist/esm/virtualization/index.js +0 -21
- package/dist/esm/virtualization/index.js.map +0 -7
- package/dist/types/DeferRenderAfterComputation.d.ts +0 -7
- package/dist/types/FocusGroup/FocusGrid.d.ts +0 -12
- package/dist/types/FocusGroup/FocusGroupContext.d.ts +0 -4
- package/dist/types/FocusGroup/focusGroupManagerHoc.d.ts +0 -9
- package/dist/types/FocusGroup/index.d.ts +0 -6
- package/dist/types/FocusGroup/useFocusGroupItem.d.ts +0 -4
- package/dist/types/GroupContext/index.d.ts +0 -3
- package/dist/types/ScrollSync/ScrollSyncPane.d.ts +0 -3
- package/dist/types/ScrollSync/index.d.ts +0 -2
- package/dist/types/ScrollSync/useScrollSync.d.ts +0 -7
- package/dist/types/createDataInstance/createInstancePlugin.d.ts +0 -2
- package/dist/types/dimsum.config.d.ts +0 -5
- package/dist/types/index.d.ts +0 -2
- package/dist/types/toolbar/ToolbarProvider.d.ts +0 -5
- package/dist/types/useDataGrid/VolatileRowsListener.d.ts +0 -7
- package/dist/types/useDataGrid/index.d.ts +0 -1
- package/dist/types/useDataGrid/useDataGrid.d.ts +0 -9
- package/dist/types/useDataList/index.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useDataList.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const defaultStrategy = () => {
|
|
2
|
+
throw Error('Implement an iterator strategy for record iterator');
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
function recordIterator(records) {
|
|
6
|
+
let strategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultStrategy;
|
|
7
|
+
let decorators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
8
|
+
let instance = arguments.length > 3 ? arguments[3] : undefined;
|
|
9
|
+
const nextRows = [];
|
|
10
|
+
strategy({
|
|
11
|
+
data: records,
|
|
12
|
+
cb: row => {
|
|
13
|
+
let nextRow = row; // eslint-disable-next-line no-loops/no-loops,no-plusplus
|
|
14
|
+
|
|
15
|
+
for (let i = 0; i < decorators.length; i++) {
|
|
16
|
+
nextRow = decorators[i](nextRow, instance);
|
|
17
|
+
if (!nextRow) break;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (nextRow) nextRows.push(nextRow);
|
|
21
|
+
},
|
|
22
|
+
instance
|
|
23
|
+
});
|
|
24
|
+
return nextRows;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { recordIterator };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
5
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
6
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
11
|
+
import { useRef, useMemo } from 'react';
|
|
12
|
+
import { setRef } from '@elliemae/ds-utilities';
|
|
13
|
+
import get from 'lodash/get';
|
|
14
|
+
import { reducePropsGetter, composeFormatters } from '../createDataInstance/utils.js';
|
|
15
|
+
import { recordIterator } from './recordIterator.js';
|
|
16
|
+
import createDataInstanceRef from '../createDataInstance/createInstanceRef.js';
|
|
17
|
+
|
|
18
|
+
const _excluded = ["data", "plugins", "renderers", "itemRenderer", "customDecorators"];
|
|
19
|
+
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
const getItemLabel = function (record) {
|
|
24
|
+
let nameKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'name';
|
|
25
|
+
return get(record, ['data', nameKey]);
|
|
26
|
+
};
|
|
27
|
+
const getItemChildren = function (record) {
|
|
28
|
+
let childrenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
29
|
+
return get(record, ['data', childrenKey]);
|
|
30
|
+
};
|
|
31
|
+
const listRenderers = {
|
|
32
|
+
list: 'ul',
|
|
33
|
+
item: 'li'
|
|
34
|
+
}; // todo: check if a plugin is a LIST plugin rather than GRID
|
|
35
|
+
|
|
36
|
+
function useDataList(_ref) {
|
|
37
|
+
let {
|
|
38
|
+
data = [],
|
|
39
|
+
plugins = [],
|
|
40
|
+
renderers = listRenderers,
|
|
41
|
+
itemRenderer = [],
|
|
42
|
+
customDecorators
|
|
43
|
+
} = _ref,
|
|
44
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
|
|
46
|
+
const listRef = useRef();
|
|
47
|
+
const {
|
|
48
|
+
instance,
|
|
49
|
+
decorators
|
|
50
|
+
} = createDataInstanceRef(_objectSpread({
|
|
51
|
+
data,
|
|
52
|
+
renderers,
|
|
53
|
+
plugins,
|
|
54
|
+
customDecorators: _objectSpread(_objectSpread({}, customDecorators), {}, {
|
|
55
|
+
recordIterator,
|
|
56
|
+
getListProps: [],
|
|
57
|
+
getItemProps: [],
|
|
58
|
+
itemRenderer: [...itemRenderer],
|
|
59
|
+
// components reduce to compose item content
|
|
60
|
+
record: [],
|
|
61
|
+
records: []
|
|
62
|
+
})
|
|
63
|
+
}, props));
|
|
64
|
+
|
|
65
|
+
instance.current.getListRef = () => listRef;
|
|
66
|
+
|
|
67
|
+
instance.current.setListRef = ref => {
|
|
68
|
+
listRef.current = ref;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
instance.current.getItemLabel = record => getItemLabel(record, props.nameKey);
|
|
72
|
+
|
|
73
|
+
instance.current.getItemChildren = record => getItemChildren(record, props.childrenKey);
|
|
74
|
+
|
|
75
|
+
instance.current.decorators = decorators;
|
|
76
|
+
instance.current.getListProps = reducePropsGetter(decorators.getListProps, instance.current);
|
|
77
|
+
instance.current.getItemProps = reducePropsGetter(decorators.getItemProps, instance.current);
|
|
78
|
+
instance.current.itemRenderer = composeFormatters(instance.current.decorators.itemRenderer, instance.current);
|
|
79
|
+
instance.current.records = useMemo(() => {
|
|
80
|
+
// record iterator TREE / Simple
|
|
81
|
+
let nextRecords = recordIterator(data, instance.current.decorators.recordIterator, decorators.record, instance.current); // compose all records
|
|
82
|
+
|
|
83
|
+
nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);
|
|
84
|
+
return nextRecords;
|
|
85
|
+
});
|
|
86
|
+
if (props.instanceRef) setRef(props.instanceRef, instance.current);
|
|
87
|
+
return instance.current;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { useDataList as default, getItemChildren, getItemLabel };
|
package/esm/utils.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
|
+
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
|
|
14
|
+
/* eslint-disable no-cond-assign */
|
|
15
|
+
const objectType = obj => Object.prototype.toString.call(obj).slice(8, -1);
|
|
16
|
+
const isDefined = param => typeof param !== 'undefined';
|
|
17
|
+
const isUndefined = param => typeof param === 'undefined';
|
|
18
|
+
const isFunction = param => typeof param === 'function';
|
|
19
|
+
const isNumber = param => typeof param === 'number' && !isNaN(param); // eslint-disable-line
|
|
20
|
+
|
|
21
|
+
const isString = str => objectType(str) === 'String';
|
|
22
|
+
const isArray = arr => objectType(arr) === 'Array';
|
|
23
|
+
const closest = (target, selector) => {
|
|
24
|
+
// closest(e.target, '.field')
|
|
25
|
+
while (target) {
|
|
26
|
+
// eslint-disable-line
|
|
27
|
+
if (target.matches && target.matches(selector)) return target;
|
|
28
|
+
if (target.msMatchesSelector && target.msMatchesSelector(selector)) return target; // eslint-disable-next-line no-param-reassign
|
|
29
|
+
|
|
30
|
+
target = target.parentNode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
const getOffsetRect = elem => {
|
|
36
|
+
// (1)
|
|
37
|
+
const box = elem.getBoundingClientRect();
|
|
38
|
+
const {
|
|
39
|
+
body,
|
|
40
|
+
documentElement
|
|
41
|
+
} = document; // (2)
|
|
42
|
+
|
|
43
|
+
const scrollTop = window.pageYOffset || documentElement.scrollTop || body.scrollTop;
|
|
44
|
+
const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft; // (3)
|
|
45
|
+
|
|
46
|
+
const clientTop = documentElement.clientTop || body.clientTop || 0;
|
|
47
|
+
const clientLeft = documentElement.clientLeft || body.clientLeft || 0; // (4)
|
|
48
|
+
|
|
49
|
+
const top = box.top + scrollTop - clientTop;
|
|
50
|
+
const left = box.left + scrollLeft - clientLeft;
|
|
51
|
+
return {
|
|
52
|
+
top: Math.round(top),
|
|
53
|
+
left: Math.round(left)
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const getTotalScroll = elem => {
|
|
57
|
+
let top = 0;
|
|
58
|
+
let left = 0; // eslint-disable-next-line no-param-reassign
|
|
59
|
+
|
|
60
|
+
while (elem = elem.parentNode) {
|
|
61
|
+
top += elem.scrollTop || 0;
|
|
62
|
+
left += elem.scrollLeft || 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
top,
|
|
67
|
+
left
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
const getTransformProps = (x, y) => ({
|
|
71
|
+
transform: "translate(".concat(x, "px, ").concat(y, "px)")
|
|
72
|
+
});
|
|
73
|
+
const listWithChildren = (list, childrenProp) => list.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
74
|
+
[childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : []
|
|
75
|
+
}));
|
|
76
|
+
const getAllNonEmptyNodesIds = (items, childrenProp) => {
|
|
77
|
+
let childrenIds = [];
|
|
78
|
+
const ids = items.filter(item => item[childrenProp].length).map(item => {
|
|
79
|
+
childrenIds = childrenIds.concat(getAllNonEmptyNodesIds(item[childrenProp], childrenProp));
|
|
80
|
+
return item.id;
|
|
81
|
+
});
|
|
82
|
+
return ids.concat(childrenIds);
|
|
83
|
+
};
|
|
84
|
+
const isInternetExplorer = () => {
|
|
85
|
+
const ua = window.navigator.userAgent;
|
|
86
|
+
const msie = ua.indexOf('MSIE '); // If Internet Explorer, return version number
|
|
87
|
+
|
|
88
|
+
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\./)) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { closest, getAllNonEmptyNodesIds, getOffsetRect, getTotalScroll, getTransformProps, isArray, isDefined, isFunction, isInternetExplorer, isNumber, isString, isUndefined, listWithChildren, objectType };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
8
|
+
import { forwardRef, useRef } from 'react';
|
|
9
|
+
import { FixedSizeList } from 'react-window';
|
|
10
|
+
import { useWindowScrollerList, mergeRefs, cx } from '@elliemae/ds-utilities';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
const _excluded = ["itemCount", "className", "innerRef", "itemData", "itemKey", "itemSize", "outerRef", "component"];
|
|
14
|
+
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
const AutoHeightList = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
19
|
+
let {
|
|
20
|
+
itemCount,
|
|
21
|
+
className,
|
|
22
|
+
innerRef,
|
|
23
|
+
itemData,
|
|
24
|
+
itemKey,
|
|
25
|
+
itemSize,
|
|
26
|
+
outerRef,
|
|
27
|
+
component: ListComponent = FixedSizeList
|
|
28
|
+
} = _ref,
|
|
29
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
|
|
31
|
+
const listRef = useRef();
|
|
32
|
+
const outerListRef = useRef();
|
|
33
|
+
useWindowScrollerList({
|
|
34
|
+
listInstance: listRef,
|
|
35
|
+
outerListRef
|
|
36
|
+
});
|
|
37
|
+
return /*#__PURE__*/jsx(ListComponent, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
38
|
+
ref: mergeRefs(ref, listRef),
|
|
39
|
+
className: cx(className, 'window-scroller-override'),
|
|
40
|
+
height: window.innerHeight,
|
|
41
|
+
innerRef: innerRef,
|
|
42
|
+
itemCount: itemCount,
|
|
43
|
+
itemData: itemData,
|
|
44
|
+
itemKey: itemKey,
|
|
45
|
+
itemSize: itemSize,
|
|
46
|
+
outerRef: mergeRefs(outerListRef, outerRef),
|
|
47
|
+
overscanCount: 10,
|
|
48
|
+
useIsScrolling: true
|
|
49
|
+
}));
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export { AutoHeightList };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import { forwardRef } from 'react';
|
|
10
|
+
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
const _excluded = ["component"];
|
|
14
|
+
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
const FluidHeightList = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
19
|
+
let {
|
|
20
|
+
component: Component
|
|
21
|
+
} = _ref,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
|
|
24
|
+
return /*#__PURE__*/_jsx(AutoSizer, {
|
|
25
|
+
disableWidth: true
|
|
26
|
+
}, void 0, _ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
height: fluidHeight
|
|
29
|
+
} = _ref2;
|
|
30
|
+
return /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({}, props), {}, {
|
|
31
|
+
ref: ref,
|
|
32
|
+
height: fluidHeight - 32 // taking in count the margins of the list
|
|
33
|
+
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export { FluidHeightList };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FluidHeightList } from './FluidHeightList.js';
|
|
2
|
+
export { FluidHeightList } from './FluidHeightList.js';
|
|
3
|
+
import { AutoHeightList } from './AutoHeightList.js';
|
|
4
|
+
export { AutoHeightList } from './AutoHeightList.js';
|
|
5
|
+
|
|
6
|
+
function getVirtualListComponent(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
component: Component,
|
|
9
|
+
fluid,
|
|
10
|
+
height,
|
|
11
|
+
autoHeight
|
|
12
|
+
} = _ref;
|
|
13
|
+
if (autoHeight) return AutoHeightList;
|
|
14
|
+
if (fluid) return FluidHeightList;
|
|
15
|
+
return Component;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { getVirtualListComponent };
|