@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,51 +1,41 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
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');
|
|
4
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
5
|
var React = require('react');
|
|
10
|
-
var
|
|
11
|
-
var GroupContext_GroupContext = require('./GroupContext.js');
|
|
6
|
+
var GroupContext = require('./GroupContext.js');
|
|
12
7
|
|
|
13
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
9
|
|
|
15
|
-
var
|
|
16
|
-
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
|
|
17
|
-
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
18
|
-
var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits);
|
|
19
|
-
var _possibleConstructorReturn__default = /*#__PURE__*/_interopDefaultLegacy(_possibleConstructorReturn);
|
|
20
|
-
var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf);
|
|
21
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
10
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
23
11
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var target = e.target,
|
|
30
|
-
currentTarget = e.currentTarget;
|
|
12
|
+
const getValueItem = e => {
|
|
13
|
+
const {
|
|
14
|
+
target,
|
|
15
|
+
currentTarget
|
|
16
|
+
} = e;
|
|
31
17
|
|
|
32
18
|
if (target) {
|
|
33
|
-
|
|
19
|
+
const {
|
|
20
|
+
value
|
|
21
|
+
} = target;
|
|
34
22
|
return value;
|
|
35
23
|
}
|
|
36
24
|
|
|
37
25
|
if (currentTarget) {
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
const {
|
|
27
|
+
value
|
|
28
|
+
} = currentTarget;
|
|
29
|
+
return value;
|
|
40
30
|
}
|
|
41
31
|
|
|
42
32
|
return e;
|
|
43
33
|
};
|
|
44
34
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
const toggleItemValue = (array, e) => {
|
|
36
|
+
const newvalue = getValueItem(e);
|
|
37
|
+
const res = array;
|
|
38
|
+
const index = array.indexOf(newvalue);
|
|
49
39
|
|
|
50
40
|
if (index === -1) {
|
|
51
41
|
res.push(newvalue);
|
|
@@ -56,91 +46,79 @@ var toggleItemValue = function toggleItemValue(array, e) {
|
|
|
56
46
|
return res;
|
|
57
47
|
};
|
|
58
48
|
|
|
59
|
-
|
|
49
|
+
const {
|
|
50
|
+
Provider
|
|
51
|
+
} = GroupContext.GroupContext;
|
|
60
52
|
/** deprecated use CheckableGroup instead */
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_this = _super.call(this, props);
|
|
73
|
-
var activeValue = props.activeValue,
|
|
74
|
-
disabled = props.disabled;
|
|
75
|
-
_this.state = {
|
|
76
|
-
activeValue: activeValue,
|
|
77
|
-
disabled: disabled,
|
|
54
|
+
class Group extends React.Component {
|
|
55
|
+
constructor(props) {
|
|
56
|
+
super(props);
|
|
57
|
+
const {
|
|
58
|
+
activeValue,
|
|
59
|
+
disabled
|
|
60
|
+
} = props;
|
|
61
|
+
this.state = {
|
|
62
|
+
activeValue,
|
|
63
|
+
disabled,
|
|
78
64
|
prevValue: null,
|
|
79
|
-
onChange:
|
|
65
|
+
onChange: this.handleChange.bind(this)
|
|
80
66
|
};
|
|
81
|
-
return _this;
|
|
82
67
|
}
|
|
83
68
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}, {
|
|
112
|
-
key: "render",
|
|
113
|
-
value: function render() {
|
|
114
|
-
var children = this.props.children;
|
|
115
|
-
return /*#__PURE__*/React__default['default'].createElement(Provider, {
|
|
116
|
-
value: this.state
|
|
117
|
-
}, children);
|
|
69
|
+
static getDerivedStateFromProps(nextProps, _ref) {
|
|
70
|
+
let {
|
|
71
|
+
prevValue
|
|
72
|
+
} = _ref;
|
|
73
|
+
if (nextProps.activeValue === prevValue) return null;
|
|
74
|
+
return {
|
|
75
|
+
activeValue: nextProps.activeValue,
|
|
76
|
+
prevValue: nextProps.activeValue
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
handleChange(e) {
|
|
81
|
+
const {
|
|
82
|
+
multiple,
|
|
83
|
+
onChange
|
|
84
|
+
} = this.props;
|
|
85
|
+
const {
|
|
86
|
+
activeValue
|
|
87
|
+
} = this.state;
|
|
88
|
+
const value = getValueItem(e);
|
|
89
|
+
let newValue;
|
|
90
|
+
|
|
91
|
+
if (multiple) {
|
|
92
|
+
newValue = toggleItemValue(activeValue || [], value);
|
|
93
|
+
} else if (activeValue !== value) {
|
|
94
|
+
// default behaviour it will be toggle the active value
|
|
95
|
+
newValue = value;
|
|
118
96
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
prevValue: nextProps.activeValue
|
|
127
|
-
};
|
|
97
|
+
|
|
98
|
+
this.setState({
|
|
99
|
+
activeValue: newValue
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
103
|
+
rest[_key - 1] = arguments[_key];
|
|
128
104
|
}
|
|
129
|
-
}]);
|
|
130
105
|
|
|
131
|
-
|
|
132
|
-
}
|
|
106
|
+
if (onChange) onChange(newValue, ...rest);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
render() {
|
|
110
|
+
const {
|
|
111
|
+
children
|
|
112
|
+
} = this.props;
|
|
113
|
+
return /*#__PURE__*/_jsx__default["default"](Provider, {
|
|
114
|
+
value: this.state
|
|
115
|
+
}, void 0, children);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
}
|
|
133
119
|
|
|
134
120
|
Group.defaultProps = {
|
|
135
121
|
multiple: false
|
|
136
122
|
};
|
|
137
|
-
Group.propTypes = {
|
|
138
|
-
children: PropTypes__default['default'].array,
|
|
139
|
-
multiple: PropTypes__default['default'].bool,
|
|
140
|
-
onChange: PropTypes__default['default'].func,
|
|
141
|
-
activeValue: PropTypes__default['default'].oneOfType([PropTypes__default['default'].array, PropTypes__default['default'].number]),
|
|
142
|
-
disabled: PropTypes__default['default'].bool
|
|
143
|
-
};
|
|
144
123
|
|
|
145
124
|
module.exports = Group;
|
|
146
|
-
//# sourceMappingURL=Group.js.map
|
|
@@ -8,7 +8,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const GroupContext = /*#__PURE__*/React__default["default"].createContext();
|
|
12
12
|
|
|
13
13
|
exports.GroupContext = GroupContext;
|
|
14
|
-
//# sourceMappingURL=GroupContext.js.map
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
require('react');
|
|
5
|
+
var GroupContext = require('./GroupContext.js');
|
|
5
6
|
|
|
6
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
8
|
|
|
8
|
-
var
|
|
9
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
const {
|
|
12
|
+
Consumer
|
|
13
|
+
} = GroupContext.GroupContext;
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
15
|
+
const GroupItem = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
render
|
|
18
|
+
} = _ref;
|
|
19
|
+
return /*#__PURE__*/_jsx__default["default"](Consumer, {}, void 0, context => render(context));
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
module.exports = GroupItem;
|
|
20
|
-
//# sourceMappingURL=GroupItem.js.map
|
|
@@ -2,21 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
require('@babel/runtime/helpers/classCallCheck');
|
|
9
|
-
require('@babel/runtime/helpers/createClass');
|
|
10
|
-
require('@babel/runtime/helpers/assertThisInitialized');
|
|
11
|
-
require('@babel/runtime/helpers/inherits');
|
|
12
|
-
require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
13
|
-
require('@babel/runtime/helpers/getPrototypeOf');
|
|
14
|
-
require('react');
|
|
15
|
-
require('prop-types');
|
|
5
|
+
var Group = require('./Group.js');
|
|
6
|
+
var GroupContext = require('./GroupContext.js');
|
|
7
|
+
var GroupItem = require('./GroupItem.js');
|
|
16
8
|
|
|
17
9
|
|
|
18
10
|
|
|
19
|
-
exports.Group =
|
|
20
|
-
exports.GroupContext =
|
|
21
|
-
exports.GroupItem =
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
11
|
+
exports.Group = Group;
|
|
12
|
+
exports.GroupContext = GroupContext.GroupContext;
|
|
13
|
+
exports.GroupItem = GroupItem;
|
|
@@ -2,167 +2,146 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.find.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.find.js');
|
|
11
11
|
var React = require('react');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
|
|
17
|
-
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
18
|
-
var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits);
|
|
19
|
-
var _possibleConstructorReturn__default = /*#__PURE__*/_interopDefaultLegacy(_possibleConstructorReturn);
|
|
20
|
-
var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf);
|
|
15
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
_classCallCheck__default['default'](this, ScrollSync);
|
|
38
|
-
|
|
39
|
-
_this = _super.call(this, props);
|
|
40
|
-
_this.panes = {};
|
|
41
|
-
|
|
42
|
-
_this.registerPane = function (node, groups) {
|
|
43
|
-
groups.forEach(function (group) {
|
|
44
|
-
if (!_this.panes[group]) {
|
|
45
|
-
_this.panes[group] = [];
|
|
18
|
+
const ScrollSyncContext = /*#__PURE__*/React__default["default"].createContext();
|
|
19
|
+
const {
|
|
20
|
+
Provider
|
|
21
|
+
} = ScrollSyncContext;
|
|
22
|
+
class ScrollSync extends React.Component {
|
|
23
|
+
constructor(props) {
|
|
24
|
+
super(props);
|
|
25
|
+
this.panes = {};
|
|
26
|
+
|
|
27
|
+
this.registerPane = (node, groups) => {
|
|
28
|
+
groups.forEach(group => {
|
|
29
|
+
if (!this.panes[group]) {
|
|
30
|
+
this.panes[group] = [];
|
|
46
31
|
}
|
|
47
32
|
|
|
48
|
-
if (
|
|
49
|
-
|
|
33
|
+
if (this.panes[group].length > 0) {
|
|
34
|
+
this.syncScrollPosition(this.panes[group][0], node);
|
|
50
35
|
}
|
|
51
36
|
|
|
52
|
-
|
|
37
|
+
this.panes[group].push(node);
|
|
53
38
|
});
|
|
54
|
-
|
|
55
|
-
_this.addEvents(node, groups);
|
|
39
|
+
this.addEvents(node, groups);
|
|
56
40
|
};
|
|
57
41
|
|
|
58
|
-
|
|
59
|
-
groups.forEach(
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
_this.panes[group].splice(_this.panes[group].indexOf(node), 1);
|
|
42
|
+
this.unregisterPane = (node, groups) => {
|
|
43
|
+
groups.forEach(group => {
|
|
44
|
+
if (this.findPane(node, group)) {
|
|
45
|
+
this.removeEvents(node);
|
|
46
|
+
this.panes[group].splice(this.panes[group].indexOf(node), 1);
|
|
64
47
|
}
|
|
65
48
|
});
|
|
66
49
|
};
|
|
67
50
|
|
|
68
|
-
|
|
51
|
+
this.addEvents = (node, groups) => {
|
|
69
52
|
/* For some reason element.addEventListener doesnt work with document.body */
|
|
70
|
-
node.onscroll =
|
|
53
|
+
node.onscroll = this.handlePaneScroll.bind(this, node, groups); // eslint-disable-line
|
|
71
54
|
};
|
|
72
55
|
|
|
73
|
-
|
|
56
|
+
this.removeEvents = node => {
|
|
74
57
|
/* For some reason element.removeEventListener doesnt work with document.body */
|
|
75
58
|
node.onscroll = null; // eslint-disable-line
|
|
76
59
|
};
|
|
77
60
|
|
|
78
|
-
|
|
79
|
-
if (!
|
|
61
|
+
this.findPane = (node, group) => {
|
|
62
|
+
if (!this.panes[group]) {
|
|
80
63
|
return false;
|
|
81
64
|
}
|
|
82
65
|
|
|
83
|
-
return
|
|
84
|
-
return pane === node;
|
|
85
|
-
});
|
|
66
|
+
return this.panes[group].find(pane => pane === node);
|
|
86
67
|
};
|
|
87
68
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
69
|
+
this.handlePaneScroll = (node, groups, e) => {
|
|
70
|
+
const {
|
|
71
|
+
enabled
|
|
72
|
+
} = this.props;
|
|
73
|
+
if (this.props.onScroll) this.props.onScroll(e);
|
|
91
74
|
if (!enabled) return;
|
|
92
|
-
window.requestAnimationFrame(
|
|
93
|
-
|
|
75
|
+
window.requestAnimationFrame(() => {
|
|
76
|
+
this.syncScrollPositions(node, groups);
|
|
94
77
|
});
|
|
95
78
|
};
|
|
96
79
|
|
|
97
|
-
|
|
98
|
-
groups.forEach(
|
|
99
|
-
|
|
80
|
+
this.syncScrollPositions = (scrolledPane, groups) => {
|
|
81
|
+
groups.forEach(group => {
|
|
82
|
+
this.panes[group].forEach(pane => {
|
|
100
83
|
/* For all panes beside the currently scrolling one */
|
|
101
84
|
if (scrolledPane !== pane) {
|
|
102
85
|
/* Remove event listeners from the node that we'll manipulate */
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
_this.syncScrollPosition(scrolledPane, pane);
|
|
86
|
+
this.removeEvents(pane, group);
|
|
87
|
+
this.syncScrollPosition(scrolledPane, pane);
|
|
106
88
|
/* Re-attach event listeners after we're done scrolling */
|
|
107
89
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
_this.addEvents(pane, groups);
|
|
90
|
+
window.requestAnimationFrame(() => {
|
|
91
|
+
this.addEvents(pane, groups);
|
|
111
92
|
});
|
|
112
93
|
}
|
|
113
94
|
});
|
|
114
95
|
});
|
|
115
96
|
};
|
|
116
97
|
|
|
117
|
-
|
|
118
|
-
registerPane:
|
|
119
|
-
unregisterPane:
|
|
98
|
+
this.syncContext = {
|
|
99
|
+
registerPane: this.registerPane,
|
|
100
|
+
unregisterPane: this.unregisterPane
|
|
120
101
|
};
|
|
121
|
-
return _this;
|
|
122
102
|
}
|
|
123
103
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (horizontal && scrollLeftOffset > 0) {
|
|
150
|
-
pane.scrollLeft = proportional ? paneWidth * scrollLeft / scrollLeftOffset : scrollLeft; // eslint-disable-line
|
|
151
|
-
}
|
|
104
|
+
syncScrollPosition(scrolledPane, pane) {
|
|
105
|
+
const {
|
|
106
|
+
scrollTop,
|
|
107
|
+
scrollHeight,
|
|
108
|
+
clientHeight,
|
|
109
|
+
scrollLeft,
|
|
110
|
+
scrollWidth,
|
|
111
|
+
clientWidth
|
|
112
|
+
} = scrolledPane;
|
|
113
|
+
const scrollTopOffset = scrollHeight - clientHeight;
|
|
114
|
+
const scrollLeftOffset = scrollWidth - clientWidth;
|
|
115
|
+
const {
|
|
116
|
+
proportional,
|
|
117
|
+
vertical,
|
|
118
|
+
horizontal
|
|
119
|
+
} = this.props;
|
|
120
|
+
/* Calculate the actual pane height */
|
|
121
|
+
|
|
122
|
+
const paneHeight = pane.scrollHeight - clientHeight;
|
|
123
|
+
const paneWidth = pane.scrollWidth - clientWidth;
|
|
124
|
+
/* Adjust the scrollTop position of it accordingly */
|
|
125
|
+
|
|
126
|
+
if (vertical && scrollTopOffset > 0) {
|
|
127
|
+
pane.scrollTop = proportional ? paneHeight * scrollTop / scrollTopOffset : scrollTop; // eslint-disable-line
|
|
152
128
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
var children = this.props.children;
|
|
157
|
-
return /*#__PURE__*/React__default['default'].createElement(Provider, {
|
|
158
|
-
value: this.syncContext
|
|
159
|
-
}, React__default['default'].Children.only(children));
|
|
129
|
+
|
|
130
|
+
if (horizontal && scrollLeftOffset > 0) {
|
|
131
|
+
pane.scrollLeft = proportional ? paneWidth * scrollLeft / scrollLeftOffset : scrollLeft; // eslint-disable-line
|
|
160
132
|
}
|
|
161
|
-
}
|
|
133
|
+
}
|
|
162
134
|
|
|
163
|
-
|
|
164
|
-
|
|
135
|
+
render() {
|
|
136
|
+
const {
|
|
137
|
+
children
|
|
138
|
+
} = this.props;
|
|
139
|
+
return /*#__PURE__*/_jsx__default["default"](Provider, {
|
|
140
|
+
value: this.syncContext
|
|
141
|
+
}, void 0, React__default["default"].Children.only(children));
|
|
142
|
+
}
|
|
165
143
|
|
|
144
|
+
}
|
|
166
145
|
ScrollSync.defaultProps = {
|
|
167
146
|
proportional: true,
|
|
168
147
|
vertical: true,
|
|
@@ -171,5 +150,4 @@ ScrollSync.defaultProps = {
|
|
|
171
150
|
};
|
|
172
151
|
|
|
173
152
|
exports.ScrollSyncContext = ScrollSyncContext;
|
|
174
|
-
exports[
|
|
175
|
-
//# sourceMappingURL=ScrollSync.js.map
|
|
153
|
+
exports["default"] = ScrollSync;
|