rsuite 5.76.3 → 5.77.1
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 +27 -0
- package/Dropdown/styles/index.css +0 -1
- package/Dropdown/styles/index.less +0 -1
- package/Nav/styles/index.css +0 -1
- package/Navbar/styles/index.css +0 -1
- package/Tabs/styles/index.css +0 -1
- package/cjs/DatePicker/DatePicker.js +2 -1
- package/cjs/DatePicker/types.d.ts +2 -2
- package/cjs/DateRangePicker/DateRangePicker.d.ts +6 -0
- package/cjs/DateRangePicker/DateRangePicker.js +9 -3
- package/cjs/DateRangePicker/types.d.ts +3 -8
- package/cjs/FormControl/utils.d.ts +8 -0
- package/cjs/FormControl/utils.js +44 -1
- package/cjs/InputPicker/InputPicker.js +7 -1
- package/cjs/internals/Menu/Menubar.js +4 -1
- package/dist/rsuite-no-reset-rtl.css +0 -1
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +0 -1
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +0 -1
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +0 -1
- package/dist/rsuite.js +10 -64
- 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.LICENSE.txt +0 -35
- package/dist/rsuite.min.js.map +1 -1
- package/esm/DatePicker/DatePicker.js +2 -1
- package/esm/DatePicker/types.d.ts +2 -2
- package/esm/DateRangePicker/DateRangePicker.d.ts +6 -0
- package/esm/DateRangePicker/DateRangePicker.js +9 -3
- package/esm/DateRangePicker/types.d.ts +3 -8
- package/esm/FormControl/utils.d.ts +8 -0
- package/esm/FormControl/utils.js +44 -1
- package/esm/InputPicker/InputPicker.js +7 -1
- package/esm/internals/Menu/Menubar.js +4 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
## [5.77.1](https://github.com/rsuite/rsuite/compare/v5.77.0...v5.77.1) (2025-02-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **DateRangePicker:** allow ranges option value to be null ([#4141](https://github.com/rsuite/rsuite/issues/4141)) ([32017c4](https://github.com/rsuite/rsuite/commit/32017c4429d15e9d3ca881b0e59e9d63bb89427a))
|
|
7
|
+
* **Dropdown:** prevent focus moving to first item when focusing on disabled item ([#4142](https://github.com/rsuite/rsuite/issues/4142)) ([caa4a9a](https://github.com/rsuite/rsuite/commit/caa4a9adad08f69fb09f226a99c17a6becb58041))
|
|
8
|
+
* **Form:** validation for nested array fields ([#4139](https://github.com/rsuite/rsuite/issues/4139)) ([dbf15cb](https://github.com/rsuite/rsuite/commit/dbf15cb5232c25d54c691411884c2aad0583bedd))
|
|
9
|
+
* prevent duplicate className in DatePicker and DateRangePicker components ([#4140](https://github.com/rsuite/rsuite/issues/4140)) ([fa3f40d](https://github.com/rsuite/rsuite/commit/fa3f40d30752a4af5a6d463c65d1df70adf9a74a))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# [5.77.0](https://github.com/rsuite/rsuite/compare/v5.76.3...v5.77.0) (2025-01-21)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **Form:** support deeply nested object validation ([#4125](https://github.com/rsuite/rsuite/issues/4125)) ([2de3f90](https://github.com/rsuite/rsuite/commit/2de3f901970d982ac4a0a2329fd4e6af83962804))
|
|
19
|
+
* **InputPicker:** do not trigger clean when clicking delete with search keyword ([#4124](https://github.com/rsuite/rsuite/issues/4124)) ([98a0019](https://github.com/rsuite/rsuite/commit/98a001908df884c8cd5a87959a9b9608d6bba37c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* **DateRangePicker:** support custom render calendar cell content ([#4126](https://github.com/rsuite/rsuite/issues/4126)) ([74171d1](https://github.com/rsuite/rsuite/commit/74171d17f36aa611009e0048c1f490b6ac31fcea))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
1
28
|
## [5.76.3](https://github.com/rsuite/rsuite/compare/v5.76.2...v5.76.3) (2025-01-10)
|
|
2
29
|
|
|
3
30
|
|
package/Nav/styles/index.css
CHANGED
package/Navbar/styles/index.css
CHANGED
package/Tabs/styles/index.css
CHANGED
|
@@ -436,6 +436,7 @@ var DatePicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
436
436
|
};
|
|
437
437
|
var hasValue = (0, _date.isValid)(value);
|
|
438
438
|
var _usePickerClassName = (0, _Picker.usePickerClassName)((0, _extends2.default)({}, props, {
|
|
439
|
+
className: className,
|
|
439
440
|
classPrefix: classPrefix,
|
|
440
441
|
name: 'date',
|
|
441
442
|
appearance: appearance,
|
|
@@ -491,7 +492,7 @@ var DatePicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
491
492
|
onExit: (0, _utils2.createChainedFunction)(events.onInactive, onExit),
|
|
492
493
|
speaker: renderCalendarOverlay
|
|
493
494
|
}, /*#__PURE__*/_react.default.createElement(Component, {
|
|
494
|
-
className: merge(
|
|
495
|
+
className: merge(classes, (_merge = {}, _merge[prefix('error')] = invalidValue, _merge)),
|
|
495
496
|
style: style,
|
|
496
497
|
ref: root
|
|
497
498
|
}, plaintext ? /*#__PURE__*/_react.default.createElement(_DateInput.default, {
|
|
@@ -3,11 +3,11 @@ export type ToolbarValue = Date | [Date?, Date?];
|
|
|
3
3
|
export interface RangeType<T> {
|
|
4
4
|
label: ReactNode;
|
|
5
5
|
closeOverlay?: boolean;
|
|
6
|
-
value: T | ((value: T) => T);
|
|
6
|
+
value: T | ((value: T) => T) | null;
|
|
7
7
|
placement?: 'bottom' | 'left';
|
|
8
8
|
}
|
|
9
9
|
export interface InnerRange<T> extends Omit<RangeType<T>, 'value'> {
|
|
10
|
-
value: T;
|
|
10
|
+
value: T | null;
|
|
11
11
|
}
|
|
12
12
|
export interface DeprecatedProps {
|
|
13
13
|
/**
|
|
@@ -159,6 +159,12 @@ export interface DateRangePickerProps extends PickerBaseProps<DateRangePickerLoc
|
|
|
159
159
|
* Custom render for calendar title
|
|
160
160
|
*/
|
|
161
161
|
renderTitle?: (date: Date) => React.ReactNode;
|
|
162
|
+
/**
|
|
163
|
+
* Custom rendering calendar cell content.
|
|
164
|
+
*
|
|
165
|
+
* @version 5.77.0
|
|
166
|
+
*/
|
|
167
|
+
renderCell?: (date: Date) => React.ReactNode;
|
|
162
168
|
}
|
|
163
169
|
export interface DateRangePickerComponent extends PickerComponent<DateRangePickerProps> {
|
|
164
170
|
/** Allow the maximum number of days specified, other dates are disabled */
|
|
@@ -33,7 +33,7 @@ var _utils2 = require("../internals/utils");
|
|
|
33
33
|
var _date = require("../internals/utils/date");
|
|
34
34
|
var _CustomProvider = require("../CustomProvider");
|
|
35
35
|
var _templateObject, _templateObject2;
|
|
36
|
-
var _excluded = ["as", "classPrefix", "className", "appearance", "editable", "cleanable", "character", "calendarSnapping", "defaultCalendarValue", "defaultValue", "plaintext", "disabled", "disabledDate", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "format", "hoverRange", "id", "isoWeek", "weekStart", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "readOnly", "showOneCalendar", "showWeekNumbers", "showMeridian", "showMeridiem", "showHeader", "style", "size", "caretAs", "value", "monthDropdownProps", "hideHours", "hideMinutes", "hideSeconds", "onChange", "onClean", "onEnter", "onExit", "onOk", "onSelect", "onShortcutClick", "renderTitle", "renderValue"];
|
|
36
|
+
var _excluded = ["as", "classPrefix", "className", "appearance", "editable", "cleanable", "character", "calendarSnapping", "defaultCalendarValue", "defaultValue", "plaintext", "disabled", "disabledDate", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "format", "hoverRange", "id", "isoWeek", "weekStart", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "readOnly", "showOneCalendar", "showWeekNumbers", "showMeridian", "showMeridiem", "showHeader", "style", "size", "caretAs", "value", "monthDropdownProps", "hideHours", "hideMinutes", "hideSeconds", "onChange", "onClean", "onEnter", "onExit", "onOk", "onSelect", "onShortcutClick", "renderTitle", "renderValue", "renderCell"];
|
|
37
37
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
38
38
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
39
39
|
/**
|
|
@@ -116,6 +116,7 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
116
116
|
onShortcutClick = propsWithDefaults.onShortcutClick,
|
|
117
117
|
renderTitle = propsWithDefaults.renderTitle,
|
|
118
118
|
renderValue = propsWithDefaults.renderValue,
|
|
119
|
+
renderCell = propsWithDefaults.renderCell,
|
|
119
120
|
restProps = (0, _objectWithoutPropertiesLoose2.default)(propsWithDefaults, _excluded);
|
|
120
121
|
var id = (0, _hooks.useUniqueId)('rs-', idProp);
|
|
121
122
|
var _usePickerRef = (0, _Picker.usePickerRef)(ref),
|
|
@@ -591,6 +592,9 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
591
592
|
if (selectedDates === void 0) {
|
|
592
593
|
selectedDates = [];
|
|
593
594
|
}
|
|
595
|
+
if (selectedDates === null) {
|
|
596
|
+
return false;
|
|
597
|
+
}
|
|
594
598
|
var _selectedDates = selectedDates,
|
|
595
599
|
startDate = _selectedDates[0],
|
|
596
600
|
endDate = _selectedDates[1];
|
|
@@ -673,7 +677,8 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
673
677
|
onChangeCalendarMonth: onChangeCalendarMonth,
|
|
674
678
|
onChangeCalendarTime: onChangeCalendarTime,
|
|
675
679
|
onMouseMove: onMouseMove,
|
|
676
|
-
renderTitle: renderTitle
|
|
680
|
+
renderTitle: renderTitle,
|
|
681
|
+
renderCellOnPicker: renderCell
|
|
677
682
|
};
|
|
678
683
|
var getCalendars = function getCalendars() {
|
|
679
684
|
if (showOneCalendar) {
|
|
@@ -745,6 +750,7 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
745
750
|
var hasValue = !(0, _isNil.default)(value) && value.length > 1;
|
|
746
751
|
var _usePickerClassName = (0, _Picker.usePickerClassName)((0, _extends2.default)({}, props, {
|
|
747
752
|
classPrefix: classPrefix,
|
|
753
|
+
className: className,
|
|
748
754
|
name: 'daterange',
|
|
749
755
|
appearance: appearance,
|
|
750
756
|
hasValue: hasValue,
|
|
@@ -816,7 +822,7 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
816
822
|
speaker: renderCalendarOverlay
|
|
817
823
|
}, /*#__PURE__*/_react.default.createElement(Component, {
|
|
818
824
|
ref: root,
|
|
819
|
-
className: merge(
|
|
825
|
+
className: merge(classes, (_merge = {}, _merge[prefix('error')] = invalidValue, _merge)),
|
|
820
826
|
style: style
|
|
821
827
|
}, plaintext ? /*#__PURE__*/_react.default.createElement(_DateRangeInput.default, {
|
|
822
828
|
value: value,
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { DATERANGE_DISABLED_TARGET } from '../internals/constants';
|
|
3
|
-
|
|
2
|
+
import type { RangeType as DatePickerRangeType } from '../DatePicker/types';
|
|
3
|
+
export type ValueType = [Date?, Date?] | null;
|
|
4
4
|
export type DateRange = [Date, Date];
|
|
5
|
-
export
|
|
6
|
-
label: React.ReactNode;
|
|
7
|
-
value: T | ((value?: T) => T);
|
|
8
|
-
closeOverlay?: boolean;
|
|
9
|
-
placement?: 'bottom' | 'left';
|
|
10
|
-
}
|
|
5
|
+
export type RangeType<T = DateRange> = DatePickerRangeType<T>;
|
|
11
6
|
export type DisabledDateFunction = (
|
|
12
7
|
/**
|
|
13
8
|
* Date used to determine if disabling is required.
|
|
@@ -1 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a field name to a path that can be used in a nested object.
|
|
3
|
+
* @example
|
|
4
|
+
* nameToPath('a.b.c') // 'a.object.b.object.c'
|
|
5
|
+
* nameToPath('items[0].name') // 'items.array[0].object.name'
|
|
6
|
+
* @param name the field name to convert
|
|
7
|
+
* @returns the converted path
|
|
8
|
+
*/
|
|
1
9
|
export declare function nameToPath(name: string): string;
|
package/cjs/FormControl/utils.js
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.nameToPath = nameToPath;
|
|
6
|
+
/**
|
|
7
|
+
* Converts a field name to a path that can be used in a nested object.
|
|
8
|
+
* @example
|
|
9
|
+
* nameToPath('a.b.c') // 'a.object.b.object.c'
|
|
10
|
+
* nameToPath('items[0].name') // 'items.array[0].object.name'
|
|
11
|
+
* @param name the field name to convert
|
|
12
|
+
* @returns the converted path
|
|
13
|
+
*/
|
|
6
14
|
function nameToPath(name) {
|
|
7
|
-
|
|
15
|
+
if (!name.includes('.') && !name.includes('[')) {
|
|
16
|
+
return name;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Split the path by dots and array accessors
|
|
20
|
+
var parts = name.split(/\.|\[|\]\.?/).filter(Boolean);
|
|
21
|
+
var result = [];
|
|
22
|
+
for (var i = 0; i < parts.length; i++) {
|
|
23
|
+
var part = parts[i];
|
|
24
|
+
var isLast = i === parts.length - 1;
|
|
25
|
+
if (part.match(/^\d+$/)) {
|
|
26
|
+
// If it's a number (array index), add array accessor
|
|
27
|
+
result.push("array[" + part + "]");
|
|
28
|
+
// If there's a next part and it's not an array index, add .object
|
|
29
|
+
if (!isLast && !parts[i + 1].match(/^\d+$/)) {
|
|
30
|
+
result.push('object');
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
// For regular property names
|
|
34
|
+
if (!isLast) {
|
|
35
|
+
// Not the last part, add .object unless next part is array index
|
|
36
|
+
var nextPart = parts[i + 1];
|
|
37
|
+
if (nextPart && nextPart.match(/^\d+$/)) {
|
|
38
|
+
// Next part is array index
|
|
39
|
+
result.push(part);
|
|
40
|
+
} else {
|
|
41
|
+
// Next part is object property
|
|
42
|
+
result.push(part + ".object");
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
// Last part, just add the name
|
|
46
|
+
result.push(part);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return result.join('.');
|
|
8
51
|
}
|
|
@@ -396,7 +396,13 @@ var InputPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
396
396
|
handleChange(val, event);
|
|
397
397
|
});
|
|
398
398
|
var handleClean = (0, _hooks.useEventCallback)(function (event) {
|
|
399
|
-
if (disabled
|
|
399
|
+
if (disabled) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// When there is a value in the search box and the user presses the delete key on the keyboard,
|
|
404
|
+
// do not trigger clearing
|
|
405
|
+
if (inputRef.current === event.target && searchKeyword !== '') {
|
|
400
406
|
return;
|
|
401
407
|
}
|
|
402
408
|
setValue(null);
|
|
@@ -37,7 +37,10 @@ function Menubar(_ref) {
|
|
|
37
37
|
if ((0, _utils.isFocusEntering)(event) &&
|
|
38
38
|
// Skip if focus is moving to a focusable element within this menu
|
|
39
39
|
!(event.target !== event.currentTarget && (0, _utils.isFocusableElement)(event.target))) {
|
|
40
|
-
|
|
40
|
+
var disabled = event.target.getAttribute('aria-disabled');
|
|
41
|
+
|
|
42
|
+
// Skip if the item is disabled
|
|
43
|
+
if (activeItemIndex === null && disabled !== 'true') {
|
|
41
44
|
dispatch({
|
|
42
45
|
type: _MenuContext.MenuActionTypes.MoveFocus,
|
|
43
46
|
to: _MenuContext.MoveFocusTo.First
|