rsuite 5.30.0 → 5.31.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 +10 -0
- package/cjs/Calendar/Calendar.d.ts +2 -0
- package/cjs/Calendar/Calendar.js +15 -5
- package/cjs/Calendar/CalendarHeader.js +4 -0
- package/cjs/Table/Table.d.ts +1 -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 +5 -5
- 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/Calendar.d.ts +2 -0
- package/esm/Calendar/Calendar.js +14 -5
- package/esm/Calendar/CalendarHeader.js +4 -0
- package/esm/Table/Table.d.ts +1 -1
- package/package.json +2 -2
- package/toaster/styles/index.less +0 -1
|
@@ -17,6 +17,8 @@ export interface CalendarProps extends WithAsProps {
|
|
|
17
17
|
locale?: CalendarLocale;
|
|
18
18
|
/** Callback fired before the value changed */
|
|
19
19
|
onChange?: (date: Date) => void;
|
|
20
|
+
/** Callback fired before the month changed */
|
|
21
|
+
onMonthChange?: (date: Date) => void;
|
|
20
22
|
/** Callback fired before the date selected */
|
|
21
23
|
onSelect?: (date: Date) => void;
|
|
22
24
|
/** Custom render calendar cells */
|
package/esm/Calendar/Calendar.js
CHANGED
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import React, { useCallback } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import isSameMonth from 'date-fns/isSameMonth';
|
|
5
6
|
import Calendar from './CalendarContainer';
|
|
6
7
|
import Button from '../Button';
|
|
7
8
|
import { FormattedDate } from '../CustomProvider';
|
|
@@ -20,10 +21,11 @@ var CalendarPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
20
21
|
isoWeek = props.isoWeek,
|
|
21
22
|
overrideLocale = props.locale,
|
|
22
23
|
onChange = props.onChange,
|
|
24
|
+
onMonthChange = props.onMonthChange,
|
|
23
25
|
onSelect = props.onSelect,
|
|
24
26
|
renderCell = props.renderCell,
|
|
25
27
|
value = props.value,
|
|
26
|
-
rest = _objectWithoutPropertiesLoose(props, ["as", "bordered", "className", "classPrefix", "compact", "defaultValue", "isoWeek", "locale", "onChange", "onSelect", "renderCell", "value"]);
|
|
28
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "bordered", "className", "classPrefix", "compact", "defaultValue", "isoWeek", "locale", "onChange", "onMonthChange", "onSelect", "renderCell", "value"]);
|
|
27
29
|
|
|
28
30
|
var _useCalendarDate = useCalendarDate(value, defaultValue),
|
|
29
31
|
calendarDate = _useCalendarDate.calendarDate,
|
|
@@ -42,7 +44,14 @@ var CalendarPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
42
44
|
var handleSelect = useCallback(function (nextValue) {
|
|
43
45
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextValue);
|
|
44
46
|
handleChange(nextValue);
|
|
45
|
-
}, [handleChange, onSelect]);
|
|
47
|
+
}, [handleChange, onSelect]); // Trigger onMonthChange when the month changes
|
|
48
|
+
|
|
49
|
+
var handleMonthChange = useCallback(function (nextValue) {
|
|
50
|
+
if (!isSameMonth(nextValue, calendarDate)) {
|
|
51
|
+
handleChange(nextValue);
|
|
52
|
+
onMonthChange === null || onMonthChange === void 0 ? void 0 : onMonthChange(nextValue);
|
|
53
|
+
}
|
|
54
|
+
}, [calendarDate, handleChange, onMonthChange]);
|
|
46
55
|
|
|
47
56
|
var _useClassNames = useClassNames(classPrefix),
|
|
48
57
|
prefix = _useClassNames.prefix,
|
|
@@ -80,9 +89,9 @@ var CalendarPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
80
89
|
},
|
|
81
90
|
renderToolbar: renderToolbar,
|
|
82
91
|
renderCell: customRenderCell,
|
|
83
|
-
onMoveForward:
|
|
84
|
-
onMoveBackward:
|
|
85
|
-
onChangeMonth:
|
|
92
|
+
onMoveForward: handleMonthChange,
|
|
93
|
+
onMoveBackward: handleMonthChange,
|
|
94
|
+
onChangeMonth: handleMonthChange,
|
|
86
95
|
onSelect: handleSelect
|
|
87
96
|
}));
|
|
88
97
|
});
|
|
@@ -103,13 +103,17 @@ var CalendarHeader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
103
103
|
var monthToolbar = /*#__PURE__*/React.createElement("div", {
|
|
104
104
|
className: prefix('month-toolbar')
|
|
105
105
|
}, /*#__PURE__*/React.createElement(IconButton, _extends({}, btnProps, {
|
|
106
|
+
// TODO: aria-label should be translated by i18n
|
|
107
|
+
"aria-label": "Previous month",
|
|
106
108
|
className: backwardClass,
|
|
107
109
|
onClick: disabledBackward ? undefined : onMoveBackward,
|
|
108
110
|
icon: /*#__PURE__*/React.createElement(AngleLeftIcon, null)
|
|
109
111
|
})), /*#__PURE__*/React.createElement(Button, _extends({}, btnProps, {
|
|
112
|
+
"aria-label": "Select month",
|
|
110
113
|
className: dateTitleClasses,
|
|
111
114
|
onClick: onToggleMonthDropdown
|
|
112
115
|
}), renderTitle()), /*#__PURE__*/React.createElement(IconButton, _extends({}, btnProps, {
|
|
116
|
+
"aria-label": "Next month",
|
|
113
117
|
className: forwardClass,
|
|
114
118
|
onClick: disabledForward ? undefined : onMoveForward,
|
|
115
119
|
icon: /*#__PURE__*/React.createElement(AngleRightIcon, null)
|
package/esm/Table/Table.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface CellProps<T = any> extends Omit<TableCellProps, 'rowData' | 'da
|
|
|
6
6
|
/** Row Data */
|
|
7
7
|
rowData?: T;
|
|
8
8
|
}
|
|
9
|
-
declare const _default: (<Row extends RowDataType
|
|
9
|
+
declare const _default: (<Row extends RowDataType<never>, Key>(props: TableProps<Row, Key> & React.RefAttributes<TableInstance<Row, Key>>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
10
10
|
Cell: React.ForwardRefExoticComponent<import("rsuite-table/lib/Cell").InnerCellProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
Column: typeof Column;
|
|
12
12
|
HeaderCell: React.ForwardRefExoticComponent<import("rsuite-table").HeaderCellProps & React.RefAttributes<HTMLDivElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsuite",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.31.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.8.1",
|
|
39
39
|
"react-window": "^1.8.8",
|
|
40
|
-
"rsuite-table": "^5.10.
|
|
40
|
+
"rsuite-table": "^5.10.3",
|
|
41
41
|
"schema-typed": "^2.1.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|