@elliemae/ds-shared 1.57.1-rc.0 → 2.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Animations/BaseAnimation.js +25 -36
- package/cjs/Animations/Grow.js +31 -39
- package/cjs/Animations/GrowRight.js +31 -40
- package/cjs/Animations/GrowVertical.js +3 -2
- package/cjs/CheckableGroup.js +36 -50
- package/cjs/DeferRenderAfterComputation.js +12 -22
- package/cjs/FocusGroup/FocusGrid.js +94 -102
- package/cjs/FocusGroup/FocusGroup.js +215 -270
- package/cjs/FocusGroup/FocusGroupContext.js +1 -2
- package/cjs/FocusGroup/FocusGroupManager.js +88 -124
- package/cjs/FocusGroup/focusGroupManagerHoc.js +24 -29
- package/cjs/FocusGroup/index.js +14 -28
- package/cjs/FocusGroup/useFocusGroupItem.js +24 -27
- package/cjs/FocusGroup/utils/getNextCellPosition.js +14 -16
- package/cjs/GroupContext/Group.js +76 -104
- package/cjs/GroupContext/GroupContext.js +1 -2
- package/cjs/GroupContext/GroupItem.js +10 -11
- package/cjs/GroupContext/index.js +6 -15
- package/cjs/ScrollSync/ScrollSync.js +86 -112
- package/cjs/ScrollSync/ScrollSyncPane.js +49 -92
- package/cjs/ScrollSync/ScrollSyncProvider.js +32 -28
- package/cjs/ScrollSync/index.js +4 -14
- package/cjs/ScrollSync/useScrollSync.js +0 -1
- package/cjs/constants.js +43 -4
- package/cjs/createDataInstance/createInstancePlugin.js +6 -10
- package/cjs/createDataInstance/createInstanceRef.js +34 -42
- package/cjs/createDataInstance/utils.js +42 -76
- package/cjs/defer-render-hoc/index.js +19 -64
- package/cjs/dimsum.config.js +7 -0
- package/cjs/index.js +10 -21
- package/cjs/prop-types.js +59 -0
- package/cjs/react-spring/index.js +3 -6
- package/cjs/react-spring/renderprops.js +3 -6
- package/cjs/toolbar/ToolbarProvider.js +60 -81
- package/cjs/useDataGrid/VolatileRowsListener.js +13 -27
- package/cjs/useDataGrid/index.js +2 -17
- package/cjs/useDataGrid/initColumnDefinition.js +45 -53
- package/cjs/useDataGrid/useDataGrid.js +105 -152
- package/cjs/useDataList/index.js +2 -15
- package/cjs/useDataList/recordIterator.js +7 -11
- package/cjs/useDataList/useDataList.js +42 -63
- package/cjs/utils.js +39 -59
- package/cjs/virtualization/AutoHeightList.js +34 -27
- package/cjs/virtualization/FluidHeightList.js +23 -17
- package/cjs/virtualization/index.js +12 -18
- package/esm/Animations/BaseAnimation.js +24 -35
- package/esm/Animations/Grow.js +29 -37
- package/esm/Animations/GrowRight.js +29 -38
- package/esm/Animations/GrowVertical.js +3 -2
- package/esm/CheckableGroup.js +33 -46
- package/esm/DeferRenderAfterComputation.js +12 -21
- package/esm/FocusGroup/FocusGrid.js +86 -96
- package/esm/FocusGroup/FocusGroup.js +210 -263
- package/esm/FocusGroup/FocusGroupContext.js +0 -1
- package/esm/FocusGroup/FocusGroupManager.js +85 -115
- package/esm/FocusGroup/focusGroupManagerHoc.js +19 -23
- package/esm/FocusGroup/index.js +0 -14
- package/esm/FocusGroup/useFocusGroupItem.js +22 -25
- package/esm/FocusGroup/utils/getNextCellPosition.js +14 -16
- package/esm/GroupContext/Group.js +75 -96
- package/esm/GroupContext/GroupContext.js +1 -2
- package/esm/GroupContext/GroupItem.js +8 -9
- package/esm/GroupContext/index.js +0 -9
- package/esm/ScrollSync/ScrollSync.js +83 -104
- package/esm/ScrollSync/ScrollSyncPane.js +47 -83
- package/esm/ScrollSync/ScrollSyncProvider.js +31 -28
- package/esm/ScrollSync/index.js +0 -10
- package/esm/ScrollSync/useScrollSync.js +0 -1
- package/esm/constants.js +31 -5
- package/esm/createDataInstance/createInstancePlugin.js +5 -8
- package/esm/createDataInstance/createInstanceRef.js +29 -36
- package/esm/createDataInstance/utils.js +40 -74
- package/esm/defer-render-hoc/index.js +19 -57
- package/esm/dimsum.config.js +5 -0
- package/esm/index.js +0 -11
- package/esm/prop-types.js +43 -0
- package/esm/react-spring/index.js +1 -2
- package/esm/react-spring/renderprops.js +1 -2
- package/esm/toolbar/ToolbarProvider.js +55 -75
- package/esm/useDataGrid/VolatileRowsListener.js +12 -24
- package/esm/useDataGrid/index.js +0 -15
- package/esm/useDataGrid/initColumnDefinition.js +38 -45
- package/esm/useDataGrid/useDataGrid.js +85 -131
- package/esm/useDataList/index.js +0 -13
- package/esm/useDataList/recordIterator.js +7 -11
- package/esm/useDataList/useDataList.js +31 -51
- package/esm/utils.js +37 -57
- package/esm/virtualization/AutoHeightList.js +26 -19
- package/esm/virtualization/FluidHeightList.js +20 -14
- package/esm/virtualization/index.js +6 -12
- package/package.json +202 -13
- package/types/Animations/BaseAnimation.d.ts +12 -0
- package/types/Animations/Grow.d.ts +11 -0
- package/types/Animations/GrowRight.d.ts +11 -0
- package/types/Animations/GrowVertical.d.ts +1 -0
- package/types/CheckableGroup.d.ts +20 -0
- package/types/DeferRenderAfterComputation.d.ts +6 -0
- package/types/FocusGroup/FocusGrid.d.ts +10 -0
- package/types/FocusGroup/FocusGroup.d.ts +36 -0
- package/types/FocusGroup/FocusGroupContext.d.ts +3 -0
- package/types/FocusGroup/FocusGroupManager.d.ts +24 -0
- package/types/FocusGroup/focusGroupManagerHoc.d.ts +7 -0
- package/types/FocusGroup/index.d.ts +6 -0
- package/types/FocusGroup/useFocusGroupItem.d.ts +2 -0
- package/types/FocusGroup/utils/getNextCellPosition.d.ts +12 -0
- package/types/GroupContext/Group.d.ts +14 -0
- package/types/GroupContext/GroupContext.d.ts +2 -0
- package/types/GroupContext/GroupItem.d.ts +5 -0
- package/types/GroupContext/index.d.ts +3 -0
- package/types/ScrollSync/ScrollSync.d.ts +21 -0
- package/types/ScrollSync/ScrollSyncPane.d.ts +3 -0
- package/types/ScrollSync/ScrollSyncProvider.d.ts +12 -0
- package/types/ScrollSync/index.d.ts +2 -0
- package/types/ScrollSync/useScrollSync.d.ts +6 -0
- package/types/constants.d.ts +30 -0
- package/types/createDataInstance/createInstancePlugin.d.ts +1 -0
- package/types/createDataInstance/createInstanceRef.d.ts +12 -0
- package/types/createDataInstance/tests/createInstanceRef.test.d.ts +0 -0
- package/types/createDataInstance/utils.d.ts +9 -0
- package/types/dimsum.config.d.ts +4 -0
- package/types/index.d.ts +2 -0
- package/types/prop-types.d.ts +41 -0
- package/types/react-spring/index.d.ts +1 -0
- package/types/react-spring/renderprops.d.ts +1 -0
- package/types/toolbar/ToolbarProvider.d.ts +10 -0
- package/types/useDataGrid/VolatileRowsListener.d.ts +5 -0
- package/types/useDataGrid/index.d.ts +1 -0
- package/types/useDataGrid/initColumnDefinition.d.ts +4 -0
- package/types/useDataGrid/useDataGrid.d.ts +8 -0
- package/types/useDataList/index.d.ts +1 -0
- package/types/useDataList/recordIterator.d.ts +1 -0
- package/types/useDataList/useDataList.d.ts +13 -0
- package/types/utils.d.ts +22 -0
- package/types/virtualization/AutoHeightList.d.ts +2 -0
- package/types/virtualization/FluidHeightList.d.ts +2 -0
- package/types/virtualization/index.d.ts +9 -0
- package/Animations/BaseAnimation/package.json +0 -10
- package/Animations/Grow/package.json +0 -10
- package/Animations/GrowRight/package.json +0 -10
- package/Animations/GrowVertical/package.json +0 -10
- package/CheckableGroup/package.json +0 -10
- package/DeferRenderAfterComputation/package.json +0 -10
- package/FocusGroup/FocusGrid/package.json +0 -10
- package/FocusGroup/FocusGroup/package.json +0 -10
- package/FocusGroup/FocusGroupContext/package.json +0 -10
- package/FocusGroup/FocusGroupManager/package.json +0 -10
- package/FocusGroup/focusGroupManagerHoc/package.json +0 -10
- package/FocusGroup/package.json +0 -10
- package/FocusGroup/useFocusGroupItem/package.json +0 -10
- package/FocusGroup/utils/getNextCellPosition/package.json +0 -10
- package/GroupContext/Group/package.json +0 -10
- package/GroupContext/GroupContext/package.json +0 -10
- package/GroupContext/GroupItem/package.json +0 -10
- package/GroupContext/package.json +0 -10
- package/ScrollSync/ScrollSync/package.json +0 -10
- package/ScrollSync/ScrollSyncPane/package.json +0 -10
- package/ScrollSync/ScrollSyncProvider/package.json +0 -10
- package/ScrollSync/package.json +0 -10
- package/ScrollSync/useScrollSync/package.json +0 -10
- package/cjs/Animations/BaseAnimation.js.map +0 -1
- package/cjs/Animations/Grow.js.map +0 -1
- package/cjs/Animations/GrowRight.js.map +0 -1
- package/cjs/Animations/GrowVertical.js.map +0 -1
- package/cjs/CheckableGroup.js.map +0 -1
- package/cjs/DeferRenderAfterComputation.js.map +0 -1
- package/cjs/FocusGroup/FocusGrid.js.map +0 -1
- package/cjs/FocusGroup/FocusGroup.js.map +0 -1
- package/cjs/FocusGroup/FocusGroupContext.js.map +0 -1
- package/cjs/FocusGroup/FocusGroupManager.js.map +0 -1
- package/cjs/FocusGroup/focusGroupManagerHoc.js.map +0 -1
- package/cjs/FocusGroup/index.js.map +0 -1
- package/cjs/FocusGroup/useFocusGroupItem.js.map +0 -1
- package/cjs/FocusGroup/utils/getNextCellPosition.js.map +0 -1
- package/cjs/GroupContext/Group.js.map +0 -1
- package/cjs/GroupContext/GroupContext.js.map +0 -1
- package/cjs/GroupContext/GroupItem.js.map +0 -1
- package/cjs/GroupContext/index.js.map +0 -1
- package/cjs/ScrollSync/ScrollSync.js.map +0 -1
- package/cjs/ScrollSync/ScrollSyncPane.js.map +0 -1
- package/cjs/ScrollSync/ScrollSyncProvider.js.map +0 -1
- package/cjs/ScrollSync/index.js.map +0 -1
- package/cjs/ScrollSync/useScrollSync.js.map +0 -1
- package/cjs/constants.js.map +0 -1
- package/cjs/createDataInstance/createInstancePlugin.js.map +0 -1
- package/cjs/createDataInstance/createInstanceRef.js.map +0 -1
- package/cjs/createDataInstance/utils.js.map +0 -1
- package/cjs/defer-render-hoc/index.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/react-spring/index.js.map +0 -1
- package/cjs/react-spring/renderprops.js.map +0 -1
- package/cjs/toolbar/ToolbarProvider.js.map +0 -1
- package/cjs/useDataGrid/VolatileRowsListener.js.map +0 -1
- package/cjs/useDataGrid/index.js.map +0 -1
- package/cjs/useDataGrid/initColumnDefinition.js.map +0 -1
- package/cjs/useDataGrid/useDataGrid.js.map +0 -1
- package/cjs/useDataList/index.js.map +0 -1
- package/cjs/useDataList/recordIterator.js.map +0 -1
- package/cjs/useDataList/useDataList.js.map +0 -1
- package/cjs/utils.js.map +0 -1
- package/cjs/virtualization/AutoHeightList.js.map +0 -1
- package/cjs/virtualization/FluidHeightList.js.map +0 -1
- package/cjs/virtualization/index.js.map +0 -1
- package/constants/package.json +0 -10
- package/createDataInstance/createInstancePlugin/package.json +0 -10
- package/createDataInstance/createInstanceRef/package.json +0 -10
- package/createDataInstance/utils/package.json +0 -10
- package/defer-render-hoc/package.json +0 -10
- package/esm/Animations/BaseAnimation.js.map +0 -1
- package/esm/Animations/Grow.js.map +0 -1
- package/esm/Animations/GrowRight.js.map +0 -1
- package/esm/Animations/GrowVertical.js.map +0 -1
- package/esm/CheckableGroup.js.map +0 -1
- package/esm/DeferRenderAfterComputation.js.map +0 -1
- package/esm/FocusGroup/FocusGrid.js.map +0 -1
- package/esm/FocusGroup/FocusGroup.js.map +0 -1
- package/esm/FocusGroup/FocusGroupContext.js.map +0 -1
- package/esm/FocusGroup/FocusGroupManager.js.map +0 -1
- package/esm/FocusGroup/focusGroupManagerHoc.js.map +0 -1
- package/esm/FocusGroup/index.js.map +0 -1
- package/esm/FocusGroup/useFocusGroupItem.js.map +0 -1
- package/esm/FocusGroup/utils/getNextCellPosition.js.map +0 -1
- package/esm/GroupContext/Group.js.map +0 -1
- package/esm/GroupContext/GroupContext.js.map +0 -1
- package/esm/GroupContext/GroupItem.js.map +0 -1
- package/esm/GroupContext/index.js.map +0 -1
- package/esm/ScrollSync/ScrollSync.js.map +0 -1
- package/esm/ScrollSync/ScrollSyncPane.js.map +0 -1
- package/esm/ScrollSync/ScrollSyncProvider.js.map +0 -1
- package/esm/ScrollSync/index.js.map +0 -1
- package/esm/ScrollSync/useScrollSync.js.map +0 -1
- package/esm/constants.js.map +0 -1
- package/esm/createDataInstance/createInstancePlugin.js.map +0 -1
- package/esm/createDataInstance/createInstanceRef.js.map +0 -1
- package/esm/createDataInstance/utils.js.map +0 -1
- package/esm/defer-render-hoc/index.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/react-spring/index.js.map +0 -1
- package/esm/react-spring/renderprops.js.map +0 -1
- package/esm/toolbar/ToolbarProvider.js.map +0 -1
- package/esm/useDataGrid/VolatileRowsListener.js.map +0 -1
- package/esm/useDataGrid/index.js.map +0 -1
- package/esm/useDataGrid/initColumnDefinition.js.map +0 -1
- package/esm/useDataGrid/useDataGrid.js.map +0 -1
- package/esm/useDataList/index.js.map +0 -1
- package/esm/useDataList/recordIterator.js.map +0 -1
- package/esm/useDataList/useDataList.js.map +0 -1
- package/esm/utils.js.map +0 -1
- package/esm/virtualization/AutoHeightList.js.map +0 -1
- package/esm/virtualization/FluidHeightList.js.map +0 -1
- package/esm/virtualization/index.js.map +0 -1
- package/react-spring/package.json +0 -10
- package/react-spring/renderprops/package.json +0 -10
- package/toolbar/ToolbarProvider/package.json +0 -10
- package/useDataGrid/VolatileRowsListener/package.json +0 -10
- package/useDataGrid/initColumnDefinition/package.json +0 -10
- package/useDataGrid/package.json +0 -10
- package/useDataGrid/useDataGrid/package.json +0 -10
- package/useDataList/package.json +0 -10
- package/useDataList/recordIterator/package.json +0 -10
- package/useDataList/useDataList/package.json +0 -10
- package/utils/package.json +0 -10
- package/virtualization/AutoHeightList/package.json +0 -10
- package/virtualization/FluidHeightList/package.json +0 -10
- package/virtualization/package.json +0 -10
|
@@ -1,32 +1,20 @@
|
|
|
1
|
-
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
|
|
2
|
-
import _createClass from '@babel/runtime/helpers/esm/createClass';
|
|
3
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
-
import { safeCall } from '@elliemae/ds-utilities';
|
|
5
|
-
|
|
6
|
-
var VolatileRowsListener = /*#__PURE__*/function () {
|
|
7
|
-
function VolatileRowsListener() {
|
|
8
|
-
_classCallCheck(this, VolatileRowsListener);
|
|
2
|
+
import { safeCall } from '@elliemae/ds-utilities/utils';
|
|
9
3
|
|
|
4
|
+
class VolatileRowsListener {
|
|
5
|
+
constructor() {
|
|
10
6
|
_defineProperty(this, "observers", []);
|
|
11
7
|
}
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.observers.forEach(function (observer) {
|
|
22
|
-
return safeCall(observer, nextRows);
|
|
23
|
-
});
|
|
24
|
-
this.observers = [];
|
|
25
|
-
}
|
|
26
|
-
}]);
|
|
9
|
+
observe(listener) {
|
|
10
|
+
this.observers.push(listener);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
notify(nextRows) {
|
|
14
|
+
this.observers.forEach(observer => safeCall(observer, nextRows));
|
|
15
|
+
this.observers = [];
|
|
16
|
+
}
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
}();
|
|
18
|
+
}
|
|
30
19
|
|
|
31
20
|
export { VolatileRowsListener as default };
|
|
32
|
-
//# sourceMappingURL=VolatileRowsListener.js.map
|
package/esm/useDataGrid/index.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
1
|
export { default } from './useDataGrid.js';
|
|
2
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
4
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
5
|
-
import '@elliemae/ds-utilities';
|
|
6
|
-
import 'react';
|
|
7
|
-
import 'uuid';
|
|
8
|
-
import 'table-resolver';
|
|
9
|
-
import './initColumnDefinition.js';
|
|
10
|
-
import '@babel/runtime/helpers/esm/toConsumableArray';
|
|
11
|
-
import '../createDataInstance/utils.js';
|
|
12
|
-
import './VolatileRowsListener.js';
|
|
13
|
-
import '@babel/runtime/helpers/esm/classCallCheck';
|
|
14
|
-
import '@babel/runtime/helpers/esm/createClass';
|
|
15
|
-
import '../utils.js';
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import
|
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
|
+
import 'core-js/modules/es.string.replace.js';
|
|
5
|
+
import 'react';
|
|
4
6
|
import { v4 } from 'uuid';
|
|
5
|
-
import { curry, get, cloneDeep, set, isFunction } from '@elliemae/ds-utilities';
|
|
7
|
+
import { curry, get, cloneDeep, set, isFunction } from '@elliemae/ds-utilities/utils';
|
|
6
8
|
|
|
7
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8
10
|
|
|
9
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var nextColumn = cloneDeep(column);
|
|
21
|
-
var formatters = get(nextColumn, ['cell', path], []);
|
|
22
|
-
var scrollingFormatters = get(nextColumn, 'cell.scrollingFormatters', []);
|
|
13
|
+
const appendHeaderFormatter = curry((formatter, column) => _objectSpread(_objectSpread({}, column), {}, {
|
|
14
|
+
header: _objectSpread(_objectSpread({}, column.header), {}, {
|
|
15
|
+
formatters: [...get(column, 'header.formatters', []), formatter]
|
|
16
|
+
})
|
|
17
|
+
}));
|
|
18
|
+
const appendCellFormatter = curry((formatter, column, path = 'formatters') => {
|
|
19
|
+
const nextColumn = cloneDeep(column);
|
|
20
|
+
const formatters = get(nextColumn, ['cell', path], []);
|
|
21
|
+
const scrollingFormatters = get(nextColumn, 'cell.scrollingFormatters', []);
|
|
23
22
|
|
|
24
23
|
if (Array.isArray(formatter)) {
|
|
25
24
|
if (formatter[1]) scrollingFormatters.push(formatter[1]);
|
|
@@ -33,15 +32,15 @@ var appendCellFormatter = curry(function (formatter, column) {
|
|
|
33
32
|
set(nextColumn, 'cell.scrollingFormatters', scrollingFormatters);
|
|
34
33
|
return nextColumn;
|
|
35
34
|
});
|
|
36
|
-
|
|
35
|
+
const defaultColumnDefinitionOptions = {
|
|
37
36
|
normalize: false,
|
|
38
37
|
useTextTruncation: true,
|
|
39
38
|
isUserColumn: true,
|
|
40
39
|
visible: true
|
|
41
40
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const mergeClassNameToColumnHeader = curry((className, column) => {
|
|
42
|
+
const headerProps = get(column, ['header', 'props'], {});
|
|
43
|
+
const headerClassName = headerProps.className || '';
|
|
45
44
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
46
45
|
header: _objectSpread(_objectSpread({}, column.header), {}, {
|
|
47
46
|
props: _objectSpread(_objectSpread({}, headerProps), {}, {
|
|
@@ -50,10 +49,9 @@ var mergeClassNameToColumnHeader = curry(function (className, column) {
|
|
|
50
49
|
})
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
|
-
function initColumnDefinition() {
|
|
54
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
52
|
+
function initColumnDefinition(options = {}) {
|
|
55
53
|
// eslint-disable-next-line complexity
|
|
56
|
-
return
|
|
54
|
+
return column => {
|
|
57
55
|
// todo: clean this
|
|
58
56
|
if (column.type === 'number') {
|
|
59
57
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -62,12 +60,12 @@ function initColumnDefinition() {
|
|
|
62
60
|
};
|
|
63
61
|
}
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
const {
|
|
64
|
+
useTextTruncation = true,
|
|
65
|
+
isUserColumn,
|
|
66
|
+
visible,
|
|
67
|
+
normalize
|
|
68
|
+
} = _objectSpread(_objectSpread({}, defaultColumnDefinitionOptions), options);
|
|
71
69
|
|
|
72
70
|
if (normalize) {
|
|
73
71
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -83,39 +81,35 @@ function initColumnDefinition() {
|
|
|
83
81
|
|
|
84
82
|
column.header = _objectSpread(_objectSpread({}, column.header), {}, {
|
|
85
83
|
label: column.label,
|
|
86
|
-
formatters:
|
|
84
|
+
formatters: [...get(column, ['header', 'formatters'], [])],
|
|
87
85
|
props: {
|
|
88
86
|
style: column.headerStyle || {}
|
|
89
87
|
}
|
|
90
88
|
});
|
|
91
89
|
|
|
92
90
|
if (useTextTruncation && !(isFunction(column.customHeaderRenderer) || column.header.formatters.length)) {
|
|
93
|
-
column.header.formatters.push(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, value);
|
|
97
|
-
});
|
|
91
|
+
column.header.formatters.push(value => /*#__PURE__*/_jsx("span", {
|
|
92
|
+
className: "cell-value"
|
|
93
|
+
}, void 0, value));
|
|
98
94
|
} // eslint-disable-next-line no-param-reassign
|
|
99
95
|
|
|
100
96
|
|
|
101
97
|
column.cell = _objectSpread(_objectSpread({}, column.cell), {}, {
|
|
102
98
|
transforms: [],
|
|
103
|
-
formatters:
|
|
104
|
-
scrollingFormatters:
|
|
99
|
+
formatters: [...get(column, ['cell', 'formatters'], [])],
|
|
100
|
+
scrollingFormatters: [...get(column, ['cell', 'formatters'], [])],
|
|
105
101
|
props: {
|
|
106
102
|
style: column.cellStyle || {}
|
|
107
103
|
}
|
|
108
104
|
});
|
|
109
105
|
|
|
110
106
|
if (useTextTruncation && !(isFunction(column.customRenderer) || column.cell.formatters.length)) {
|
|
111
|
-
column.cell.formatters.push(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}, value);
|
|
118
|
-
});
|
|
107
|
+
column.cell.formatters.push(value => /*#__PURE__*/_jsx("span", {
|
|
108
|
+
className: "cell-value",
|
|
109
|
+
style: {
|
|
110
|
+
justifyContent: column.type === 'number' ? 'flex-end' : 'flex-start'
|
|
111
|
+
}
|
|
112
|
+
}, void 0, value));
|
|
119
113
|
} // eslint-disable-next-line no-param-reassign
|
|
120
114
|
|
|
121
115
|
|
|
@@ -131,4 +125,3 @@ function initColumnDefinition() {
|
|
|
131
125
|
}
|
|
132
126
|
|
|
133
127
|
export { appendCellFormatter, appendHeaderFormatter, initColumnDefinition as default, mergeClassNameToColumnHeader };
|
|
134
|
-
//# sourceMappingURL=initColumnDefinition.js.map
|
|
@@ -1,95 +1,71 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
|
|
3
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
-
import
|
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
|
+
import { compose, cloneDeep, isObject, isEqual } from '@elliemae/ds-utilities/utils';
|
|
5
5
|
import { useRef, useState, useMemo } from 'react';
|
|
6
6
|
import { v4 } from 'uuid';
|
|
7
7
|
import * as resolve from 'table-resolver';
|
|
8
|
+
import useDerivedStateFromProps from '@elliemae/ds-utilities/hooks/useDerivedStateFromProps';
|
|
9
|
+
import usePrevious from '@elliemae/ds-utilities/hooks/usePrevious';
|
|
10
|
+
import { setRef } from '@elliemae/ds-utilities/system';
|
|
8
11
|
import initColumnDefinition from './initColumnDefinition.js';
|
|
9
12
|
import { applyDecorators, decorateColumns, reducePropsGetter } from '../createDataInstance/utils.js';
|
|
10
13
|
import VolatileRowsListener from './VolatileRowsListener.js';
|
|
11
14
|
import { isInternetExplorer } from '../utils.js';
|
|
12
|
-
import '@babel/runtime/helpers/esm/toConsumableArray';
|
|
13
|
-
import '@babel/runtime/helpers/esm/classCallCheck';
|
|
14
|
-
import '@babel/runtime/helpers/esm/createClass';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const _excluded = ["uuid", "plugins", "rows", "columns", "renderers"];
|
|
17
17
|
|
|
18
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19
19
|
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
|
-
|
|
21
|
+
const IS_INTERNET_EXPLORER = isInternetExplorer(); // TODO: Reuse createDataInstance for the grid the same
|
|
22
22
|
// way as the list does ex: packages/ds-shared/src/useDataList/useDataList.js
|
|
23
23
|
// eslint-disable-next-line max-statements
|
|
24
24
|
|
|
25
25
|
function useDataGrid(_ref) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
let {
|
|
27
|
+
uuid: uuidProp,
|
|
28
|
+
plugins: pluginsFromProps,
|
|
29
|
+
rows,
|
|
30
|
+
columns,
|
|
31
|
+
renderers = {}
|
|
32
|
+
} = _ref,
|
|
32
33
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
hasScroll = _useState4[0],
|
|
50
|
-
setHasScroll = _useState4[1];
|
|
51
|
-
|
|
52
|
-
var _useState5 = useState(false),
|
|
53
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
54
|
-
isRowDragging = _useState6[0],
|
|
55
|
-
setIsRowDragging = _useState6[1];
|
|
56
|
-
|
|
57
|
-
var isScrolling = useRef();
|
|
58
|
-
var shouldRefocus = useRef(); // todo: we probably need a plugin for focus related stuff
|
|
59
|
-
|
|
60
|
-
var _useState7 = useState(function () {
|
|
61
|
-
return new VolatileRowsListener();
|
|
62
|
-
}),
|
|
63
|
-
_useState8 = _slicedToArray(_useState7, 1),
|
|
64
|
-
RowsObserver = _useState8[0]; // todo move this with rows composition
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var _useDerivedStateFromP = useDerivedStateFromProps(rows, {
|
|
35
|
+
const plugins = pluginsFromProps;
|
|
36
|
+
const instance = useRef();
|
|
37
|
+
const tableRef = useRef();
|
|
38
|
+
const headerRef = useRef();
|
|
39
|
+
const bodyRef = useRef();
|
|
40
|
+
const bodyInnerRef = useRef();
|
|
41
|
+
const [uuid] = useState(uuidProp || (() => v4()));
|
|
42
|
+
const [hasScroll, setHasScroll] = useState(false);
|
|
43
|
+
const [isRowDragging, setIsRowDragging] = useState(false);
|
|
44
|
+
const isScrolling = useRef();
|
|
45
|
+
const shouldRefocus = useRef(); // todo: we probably need a plugin for focus related stuff
|
|
46
|
+
|
|
47
|
+
const [RowsObserver] = useState(() => new VolatileRowsListener()); // todo move this with rows composition
|
|
48
|
+
|
|
49
|
+
const [originalRows, updateRows] = useDerivedStateFromProps(rows, {
|
|
68
50
|
onUpdate: resolve.resolve({
|
|
69
|
-
columns
|
|
70
|
-
method:
|
|
71
|
-
return compose(resolve.byFunction('valueTransformation')(extra), resolve.nested(extra));
|
|
72
|
-
}
|
|
51
|
+
columns,
|
|
52
|
+
method: extra => compose(resolve.byFunction('valueTransformation')(extra), resolve.nested(extra))
|
|
73
53
|
}),
|
|
74
54
|
updateOnStateChange: true
|
|
75
|
-
})
|
|
76
|
-
_useDerivedStateFromP2 = _slicedToArray(_useDerivedStateFromP, 2),
|
|
77
|
-
originalRows = _useDerivedStateFromP2[0],
|
|
78
|
-
updateRows = _useDerivedStateFromP2[1];
|
|
79
|
-
|
|
55
|
+
});
|
|
80
56
|
instance.current = {
|
|
81
57
|
decoratedRenderers: cloneDeep(renderers),
|
|
82
58
|
decoratedColumns: columns,
|
|
83
|
-
columns
|
|
84
|
-
rows
|
|
59
|
+
columns,
|
|
60
|
+
rows,
|
|
85
61
|
composedRows: originalRows,
|
|
86
62
|
getRowProps: [],
|
|
87
63
|
getHeaderRowProps: [],
|
|
88
64
|
getBodyProps: [],
|
|
89
65
|
getTableProps: [],
|
|
90
66
|
effects: [],
|
|
91
|
-
uuid
|
|
92
|
-
props
|
|
67
|
+
uuid,
|
|
68
|
+
props,
|
|
93
69
|
refs: {
|
|
94
70
|
table: tableRef,
|
|
95
71
|
body: bodyRef,
|
|
@@ -97,54 +73,40 @@ function useDataGrid(_ref) {
|
|
|
97
73
|
innerBody: bodyInnerRef
|
|
98
74
|
},
|
|
99
75
|
state: {
|
|
100
|
-
hasScroll
|
|
76
|
+
hasScroll
|
|
101
77
|
},
|
|
102
78
|
actions: {
|
|
103
|
-
updateRows
|
|
79
|
+
updateRows
|
|
104
80
|
},
|
|
105
|
-
updateRows
|
|
81
|
+
updateRows,
|
|
106
82
|
// eslint-disable-next-line no-return-assign
|
|
107
|
-
enableEvents:
|
|
108
|
-
return document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? '' : null;
|
|
109
|
-
},
|
|
83
|
+
enableEvents: () => document.body.style.pointerEvents = IS_INTERNET_EXPLORER ? '' : null,
|
|
110
84
|
// eslint-disable-next-line no-return-assign
|
|
111
|
-
disableEvents:
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
observeRows: function observeRows(observer) {
|
|
115
|
-
return RowsObserver.observe(observer);
|
|
116
|
-
},
|
|
85
|
+
disableEvents: () => document.body.style.pointerEvents = 'none',
|
|
86
|
+
observeRows: observer => RowsObserver.observe(observer),
|
|
117
87
|
hotKeys: {},
|
|
118
|
-
shouldRefocus
|
|
119
|
-
isScrolling
|
|
120
|
-
setHasScroll
|
|
121
|
-
setIsRowDragging
|
|
122
|
-
isRowDragging
|
|
123
|
-
plugins
|
|
88
|
+
shouldRefocus,
|
|
89
|
+
isScrolling,
|
|
90
|
+
setHasScroll,
|
|
91
|
+
setIsRowDragging,
|
|
92
|
+
isRowDragging,
|
|
93
|
+
plugins
|
|
124
94
|
};
|
|
125
95
|
|
|
126
|
-
instance.current.getState =
|
|
127
|
-
return instance.current.state;
|
|
128
|
-
};
|
|
96
|
+
instance.current.getState = () => instance.current.state;
|
|
129
97
|
|
|
130
|
-
instance.current.getInstance =
|
|
131
|
-
return instance.current;
|
|
132
|
-
};
|
|
98
|
+
instance.current.getInstance = () => instance.current;
|
|
133
99
|
|
|
134
|
-
|
|
100
|
+
const defaultDecorators = {
|
|
135
101
|
decorateGrid: [],
|
|
136
102
|
registerStateHook: [],
|
|
137
103
|
registerHotKeys: [],
|
|
138
104
|
decorateColumn: [],
|
|
139
|
-
decorateColumns: [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
normalize: props.normalizeDataKeys
|
|
145
|
-
})(col);
|
|
146
|
-
});
|
|
147
|
-
}],
|
|
105
|
+
decorateColumns: [cols => cols.map(col => initColumnDefinition({
|
|
106
|
+
useTextTruncation: col.useTextTruncation,
|
|
107
|
+
wrapText: props.wrapText,
|
|
108
|
+
normalize: props.normalizeDataKeys
|
|
109
|
+
})(col))],
|
|
148
110
|
decorateRenderers: [],
|
|
149
111
|
getRowProps: [],
|
|
150
112
|
getHeaderRowProps: [],
|
|
@@ -153,42 +115,39 @@ function useDataGrid(_ref) {
|
|
|
153
115
|
getHeaderProps: [],
|
|
154
116
|
composeRows: []
|
|
155
117
|
};
|
|
156
|
-
|
|
157
|
-
|
|
118
|
+
const decorators = useMemo(() => {
|
|
119
|
+
let nextDecorators = defaultDecorators; // eslint-disable-next-line no-return-assign
|
|
158
120
|
|
|
159
|
-
plugins.forEach(
|
|
160
|
-
return nextDecorators = plugin(nextDecorators);
|
|
161
|
-
});
|
|
121
|
+
plugins.forEach(plugin => nextDecorators = plugin(nextDecorators));
|
|
162
122
|
return nextDecorators;
|
|
163
123
|
}, [plugins]);
|
|
164
|
-
instance.current = decorators.decorateGrid.reduce(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
actions = _decorator.actions;
|
|
171
|
-
|
|
124
|
+
instance.current = decorators.decorateGrid.reduce((nextInstance, decorator) => _objectSpread(_objectSpread({}, nextInstance), decorator(instance.current)), instance.current);
|
|
125
|
+
instance.current = decorators.registerStateHook.reduce((nextInstance, decorator) => {
|
|
126
|
+
const {
|
|
127
|
+
state,
|
|
128
|
+
actions
|
|
129
|
+
} = decorator(instance.current);
|
|
172
130
|
return _objectSpread(_objectSpread({}, nextInstance), {}, {
|
|
173
131
|
state: _objectSpread(_objectSpread({}, nextInstance.state), state),
|
|
174
132
|
actions: _objectSpread(_objectSpread({}, nextInstance.actions), actions)
|
|
175
133
|
});
|
|
176
134
|
}, instance.current);
|
|
177
135
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
136
|
+
const reduceHotKey = (nextInstance, {
|
|
137
|
+
key,
|
|
138
|
+
handler,
|
|
139
|
+
options
|
|
140
|
+
}) => _objectSpread(_objectSpread({}, nextInstance), {}, {
|
|
141
|
+
hotKeys: _objectSpread(_objectSpread({}, nextInstance.hotKeys), {}, {
|
|
142
|
+
[key]: {
|
|
143
|
+
handler,
|
|
144
|
+
options
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
});
|
|
189
148
|
|
|
190
|
-
instance.current = decorators.registerHotKeys.reduce(
|
|
191
|
-
|
|
149
|
+
instance.current = decorators.registerHotKeys.reduce((nextInstance, decorator) => {
|
|
150
|
+
const hotKeys = decorator(nextInstance);
|
|
192
151
|
|
|
193
152
|
if (Array.isArray(hotKeys)) {
|
|
194
153
|
return hotKeys.reduce(reduceHotKey, nextInstance);
|
|
@@ -197,10 +156,8 @@ function useDataGrid(_ref) {
|
|
|
197
156
|
return reduceHotKey(nextInstance, hotKeys);
|
|
198
157
|
}, instance.current);
|
|
199
158
|
instance.current.decoratedRenderers = applyDecorators(instance.current.decoratedRenderers, decorators.decorateRenderers, instance.current);
|
|
200
|
-
instance.current.decoratedColumns = useMemo(
|
|
201
|
-
|
|
202
|
-
return typeof column.visible === 'undefined' || column.visible;
|
|
203
|
-
});
|
|
159
|
+
instance.current.decoratedColumns = useMemo(() => {
|
|
160
|
+
const visibleColumns = cloneDeep(columns).filter(column => typeof column.visible === 'undefined' || column.visible);
|
|
204
161
|
return visibleColumns.length ? decorateColumns(visibleColumns, decorators, instance.current) : [];
|
|
205
162
|
}, [columns]);
|
|
206
163
|
instance.current.getBodyProps = reducePropsGetter(decorators.getBodyProps, instance.current);
|
|
@@ -208,12 +165,10 @@ function useDataGrid(_ref) {
|
|
|
208
165
|
instance.current.getRowProps = reducePropsGetter(decorators.getRowProps, instance.current);
|
|
209
166
|
instance.current.getHeaderRowProps = reducePropsGetter(decorators.getHeaderRowProps, instance.current);
|
|
210
167
|
instance.current.getTableProps = reducePropsGetter(decorators.getTableProps, instance.current);
|
|
211
|
-
instance.current.composedRows = decorators.composeRows.reduce(
|
|
212
|
-
return getter(nextRows, instance.current);
|
|
213
|
-
}, instance.current.composedRows);
|
|
168
|
+
instance.current.composedRows = decorators.composeRows.reduce((nextRows, getter) => getter(nextRows, instance.current), instance.current.composedRows);
|
|
214
169
|
RowsObserver.notify(instance.current.composedRows);
|
|
215
|
-
|
|
216
|
-
|
|
170
|
+
const currentShouldRefocus = instance.current.shouldRefocus.current;
|
|
171
|
+
const prevState = usePrevious(instance.current.state);
|
|
217
172
|
|
|
218
173
|
if (isObject(currentShouldRefocus) && currentShouldRefocus.forced) {
|
|
219
174
|
instance.current.shouldRefocus.current = currentShouldRefocus.value;
|
|
@@ -223,9 +178,8 @@ function useDataGrid(_ref) {
|
|
|
223
178
|
|
|
224
179
|
if (props.instanceRef) setRef(props.instanceRef, instance.current);
|
|
225
180
|
return _objectSpread(_objectSpread({}, instance.current), {}, {
|
|
226
|
-
decorators
|
|
181
|
+
decorators
|
|
227
182
|
});
|
|
228
183
|
}
|
|
229
184
|
|
|
230
185
|
export { useDataGrid as default };
|
|
231
|
-
//# sourceMappingURL=useDataGrid.js.map
|
package/esm/useDataList/index.js
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
1
|
export { default } from './useDataList.js';
|
|
2
|
-
import '@babel/runtime/helpers/esm/toConsumableArray';
|
|
3
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
5
|
-
import 'react';
|
|
6
|
-
import '@elliemae/ds-utilities';
|
|
7
|
-
import 'lodash/get';
|
|
8
|
-
import '../createDataInstance/utils.js';
|
|
9
|
-
import './recordIterator.js';
|
|
10
|
-
import '../createDataInstance/createInstanceRef.js';
|
|
11
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
12
|
-
import 'uuid';
|
|
13
|
-
import 'lodash';
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
const defaultStrategy = () => {
|
|
2
2
|
throw Error('Implement an iterator strategy for record iterator');
|
|
3
3
|
};
|
|
4
4
|
|
|
5
|
-
function recordIterator(records) {
|
|
6
|
-
|
|
7
|
-
var decorators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
8
|
-
var instance = arguments.length > 3 ? arguments[3] : undefined;
|
|
9
|
-
var nextRows = [];
|
|
5
|
+
function recordIterator(records, strategy = defaultStrategy, decorators = [], instance) {
|
|
6
|
+
const nextRows = [];
|
|
10
7
|
strategy({
|
|
11
8
|
data: records,
|
|
12
|
-
cb:
|
|
13
|
-
|
|
9
|
+
cb: row => {
|
|
10
|
+
let nextRow = row; // eslint-disable-next-line no-loops/no-loops,no-plusplus
|
|
14
11
|
|
|
15
|
-
for (
|
|
12
|
+
for (let i = 0; i < decorators.length; i++) {
|
|
16
13
|
nextRow = decorators[i](nextRow, instance);
|
|
17
14
|
if (!nextRow) break;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
if (nextRow) nextRows.push(nextRow);
|
|
21
18
|
},
|
|
22
|
-
instance
|
|
19
|
+
instance
|
|
23
20
|
});
|
|
24
21
|
return nextRows;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
export { recordIterator };
|
|
28
|
-
//# sourceMappingURL=recordIterator.js.map
|