@elliemae/ds-shared 2.3.0-alpha.8 → 2.3.0-next.2
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/esm/react-spring/index.js +1 -0
- package/esm/react-spring/renderprops.js +1 -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/types/Animations/BaseAnimation.d.ts +12 -0
- package/types/Animations/Grow.d.ts +11 -0
- package/types/Animations/GrowRight.d.ts +11 -0
- package/types/Animations/GrowVertical.d.ts +1 -0
- package/types/CheckableGroup.d.ts +20 -0
- package/types/DeferRenderAfterComputation.d.ts +6 -0
- package/types/FocusGroup/FocusGrid.d.ts +10 -0
- package/types/FocusGroup/FocusGroup.d.ts +36 -0
- package/types/FocusGroup/FocusGroupContext.d.ts +3 -0
- package/types/FocusGroup/FocusGroupManager.d.ts +24 -0
- 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/types/FocusGroup/utils/getNextCellPosition.d.ts +12 -0
- package/types/GroupContext/Group.d.ts +14 -0
- package/types/GroupContext/GroupContext.d.ts +2 -0
- package/types/GroupContext/GroupItem.d.ts +5 -0
- package/types/GroupContext/index.d.ts +3 -0
- package/types/ScrollSync/ScrollSync.d.ts +21 -0
- package/types/ScrollSync/ScrollSyncPane.d.ts +3 -0
- package/types/ScrollSync/ScrollSyncProvider.d.ts +12 -0
- package/types/ScrollSync/index.d.ts +2 -0
- package/types/ScrollSync/useScrollSync.d.ts +6 -0
- package/types/constants.d.ts +30 -0
- package/types/createDataInstance/createInstancePlugin.d.ts +1 -0
- package/types/createDataInstance/createInstanceRef.d.ts +12 -0
- package/types/createDataInstance/tests/createInstanceRef.test.d.ts +0 -0
- package/types/createDataInstance/utils.d.ts +9 -0
- package/types/dimsum.config.d.ts +4 -0
- package/types/index.d.ts +2 -0
- package/types/prop-types.d.ts +41 -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/types/useDataGrid/initColumnDefinition.d.ts +5 -0
- package/types/useDataGrid/useDataGrid.d.ts +8 -0
- package/types/useDataList/index.d.ts +1 -0
- package/types/useDataList/recordIterator.d.ts +1 -0
- package/types/useDataList/useDataList.d.ts +13 -0
- package/types/utils.d.ts +22 -0
- package/types/virtualization/AutoHeightList.d.ts +2 -0
- package/types/virtualization/FluidHeightList.d.ts +2 -0
- package/types/virtualization/index.d.ts +9 -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
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
13
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
14
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
15
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
16
|
+
var React = require('react');
|
|
17
|
+
var uuid = require('uuid');
|
|
18
|
+
var resolve = require('table-resolver');
|
|
19
|
+
var initColumnDefinition = require('./initColumnDefinition.js');
|
|
20
|
+
var utils$1 = require('../createDataInstance/utils.js');
|
|
21
|
+
var VolatileRowsListener = require('./VolatileRowsListener.js');
|
|
22
|
+
var utils = require('../utils.js');
|
|
23
|
+
|
|
24
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
|
+
|
|
26
|
+
function _interopNamespace(e) {
|
|
27
|
+
if (e && e.__esModule) return e;
|
|
28
|
+
var n = Object.create(null);
|
|
29
|
+
if (e) {
|
|
30
|
+
Object.keys(e).forEach(function (k) {
|
|
31
|
+
if (k !== 'default') {
|
|
32
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
33
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return e[k]; }
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
n["default"] = e;
|
|
41
|
+
return Object.freeze(n);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
45
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
46
|
+
var resolve__namespace = /*#__PURE__*/_interopNamespace(resolve);
|
|
47
|
+
|
|
48
|
+
const _excluded = ["uuid", "plugins", "rows", "columns", "renderers"];
|
|
49
|
+
|
|
50
|
+
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; }
|
|
51
|
+
|
|
52
|
+
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__default["default"](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; }
|
|
53
|
+
const IS_INTERNET_EXPLORER = utils.isInternetExplorer(); // TODO: Reuse createDataInstance for the grid the same
|
|
54
|
+
// way as the list does ex: packages/ds-shared/src/useDataList/useDataList.js
|
|
55
|
+
// eslint-disable-next-line max-statements
|
|
56
|
+
|
|
57
|
+
function useDataGrid(_ref) {
|
|
58
|
+
let {
|
|
59
|
+
uuid: uuidProp,
|
|
60
|
+
plugins: pluginsFromProps,
|
|
61
|
+
rows,
|
|
62
|
+
columns,
|
|
63
|
+
renderers = {}
|
|
64
|
+
} = _ref,
|
|
65
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
66
|
+
|
|
67
|
+
const plugins = pluginsFromProps;
|
|
68
|
+
const instance = React.useRef();
|
|
69
|
+
const tableRef = React.useRef();
|
|
70
|
+
const headerRef = React.useRef();
|
|
71
|
+
const bodyRef = React.useRef();
|
|
72
|
+
const bodyInnerRef = React.useRef();
|
|
73
|
+
const [uuid$1] = React.useState(uuidProp || (() => uuid.v4()));
|
|
74
|
+
const [hasScroll, setHasScroll] = React.useState(false);
|
|
75
|
+
const [isRowDragging, setIsRowDragging] = React.useState(false);
|
|
76
|
+
const isScrolling = React.useRef();
|
|
77
|
+
const shouldRefocus = React.useRef(); // todo: we probably need a plugin for focus related stuff
|
|
78
|
+
|
|
79
|
+
const [RowsObserver] = React.useState(() => new VolatileRowsListener()); // todo move this with rows composition
|
|
80
|
+
|
|
81
|
+
const [originalRows, updateRows] = dsUtilities.useDerivedStateFromProps(rows, {
|
|
82
|
+
onUpdate: resolve__namespace.resolve({
|
|
83
|
+
columns,
|
|
84
|
+
method: extra => dsUtilities.compose(resolve__namespace.byFunction('valueTransformation')(extra), resolve__namespace.nested(extra))
|
|
85
|
+
}),
|
|
86
|
+
updateOnStateChange: true
|
|
87
|
+
});
|
|
88
|
+
instance.current = {
|
|
89
|
+
decoratedRenderers: dsUtilities.cloneDeep(renderers),
|
|
90
|
+
decoratedColumns: columns,
|
|
91
|
+
columns,
|
|
92
|
+
rows,
|
|
93
|
+
composedRows: originalRows,
|
|
94
|
+
getRowProps: [],
|
|
95
|
+
getHeaderRowProps: [],
|
|
96
|
+
getBodyProps: [],
|
|
97
|
+
getTableProps: [],
|
|
98
|
+
effects: [],
|
|
99
|
+
uuid: uuid$1,
|
|
100
|
+
props,
|
|
101
|
+
refs: {
|
|
102
|
+
table: tableRef,
|
|
103
|
+
body: bodyRef,
|
|
104
|
+
header: headerRef,
|
|
105
|
+
innerBody: bodyInnerRef
|
|
106
|
+
},
|
|
107
|
+
state: {
|
|
108
|
+
hasScroll
|
|
109
|
+
},
|
|
110
|
+
actions: {
|
|
111
|
+
updateRows
|
|
112
|
+
},
|
|
113
|
+
updateRows,
|
|
114
|
+
// eslint-disable-next-line no-return-assign
|
|
115
|
+
enableEvents: () => document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? '' : null,
|
|
116
|
+
// eslint-disable-next-line no-return-assign
|
|
117
|
+
disableEvents: () => document.body.style.pointerEvents = 'none',
|
|
118
|
+
observeRows: observer => RowsObserver.observe(observer),
|
|
119
|
+
hotKeys: {},
|
|
120
|
+
shouldRefocus,
|
|
121
|
+
isScrolling,
|
|
122
|
+
setHasScroll,
|
|
123
|
+
setIsRowDragging,
|
|
124
|
+
isRowDragging,
|
|
125
|
+
plugins
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
instance.current.getState = () => instance.current.state;
|
|
129
|
+
|
|
130
|
+
instance.current.getInstance = () => instance.current;
|
|
131
|
+
|
|
132
|
+
const defaultDecorators = {
|
|
133
|
+
decorateGrid: [],
|
|
134
|
+
registerStateHook: [],
|
|
135
|
+
registerHotKeys: [],
|
|
136
|
+
decorateColumn: [],
|
|
137
|
+
decorateColumns: [cols => cols.map(col => initColumnDefinition["default"]({
|
|
138
|
+
useTextTruncation: col.useTextTruncation,
|
|
139
|
+
wrapText: props.wrapText,
|
|
140
|
+
normalize: props.normalizeDataKeys
|
|
141
|
+
})(col))],
|
|
142
|
+
decorateRenderers: [],
|
|
143
|
+
getRowProps: [],
|
|
144
|
+
getHeaderRowProps: [],
|
|
145
|
+
getBodyProps: [],
|
|
146
|
+
getTableProps: [],
|
|
147
|
+
getHeaderProps: [],
|
|
148
|
+
composeRows: []
|
|
149
|
+
};
|
|
150
|
+
const decorators = React.useMemo(() => {
|
|
151
|
+
let nextDecorators = defaultDecorators; // eslint-disable-next-line no-return-assign
|
|
152
|
+
|
|
153
|
+
plugins.forEach(plugin => nextDecorators = plugin(nextDecorators));
|
|
154
|
+
return nextDecorators;
|
|
155
|
+
}, [plugins]);
|
|
156
|
+
instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) => _objectSpread(_objectSpread({}, nextInstance), decorator(instance.current)), instance.current);
|
|
157
|
+
instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {
|
|
158
|
+
const {
|
|
159
|
+
state,
|
|
160
|
+
actions
|
|
161
|
+
} = decorator(instance.current);
|
|
162
|
+
return _objectSpread(_objectSpread({}, nextInstance), {}, {
|
|
163
|
+
state: _objectSpread(_objectSpread({}, nextInstance.state), state),
|
|
164
|
+
actions: _objectSpread(_objectSpread({}, nextInstance.actions), actions)
|
|
165
|
+
});
|
|
166
|
+
}, instance.current);
|
|
167
|
+
|
|
168
|
+
const reduceHotKey = (nextInstance, _ref2) => {
|
|
169
|
+
let {
|
|
170
|
+
key,
|
|
171
|
+
handler,
|
|
172
|
+
options
|
|
173
|
+
} = _ref2;
|
|
174
|
+
return _objectSpread(_objectSpread({}, nextInstance), {}, {
|
|
175
|
+
hotKeys: _objectSpread(_objectSpread({}, nextInstance.hotKeys), {}, {
|
|
176
|
+
[key]: {
|
|
177
|
+
handler,
|
|
178
|
+
options
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {
|
|
185
|
+
const hotKeys = decorator(nextInstance);
|
|
186
|
+
|
|
187
|
+
if (Array.isArray(hotKeys)) {
|
|
188
|
+
return hotKeys.reduce(reduceHotKey, nextInstance);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return reduceHotKey(nextInstance, hotKeys);
|
|
192
|
+
}, instance.current);
|
|
193
|
+
instance.current.decoratedRenderers = utils$1.applyDecorators(instance.current.decoratedRenderers, decorators.decorateRenderers, instance.current);
|
|
194
|
+
instance.current.decoratedColumns = React.useMemo(() => {
|
|
195
|
+
const visibleColumns = dsUtilities.cloneDeep(columns).filter(column => typeof column.visible === 'undefined' || column.visible);
|
|
196
|
+
return visibleColumns.length ? utils$1.decorateColumns(visibleColumns, decorators, instance.current) : [];
|
|
197
|
+
}, [columns]);
|
|
198
|
+
instance.current.getBodyProps = utils$1.reducePropsGetter(decorators.getBodyProps, instance.current);
|
|
199
|
+
instance.current.getHeaderProps = utils$1.reducePropsGetter(decorators.getHeaderProps, instance.current);
|
|
200
|
+
instance.current.getRowProps = utils$1.reducePropsGetter(decorators.getRowProps, instance.current);
|
|
201
|
+
instance.current.getHeaderRowProps = utils$1.reducePropsGetter(decorators.getHeaderRowProps, instance.current);
|
|
202
|
+
instance.current.getTableProps = utils$1.reducePropsGetter(decorators.getTableProps, instance.current);
|
|
203
|
+
instance.current.composedRows = decorators.composeRows.reduce((nextRows, getter) => getter(nextRows, instance.current), instance.current.composedRows);
|
|
204
|
+
RowsObserver.notify(instance.current.composedRows);
|
|
205
|
+
const currentShouldRefocus = instance.current.shouldRefocus.current;
|
|
206
|
+
const prevState = dsUtilities.usePrevious(instance.current.state);
|
|
207
|
+
|
|
208
|
+
if (dsUtilities.isObject(currentShouldRefocus) && currentShouldRefocus.forced) {
|
|
209
|
+
instance.current.shouldRefocus.current = currentShouldRefocus.value;
|
|
210
|
+
} else {
|
|
211
|
+
instance.current.shouldRefocus.current = !dsUtilities.isEqual(prevState, instance.current.state);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (props.instanceRef) dsUtilities.setRef(props.instanceRef, instance.current);
|
|
215
|
+
return _objectSpread(_objectSpread({}, instance.current), {}, {
|
|
216
|
+
decorators
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
module.exports = useDataGrid;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const defaultStrategy = () => {
|
|
6
|
+
throw Error('Implement an iterator strategy for record iterator');
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function recordIterator(records) {
|
|
10
|
+
let strategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultStrategy;
|
|
11
|
+
let decorators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
12
|
+
let instance = arguments.length > 3 ? arguments[3] : undefined;
|
|
13
|
+
const nextRows = [];
|
|
14
|
+
strategy({
|
|
15
|
+
data: records,
|
|
16
|
+
cb: row => {
|
|
17
|
+
let nextRow = row; // eslint-disable-next-line no-loops/no-loops,no-plusplus
|
|
18
|
+
|
|
19
|
+
for (let i = 0; i < decorators.length; i++) {
|
|
20
|
+
nextRow = decorators[i](nextRow, instance);
|
|
21
|
+
if (!nextRow) break;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (nextRow) nextRows.push(nextRow);
|
|
25
|
+
},
|
|
26
|
+
instance
|
|
27
|
+
});
|
|
28
|
+
return nextRows;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.recordIterator = recordIterator;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
13
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
14
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
15
|
+
var React = require('react');
|
|
16
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
17
|
+
var get = require('lodash/get');
|
|
18
|
+
var utils = require('../createDataInstance/utils.js');
|
|
19
|
+
var recordIterator = require('./recordIterator.js');
|
|
20
|
+
var createInstanceRef = require('../createDataInstance/createInstanceRef.js');
|
|
21
|
+
|
|
22
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
+
|
|
24
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
25
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
26
|
+
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
27
|
+
|
|
28
|
+
const _excluded = ["data", "plugins", "renderers", "itemRenderer", "customDecorators"];
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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__default["default"](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; }
|
|
33
|
+
const getItemLabel = function (record) {
|
|
34
|
+
let nameKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'name';
|
|
35
|
+
return get__default["default"](record, ['data', nameKey]);
|
|
36
|
+
};
|
|
37
|
+
const getItemChildren = function (record) {
|
|
38
|
+
let childrenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
39
|
+
return get__default["default"](record, ['data', childrenKey]);
|
|
40
|
+
};
|
|
41
|
+
const listRenderers = {
|
|
42
|
+
list: 'ul',
|
|
43
|
+
item: 'li'
|
|
44
|
+
}; // todo: check if a plugin is a LIST plugin rather than GRID
|
|
45
|
+
|
|
46
|
+
function useDataList(_ref) {
|
|
47
|
+
let {
|
|
48
|
+
data = [],
|
|
49
|
+
plugins = [],
|
|
50
|
+
renderers = listRenderers,
|
|
51
|
+
itemRenderer = [],
|
|
52
|
+
customDecorators
|
|
53
|
+
} = _ref,
|
|
54
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
55
|
+
|
|
56
|
+
const listRef = React.useRef();
|
|
57
|
+
const {
|
|
58
|
+
instance,
|
|
59
|
+
decorators
|
|
60
|
+
} = createInstanceRef(_objectSpread({
|
|
61
|
+
data,
|
|
62
|
+
renderers,
|
|
63
|
+
plugins,
|
|
64
|
+
customDecorators: _objectSpread(_objectSpread({}, customDecorators), {}, {
|
|
65
|
+
recordIterator: recordIterator.recordIterator,
|
|
66
|
+
getListProps: [],
|
|
67
|
+
getItemProps: [],
|
|
68
|
+
itemRenderer: [...itemRenderer],
|
|
69
|
+
// components reduce to compose item content
|
|
70
|
+
record: [],
|
|
71
|
+
records: []
|
|
72
|
+
})
|
|
73
|
+
}, props));
|
|
74
|
+
|
|
75
|
+
instance.current.getListRef = () => listRef;
|
|
76
|
+
|
|
77
|
+
instance.current.setListRef = ref => {
|
|
78
|
+
listRef.current = ref;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
instance.current.getItemLabel = record => getItemLabel(record, props.nameKey);
|
|
82
|
+
|
|
83
|
+
instance.current.getItemChildren = record => getItemChildren(record, props.childrenKey);
|
|
84
|
+
|
|
85
|
+
instance.current.decorators = decorators;
|
|
86
|
+
instance.current.getListProps = utils.reducePropsGetter(decorators.getListProps, instance.current);
|
|
87
|
+
instance.current.getItemProps = utils.reducePropsGetter(decorators.getItemProps, instance.current);
|
|
88
|
+
instance.current.itemRenderer = utils.composeFormatters(instance.current.decorators.itemRenderer, instance.current);
|
|
89
|
+
instance.current.records = React.useMemo(() => {
|
|
90
|
+
// record iterator TREE / Simple
|
|
91
|
+
let nextRecords = recordIterator.recordIterator(data, instance.current.decorators.recordIterator, decorators.record, instance.current); // compose all records
|
|
92
|
+
|
|
93
|
+
nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);
|
|
94
|
+
return nextRecords;
|
|
95
|
+
});
|
|
96
|
+
if (props.instanceRef) dsUtilities.setRef(props.instanceRef, instance.current);
|
|
97
|
+
return instance.current;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
exports["default"] = useDataList;
|
|
101
|
+
exports.getItemChildren = getItemChildren;
|
|
102
|
+
exports.getItemLabel = getItemLabel;
|
package/cjs/utils.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
13
|
+
|
|
14
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
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__default["default"](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; }
|
|
21
|
+
|
|
22
|
+
/* eslint-disable no-cond-assign */
|
|
23
|
+
const objectType = obj => Object.prototype.toString.call(obj).slice(8, -1);
|
|
24
|
+
const isDefined = param => typeof param !== 'undefined';
|
|
25
|
+
const isUndefined = param => typeof param === 'undefined';
|
|
26
|
+
const isFunction = param => typeof param === 'function';
|
|
27
|
+
const isNumber = param => typeof param === 'number' && !isNaN(param); // eslint-disable-line
|
|
28
|
+
|
|
29
|
+
const isString = str => objectType(str) === 'String';
|
|
30
|
+
const isArray = arr => objectType(arr) === 'Array';
|
|
31
|
+
const closest = (target, selector) => {
|
|
32
|
+
// closest(e.target, '.field')
|
|
33
|
+
while (target) {
|
|
34
|
+
// eslint-disable-line
|
|
35
|
+
if (target.matches && target.matches(selector)) return target;
|
|
36
|
+
if (target.msMatchesSelector && target.msMatchesSelector(selector)) return target; // eslint-disable-next-line no-param-reassign
|
|
37
|
+
|
|
38
|
+
target = target.parentNode;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
const getOffsetRect = elem => {
|
|
44
|
+
// (1)
|
|
45
|
+
const box = elem.getBoundingClientRect();
|
|
46
|
+
const {
|
|
47
|
+
body,
|
|
48
|
+
documentElement
|
|
49
|
+
} = document; // (2)
|
|
50
|
+
|
|
51
|
+
const scrollTop = window.pageYOffset || documentElement.scrollTop || body.scrollTop;
|
|
52
|
+
const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft; // (3)
|
|
53
|
+
|
|
54
|
+
const clientTop = documentElement.clientTop || body.clientTop || 0;
|
|
55
|
+
const clientLeft = documentElement.clientLeft || body.clientLeft || 0; // (4)
|
|
56
|
+
|
|
57
|
+
const top = box.top + scrollTop - clientTop;
|
|
58
|
+
const left = box.left + scrollLeft - clientLeft;
|
|
59
|
+
return {
|
|
60
|
+
top: Math.round(top),
|
|
61
|
+
left: Math.round(left)
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const getTotalScroll = elem => {
|
|
65
|
+
let top = 0;
|
|
66
|
+
let left = 0; // eslint-disable-next-line no-param-reassign
|
|
67
|
+
|
|
68
|
+
while (elem = elem.parentNode) {
|
|
69
|
+
top += elem.scrollTop || 0;
|
|
70
|
+
left += elem.scrollLeft || 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
top,
|
|
75
|
+
left
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
const getTransformProps = (x, y) => ({
|
|
79
|
+
transform: "translate(".concat(x, "px, ").concat(y, "px)")
|
|
80
|
+
});
|
|
81
|
+
const listWithChildren = (list, childrenProp) => list.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
82
|
+
[childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : []
|
|
83
|
+
}));
|
|
84
|
+
const getAllNonEmptyNodesIds = (items, childrenProp) => {
|
|
85
|
+
let childrenIds = [];
|
|
86
|
+
const ids = items.filter(item => item[childrenProp].length).map(item => {
|
|
87
|
+
childrenIds = childrenIds.concat(getAllNonEmptyNodesIds(item[childrenProp], childrenProp));
|
|
88
|
+
return item.id;
|
|
89
|
+
});
|
|
90
|
+
return ids.concat(childrenIds);
|
|
91
|
+
};
|
|
92
|
+
const isInternetExplorer = () => {
|
|
93
|
+
const ua = window.navigator.userAgent;
|
|
94
|
+
const msie = ua.indexOf('MSIE '); // If Internet Explorer, return version number
|
|
95
|
+
|
|
96
|
+
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\./)) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return false;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
exports.closest = closest;
|
|
104
|
+
exports.getAllNonEmptyNodesIds = getAllNonEmptyNodesIds;
|
|
105
|
+
exports.getOffsetRect = getOffsetRect;
|
|
106
|
+
exports.getTotalScroll = getTotalScroll;
|
|
107
|
+
exports.getTransformProps = getTransformProps;
|
|
108
|
+
exports.isArray = isArray;
|
|
109
|
+
exports.isDefined = isDefined;
|
|
110
|
+
exports.isFunction = isFunction;
|
|
111
|
+
exports.isInternetExplorer = isInternetExplorer;
|
|
112
|
+
exports.isNumber = isNumber;
|
|
113
|
+
exports.isString = isString;
|
|
114
|
+
exports.isUndefined = isUndefined;
|
|
115
|
+
exports.listWithChildren = listWithChildren;
|
|
116
|
+
exports.objectType = objectType;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
12
|
+
var React = require('react');
|
|
13
|
+
var reactWindow = require('react-window');
|
|
14
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
15
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
21
|
+
|
|
22
|
+
const _excluded = ["itemCount", "className", "innerRef", "itemData", "itemKey", "itemSize", "outerRef", "component"];
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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__default["default"](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; }
|
|
27
|
+
const AutoHeightList = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
28
|
+
let {
|
|
29
|
+
itemCount,
|
|
30
|
+
className,
|
|
31
|
+
innerRef,
|
|
32
|
+
itemData,
|
|
33
|
+
itemKey,
|
|
34
|
+
itemSize,
|
|
35
|
+
outerRef,
|
|
36
|
+
component: ListComponent = reactWindow.FixedSizeList
|
|
37
|
+
} = _ref,
|
|
38
|
+
otherProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
39
|
+
|
|
40
|
+
const listRef = React.useRef();
|
|
41
|
+
const outerListRef = React.useRef();
|
|
42
|
+
dsUtilities.useWindowScrollerList({
|
|
43
|
+
listInstance: listRef,
|
|
44
|
+
outerListRef
|
|
45
|
+
});
|
|
46
|
+
return /*#__PURE__*/jsxRuntime.jsx(ListComponent, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
47
|
+
ref: dsUtilities.mergeRefs(ref, listRef),
|
|
48
|
+
className: dsUtilities.cx(className, 'window-scroller-override'),
|
|
49
|
+
height: window.innerHeight,
|
|
50
|
+
innerRef: innerRef,
|
|
51
|
+
itemCount: itemCount,
|
|
52
|
+
itemData: itemData,
|
|
53
|
+
itemKey: itemKey,
|
|
54
|
+
itemSize: itemSize,
|
|
55
|
+
outerRef: dsUtilities.mergeRefs(outerListRef, outerRef),
|
|
56
|
+
overscanCount: 10,
|
|
57
|
+
useIsScrolling: true
|
|
58
|
+
}));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
exports.AutoHeightList = AutoHeightList;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
13
|
+
var React = require('react');
|
|
14
|
+
var AutoSizer = require('react-virtualized-auto-sizer');
|
|
15
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
20
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
21
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
22
|
+
var AutoSizer__default = /*#__PURE__*/_interopDefaultLegacy(AutoSizer);
|
|
23
|
+
|
|
24
|
+
const _excluded = ["component"];
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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__default["default"](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; }
|
|
29
|
+
const FluidHeightList = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
30
|
+
let {
|
|
31
|
+
component: Component
|
|
32
|
+
} = _ref,
|
|
33
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
34
|
+
|
|
35
|
+
return /*#__PURE__*/_jsx__default["default"](AutoSizer__default["default"], {
|
|
36
|
+
disableWidth: true
|
|
37
|
+
}, void 0, _ref2 => {
|
|
38
|
+
let {
|
|
39
|
+
height: fluidHeight
|
|
40
|
+
} = _ref2;
|
|
41
|
+
return /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread(_objectSpread({}, props), {}, {
|
|
42
|
+
ref: ref,
|
|
43
|
+
height: fluidHeight - 32 // taking in count the margins of the list
|
|
44
|
+
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
exports.FluidHeightList = FluidHeightList;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var FluidHeightList = require('./FluidHeightList.js');
|
|
6
|
+
var AutoHeightList = require('./AutoHeightList.js');
|
|
7
|
+
|
|
8
|
+
function getVirtualListComponent(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
component: Component,
|
|
11
|
+
fluid,
|
|
12
|
+
height,
|
|
13
|
+
autoHeight
|
|
14
|
+
} = _ref;
|
|
15
|
+
if (autoHeight) return AutoHeightList.AutoHeightList;
|
|
16
|
+
if (fluid) return FluidHeightList.FluidHeightList;
|
|
17
|
+
return Component;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.FluidHeightList = FluidHeightList.FluidHeightList;
|
|
21
|
+
exports.AutoHeightList = AutoHeightList.AutoHeightList;
|
|
22
|
+
exports.getVirtualListComponent = getVirtualListComponent;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { Transition } from 'react-spring/renderprops';
|
|
5
|
+
|
|
6
|
+
const BaseAnimation = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
keys = undefined,
|
|
9
|
+
items = [],
|
|
10
|
+
duration = 100,
|
|
11
|
+
enter = {},
|
|
12
|
+
from = {},
|
|
13
|
+
leave = {},
|
|
14
|
+
onRest = () => null,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/_jsx(Transition, {
|
|
18
|
+
config: {
|
|
19
|
+
duration
|
|
20
|
+
},
|
|
21
|
+
enter: enter,
|
|
22
|
+
from: from,
|
|
23
|
+
items: items,
|
|
24
|
+
keys: keys,
|
|
25
|
+
leave: leave,
|
|
26
|
+
onRest: onRest
|
|
27
|
+
}, void 0, children);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { BaseAnimation as default };
|