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