@elliemae/ds-shared 3.0.0-next.1 → 3.0.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Animations/BaseAnimation.js +56 -0
- package/dist/cjs/Animations/BaseAnimation.js.map +7 -0
- package/dist/cjs/Animations/Grow.js +55 -0
- package/dist/cjs/Animations/Grow.js.map +7 -0
- package/dist/cjs/Animations/GrowRight.js +64 -0
- package/dist/cjs/Animations/GrowRight.js.map +7 -0
- package/dist/cjs/Animations/GrowVertical.js +47 -0
- package/dist/cjs/Animations/GrowVertical.js.map +7 -0
- package/dist/cjs/CheckableGroup.js +92 -0
- package/dist/cjs/CheckableGroup.js.map +7 -0
- package/dist/cjs/DeferRenderAfterComputation.js +52 -0
- package/dist/cjs/DeferRenderAfterComputation.js.map +7 -0
- package/dist/cjs/FocusGroup/FocusGrid.js +193 -0
- package/dist/cjs/FocusGroup/FocusGrid.js.map +7 -0
- package/dist/cjs/FocusGroup/FocusGroup.js +262 -0
- package/dist/cjs/FocusGroup/FocusGroup.js.map +7 -0
- package/dist/cjs/FocusGroup/FocusGroupContext.js +38 -0
- package/dist/cjs/FocusGroup/FocusGroupContext.js.map +7 -0
- package/dist/cjs/FocusGroup/FocusGroupManager.js +126 -0
- package/dist/cjs/FocusGroup/FocusGroupManager.js.map +7 -0
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js +82 -0
- package/dist/cjs/FocusGroup/focusGroupManagerHoc.js.map +7 -0
- package/dist/cjs/FocusGroup/index.js +47 -0
- package/dist/cjs/FocusGroup/index.js.map +7 -0
- package/dist/cjs/FocusGroup/useFocusGroupItem.js +81 -0
- package/dist/cjs/FocusGroup/useFocusGroupItem.js.map +7 -0
- package/dist/cjs/FocusGroup/utils/getNextCellPosition.js +80 -0
- package/dist/cjs/FocusGroup/utils/getNextCellPosition.js.map +7 -0
- package/dist/cjs/GroupContext/Group.js +115 -0
- package/dist/cjs/GroupContext/Group.js.map +7 -0
- package/dist/cjs/GroupContext/GroupContext.js +36 -0
- package/dist/cjs/GroupContext/GroupContext.js.map +7 -0
- package/dist/cjs/GroupContext/GroupItem.js +40 -0
- package/dist/cjs/GroupContext/GroupItem.js.map +7 -0
- package/dist/cjs/GroupContext/index.js +39 -0
- package/dist/cjs/GroupContext/index.js.map +7 -0
- package/dist/cjs/ScrollSync/ScrollSync.js +138 -0
- package/dist/cjs/ScrollSync/ScrollSync.js.map +7 -0
- package/dist/cjs/ScrollSync/ScrollSyncPane.js +89 -0
- package/dist/cjs/ScrollSync/ScrollSyncPane.js.map +7 -0
- package/dist/cjs/ScrollSync/ScrollSyncProvider.js +120 -0
- package/dist/cjs/ScrollSync/ScrollSyncProvider.js.map +7 -0
- package/dist/cjs/ScrollSync/index.js +37 -0
- package/dist/cjs/ScrollSync/index.js.map +7 -0
- package/dist/cjs/ScrollSync/useScrollSync.js +41 -0
- package/dist/cjs/ScrollSync/useScrollSync.js.map +7 -0
- package/dist/cjs/constants.js +70 -0
- package/dist/cjs/constants.js.map +7 -0
- package/dist/cjs/createDataInstance/createInstancePlugin.js +62 -0
- package/dist/cjs/createDataInstance/createInstancePlugin.js.map +7 -0
- package/dist/cjs/createDataInstance/createInstanceRef.js +124 -0
- package/dist/cjs/createDataInstance/createInstanceRef.js.map +7 -0
- package/dist/cjs/createDataInstance/utils.js +104 -0
- package/dist/cjs/createDataInstance/utils.js.map +7 -0
- package/dist/cjs/defer-render-hoc/index.js +68 -0
- package/dist/cjs/defer-render-hoc/index.js.map +7 -0
- package/dist/cjs/dimsum.config.js +39 -0
- package/dist/cjs/dimsum.config.js.map +7 -0
- package/dist/cjs/index.js +40 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/prop-types.js +116 -0
- package/dist/cjs/prop-types.js.map +7 -0
- package/dist/cjs/react-spring/index.js +28 -0
- package/dist/cjs/react-spring/index.js.map +7 -0
- package/dist/cjs/react-spring/renderprops.js +28 -0
- package/dist/cjs/react-spring/renderprops.js.map +7 -0
- package/dist/cjs/toolbar/ToolbarProvider.js +126 -0
- package/dist/cjs/toolbar/ToolbarProvider.js.map +7 -0
- package/dist/cjs/useDataGrid/VolatileRowsListener.js +49 -0
- package/dist/cjs/useDataGrid/VolatileRowsListener.js.map +7 -0
- package/dist/cjs/useDataGrid/index.js +36 -0
- package/dist/cjs/useDataGrid/index.js.map +7 -0
- package/dist/cjs/useDataGrid/initColumnDefinition.js +147 -0
- package/dist/cjs/useDataGrid/initColumnDefinition.js.map +7 -0
- package/dist/cjs/useDataGrid/useDataGrid.js +216 -0
- package/dist/cjs/useDataGrid/useDataGrid.js.map +7 -0
- package/dist/cjs/useDataList/index.js +36 -0
- package/dist/cjs/useDataList/index.js.map +7 -0
- package/dist/cjs/useDataList/recordIterator.js +55 -0
- package/dist/cjs/useDataList/recordIterator.js.map +7 -0
- package/dist/cjs/useDataList/useDataList.js +126 -0
- package/dist/cjs/useDataList/useDataList.js.map +7 -0
- package/dist/cjs/utils.js +123 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/cjs/virtualization/AutoHeightList.js +106 -0
- package/dist/cjs/virtualization/AutoHeightList.js.map +7 -0
- package/dist/cjs/virtualization/FluidHeightList.js +74 -0
- package/dist/cjs/virtualization/FluidHeightList.js.map +7 -0
- package/dist/cjs/virtualization/index.js +50 -0
- package/dist/cjs/virtualization/index.js.map +7 -0
- package/dist/esm/Animations/BaseAnimation.js +27 -0
- package/dist/esm/Animations/BaseAnimation.js.map +7 -0
- package/dist/esm/Animations/Grow.js +26 -0
- package/dist/esm/Animations/Grow.js.map +7 -0
- package/dist/esm/Animations/GrowRight.js +35 -0
- package/dist/esm/Animations/GrowRight.js.map +7 -0
- package/dist/esm/Animations/GrowVertical.js +29 -0
- package/dist/esm/Animations/GrowVertical.js.map +7 -0
- package/dist/esm/CheckableGroup.js +65 -0
- package/dist/esm/CheckableGroup.js.map +7 -0
- package/dist/esm/DeferRenderAfterComputation.js +23 -0
- package/dist/esm/DeferRenderAfterComputation.js.map +7 -0
- package/dist/esm/FocusGroup/FocusGrid.js +166 -0
- package/dist/esm/FocusGroup/FocusGrid.js.map +7 -0
- package/{esm → dist/esm}/FocusGroup/FocusGroup.js +70 -136
- package/dist/esm/FocusGroup/FocusGroup.js.map +7 -0
- package/dist/esm/FocusGroup/FocusGroupContext.js +9 -0
- package/dist/esm/FocusGroup/FocusGroupContext.js.map +7 -0
- package/{esm → dist/esm}/FocusGroup/FocusGroupManager.js +24 -38
- package/dist/esm/FocusGroup/FocusGroupManager.js.map +7 -0
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js +55 -0
- package/dist/esm/FocusGroup/focusGroupManagerHoc.js.map +7 -0
- package/dist/esm/FocusGroup/index.js +18 -0
- package/dist/esm/FocusGroup/index.js.map +7 -0
- package/dist/esm/FocusGroup/useFocusGroupItem.js +53 -0
- package/dist/esm/FocusGroup/useFocusGroupItem.js.map +7 -0
- package/{esm → dist/esm}/FocusGroup/utils/getNextCellPosition.js +18 -25
- package/dist/esm/FocusGroup/utils/getNextCellPosition.js.map +7 -0
- package/dist/esm/GroupContext/Group.js +86 -0
- package/dist/esm/GroupContext/Group.js.map +7 -0
- package/dist/esm/GroupContext/GroupContext.js +7 -0
- package/dist/esm/GroupContext/GroupContext.js.map +7 -0
- package/dist/esm/GroupContext/GroupItem.js +11 -0
- package/dist/esm/GroupContext/GroupItem.js.map +7 -0
- package/dist/esm/GroupContext/index.js +10 -0
- package/dist/esm/GroupContext/index.js.map +7 -0
- package/{esm → dist/esm}/ScrollSync/ScrollSync.js +30 -64
- package/dist/esm/ScrollSync/ScrollSync.js.map +7 -0
- package/dist/esm/ScrollSync/ScrollSyncPane.js +62 -0
- package/dist/esm/ScrollSync/ScrollSyncPane.js.map +7 -0
- package/dist/esm/ScrollSync/ScrollSyncProvider.js +91 -0
- package/dist/esm/ScrollSync/ScrollSyncProvider.js.map +7 -0
- package/dist/esm/ScrollSync/index.js +8 -0
- package/dist/esm/ScrollSync/index.js.map +7 -0
- package/dist/esm/ScrollSync/useScrollSync.js +12 -0
- package/dist/esm/ScrollSync/useScrollSync.js.map +7 -0
- package/dist/esm/constants.js +41 -0
- package/dist/esm/constants.js.map +7 -0
- package/dist/esm/createDataInstance/createInstancePlugin.js +35 -0
- package/dist/esm/createDataInstance/createInstancePlugin.js.map +7 -0
- package/dist/esm/createDataInstance/createInstanceRef.js +101 -0
- package/dist/esm/createDataInstance/createInstanceRef.js.map +7 -0
- package/dist/esm/createDataInstance/utils.js +77 -0
- package/dist/esm/createDataInstance/utils.js.map +7 -0
- package/dist/esm/defer-render-hoc/index.js +41 -0
- package/dist/esm/defer-render-hoc/index.js.map +7 -0
- package/dist/esm/dimsum.config.js +10 -0
- package/dist/esm/dimsum.config.js.map +7 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/prop-types.js +87 -0
- package/dist/esm/prop-types.js.map +7 -0
- package/dist/esm/react-spring/index.js +3 -0
- package/dist/esm/react-spring/index.js.map +7 -0
- package/dist/esm/react-spring/renderprops.js +3 -0
- package/dist/esm/react-spring/renderprops.js.map +7 -0
- package/dist/esm/toolbar/ToolbarProvider.js +99 -0
- package/dist/esm/toolbar/ToolbarProvider.js.map +7 -0
- package/dist/esm/useDataGrid/VolatileRowsListener.js +20 -0
- package/dist/esm/useDataGrid/VolatileRowsListener.js.map +7 -0
- package/dist/esm/useDataGrid/index.js +7 -0
- package/dist/esm/useDataGrid/index.js.map +7 -0
- package/dist/esm/useDataGrid/initColumnDefinition.js +126 -0
- package/dist/esm/useDataGrid/initColumnDefinition.js.map +7 -0
- package/dist/esm/useDataGrid/useDataGrid.js +201 -0
- package/dist/esm/useDataGrid/useDataGrid.js.map +7 -0
- package/dist/esm/useDataList/index.js +7 -0
- package/dist/esm/useDataList/index.js.map +7 -0
- package/dist/esm/useDataList/recordIterator.js +26 -0
- package/dist/esm/useDataList/recordIterator.js.map +7 -0
- package/dist/esm/useDataList/useDataList.js +102 -0
- package/dist/esm/useDataList/useDataList.js.map +7 -0
- package/dist/esm/utils.js +96 -0
- package/dist/esm/utils.js.map +7 -0
- package/dist/esm/virtualization/AutoHeightList.js +79 -0
- package/dist/esm/virtualization/AutoHeightList.js.map +7 -0
- package/dist/esm/virtualization/FluidHeightList.js +47 -0
- package/dist/esm/virtualization/FluidHeightList.js.map +7 -0
- package/dist/esm/virtualization/index.js +21 -0
- package/dist/esm/virtualization/index.js.map +7 -0
- package/package.json +119 -110
- package/cjs/Animations/BaseAnimation.js +0 -36
- package/cjs/Animations/Grow.js +0 -42
- package/cjs/Animations/GrowRight.js +0 -42
- package/cjs/Animations/GrowVertical.js +0 -7
- package/cjs/CheckableGroup.js +0 -74
- package/cjs/DeferRenderAfterComputation.js +0 -28
- package/cjs/FocusGroup/FocusGrid.js +0 -215
- package/cjs/FocusGroup/FocusGroup.js +0 -308
- package/cjs/FocusGroup/FocusGroupContext.js +0 -11
- package/cjs/FocusGroup/FocusGroupManager.js +0 -117
- package/cjs/FocusGroup/focusGroupManagerHoc.js +0 -44
- package/cjs/FocusGroup/index.js +0 -21
- package/cjs/FocusGroup/useFocusGroupItem.js +0 -59
- package/cjs/FocusGroup/utils/getNextCellPosition.js +0 -60
- package/cjs/GroupContext/Group.js +0 -124
- package/cjs/GroupContext/GroupContext.js +0 -13
- package/cjs/GroupContext/GroupItem.js +0 -22
- package/cjs/GroupContext/index.js +0 -13
- package/cjs/ScrollSync/ScrollSync.js +0 -153
- package/cjs/ScrollSync/ScrollSyncPane.js +0 -81
- package/cjs/ScrollSync/ScrollSyncProvider.js +0 -67
- package/cjs/ScrollSync/index.js +0 -11
- package/cjs/ScrollSync/useScrollSync.js +0 -10
- package/cjs/constants.js +0 -51
- package/cjs/createDataInstance/createInstancePlugin.js +0 -36
- package/cjs/createDataInstance/createInstanceRef.js +0 -97
- package/cjs/createDataInstance/utils.js +0 -123
- package/cjs/defer-render-hoc/index.js +0 -49
- package/cjs/dimsum.config.js +0 -7
- package/cjs/index.js +0 -17
- package/cjs/prop-types.js +0 -59
- package/cjs/react-spring/index.js +0 -14
- package/cjs/react-spring/renderprops.js +0 -14
- package/cjs/toolbar/ToolbarProvider.js +0 -123
- package/cjs/useDataGrid/VolatileRowsListener.js +0 -24
- package/cjs/useDataGrid/index.js +0 -7
- package/cjs/useDataGrid/initColumnDefinition.js +0 -146
- package/cjs/useDataGrid/useDataGrid.js +0 -220
- package/cjs/useDataList/index.js +0 -7
- package/cjs/useDataList/recordIterator.js +0 -31
- package/cjs/useDataList/useDataList.js +0 -102
- package/cjs/utils.js +0 -116
- package/cjs/virtualization/AutoHeightList.js +0 -61
- package/cjs/virtualization/FluidHeightList.js +0 -49
- package/cjs/virtualization/index.js +0 -22
- package/esm/Animations/BaseAnimation.js +0 -30
- package/esm/Animations/Grow.js +0 -36
- package/esm/Animations/GrowRight.js +0 -36
- package/esm/Animations/GrowVertical.js +0 -4
- package/esm/CheckableGroup.js +0 -64
- package/esm/DeferRenderAfterComputation.js +0 -22
- package/esm/FocusGroup/FocusGrid.js +0 -204
- package/esm/FocusGroup/FocusGroupContext.js +0 -5
- package/esm/FocusGroup/focusGroupManagerHoc.js +0 -37
- package/esm/FocusGroup/index.js +0 -6
- package/esm/FocusGroup/useFocusGroupItem.js +0 -50
- package/esm/GroupContext/Group.js +0 -118
- package/esm/GroupContext/GroupContext.js +0 -5
- package/esm/GroupContext/GroupItem.js +0 -16
- package/esm/GroupContext/index.js +0 -3
- package/esm/ScrollSync/ScrollSyncPane.js +0 -74
- package/esm/ScrollSync/ScrollSyncProvider.js +0 -59
- package/esm/ScrollSync/index.js +0 -2
- package/esm/ScrollSync/useScrollSync.js +0 -8
- package/esm/constants.js +0 -32
- package/esm/createDataInstance/createInstancePlugin.js +0 -30
- package/esm/createDataInstance/createInstanceRef.js +0 -90
- package/esm/createDataInstance/utils.js +0 -107
- package/esm/defer-render-hoc/index.js +0 -41
- package/esm/dimsum.config.js +0 -5
- package/esm/index.js +0 -5
- package/esm/prop-types.js +0 -43
- package/esm/react-spring/index.js +0 -1
- package/esm/react-spring/renderprops.js +0 -1
- package/esm/toolbar/ToolbarProvider.js +0 -111
- package/esm/useDataGrid/VolatileRowsListener.js +0 -22
- package/esm/useDataGrid/index.js +0 -1
- package/esm/useDataGrid/initColumnDefinition.js +0 -134
- package/esm/useDataGrid/useDataGrid.js +0 -194
- package/esm/useDataList/index.js +0 -1
- package/esm/useDataList/recordIterator.js +0 -27
- package/esm/useDataList/useDataList.js +0 -90
- package/esm/utils.js +0 -95
- package/esm/virtualization/AutoHeightList.js +0 -52
- package/esm/virtualization/FluidHeightList.js +0 -38
- package/esm/virtualization/index.js +0 -18
- package/types/Animations/BaseAnimation.d.ts +0 -12
- package/types/Animations/Grow.d.ts +0 -11
- package/types/Animations/GrowRight.d.ts +0 -11
- package/types/Animations/GrowVertical.d.ts +0 -1
- package/types/CheckableGroup.d.ts +0 -20
- package/types/DeferRenderAfterComputation.d.ts +0 -6
- package/types/FocusGroup/FocusGrid.d.ts +0 -10
- package/types/FocusGroup/FocusGroup.d.ts +0 -36
- package/types/FocusGroup/FocusGroupContext.d.ts +0 -3
- package/types/FocusGroup/FocusGroupManager.d.ts +0 -24
- package/types/FocusGroup/focusGroupManagerHoc.d.ts +0 -7
- package/types/FocusGroup/index.d.ts +0 -6
- package/types/FocusGroup/useFocusGroupItem.d.ts +0 -2
- package/types/FocusGroup/utils/getNextCellPosition.d.ts +0 -12
- package/types/GroupContext/Group.d.ts +0 -14
- package/types/GroupContext/GroupContext.d.ts +0 -2
- package/types/GroupContext/GroupItem.d.ts +0 -5
- package/types/GroupContext/index.d.ts +0 -3
- package/types/ScrollSync/ScrollSync.d.ts +0 -21
- package/types/ScrollSync/ScrollSyncPane.d.ts +0 -3
- package/types/ScrollSync/ScrollSyncProvider.d.ts +0 -12
- package/types/ScrollSync/index.d.ts +0 -2
- package/types/ScrollSync/useScrollSync.d.ts +0 -6
- package/types/constants.d.ts +0 -30
- package/types/createDataInstance/createInstancePlugin.d.ts +0 -1
- package/types/createDataInstance/createInstanceRef.d.ts +0 -12
- package/types/createDataInstance/tests/createInstanceRef.test.d.ts +0 -0
- package/types/createDataInstance/utils.d.ts +0 -9
- package/types/dimsum.config.d.ts +0 -4
- package/types/index.d.ts +0 -2
- package/types/prop-types.d.ts +0 -41
- package/types/react-spring/index.d.ts +0 -1
- package/types/react-spring/renderprops.d.ts +0 -1
- package/types/toolbar/ToolbarProvider.d.ts +0 -10
- package/types/useDataGrid/VolatileRowsListener.d.ts +0 -5
- package/types/useDataGrid/index.d.ts +0 -1
- package/types/useDataGrid/initColumnDefinition.d.ts +0 -5
- package/types/useDataGrid/useDataGrid.d.ts +0 -8
- package/types/useDataList/index.d.ts +0 -1
- package/types/useDataList/recordIterator.d.ts +0 -1
- package/types/useDataList/useDataList.d.ts +0 -13
- package/types/utils.d.ts +0 -22
- package/types/virtualization/AutoHeightList.d.ts +0 -2
- package/types/virtualization/FluidHeightList.d.ts +0 -2
- package/types/virtualization/index.d.ts +0 -9
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
|
-
require('core-js/modules/es.string.replace.js');
|
|
9
|
-
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
-
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
-
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
-
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
|
-
require('react');
|
|
15
|
-
var uuid = require('uuid');
|
|
16
|
-
var dsUtilities = require('@elliemae/ds-utilities');
|
|
17
|
-
|
|
18
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
22
|
-
|
|
23
|
-
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; }
|
|
24
|
-
|
|
25
|
-
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; }
|
|
26
|
-
|
|
27
|
-
const appendHeaderFormatter = dsUtilities.curry((formatter, column) => _objectSpread(_objectSpread({}, column), {}, {
|
|
28
|
-
header: _objectSpread(_objectSpread({}, column.header), {}, {
|
|
29
|
-
formatters: [...dsUtilities.get(column, 'header.formatters', []), formatter]
|
|
30
|
-
})
|
|
31
|
-
}));
|
|
32
|
-
const appendCellFormatter = dsUtilities.curry(function (formatter, column) {
|
|
33
|
-
let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'formatters';
|
|
34
|
-
const nextColumn = dsUtilities.cloneDeep(column);
|
|
35
|
-
const formatters = dsUtilities.get(nextColumn, ['cell', path], []);
|
|
36
|
-
const scrollingFormatters = dsUtilities.get(nextColumn, 'cell.scrollingFormatters', []);
|
|
37
|
-
|
|
38
|
-
if (Array.isArray(formatter)) {
|
|
39
|
-
if (formatter[1]) scrollingFormatters.push(formatter[1]);
|
|
40
|
-
formatters.push(formatter[0]);
|
|
41
|
-
} else {
|
|
42
|
-
formatters.push(formatter);
|
|
43
|
-
scrollingFormatters.push(formatter);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
dsUtilities.set(nextColumn, ['cell', path], formatters);
|
|
47
|
-
dsUtilities.set(nextColumn, 'cell.scrollingFormatters', scrollingFormatters);
|
|
48
|
-
return nextColumn;
|
|
49
|
-
});
|
|
50
|
-
const defaultColumnDefinitionOptions = {
|
|
51
|
-
normalize: false,
|
|
52
|
-
useTextTruncation: true,
|
|
53
|
-
isUserColumn: true,
|
|
54
|
-
visible: true
|
|
55
|
-
};
|
|
56
|
-
const mergeClassNameToColumnHeader = dsUtilities.curry((className, column) => {
|
|
57
|
-
const headerProps = dsUtilities.get(column, ['header', 'props'], {});
|
|
58
|
-
const headerClassName = headerProps.className || '';
|
|
59
|
-
return _objectSpread(_objectSpread({}, column), {}, {
|
|
60
|
-
header: _objectSpread(_objectSpread({}, column.header), {}, {
|
|
61
|
-
props: _objectSpread(_objectSpread({}, headerProps), {}, {
|
|
62
|
-
className: "".concat(headerClassName, " ").concat(className)
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
function initColumnDefinition() {
|
|
68
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
69
|
-
// eslint-disable-next-line complexity
|
|
70
|
-
return column => {
|
|
71
|
-
// todo: clean this
|
|
72
|
-
if (column.type === 'number') {
|
|
73
|
-
// eslint-disable-next-line no-param-reassign
|
|
74
|
-
column.cellStyle = {
|
|
75
|
-
textAlign: 'right'
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const {
|
|
80
|
-
useTextTruncation = true,
|
|
81
|
-
isUserColumn,
|
|
82
|
-
visible,
|
|
83
|
-
normalize
|
|
84
|
-
} = _objectSpread(_objectSpread({}, defaultColumnDefinitionOptions), options);
|
|
85
|
-
|
|
86
|
-
if (normalize) {
|
|
87
|
-
// eslint-disable-next-line no-param-reassign
|
|
88
|
-
column.originalProperty = column.property; // eslint-disable-next-line no-param-reassign
|
|
89
|
-
|
|
90
|
-
column.property = column.property.replace(/\s+/g, '');
|
|
91
|
-
} // eslint-disable-next-line no-param-reassign
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
column.props = _objectSpread(_objectSpread({}, column.props), {}, {
|
|
95
|
-
style: {}
|
|
96
|
-
}); // eslint-disable-next-line no-param-reassign
|
|
97
|
-
|
|
98
|
-
column.header = _objectSpread(_objectSpread({}, column.header), {}, {
|
|
99
|
-
label: column.label,
|
|
100
|
-
formatters: [...dsUtilities.get(column, ['header', 'formatters'], [])],
|
|
101
|
-
props: {
|
|
102
|
-
style: column.headerStyle || {}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
if (useTextTruncation && !(dsUtilities.isFunction(column.customHeaderRenderer) || column.header.formatters.length)) {
|
|
107
|
-
column.header.formatters.push(value => /*#__PURE__*/_jsx__default["default"]("span", {
|
|
108
|
-
className: "cell-value"
|
|
109
|
-
}, void 0, value));
|
|
110
|
-
} // eslint-disable-next-line no-param-reassign
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
column.cell = _objectSpread(_objectSpread({}, column.cell), {}, {
|
|
114
|
-
transforms: [],
|
|
115
|
-
formatters: [...dsUtilities.get(column, ['cell', 'formatters'], [])],
|
|
116
|
-
scrollingFormatters: [...dsUtilities.get(column, ['cell', 'formatters'], [])],
|
|
117
|
-
props: {
|
|
118
|
-
style: column.cellStyle || {}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
if (useTextTruncation && !(dsUtilities.isFunction(column.customRenderer) || column.cell.formatters.length)) {
|
|
123
|
-
column.cell.formatters.push(value => /*#__PURE__*/_jsx__default["default"]("span", {
|
|
124
|
-
className: "cell-value",
|
|
125
|
-
style: {
|
|
126
|
-
justifyContent: column.type === 'number' ? 'flex-end' : 'flex-start'
|
|
127
|
-
}
|
|
128
|
-
}, void 0, value));
|
|
129
|
-
} // eslint-disable-next-line no-param-reassign
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
column.uuid = column.uuid || uuid.v4(); // eslint-disable-next-line no-param-reassign
|
|
133
|
-
|
|
134
|
-
column.visible = column.visible === undefined ? visible : column.visible; // eslint-disable-next-line no-param-reassign, max-lines
|
|
135
|
-
|
|
136
|
-
column.isUserColumn = column.isUserColumn || isUserColumn; // eslint-disable-next-line no-param-reassign
|
|
137
|
-
|
|
138
|
-
column.headerHookEffects = [];
|
|
139
|
-
return column;
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
exports.appendCellFormatter = appendCellFormatter;
|
|
144
|
-
exports.appendHeaderFormatter = appendHeaderFormatter;
|
|
145
|
-
exports["default"] = initColumnDefinition;
|
|
146
|
-
exports.mergeClassNameToColumnHeader = mergeClassNameToColumnHeader;
|
|
@@ -1,220 +0,0 @@
|
|
|
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;
|
package/cjs/useDataList/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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;
|
|
@@ -1,102 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
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;
|