@elliemae/ds-shared 2.2.0-alpha.4 → 3.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Animations/BaseAnimation.js +35 -55
- package/cjs/Animations/Grow.js +41 -54
- package/cjs/Animations/GrowRight.js +41 -63
- package/cjs/Animations/GrowVertical.js +7 -47
- package/cjs/CheckableGroup.js +65 -67
- package/cjs/DeferRenderAfterComputation.js +24 -48
- package/cjs/FocusGroup/FocusGrid.js +143 -108
- package/cjs/FocusGroup/FocusGroup.js +147 -88
- package/cjs/FocusGroup/FocusGroupContext.js +11 -38
- package/cjs/FocusGroup/FocusGroupManager.js +47 -56
- package/cjs/FocusGroup/focusGroupManagerHoc.js +42 -52
- package/cjs/FocusGroup/index.js +21 -47
- package/cjs/FocusGroup/useFocusGroupItem.js +51 -59
- package/cjs/FocusGroup/utils/getNextCellPosition.js +27 -47
- package/cjs/GroupContext/Group.js +73 -64
- package/cjs/GroupContext/GroupContext.js +13 -36
- package/cjs/GroupContext/GroupItem.js +21 -39
- package/cjs/GroupContext/index.js +13 -39
- package/cjs/ScrollSync/ScrollSync.js +75 -60
- package/cjs/ScrollSync/ScrollSyncPane.js +60 -52
- package/cjs/ScrollSync/ScrollSyncProvider.js +50 -103
- package/cjs/ScrollSync/index.js +11 -37
- package/cjs/ScrollSync/useScrollSync.js +7 -38
- package/cjs/constants.js +46 -65
- package/cjs/createDataInstance/createInstancePlugin.js +29 -41
- package/cjs/createDataInstance/createInstanceRef.js +71 -66
- package/cjs/createDataInstance/utils.js +100 -76
- package/cjs/defer-render-hoc/index.js +41 -48
- package/cjs/dimsum.config.js +6 -38
- package/cjs/index.js +17 -40
- package/cjs/prop-types.js +49 -106
- package/cjs/react-spring/index.js +14 -28
- package/cjs/react-spring/renderprops.js +14 -28
- package/cjs/toolbar/ToolbarProvider.js +94 -82
- package/cjs/useDataGrid/VolatileRowsListener.js +13 -38
- package/cjs/useDataGrid/index.js +7 -36
- package/cjs/useDataGrid/initColumnDefinition.js +110 -105
- package/cjs/useDataGrid/useDataGrid.js +148 -122
- package/cjs/useDataList/index.js +7 -36
- package/cjs/useDataList/recordIterator.js +18 -42
- package/cjs/useDataList/useDataList.js +83 -74
- package/cjs/utils.js +80 -71
- package/cjs/virtualization/AutoHeightList.js +54 -62
- package/cjs/virtualization/FluidHeightList.js +48 -42
- package/cjs/virtualization/index.js +20 -48
- package/esm/Animations/BaseAnimation.js +29 -26
- package/esm/Animations/Grow.js +35 -25
- package/esm/Animations/GrowRight.js +35 -34
- package/esm/Animations/GrowVertical.js +4 -29
- package/esm/CheckableGroup.js +52 -35
- package/esm/DeferRenderAfterComputation.js +15 -16
- package/esm/FocusGroup/FocusGrid.js +117 -64
- package/esm/FocusGroup/FocusGroup.js +137 -56
- package/esm/FocusGroup/FocusGroupContext.js +5 -9
- package/esm/FocusGroup/FocusGroupManager.js +38 -24
- package/esm/FocusGroup/focusGroupManagerHoc.js +36 -24
- package/esm/FocusGroup/index.js +6 -18
- package/esm/FocusGroup/useFocusGroupItem.js +40 -28
- package/esm/FocusGroup/utils/getNextCellPosition.js +25 -18
- package/esm/GroupContext/Group.js +66 -34
- package/esm/GroupContext/GroupContext.js +5 -7
- package/esm/GroupContext/GroupItem.js +15 -10
- package/esm/GroupContext/index.js +3 -10
- package/esm/ScrollSync/ScrollSync.js +64 -30
- package/esm/ScrollSync/ScrollSyncPane.js +52 -22
- package/esm/ScrollSync/ScrollSyncProvider.js +42 -74
- package/esm/ScrollSync/index.js +2 -8
- package/esm/ScrollSync/useScrollSync.js +5 -9
- package/esm/constants.js +28 -37
- package/esm/createDataInstance/createInstancePlugin.js +23 -12
- package/esm/createDataInstance/createInstanceRef.js +59 -36
- package/esm/createDataInstance/utils.js +85 -48
- package/esm/defer-render-hoc/index.js +31 -17
- package/esm/dimsum.config.js +4 -9
- package/esm/index.js +5 -11
- package/esm/prop-types.js +31 -75
- package/esm/react-spring/index.js +1 -3
- package/esm/react-spring/renderprops.js +1 -3
- package/esm/toolbar/ToolbarProvider.js +74 -45
- package/esm/useDataGrid/VolatileRowsListener.js +11 -9
- package/esm/useDataGrid/index.js +1 -7
- package/esm/useDataGrid/initColumnDefinition.js +94 -78
- package/esm/useDataGrid/useDataGrid.js +99 -82
- package/esm/useDataList/index.js +1 -7
- package/esm/useDataList/recordIterator.js +14 -13
- package/esm/useDataList/useDataList.js +67 -44
- package/esm/utils.js +59 -42
- package/esm/virtualization/AutoHeightList.js +40 -28
- package/esm/virtualization/FluidHeightList.js +38 -14
- package/esm/virtualization/index.js +16 -19
- package/package.json +3 -3
- package/types/Animations/BaseAnimation.d.ts +0 -1
- package/types/Animations/Grow.d.ts +0 -1
- package/types/Animations/GrowRight.d.ts +0 -1
- package/types/CheckableGroup.d.ts +0 -1
- package/types/DeferRenderAfterComputation.d.ts +2 -3
- package/types/FocusGroup/FocusGrid.d.ts +3 -5
- package/types/FocusGroup/FocusGroup.d.ts +1 -3
- package/types/FocusGroup/FocusGroupContext.d.ts +2 -3
- package/types/FocusGroup/FocusGroupManager.d.ts +1 -3
- package/types/FocusGroup/focusGroupManagerHoc.d.ts +1 -3
- package/types/FocusGroup/index.d.ts +6 -6
- package/types/FocusGroup/useFocusGroupItem.d.ts +1 -3
- package/types/FocusGroup/utils/getNextCellPosition.d.ts +1 -3
- package/types/GroupContext/Group.d.ts +0 -1
- package/types/GroupContext/GroupItem.d.ts +0 -1
- package/types/GroupContext/index.d.ts +3 -3
- package/types/ScrollSync/ScrollSync.d.ts +2 -4
- package/types/ScrollSync/ScrollSyncPane.d.ts +2 -2
- package/types/ScrollSync/index.d.ts +2 -2
- package/types/ScrollSync/useScrollSync.d.ts +5 -6
- package/types/createDataInstance/createInstancePlugin.d.ts +1 -2
- package/types/createDataInstance/createInstanceRef.d.ts +1 -3
- package/types/dimsum.config.d.ts +2 -3
- package/types/index.d.ts +2 -2
- package/types/toolbar/ToolbarProvider.d.ts +8 -3
- package/types/useDataGrid/VolatileRowsListener.d.ts +1 -3
- package/types/useDataGrid/index.d.ts +1 -1
- package/types/useDataGrid/initColumnDefinition.d.ts +1 -2
- package/types/useDataGrid/useDataGrid.d.ts +2 -3
- package/types/useDataList/index.d.ts +1 -1
- package/types/useDataList/useDataList.d.ts +2 -3
- package/cjs/Animations/BaseAnimation.js.map +0 -7
- package/cjs/Animations/Grow.js.map +0 -7
- package/cjs/Animations/GrowRight.js.map +0 -7
- package/cjs/Animations/GrowVertical.js.map +0 -7
- package/cjs/CheckableGroup.js.map +0 -7
- package/cjs/DeferRenderAfterComputation.js.map +0 -7
- package/cjs/FocusGroup/FocusGrid.js.map +0 -7
- package/cjs/FocusGroup/FocusGroup.js.map +0 -7
- package/cjs/FocusGroup/FocusGroupContext.js.map +0 -7
- package/cjs/FocusGroup/FocusGroupManager.js.map +0 -7
- package/cjs/FocusGroup/focusGroupManagerHoc.js.map +0 -7
- package/cjs/FocusGroup/index.js.map +0 -7
- package/cjs/FocusGroup/useFocusGroupItem.js.map +0 -7
- package/cjs/FocusGroup/utils/getNextCellPosition.js.map +0 -7
- package/cjs/GroupContext/Group.js.map +0 -7
- package/cjs/GroupContext/GroupContext.js.map +0 -7
- package/cjs/GroupContext/GroupItem.js.map +0 -7
- package/cjs/GroupContext/index.js.map +0 -7
- package/cjs/ScrollSync/ScrollSync.js.map +0 -7
- package/cjs/ScrollSync/ScrollSyncPane.js.map +0 -7
- package/cjs/ScrollSync/ScrollSyncProvider.js.map +0 -7
- package/cjs/ScrollSync/index.js.map +0 -7
- package/cjs/ScrollSync/useScrollSync.js.map +0 -7
- package/cjs/constants.js.map +0 -7
- package/cjs/createDataInstance/createInstancePlugin.js.map +0 -7
- package/cjs/createDataInstance/createInstanceRef.js.map +0 -7
- package/cjs/createDataInstance/utils.js.map +0 -7
- package/cjs/defer-render-hoc/index.js.map +0 -7
- package/cjs/dimsum.config.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/prop-types.js.map +0 -7
- package/cjs/react-spring/index.js.map +0 -7
- package/cjs/react-spring/renderprops.js.map +0 -7
- package/cjs/toolbar/ToolbarProvider.js.map +0 -7
- package/cjs/useDataGrid/VolatileRowsListener.js.map +0 -7
- package/cjs/useDataGrid/index.js.map +0 -7
- package/cjs/useDataGrid/initColumnDefinition.js.map +0 -7
- package/cjs/useDataGrid/useDataGrid.js.map +0 -7
- package/cjs/useDataList/index.js.map +0 -7
- package/cjs/useDataList/recordIterator.js.map +0 -7
- package/cjs/useDataList/useDataList.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/cjs/virtualization/AutoHeightList.js.map +0 -7
- package/cjs/virtualization/FluidHeightList.js.map +0 -7
- package/cjs/virtualization/index.js.map +0 -7
- package/esm/Animations/BaseAnimation.js.map +0 -7
- package/esm/Animations/Grow.js.map +0 -7
- package/esm/Animations/GrowRight.js.map +0 -7
- package/esm/Animations/GrowVertical.js.map +0 -7
- package/esm/CheckableGroup.js.map +0 -7
- package/esm/DeferRenderAfterComputation.js.map +0 -7
- package/esm/FocusGroup/FocusGrid.js.map +0 -7
- package/esm/FocusGroup/FocusGroup.js.map +0 -7
- package/esm/FocusGroup/FocusGroupContext.js.map +0 -7
- package/esm/FocusGroup/FocusGroupManager.js.map +0 -7
- package/esm/FocusGroup/focusGroupManagerHoc.js.map +0 -7
- package/esm/FocusGroup/index.js.map +0 -7
- package/esm/FocusGroup/useFocusGroupItem.js.map +0 -7
- package/esm/FocusGroup/utils/getNextCellPosition.js.map +0 -7
- package/esm/GroupContext/Group.js.map +0 -7
- package/esm/GroupContext/GroupContext.js.map +0 -7
- package/esm/GroupContext/GroupItem.js.map +0 -7
- package/esm/GroupContext/index.js.map +0 -7
- package/esm/ScrollSync/ScrollSync.js.map +0 -7
- package/esm/ScrollSync/ScrollSyncPane.js.map +0 -7
- package/esm/ScrollSync/ScrollSyncProvider.js.map +0 -7
- package/esm/ScrollSync/index.js.map +0 -7
- package/esm/ScrollSync/useScrollSync.js.map +0 -7
- package/esm/constants.js.map +0 -7
- package/esm/createDataInstance/createInstancePlugin.js.map +0 -7
- package/esm/createDataInstance/createInstanceRef.js.map +0 -7
- package/esm/createDataInstance/utils.js.map +0 -7
- package/esm/defer-render-hoc/index.js.map +0 -7
- package/esm/dimsum.config.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/prop-types.js.map +0 -7
- package/esm/react-spring/index.js.map +0 -7
- package/esm/react-spring/renderprops.js.map +0 -7
- package/esm/toolbar/ToolbarProvider.js.map +0 -7
- package/esm/useDataGrid/VolatileRowsListener.js.map +0 -7
- package/esm/useDataGrid/index.js.map +0 -7
- package/esm/useDataGrid/initColumnDefinition.js.map +0 -7
- package/esm/useDataGrid/useDataGrid.js.map +0 -7
- package/esm/useDataList/index.js.map +0 -7
- package/esm/useDataList/recordIterator.js.map +0 -7
- package/esm/useDataList/useDataList.js.map +0 -7
- package/esm/utils.js.map +0 -7
- package/esm/virtualization/AutoHeightList.js.map +0 -7
- package/esm/virtualization/FluidHeightList.js.map +0 -7
- package/esm/virtualization/index.js.map +0 -7
package/esm/useDataList/index.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
const defaultStrategy = () => {
|
|
3
|
-
throw Error(
|
|
2
|
+
throw Error('Implement an iterator strategy for record iterator');
|
|
4
3
|
};
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
function recordIterator(records) {
|
|
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;
|
|
6
9
|
const nextRows = [];
|
|
7
10
|
strategy({
|
|
8
11
|
data: records,
|
|
9
|
-
cb:
|
|
10
|
-
let nextRow = row;
|
|
12
|
+
cb: row => {
|
|
13
|
+
let nextRow = row; // eslint-disable-next-line no-loops/no-loops,no-plusplus
|
|
14
|
+
|
|
11
15
|
for (let i = 0; i < decorators.length; i++) {
|
|
12
16
|
nextRow = decorators[i](nextRow, instance);
|
|
13
|
-
if (!nextRow)
|
|
14
|
-
break;
|
|
17
|
+
if (!nextRow) break;
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
|
|
20
|
+
if (nextRow) nextRows.push(nextRow);
|
|
18
21
|
},
|
|
19
22
|
instance
|
|
20
23
|
});
|
|
21
24
|
return nextRows;
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=recordIterator.js.map
|
|
26
|
+
|
|
27
|
+
export { recordIterator };
|
|
@@ -1,67 +1,90 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
5
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
6
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
11
|
+
import { useRef, useMemo } from 'react';
|
|
12
|
+
import { setRef } from '@elliemae/ds-utilities';
|
|
13
|
+
import get from 'lodash/get';
|
|
14
|
+
import { reducePropsGetter, composeFormatters } from '../createDataInstance/utils.js';
|
|
15
|
+
import { recordIterator } from './recordIterator.js';
|
|
16
|
+
import createDataInstanceRef from '../createDataInstance/createInstanceRef.js';
|
|
17
|
+
|
|
18
|
+
const _excluded = ["data", "plugins", "renderers", "itemRenderer", "customDecorators"];
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
const getItemLabel = function (record) {
|
|
24
|
+
let nameKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'name';
|
|
25
|
+
return get(record, ['data', nameKey]);
|
|
26
|
+
};
|
|
27
|
+
const getItemChildren = function (record) {
|
|
28
|
+
let childrenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
29
|
+
return get(record, ['data', childrenKey]);
|
|
16
30
|
};
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
const listRenderers = {
|
|
32
|
+
list: 'ul',
|
|
33
|
+
item: 'li'
|
|
34
|
+
}; // todo: check if a plugin is a LIST plugin rather than GRID
|
|
35
|
+
|
|
36
|
+
function useDataList(_ref) {
|
|
37
|
+
let {
|
|
38
|
+
data = [],
|
|
39
|
+
plugins = [],
|
|
40
|
+
renderers = listRenderers,
|
|
41
|
+
itemRenderer = [],
|
|
42
|
+
customDecorators
|
|
43
|
+
} = _ref,
|
|
44
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
|
|
25
46
|
const listRef = useRef();
|
|
26
|
-
const {
|
|
47
|
+
const {
|
|
48
|
+
instance,
|
|
49
|
+
decorators
|
|
50
|
+
} = createDataInstanceRef(_objectSpread({
|
|
27
51
|
data,
|
|
28
52
|
renderers,
|
|
29
53
|
plugins,
|
|
30
|
-
customDecorators: {
|
|
31
|
-
...customDecorators,
|
|
54
|
+
customDecorators: _objectSpread(_objectSpread({}, customDecorators), {}, {
|
|
32
55
|
recordIterator,
|
|
33
56
|
getListProps: [],
|
|
34
57
|
getItemProps: [],
|
|
35
58
|
itemRenderer: [...itemRenderer],
|
|
59
|
+
// components reduce to compose item content
|
|
36
60
|
record: [],
|
|
37
61
|
records: []
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
62
|
+
})
|
|
63
|
+
}, props));
|
|
64
|
+
|
|
41
65
|
instance.current.getListRef = () => listRef;
|
|
42
|
-
|
|
66
|
+
|
|
67
|
+
instance.current.setListRef = ref => {
|
|
43
68
|
listRef.current = ref;
|
|
44
69
|
};
|
|
45
|
-
|
|
46
|
-
instance.current.
|
|
70
|
+
|
|
71
|
+
instance.current.getItemLabel = record => getItemLabel(record, props.nameKey);
|
|
72
|
+
|
|
73
|
+
instance.current.getItemChildren = record => getItemChildren(record, props.childrenKey);
|
|
74
|
+
|
|
47
75
|
instance.current.decorators = decorators;
|
|
48
76
|
instance.current.getListProps = reducePropsGetter(decorators.getListProps, instance.current);
|
|
49
77
|
instance.current.getItemProps = reducePropsGetter(decorators.getItemProps, instance.current);
|
|
50
78
|
instance.current.itemRenderer = composeFormatters(instance.current.decorators.itemRenderer, instance.current);
|
|
51
79
|
instance.current.records = useMemo(() => {
|
|
52
|
-
|
|
80
|
+
// record iterator TREE / Simple
|
|
81
|
+
let nextRecords = recordIterator(data, instance.current.decorators.recordIterator, decorators.record, instance.current); // compose all records
|
|
82
|
+
|
|
53
83
|
nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);
|
|
54
84
|
return nextRecords;
|
|
55
85
|
});
|
|
56
|
-
if (props.instanceRef)
|
|
57
|
-
setRef(props.instanceRef, instance.current);
|
|
86
|
+
if (props.instanceRef) setRef(props.instanceRef, instance.current);
|
|
58
87
|
return instance.current;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export {
|
|
62
|
-
useDataList_default as default,
|
|
63
|
-
getItemChildren,
|
|
64
|
-
getItemLabel,
|
|
65
|
-
useDataList
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=useDataList.js.map
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { useDataList as default, getItemChildren, getItemLabel };
|
package/esm/utils.js
CHANGED
|
@@ -1,51 +1,81 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
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.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
|
|
14
|
+
/* eslint-disable no-cond-assign */
|
|
15
|
+
const objectType = obj => Object.prototype.toString.call(obj).slice(8, -1);
|
|
16
|
+
const isDefined = param => typeof param !== 'undefined';
|
|
17
|
+
const isUndefined = param => typeof param === 'undefined';
|
|
18
|
+
const isFunction = param => typeof param === 'function';
|
|
19
|
+
const isNumber = param => typeof param === 'number' && !isNaN(param); // eslint-disable-line
|
|
20
|
+
|
|
21
|
+
const isString = str => objectType(str) === 'String';
|
|
22
|
+
const isArray = arr => objectType(arr) === 'Array';
|
|
9
23
|
const closest = (target, selector) => {
|
|
24
|
+
// closest(e.target, '.field')
|
|
10
25
|
while (target) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (target.msMatchesSelector && target.msMatchesSelector(selector))
|
|
14
|
-
|
|
26
|
+
// eslint-disable-line
|
|
27
|
+
if (target.matches && target.matches(selector)) return target;
|
|
28
|
+
if (target.msMatchesSelector && target.msMatchesSelector(selector)) return target; // eslint-disable-next-line no-param-reassign
|
|
29
|
+
|
|
15
30
|
target = target.parentNode;
|
|
16
31
|
}
|
|
32
|
+
|
|
17
33
|
return null;
|
|
18
34
|
};
|
|
19
|
-
const getOffsetRect =
|
|
35
|
+
const getOffsetRect = elem => {
|
|
36
|
+
// (1)
|
|
20
37
|
const box = elem.getBoundingClientRect();
|
|
21
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
body,
|
|
40
|
+
documentElement
|
|
41
|
+
} = document; // (2)
|
|
42
|
+
|
|
22
43
|
const scrollTop = window.pageYOffset || documentElement.scrollTop || body.scrollTop;
|
|
23
|
-
const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft;
|
|
44
|
+
const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft; // (3)
|
|
45
|
+
|
|
24
46
|
const clientTop = documentElement.clientTop || body.clientTop || 0;
|
|
25
|
-
const clientLeft = documentElement.clientLeft || body.clientLeft || 0;
|
|
47
|
+
const clientLeft = documentElement.clientLeft || body.clientLeft || 0; // (4)
|
|
48
|
+
|
|
26
49
|
const top = box.top + scrollTop - clientTop;
|
|
27
50
|
const left = box.left + scrollLeft - clientLeft;
|
|
28
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
top: Math.round(top),
|
|
53
|
+
left: Math.round(left)
|
|
54
|
+
};
|
|
29
55
|
};
|
|
30
|
-
const getTotalScroll =
|
|
56
|
+
const getTotalScroll = elem => {
|
|
31
57
|
let top = 0;
|
|
32
|
-
let left = 0;
|
|
58
|
+
let left = 0; // eslint-disable-next-line no-param-reassign
|
|
59
|
+
|
|
33
60
|
while (elem = elem.parentNode) {
|
|
34
61
|
top += elem.scrollTop || 0;
|
|
35
62
|
left += elem.scrollLeft || 0;
|
|
36
63
|
}
|
|
37
|
-
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
top,
|
|
67
|
+
left
|
|
68
|
+
};
|
|
38
69
|
};
|
|
39
70
|
const getTransformProps = (x, y) => ({
|
|
40
|
-
transform:
|
|
71
|
+
transform: "translate(".concat(x, "px, ").concat(y, "px)")
|
|
41
72
|
});
|
|
42
|
-
const listWithChildren = (list, childrenProp) => list.map(
|
|
43
|
-
...item,
|
|
73
|
+
const listWithChildren = (list, childrenProp) => list.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
44
74
|
[childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : []
|
|
45
75
|
}));
|
|
46
76
|
const getAllNonEmptyNodesIds = (items, childrenProp) => {
|
|
47
77
|
let childrenIds = [];
|
|
48
|
-
const ids = items.filter(
|
|
78
|
+
const ids = items.filter(item => item[childrenProp].length).map(item => {
|
|
49
79
|
childrenIds = childrenIds.concat(getAllNonEmptyNodesIds(item[childrenProp], childrenProp));
|
|
50
80
|
return item.id;
|
|
51
81
|
});
|
|
@@ -53,26 +83,13 @@ const getAllNonEmptyNodesIds = (items, childrenProp) => {
|
|
|
53
83
|
};
|
|
54
84
|
const isInternetExplorer = () => {
|
|
55
85
|
const ua = window.navigator.userAgent;
|
|
56
|
-
const msie = ua.indexOf(
|
|
86
|
+
const msie = ua.indexOf('MSIE '); // If Internet Explorer, return version number
|
|
87
|
+
|
|
57
88
|
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\./)) {
|
|
58
89
|
return true;
|
|
59
90
|
}
|
|
91
|
+
|
|
60
92
|
return false;
|
|
61
93
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
getAllNonEmptyNodesIds,
|
|
65
|
-
getOffsetRect,
|
|
66
|
-
getTotalScroll,
|
|
67
|
-
getTransformProps,
|
|
68
|
-
isArray,
|
|
69
|
-
isDefined,
|
|
70
|
-
isFunction,
|
|
71
|
-
isInternetExplorer,
|
|
72
|
-
isNumber,
|
|
73
|
-
isString,
|
|
74
|
-
isUndefined,
|
|
75
|
-
listWithChildren,
|
|
76
|
-
objectType
|
|
77
|
-
};
|
|
78
|
-
//# sourceMappingURL=utils.js.map
|
|
94
|
+
|
|
95
|
+
export { closest, getAllNonEmptyNodesIds, getOffsetRect, getTotalScroll, getTransformProps, isArray, isDefined, isFunction, isInternetExplorer, isNumber, isString, isUndefined, listWithChildren, objectType };
|
|
@@ -1,40 +1,52 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
8
|
+
import { forwardRef, useRef } from 'react';
|
|
9
|
+
import { FixedSizeList } from 'react-window';
|
|
10
|
+
import { useWindowScrollerList, mergeRefs, cx } from '@elliemae/ds-utilities';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
const _excluded = ["itemCount", "className", "innerRef", "itemData", "itemKey", "itemSize", "outerRef", "component"];
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
const AutoHeightList = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
19
|
+
let {
|
|
20
|
+
itemCount,
|
|
21
|
+
className,
|
|
22
|
+
innerRef,
|
|
23
|
+
itemData,
|
|
24
|
+
itemKey,
|
|
25
|
+
itemSize,
|
|
26
|
+
outerRef,
|
|
27
|
+
component: ListComponent = FixedSizeList
|
|
28
|
+
} = _ref,
|
|
29
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
|
|
16
31
|
const listRef = useRef();
|
|
17
32
|
const outerListRef = useRef();
|
|
18
33
|
useWindowScrollerList({
|
|
19
34
|
listInstance: listRef,
|
|
20
35
|
outerListRef
|
|
21
36
|
});
|
|
22
|
-
return
|
|
23
|
-
...otherProps,
|
|
37
|
+
return /*#__PURE__*/jsx(ListComponent, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
24
38
|
ref: mergeRefs(ref, listRef),
|
|
25
|
-
className: cx(className,
|
|
39
|
+
className: cx(className, 'window-scroller-override'),
|
|
26
40
|
height: window.innerHeight,
|
|
27
|
-
innerRef,
|
|
28
|
-
itemCount,
|
|
29
|
-
itemData,
|
|
30
|
-
itemKey,
|
|
31
|
-
itemSize,
|
|
41
|
+
innerRef: innerRef,
|
|
42
|
+
itemCount: itemCount,
|
|
43
|
+
itemData: itemData,
|
|
44
|
+
itemKey: itemKey,
|
|
45
|
+
itemSize: itemSize,
|
|
32
46
|
outerRef: mergeRefs(outerListRef, outerRef),
|
|
33
47
|
overscanCount: 10,
|
|
34
48
|
useIsScrolling: true
|
|
35
|
-
});
|
|
49
|
+
}));
|
|
36
50
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=AutoHeightList.js.map
|
|
51
|
+
|
|
52
|
+
export { AutoHeightList };
|
|
@@ -1,14 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import { forwardRef } from 'react';
|
|
10
|
+
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
const _excluded = ["component"];
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
const FluidHeightList = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
19
|
+
let {
|
|
20
|
+
component: Component
|
|
21
|
+
} = _ref,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
|
|
24
|
+
return /*#__PURE__*/_jsx(AutoSizer, {
|
|
25
|
+
disableWidth: true
|
|
26
|
+
}, void 0, _ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
height: fluidHeight
|
|
29
|
+
} = _ref2;
|
|
30
|
+
return /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({}, props), {}, {
|
|
31
|
+
ref: ref,
|
|
32
|
+
height: fluidHeight - 32 // taking in count the margins of the list
|
|
33
|
+
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export { FluidHeightList };
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { AutoHeightList } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { FluidHeightList } from './FluidHeightList.js';
|
|
2
|
+
export { FluidHeightList } from './FluidHeightList.js';
|
|
3
|
+
import { AutoHeightList } from './AutoHeightList.js';
|
|
4
|
+
export { AutoHeightList } from './AutoHeightList.js';
|
|
5
|
+
|
|
6
|
+
function getVirtualListComponent(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
component: Component,
|
|
9
|
+
fluid,
|
|
10
|
+
height,
|
|
11
|
+
autoHeight
|
|
12
|
+
} = _ref;
|
|
13
|
+
if (autoHeight) return AutoHeightList;
|
|
14
|
+
if (fluid) return FluidHeightList;
|
|
14
15
|
return Component;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
FluidHeightList,
|
|
19
|
-
getVirtualListComponent
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
17
|
+
|
|
18
|
+
export { getVirtualListComponent };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Shared components and utilities",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -213,8 +213,8 @@
|
|
|
213
213
|
"generateSubmodules": true
|
|
214
214
|
},
|
|
215
215
|
"dependencies": {
|
|
216
|
-
"@elliemae/ds-popper": "
|
|
217
|
-
"@elliemae/ds-utilities": "
|
|
216
|
+
"@elliemae/ds-popper": "3.0.0-next.2",
|
|
217
|
+
"@elliemae/ds-utilities": "3.0.0-next.2",
|
|
218
218
|
"hoist-non-react-statics": "~3.3.2",
|
|
219
219
|
"hotkeys-js": "~3.8.2",
|
|
220
220
|
"prop-types": "~15.7.2",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export default function DeferRenderAfterComputation({ children, resolve, fallback, timeout, }: {
|
|
2
2
|
children: any;
|
|
3
3
|
resolve: any;
|
|
4
4
|
fallback: any;
|
|
5
5
|
timeout?: number | undefined;
|
|
6
|
-
})
|
|
7
|
-
export default DeferRenderAfterComputation;
|
|
6
|
+
}): any;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const FocusGridContext: React.Context<unknown>;
|
|
3
|
-
|
|
2
|
+
export declare const FocusGridContext: React.Context<unknown>;
|
|
3
|
+
export default function FocusGridProvider({ shouldWrapRows, shouldWrapCells, shouldRefocus, children, keyBindings, hotKeys, }: {
|
|
4
4
|
shouldWrapRows?: boolean | undefined;
|
|
5
5
|
shouldWrapCells?: boolean | undefined;
|
|
6
6
|
shouldRefocus?: boolean | undefined;
|
|
7
7
|
children: any;
|
|
8
8
|
keyBindings: any;
|
|
9
9
|
hotKeys: any;
|
|
10
|
-
})
|
|
11
|
-
export { FocusGridProvider, FocusGridProvider as FocusGrid, FocusGridContext };
|
|
12
|
-
export default FocusGridProvider;
|
|
10
|
+
}): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default class FocusGroup {
|
|
2
2
|
items: never[];
|
|
3
3
|
constructor(options?: {});
|
|
4
4
|
getHotKeysParams(): {
|
|
@@ -34,5 +34,3 @@ declare class FocusGroup {
|
|
|
34
34
|
getFirstItem(): false;
|
|
35
35
|
getLastItem(): false;
|
|
36
36
|
}
|
|
37
|
-
export { FocusGroup };
|
|
38
|
-
export default FocusGroup;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
|
|
2
|
+
export default class FocusGroupProvider extends Component {
|
|
3
3
|
activated: boolean;
|
|
4
4
|
static defaultProps: {
|
|
5
5
|
exitWhenNoPrevious: boolean;
|
|
@@ -22,5 +22,3 @@ declare class FocusGroupProvider extends Component {
|
|
|
22
22
|
focusItemByNode(node: any): void;
|
|
23
23
|
render(): JSX.Element;
|
|
24
24
|
}
|
|
25
|
-
export { FocusGroupProvider, FocusGroupProvider as FocusGroupManager };
|
|
26
|
-
export default FocusGroupProvider;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
export default function FocusGroupHoc(WrappedComponent: any, options?: {}): ({ onExitFocusGroup, onFocusPrevGroup, focusKeyBindings, ...props }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
onExitFocusGroup: any;
|
|
5
5
|
onFocusPrevGroup: any;
|
|
6
6
|
focusKeyBindings: any;
|
|
7
7
|
}) => JSX.Element;
|
|
8
|
-
export { FocusGroupHoc };
|
|
9
|
-
export default FocusGroupHoc;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { FocusGroup } from './FocusGroup';
|
|
2
|
-
export { FocusGroupContext } from './FocusGroupContext';
|
|
3
|
-
export { FocusGroupManager } from './FocusGroupManager';
|
|
4
|
-
export { useFocusGroupItem, useFocusGroupWithState } from './useFocusGroupItem';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
1
|
+
export { default as FocusGroup } from './FocusGroup';
|
|
2
|
+
export { default as FocusGroupContext } from './FocusGroupContext';
|
|
3
|
+
export { default as FocusGroupManager } from './FocusGroupManager';
|
|
4
|
+
export { default as useFocusGroupItem, useFocusGroupWithState, } from './useFocusGroupItem';
|
|
5
|
+
export { default as focusGroupManagerHoc } from './focusGroupManagerHoc';
|
|
6
|
+
export { default as FocusGrid, FocusGridContext } from './FocusGrid';
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export default function useFocusGroupItem(ref: {} | undefined, props: any): any;
|
|
2
2
|
export declare const useFocusGroupWithState: (ref: {} | undefined, props: any) => any;
|
|
3
|
-
export { useFocusGroupItem };
|
|
4
|
-
export default useFocusGroupItem;
|