@elliemae/ds-shared 2.3.0-alpha.9 → 2.3.0-next.0
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,107 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
const reducePropsGetter = function () {
|
|
17
|
+
let decorators = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
18
|
+
let grid = arguments.length > 1 ? arguments[1] : undefined;
|
|
19
|
+
return function () {
|
|
20
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
|
+
let extraParams = arguments.length > 1 ? arguments[1] : undefined;
|
|
22
|
+
let nextProps = props;
|
|
23
|
+
decorators.forEach(decorator => {
|
|
24
|
+
nextProps = decorator(nextProps, grid, extraParams);
|
|
25
|
+
});
|
|
26
|
+
return nextProps;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/* eslint-disable-next-line max-params */
|
|
30
|
+
|
|
31
|
+
function evaluateTransforms(transforms, value) {
|
|
32
|
+
let extraParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
33
|
+
let props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
34
|
+
let grid = arguments.length > 4 ? arguments[4] : undefined;
|
|
35
|
+
let nextProps = props;
|
|
36
|
+
transforms.forEach(transform => {
|
|
37
|
+
nextProps = transform(value, extraParams, nextProps, grid);
|
|
38
|
+
});
|
|
39
|
+
return nextProps;
|
|
40
|
+
}
|
|
41
|
+
/* eslint-disable-next-line max-params */
|
|
42
|
+
|
|
43
|
+
function evaluateFormatters(formatters, value) {
|
|
44
|
+
let extraParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
45
|
+
let grid = arguments.length > 3 ? arguments[3] : undefined;
|
|
46
|
+
return formatters.reduce((result, formatter) => formatter(result, extraParams, grid), value);
|
|
47
|
+
}
|
|
48
|
+
function composeFormatters(formatters, instance) {
|
|
49
|
+
let getItemValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : record => record.data.name;
|
|
50
|
+
// todo: make the formatters subscribe to the item props instead of getting the whole instance
|
|
51
|
+
// todo: addd should formatter update to memoize specific ones
|
|
52
|
+
return props => formatters.reduce((result, formatter) => formatter(result, props, instance), getItemValue(props.record));
|
|
53
|
+
}
|
|
54
|
+
const applyDecorators = function (subject) {
|
|
55
|
+
let decorators = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
56
|
+
|
|
57
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
58
|
+
args[_key - 2] = arguments[_key];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return decorators.reduce((nextSubject, decorator) => decorator(nextSubject, ...args), subject);
|
|
62
|
+
};
|
|
63
|
+
const decorateColumns = (columns, decorators, grid) => {
|
|
64
|
+
const nextColumns = applyDecorators(columns, decorators.decorateColumns, grid);
|
|
65
|
+
return nextColumns.map((column, index) => applyDecorators(column, decorators.decorateColumn, grid, index));
|
|
66
|
+
};
|
|
67
|
+
const mergeInstance = (instance, instanceHook) => _objectSpread(_objectSpread({}, instance), instanceHook(instance));
|
|
68
|
+
const registerStateHookToInstance = (instance, stateHook) => {
|
|
69
|
+
const {
|
|
70
|
+
state,
|
|
71
|
+
actions
|
|
72
|
+
} = stateHook(instance);
|
|
73
|
+
return _objectSpread(_objectSpread({}, instance), {}, {
|
|
74
|
+
state: _objectSpread(_objectSpread({}, instance.state), state),
|
|
75
|
+
actions: _objectSpread(_objectSpread({}, instance.actions), actions)
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const reduceHotKey = (instance, _ref) => {
|
|
80
|
+
let {
|
|
81
|
+
key,
|
|
82
|
+
handler,
|
|
83
|
+
options,
|
|
84
|
+
allowDocumentHandler
|
|
85
|
+
} = _ref;
|
|
86
|
+
return _objectSpread(_objectSpread({}, instance), {}, {
|
|
87
|
+
hotKeys: _objectSpread(_objectSpread({}, instance.hotKeys), {}, {
|
|
88
|
+
[key]: {
|
|
89
|
+
handler,
|
|
90
|
+
options,
|
|
91
|
+
allowDocumentHandler
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const registerHotKeysHookToInstance = (instance, hotKeysHook) => {
|
|
98
|
+
const hotKeys = hotKeysHook(instance);
|
|
99
|
+
|
|
100
|
+
if (Array.isArray(hotKeys)) {
|
|
101
|
+
return hotKeys.reduce(reduceHotKey, instance);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return reduceHotKey(instance, hotKeys);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export { applyDecorators, composeFormatters, decorateColumns, evaluateFormatters, evaluateTransforms, mergeInstance, reducePropsGetter, registerHotKeysHookToInstance, registerStateHookToInstance };
|
|
@@ -0,0 +1,41 @@
|
|
|
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 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import { PureComponent } from 'react';
|
|
9
|
+
import raf from 'raf';
|
|
10
|
+
import hoistNonReactStatic from 'hoist-non-react-statics';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
function deferComponentRender(WrappedComponent, fallback) {
|
|
17
|
+
class DeferredRenderWrapper extends PureComponent {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.state = {
|
|
21
|
+
shouldRender: false
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
componentDidMount() {
|
|
26
|
+
raf(() => raf(() => this.setState({
|
|
27
|
+
shouldRender: true
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
render() {
|
|
32
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
33
|
+
return this.state.shouldRender ? /*#__PURE__*/jsx(WrappedComponent, _objectSpread({}, this.props)) : fallback;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return hoistNonReactStatic(DeferredRenderWrapper, WrappedComponent);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { deferComponentRender as default };
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as ScrollSync } from './ScrollSync/ScrollSync.js';
|
|
2
|
+
export { default as ScrollSyncPane } from './ScrollSync/ScrollSyncPane.js';
|
|
3
|
+
export { default as Group } from './GroupContext/Group.js';
|
|
4
|
+
export { GroupContext } from './GroupContext/GroupContext.js';
|
|
5
|
+
export { default as GroupItem } from './GroupContext/GroupItem.js';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const dsBasicSizes = ['s', 'm', 'l'];
|
|
2
|
+
const sizes = ['xsmall', 'small', 'medium', 'large', 'xlarge'];
|
|
3
|
+
const iconSizes = ['xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl'];
|
|
4
|
+
const iconColors = [['neutral', '900'], ['neutral', '0'], ['danger', '900'], ['warning', '500'], ['success', '900'], ['brand-primary', '600']];
|
|
5
|
+
const CHECKBOX_VARIANT = {
|
|
6
|
+
DEFAULT: 'variant-default',
|
|
7
|
+
FOCUS: 'variant-focus',
|
|
8
|
+
ACTIVE: 'variant-active',
|
|
9
|
+
DISABLED: 'variant-disabled',
|
|
10
|
+
ERROR: 'variant-error'
|
|
11
|
+
};
|
|
12
|
+
const checkboxVariants = [CHECKBOX_VARIANT.DEFAULT, CHECKBOX_VARIANT.FOCUS, CHECKBOX_VARIANT.ACTIVE, CHECKBOX_VARIANT.DISABLED, CHECKBOX_VARIANT.ERROR];
|
|
13
|
+
const COMBOBOX_VARIANT = {
|
|
14
|
+
DEFAULT: 'variant-default',
|
|
15
|
+
FOCUS: 'variant-focus-input',
|
|
16
|
+
FOCUS_ICON: 'variant-focus-icon',
|
|
17
|
+
ACTIVE: 'variant-active-input',
|
|
18
|
+
ACTIVE_ICON: 'variant-active-icon',
|
|
19
|
+
DISABLED: 'variant-disabled',
|
|
20
|
+
ERROR: 'variant-error'
|
|
21
|
+
};
|
|
22
|
+
const comboBoxVariants = [COMBOBOX_VARIANT.DEFAULT, COMBOBOX_VARIANT.FOCUS, COMBOBOX_VARIANT.FOCUS_ICON, COMBOBOX_VARIANT.ACTIVE, COMBOBOX_VARIANT.ACTIVE_ICON, COMBOBOX_VARIANT.DISABLED, COMBOBOX_VARIANT.ERROR];
|
|
23
|
+
const sizeVariants = {
|
|
24
|
+
S: 's',
|
|
25
|
+
M: 'm',
|
|
26
|
+
L: 'l'
|
|
27
|
+
};
|
|
28
|
+
const position = {
|
|
29
|
+
LEFT: 'left',
|
|
30
|
+
RIGHT: 'right',
|
|
31
|
+
CENTER: 'center'
|
|
32
|
+
};
|
|
33
|
+
const fontColor = {
|
|
34
|
+
NEUTRAL500: 'neutral500',
|
|
35
|
+
NEUTRAL700: 'neutral700'
|
|
36
|
+
};
|
|
37
|
+
const orientation = ['horizontal', 'vertical'];
|
|
38
|
+
const orientationVariants = {
|
|
39
|
+
HORIZONTAL: 'horizontal',
|
|
40
|
+
VERTICAL: 'vertical'
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { CHECKBOX_VARIANT, COMBOBOX_VARIANT, checkboxVariants, comboBoxVariants, dsBasicSizes, fontColor, iconColors, iconSizes, orientation, orientationVariants, position, sizeVariants, sizes };
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,111 @@
|
|
|
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 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
+
import React, { useRef, useState, useEffect, useMemo } from 'react';
|
|
10
|
+
import DSPopover from '@elliemae/ds-popper';
|
|
11
|
+
import { useOnClickOutside } from '@elliemae/ds-utilities';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
const ToolbarContext = /*#__PURE__*/React.createContext();
|
|
18
|
+
const {
|
|
19
|
+
Provider
|
|
20
|
+
} = ToolbarContext;
|
|
21
|
+
|
|
22
|
+
const useScrollListener = (callback, dependencies) => {
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
window.addEventListener('scroll', callback, true);
|
|
25
|
+
return () => {
|
|
26
|
+
window.removeEventListener('scroll', callback, true);
|
|
27
|
+
};
|
|
28
|
+
}, [dependencies]);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const noop = () => null;
|
|
32
|
+
|
|
33
|
+
function ToolbarProvider(_ref) {
|
|
34
|
+
let {
|
|
35
|
+
delay = 200,
|
|
36
|
+
children,
|
|
37
|
+
onHide = noop,
|
|
38
|
+
onShow = noop
|
|
39
|
+
} = _ref;
|
|
40
|
+
const showTimer = useRef();
|
|
41
|
+
const hideTimer = useRef();
|
|
42
|
+
const toolbarRef = useRef();
|
|
43
|
+
const [tooltipState, setTooltipState] = useState({});
|
|
44
|
+
|
|
45
|
+
const show = state => {
|
|
46
|
+
if (state.reference === tooltipState.reference) clearTimeout(hideTimer.current);
|
|
47
|
+
showTimer.current = setTimeout(() => setTooltipState(_objectSpread(_objectSpread({}, state), {}, {
|
|
48
|
+
visible: true
|
|
49
|
+
})), delay);
|
|
50
|
+
onShow();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const hide = (e, force) => {
|
|
54
|
+
if (!force) clearTimeout(showTimer.current);
|
|
55
|
+
hideTimer.current = setTimeout(() => setTooltipState(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
|
|
56
|
+
visible: false
|
|
57
|
+
})), 100);
|
|
58
|
+
onHide(tooltipState, e);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
useScrollListener(e => hide(e, true), tooltipState.visible);
|
|
62
|
+
useOnClickOutside(toolbarRef, () => hide());
|
|
63
|
+
|
|
64
|
+
const keyDownHandler = e => {
|
|
65
|
+
if (e.key === 'Escape') {
|
|
66
|
+
hide(e);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
window.addEventListener('keydown', keyDownHandler);
|
|
72
|
+
return () => {
|
|
73
|
+
window.removeEventListener('keydown', keyDownHandler);
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
const value = useMemo(() => ({
|
|
77
|
+
state: tooltipState,
|
|
78
|
+
show,
|
|
79
|
+
hide
|
|
80
|
+
}), [tooltipState.reference]);
|
|
81
|
+
return /*#__PURE__*/_jsx(Provider, {
|
|
82
|
+
value: value
|
|
83
|
+
}, void 0, children, /*#__PURE__*/jsx(DSPopover, _objectSpread(_objectSpread({
|
|
84
|
+
boundaries: "scrollParent"
|
|
85
|
+
}, tooltipState.options || {}), {}, {
|
|
86
|
+
content: tooltipState.renderer,
|
|
87
|
+
placement: "left",
|
|
88
|
+
referenceEl: tooltipState.reference,
|
|
89
|
+
renderer: _ref2 => {
|
|
90
|
+
let {
|
|
91
|
+
as: Component,
|
|
92
|
+
style,
|
|
93
|
+
children: Content
|
|
94
|
+
} = _ref2;
|
|
95
|
+
return /*#__PURE__*/jsx("div", {
|
|
96
|
+
ref: toolbarRef,
|
|
97
|
+
onMouseEnter: e => show(tooltipState),
|
|
98
|
+
onMouseLeave: hide,
|
|
99
|
+
children: /*#__PURE__*/_jsx(Component, {
|
|
100
|
+
style: style
|
|
101
|
+
}, void 0, Content)
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
style: tooltipState.style,
|
|
105
|
+
visible: tooltipState.visible
|
|
106
|
+
})));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var ToolbarProvider$1 = /*#__PURE__*/React.memo(ToolbarProvider);
|
|
110
|
+
|
|
111
|
+
export { ToolbarContext, ToolbarProvider$1 as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
|
+
import { safeCall } from '@elliemae/ds-utilities';
|
|
5
|
+
|
|
6
|
+
class VolatileRowsListener {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.observers = [];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
observe(listener) {
|
|
12
|
+
this.observers.push(listener);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
notify(nextRows) {
|
|
16
|
+
this.observers.forEach(observer => safeCall(observer, nextRows));
|
|
17
|
+
this.observers = [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { VolatileRowsListener as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useDataGrid.js';
|
|
@@ -0,0 +1,134 @@
|
|
|
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 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
+
import 'core-js/modules/es.string.replace.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import { v4 } from 'uuid';
|
|
12
|
+
import { curry, get, cloneDeep, set, isFunction } from '@elliemae/ds-utilities';
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
const appendHeaderFormatter = curry((formatter, column) => _objectSpread(_objectSpread({}, column), {}, {
|
|
19
|
+
header: _objectSpread(_objectSpread({}, column.header), {}, {
|
|
20
|
+
formatters: [...get(column, 'header.formatters', []), formatter]
|
|
21
|
+
})
|
|
22
|
+
}));
|
|
23
|
+
const appendCellFormatter = curry(function (formatter, column) {
|
|
24
|
+
let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'formatters';
|
|
25
|
+
const nextColumn = cloneDeep(column);
|
|
26
|
+
const formatters = get(nextColumn, ['cell', path], []);
|
|
27
|
+
const scrollingFormatters = get(nextColumn, 'cell.scrollingFormatters', []);
|
|
28
|
+
|
|
29
|
+
if (Array.isArray(formatter)) {
|
|
30
|
+
if (formatter[1]) scrollingFormatters.push(formatter[1]);
|
|
31
|
+
formatters.push(formatter[0]);
|
|
32
|
+
} else {
|
|
33
|
+
formatters.push(formatter);
|
|
34
|
+
scrollingFormatters.push(formatter);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
set(nextColumn, ['cell', path], formatters);
|
|
38
|
+
set(nextColumn, 'cell.scrollingFormatters', scrollingFormatters);
|
|
39
|
+
return nextColumn;
|
|
40
|
+
});
|
|
41
|
+
const defaultColumnDefinitionOptions = {
|
|
42
|
+
normalize: false,
|
|
43
|
+
useTextTruncation: true,
|
|
44
|
+
isUserColumn: true,
|
|
45
|
+
visible: true
|
|
46
|
+
};
|
|
47
|
+
const mergeClassNameToColumnHeader = curry((className, column) => {
|
|
48
|
+
const headerProps = get(column, ['header', 'props'], {});
|
|
49
|
+
const headerClassName = headerProps.className || '';
|
|
50
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
51
|
+
header: _objectSpread(_objectSpread({}, column.header), {}, {
|
|
52
|
+
props: _objectSpread(_objectSpread({}, headerProps), {}, {
|
|
53
|
+
className: "".concat(headerClassName, " ").concat(className)
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
function initColumnDefinition() {
|
|
59
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
60
|
+
// eslint-disable-next-line complexity
|
|
61
|
+
return column => {
|
|
62
|
+
// todo: clean this
|
|
63
|
+
if (column.type === 'number') {
|
|
64
|
+
// eslint-disable-next-line no-param-reassign
|
|
65
|
+
column.cellStyle = {
|
|
66
|
+
textAlign: 'right'
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const {
|
|
71
|
+
useTextTruncation = true,
|
|
72
|
+
isUserColumn,
|
|
73
|
+
visible,
|
|
74
|
+
normalize
|
|
75
|
+
} = _objectSpread(_objectSpread({}, defaultColumnDefinitionOptions), options);
|
|
76
|
+
|
|
77
|
+
if (normalize) {
|
|
78
|
+
// eslint-disable-next-line no-param-reassign
|
|
79
|
+
column.originalProperty = column.property; // eslint-disable-next-line no-param-reassign
|
|
80
|
+
|
|
81
|
+
column.property = column.property.replace(/\s+/g, '');
|
|
82
|
+
} // eslint-disable-next-line no-param-reassign
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
column.props = _objectSpread(_objectSpread({}, column.props), {}, {
|
|
86
|
+
style: {}
|
|
87
|
+
}); // eslint-disable-next-line no-param-reassign
|
|
88
|
+
|
|
89
|
+
column.header = _objectSpread(_objectSpread({}, column.header), {}, {
|
|
90
|
+
label: column.label,
|
|
91
|
+
formatters: [...get(column, ['header', 'formatters'], [])],
|
|
92
|
+
props: {
|
|
93
|
+
style: column.headerStyle || {}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
if (useTextTruncation && !(isFunction(column.customHeaderRenderer) || column.header.formatters.length)) {
|
|
98
|
+
column.header.formatters.push(value => /*#__PURE__*/_jsx("span", {
|
|
99
|
+
className: "cell-value"
|
|
100
|
+
}, void 0, value));
|
|
101
|
+
} // eslint-disable-next-line no-param-reassign
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
column.cell = _objectSpread(_objectSpread({}, column.cell), {}, {
|
|
105
|
+
transforms: [],
|
|
106
|
+
formatters: [...get(column, ['cell', 'formatters'], [])],
|
|
107
|
+
scrollingFormatters: [...get(column, ['cell', 'formatters'], [])],
|
|
108
|
+
props: {
|
|
109
|
+
style: column.cellStyle || {}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
if (useTextTruncation && !(isFunction(column.customRenderer) || column.cell.formatters.length)) {
|
|
114
|
+
column.cell.formatters.push(value => /*#__PURE__*/_jsx("span", {
|
|
115
|
+
className: "cell-value",
|
|
116
|
+
style: {
|
|
117
|
+
justifyContent: column.type === 'number' ? 'flex-end' : 'flex-start'
|
|
118
|
+
}
|
|
119
|
+
}, void 0, value));
|
|
120
|
+
} // eslint-disable-next-line no-param-reassign
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
column.uuid = column.uuid || v4(); // eslint-disable-next-line no-param-reassign
|
|
124
|
+
|
|
125
|
+
column.visible = column.visible === undefined ? visible : column.visible; // eslint-disable-next-line no-param-reassign, max-lines
|
|
126
|
+
|
|
127
|
+
column.isUserColumn = column.isUserColumn || isUserColumn; // eslint-disable-next-line no-param-reassign
|
|
128
|
+
|
|
129
|
+
column.headerHookEffects = [];
|
|
130
|
+
return column;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { appendCellFormatter, appendHeaderFormatter, initColumnDefinition as default, mergeClassNameToColumnHeader };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
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.for-each.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
11
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
12
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
13
|
+
import { useDerivedStateFromProps, compose, cloneDeep, usePrevious, isObject, isEqual, setRef } from '@elliemae/ds-utilities';
|
|
14
|
+
import { useRef, useState, useMemo } from 'react';
|
|
15
|
+
import { v4 } from 'uuid';
|
|
16
|
+
import * as resolve from 'table-resolver';
|
|
17
|
+
import initColumnDefinition from './initColumnDefinition.js';
|
|
18
|
+
import { applyDecorators, decorateColumns, reducePropsGetter } from '../createDataInstance/utils.js';
|
|
19
|
+
import VolatileRowsListener from './VolatileRowsListener.js';
|
|
20
|
+
import { isInternetExplorer } from '../utils.js';
|
|
21
|
+
|
|
22
|
+
const _excluded = ["uuid", "plugins", "rows", "columns", "renderers"];
|
|
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(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 IS_INTERNET_EXPLORER = isInternetExplorer(); // TODO: Reuse createDataInstance for the grid the same
|
|
28
|
+
// way as the list does ex: packages/ds-shared/src/useDataList/useDataList.js
|
|
29
|
+
// eslint-disable-next-line max-statements
|
|
30
|
+
|
|
31
|
+
function useDataGrid(_ref) {
|
|
32
|
+
let {
|
|
33
|
+
uuid: uuidProp,
|
|
34
|
+
plugins: pluginsFromProps,
|
|
35
|
+
rows,
|
|
36
|
+
columns,
|
|
37
|
+
renderers = {}
|
|
38
|
+
} = _ref,
|
|
39
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
|
|
41
|
+
const plugins = pluginsFromProps;
|
|
42
|
+
const instance = useRef();
|
|
43
|
+
const tableRef = useRef();
|
|
44
|
+
const headerRef = useRef();
|
|
45
|
+
const bodyRef = useRef();
|
|
46
|
+
const bodyInnerRef = useRef();
|
|
47
|
+
const [uuid] = useState(uuidProp || (() => v4()));
|
|
48
|
+
const [hasScroll, setHasScroll] = useState(false);
|
|
49
|
+
const [isRowDragging, setIsRowDragging] = useState(false);
|
|
50
|
+
const isScrolling = useRef();
|
|
51
|
+
const shouldRefocus = useRef(); // todo: we probably need a plugin for focus related stuff
|
|
52
|
+
|
|
53
|
+
const [RowsObserver] = useState(() => new VolatileRowsListener()); // todo move this with rows composition
|
|
54
|
+
|
|
55
|
+
const [originalRows, updateRows] = useDerivedStateFromProps(rows, {
|
|
56
|
+
onUpdate: resolve.resolve({
|
|
57
|
+
columns,
|
|
58
|
+
method: extra => compose(resolve.byFunction('valueTransformation')(extra), resolve.nested(extra))
|
|
59
|
+
}),
|
|
60
|
+
updateOnStateChange: true
|
|
61
|
+
});
|
|
62
|
+
instance.current = {
|
|
63
|
+
decoratedRenderers: cloneDeep(renderers),
|
|
64
|
+
decoratedColumns: columns,
|
|
65
|
+
columns,
|
|
66
|
+
rows,
|
|
67
|
+
composedRows: originalRows,
|
|
68
|
+
getRowProps: [],
|
|
69
|
+
getHeaderRowProps: [],
|
|
70
|
+
getBodyProps: [],
|
|
71
|
+
getTableProps: [],
|
|
72
|
+
effects: [],
|
|
73
|
+
uuid,
|
|
74
|
+
props,
|
|
75
|
+
refs: {
|
|
76
|
+
table: tableRef,
|
|
77
|
+
body: bodyRef,
|
|
78
|
+
header: headerRef,
|
|
79
|
+
innerBody: bodyInnerRef
|
|
80
|
+
},
|
|
81
|
+
state: {
|
|
82
|
+
hasScroll
|
|
83
|
+
},
|
|
84
|
+
actions: {
|
|
85
|
+
updateRows
|
|
86
|
+
},
|
|
87
|
+
updateRows,
|
|
88
|
+
// eslint-disable-next-line no-return-assign
|
|
89
|
+
enableEvents: () => document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? '' : null,
|
|
90
|
+
// eslint-disable-next-line no-return-assign
|
|
91
|
+
disableEvents: () => document.body.style.pointerEvents = 'none',
|
|
92
|
+
observeRows: observer => RowsObserver.observe(observer),
|
|
93
|
+
hotKeys: {},
|
|
94
|
+
shouldRefocus,
|
|
95
|
+
isScrolling,
|
|
96
|
+
setHasScroll,
|
|
97
|
+
setIsRowDragging,
|
|
98
|
+
isRowDragging,
|
|
99
|
+
plugins
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
instance.current.getState = () => instance.current.state;
|
|
103
|
+
|
|
104
|
+
instance.current.getInstance = () => instance.current;
|
|
105
|
+
|
|
106
|
+
const defaultDecorators = {
|
|
107
|
+
decorateGrid: [],
|
|
108
|
+
registerStateHook: [],
|
|
109
|
+
registerHotKeys: [],
|
|
110
|
+
decorateColumn: [],
|
|
111
|
+
decorateColumns: [cols => cols.map(col => initColumnDefinition({
|
|
112
|
+
useTextTruncation: col.useTextTruncation,
|
|
113
|
+
wrapText: props.wrapText,
|
|
114
|
+
normalize: props.normalizeDataKeys
|
|
115
|
+
})(col))],
|
|
116
|
+
decorateRenderers: [],
|
|
117
|
+
getRowProps: [],
|
|
118
|
+
getHeaderRowProps: [],
|
|
119
|
+
getBodyProps: [],
|
|
120
|
+
getTableProps: [],
|
|
121
|
+
getHeaderProps: [],
|
|
122
|
+
composeRows: []
|
|
123
|
+
};
|
|
124
|
+
const decorators = useMemo(() => {
|
|
125
|
+
let nextDecorators = defaultDecorators; // eslint-disable-next-line no-return-assign
|
|
126
|
+
|
|
127
|
+
plugins.forEach(plugin => nextDecorators = plugin(nextDecorators));
|
|
128
|
+
return nextDecorators;
|
|
129
|
+
}, [plugins]);
|
|
130
|
+
instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) => _objectSpread(_objectSpread({}, nextInstance), decorator(instance.current)), instance.current);
|
|
131
|
+
instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {
|
|
132
|
+
const {
|
|
133
|
+
state,
|
|
134
|
+
actions
|
|
135
|
+
} = decorator(instance.current);
|
|
136
|
+
return _objectSpread(_objectSpread({}, nextInstance), {}, {
|
|
137
|
+
state: _objectSpread(_objectSpread({}, nextInstance.state), state),
|
|
138
|
+
actions: _objectSpread(_objectSpread({}, nextInstance.actions), actions)
|
|
139
|
+
});
|
|
140
|
+
}, instance.current);
|
|
141
|
+
|
|
142
|
+
const reduceHotKey = (nextInstance, _ref2) => {
|
|
143
|
+
let {
|
|
144
|
+
key,
|
|
145
|
+
handler,
|
|
146
|
+
options
|
|
147
|
+
} = _ref2;
|
|
148
|
+
return _objectSpread(_objectSpread({}, nextInstance), {}, {
|
|
149
|
+
hotKeys: _objectSpread(_objectSpread({}, nextInstance.hotKeys), {}, {
|
|
150
|
+
[key]: {
|
|
151
|
+
handler,
|
|
152
|
+
options
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {
|
|
159
|
+
const hotKeys = decorator(nextInstance);
|
|
160
|
+
|
|
161
|
+
if (Array.isArray(hotKeys)) {
|
|
162
|
+
return hotKeys.reduce(reduceHotKey, nextInstance);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return reduceHotKey(nextInstance, hotKeys);
|
|
166
|
+
}, instance.current);
|
|
167
|
+
instance.current.decoratedRenderers = applyDecorators(instance.current.decoratedRenderers, decorators.decorateRenderers, instance.current);
|
|
168
|
+
instance.current.decoratedColumns = useMemo(() => {
|
|
169
|
+
const visibleColumns = cloneDeep(columns).filter(column => typeof column.visible === 'undefined' || column.visible);
|
|
170
|
+
return visibleColumns.length ? decorateColumns(visibleColumns, decorators, instance.current) : [];
|
|
171
|
+
}, [columns]);
|
|
172
|
+
instance.current.getBodyProps = reducePropsGetter(decorators.getBodyProps, instance.current);
|
|
173
|
+
instance.current.getHeaderProps = reducePropsGetter(decorators.getHeaderProps, instance.current);
|
|
174
|
+
instance.current.getRowProps = reducePropsGetter(decorators.getRowProps, instance.current);
|
|
175
|
+
instance.current.getHeaderRowProps = reducePropsGetter(decorators.getHeaderRowProps, instance.current);
|
|
176
|
+
instance.current.getTableProps = reducePropsGetter(decorators.getTableProps, instance.current);
|
|
177
|
+
instance.current.composedRows = decorators.composeRows.reduce((nextRows, getter) => getter(nextRows, instance.current), instance.current.composedRows);
|
|
178
|
+
RowsObserver.notify(instance.current.composedRows);
|
|
179
|
+
const currentShouldRefocus = instance.current.shouldRefocus.current;
|
|
180
|
+
const prevState = usePrevious(instance.current.state);
|
|
181
|
+
|
|
182
|
+
if (isObject(currentShouldRefocus) && currentShouldRefocus.forced) {
|
|
183
|
+
instance.current.shouldRefocus.current = currentShouldRefocus.value;
|
|
184
|
+
} else {
|
|
185
|
+
instance.current.shouldRefocus.current = !isEqual(prevState, instance.current.state);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (props.instanceRef) setRef(props.instanceRef, instance.current);
|
|
189
|
+
return _objectSpread(_objectSpread({}, instance.current), {}, {
|
|
190
|
+
decorators
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export { useDataGrid as default };
|