rsuite 5.4.3 → 5.4.4
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 +9 -0
- package/CheckTreePicker/styles/index.less +1 -1
- package/Dropdown/styles/index.less +2 -19
- package/README.md +1 -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/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/Dropdown/DropdownMenu.js +5 -11
- package/cjs/Modal/utils.js +16 -8
- package/cjs/MultiCascader/MultiCascader.js +6 -3
- package/cjs/Nav/NavItem.js +3 -1
- package/cjs/Picker/DropdownMenu.js +5 -0
- package/cjs/Picker/PickerToggle.js +2 -4
- 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/useClickOutside.js +6 -2
- package/dist/rsuite-rtl.css +4 -7
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +4 -7
- package/dist/rsuite.js +18 -18
- 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 +13 -2
- 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/Dropdown/DropdownMenu.js +5 -11
- package/esm/Modal/utils.js +16 -8
- package/esm/MultiCascader/MultiCascader.js +6 -3
- package/esm/Nav/NavItem.js +3 -1
- package/esm/Picker/DropdownMenu.js +5 -0
- package/esm/Picker/PickerToggle.js +2 -4
- 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/useClickOutside.js +6 -2
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const useCalendarDate: (value: Date | undefined, defaultDate: Date | undefined) => {
|
|
1
|
+
declare const useCalendarDate: (value: Date | null | undefined, defaultDate: Date | undefined) => {
|
|
2
2
|
calendarDate: Date;
|
|
3
3
|
setCalendarDate: (date: Date | undefined) => void;
|
|
4
4
|
};
|
|
@@ -19,7 +19,7 @@ var useCalendarDate = function useCalendarDate(value, defaultDate) {
|
|
|
19
19
|
var _valueRef$current;
|
|
20
20
|
|
|
21
21
|
if ((value === null || value === void 0 ? void 0 : value.valueOf()) !== ((_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current.valueOf())) {
|
|
22
|
-
setCalendarDate(value);
|
|
22
|
+
setCalendarDate(value !== null && value !== void 0 ? value : new Date());
|
|
23
23
|
valueRef.current = value;
|
|
24
24
|
}
|
|
25
25
|
}, [value]);
|
package/esm/Carousel/Carousel.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React, { useState, useMemo, useCallback } from 'react';
|
|
3
|
+
import React, { useState, useMemo, useCallback, useRef } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import { useClassNames, useCustom, guid, ReactChildren, useTimeout } from '../utils';
|
|
6
|
+
import { useClassNames, useCustom, guid, ReactChildren, useTimeout, mergeRefs } from '../utils';
|
|
7
7
|
var Carousel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
8
8
|
var _sliderStyles, _ref;
|
|
9
9
|
|
|
@@ -46,7 +46,13 @@ var Carousel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
46
46
|
lastIndex = _useState2[0],
|
|
47
47
|
setLastIndex = _useState2[1];
|
|
48
48
|
|
|
49
|
+
var rootRef = useRef(null);
|
|
50
|
+
|
|
49
51
|
var handleSlide = function handleSlide(nextActiveIndex, event) {
|
|
52
|
+
if (!rootRef.current) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
clear();
|
|
51
57
|
var index = nextActiveIndex !== null && nextActiveIndex !== void 0 ? nextActiveIndex : activeIndex + 1; // When index is greater than count, start from 1 again.
|
|
52
58
|
|
|
@@ -111,7 +117,7 @@ var Carousel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
111
117
|
var sliderStyles = (_sliderStyles = {}, _sliderStyles[lengthKey] = count * 100 + "%", _sliderStyles.transform = vertical ? "translate3d(0, " + activeRatio + " ,0)" : "translate3d(" + activeRatio + ", 0 ,0)", _sliderStyles);
|
|
112
118
|
var showMask = count > 1 && activeIndex === 0 && activeIndex !== lastIndex;
|
|
113
119
|
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
114
|
-
ref: ref,
|
|
120
|
+
ref: mergeRefs(ref, rootRef),
|
|
115
121
|
className: classes
|
|
116
122
|
}), /*#__PURE__*/React.createElement("div", {
|
|
117
123
|
className: prefix('content')
|
package/esm/Cascader/Cascader.js
CHANGED
|
@@ -188,10 +188,18 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
188
188
|
}
|
|
189
189
|
}, [getSearchResult, onSearch, setFocusItemValue, setKeys, setLayer, valueKey]);
|
|
190
190
|
var handleEntered = useCallback(function () {
|
|
191
|
+
if (!targetRef.current) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
191
195
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
192
196
|
setActive(true);
|
|
193
197
|
}, [onOpen]);
|
|
194
198
|
var handleExited = useCallback(function () {
|
|
199
|
+
if (!targetRef.current) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
195
203
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
196
204
|
setActive(false);
|
|
197
205
|
setSearchKeyword('');
|
|
@@ -202,7 +210,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
202
210
|
(_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.close();
|
|
203
211
|
}, [triggerRef]);
|
|
204
212
|
var handleClean = useCallback(function (event) {
|
|
205
|
-
if (disabled) {
|
|
213
|
+
if (disabled || !targetRef.current) {
|
|
206
214
|
return;
|
|
207
215
|
}
|
|
208
216
|
|
|
@@ -260,7 +268,10 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
260
268
|
children.then(function (data) {
|
|
261
269
|
node.loading = false;
|
|
262
270
|
node[childrenKey] = data;
|
|
263
|
-
|
|
271
|
+
|
|
272
|
+
if (targetRef.current) {
|
|
273
|
+
addColumn(data, cascadePaths.length);
|
|
274
|
+
}
|
|
264
275
|
});
|
|
265
276
|
} else {
|
|
266
277
|
node.loading = false;
|
|
@@ -621,7 +621,7 @@ var CheckTreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
621
621
|
var renderCheckTree = function renderCheckTree() {
|
|
622
622
|
var _withCheckTreeClassPr, _merge2;
|
|
623
623
|
|
|
624
|
-
var classes = withCheckTreeClassPrefix((_withCheckTreeClassPr = {}, _withCheckTreeClassPr[className !== null && className !== void 0 ? className : ''] = inline, _withCheckTreeClassPr['without-children'] = !isSomeNodeHasChildren, _withCheckTreeClassPr.virtualized = virtualized, _withCheckTreeClassPr));
|
|
624
|
+
var classes = withCheckTreeClassPrefix((_withCheckTreeClassPr = {}, _withCheckTreeClassPr[className !== null && className !== void 0 ? className : ''] = inline, _withCheckTreeClassPr['without-children'] = !isSomeNodeHasChildren(data, childrenKey), _withCheckTreeClassPr.virtualized = virtualized, _withCheckTreeClassPr));
|
|
625
625
|
var formattedNodes = getFormattedNodes(renderNode);
|
|
626
626
|
|
|
627
627
|
if (!formattedNodes.some(function (v) {
|
|
@@ -38,7 +38,7 @@ export function isSomeChildChecked(nodes, parent, childrenKey) {
|
|
|
38
38
|
}
|
|
39
39
|
export function isSomeNodeHasChildren(data, childrenKey) {
|
|
40
40
|
return data.some(function (node) {
|
|
41
|
-
return node[childrenKey];
|
|
41
|
+
return Array.isArray(node[childrenKey]);
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
@@ -72,10 +72,10 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
72
72
|
saturday: string;
|
|
73
73
|
ok: string;
|
|
74
74
|
today: string;
|
|
75
|
-
yesterday: string;
|
|
75
|
+
yesterday: string;
|
|
76
76
|
hours: string;
|
|
77
77
|
minutes: string;
|
|
78
|
-
seconds: string;
|
|
78
|
+
seconds: string; /** Support right-to-left */
|
|
79
79
|
formattedMonthPattern: string;
|
|
80
80
|
formattedDayPattern: string;
|
|
81
81
|
dateLocale: any;
|
|
@@ -90,10 +90,10 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
90
90
|
saturday: string;
|
|
91
91
|
ok: string;
|
|
92
92
|
today: string;
|
|
93
|
-
yesterday: string;
|
|
93
|
+
yesterday: string;
|
|
94
94
|
hours: string;
|
|
95
95
|
minutes: string;
|
|
96
|
-
seconds: string;
|
|
96
|
+
seconds: string; /** Support right-to-left */
|
|
97
97
|
formattedMonthPattern: string;
|
|
98
98
|
formattedDayPattern: string;
|
|
99
99
|
dateLocale: any;
|
|
@@ -109,10 +109,10 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
109
109
|
saturday: string;
|
|
110
110
|
ok: string;
|
|
111
111
|
today: string;
|
|
112
|
-
yesterday: string;
|
|
112
|
+
yesterday: string;
|
|
113
113
|
hours: string;
|
|
114
114
|
minutes: string;
|
|
115
|
-
seconds: string;
|
|
115
|
+
seconds: string; /** Support right-to-left */
|
|
116
116
|
formattedMonthPattern: string;
|
|
117
117
|
formattedDayPattern: string;
|
|
118
118
|
dateLocale: any;
|
|
@@ -120,7 +120,7 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
120
120
|
Picker?: {
|
|
121
121
|
noResultsText: string;
|
|
122
122
|
placeholder: string;
|
|
123
|
-
searchPlaceholder: string;
|
|
123
|
+
searchPlaceholder: string;
|
|
124
124
|
checkAll: string;
|
|
125
125
|
} | undefined;
|
|
126
126
|
InputPicker?: {
|
|
@@ -176,10 +176,10 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
|
176
176
|
saturday: string;
|
|
177
177
|
ok: string;
|
|
178
178
|
today: string;
|
|
179
|
-
yesterday: string;
|
|
179
|
+
yesterday: string;
|
|
180
180
|
hours: string;
|
|
181
181
|
minutes: string;
|
|
182
|
-
seconds: string;
|
|
182
|
+
seconds: string; /** Support right-to-left */
|
|
183
183
|
formattedMonthPattern: string;
|
|
184
184
|
formattedDayPattern: string;
|
|
185
185
|
dateLocale: any;
|
|
@@ -194,10 +194,10 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
|
194
194
|
saturday: string;
|
|
195
195
|
ok: string;
|
|
196
196
|
today: string;
|
|
197
|
-
yesterday: string;
|
|
197
|
+
yesterday: string;
|
|
198
198
|
hours: string;
|
|
199
199
|
minutes: string;
|
|
200
|
-
seconds: string;
|
|
200
|
+
seconds: string; /** Support right-to-left */
|
|
201
201
|
formattedMonthPattern: string;
|
|
202
202
|
formattedDayPattern: string;
|
|
203
203
|
dateLocale: any;
|
|
@@ -213,10 +213,10 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
|
213
213
|
saturday: string;
|
|
214
214
|
ok: string;
|
|
215
215
|
today: string;
|
|
216
|
-
yesterday: string;
|
|
216
|
+
yesterday: string;
|
|
217
217
|
hours: string;
|
|
218
218
|
minutes: string;
|
|
219
|
-
seconds: string;
|
|
219
|
+
seconds: string; /** Support right-to-left */
|
|
220
220
|
formattedMonthPattern: string;
|
|
221
221
|
formattedDayPattern: string;
|
|
222
222
|
dateLocale: any;
|
|
@@ -224,7 +224,7 @@ declare const Consumer: React.Consumer<CustomProviderProps<{
|
|
|
224
224
|
Picker?: {
|
|
225
225
|
noResultsText: string;
|
|
226
226
|
placeholder: string;
|
|
227
|
-
searchPlaceholder: string;
|
|
227
|
+
searchPlaceholder: string;
|
|
228
228
|
checkAll: string;
|
|
229
229
|
} | undefined;
|
|
230
230
|
InputPicker?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
4
|
import { getClassNamePrefix, prefix } from '../utils/prefix';
|
|
5
5
|
import { addClass, removeClass, canUseDOM } from '../DOMHelper';
|
|
6
6
|
var CustomContext = /*#__PURE__*/React.createContext({});
|
|
@@ -21,7 +21,7 @@ var CustomProvider = function CustomProvider(props) {
|
|
|
21
21
|
theme: theme
|
|
22
22
|
}, rest);
|
|
23
23
|
}, [classPrefix, theme, rest]);
|
|
24
|
-
|
|
24
|
+
useEffect(function () {
|
|
25
25
|
if (canUseDOM && theme) {
|
|
26
26
|
addClass(document.body, prefix(classPrefix, "theme-" + theme)); // Remove the className that will cause style conflicts
|
|
27
27
|
|
|
@@ -3,7 +3,7 @@ import { RangeType } from './Toolbar';
|
|
|
3
3
|
import { DatePickerLocale } from '../locales';
|
|
4
4
|
import { FormControlBaseProps, PickerBaseProps, RsRefForwardingComponent } from '../@types/common';
|
|
5
5
|
export type { RangeType } from './Toolbar';
|
|
6
|
-
export interface DatePickerProps extends PickerBaseProps<DatePickerLocale>, FormControlBaseProps<Date> {
|
|
6
|
+
export interface DatePickerProps extends PickerBaseProps<DatePickerLocale>, FormControlBaseProps<Date | null> {
|
|
7
7
|
/** Configure shortcut options */
|
|
8
8
|
ranges?: RangeType<Date>[];
|
|
9
9
|
/** Calendar panel default presentation date and time */
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import isNil from 'lodash/isNil';
|
|
6
5
|
import mapValues from 'lodash/mapValues';
|
|
7
6
|
import pick from 'lodash/pick';
|
|
8
7
|
import omit from 'lodash/omit';
|
|
@@ -166,11 +165,11 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
166
165
|
closeOverlay = true;
|
|
167
166
|
}
|
|
168
167
|
|
|
169
|
-
var nextValue =
|
|
168
|
+
var nextValue = typeof nextPageDate !== 'undefined' ? nextPageDate : calendarDate;
|
|
170
169
|
setCalendarDate(nextValue || new Date());
|
|
171
170
|
setValue(nextValue);
|
|
172
171
|
|
|
173
|
-
if (nextValue !== value
|
|
172
|
+
if (nextValue !== value) {
|
|
174
173
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue, event);
|
|
175
174
|
} // `closeOverlay` default value is `true`
|
|
176
175
|
|
|
@@ -129,8 +129,7 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
129
129
|
var classes = mergeItemClassNames(className, withItemClassPrefix({
|
|
130
130
|
disabled: disabled,
|
|
131
131
|
open: open,
|
|
132
|
-
submenu: true
|
|
133
|
-
|
|
132
|
+
submenu: true
|
|
134
133
|
}));
|
|
135
134
|
return /*#__PURE__*/React.createElement("li", _extends({
|
|
136
135
|
ref: mergeRefs(ref, containerRef),
|
|
@@ -139,13 +138,10 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
139
138
|
var open = _ref2.open,
|
|
140
139
|
buttonProps = _objectWithoutPropertiesLoose(_ref2, ["open"]);
|
|
141
140
|
|
|
142
|
-
var classes = mergeItemClassNames(className, prefixItemClassName(
|
|
143
|
-
withItemClassPrefix({
|
|
141
|
+
var classes = mergeItemClassNames(className, prefixItemClassName(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["toggle"]))), withItemClassPrefix({
|
|
144
142
|
'with-icon': icon,
|
|
145
143
|
open: open,
|
|
146
|
-
|
|
147
|
-
disabled: disabled // focus: active
|
|
148
|
-
|
|
144
|
+
disabled: disabled
|
|
149
145
|
}));
|
|
150
146
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
151
147
|
ref: mergeRefs(buttonRef, buttonRef),
|
|
@@ -182,8 +178,7 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
182
178
|
active = _ref5.active,
|
|
183
179
|
menuitem = _objectWithoutPropertiesLoose(_ref5, ["selected", "active"]);
|
|
184
180
|
|
|
185
|
-
var classes = mergeItemClassNames(className, prefixItemClassName(
|
|
186
|
-
withItemClassPrefix({
|
|
181
|
+
var classes = mergeItemClassNames(className, prefixItemClassName(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["toggle"]))), withItemClassPrefix({
|
|
187
182
|
'with-icon': icon,
|
|
188
183
|
open: open,
|
|
189
184
|
active: selected,
|
|
@@ -221,8 +216,7 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
221
216
|
var classes = mergeItemClassNames(className, withItemClassPrefix({
|
|
222
217
|
disabled: disabled,
|
|
223
218
|
open: open,
|
|
224
|
-
submenu: true
|
|
225
|
-
|
|
219
|
+
submenu: true
|
|
226
220
|
}));
|
|
227
221
|
return /*#__PURE__*/React.createElement("li", _extends({
|
|
228
222
|
ref: mergeRefs(ref, menuContainerRef),
|
package/esm/Modal/utils.js
CHANGED
|
@@ -45,20 +45,28 @@ export var useBodyStyles = function useBodyStyles(ref, options) {
|
|
|
45
45
|
|
|
46
46
|
(_windowResizeListener = windowResizeListener.current) === null || _windowResizeListener === void 0 ? void 0 : (_windowResizeListener2 = _windowResizeListener.off) === null || _windowResizeListener2 === void 0 ? void 0 : _windowResizeListener2.call(_windowResizeListener);
|
|
47
47
|
(_contentElementResize = contentElementResizeObserver.current) === null || _contentElementResize === void 0 ? void 0 : _contentElementResize.disconnect();
|
|
48
|
+
windowResizeListener.current = null;
|
|
49
|
+
contentElementResizeObserver.current = null;
|
|
48
50
|
}, []);
|
|
49
51
|
var onChangeBodyStyles = useCallback(function (entering) {
|
|
50
|
-
if (overflow && !drawer) {
|
|
52
|
+
if (overflow && !drawer && ref.current) {
|
|
51
53
|
updateBodyStyles(undefined, entering);
|
|
52
54
|
contentElement.current = ref.current.querySelector("." + prefix('content'));
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
55
|
+
|
|
56
|
+
if (!windowResizeListener.current) {
|
|
57
|
+
windowResizeListener.current = on(window, 'resize', updateBodyStyles);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (contentElement.current && !contentElementResizeObserver.current) {
|
|
61
|
+
contentElementResizeObserver.current = new ResizeObserver(function () {
|
|
62
|
+
return updateBodyStyles();
|
|
63
|
+
});
|
|
64
|
+
contentElementResizeObserver.current.observe(contentElement.current);
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
}, [drawer, overflow, prefix, ref, updateBodyStyles]);
|
|
60
68
|
useEffect(function () {
|
|
61
|
-
onDestroyEvents
|
|
62
|
-
}, [
|
|
69
|
+
return onDestroyEvents; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
70
|
+
}, []);
|
|
63
71
|
return [overflow ? bodyStyles : {}, onChangeBodyStyles, onDestroyEvents];
|
|
64
72
|
};
|
|
@@ -196,8 +196,11 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
196
196
|
children.then(function (data) {
|
|
197
197
|
node.loading = false;
|
|
198
198
|
node[childrenKey] = data;
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
|
|
200
|
+
if (targetRef.current) {
|
|
201
|
+
addFlattenData(data, node);
|
|
202
|
+
addColumn(data, cascadePaths.length);
|
|
203
|
+
}
|
|
201
204
|
});
|
|
202
205
|
} else {
|
|
203
206
|
node.loading = false;
|
|
@@ -234,7 +237,7 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
234
237
|
onCheck === null || onCheck === void 0 ? void 0 : onCheck(nextValue, node, checked, event);
|
|
235
238
|
}, [cascade, onChange, onCheck, setValue, splitValue, value, valueKey]);
|
|
236
239
|
var handleClean = useCallback(function (event) {
|
|
237
|
-
if (disabled) {
|
|
240
|
+
if (disabled || !targetRef.current) {
|
|
238
241
|
return;
|
|
239
242
|
}
|
|
240
243
|
|
package/esm/Nav/NavItem.js
CHANGED
|
@@ -83,7 +83,9 @@ var NavItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
if (navbar) {
|
|
86
|
-
return /*#__PURE__*/React.createElement(NavbarItem,
|
|
86
|
+
return /*#__PURE__*/React.createElement(NavbarItem, _extends({
|
|
87
|
+
ref: ref
|
|
88
|
+
}, props));
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
@@ -99,6 +99,11 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
99
99
|
|
|
100
100
|
useEffect(function () {
|
|
101
101
|
var container = menuBodyContainerRef.current;
|
|
102
|
+
|
|
103
|
+
if (!container) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
102
107
|
var activeItem = container.querySelector("." + prefix('item-focus'));
|
|
103
108
|
|
|
104
109
|
if (!activeItem) {
|
|
@@ -90,11 +90,9 @@ var PickerToggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
90
90
|
}
|
|
91
91
|
}, [input, onFocus]);
|
|
92
92
|
var handleBlur = useCallback(function (event) {
|
|
93
|
-
if (document.activeElement !== inputRef.current) {
|
|
94
|
-
var _inputRef$current2;
|
|
95
|
-
|
|
93
|
+
if (inputRef.current && document.activeElement !== inputRef.current) {
|
|
96
94
|
setActive(false);
|
|
97
|
-
|
|
95
|
+
inputRef.current.blur();
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
@@ -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]);
|
|
@@ -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.4.
|
|
3
|
+
"version": "5.4.4",
|
|
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.1",
|
|
41
41
|
"schema-typed": "^2.0.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|