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