@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,92 +1,86 @@
|
|
|
1
|
-
import
|
|
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';
|
|
2
5
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
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';
|
|
4
11
|
import { useRef, useMemo } from 'react';
|
|
5
12
|
import { setRef } from '@elliemae/ds-utilities';
|
|
6
13
|
import get from 'lodash/get';
|
|
7
14
|
import { reducePropsGetter, composeFormatters } from '../createDataInstance/utils.js';
|
|
8
15
|
import { recordIterator } from './recordIterator.js';
|
|
9
16
|
import createDataInstanceRef from '../createDataInstance/createInstanceRef.js';
|
|
10
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
11
|
-
import 'uuid';
|
|
12
|
-
import 'lodash';
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
const _excluded = ["data", "plugins", "renderers", "itemRenderer", "customDecorators"];
|
|
15
19
|
|
|
16
20
|
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; }
|
|
17
21
|
|
|
18
22
|
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; }
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
const getItemLabel = function (record) {
|
|
24
|
+
let nameKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'name';
|
|
21
25
|
return get(record, ['data', nameKey]);
|
|
22
26
|
};
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
const getItemChildren = function (record) {
|
|
28
|
+
let childrenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
25
29
|
return get(record, ['data', childrenKey]);
|
|
26
30
|
};
|
|
27
|
-
|
|
31
|
+
const listRenderers = {
|
|
28
32
|
list: 'ul',
|
|
29
33
|
item: 'li'
|
|
30
34
|
}; // todo: check if a plugin is a LIST plugin rather than GRID
|
|
31
35
|
|
|
32
36
|
function useDataList(_ref) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
itemRenderer = _ref$itemRenderer === void 0 ? [] : _ref$itemRenderer,
|
|
41
|
-
customDecorators = _ref.customDecorators,
|
|
37
|
+
let {
|
|
38
|
+
data = [],
|
|
39
|
+
plugins = [],
|
|
40
|
+
renderers = listRenderers,
|
|
41
|
+
itemRenderer = [],
|
|
42
|
+
customDecorators
|
|
43
|
+
} = _ref,
|
|
42
44
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const listRef = useRef();
|
|
47
|
+
const {
|
|
48
|
+
instance,
|
|
49
|
+
decorators
|
|
50
|
+
} = createDataInstanceRef(_objectSpread({
|
|
51
|
+
data,
|
|
52
|
+
renderers,
|
|
53
|
+
plugins,
|
|
50
54
|
customDecorators: _objectSpread(_objectSpread({}, customDecorators), {}, {
|
|
51
|
-
recordIterator
|
|
55
|
+
recordIterator,
|
|
52
56
|
getListProps: [],
|
|
53
57
|
getItemProps: [],
|
|
54
|
-
itemRenderer:
|
|
58
|
+
itemRenderer: [...itemRenderer],
|
|
55
59
|
// components reduce to compose item content
|
|
56
60
|
record: [],
|
|
57
61
|
records: []
|
|
58
62
|
})
|
|
59
|
-
}, props))
|
|
60
|
-
instance = _createInstanceRef.instance,
|
|
61
|
-
decorators = _createInstanceRef.decorators;
|
|
63
|
+
}, props));
|
|
62
64
|
|
|
63
|
-
instance.current.getListRef =
|
|
64
|
-
return listRef;
|
|
65
|
-
};
|
|
65
|
+
instance.current.getListRef = () => listRef;
|
|
66
66
|
|
|
67
|
-
instance.current.setListRef =
|
|
67
|
+
instance.current.setListRef = ref => {
|
|
68
68
|
listRef.current = ref;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
instance.current.getItemLabel =
|
|
72
|
-
return getItemLabel(record, props.nameKey);
|
|
73
|
-
};
|
|
71
|
+
instance.current.getItemLabel = record => getItemLabel(record, props.nameKey);
|
|
74
72
|
|
|
75
|
-
instance.current.getItemChildren =
|
|
76
|
-
return getItemChildren(record, props.childrenKey);
|
|
77
|
-
};
|
|
73
|
+
instance.current.getItemChildren = record => getItemChildren(record, props.childrenKey);
|
|
78
74
|
|
|
79
75
|
instance.current.decorators = decorators;
|
|
80
76
|
instance.current.getListProps = reducePropsGetter(decorators.getListProps, instance.current);
|
|
81
77
|
instance.current.getItemProps = reducePropsGetter(decorators.getItemProps, instance.current);
|
|
82
78
|
instance.current.itemRenderer = composeFormatters(instance.current.decorators.itemRenderer, instance.current);
|
|
83
|
-
instance.current.records = useMemo(
|
|
79
|
+
instance.current.records = useMemo(() => {
|
|
84
80
|
// record iterator TREE / Simple
|
|
85
|
-
|
|
81
|
+
let nextRecords = recordIterator(data, instance.current.decorators.recordIterator, decorators.record, instance.current); // compose all records
|
|
86
82
|
|
|
87
|
-
nextRecords = decorators.records.reduce(
|
|
88
|
-
return getter(nextRows, instance.current);
|
|
89
|
-
}, nextRecords);
|
|
83
|
+
nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);
|
|
90
84
|
return nextRecords;
|
|
91
85
|
});
|
|
92
86
|
if (props.instanceRef) setRef(props.instanceRef, instance.current);
|
|
@@ -94,4 +88,3 @@ function useDataList(_ref) {
|
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
export { useDataList as default, getItemChildren, getItemLabel };
|
|
97
|
-
//# sourceMappingURL=useDataList.js.map
|
package/esm/utils.js
CHANGED
|
@@ -1,33 +1,26 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
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';
|
|
2
9
|
|
|
3
10
|
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; }
|
|
4
11
|
|
|
5
12
|
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; }
|
|
6
13
|
|
|
7
14
|
/* eslint-disable no-cond-assign */
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
var isUndefined = function isUndefined(param) {
|
|
15
|
-
return typeof param === 'undefined';
|
|
16
|
-
};
|
|
17
|
-
var isFunction = function isFunction(param) {
|
|
18
|
-
return typeof param === 'function';
|
|
19
|
-
};
|
|
20
|
-
var isNumber = function isNumber(param) {
|
|
21
|
-
return typeof param === 'number' && !isNaN(param);
|
|
22
|
-
}; // eslint-disable-line
|
|
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
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var isArray = function isArray(arr) {
|
|
28
|
-
return objectType(arr) === 'Array';
|
|
29
|
-
};
|
|
30
|
-
var closest = function closest(target, selector) {
|
|
21
|
+
const isString = str => objectType(str) === 'String';
|
|
22
|
+
const isArray = arr => objectType(arr) === 'Array';
|
|
23
|
+
const closest = (target, selector) => {
|
|
31
24
|
// closest(e.target, '.field')
|
|
32
25
|
while (target) {
|
|
33
26
|
// eslint-disable-line
|
|
@@ -39,29 +32,30 @@ var closest = function closest(target, selector) {
|
|
|
39
32
|
|
|
40
33
|
return null;
|
|
41
34
|
};
|
|
42
|
-
|
|
35
|
+
const getOffsetRect = elem => {
|
|
43
36
|
// (1)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
const box = elem.getBoundingClientRect();
|
|
38
|
+
const {
|
|
39
|
+
body,
|
|
40
|
+
documentElement
|
|
41
|
+
} = document; // (2)
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
const scrollTop = window.pageYOffset || documentElement.scrollTop || body.scrollTop;
|
|
44
|
+
const scrollLeft = window.pageXOffset || documentElement.scrollLeft || body.scrollLeft; // (3)
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
const clientTop = documentElement.clientTop || body.clientTop || 0;
|
|
47
|
+
const clientLeft = documentElement.clientLeft || body.clientLeft || 0; // (4)
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
const top = box.top + scrollTop - clientTop;
|
|
50
|
+
const left = box.left + scrollLeft - clientLeft;
|
|
57
51
|
return {
|
|
58
52
|
top: Math.round(top),
|
|
59
53
|
left: Math.round(left)
|
|
60
54
|
};
|
|
61
55
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
const getTotalScroll = elem => {
|
|
57
|
+
let top = 0;
|
|
58
|
+
let left = 0; // eslint-disable-next-line no-param-reassign
|
|
65
59
|
|
|
66
60
|
while (elem = elem.parentNode) {
|
|
67
61
|
top += elem.scrollTop || 0;
|
|
@@ -69,33 +63,27 @@ var getTotalScroll = function getTotalScroll(elem) {
|
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
return {
|
|
72
|
-
top
|
|
73
|
-
left
|
|
66
|
+
top,
|
|
67
|
+
left
|
|
74
68
|
};
|
|
75
69
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
var getAllNonEmptyNodesIds = function getAllNonEmptyNodesIds(items, childrenProp) {
|
|
87
|
-
var childrenIds = [];
|
|
88
|
-
var ids = items.filter(function (item) {
|
|
89
|
-
return item[childrenProp].length;
|
|
90
|
-
}).map(function (item) {
|
|
70
|
+
const getTransformProps = (x, y) => ({
|
|
71
|
+
transform: "translate(".concat(x, "px, ").concat(y, "px)")
|
|
72
|
+
});
|
|
73
|
+
const listWithChildren = (list, childrenProp) => list.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
74
|
+
[childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : []
|
|
75
|
+
}));
|
|
76
|
+
const getAllNonEmptyNodesIds = (items, childrenProp) => {
|
|
77
|
+
let childrenIds = [];
|
|
78
|
+
const ids = items.filter(item => item[childrenProp].length).map(item => {
|
|
91
79
|
childrenIds = childrenIds.concat(getAllNonEmptyNodesIds(item[childrenProp], childrenProp));
|
|
92
80
|
return item.id;
|
|
93
81
|
});
|
|
94
82
|
return ids.concat(childrenIds);
|
|
95
83
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
const isInternetExplorer = () => {
|
|
85
|
+
const ua = window.navigator.userAgent;
|
|
86
|
+
const msie = ua.indexOf('MSIE '); // If Internet Explorer, return version number
|
|
99
87
|
|
|
100
88
|
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\./)) {
|
|
101
89
|
return true;
|
|
@@ -105,4 +93,3 @@ var isInternetExplorer = function isInternetExplorer() {
|
|
|
105
93
|
};
|
|
106
94
|
|
|
107
95
|
export { closest, getAllNonEmptyNodesIds, getOffsetRect, getTotalScroll, getTransformProps, isArray, isDefined, isFunction, isInternetExplorer, isNumber, isString, isUndefined, listWithChildren, objectType };
|
|
108
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1,29 +1,40 @@
|
|
|
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 _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
-
import
|
|
8
|
+
import { forwardRef, useRef } from 'react';
|
|
4
9
|
import { FixedSizeList } from 'react-window';
|
|
5
10
|
import { useWindowScrollerList, mergeRefs, cx } from '@elliemae/ds-utilities';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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); if (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 = 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; }
|
|
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,
|
|
18
29
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
19
30
|
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
const listRef = useRef();
|
|
32
|
+
const outerListRef = useRef();
|
|
22
33
|
useWindowScrollerList({
|
|
23
34
|
listInstance: listRef,
|
|
24
|
-
outerListRef
|
|
35
|
+
outerListRef
|
|
25
36
|
});
|
|
26
|
-
return /*#__PURE__*/
|
|
37
|
+
return /*#__PURE__*/jsx(ListComponent, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
27
38
|
ref: mergeRefs(ref, listRef),
|
|
28
39
|
className: cx(className, 'window-scroller-override'),
|
|
29
40
|
height: window.innerHeight,
|
|
@@ -39,4 +50,3 @@ var AutoHeightList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
39
50
|
});
|
|
40
51
|
|
|
41
52
|
export { AutoHeightList };
|
|
42
|
-
//# sourceMappingURL=AutoHeightList.js.map
|
|
@@ -1,18 +1,33 @@
|
|
|
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';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
-
import
|
|
9
|
+
import { forwardRef } from 'react';
|
|
4
10
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
12
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
const _excluded = ["component"];
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
const FluidHeightList = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
19
|
+
let {
|
|
20
|
+
component: Component
|
|
21
|
+
} = _ref,
|
|
9
22
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
10
23
|
|
|
11
|
-
return /*#__PURE__*/
|
|
24
|
+
return /*#__PURE__*/_jsx(AutoSizer, {
|
|
12
25
|
disableWidth: true
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
}, void 0, _ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
height: fluidHeight
|
|
29
|
+
} = _ref2;
|
|
30
|
+
return /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({}, props), {}, {
|
|
16
31
|
ref: ref,
|
|
17
32
|
height: fluidHeight - 32 // taking in count the margins of the list
|
|
18
33
|
|
|
@@ -21,4 +36,3 @@ var FluidHeightList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
21
36
|
});
|
|
22
37
|
|
|
23
38
|
export { FluidHeightList };
|
|
24
|
-
//# sourceMappingURL=FluidHeightList.js.map
|
|
@@ -2,22 +2,17 @@ import { FluidHeightList } from './FluidHeightList.js';
|
|
|
2
2
|
export { FluidHeightList } from './FluidHeightList.js';
|
|
3
3
|
import { AutoHeightList } from './AutoHeightList.js';
|
|
4
4
|
export { AutoHeightList } from './AutoHeightList.js';
|
|
5
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
6
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
7
|
-
import 'react';
|
|
8
|
-
import 'react-virtualized-auto-sizer';
|
|
9
|
-
import 'react-window';
|
|
10
|
-
import '@elliemae/ds-utilities';
|
|
11
5
|
|
|
12
6
|
function getVirtualListComponent(_ref) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
let {
|
|
8
|
+
component: Component,
|
|
9
|
+
fluid,
|
|
10
|
+
height,
|
|
11
|
+
autoHeight
|
|
12
|
+
} = _ref;
|
|
17
13
|
if (autoHeight) return AutoHeightList;
|
|
18
14
|
if (fluid) return FluidHeightList;
|
|
19
15
|
return Component;
|
|
20
16
|
}
|
|
21
17
|
|
|
22
18
|
export { getVirtualListComponent };
|
|
23
|
-
//# sourceMappingURL=index.js.map
|