@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,145 +1,108 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
5
|
-
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
6
|
-
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
7
|
-
var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
8
|
-
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
9
4
|
var React = require('react');
|
|
10
5
|
var dsUtilities = require('@elliemae/ds-utilities');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
14
|
-
require('hotkeys-js');
|
|
6
|
+
var FocusGroup = require('./FocusGroup.js');
|
|
7
|
+
var FocusGroupContext = require('./FocusGroupContext.js');
|
|
15
8
|
|
|
16
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
10
|
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
|
+
|
|
13
|
+
const noop = () => null;
|
|
14
|
+
|
|
15
|
+
class FocusGroupProvider extends React.Component {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.activated = false;
|
|
19
|
+
this.focusGroup = new FocusGroup(props);
|
|
20
|
+
props.onFocusGroupSet(this);
|
|
21
|
+
this.actions = {
|
|
22
|
+
activate: this.activate.bind(this),
|
|
23
|
+
deactivate: this.deactivate.bind(this),
|
|
24
|
+
register: this.focusGroup.register,
|
|
25
|
+
unregister: this.unregister.bind(this),
|
|
26
|
+
focusFirst: this.focusGroup.focusFirst,
|
|
27
|
+
focusLast: this.focusGroup.focusLast,
|
|
28
|
+
focusItemByIndex: this.focusItemByIndex.bind(this),
|
|
29
|
+
focusItemByNode: this.focusItemByNode.bind(this),
|
|
30
|
+
focus: this.focusGroup.focusCurrent,
|
|
31
|
+
isGroupActive: this.focusGroup.isGroupActive,
|
|
32
|
+
focusNext: this.focusGroup.focusNext,
|
|
33
|
+
focusPrevious: this.focusGroup.focusPrevious
|
|
34
|
+
};
|
|
35
|
+
}
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
componentDidMount() {
|
|
38
|
+
const {
|
|
39
|
+
autoFocusOnMount
|
|
40
|
+
} = this.props;
|
|
41
|
+
this.activate();
|
|
29
42
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
if (autoFocusOnMount) {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
this.actions.focusFirst();
|
|
46
|
+
}, 0);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
33
49
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var _super = _createSuper(FocusGroupProvider);
|
|
38
|
-
|
|
39
|
-
function FocusGroupProvider(props) {
|
|
40
|
-
var _this;
|
|
41
|
-
|
|
42
|
-
_classCallCheck__default['default'](this, FocusGroupProvider);
|
|
43
|
-
|
|
44
|
-
_this = _super.call(this, props);
|
|
45
|
-
_this.activated = false;
|
|
46
|
-
_this.focusGroup = new FocusGroup_FocusGroup(props);
|
|
47
|
-
props.onFocusGroupSet(_assertThisInitialized__default['default'](_this));
|
|
48
|
-
_this.actions = {
|
|
49
|
-
activate: _this.activate.bind(_assertThisInitialized__default['default'](_this)),
|
|
50
|
-
deactivate: _this.deactivate.bind(_assertThisInitialized__default['default'](_this)),
|
|
51
|
-
register: _this.focusGroup.register,
|
|
52
|
-
unregister: _this.unregister.bind(_assertThisInitialized__default['default'](_this)),
|
|
53
|
-
focusFirst: _this.focusGroup.focusFirst,
|
|
54
|
-
focusLast: _this.focusGroup.focusLast,
|
|
55
|
-
focusItemByIndex: _this.focusItemByIndex.bind(_assertThisInitialized__default['default'](_this)),
|
|
56
|
-
focusItemByNode: _this.focusItemByNode.bind(_assertThisInitialized__default['default'](_this)),
|
|
57
|
-
focus: _this.focusGroup.focusCurrent,
|
|
58
|
-
isGroupActive: _this.focusGroup.isGroupActive,
|
|
59
|
-
focusNext: _this.focusGroup.focusNext,
|
|
60
|
-
focusPrevious: _this.focusGroup.focusPrevious
|
|
61
|
-
};
|
|
62
|
-
return _this;
|
|
50
|
+
componentWillUnmount() {
|
|
51
|
+
this.deactivate();
|
|
63
52
|
}
|
|
64
53
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
activate() {
|
|
55
|
+
const {
|
|
56
|
+
onActivate
|
|
57
|
+
} = this.props;
|
|
58
|
+
this.focusGroup.activate();
|
|
59
|
+
this.activated = true;
|
|
60
|
+
if (dsUtilities.isFunction(onActivate)) onActivate();
|
|
61
|
+
}
|
|
69
62
|
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
deactivate() {
|
|
64
|
+
const {
|
|
65
|
+
onExitFocusGroup
|
|
66
|
+
} = this.props;
|
|
67
|
+
this.activated = false;
|
|
68
|
+
this.focusGroup.deactivate();
|
|
72
69
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
_this2.actions.focusFirst();
|
|
76
|
-
}, 0);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}, {
|
|
80
|
-
key: "componentWillUnmount",
|
|
81
|
-
value: function componentWillUnmount() {
|
|
82
|
-
this.deactivate();
|
|
83
|
-
}
|
|
84
|
-
}, {
|
|
85
|
-
key: "activate",
|
|
86
|
-
value: function activate() {
|
|
87
|
-
var onActivate = this.props.onActivate;
|
|
88
|
-
this.focusGroup.activate();
|
|
89
|
-
this.activated = true;
|
|
90
|
-
if (dsUtilities.isFunction(onActivate)) onActivate();
|
|
91
|
-
}
|
|
92
|
-
}, {
|
|
93
|
-
key: "deactivate",
|
|
94
|
-
value: function deactivate() {
|
|
95
|
-
var onExitFocusGroup = this.props.onExitFocusGroup;
|
|
96
|
-
this.activated = false;
|
|
97
|
-
this.focusGroup.deactivate();
|
|
98
|
-
|
|
99
|
-
if (dsUtilities.isFunction(onExitFocusGroup)) {
|
|
100
|
-
onExitFocusGroup();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}, {
|
|
104
|
-
key: "register",
|
|
105
|
-
value: function register(item) {
|
|
106
|
-
this.focusGroup.register(item);
|
|
107
|
-
}
|
|
108
|
-
}, {
|
|
109
|
-
key: "unregister",
|
|
110
|
-
value: function unregister(item) {
|
|
111
|
-
this.focusGroup.unregister(item);
|
|
70
|
+
if (dsUtilities.isFunction(onExitFocusGroup)) {
|
|
71
|
+
onExitFocusGroup();
|
|
112
72
|
}
|
|
113
|
-
}
|
|
114
|
-
key: "focusItemByIndex",
|
|
115
|
-
value: function focusItemByIndex(index) {
|
|
116
|
-
var _this3 = this;
|
|
117
|
-
|
|
118
|
-
if (!this.activated) this.activate();
|
|
119
|
-
setTimeout(function () {
|
|
120
|
-
_this3.focusGroup.focusByIndex(index);
|
|
121
|
-
}, 200);
|
|
122
|
-
}
|
|
123
|
-
}, {
|
|
124
|
-
key: "focusItemByNode",
|
|
125
|
-
value: function focusItemByNode(node) {
|
|
126
|
-
if (!this.activated) this.activate();
|
|
127
|
-
var index = this.focusGroup.getItemIndexByNode(node);
|
|
128
|
-
this.focusItemByIndex(index);
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
key: "render",
|
|
132
|
-
value: function render() {
|
|
133
|
-
var children = this.props.children;
|
|
134
|
-
return /*#__PURE__*/React__default['default'].createElement(FocusGroup_FocusGroupContext.Provider, {
|
|
135
|
-
value: this.actions
|
|
136
|
-
}, children);
|
|
137
|
-
}
|
|
138
|
-
}]);
|
|
73
|
+
}
|
|
139
74
|
|
|
140
|
-
|
|
141
|
-
|
|
75
|
+
register(item) {
|
|
76
|
+
this.focusGroup.register(item);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
unregister(item) {
|
|
80
|
+
this.focusGroup.unregister(item);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
focusItemByIndex(index) {
|
|
84
|
+
if (!this.activated) this.activate();
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
this.focusGroup.focusByIndex(index);
|
|
87
|
+
}, 200);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
focusItemByNode(node) {
|
|
91
|
+
if (!this.activated) this.activate();
|
|
92
|
+
const index = this.focusGroup.getItemIndexByNode(node);
|
|
93
|
+
this.focusItemByIndex(index);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
render() {
|
|
97
|
+
const {
|
|
98
|
+
children
|
|
99
|
+
} = this.props;
|
|
100
|
+
return /*#__PURE__*/_jsx__default["default"](FocusGroupContext.Provider, {
|
|
101
|
+
value: this.actions
|
|
102
|
+
}, void 0, children);
|
|
103
|
+
}
|
|
142
104
|
|
|
105
|
+
}
|
|
143
106
|
FocusGroupProvider.defaultProps = {
|
|
144
107
|
exitWhenNoPrevious: false,
|
|
145
108
|
exitWhenNoNext: false,
|
|
@@ -152,4 +115,3 @@ FocusGroupProvider.defaultProps = {
|
|
|
152
115
|
};
|
|
153
116
|
|
|
154
117
|
module.exports = FocusGroupProvider;
|
|
155
|
-
//# sourceMappingURL=FocusGroupManager.js.map
|
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
9
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
require('
|
|
8
|
-
require('@babel/runtime/helpers/createClass');
|
|
9
|
-
require('@babel/runtime/helpers/assertThisInitialized');
|
|
10
|
-
require('@babel/runtime/helpers/inherits');
|
|
11
|
-
require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
12
|
-
require('@babel/runtime/helpers/getPrototypeOf');
|
|
13
|
-
require('@elliemae/ds-utilities');
|
|
14
|
-
require('./FocusGroup.js');
|
|
15
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
16
|
-
require('hotkeys-js');
|
|
17
|
-
require('./FocusGroupContext.js');
|
|
10
|
+
require('react');
|
|
11
|
+
var FocusGroupManager = require('./FocusGroupManager.js');
|
|
12
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
18
13
|
|
|
19
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
15
|
|
|
21
|
-
var
|
|
16
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
22
17
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
23
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
const _excluded = ["onExitFocusGroup", "onFocusPrevGroup", "focusKeyBindings"];
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
26
24
|
function FocusGroupHoc(WrappedComponent) {
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26
|
+
return _ref => {
|
|
27
|
+
let {
|
|
28
|
+
onExitFocusGroup,
|
|
29
|
+
onFocusPrevGroup,
|
|
30
|
+
focusKeyBindings
|
|
31
|
+
} = _ref,
|
|
32
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
33
|
+
|
|
34
|
+
return /*#__PURE__*/jsxRuntime.jsx(FocusGroupManager, _objectSpread(_objectSpread({
|
|
35
35
|
keyBindings: focusKeyBindings,
|
|
36
36
|
onExitFocusGroup: onExitFocusGroup,
|
|
37
37
|
onFocusPrevGroup: onFocusPrevGroup
|
|
38
|
-
}, options),
|
|
38
|
+
}, options), {}, {
|
|
39
|
+
children: /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, _objectSpread(_objectSpread({}, props), options))
|
|
40
|
+
}));
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
module.exports = FocusGroupHoc;
|
|
43
|
-
//# sourceMappingURL=focusGroupManagerHoc.js.map
|
package/cjs/FocusGroup/index.js
CHANGED
|
@@ -2,34 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
require('@babel/runtime/helpers/classCallCheck');
|
|
12
|
-
require('@babel/runtime/helpers/createClass');
|
|
13
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
14
|
-
require('@elliemae/ds-utilities');
|
|
15
|
-
require('hotkeys-js');
|
|
16
|
-
require('react');
|
|
17
|
-
require('@babel/runtime/helpers/assertThisInitialized');
|
|
18
|
-
require('@babel/runtime/helpers/inherits');
|
|
19
|
-
require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
20
|
-
require('@babel/runtime/helpers/getPrototypeOf');
|
|
21
|
-
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
22
|
-
require('@babel/runtime/helpers/extends');
|
|
23
|
-
require('./utils/getNextCellPosition.js');
|
|
5
|
+
var FocusGroup = require('./FocusGroup.js');
|
|
6
|
+
var FocusGroupContext = require('./FocusGroupContext.js');
|
|
7
|
+
var FocusGroupManager = require('./FocusGroupManager.js');
|
|
8
|
+
var useFocusGroupItem = require('./useFocusGroupItem.js');
|
|
9
|
+
var focusGroupManagerHoc = require('./focusGroupManagerHoc.js');
|
|
10
|
+
var FocusGrid = require('./FocusGrid.js');
|
|
24
11
|
|
|
25
12
|
|
|
26
13
|
|
|
27
|
-
exports.FocusGroup =
|
|
28
|
-
exports.FocusGroupContext =
|
|
29
|
-
exports.FocusGroupManager =
|
|
30
|
-
exports.useFocusGroupItem =
|
|
31
|
-
exports.useFocusGroupWithState =
|
|
32
|
-
exports.focusGroupManagerHoc =
|
|
33
|
-
exports.FocusGrid =
|
|
34
|
-
exports.FocusGridContext =
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
|
14
|
+
exports.FocusGroup = FocusGroup;
|
|
15
|
+
exports.FocusGroupContext = FocusGroupContext;
|
|
16
|
+
exports.FocusGroupManager = FocusGroupManager;
|
|
17
|
+
exports.useFocusGroupItem = useFocusGroupItem["default"];
|
|
18
|
+
exports.useFocusGroupWithState = useFocusGroupItem.useFocusGroupWithState;
|
|
19
|
+
exports.focusGroupManagerHoc = focusGroupManagerHoc;
|
|
20
|
+
exports.FocusGrid = FocusGrid["default"];
|
|
21
|
+
exports.FocusGridContext = FocusGrid.FocusGridContext;
|
|
@@ -4,26 +4,28 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
7
|
+
var FocusGroupContext = require('./FocusGroupContext.js');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
|
11
11
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const _excluded = ["register", "unregister"],
|
|
14
|
+
_excluded2 = ["register", "unregister"];
|
|
15
15
|
function useFocusGroupItem() {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
let ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17
|
+
let props = arguments.length > 1 ? arguments[1] : undefined;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const _ref = React.useContext(FocusGroupContext) || {},
|
|
20
|
+
{
|
|
21
|
+
register,
|
|
22
|
+
unregister
|
|
23
|
+
} = _ref,
|
|
24
|
+
otherActions = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
23
25
|
|
|
24
|
-
React.useEffect(
|
|
26
|
+
React.useEffect(() => {
|
|
25
27
|
if (ref.current && register) register(ref.current, props);
|
|
26
|
-
return
|
|
28
|
+
return () => {
|
|
27
29
|
if (ref.current && unregister) unregister(ref.current);
|
|
28
30
|
};
|
|
29
31
|
}); // if the focus item is not wrapped with the focus provider then return null
|
|
@@ -31,18 +33,20 @@ function useFocusGroupItem() {
|
|
|
31
33
|
if (!register) return {};
|
|
32
34
|
return otherActions;
|
|
33
35
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
const useFocusGroupWithState = function () {
|
|
37
|
+
let ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
38
|
+
let props = arguments.length > 1 ? arguments[1] : undefined;
|
|
39
|
+
|
|
40
|
+
const _ref2 = React.useContext(FocusGroupContext) || {},
|
|
41
|
+
{
|
|
42
|
+
register,
|
|
43
|
+
unregister
|
|
44
|
+
} = _ref2,
|
|
45
|
+
otherActions = _objectWithoutProperties__default["default"](_ref2, _excluded2);
|
|
46
|
+
|
|
47
|
+
React.useEffect(() => {
|
|
44
48
|
if (ref && register) register(ref, props);
|
|
45
|
-
return
|
|
49
|
+
return () => {
|
|
46
50
|
if (ref && unregister) unregister(ref);
|
|
47
51
|
};
|
|
48
52
|
}, [ref]); // if the focus item is not wrapped with the focus provider then return null
|
|
@@ -51,6 +55,5 @@ var useFocusGroupWithState = function useFocusGroupWithState() {
|
|
|
51
55
|
return otherActions;
|
|
52
56
|
};
|
|
53
57
|
|
|
54
|
-
exports[
|
|
58
|
+
exports["default"] = useFocusGroupItem;
|
|
55
59
|
exports.useFocusGroupWithState = useFocusGroupWithState;
|
|
56
|
-
//# sourceMappingURL=useFocusGroupItem.js.map
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line max-statements
|
|
4
4
|
function getNextCellPosition(_ref) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
let {
|
|
6
|
+
grid,
|
|
7
|
+
currentRow = 0,
|
|
8
|
+
currentCell = 0,
|
|
9
|
+
directionY,
|
|
10
|
+
directionX,
|
|
11
|
+
shouldWrapCells,
|
|
12
|
+
shouldWrapRows
|
|
13
|
+
} = _ref;
|
|
14
|
+
let nextRow = currentRow + directionY;
|
|
15
|
+
let nextCell = currentCell + directionX;
|
|
16
|
+
const rowCount = grid.length;
|
|
17
|
+
const isLeftRight = directionX !== 0;
|
|
18
18
|
|
|
19
19
|
if (!rowCount) {
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
const cellsLength = grid[0].length; // moving horizontally
|
|
24
24
|
|
|
25
25
|
if (shouldWrapCells && isLeftRight) {
|
|
26
26
|
// to left
|
|
@@ -58,4 +58,3 @@ function getNextCellPosition(_ref) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
module.exports = getNextCellPosition;
|
|
61
|
-
//# sourceMappingURL=getNextCellPosition.js.map
|