rsuite 5.4.1 → 5.5.0
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/Button/styles/index.less +1 -5
- package/CHANGELOG.md +42 -0
- package/CheckTreePicker/styles/index.less +48 -47
- package/Drawer/styles/index.less +3 -0
- package/Dropdown/styles/index.less +3 -19
- package/Dropdown/styles/mixin.less +0 -2
- package/Modal/styles/index.less +23 -22
- package/Navbar/styles/index.less +20 -8
- package/Picker/styles/mixin.less +3 -2
- package/README.md +1 -1
- package/Sidenav/styles/index.less +58 -57
- package/TreePicker/styles/index.less +3 -3
- package/cjs/Affix/Affix.js +3 -1
- 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 +13 -2
- package/cjs/CheckPicker/CheckPicker.d.ts +5 -2
- package/cjs/CheckPicker/test/CheckPicker.test.js +8 -0
- 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/Disclosure/Disclosure.d.ts +8 -5
- package/cjs/Disclosure/Disclosure.js +49 -9
- package/cjs/Disclosure/DisclosureButton.d.ts +2 -2
- package/cjs/Disclosure/DisclosureContext.d.ts +6 -1
- package/cjs/Dropdown/Dropdown.d.ts +5 -0
- package/cjs/Dropdown/Dropdown.js +1 -1
- package/cjs/Dropdown/DropdownItem.js +9 -10
- package/cjs/Dropdown/DropdownMenu.js +69 -20
- 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/Modal.js +34 -22
- package/cjs/Modal/utils.js +16 -8
- package/cjs/MultiCascader/MultiCascader.js +7 -3
- package/cjs/Nav/NavItem.js +3 -1
- package/cjs/Navbar/index.d.ts +1 -0
- package/cjs/Navbar/index.js +4 -3
- package/cjs/Overlay/Modal.js +10 -27
- 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/SelectPicker/SelectPicker.d.ts +5 -2
- package/cjs/SelectPicker/test/SelectPicker.test.js +8 -0
- 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/index.d.ts +1 -0
- package/cjs/utils/index.js +7 -2
- 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/cjs/utils/useMount.d.ts +2 -0
- package/cjs/utils/useMount.js +19 -0
- package/dist/rsuite-rtl.css +416 -264
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +416 -264
- package/dist/rsuite.js +55 -33
- package/dist/rsuite.js.map +1 -1
- 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/Affix/Affix.js +4 -2
- 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 +13 -2
- package/esm/CheckPicker/CheckPicker.d.ts +5 -2
- package/esm/CheckPicker/test/CheckPicker.test.js +7 -0
- 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/Disclosure/Disclosure.d.ts +8 -5
- package/esm/Disclosure/Disclosure.js +50 -11
- package/esm/Disclosure/DisclosureButton.d.ts +2 -2
- package/esm/Disclosure/DisclosureContext.d.ts +6 -1
- package/esm/Dropdown/Dropdown.d.ts +5 -0
- package/esm/Dropdown/Dropdown.js +1 -1
- package/esm/Dropdown/DropdownItem.js +9 -9
- package/esm/Dropdown/DropdownMenu.js +69 -20
- 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/Modal.js +36 -24
- package/esm/Modal/utils.js +16 -8
- package/esm/MultiCascader/MultiCascader.js +7 -3
- package/esm/Nav/NavItem.js +3 -1
- package/esm/Navbar/index.d.ts +1 -0
- package/esm/Navbar/index.js +1 -0
- package/esm/Overlay/Modal.js +10 -27
- 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/SelectPicker/SelectPicker.d.ts +5 -2
- package/esm/SelectPicker/test/SelectPicker.test.js +7 -0
- 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/index.d.ts +1 -0
- package/esm/utils/index.js +2 -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/esm/utils/useMount.d.ts +2 -0
- package/esm/utils/useMount.js +13 -0
- package/package.json +2 -2
- package/styles/color-modes/dark.less +1 -0
- package/styles/color-modes/high-contrast.less +1 -0
- package/styles/color-modes/light.less +1 -0
- package/styles/mixins/utilities.less +17 -5
|
@@ -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],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Ref } from 'react';
|
|
2
2
|
import { PickerLocale } from '../locales';
|
|
3
|
+
import { PickerInstance } from '../Picker';
|
|
3
4
|
import { FormControlPickerProps, ItemDataType } from '../@types/common';
|
|
4
5
|
import { ListProps } from 'react-virtualized/dist/commonjs/List';
|
|
5
6
|
export interface SelectProps<T> {
|
|
@@ -42,7 +43,9 @@ export interface MultipleSelectProps<T> extends Omit<SelectProps<T>, 'renderValu
|
|
|
42
43
|
export interface SelectPickerProps<T> extends FormControlPickerProps<T, PickerLocale, ItemDataType<T>>, SelectProps<T> {
|
|
43
44
|
}
|
|
44
45
|
export interface SelectPickerComponent {
|
|
45
|
-
<T>(props: SelectPickerProps<T>
|
|
46
|
+
<T>(props: SelectPickerProps<T> & {
|
|
47
|
+
ref?: Ref<PickerInstance>;
|
|
48
|
+
}): JSX.Element | null;
|
|
46
49
|
displayName?: string;
|
|
47
50
|
propTypes?: React.WeakValidationMap<SelectPickerProps<any>>;
|
|
48
51
|
}
|
|
@@ -49,4 +49,11 @@ React.createElement(SelectPicker, {
|
|
|
49
49
|
onChange: function onChange(newValue) {
|
|
50
50
|
expectType(newValue);
|
|
51
51
|
}
|
|
52
|
+
});
|
|
53
|
+
var pickerRef = /*#__PURE__*/React.createRef();
|
|
54
|
+
|
|
55
|
+
/*#__PURE__*/
|
|
56
|
+
React.createElement(SelectPicker, {
|
|
57
|
+
ref: pickerRef,
|
|
58
|
+
data: []
|
|
52
59
|
});
|
|
@@ -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;
|
package/esm/utils/index.d.ts
CHANGED
|
@@ -40,3 +40,4 @@ export { default as useUpdatedRef } from './useUpdatedRef';
|
|
|
40
40
|
export { default as useWillUnmount } from './useWillUnmount';
|
|
41
41
|
export { default as useUpdateEffect } from './useUpdateEffect';
|
|
42
42
|
export { default as useIsMounted } from './useIsMounted';
|
|
43
|
+
export { default as useMount } from './useMount';
|
package/esm/utils/index.js
CHANGED
|
@@ -42,4 +42,5 @@ export { default as useEventCallback } from './useEventCallback';
|
|
|
42
42
|
export { default as useUpdatedRef } from './useUpdatedRef';
|
|
43
43
|
export { default as useWillUnmount } from './useWillUnmount';
|
|
44
44
|
export { default as useUpdateEffect } from './useUpdateEffect';
|
|
45
|
-
export { default as useIsMounted } from './useIsMounted';
|
|
45
|
+
export { default as useIsMounted } from './useIsMounted';
|
|
46
|
+
export { default as useMount } from './useMount';
|
|
@@ -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
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
var useMount = function useMount(callback) {
|
|
4
|
+
var mountRef = useRef(callback);
|
|
5
|
+
mountRef.current = callback;
|
|
6
|
+
useEffect(function () {
|
|
7
|
+
var _mountRef$current;
|
|
8
|
+
|
|
9
|
+
(_mountRef$current = mountRef.current) === null || _mountRef$current === void 0 ? void 0 : _mountRef$current.call(mountRef);
|
|
10
|
+
}, []);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default useMount;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsuite",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
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.
|
|
40
|
+
"rsuite-table": "^5.3.2",
|
|
41
41
|
"schema-typed": "^2.0.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
--rs-bg-active: @H700;
|
|
28
28
|
--rs-bg-backdrop: fade(@B900, 80%);
|
|
29
29
|
--rs-state-hover-bg: @B600;
|
|
30
|
+
--rs-color-focus-ring: 0 0 0 3px fade(@H500, 25%);
|
|
30
31
|
--rs-state-focus-shadow: 0 0 0 3px fade(@H500, 25%);
|
|
31
32
|
--rs-state-focus-outline: 3px solid fade(@H500, 25%);
|
|
32
33
|
--rs-shadow-overlay: 0 4px 4px rgba(0, 0, 0, 0.12), 0 0 10px rgba(0, 0, 0, 0.06);
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
--rs-bg-active: @H500;
|
|
28
28
|
--rs-bg-backdrop: fade(@B900, 80%);
|
|
29
29
|
--rs-state-hover-bg: @B600;
|
|
30
|
+
--rs-color-focus-ring: @B000;
|
|
30
31
|
--rs-state-focus-shadow: 0 0 0 3px @B900, 0 0 0 5px @B000;
|
|
31
32
|
--rs-state-focus-shadow-slim: 0 0 0 2px @B000;
|
|
32
33
|
--rs-state-focus-outline: 3px solid fade(@H500, 25%);
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
--rs-bg-active: @H500;
|
|
35
35
|
--rs-bg-backdrop: fade(@B900, 30%);
|
|
36
36
|
--rs-state-hover-bg: @H050;
|
|
37
|
+
--rs-color-focus-ring: fade(@H500, 25%);
|
|
37
38
|
--rs-state-focus-shadow: 0 0 0 3px fade(@H500, 25%);
|
|
38
39
|
--rs-state-focus-outline: 3px solid fade(@H500, 25%);
|
|
39
40
|
--rs-shadow-overlay: 0 4px 4px rgba(0, 0, 0, 0.12), 0 0 10px rgba(0, 0, 0, 0.06);
|
|
@@ -122,26 +122,38 @@
|
|
|
122
122
|
|
|
123
123
|
// Useful when adding focus ring to an element
|
|
124
124
|
.with-focus-ring() {
|
|
125
|
-
&:focus {
|
|
125
|
+
&:focus-visible {
|
|
126
126
|
.focus-ring();
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// Useful when appending the ring into an existing :focus rule
|
|
131
131
|
.focus-ring() {
|
|
132
|
-
|
|
132
|
+
outline: 3px solid var(--rs-color-focus-ring);
|
|
133
|
+
// box-shadow: var(--rs-state-focus-shadow);
|
|
134
|
+
|
|
135
|
+
.high-contrast-mode({
|
|
136
|
+
outline-offset: 2px;
|
|
137
|
+
});
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
.focus-ring(slim) {
|
|
136
|
-
|
|
141
|
+
.focus-ring();
|
|
142
|
+
|
|
143
|
+
outline-width: 2px;
|
|
144
|
+
outline-offset: 0;
|
|
137
145
|
}
|
|
138
146
|
|
|
139
147
|
.focus-ring(inset) {
|
|
140
|
-
|
|
148
|
+
.focus-ring();
|
|
149
|
+
|
|
150
|
+
outline-offset: -3px;
|
|
141
151
|
}
|
|
142
152
|
|
|
143
153
|
.focus-ring(slim-inset) {
|
|
144
|
-
|
|
154
|
+
.focus-ring(inset);
|
|
155
|
+
|
|
156
|
+
outline-width: 2px;
|
|
145
157
|
}
|
|
146
158
|
|
|
147
159
|
.focus-ring(outline) {
|