rsuite 5.23.3 → 5.24.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/CHANGELOG.md +12 -0
- package/Sidenav/styles/index.less +7 -2
- package/cjs/AutoComplete/AutoComplete.d.ts +2 -0
- package/cjs/AutoComplete/AutoComplete.js +4 -1
- package/cjs/Calendar/MonthDropdown.d.ts +1 -0
- package/cjs/Calendar/MonthDropdown.js +14 -10
- package/cjs/DatePicker/DatePicker.d.ts +5 -1
- package/cjs/DatePicker/DatePicker.js +17 -1
- package/cjs/Dropdown/Dropdown.d.ts +2 -0
- package/cjs/Dropdown/Dropdown.js +3 -0
- package/cjs/Dropdown/DropdownItem.d.ts +5 -1
- package/cjs/Dropdown/DropdownItem.js +7 -7
- package/cjs/Dropdown/DropdownSeparator.d.ts +14 -0
- package/cjs/Dropdown/DropdownSeparator.js +48 -0
- package/cjs/Sidenav/ExpandedSidenavDropdownMenu.js +3 -2
- package/cjs/utils/deprecatePropType.d.ts +9 -0
- package/cjs/utils/deprecatePropType.js +27 -0
- package/dist/rsuite-rtl.css +5 -3
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +5 -3
- package/dist/rsuite.js +18 -7
- 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/AutoComplete/AutoComplete.d.ts +2 -0
- package/esm/AutoComplete/AutoComplete.js +4 -1
- package/esm/Calendar/MonthDropdown.d.ts +1 -0
- package/esm/Calendar/MonthDropdown.js +12 -9
- package/esm/DatePicker/DatePicker.d.ts +5 -1
- package/esm/DatePicker/DatePicker.js +16 -1
- package/esm/Dropdown/Dropdown.d.ts +2 -0
- package/esm/Dropdown/Dropdown.js +2 -0
- package/esm/Dropdown/DropdownItem.d.ts +5 -1
- package/esm/Dropdown/DropdownItem.js +5 -7
- package/esm/Dropdown/DropdownSeparator.d.ts +14 -0
- package/esm/Dropdown/DropdownSeparator.js +35 -0
- package/esm/Sidenav/ExpandedSidenavDropdownMenu.js +3 -2
- package/esm/utils/deprecatePropType.d.ts +9 -0
- package/esm/utils/deprecatePropType.js +25 -0
- package/package.json +1 -1
|
@@ -9,6 +9,8 @@ export interface AutoCompleteProps<T = ValueType> extends WithAsProps, FormContr
|
|
|
9
9
|
placement?: TypeAttributes.Placement;
|
|
10
10
|
/** When set to false, the Enter key selection function is invalid */
|
|
11
11
|
selectOnEnter?: boolean;
|
|
12
|
+
/** A component can have different sizes */
|
|
13
|
+
size?: TypeAttributes.Size;
|
|
12
14
|
/** Open the menu and control it */
|
|
13
15
|
open?: boolean;
|
|
14
16
|
/** Placeholder text */
|
|
@@ -33,6 +33,7 @@ var AutoComplete = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
33
33
|
valueProp = props.value,
|
|
34
34
|
open = props.open,
|
|
35
35
|
style = props.style,
|
|
36
|
+
size = props.size,
|
|
36
37
|
menuClassName = props.menuClassName,
|
|
37
38
|
id = props.id,
|
|
38
39
|
renderMenu = props.renderMenu,
|
|
@@ -46,7 +47,7 @@ var AutoComplete = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
46
47
|
onFocus = props.onFocus,
|
|
47
48
|
onBlur = props.onBlur,
|
|
48
49
|
onMenuFocus = props.onMenuFocus,
|
|
49
|
-
rest = _objectWithoutPropertiesLoose(props, ["as", "disabled", "className", "placement", "selectOnEnter", "classPrefix", "defaultValue", "menuAutoWidth", "data", "value", "open", "style", "menuClassName", "id", "renderMenu", "renderMenuItem", "onSelect", "filterBy", "onKeyDown", "onChange", "onClose", "onOpen", "onFocus", "onBlur", "onMenuFocus"]);
|
|
50
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "disabled", "className", "placement", "selectOnEnter", "classPrefix", "defaultValue", "menuAutoWidth", "data", "value", "open", "style", "size", "menuClassName", "id", "renderMenu", "renderMenuItem", "onSelect", "filterBy", "onKeyDown", "onChange", "onClose", "onOpen", "onFocus", "onBlur", "onMenuFocus"]);
|
|
50
51
|
|
|
51
52
|
var datalist = transformData(data);
|
|
52
53
|
|
|
@@ -211,6 +212,7 @@ var AutoComplete = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
211
212
|
id: id,
|
|
212
213
|
disabled: disabled,
|
|
213
214
|
value: value,
|
|
215
|
+
size: size,
|
|
214
216
|
onBlur: handleInputBlur,
|
|
215
217
|
onFocus: handleInputFocus,
|
|
216
218
|
onChange: handleChange,
|
|
@@ -239,6 +241,7 @@ AutoComplete.propTypes = _extends({}, animationPropTypes, {
|
|
|
239
241
|
renderMenu: PropTypes.func,
|
|
240
242
|
renderMenuItem: PropTypes.func,
|
|
241
243
|
style: PropTypes.object,
|
|
244
|
+
size: PropTypes.oneOf(['lg', 'md', 'sm', 'xs']),
|
|
242
245
|
open: PropTypes.bool,
|
|
243
246
|
selectOnEnter: PropTypes.bool,
|
|
244
247
|
filterBy: PropTypes.func
|
|
@@ -22,5 +22,6 @@ export interface RowProps {
|
|
|
22
22
|
/** Style object to be applied to row (to position it); */
|
|
23
23
|
style?: React.CSSProperties;
|
|
24
24
|
}
|
|
25
|
+
export declare function isEveryDateInMonth(year: number, month: number, predicate: (date: Date) => boolean): boolean;
|
|
25
26
|
declare const MonthDropdown: RsRefForwardingComponent<'div', MonthDropdownProps>;
|
|
26
27
|
export default MonthDropdown;
|
|
@@ -7,6 +7,17 @@ import { DateUtils, useClassNames } from '../utils';
|
|
|
7
7
|
import MonthDropdownItem from './MonthDropdownItem';
|
|
8
8
|
import { useCalendarContext } from './CalendarContext';
|
|
9
9
|
var monthMap = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
10
|
+
export function isEveryDateInMonth(year, month, predicate) {
|
|
11
|
+
var days = DateUtils.getDaysInMonth(new Date(year, month));
|
|
12
|
+
|
|
13
|
+
for (var i = 1; i <= days; i++) {
|
|
14
|
+
if (!predicate(new Date(year, month, i))) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
10
21
|
var MonthDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
11
22
|
var _props$as = props.as,
|
|
12
23
|
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
@@ -41,15 +52,7 @@ var MonthDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
41
52
|
}, [limitEndYear, startYear, thisYear]);
|
|
42
53
|
var isMonthDisabled = useCallback(function (year, month) {
|
|
43
54
|
if (disabledMonth) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
for (var i = 1; i <= days; i++) {
|
|
47
|
-
if (!disabledMonth(new Date(year, month, i))) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return true;
|
|
55
|
+
return isEveryDateInMonth(year, month, disabledMonth);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
return false;
|
|
@@ -29,7 +29,11 @@ export interface DatePickerProps extends PickerBaseProps<DatePickerLocale>, Form
|
|
|
29
29
|
showMeridian?: boolean;
|
|
30
30
|
/** one tap to select */
|
|
31
31
|
oneTap?: boolean;
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Whether to disable a date on the calendar view
|
|
34
|
+
*
|
|
35
|
+
* @returns date should be disabled (not selectable)
|
|
36
|
+
*/
|
|
33
37
|
disabledDate?: (date?: Date) => boolean;
|
|
34
38
|
/** Disabled hours */
|
|
35
39
|
disabledHours?: (hour: number, date: Date) => boolean;
|
|
@@ -9,6 +9,7 @@ import IconCalendar from '@rsuite/icons/legacy/Calendar';
|
|
|
9
9
|
import IconClockO from '@rsuite/icons/legacy/ClockO';
|
|
10
10
|
import CalendarContainer from '../Calendar/CalendarContainer';
|
|
11
11
|
import useCalendarDate from '../Calendar/useCalendarDate';
|
|
12
|
+
import { isEveryDateInMonth } from '../Calendar/MonthDropdown';
|
|
12
13
|
import Toolbar from './Toolbar';
|
|
13
14
|
import Stack from '../Stack';
|
|
14
15
|
import PredefinedRanges from './PredefinedRanges';
|
|
@@ -305,6 +306,20 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
305
306
|
var allowTime = DateUtils.disabledTime(props, date);
|
|
306
307
|
return allowDate || allowTime;
|
|
307
308
|
}, [disabledDateProp, props]);
|
|
309
|
+
/**
|
|
310
|
+
* Whether "OK" button is disabled
|
|
311
|
+
*
|
|
312
|
+
* - If format is date, disable ok button if selected date is disabled
|
|
313
|
+
* - If format is month, disable ok button if all dates in the month of selected date are disabled
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
var isOKButtonDisabled = useCallback(function (selectedDate) {
|
|
317
|
+
if (DateUtils.shouldRenderMonth(formatStr) && !DateUtils.shouldRenderDate(formatStr)) {
|
|
318
|
+
return isEveryDateInMonth(selectedDate.getFullYear(), selectedDate.getMonth(), disabledToolbarHandle);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return disabledToolbarHandle(selectedDate);
|
|
322
|
+
}, [disabledToolbarHandle, formatStr]);
|
|
308
323
|
var calendarProps = useMemo(function () {
|
|
309
324
|
return mapValues(pick(props, DateUtils.calendarOnlyProps), function (disabledOrHiddenTimeFunc) {
|
|
310
325
|
return function (next, date) {
|
|
@@ -373,7 +388,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
373
388
|
locale: locale,
|
|
374
389
|
ranges: bottomRanges,
|
|
375
390
|
calendarDate: calendarDate,
|
|
376
|
-
disabledOkBtn:
|
|
391
|
+
disabledOkBtn: isOKButtonDisabled,
|
|
377
392
|
disabledShortcut: disabledToolbarHandle,
|
|
378
393
|
onClickShortcut: handleShortcutPageDate,
|
|
379
394
|
onOk: handleOK,
|
|
@@ -4,6 +4,7 @@ import { TypeAttributes, WithAsProps, RsRefForwardingComponent } from '../@types
|
|
|
4
4
|
import { IconProps } from '@rsuite/icons/lib/Icon';
|
|
5
5
|
import DropdownItem from './DropdownItem';
|
|
6
6
|
import Button from '../Button';
|
|
7
|
+
import DropdownSeparator from './DropdownSeparator';
|
|
7
8
|
export declare type DropdownTrigger = 'click' | 'hover' | 'contextMenu';
|
|
8
9
|
export interface DropdownProps<T = any> extends WithAsProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect' | 'title'> {
|
|
9
10
|
/** Define the title as a submenu */
|
|
@@ -58,6 +59,7 @@ export interface DropdownComponent extends RsRefForwardingComponent<'div', Dropd
|
|
|
58
59
|
} & React.ComponentProps<ToggleAs>, context: any): JSX.Element | null;
|
|
59
60
|
Item: typeof DropdownItem;
|
|
60
61
|
Menu: typeof DropdownMenu;
|
|
62
|
+
Separator: typeof DropdownSeparator;
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
63
65
|
* The <Dropdown> API
|
package/esm/Dropdown/Dropdown.js
CHANGED
|
@@ -16,6 +16,7 @@ import NavContext from '../Nav/NavContext';
|
|
|
16
16
|
import { initialState, reducer } from './DropdownState';
|
|
17
17
|
import warnOnce from '../utils/warnOnce';
|
|
18
18
|
import Nav from '../Nav';
|
|
19
|
+
import DropdownSeparator from './DropdownSeparator';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* The <Dropdown> API
|
|
@@ -163,6 +164,7 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
163
164
|
});
|
|
164
165
|
Dropdown.Item = DropdownItem;
|
|
165
166
|
Dropdown.Menu = DropdownMenu;
|
|
167
|
+
Dropdown.Separator = DropdownSeparator;
|
|
166
168
|
Dropdown.displayName = 'Dropdown';
|
|
167
169
|
Dropdown.propTypes = {
|
|
168
170
|
activeKey: PropTypes.any,
|
|
@@ -8,7 +8,11 @@ export interface DropdownMenuItemProps<T = any> extends WithAsProps, Omit<React.
|
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
/** You can use a custom element for this component */
|
|
10
10
|
as?: React.ElementType;
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Whether to display the divider
|
|
13
|
+
*
|
|
14
|
+
* @deprecated Use dedicated <Dropdown.Separator> component instead
|
|
15
|
+
*/
|
|
12
16
|
divider?: boolean;
|
|
13
17
|
/** Disable the current option */
|
|
14
18
|
disabled?: boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
import _pick from "lodash/pick";
|
|
3
4
|
import React, { useCallback, useContext, useEffect } from 'react';
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
|
-
import deprecatePropType from '../utils/deprecatePropType';
|
|
6
|
+
import deprecatePropType, { deprecatePropTypeNew } from '../utils/deprecatePropType';
|
|
6
7
|
import MenuItem from '../Menu/MenuItem';
|
|
7
8
|
import DropdownContext from './DropdownContext';
|
|
8
9
|
import isNil from 'lodash/isNil';
|
|
@@ -13,6 +14,7 @@ import { DropdownActionType } from './DropdownState';
|
|
|
13
14
|
import { useRenderDropdownItem } from './useRenderDropdownItem';
|
|
14
15
|
import warnOnce from '../utils/warnOnce';
|
|
15
16
|
import Nav from '../Nav';
|
|
17
|
+
import DropdownSeparator from './DropdownSeparator';
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* The <Dropdown.Item> API
|
|
@@ -84,11 +86,7 @@ var DropdownItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
if (divider) {
|
|
87
|
-
return
|
|
88
|
-
ref: ref,
|
|
89
|
-
role: 'separator',
|
|
90
|
-
className: merge(prefix('divider'), className)
|
|
91
|
-
}, restProps));
|
|
89
|
+
return /*#__PURE__*/React.createElement(DropdownSeparator, _pick(props, ['data-testid']));
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
if (panel) {
|
|
@@ -137,7 +135,7 @@ var DropdownItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
137
135
|
DropdownItem.displayName = 'Dropdown.Item';
|
|
138
136
|
DropdownItem.propTypes = {
|
|
139
137
|
as: PropTypes.elementType,
|
|
140
|
-
divider: PropTypes.bool,
|
|
138
|
+
divider: deprecatePropTypeNew(PropTypes.bool, 'Use Dropdown.Separator component instead.'),
|
|
141
139
|
panel: PropTypes.bool,
|
|
142
140
|
trigger: PropTypes.oneOfType([PropTypes.array, PropTypes.oneOf(['click', 'hover'])]),
|
|
143
141
|
open: deprecatePropType(PropTypes.bool),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RsRefForwardingComponent, WithAsProps } from '../@types/common';
|
|
3
|
+
export interface DropdownSeparatorProps extends WithAsProps, React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
/** You can use a custom element for this component */
|
|
5
|
+
as?: React.ElementType;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The <Dropdown.Separator> API
|
|
9
|
+
*
|
|
10
|
+
* Renders a non-focusable and non-interactive `separator`
|
|
11
|
+
* Per ARIA APG https://www.w3.org/WAI/ARIA/apg/patterns/menu/
|
|
12
|
+
*/
|
|
13
|
+
declare const DropdownSeparator: RsRefForwardingComponent<'li', DropdownSeparatorProps>;
|
|
14
|
+
export default DropdownSeparator;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useClassNames } from '../utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The <Dropdown.Separator> API
|
|
9
|
+
*
|
|
10
|
+
* Renders a non-focusable and non-interactive `separator`
|
|
11
|
+
* Per ARIA APG https://www.w3.org/WAI/ARIA/apg/patterns/menu/
|
|
12
|
+
*/
|
|
13
|
+
var DropdownSeparator = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
14
|
+
var _props$classPrefix = props.classPrefix,
|
|
15
|
+
classPrefix = _props$classPrefix === void 0 ? 'dropdown-item-divider' : _props$classPrefix,
|
|
16
|
+
className = props.className,
|
|
17
|
+
_props$as = props.as,
|
|
18
|
+
Component = _props$as === void 0 ? 'li' : _props$as,
|
|
19
|
+
restProps = _objectWithoutPropertiesLoose(props, ["classPrefix", "className", "as"]);
|
|
20
|
+
|
|
21
|
+
var _useClassNames = useClassNames(classPrefix),
|
|
22
|
+
merge = _useClassNames.merge,
|
|
23
|
+
withClassPrefix = _useClassNames.withClassPrefix;
|
|
24
|
+
|
|
25
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
26
|
+
ref: ref,
|
|
27
|
+
role: "separator",
|
|
28
|
+
className: merge(withClassPrefix(), className)
|
|
29
|
+
}, restProps));
|
|
30
|
+
});
|
|
31
|
+
DropdownSeparator.displayName = 'Dropdown.Separator';
|
|
32
|
+
DropdownSeparator.propTypes = {
|
|
33
|
+
as: PropTypes.elementType
|
|
34
|
+
};
|
|
35
|
+
export default DropdownSeparator;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTemplateLiteralLoose";
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
|
|
5
|
-
var _templateObject
|
|
5
|
+
var _templateObject;
|
|
6
6
|
|
|
7
7
|
import React, { useCallback, useContext } from 'react';
|
|
8
8
|
import isNil from 'lodash/isNil';
|
|
@@ -77,6 +77,7 @@ var ExpandedSidenavDropdownMenu = /*#__PURE__*/React.forwardRef(function (props,
|
|
|
77
77
|
// open,
|
|
78
78
|
disabled: disabled
|
|
79
79
|
}));
|
|
80
|
+
var iconClasses = merge(className, prefix('toggle-icon'), prefix((open ? 'expand' : 'collapse') + "-icon"));
|
|
80
81
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
81
82
|
ref: ref
|
|
82
83
|
}, rest, {
|
|
@@ -90,7 +91,7 @@ var ExpandedSidenavDropdownMenu = /*#__PURE__*/React.forwardRef(function (props,
|
|
|
90
91
|
}, omit(buttonProps, ['open'])), icon && /*#__PURE__*/React.cloneElement(icon, {
|
|
91
92
|
className: prefix('menu-icon')
|
|
92
93
|
}), title, /*#__PURE__*/React.createElement(Icon, {
|
|
93
|
-
className:
|
|
94
|
+
className: iconClasses
|
|
94
95
|
}), /*#__PURE__*/React.createElement(Ripple, null));
|
|
95
96
|
}), /*#__PURE__*/React.createElement(Disclosure.Content, null, function (_ref2) {
|
|
96
97
|
var open = _ref2.open;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import * as PropTypes from 'prop-types';
|
|
2
|
+
/**
|
|
3
|
+
* Prints deprecation message when user uses a deprecated prop
|
|
4
|
+
*
|
|
5
|
+
* @deprecated Use {@link deprecatePropTypeNew} which prints clearer messages.
|
|
6
|
+
*/
|
|
2
7
|
export default function deprecatePropType<T extends PropTypes.Validator<any>>(propType: T, explanation?: string): typeof propType;
|
|
8
|
+
/**
|
|
9
|
+
* Prints deprecation message when user uses a deprecated prop
|
|
10
|
+
*/
|
|
11
|
+
export declare function deprecatePropTypeNew<T extends PropTypes.Validator<any>>(propType: T, explanation?: string): typeof propType;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// Ref: https://github.com/thefrontside/deprecated-prop-type/blob/master/deprecated.js
|
|
2
2
|
import warnOnce from './warnOnce';
|
|
3
|
+
/**
|
|
4
|
+
* Prints deprecation message when user uses a deprecated prop
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Use {@link deprecatePropTypeNew} which prints clearer messages.
|
|
7
|
+
*/
|
|
8
|
+
|
|
3
9
|
export default function deprecatePropType(propType, explanation) {
|
|
4
10
|
return function validate(props, propName, componentName) {
|
|
5
11
|
// Note ...rest here
|
|
@@ -12,6 +18,25 @@ export default function deprecatePropType(propType, explanation) {
|
|
|
12
18
|
rest[_key - 3] = arguments[_key];
|
|
13
19
|
}
|
|
14
20
|
|
|
21
|
+
return propType.apply(void 0, [props, propName, componentName].concat(rest)); // and here
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Prints deprecation message when user uses a deprecated prop
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
export function deprecatePropTypeNew(propType, explanation) {
|
|
29
|
+
return function validate(props, propName, componentName) {
|
|
30
|
+
// Note ...rest here
|
|
31
|
+
if (props[propName] != null) {
|
|
32
|
+
var message = "[rsuite] \"" + propName + "\" property of " + componentName + " component has been deprecated.\n" + explanation;
|
|
33
|
+
warnOnce(message);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
for (var _len2 = arguments.length, rest = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
|
37
|
+
rest[_key2 - 3] = arguments[_key2];
|
|
38
|
+
}
|
|
39
|
+
|
|
15
40
|
return propType.apply(void 0, [props, propName, componentName].concat(rest)); // and here
|
|
16
41
|
};
|
|
17
42
|
}
|