rsuite 5.76.3 → 5.77.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 +15 -0
- package/cjs/DateRangePicker/DateRangePicker.d.ts +6 -0
- package/cjs/DateRangePicker/DateRangePicker.js +4 -2
- package/cjs/FormControl/utils.d.ts +8 -0
- package/cjs/FormControl/utils.js +44 -1
- package/cjs/InputPicker/InputPicker.js +7 -1
- package/dist/rsuite.js +5 -5
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/DateRangePicker/DateRangePicker.d.ts +6 -0
- package/esm/DateRangePicker/DateRangePicker.js +4 -2
- package/esm/FormControl/utils.d.ts +8 -0
- package/esm/FormControl/utils.js +44 -1
- package/esm/InputPicker/InputPicker.js +7 -1
- package/package.json +1 -1
|
@@ -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 */
|
|
@@ -3,7 +3,7 @@ import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTempla
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
var _templateObject, _templateObject2;
|
|
6
|
-
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"];
|
|
6
|
+
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"];
|
|
7
7
|
import React, { useEffect, useRef, useState, useMemo } from 'react';
|
|
8
8
|
import isNil from 'lodash/isNil';
|
|
9
9
|
import omit from 'lodash/omit';
|
|
@@ -109,6 +109,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
109
109
|
onShortcutClick = propsWithDefaults.onShortcutClick,
|
|
110
110
|
renderTitle = propsWithDefaults.renderTitle,
|
|
111
111
|
renderValue = propsWithDefaults.renderValue,
|
|
112
|
+
renderCell = propsWithDefaults.renderCell,
|
|
112
113
|
restProps = _objectWithoutPropertiesLoose(propsWithDefaults, _excluded);
|
|
113
114
|
var id = useUniqueId('rs-', idProp);
|
|
114
115
|
var _usePickerRef = usePickerRef(ref),
|
|
@@ -666,7 +667,8 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
666
667
|
onChangeCalendarMonth: onChangeCalendarMonth,
|
|
667
668
|
onChangeCalendarTime: onChangeCalendarTime,
|
|
668
669
|
onMouseMove: onMouseMove,
|
|
669
|
-
renderTitle: renderTitle
|
|
670
|
+
renderTitle: renderTitle,
|
|
671
|
+
renderCellOnPicker: renderCell
|
|
670
672
|
};
|
|
671
673
|
var getCalendars = function getCalendars() {
|
|
672
674
|
if (showOneCalendar) {
|
|
@@ -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/esm/FormControl/utils.js
CHANGED
|
@@ -1,4 +1,47 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a field name to a path that can be used in a nested object.
|
|
4
|
+
* @example
|
|
5
|
+
* nameToPath('a.b.c') // 'a.object.b.object.c'
|
|
6
|
+
* nameToPath('items[0].name') // 'items.array[0].object.name'
|
|
7
|
+
* @param name the field name to convert
|
|
8
|
+
* @returns the converted path
|
|
9
|
+
*/
|
|
2
10
|
export function nameToPath(name) {
|
|
3
|
-
|
|
11
|
+
if (!name.includes('.') && !name.includes('[')) {
|
|
12
|
+
return name;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Split the path by dots and array accessors
|
|
16
|
+
var parts = name.split(/\.|\[|\]\.?/).filter(Boolean);
|
|
17
|
+
var result = [];
|
|
18
|
+
for (var i = 0; i < parts.length; i++) {
|
|
19
|
+
var part = parts[i];
|
|
20
|
+
var isLast = i === parts.length - 1;
|
|
21
|
+
if (part.match(/^\d+$/)) {
|
|
22
|
+
// If it's a number (array index), add array accessor
|
|
23
|
+
result.push("array[" + part + "]");
|
|
24
|
+
// If there's a next part and it's not an array index, add .object
|
|
25
|
+
if (!isLast && !parts[i + 1].match(/^\d+$/)) {
|
|
26
|
+
result.push('object');
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
// For regular property names
|
|
30
|
+
if (!isLast) {
|
|
31
|
+
// Not the last part, add .object unless next part is array index
|
|
32
|
+
var nextPart = parts[i + 1];
|
|
33
|
+
if (nextPart && nextPart.match(/^\d+$/)) {
|
|
34
|
+
// Next part is array index
|
|
35
|
+
result.push(part);
|
|
36
|
+
} else {
|
|
37
|
+
// Next part is object property
|
|
38
|
+
result.push(part + ".object");
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
// Last part, just add the name
|
|
42
|
+
result.push(part);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return result.join('.');
|
|
4
47
|
}
|
|
@@ -390,7 +390,13 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
390
390
|
handleChange(val, event);
|
|
391
391
|
});
|
|
392
392
|
var handleClean = useEventCallback(function (event) {
|
|
393
|
-
if (disabled
|
|
393
|
+
if (disabled) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// When there is a value in the search box and the user presses the delete key on the keyboard,
|
|
398
|
+
// do not trigger clearing
|
|
399
|
+
if (inputRef.current === event.target && searchKeyword !== '') {
|
|
394
400
|
return;
|
|
395
401
|
}
|
|
396
402
|
setValue(null);
|