rsuite 5.4.3 → 5.5.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 +46 -0
- package/Carousel/styles/index.less +1 -0
- package/CheckTreePicker/styles/index.less +51 -50
- package/Dropdown/styles/index.less +2 -19
- package/Modal/styles/mixin.less +1 -0
- package/Picker/styles/mixin.less +3 -2
- package/README.md +1 -1
- package/Sidenav/styles/index.less +54 -59
- package/TreePicker/styles/index.less +3 -3
- package/cjs/Calendar/useCalendarDate.d.ts +1 -1
- package/cjs/Calendar/useCalendarDate.js +1 -1
- package/cjs/Carousel/Carousel.js +7 -1
- package/cjs/Cascader/Cascader.js +15 -4
- package/cjs/CheckTreePicker/CheckTreePicker.js +1 -1
- package/cjs/CheckTreePicker/utils.js +1 -1
- package/cjs/CustomProvider/CustomProvider.d.ts +14 -14
- package/cjs/CustomProvider/CustomProvider.js +4 -3
- package/cjs/DatePicker/DatePicker.d.ts +1 -1
- package/cjs/DatePicker/DatePicker.js +2 -4
- package/cjs/DateRangePicker/Calendar.js +2 -16
- package/cjs/Dropdown/Dropdown.d.ts +5 -0
- package/cjs/Dropdown/DropdownMenu.js +5 -11
- package/cjs/Dropdown/test/Dropdown.test.d.ts +1 -0
- package/cjs/Dropdown/test/Dropdown.test.js +30 -0
- package/cjs/InputNumber/InputNumber.d.ts +1 -1
- package/cjs/InputNumber/InputNumber.js +36 -6
- package/cjs/InputNumber/test/InputNumber.test.d.ts +1 -0
- package/cjs/InputNumber/test/InputNumber.test.js +14 -0
- package/cjs/Modal/utils.js +16 -8
- package/cjs/MultiCascader/MultiCascader.js +7 -3
- package/cjs/Nav/NavItem.js +3 -1
- package/cjs/Picker/DropdownMenu.js +5 -0
- package/cjs/Picker/PickerToggle.js +2 -4
- package/cjs/RangeSlider/RangeSlider.d.ts +12 -2
- package/cjs/RangeSlider/RangeSlider.js +35 -12
- package/cjs/Uploader/UploadFileItem.d.ts +1 -1
- package/cjs/Uploader/UploadFileItem.js +1 -1
- package/cjs/Uploader/Uploader.js +3 -0
- package/cjs/utils/propTypeChecker.d.ts +2 -6
- package/cjs/utils/propTypeChecker.js +7 -59
- package/cjs/utils/treeUtils.js +4 -3
- package/cjs/utils/useClickOutside.js +6 -2
- package/dist/rsuite-rtl.css +115 -127
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +115 -127
- package/dist/rsuite.js +24 -24
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Calendar/useCalendarDate.d.ts +1 -1
- package/esm/Calendar/useCalendarDate.js +1 -1
- package/esm/Carousel/Carousel.js +9 -3
- package/esm/Cascader/Cascader.js +15 -4
- package/esm/CheckTreePicker/CheckTreePicker.js +1 -1
- package/esm/CheckTreePicker/utils.js +1 -1
- package/esm/CustomProvider/CustomProvider.d.ts +14 -14
- package/esm/CustomProvider/CustomProvider.js +2 -2
- package/esm/DatePicker/DatePicker.d.ts +1 -1
- package/esm/DatePicker/DatePicker.js +2 -3
- package/esm/DateRangePicker/Calendar.js +2 -16
- package/esm/Dropdown/Dropdown.d.ts +5 -0
- package/esm/Dropdown/DropdownMenu.js +5 -11
- package/esm/Dropdown/test/Dropdown.test.d.ts +1 -0
- package/esm/Dropdown/test/Dropdown.test.js +22 -0
- package/esm/InputNumber/InputNumber.d.ts +1 -1
- package/esm/InputNumber/InputNumber.js +38 -7
- package/esm/InputNumber/test/InputNumber.test.d.ts +1 -0
- package/esm/InputNumber/test/InputNumber.test.js +7 -0
- package/esm/Modal/utils.js +16 -8
- package/esm/MultiCascader/MultiCascader.js +7 -3
- package/esm/Nav/NavItem.js +3 -1
- package/esm/Picker/DropdownMenu.js +5 -0
- package/esm/Picker/PickerToggle.js +2 -4
- package/esm/RangeSlider/RangeSlider.d.ts +12 -2
- package/esm/RangeSlider/RangeSlider.js +35 -12
- package/esm/Uploader/UploadFileItem.d.ts +1 -1
- package/esm/Uploader/UploadFileItem.js +1 -1
- package/esm/Uploader/Uploader.js +4 -1
- package/esm/utils/propTypeChecker.d.ts +2 -6
- package/esm/utils/propTypeChecker.js +7 -59
- package/esm/utils/treeUtils.js +6 -3
- package/esm/utils/useClickOutside.js +6 -2
- package/package.json +2 -2
|
@@ -21,6 +21,7 @@ var RangeSlider = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
21
21
|
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
22
22
|
barClassName = props.barClassName,
|
|
23
23
|
className = props.className,
|
|
24
|
+
constraint = props.constraint,
|
|
24
25
|
_props$defaultValue = props.defaultValue,
|
|
25
26
|
defaultValue = _props$defaultValue === void 0 ? defaultDefaultValue : _props$defaultValue,
|
|
26
27
|
graduated = props.graduated,
|
|
@@ -47,7 +48,7 @@ var RangeSlider = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
47
48
|
renderMark = props.renderMark,
|
|
48
49
|
onChange = props.onChange,
|
|
49
50
|
onChangeCommitted = props.onChangeCommitted,
|
|
50
|
-
rest = _objectWithoutPropertiesLoose(props, ["aria-label", "aria-labelledby", "aria-valuetext", "as", "barClassName", "className", "defaultValue", "graduated", "progress", "vertical", "disabled", "classPrefix", "min", "max", "step", "value", "handleClassName", "handleStyle", "handleTitle", "tooltip", "getAriaValueText", "renderTooltip", "renderMark", "onChange", "onChangeCommitted"]);
|
|
51
|
+
rest = _objectWithoutPropertiesLoose(props, ["aria-label", "aria-labelledby", "aria-valuetext", "as", "barClassName", "className", "constraint", "defaultValue", "graduated", "progress", "vertical", "disabled", "classPrefix", "min", "max", "step", "value", "handleClassName", "handleStyle", "handleTitle", "tooltip", "getAriaValueText", "renderTooltip", "renderMark", "onChange", "onChangeCommitted"]);
|
|
51
52
|
|
|
52
53
|
var barRef = useRef(null); // Define the parameter position of the handle
|
|
53
54
|
|
|
@@ -157,14 +158,27 @@ var RangeSlider = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
157
158
|
|
|
158
159
|
return nextValue;
|
|
159
160
|
}, [getRangeValue, getValidValue]);
|
|
161
|
+
/**
|
|
162
|
+
* Whether a range is valid against given constraint (if any)
|
|
163
|
+
* Should check before every `setValue` calls
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
var isRangeMatchingConstraint = useCallback(function (range) {
|
|
167
|
+
// If no constraint is defined, any range is valid
|
|
168
|
+
if (!constraint) return true;
|
|
169
|
+
return constraint(range);
|
|
170
|
+
}, [constraint]);
|
|
160
171
|
/**
|
|
161
172
|
* Callback function that is fired when the mousemove is triggered
|
|
162
173
|
*/
|
|
163
174
|
|
|
164
175
|
var handleDragMove = useEventCallback(function (event, dataset) {
|
|
165
176
|
var nextValue = getNextValue(event, dataset);
|
|
166
|
-
|
|
167
|
-
|
|
177
|
+
|
|
178
|
+
if (isRangeMatchingConstraint(nextValue)) {
|
|
179
|
+
setValue(nextValue);
|
|
180
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue, event);
|
|
181
|
+
}
|
|
168
182
|
});
|
|
169
183
|
/**
|
|
170
184
|
* Callback function that is fired when the mouseup is triggered
|
|
@@ -172,9 +186,12 @@ var RangeSlider = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
172
186
|
|
|
173
187
|
var handleChangeCommitted = useCallback(function (event, dataset) {
|
|
174
188
|
var nextValue = getNextValue(event, dataset);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
189
|
+
|
|
190
|
+
if (isRangeMatchingConstraint(nextValue)) {
|
|
191
|
+
setValue(nextValue);
|
|
192
|
+
onChangeCommitted === null || onChangeCommitted === void 0 ? void 0 : onChangeCommitted(nextValue, event);
|
|
193
|
+
}
|
|
194
|
+
}, [getNextValue, onChangeCommitted, isRangeMatchingConstraint, setValue]);
|
|
178
195
|
var handleKeyDown = useCallback(function (event) {
|
|
179
196
|
var _event$target;
|
|
180
197
|
|
|
@@ -217,9 +234,12 @@ var RangeSlider = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
217
234
|
|
|
218
235
|
|
|
219
236
|
event.preventDefault();
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
237
|
+
|
|
238
|
+
if (isRangeMatchingConstraint(nextValue)) {
|
|
239
|
+
setValue(nextValue);
|
|
240
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue, event);
|
|
241
|
+
}
|
|
242
|
+
}, [max, min, onChange, rtl, isRangeMatchingConstraint, setValue, step, value]);
|
|
223
243
|
var handleClick = useCallback(function (event) {
|
|
224
244
|
if (disabled) {
|
|
225
245
|
return;
|
|
@@ -236,9 +256,12 @@ var RangeSlider = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
236
256
|
}
|
|
237
257
|
|
|
238
258
|
var nextValue = getValidValue([start, end].sort());
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
259
|
+
|
|
260
|
+
if (isRangeMatchingConstraint(nextValue)) {
|
|
261
|
+
setValue(nextValue);
|
|
262
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue, event);
|
|
263
|
+
}
|
|
264
|
+
}, [disabled, getValidValue, getValueByPosition, isRangeMatchingConstraint, onChange, setValue, value]);
|
|
242
265
|
var handleProps = useMemo(function () {
|
|
243
266
|
return [{
|
|
244
267
|
value: value[0],
|
|
@@ -4,7 +4,7 @@ import { UploaderLocale } from '../locales';
|
|
|
4
4
|
import { WithAsProps } from '../@types/common';
|
|
5
5
|
export interface UploadFileItemProps extends WithAsProps {
|
|
6
6
|
file: FileType;
|
|
7
|
-
listType
|
|
7
|
+
listType?: 'text' | 'picture-text' | 'picture';
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
className?: string;
|
|
10
10
|
maxPreviewFileSize?: number;
|
|
@@ -276,7 +276,7 @@ UploadFileItem.displayName = 'UploadFileItem';
|
|
|
276
276
|
UploadFileItem.propTypes = {
|
|
277
277
|
locale: PropTypes.any,
|
|
278
278
|
file: PropTypes.object.isRequired,
|
|
279
|
-
listType: PropTypes.oneOf(['text', 'picture-text', 'picture'])
|
|
279
|
+
listType: PropTypes.oneOf(['text', 'picture-text', 'picture']),
|
|
280
280
|
disabled: PropTypes.bool,
|
|
281
281
|
className: PropTypes.string,
|
|
282
282
|
maxPreviewFileSize: PropTypes.number,
|
package/esm/Uploader/Uploader.js
CHANGED
|
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import find from 'lodash/find';
|
|
6
6
|
import FileItem from './UploadFileItem';
|
|
7
7
|
import UploadTrigger from './UploadTrigger';
|
|
8
|
-
import { ajaxUpload, useClassNames, useCustom, guid } from '../utils';
|
|
8
|
+
import { ajaxUpload, useClassNames, useCustom, guid, useWillUnmount } from '../utils';
|
|
9
9
|
import Plaintext from '../Plaintext';
|
|
10
10
|
|
|
11
11
|
var getFiles = function getFiles(event) {
|
|
@@ -83,6 +83,9 @@ var useFileList = function useFileList(defaultFileList) {
|
|
|
83
83
|
(_fileListUpdateCallba = fileListUpdateCallback.current) === null || _fileListUpdateCallba === void 0 ? void 0 : _fileListUpdateCallba.call(fileListUpdateCallback, fileList);
|
|
84
84
|
fileListUpdateCallback.current = null;
|
|
85
85
|
}, [fileList]);
|
|
86
|
+
useWillUnmount(function () {
|
|
87
|
+
fileListUpdateCallback.current = null;
|
|
88
|
+
});
|
|
86
89
|
var dispatchCallback = useCallback(function (action, callback) {
|
|
87
90
|
dispatch(action);
|
|
88
91
|
fileListUpdateCallback.current = callback;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import PropTypes
|
|
2
|
-
declare
|
|
3
|
-
[K in keyof T]: T[K] extends Validator<infer V> ? V : never;
|
|
4
|
-
};
|
|
5
|
-
export declare function tupleType<T extends readonly Validator<any>[]>(...types: T): Requireable<ExtractValue<T>>;
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export declare function tupleType<T>(...typeCheckers: any[]): PropTypes.Requireable<T>;
|
|
6
3
|
export declare const refType: PropTypes.Requireable<any>;
|
|
7
|
-
export {};
|
|
@@ -1,69 +1,17 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
var ANONYMOUS = '';
|
|
3
|
-
|
|
4
|
-
function createChainableTypeChecker(validate) {
|
|
5
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
|
6
|
-
componentName = componentName || ANONYMOUS;
|
|
7
|
-
propFullName = propFullName || propName;
|
|
8
|
-
|
|
9
|
-
if (props[propName] == null) {
|
|
10
|
-
if (isRequired) {
|
|
11
|
-
if (props[propName] === null) {
|
|
12
|
-
return new Error('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return new Error('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return null;
|
|
19
|
-
} else {
|
|
20
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var chainedCheckType = Object.assign(checkType.bind(null, false), {
|
|
25
|
-
isRequired: checkType.bind(null, true)
|
|
26
|
-
});
|
|
27
|
-
return chainedCheckType;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
2
|
export function tupleType() {
|
|
31
|
-
for (var _len = arguments.length,
|
|
32
|
-
|
|
3
|
+
for (var _len = arguments.length, typeCheckers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4
|
+
typeCheckers[_key] = arguments[_key];
|
|
33
5
|
}
|
|
34
6
|
|
|
35
|
-
return
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
if (!location) {
|
|
39
|
-
location = 'prop';
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (!propFullName) {
|
|
43
|
-
propFullName = propName;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!Array.isArray(value)) {
|
|
47
|
-
return new Error("Invalid " + location + " `" + propFullName + "` supplied to `" + componentName + "`, expected " + types.length + "-element array");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (value.length === 0) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (value.length !== types.length) {
|
|
55
|
-
return new Error("Invalid " + location + " `" + propFullName + "` supplied to `" + componentName + "`, expected " + types.length + "-element array, got array of length " + value.length);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
for (var i = 0; i < value.length; ++i) {
|
|
59
|
-
var error = types[i](value, String(i), componentName, 'element', propFullName + "[" + i + "]");
|
|
7
|
+
return PropTypes.arrayOf(function (value, index) {
|
|
8
|
+
var _typeCheckers$index;
|
|
60
9
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
10
|
+
for (var _len2 = arguments.length, rest = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
11
|
+
rest[_key2 - 2] = arguments[_key2];
|
|
64
12
|
}
|
|
65
13
|
|
|
66
|
-
return
|
|
14
|
+
return (_typeCheckers$index = typeCheckers[index]).call.apply(_typeCheckers$index, [PropTypes, value, index].concat(rest));
|
|
67
15
|
});
|
|
68
16
|
}
|
|
69
17
|
export var refType = PropTypes.oneOfType([PropTypes.func, PropTypes.any]);
|
package/esm/utils/treeUtils.js
CHANGED
|
@@ -258,6 +258,9 @@ export function createUpdateTreeDataFunction(params, _ref2) {
|
|
|
258
258
|
var dragNode = params.dragNode,
|
|
259
259
|
dropNode = params.dropNode,
|
|
260
260
|
dropNodePosition = params.dropNodePosition;
|
|
261
|
+
|
|
262
|
+
var cloneDragNode = _extends({}, dragNode);
|
|
263
|
+
|
|
261
264
|
removeDragNode(data, params, {
|
|
262
265
|
valueKey: valueKey,
|
|
263
266
|
childrenKey: childrenKey
|
|
@@ -272,16 +275,16 @@ export function createUpdateTreeDataFunction(params, _ref2) {
|
|
|
272
275
|
if (dropNodePosition === TREE_NODE_DROP_POSITION.DRAG_OVER) {
|
|
273
276
|
_item2[childrenKey] = _isNil(_item2[childrenKey]) ? [] : _item2[childrenKey];
|
|
274
277
|
|
|
275
|
-
_item2[childrenKey].push(
|
|
278
|
+
_item2[childrenKey].push(cloneDragNode);
|
|
276
279
|
|
|
277
280
|
break;
|
|
278
281
|
} else if (dropNodePosition === TREE_NODE_DROP_POSITION.DRAG_OVER_TOP) {
|
|
279
282
|
// drag to top of node
|
|
280
|
-
items.splice(_index2, 0,
|
|
283
|
+
items.splice(_index2, 0, cloneDragNode);
|
|
281
284
|
break;
|
|
282
285
|
} else if (dropNodePosition === TREE_NODE_DROP_POSITION.DRAG_OVER_BOTTOM) {
|
|
283
286
|
// drag to bottom of node
|
|
284
|
-
items.splice(_index2 + 1, 0,
|
|
287
|
+
items.splice(_index2 + 1, 0, cloneDragNode);
|
|
285
288
|
break;
|
|
286
289
|
}
|
|
287
290
|
}
|
|
@@ -13,8 +13,12 @@ export default function useClickOutside(_ref) {
|
|
|
13
13
|
useEffect(function () {
|
|
14
14
|
if (enabled) {
|
|
15
15
|
var eventHandler = function eventHandler(event) {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
var _isOutsideRef$current;
|
|
17
|
+
|
|
18
|
+
if ((_isOutsideRef$current = isOutsideRef.current) !== null && _isOutsideRef$current !== void 0 && _isOutsideRef$current.call(isOutsideRef, event)) {
|
|
19
|
+
var _handleRef$current;
|
|
20
|
+
|
|
21
|
+
(_handleRef$current = handleRef.current) === null || _handleRef$current === void 0 ? void 0 : _handleRef$current.call(handleRef, event);
|
|
18
22
|
}
|
|
19
23
|
};
|
|
20
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsuite",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.2",
|
|
4
4
|
"description": "A suite of react components",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"lodash": "^4.17.11",
|
|
38
38
|
"prop-types": "^15.7.2",
|
|
39
39
|
"react-virtualized": "^9.22.3",
|
|
40
|
-
"rsuite-table": "^5.3.
|
|
40
|
+
"rsuite-table": "^5.3.2",
|
|
41
41
|
"schema-typed": "^2.0.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|