rsuite 4.9.3 → 4.10.2
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/CHANGELOG.md +42 -0
- package/dist/rsuite.js +18 -601
- package/dist/rsuite.min.js +2 -2
- package/dist/rsuite.min.js.map +1 -1
- package/dist/styles/rsuite-dark-rtl.css +2 -1
- package/dist/styles/rsuite-dark-rtl.min.css +1 -1
- package/dist/styles/rsuite-dark-rtl.min.css.map +1 -1
- package/dist/styles/rsuite-dark.css +2 -1
- package/dist/styles/rsuite-dark.min.css +1 -1
- package/dist/styles/rsuite-dark.min.css.map +1 -1
- package/dist/styles/rsuite-default-rtl.css +2 -1
- package/dist/styles/rsuite-default-rtl.min.css +1 -1
- package/dist/styles/rsuite-default-rtl.min.css.map +1 -1
- package/dist/styles/rsuite-default.css +2 -1
- package/dist/styles/rsuite-default.min.css +1 -1
- package/dist/styles/rsuite-default.min.css.map +1 -1
- package/es/CheckTreePicker/CheckTreePicker.js +8 -7
- package/es/MultiCascader/DropdownMenu.js +1 -1
- package/es/MultiCascader/MultiCascader.d.ts +8 -0
- package/es/MultiCascader/MultiCascader.js +6 -3
- package/es/Overlay/OverlayTrigger.d.ts +1 -1
- package/es/Overlay/OverlayTrigger.js +12 -1
- package/es/Table/styles/common.less +2 -1
- package/es/utils/treeUtils.js +5 -1
- package/lib/CheckTreePicker/CheckTreePicker.js +8 -7
- package/lib/MultiCascader/DropdownMenu.js +1 -1
- package/lib/MultiCascader/MultiCascader.d.ts +8 -0
- package/lib/MultiCascader/MultiCascader.js +6 -3
- package/lib/Overlay/OverlayTrigger.d.ts +1 -1
- package/lib/Overlay/OverlayTrigger.js +12 -1
- package/lib/Table/styles/common.less +2 -1
- package/lib/utils/treeUtils.js +5 -1
- package/package.json +3 -3
- package/src/CheckTreePicker/CheckTreePicker.tsx +15 -7
- package/src/CheckTreePicker/test/CheckTreePickerSpec.js +184 -1
- package/src/MultiCascader/DropdownMenu.tsx +1 -1
- package/src/MultiCascader/MultiCascader.d.ts +8 -0
- package/src/MultiCascader/MultiCascader.tsx +4 -2
- package/src/MultiCascader/test/DropdownMenuSpec.js +17 -0
- package/src/MultiCascader/test/MultiCascaderSpec.js +14 -1
- package/src/Overlay/OverlayTrigger.d.ts +1 -1
- package/src/Overlay/OverlayTrigger.tsx +22 -1
- package/src/Overlay/test/OverlayTriggerSpec.js +155 -0
- package/src/Table/styles/common.less +2 -1
- package/src/TreePicker/test/TreePickerSpec.js +43 -15
- package/src/utils/treeUtils.ts +4 -1
|
@@ -471,11 +471,11 @@ function (_React$Component) {
|
|
|
471
471
|
nextState.value = value;
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
-
if (compareArray(expandItemValues, prevState.expandItemValues)) {
|
|
474
|
+
if (compareArray(expandItemValues, prevState.expandItemValues) && _isArray(expandItemValues)) {
|
|
475
475
|
nextState.expandItemValues = expandItemValues;
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
if (compareArray(uncheckableItemValues, prevState.uncheckableItemValues)) {
|
|
478
|
+
if (compareArray(uncheckableItemValues, prevState.uncheckableItemValues) && _isArray(uncheckableItemValues)) {
|
|
479
479
|
nextState.uncheckableItemValues = uncheckableItemValues;
|
|
480
480
|
}
|
|
481
481
|
|
|
@@ -542,7 +542,7 @@ function (_React$Component) {
|
|
|
542
542
|
|
|
543
543
|
if (compareArray(value, prevState.value)) {
|
|
544
544
|
this.unserializeLists({
|
|
545
|
-
check: value,
|
|
545
|
+
check: value !== null && value !== void 0 ? value : [],
|
|
546
546
|
expand: expandItemValues
|
|
547
547
|
});
|
|
548
548
|
this.setState({
|
|
@@ -556,7 +556,7 @@ function (_React$Component) {
|
|
|
556
556
|
_proto.updateExpandItemValuesChange = function updateExpandItemValuesChange(prevState) {
|
|
557
557
|
var expandItemValues = this.props.expandItemValues;
|
|
558
558
|
|
|
559
|
-
if (compareArray(expandItemValues, prevState.expandItemValues)) {
|
|
559
|
+
if (compareArray(expandItemValues, prevState.expandItemValues) && _isArray(expandItemValues)) {
|
|
560
560
|
this.unserializeLists({
|
|
561
561
|
expand: expandItemValues
|
|
562
562
|
});
|
|
@@ -573,7 +573,7 @@ function (_React$Component) {
|
|
|
573
573
|
expandItemValues = _this$state3.expandItemValues;
|
|
574
574
|
var uncheckableItemValues = this.props.uncheckableItemValues;
|
|
575
575
|
|
|
576
|
-
if (compareArray(uncheckableItemValues, prevState.uncheckableItemValues)) {
|
|
576
|
+
if (compareArray(uncheckableItemValues, prevState.uncheckableItemValues) && _isArray(uncheckableItemValues)) {
|
|
577
577
|
this.flattenNodes(data);
|
|
578
578
|
this.unserializeLists({
|
|
579
579
|
check: selectedValues,
|
|
@@ -625,6 +625,7 @@ function (_React$Component) {
|
|
|
625
625
|
|
|
626
626
|
if (isEveryChildChecked(node, this.nodes, this.props)) {
|
|
627
627
|
this.nodes[node.refKey].checkAll = true;
|
|
628
|
+
this.nodes[node.refKey].check = true;
|
|
628
629
|
return CHECK_STATE.CHECK;
|
|
629
630
|
}
|
|
630
631
|
|
|
@@ -844,7 +845,7 @@ function (_React$Component) {
|
|
|
844
845
|
});
|
|
845
846
|
}
|
|
846
847
|
/**
|
|
847
|
-
* 过滤选中的values中不包含 uncheckableItemValues 的那些值
|
|
848
|
+
* 过滤选中的 values 中不包含 uncheckableItemValues 的那些值
|
|
848
849
|
* @param {*} values
|
|
849
850
|
*/
|
|
850
851
|
;
|
|
@@ -1005,7 +1006,7 @@ function (_React$Component) {
|
|
|
1005
1006
|
};
|
|
1006
1007
|
|
|
1007
1008
|
_proto.toggleNode = function toggleNode(key, node, toggleValue) {
|
|
1008
|
-
// 如果该节点处于
|
|
1009
|
+
// 如果该节点处于 disabledCheckbox,则忽略该值
|
|
1009
1010
|
if (!node.uncheckable) {
|
|
1010
1011
|
this.nodes[node.refKey][key] = toggleValue;
|
|
1011
1012
|
}
|
|
@@ -146,7 +146,7 @@ function (_React$Component) {
|
|
|
146
146
|
className: classes,
|
|
147
147
|
componentClass: "li",
|
|
148
148
|
indeterminate: cascade && !active && this.utils.isSomeChildChecked(node, value),
|
|
149
|
-
onSelectItem: this.handleSelect.bind(this, layer
|
|
149
|
+
onSelectItem: this.handleSelect.bind(this, layer),
|
|
150
150
|
onCheck: onCheck,
|
|
151
151
|
checkable: !uncheckable
|
|
152
152
|
}, renderMenuItem ? renderMenuItem(label, node) : label, children ? React.createElement("span", {
|
|
@@ -41,6 +41,14 @@ export interface MultiCascaderProps<ValueType = any> extends FormControlPickerPr
|
|
|
41
41
|
event: React.SyntheticEvent<HTMLElement>
|
|
42
42
|
) => void;
|
|
43
43
|
|
|
44
|
+
/** Called after the checkbox state changes */
|
|
45
|
+
onCheck?: (
|
|
46
|
+
value: ValueType,
|
|
47
|
+
item: any,
|
|
48
|
+
checked: boolean,
|
|
49
|
+
event: React.SyntheticEvent<HTMLElement>
|
|
50
|
+
) => void;
|
|
51
|
+
|
|
44
52
|
/** Called when clean */
|
|
45
53
|
onClean?: (event: React.SyntheticEvent<HTMLElement>) => void;
|
|
46
54
|
|
|
@@ -37,9 +37,10 @@ function (_React$Component) {
|
|
|
37
37
|
_this.handleCheck = function (item, event, checked) {
|
|
38
38
|
var _this$props = _this.props,
|
|
39
39
|
valueKey = _this$props.valueKey,
|
|
40
|
-
onChange = _this$props.onChange,
|
|
41
40
|
cascade = _this$props.cascade,
|
|
42
|
-
uncheckableItemValues = _this$props.uncheckableItemValues
|
|
41
|
+
uncheckableItemValues = _this$props.uncheckableItemValues,
|
|
42
|
+
onChange = _this$props.onChange,
|
|
43
|
+
onCheck = _this$props.onCheck;
|
|
43
44
|
var itemValue = item[valueKey];
|
|
44
45
|
var value = [];
|
|
45
46
|
|
|
@@ -64,6 +65,7 @@ function (_React$Component) {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
onChange === null || onChange === void 0 ? void 0 : onChange(value, event);
|
|
68
|
+
onCheck === null || onCheck === void 0 ? void 0 : onCheck(value, item, checked, event);
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
_this.handleChangeForSearchItem = function (value, checked, event) {
|
|
@@ -543,7 +545,8 @@ MultiCascader.propTypes = _extends({}, listPickerPropTypes, {
|
|
|
543
545
|
renderMenuItem: PropTypes.func,
|
|
544
546
|
renderMenu: PropTypes.func,
|
|
545
547
|
onSearch: PropTypes.func,
|
|
546
|
-
onSelect: PropTypes.func
|
|
548
|
+
onSelect: PropTypes.func,
|
|
549
|
+
onCheck: PropTypes.func
|
|
547
550
|
});
|
|
548
551
|
MultiCascader.defaultProps = _extends({}, listPickerDefaultProps, {
|
|
549
552
|
searchable: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AnimationEventProps, StandardProps, TypeAttributes } from '../@types/common';
|
|
3
3
|
|
|
4
|
-
export type OverlayTriggerTrigger = 'click' | 'hover' | 'focus' | 'active' | 'none';
|
|
4
|
+
export type OverlayTriggerTrigger = 'click' | 'contextMenu' | 'hover' | 'focus' | 'active' | 'none';
|
|
5
5
|
|
|
6
6
|
export interface TriggerProps extends AnimationEventProps, StandardProps {
|
|
7
7
|
/** Triggering events */
|
|
@@ -49,7 +49,7 @@ function (_React$Component) {
|
|
|
49
49
|
var trigger = _this.props.trigger;
|
|
50
50
|
_this.mouseEnteredToSpeaker = false;
|
|
51
51
|
|
|
52
|
-
if (!isOneOf('click', trigger) && !isOneOf('active', trigger)) {
|
|
52
|
+
if (!isOneOf('click', trigger) && !isOneOf('active', trigger) && !isOneOf('contextMenu', trigger)) {
|
|
53
53
|
_this.hideWithCheck();
|
|
54
54
|
}
|
|
55
55
|
};
|
|
@@ -113,6 +113,10 @@ function (_React$Component) {
|
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
+
_this.preventDefault = function (event) {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
};
|
|
119
|
+
|
|
116
120
|
_this.handleDelayedShow = function () {
|
|
117
121
|
var _this$props2 = _this.props,
|
|
118
122
|
delayShow = _this$props2.delayShow,
|
|
@@ -216,6 +220,8 @@ function (_React$Component) {
|
|
|
216
220
|
|
|
217
221
|
if (isOneOf('click', trigger)) {
|
|
218
222
|
overlayProps.onHide = createChainedFunction(this.hide, onHide);
|
|
223
|
+
} else if (isOneOf('contextMenu', trigger)) {
|
|
224
|
+
overlayProps.onHide = createChainedFunction(this.hide, onHide);
|
|
219
225
|
} else if (isOneOf('active', trigger)) {
|
|
220
226
|
overlayProps.onHide = createChainedFunction(this.hide, onHide);
|
|
221
227
|
}
|
|
@@ -245,6 +251,7 @@ function (_React$Component) {
|
|
|
245
251
|
children = _this$props5.children,
|
|
246
252
|
speaker = _this$props5.speaker,
|
|
247
253
|
onClick = _this$props5.onClick,
|
|
254
|
+
onContextMenu = _this$props5.onContextMenu,
|
|
248
255
|
trigger = _this$props5.trigger,
|
|
249
256
|
onMouseOver = _this$props5.onMouseOver,
|
|
250
257
|
onMouseOut = _this$props5.onMouseOut,
|
|
@@ -264,6 +271,10 @@ function (_React$Component) {
|
|
|
264
271
|
props.onClick = createChainedFunction(this.toggleHideAndShow, props.onClick);
|
|
265
272
|
}
|
|
266
273
|
|
|
274
|
+
if (isOneOf('contextMenu', trigger)) {
|
|
275
|
+
props.onContextMenu = createChainedFunction(this.preventDefault, this.toggleHideAndShow, triggerProps.onContextMenu, onContextMenu);
|
|
276
|
+
}
|
|
277
|
+
|
|
267
278
|
if (isOneOf('active', trigger)) {
|
|
268
279
|
props.onClick = createChainedFunction(this.handleDelayedShow, props.onClick);
|
|
269
280
|
}
|
|
@@ -166,11 +166,12 @@
|
|
|
166
166
|
border-style: solid;
|
|
167
167
|
border-width: 0;
|
|
168
168
|
border-color: @table-border-color;
|
|
169
|
-
display: block;
|
|
170
169
|
overflow: hidden;
|
|
171
170
|
position: absolute;
|
|
172
171
|
white-space: normal;
|
|
173
172
|
background: @table-body-background;
|
|
173
|
+
display: table;
|
|
174
|
+
table-layout: fixed;
|
|
174
175
|
|
|
175
176
|
&.first {
|
|
176
177
|
border-left-width: 0;
|
package/es/utils/treeUtils.js
CHANGED
|
@@ -146,7 +146,11 @@ export function treeDeprecatedWarning(props, keys) {
|
|
|
146
146
|
*/
|
|
147
147
|
|
|
148
148
|
export function compareArray(a, b) {
|
|
149
|
-
|
|
149
|
+
if (!(_isArray(a) && _isArray(b))) {
|
|
150
|
+
return a !== b;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return !shallowEqualArray(a, b);
|
|
150
154
|
}
|
|
151
155
|
/**
|
|
152
156
|
* 获取 expandAll 的 value
|
|
@@ -505,11 +505,11 @@ function (_React$Component) {
|
|
|
505
505
|
nextState.value = value;
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
-
if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues)) {
|
|
508
|
+
if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues) && (0, _isArray2.default)(expandItemValues)) {
|
|
509
509
|
nextState.expandItemValues = expandItemValues;
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
if ((0, _treeUtils.compareArray)(uncheckableItemValues, prevState.uncheckableItemValues)) {
|
|
512
|
+
if ((0, _treeUtils.compareArray)(uncheckableItemValues, prevState.uncheckableItemValues) && (0, _isArray2.default)(uncheckableItemValues)) {
|
|
513
513
|
nextState.uncheckableItemValues = uncheckableItemValues;
|
|
514
514
|
}
|
|
515
515
|
|
|
@@ -576,7 +576,7 @@ function (_React$Component) {
|
|
|
576
576
|
|
|
577
577
|
if ((0, _treeUtils.compareArray)(value, prevState.value)) {
|
|
578
578
|
this.unserializeLists({
|
|
579
|
-
check: value,
|
|
579
|
+
check: value !== null && value !== void 0 ? value : [],
|
|
580
580
|
expand: expandItemValues
|
|
581
581
|
});
|
|
582
582
|
this.setState({
|
|
@@ -590,7 +590,7 @@ function (_React$Component) {
|
|
|
590
590
|
_proto.updateExpandItemValuesChange = function updateExpandItemValuesChange(prevState) {
|
|
591
591
|
var expandItemValues = this.props.expandItemValues;
|
|
592
592
|
|
|
593
|
-
if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues)) {
|
|
593
|
+
if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues) && (0, _isArray2.default)(expandItemValues)) {
|
|
594
594
|
this.unserializeLists({
|
|
595
595
|
expand: expandItemValues
|
|
596
596
|
});
|
|
@@ -607,7 +607,7 @@ function (_React$Component) {
|
|
|
607
607
|
expandItemValues = _this$state3.expandItemValues;
|
|
608
608
|
var uncheckableItemValues = this.props.uncheckableItemValues;
|
|
609
609
|
|
|
610
|
-
if ((0, _treeUtils.compareArray)(uncheckableItemValues, prevState.uncheckableItemValues)) {
|
|
610
|
+
if ((0, _treeUtils.compareArray)(uncheckableItemValues, prevState.uncheckableItemValues) && (0, _isArray2.default)(uncheckableItemValues)) {
|
|
611
611
|
this.flattenNodes(data);
|
|
612
612
|
this.unserializeLists({
|
|
613
613
|
check: selectedValues,
|
|
@@ -659,6 +659,7 @@ function (_React$Component) {
|
|
|
659
659
|
|
|
660
660
|
if ((0, _utils2.isEveryChildChecked)(node, this.nodes, this.props)) {
|
|
661
661
|
this.nodes[node.refKey].checkAll = true;
|
|
662
|
+
this.nodes[node.refKey].check = true;
|
|
662
663
|
return _constants.CHECK_STATE.CHECK;
|
|
663
664
|
}
|
|
664
665
|
|
|
@@ -878,7 +879,7 @@ function (_React$Component) {
|
|
|
878
879
|
});
|
|
879
880
|
}
|
|
880
881
|
/**
|
|
881
|
-
* 过滤选中的values中不包含 uncheckableItemValues 的那些值
|
|
882
|
+
* 过滤选中的 values 中不包含 uncheckableItemValues 的那些值
|
|
882
883
|
* @param {*} values
|
|
883
884
|
*/
|
|
884
885
|
;
|
|
@@ -1039,7 +1040,7 @@ function (_React$Component) {
|
|
|
1039
1040
|
};
|
|
1040
1041
|
|
|
1041
1042
|
_proto.toggleNode = function toggleNode(key, node, toggleValue) {
|
|
1042
|
-
// 如果该节点处于
|
|
1043
|
+
// 如果该节点处于 disabledCheckbox,则忽略该值
|
|
1043
1044
|
if (!node.uncheckable) {
|
|
1044
1045
|
this.nodes[node.refKey][key] = toggleValue;
|
|
1045
1046
|
}
|
|
@@ -168,7 +168,7 @@ function (_React$Component) {
|
|
|
168
168
|
className: classes,
|
|
169
169
|
componentClass: "li",
|
|
170
170
|
indeterminate: cascade && !active && this.utils.isSomeChildChecked(node, value),
|
|
171
|
-
onSelectItem: this.handleSelect.bind(this, layer
|
|
171
|
+
onSelectItem: this.handleSelect.bind(this, layer),
|
|
172
172
|
onCheck: onCheck,
|
|
173
173
|
checkable: !uncheckable
|
|
174
174
|
}, renderMenuItem ? renderMenuItem(label, node) : label, children ? React.createElement("span", {
|
|
@@ -41,6 +41,14 @@ export interface MultiCascaderProps<ValueType = any> extends FormControlPickerPr
|
|
|
41
41
|
event: React.SyntheticEvent<HTMLElement>
|
|
42
42
|
) => void;
|
|
43
43
|
|
|
44
|
+
/** Called after the checkbox state changes */
|
|
45
|
+
onCheck?: (
|
|
46
|
+
value: ValueType,
|
|
47
|
+
item: any,
|
|
48
|
+
checked: boolean,
|
|
49
|
+
event: React.SyntheticEvent<HTMLElement>
|
|
50
|
+
) => void;
|
|
51
|
+
|
|
44
52
|
/** Called when clean */
|
|
45
53
|
onClean?: (event: React.SyntheticEvent<HTMLElement>) => void;
|
|
46
54
|
|
|
@@ -66,9 +66,10 @@ function (_React$Component) {
|
|
|
66
66
|
_this.handleCheck = function (item, event, checked) {
|
|
67
67
|
var _this$props = _this.props,
|
|
68
68
|
valueKey = _this$props.valueKey,
|
|
69
|
-
onChange = _this$props.onChange,
|
|
70
69
|
cascade = _this$props.cascade,
|
|
71
|
-
uncheckableItemValues = _this$props.uncheckableItemValues
|
|
70
|
+
uncheckableItemValues = _this$props.uncheckableItemValues,
|
|
71
|
+
onChange = _this$props.onChange,
|
|
72
|
+
onCheck = _this$props.onCheck;
|
|
72
73
|
var itemValue = item[valueKey];
|
|
73
74
|
var value = [];
|
|
74
75
|
|
|
@@ -93,6 +94,7 @@ function (_React$Component) {
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
onChange === null || onChange === void 0 ? void 0 : onChange(value, event);
|
|
97
|
+
onCheck === null || onCheck === void 0 ? void 0 : onCheck(value, item, checked, event);
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
_this.handleChangeForSearchItem = function (value, checked, event) {
|
|
@@ -569,7 +571,8 @@ MultiCascader.propTypes = (0, _extends3.default)({}, _propTypes2.listPickerPropT
|
|
|
569
571
|
renderMenuItem: _propTypes.default.func,
|
|
570
572
|
renderMenu: _propTypes.default.func,
|
|
571
573
|
onSearch: _propTypes.default.func,
|
|
572
|
-
onSelect: _propTypes.default.func
|
|
574
|
+
onSelect: _propTypes.default.func,
|
|
575
|
+
onCheck: _propTypes.default.func
|
|
573
576
|
});
|
|
574
577
|
MultiCascader.defaultProps = (0, _extends3.default)({}, _propTypes2.listPickerDefaultProps, {
|
|
575
578
|
searchable: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AnimationEventProps, StandardProps, TypeAttributes } from '../@types/common';
|
|
3
3
|
|
|
4
|
-
export type OverlayTriggerTrigger = 'click' | 'hover' | 'focus' | 'active' | 'none';
|
|
4
|
+
export type OverlayTriggerTrigger = 'click' | 'contextMenu' | 'hover' | 'focus' | 'active' | 'none';
|
|
5
5
|
|
|
6
6
|
export interface TriggerProps extends AnimationEventProps, StandardProps {
|
|
7
7
|
/** Triggering events */
|
|
@@ -70,7 +70,7 @@ function (_React$Component) {
|
|
|
70
70
|
var trigger = _this.props.trigger;
|
|
71
71
|
_this.mouseEnteredToSpeaker = false;
|
|
72
72
|
|
|
73
|
-
if (!(0, _isOneOf.default)('click', trigger) && !(0, _isOneOf.default)('active', trigger)) {
|
|
73
|
+
if (!(0, _isOneOf.default)('click', trigger) && !(0, _isOneOf.default)('active', trigger) && !(0, _isOneOf.default)('contextMenu', trigger)) {
|
|
74
74
|
_this.hideWithCheck();
|
|
75
75
|
}
|
|
76
76
|
};
|
|
@@ -134,6 +134,10 @@ function (_React$Component) {
|
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
+
_this.preventDefault = function (event) {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
};
|
|
140
|
+
|
|
137
141
|
_this.handleDelayedShow = function () {
|
|
138
142
|
var _this$props2 = _this.props,
|
|
139
143
|
delayShow = _this$props2.delayShow,
|
|
@@ -236,6 +240,8 @@ function (_React$Component) {
|
|
|
236
240
|
|
|
237
241
|
if ((0, _isOneOf.default)('click', trigger)) {
|
|
238
242
|
overlayProps.onHide = (0, _createChainedFunction.default)(this.hide, onHide);
|
|
243
|
+
} else if ((0, _isOneOf.default)('contextMenu', trigger)) {
|
|
244
|
+
overlayProps.onHide = (0, _createChainedFunction.default)(this.hide, onHide);
|
|
239
245
|
} else if ((0, _isOneOf.default)('active', trigger)) {
|
|
240
246
|
overlayProps.onHide = (0, _createChainedFunction.default)(this.hide, onHide);
|
|
241
247
|
}
|
|
@@ -265,6 +271,7 @@ function (_React$Component) {
|
|
|
265
271
|
children = _this$props5.children,
|
|
266
272
|
speaker = _this$props5.speaker,
|
|
267
273
|
onClick = _this$props5.onClick,
|
|
274
|
+
onContextMenu = _this$props5.onContextMenu,
|
|
268
275
|
trigger = _this$props5.trigger,
|
|
269
276
|
onMouseOver = _this$props5.onMouseOver,
|
|
270
277
|
onMouseOut = _this$props5.onMouseOut,
|
|
@@ -284,6 +291,10 @@ function (_React$Component) {
|
|
|
284
291
|
props.onClick = (0, _createChainedFunction.default)(this.toggleHideAndShow, props.onClick);
|
|
285
292
|
}
|
|
286
293
|
|
|
294
|
+
if ((0, _isOneOf.default)('contextMenu', trigger)) {
|
|
295
|
+
props.onContextMenu = (0, _createChainedFunction.default)(this.preventDefault, this.toggleHideAndShow, triggerProps.onContextMenu, onContextMenu);
|
|
296
|
+
}
|
|
297
|
+
|
|
287
298
|
if ((0, _isOneOf.default)('active', trigger)) {
|
|
288
299
|
props.onClick = (0, _createChainedFunction.default)(this.handleDelayedShow, props.onClick);
|
|
289
300
|
}
|
|
@@ -166,11 +166,12 @@
|
|
|
166
166
|
border-style: solid;
|
|
167
167
|
border-width: 0;
|
|
168
168
|
border-color: @table-border-color;
|
|
169
|
-
display: block;
|
|
170
169
|
overflow: hidden;
|
|
171
170
|
position: absolute;
|
|
172
171
|
white-space: normal;
|
|
173
172
|
background: @table-body-background;
|
|
173
|
+
display: table;
|
|
174
|
+
table-layout: fixed;
|
|
174
175
|
|
|
175
176
|
&.first {
|
|
176
177
|
border-left-width: 0;
|
package/lib/utils/treeUtils.js
CHANGED
|
@@ -185,7 +185,11 @@ function treeDeprecatedWarning(props, keys) {
|
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
function compareArray(a, b) {
|
|
188
|
-
|
|
188
|
+
if (!((0, _isArray2.default)(a) && (0, _isArray2.default)(b))) {
|
|
189
|
+
return a !== b;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return !(0, _shallowEqualArray.default)(a, b);
|
|
189
193
|
}
|
|
190
194
|
/**
|
|
191
195
|
* 获取 expandAll 的 value
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsuite",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.2",
|
|
4
4
|
"description": "A suite of react components",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"classnames": ">=2.0.0",
|
|
58
58
|
"date-fns": "^1.30.1",
|
|
59
59
|
"dom-lib": "^1.2.1",
|
|
60
|
-
"element-resize-event": "^3.0.
|
|
60
|
+
"element-resize-event": "^3.0.6",
|
|
61
61
|
"lodash": "^4.17.11",
|
|
62
62
|
"prop-types": "^15.7.2",
|
|
63
63
|
"react-lifecycles-compat": "^3.0.4",
|
|
64
64
|
"react-virtualized": "^9.21.0",
|
|
65
65
|
"recompose": "^0.30.0",
|
|
66
|
-
"rsuite-table": "^3.
|
|
66
|
+
"rsuite-table": "^3.15.1",
|
|
67
67
|
"schema-typed": "^1.5.1"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -195,11 +195,14 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
|
|
|
195
195
|
nextState.value = value;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
if (compareArray(expandItemValues, prevState.expandItemValues)) {
|
|
198
|
+
if (compareArray(expandItemValues, prevState.expandItemValues) && _.isArray(expandItemValues)) {
|
|
199
199
|
nextState.expandItemValues = expandItemValues;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
if (
|
|
202
|
+
if (
|
|
203
|
+
compareArray(uncheckableItemValues, prevState.uncheckableItemValues) &&
|
|
204
|
+
_.isArray(uncheckableItemValues)
|
|
205
|
+
) {
|
|
203
206
|
nextState.uncheckableItemValues = uncheckableItemValues;
|
|
204
207
|
}
|
|
205
208
|
|
|
@@ -258,7 +261,7 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
|
|
|
258
261
|
const { value } = this.props;
|
|
259
262
|
if (compareArray(value, prevState.value)) {
|
|
260
263
|
this.unserializeLists({
|
|
261
|
-
check: value,
|
|
264
|
+
check: value ?? [],
|
|
262
265
|
expand: expandItemValues
|
|
263
266
|
});
|
|
264
267
|
this.setState({
|
|
@@ -271,7 +274,7 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
|
|
|
271
274
|
|
|
272
275
|
updateExpandItemValuesChange(prevState: CheckTreePickerState) {
|
|
273
276
|
const { expandItemValues } = this.props;
|
|
274
|
-
if (compareArray(expandItemValues, prevState.expandItemValues)) {
|
|
277
|
+
if (compareArray(expandItemValues, prevState.expandItemValues) && _.isArray(expandItemValues)) {
|
|
275
278
|
this.unserializeLists({
|
|
276
279
|
expand: expandItemValues
|
|
277
280
|
});
|
|
@@ -284,7 +287,10 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
|
|
|
284
287
|
updateUncheckableItemValuesChange(prevState: CheckTreePickerState) {
|
|
285
288
|
const { data, selectedValues, expandItemValues } = this.state;
|
|
286
289
|
const { uncheckableItemValues } = this.props;
|
|
287
|
-
if (
|
|
290
|
+
if (
|
|
291
|
+
compareArray(uncheckableItemValues, prevState.uncheckableItemValues) &&
|
|
292
|
+
_.isArray(uncheckableItemValues)
|
|
293
|
+
) {
|
|
288
294
|
this.flattenNodes(data);
|
|
289
295
|
this.unserializeLists({
|
|
290
296
|
check: selectedValues,
|
|
@@ -343,6 +349,7 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
|
|
|
343
349
|
|
|
344
350
|
if (isEveryChildChecked(node, this.nodes, this.props)) {
|
|
345
351
|
this.nodes[node.refKey].checkAll = true;
|
|
352
|
+
this.nodes[node.refKey].check = true;
|
|
346
353
|
return CHECK_STATE.CHECK;
|
|
347
354
|
}
|
|
348
355
|
|
|
@@ -481,6 +488,7 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
|
|
|
481
488
|
const checkItems = [];
|
|
482
489
|
Object.keys(this.nodes).map((refKey: string) => {
|
|
483
490
|
const node = this.nodes[refKey];
|
|
491
|
+
|
|
484
492
|
if (selectedValues.some((value: any) => shallowEqual(node[valueKey], value))) {
|
|
485
493
|
checkItems.push(node);
|
|
486
494
|
}
|
|
@@ -531,7 +539,7 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
|
|
|
531
539
|
}
|
|
532
540
|
|
|
533
541
|
/**
|
|
534
|
-
* 过滤选中的values中不包含 uncheckableItemValues 的那些值
|
|
542
|
+
* 过滤选中的 values 中不包含 uncheckableItemValues 的那些值
|
|
535
543
|
* @param {*} values
|
|
536
544
|
*/
|
|
537
545
|
filterSelectedValues(values: any[]) {
|
|
@@ -743,7 +751,7 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
|
|
|
743
751
|
}
|
|
744
752
|
|
|
745
753
|
toggleNode(key: string, node: Node, toggleValue: boolean) {
|
|
746
|
-
// 如果该节点处于
|
|
754
|
+
// 如果该节点处于 disabledCheckbox,则忽略该值
|
|
747
755
|
if (!node.uncheckable) {
|
|
748
756
|
this.nodes[node.refKey][key] = toggleValue;
|
|
749
757
|
}
|