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