@elliemae/ds-shared 2.0.0-alpha.8 → 2.0.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Animations/BaseAnimation.js +24 -20
- package/cjs/Animations/Grow.js +30 -26
- package/cjs/Animations/GrowRight.js +30 -26
- package/cjs/Animations/GrowVertical.js +1 -0
- package/cjs/CheckableGroup.js +32 -23
- package/cjs/DeferRenderAfterComputation.js +8 -6
- package/cjs/FocusGroup/FocusGrid.js +38 -31
- package/cjs/FocusGroup/FocusGroup.js +29 -9
- package/cjs/FocusGroup/FocusGroupManager.js +3 -3
- package/cjs/FocusGroup/focusGroupManagerHoc.js +7 -1
- package/cjs/FocusGroup/useFocusGroupItem.js +8 -2
- package/cjs/FocusGroup/utils/getNextCellPosition.js +10 -9
- package/cjs/GroupContext/Group.js +11 -4
- package/cjs/GroupContext/GroupItem.js +6 -3
- package/cjs/ScrollSync/ScrollSync.js +5 -0
- package/cjs/ScrollSync/ScrollSyncPane.js +11 -2
- package/cjs/ScrollSync/ScrollSyncProvider.js +12 -6
- package/cjs/createDataInstance/createInstancePlugin.js +6 -0
- package/cjs/createDataInstance/createInstanceRef.js +8 -0
- package/cjs/createDataInstance/utils.js +57 -25
- package/cjs/defer-render-hoc/index.js +8 -2
- package/cjs/toolbar/ToolbarProvider.js +31 -21
- package/cjs/useDataGrid/VolatileRowsListener.js +5 -2
- package/cjs/useDataGrid/initColumnDefinition.js +26 -18
- package/cjs/useDataGrid/useDataGrid.js +42 -34
- package/cjs/useDataList/recordIterator.js +4 -1
- package/cjs/useDataList/useDataList.js +18 -4
- package/cjs/utils.js +8 -1
- package/cjs/virtualization/AutoHeightList.js +10 -8
- package/cjs/virtualization/FluidHeightList.js +15 -7
- package/cjs/virtualization/index.js +7 -6
- package/esm/Animations/BaseAnimation.js +24 -20
- package/esm/Animations/Grow.js +30 -26
- package/esm/Animations/GrowRight.js +30 -26
- package/esm/Animations/GrowVertical.js +1 -0
- package/esm/CheckableGroup.js +29 -19
- package/esm/DeferRenderAfterComputation.js +8 -6
- package/esm/FocusGroup/FocusGrid.js +27 -19
- package/esm/FocusGroup/FocusGroup.js +26 -6
- package/esm/FocusGroup/FocusGroupManager.js +1 -1
- package/esm/FocusGroup/focusGroupManagerHoc.js +7 -1
- package/esm/FocusGroup/useFocusGroupItem.js +8 -2
- package/esm/FocusGroup/utils/getNextCellPosition.js +10 -9
- package/esm/GroupContext/Group.js +11 -4
- package/esm/GroupContext/GroupItem.js +6 -3
- package/esm/ScrollSync/ScrollSync.js +5 -0
- package/esm/ScrollSync/ScrollSyncPane.js +11 -2
- package/esm/ScrollSync/ScrollSyncProvider.js +12 -6
- package/esm/createDataInstance/createInstancePlugin.js +6 -0
- package/esm/createDataInstance/createInstanceRef.js +8 -0
- package/esm/createDataInstance/utils.js +57 -25
- package/esm/defer-render-hoc/index.js +8 -2
- package/esm/toolbar/ToolbarProvider.js +30 -20
- package/esm/useDataGrid/VolatileRowsListener.js +4 -1
- package/esm/useDataGrid/initColumnDefinition.js +12 -4
- package/esm/useDataGrid/useDataGrid.js +26 -16
- package/esm/useDataList/recordIterator.js +4 -1
- package/esm/useDataList/useDataList.js +17 -3
- package/esm/utils.js +8 -1
- package/esm/virtualization/AutoHeightList.js +6 -3
- package/esm/virtualization/FluidHeightList.js +14 -6
- package/esm/virtualization/index.js +7 -6
- package/package.json +8 -4
- package/types/toolbar/ToolbarProvider.d.ts +1 -1
- package/types/useDataGrid/initColumnDefinition.d.ts +4 -3
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -6,7 +6,10 @@ const defaultStrategy = () => {
|
|
|
6
6
|
throw Error('Implement an iterator strategy for record iterator');
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
function recordIterator(records
|
|
9
|
+
function recordIterator(records) {
|
|
10
|
+
let strategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultStrategy;
|
|
11
|
+
let decorators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
12
|
+
let instance = arguments.length > 3 ? arguments[3] : undefined;
|
|
10
13
|
const nextRows = [];
|
|
11
14
|
strategy({
|
|
12
15
|
data: records,
|
|
@@ -4,8 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
6
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
13
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
14
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
7
15
|
var React = require('react');
|
|
8
|
-
var
|
|
16
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
9
17
|
var get = require('lodash/get');
|
|
10
18
|
var utils = require('../createDataInstance/utils.js');
|
|
11
19
|
var recordIterator = require('./recordIterator.js');
|
|
@@ -22,8 +30,14 @@ const _excluded = ["data", "plugins", "renderers", "itemRenderer", "customDecora
|
|
|
22
30
|
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; }
|
|
23
31
|
|
|
24
32
|
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__default["default"](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; }
|
|
25
|
-
const getItemLabel = (record
|
|
26
|
-
|
|
33
|
+
const getItemLabel = function (record) {
|
|
34
|
+
let nameKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'name';
|
|
35
|
+
return get__default["default"](record, ['data', nameKey]);
|
|
36
|
+
};
|
|
37
|
+
const getItemChildren = function (record) {
|
|
38
|
+
let childrenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
39
|
+
return get__default["default"](record, ['data', childrenKey]);
|
|
40
|
+
};
|
|
27
41
|
const listRenderers = {
|
|
28
42
|
list: 'ul',
|
|
29
43
|
item: 'li'
|
|
@@ -79,7 +93,7 @@ function useDataList(_ref) {
|
|
|
79
93
|
nextRecords = decorators.records.reduce((nextRows, getter) => getter(nextRows, instance.current), nextRecords);
|
|
80
94
|
return nextRecords;
|
|
81
95
|
});
|
|
82
|
-
if (props.instanceRef)
|
|
96
|
+
if (props.instanceRef) dsUtilities.setRef(props.instanceRef, instance.current);
|
|
83
97
|
return instance.current;
|
|
84
98
|
}
|
|
85
99
|
|
package/cjs/utils.js
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
13
|
|
|
7
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
15
|
|
|
@@ -69,7 +76,7 @@ const getTotalScroll = elem => {
|
|
|
69
76
|
};
|
|
70
77
|
};
|
|
71
78
|
const getTransformProps = (x, y) => ({
|
|
72
|
-
transform:
|
|
79
|
+
transform: "translate(".concat(x, "px, ").concat(y, "px)")
|
|
73
80
|
});
|
|
74
81
|
const listWithChildren = (list, childrenProp) => list.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
75
82
|
[childrenProp]: item[childrenProp] ? listWithChildren(item[childrenProp], childrenProp) : []
|
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
12
|
var React = require('react');
|
|
8
13
|
var reactWindow = require('react-window');
|
|
9
|
-
var
|
|
10
|
-
var system = require('@elliemae/ds-utilities/system');
|
|
11
|
-
var useWindowScrollerList = require('@elliemae/ds-utilities/hooks/useWindowScrollerList');
|
|
14
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
12
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
16
|
|
|
14
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
18
|
|
|
16
19
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
17
20
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
18
|
-
var useWindowScrollerList__default = /*#__PURE__*/_interopDefaultLegacy(useWindowScrollerList);
|
|
19
21
|
|
|
20
22
|
const _excluded = ["itemCount", "className", "innerRef", "itemData", "itemKey", "itemSize", "outerRef", "component"];
|
|
21
23
|
|
|
@@ -37,20 +39,20 @@ const AutoHeightList = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
37
39
|
|
|
38
40
|
const listRef = React.useRef();
|
|
39
41
|
const outerListRef = React.useRef();
|
|
40
|
-
|
|
42
|
+
dsUtilities.useWindowScrollerList({
|
|
41
43
|
listInstance: listRef,
|
|
42
44
|
outerListRef
|
|
43
45
|
});
|
|
44
46
|
return /*#__PURE__*/jsxRuntime.jsx(ListComponent, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
45
|
-
ref:
|
|
46
|
-
className:
|
|
47
|
+
ref: dsUtilities.mergeRefs(ref, listRef),
|
|
48
|
+
className: dsUtilities.cx(className, 'window-scroller-override'),
|
|
47
49
|
height: window.innerHeight,
|
|
48
50
|
innerRef: innerRef,
|
|
49
51
|
itemCount: itemCount,
|
|
50
52
|
itemData: itemData,
|
|
51
53
|
itemKey: itemKey,
|
|
52
54
|
itemSize: itemSize,
|
|
53
|
-
outerRef:
|
|
55
|
+
outerRef: dsUtilities.mergeRefs(outerListRef, outerRef),
|
|
54
56
|
overscanCount: 10,
|
|
55
57
|
useIsScrolling: true
|
|
56
58
|
}));
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
11
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
12
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
@@ -29,13 +34,16 @@ const FluidHeightList = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
29
34
|
|
|
30
35
|
return /*#__PURE__*/_jsx__default["default"](AutoSizer__default["default"], {
|
|
31
36
|
disableWidth: true
|
|
32
|
-
}, void 0,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
}, void 0, _ref2 => {
|
|
38
|
+
let {
|
|
39
|
+
height: fluidHeight
|
|
40
|
+
} = _ref2;
|
|
41
|
+
return /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread(_objectSpread({}, props), {}, {
|
|
42
|
+
ref: ref,
|
|
43
|
+
height: fluidHeight - 32 // taking in count the margins of the list
|
|
44
|
+
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
39
47
|
});
|
|
40
48
|
|
|
41
49
|
exports.FluidHeightList = FluidHeightList;
|
|
@@ -5,12 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var FluidHeightList = require('./FluidHeightList.js');
|
|
6
6
|
var AutoHeightList = require('./AutoHeightList.js');
|
|
7
7
|
|
|
8
|
-
function getVirtualListComponent({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
function getVirtualListComponent(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
component: Component,
|
|
11
|
+
fluid,
|
|
12
|
+
height,
|
|
13
|
+
autoHeight
|
|
14
|
+
} = _ref;
|
|
14
15
|
if (autoHeight) return AutoHeightList.AutoHeightList;
|
|
15
16
|
if (fluid) return FluidHeightList.FluidHeightList;
|
|
16
17
|
return Component;
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import { Transition } from 'react-spring/renderprops';
|
|
4
5
|
|
|
5
|
-
const BaseAnimation =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
const BaseAnimation = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
keys = undefined,
|
|
9
|
+
items = [],
|
|
10
|
+
duration = 100,
|
|
11
|
+
enter = {},
|
|
12
|
+
from = {},
|
|
13
|
+
leave = {},
|
|
14
|
+
onRest = () => null,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/_jsx(Transition, {
|
|
18
|
+
config: {
|
|
19
|
+
duration
|
|
20
|
+
},
|
|
21
|
+
enter: enter,
|
|
22
|
+
from: from,
|
|
23
|
+
items: items,
|
|
24
|
+
keys: keys,
|
|
25
|
+
leave: leave,
|
|
26
|
+
onRest: onRest
|
|
27
|
+
}, void 0, children);
|
|
28
|
+
};
|
|
25
29
|
|
|
26
30
|
export { BaseAnimation as default };
|
package/esm/Animations/Grow.js
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import BaseAnimation from './BaseAnimation.js';
|
|
4
5
|
|
|
5
|
-
const Grow =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
6
|
+
const Grow = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
keys = undefined,
|
|
9
|
+
duration,
|
|
10
|
+
items = undefined,
|
|
11
|
+
from = 0,
|
|
12
|
+
to = 1,
|
|
13
|
+
children,
|
|
14
|
+
onRest = () => null
|
|
15
|
+
} = _ref;
|
|
16
|
+
return /*#__PURE__*/_jsx(BaseAnimation, {
|
|
17
|
+
duration: duration,
|
|
18
|
+
enter: {
|
|
19
|
+
opacity: 1,
|
|
20
|
+
transform: "scale(".concat(to, ")")
|
|
21
|
+
},
|
|
22
|
+
from: {
|
|
23
|
+
opacity: 0,
|
|
24
|
+
transform: "scale(".concat(from, ")")
|
|
25
|
+
},
|
|
26
|
+
items: items,
|
|
27
|
+
keys: keys,
|
|
28
|
+
leave: {
|
|
29
|
+
opacity: 0,
|
|
30
|
+
transform: "scale(".concat(from, ")")
|
|
31
|
+
},
|
|
32
|
+
onRest: onRest
|
|
33
|
+
}, void 0, children);
|
|
34
|
+
};
|
|
31
35
|
|
|
32
36
|
export { Grow as default };
|
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import BaseAnimation from './BaseAnimation.js';
|
|
4
5
|
|
|
5
|
-
const GrowRight =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
6
|
+
const GrowRight = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
keys = undefined,
|
|
9
|
+
items = undefined,
|
|
10
|
+
duration = 200,
|
|
11
|
+
from = 0,
|
|
12
|
+
to = 1,
|
|
13
|
+
children,
|
|
14
|
+
onRest = () => null
|
|
15
|
+
} = _ref;
|
|
16
|
+
return /*#__PURE__*/_jsx(BaseAnimation, {
|
|
17
|
+
duration: duration,
|
|
18
|
+
enter: {
|
|
19
|
+
opacity: "".concat(to),
|
|
20
|
+
transform: 'translateX(0px)'
|
|
21
|
+
},
|
|
22
|
+
from: {
|
|
23
|
+
opacity: "".concat(from),
|
|
24
|
+
transform: 'translateX(100%)'
|
|
25
|
+
},
|
|
26
|
+
items: items,
|
|
27
|
+
keys: keys,
|
|
28
|
+
leave: {
|
|
29
|
+
opacity: "".concat(from),
|
|
30
|
+
transform: 'translateX(100%)'
|
|
31
|
+
},
|
|
32
|
+
onRest: onRest
|
|
33
|
+
}, void 0, children);
|
|
34
|
+
};
|
|
31
35
|
|
|
32
36
|
export { GrowRight as default };
|
package/esm/CheckableGroup.js
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
2
10
|
import React, { cloneElement } from 'react';
|
|
3
|
-
import { runAll, addOrRemove } from '@elliemae/ds-utilities
|
|
4
|
-
import useDerivedStateFromProps from '@elliemae/ds-utilities/hooks/useDerivedStateFromProps';
|
|
11
|
+
import { useDerivedStateFromProps, runAll, addOrRemove } from '@elliemae/ds-utilities';
|
|
5
12
|
|
|
6
13
|
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; }
|
|
7
14
|
|
|
8
15
|
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; }
|
|
9
|
-
function useCheckableGroup({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
function useCheckableGroup(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
active: activeProp,
|
|
20
|
+
multi,
|
|
21
|
+
onCheck = () => null
|
|
22
|
+
} = _ref;
|
|
15
23
|
const [active, setActive] = useDerivedStateFromProps(activeProp);
|
|
16
24
|
|
|
17
|
-
const handleCheck = ({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
const handleCheck = (_ref2, item) => {
|
|
26
|
+
let {
|
|
27
|
+
target: {
|
|
28
|
+
value
|
|
29
|
+
}
|
|
30
|
+
} = _ref2;
|
|
22
31
|
setActive(prevActive => {
|
|
23
32
|
const nextActive = multi ? addOrRemove(prevActive, value) : value;
|
|
24
33
|
onCheck(nextActive, item);
|
|
@@ -38,12 +47,13 @@ function useCheckableGroup({
|
|
|
38
47
|
});
|
|
39
48
|
}
|
|
40
49
|
|
|
41
|
-
function CheckableGroup({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
function CheckableGroup(_ref3) {
|
|
51
|
+
let {
|
|
52
|
+
active = [],
|
|
53
|
+
multi = false,
|
|
54
|
+
// checkbox or radio
|
|
55
|
+
children
|
|
56
|
+
} = _ref3;
|
|
47
57
|
return useCheckableGroup({
|
|
48
58
|
active,
|
|
49
59
|
multi,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import { useState, useEffect } from 'react';
|
|
2
3
|
import raf from 'raf';
|
|
3
4
|
|
|
4
|
-
function DeferRenderAfterComputation({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
function DeferRenderAfterComputation(_ref) {
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
resolve,
|
|
9
|
+
fallback,
|
|
10
|
+
timeout = 2000
|
|
11
|
+
} = _ref;
|
|
10
12
|
const [shouldRender, setShouldRender] = useState(false);
|
|
11
13
|
useEffect(() => {
|
|
12
14
|
// eslint-disable-next-line max-nested-callbacks
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
8
|
import React, { useRef, useEffect, useMemo, createContext } from 'react';
|
|
4
|
-
import { get, runAll, isFunction } from '@elliemae/ds-utilities
|
|
5
|
-
import useHotkeys from '@elliemae/ds-utilities/hooks/useHotkeys';
|
|
6
|
-
import { mergeRefs } from '@elliemae/ds-utilities/system';
|
|
9
|
+
import { mergeRefs, get, runAll, isFunction, useHotkeys } from '@elliemae/ds-utilities';
|
|
7
10
|
import getNextCellPosition from './utils/getNextCellPosition.js';
|
|
8
11
|
|
|
9
12
|
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,10 +19,11 @@ const {
|
|
|
16
19
|
|
|
17
20
|
const preventDefault = e => e.preventDefault();
|
|
18
21
|
|
|
19
|
-
function registerHotKeysHooks(hotKeys, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
function registerHotKeysHooks(hotKeys, _ref) {
|
|
23
|
+
let {
|
|
24
|
+
focusedRow,
|
|
25
|
+
focusedCell
|
|
26
|
+
} = _ref;
|
|
23
27
|
Object.keys(hotKeys).forEach(key => {
|
|
24
28
|
const {
|
|
25
29
|
handler,
|
|
@@ -40,14 +44,15 @@ function registerHotKeysHooks(hotKeys, {
|
|
|
40
44
|
} // eslint-disable-next-line max-statements
|
|
41
45
|
|
|
42
46
|
|
|
43
|
-
function FocusGridProvider({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
function FocusGridProvider(_ref2) {
|
|
48
|
+
let {
|
|
49
|
+
shouldWrapRows = false,
|
|
50
|
+
shouldWrapCells = false,
|
|
51
|
+
shouldRefocus = true,
|
|
52
|
+
children,
|
|
53
|
+
keyBindings,
|
|
54
|
+
hotKeys
|
|
55
|
+
} = _ref2;
|
|
51
56
|
const focusedRow = useRef();
|
|
52
57
|
const focusedCell = useRef();
|
|
53
58
|
const grid = useRef([]);
|
|
@@ -57,10 +62,13 @@ function FocusGridProvider({
|
|
|
57
62
|
innerRef: mergeRefs(child.props.innerRef, containerRef)
|
|
58
63
|
});
|
|
59
64
|
|
|
60
|
-
const getNode =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
const getNode = _ref3 => {
|
|
66
|
+
let {
|
|
67
|
+
rowIndex,
|
|
68
|
+
cellIndex
|
|
69
|
+
} = _ref3;
|
|
70
|
+
return get(grid.current, [rowIndex, cellIndex]);
|
|
71
|
+
};
|
|
64
72
|
|
|
65
73
|
const register = (node, rowIndex, columnIndex) => {
|
|
66
74
|
if (!node) return;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
1
3
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
10
|
+
import { get, isFunction } from '@elliemae/ds-utilities';
|
|
3
11
|
import hotkeys from 'hotkeys-js';
|
|
4
12
|
|
|
5
13
|
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; }
|
|
@@ -9,14 +17,22 @@ const defaultOptions = {
|
|
|
9
17
|
orientation: 'vertical'
|
|
10
18
|
};
|
|
11
19
|
|
|
12
|
-
const safeCallAction = (e, fun
|
|
20
|
+
const safeCallAction = function (e, fun) {
|
|
13
21
|
if (isFunction(fun)) {
|
|
14
22
|
e.preventDefault();
|
|
23
|
+
|
|
24
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
25
|
+
args[_key - 2] = arguments[_key];
|
|
26
|
+
}
|
|
27
|
+
|
|
15
28
|
fun(...args);
|
|
16
29
|
}
|
|
17
30
|
};
|
|
18
31
|
|
|
19
|
-
const registerHotkeys =
|
|
32
|
+
const registerHotkeys = function () {
|
|
33
|
+
let hotKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
34
|
+
let params = arguments.length > 1 ? arguments[1] : undefined;
|
|
35
|
+
let getContainer = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => document;
|
|
20
36
|
Object.keys(hotKeys).forEach(hotkey => {
|
|
21
37
|
const {
|
|
22
38
|
options,
|
|
@@ -37,7 +53,8 @@ const registerHotkeys = (hotKeys = {}, params, getContainer = () => document) =>
|
|
|
37
53
|
});
|
|
38
54
|
};
|
|
39
55
|
|
|
40
|
-
const unregisterHotKeys = (
|
|
56
|
+
const unregisterHotKeys = function () {
|
|
57
|
+
let hotKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
41
58
|
Object.keys(hotKeys).forEach(hotkey => {
|
|
42
59
|
hotkeys.unbind(hotkey);
|
|
43
60
|
});
|
|
@@ -46,7 +63,9 @@ const unregisterHotKeys = (hotKeys = {}) => {
|
|
|
46
63
|
const noop = () => null;
|
|
47
64
|
|
|
48
65
|
class FocusGroup {
|
|
49
|
-
constructor(
|
|
66
|
+
constructor() {
|
|
67
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
68
|
+
|
|
50
69
|
_defineProperty(this, "items", []);
|
|
51
70
|
|
|
52
71
|
this.options = _objectSpread(_objectSpread({}, defaultOptions), options);
|
|
@@ -120,7 +139,8 @@ class FocusGroup {
|
|
|
120
139
|
return actions.map(action => typeof action === 'string' ? safeCallAction(e, this.mapActions[action]) : safeCallAction(e, action));
|
|
121
140
|
}
|
|
122
141
|
|
|
123
|
-
register(node
|
|
142
|
+
register(node) {
|
|
143
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
124
144
|
const afterIndex = this.items.findIndex(item => item.compareDocumentPosition(node) === Node.DOCUMENT_POSITION_PRECEDING);
|
|
125
145
|
node.specialOnFocus = props.onFocus || noop;
|
|
126
146
|
node.specialOnBlur = props.onBlur || noop;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
3
|
import { Component } from 'react';
|
|
4
|
-
import { isFunction } from '@elliemae/ds-utilities
|
|
4
|
+
import { isFunction } from '@elliemae/ds-utilities';
|
|
5
5
|
import FocusGroup from './FocusGroup.js';
|
|
6
6
|
import FocusGroupContext from './FocusGroupContext.js';
|
|
7
7
|
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
8
|
import 'react';
|
|
@@ -9,7 +14,8 @@ const _excluded = ["onExitFocusGroup", "onFocusPrevGroup", "focusKeyBindings"];
|
|
|
9
14
|
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; }
|
|
10
15
|
|
|
11
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; }
|
|
12
|
-
function FocusGroupHoc(WrappedComponent
|
|
17
|
+
function FocusGroupHoc(WrappedComponent) {
|
|
18
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
13
19
|
return _ref => {
|
|
14
20
|
let {
|
|
15
21
|
onExitFocusGroup,
|