rsuite 5.31.0 → 5.32.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/Calendar/styles/index.less +3 -2
  3. package/Toggle/styles/mixin.less +14 -0
  4. package/cjs/Calendar/Calendar.d.ts +3 -3
  5. package/cjs/Calendar/Calendar.js +4 -4
  6. package/cjs/Calendar/CalendarContainer.d.ts +2 -2
  7. package/cjs/Calendar/CalendarContainer.js +8 -11
  8. package/cjs/Calendar/MonthDropdown.js +1 -1
  9. package/cjs/Cascader/Cascader.d.ts +2 -2
  10. package/cjs/Cascader/Cascader.js +83 -71
  11. package/cjs/Cascader/DropdownMenu.d.ts +6 -2
  12. package/cjs/Cascader/DropdownMenu.js +8 -4
  13. package/cjs/Cascader/utils.d.ts +52 -17
  14. package/cjs/Cascader/utils.js +99 -138
  15. package/cjs/DatePicker/DatePicker.d.ts +3 -1
  16. package/cjs/DatePicker/DatePicker.js +4 -5
  17. package/cjs/DateRangePicker/Calendar.d.ts +1 -0
  18. package/cjs/DateRangePicker/Calendar.js +4 -5
  19. package/cjs/DateRangePicker/DateRangePicker.d.ts +3 -1
  20. package/cjs/DateRangePicker/DateRangePicker.js +4 -1
  21. package/cjs/MultiCascader/DropdownMenu.d.ts +2 -2
  22. package/cjs/MultiCascader/MultiCascader.d.ts +1 -1
  23. package/cjs/MultiCascader/MultiCascader.js +12 -7
  24. package/cjs/MultiCascader/utils.d.ts +2 -2
  25. package/cjs/MultiCascader/utils.js +3 -3
  26. package/cjs/Picker/utils.d.ts +4 -3
  27. package/cjs/Picker/utils.js +8 -4
  28. package/cjs/locales/ru_RU.js +6 -6
  29. package/cjs/utils/getDataGroupBy.js +1 -1
  30. package/cjs/utils/treeUtils.d.ts +5 -1
  31. package/cjs/utils/treeUtils.js +31 -6
  32. package/cjs/utils/useMap.d.ts +6 -0
  33. package/cjs/utils/useMap.js +35 -0
  34. package/dist/rsuite-no-reset-rtl.css +31 -2
  35. package/dist/rsuite-no-reset-rtl.min.css +1 -1
  36. package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
  37. package/dist/rsuite-no-reset.css +31 -2
  38. package/dist/rsuite-no-reset.min.css +1 -1
  39. package/dist/rsuite-no-reset.min.css.map +1 -1
  40. package/dist/rsuite-rtl.css +31 -2
  41. package/dist/rsuite-rtl.min.css +1 -1
  42. package/dist/rsuite-rtl.min.css.map +1 -1
  43. package/dist/rsuite.css +31 -2
  44. package/dist/rsuite.js +187 -15
  45. package/dist/rsuite.js.map +1 -1
  46. package/dist/rsuite.min.css +1 -1
  47. package/dist/rsuite.min.css.map +1 -1
  48. package/dist/rsuite.min.js +1 -1
  49. package/dist/rsuite.min.js.map +1 -1
  50. package/esm/Calendar/Calendar.d.ts +3 -3
  51. package/esm/Calendar/Calendar.js +6 -6
  52. package/esm/Calendar/CalendarContainer.d.ts +2 -2
  53. package/esm/Calendar/CalendarContainer.js +10 -13
  54. package/esm/Calendar/MonthDropdown.js +1 -1
  55. package/esm/Cascader/Cascader.d.ts +2 -2
  56. package/esm/Cascader/Cascader.js +85 -75
  57. package/esm/Cascader/DropdownMenu.d.ts +6 -2
  58. package/esm/Cascader/DropdownMenu.js +8 -4
  59. package/esm/Cascader/utils.d.ts +52 -17
  60. package/esm/Cascader/utils.js +100 -135
  61. package/esm/DatePicker/DatePicker.d.ts +3 -1
  62. package/esm/DatePicker/DatePicker.js +4 -5
  63. package/esm/DateRangePicker/Calendar.d.ts +1 -0
  64. package/esm/DateRangePicker/Calendar.js +5 -6
  65. package/esm/DateRangePicker/DateRangePicker.d.ts +3 -1
  66. package/esm/DateRangePicker/DateRangePicker.js +4 -1
  67. package/esm/MultiCascader/DropdownMenu.d.ts +2 -2
  68. package/esm/MultiCascader/MultiCascader.d.ts +1 -1
  69. package/esm/MultiCascader/MultiCascader.js +12 -7
  70. package/esm/MultiCascader/utils.d.ts +2 -2
  71. package/esm/MultiCascader/utils.js +4 -4
  72. package/esm/Picker/utils.d.ts +4 -3
  73. package/esm/Picker/utils.js +8 -4
  74. package/esm/locales/ru_RU.js +6 -6
  75. package/esm/utils/getDataGroupBy.js +2 -2
  76. package/esm/utils/treeUtils.d.ts +5 -1
  77. package/esm/utils/treeUtils.js +30 -6
  78. package/esm/utils/useMap.d.ts +6 -0
  79. package/esm/utils/useMap.js +29 -0
  80. package/package.json +2 -1
@@ -1,161 +1,126 @@
1
- import { useState, useMemo } from 'react';
2
- import slice from 'lodash/slice';
3
- import { shallowEqual, useUpdateEffect } from '../utils';
4
- import { findNodeOfTree } from '../utils/treeUtils';
5
- import { attachParent } from '../utils/attachParent';
6
- export function getColumnsAndPaths(data, value, options) {
7
- var childrenKey = options.childrenKey,
8
- valueKey = options.valueKey,
9
- isAttachChildren = options.isAttachChildren;
10
- var columns = [];
11
- var paths = [];
12
-
13
- var findNode = function findNode(items) {
14
- var _loop = function _loop(i) {
15
- var children = items[i][childrenKey];
16
-
17
- if (shallowEqual(items[i][valueKey], value)) {
18
- return {
19
- v: {
20
- items: items,
21
- active: items[i]
22
- }
23
- };
24
- } else if (children) {
25
- var node = findNode(children);
26
-
27
- if (node) {
28
- columns.push(children.map(function (item) {
29
- return attachParent(item, items[i]);
30
- }));
31
- paths.push(node.active);
32
- return {
33
- v: {
34
- items: items,
35
- active: items[i]
36
- }
37
- };
38
- }
39
- }
1
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2
+
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
6
+
7
+ import { useMemo } from 'react';
8
+
9
+ /**
10
+ * Calculate columns to be displayed:
11
+ *
12
+ * - Every ancestor level of activeItem should be displayed
13
+ * - The level that activeItem is at should be displayed
14
+ * - If activeItem is a parent node, its child level should be displayed
15
+ *
16
+ * @param items
17
+ * @param value
18
+ * @param options
19
+ * @returns
20
+ */
21
+ export function getColumnsAndPaths(items, pathTarget, options) {
22
+ var getParent = options.getParent,
23
+ getChildren = options.getChildren;
24
+
25
+ if (!pathTarget) {
26
+ return {
27
+ columns: [items],
28
+ path: []
40
29
  };
30
+ }
41
31
 
42
- for (var i = 0; i < items.length; i += 1) {
43
- var _ret = _loop(i);
44
-
45
- if (typeof _ret === "object") return _ret.v;
46
- }
47
-
48
- return null;
49
- };
50
-
51
- var selectedNode = findNode(data);
52
- columns.push(data);
32
+ var columns = [];
33
+ var path = [pathTarget];
34
+ var children = getChildren(pathTarget);
53
35
 
54
- if (selectedNode) {
55
- paths.push(selectedNode.active);
36
+ if (children && children.length > 0) {
37
+ columns.unshift(children);
56
38
  }
57
39
 
58
- if (isAttachChildren) {
59
- var valueToNode = findNodeOfTree(data, function (item) {
60
- return item[valueKey] === value;
61
- });
40
+ for (var parent = getParent(pathTarget); !!parent; parent = getParent(parent)) {
41
+ var _getChildren;
62
42
 
63
- if (valueToNode !== null && valueToNode !== void 0 && valueToNode[childrenKey]) {
64
- columns.unshift(valueToNode[childrenKey]);
65
- }
43
+ columns.unshift((_getChildren = getChildren(parent)) !== null && _getChildren !== void 0 ? _getChildren : []);
44
+ path.unshift(parent);
66
45
  }
67
46
 
68
- columns.reverse();
69
- paths.reverse();
47
+ columns.unshift(items);
70
48
  return {
71
49
  columns: columns,
72
- paths: paths
50
+ path: path
73
51
  };
74
52
  }
75
- export function usePaths(params) {
76
- var data = params.data,
77
- valueKey = params.valueKey,
78
- childrenKey = params.childrenKey,
79
- value = params.value;
53
+
54
+ /**
55
+ * Caculate following 3 things
56
+ *
57
+ * - The columns of items to be displayed
58
+ * - The path towards the current focused item
59
+ * - The path towards the current selected item (referred to by Cascader's value)
60
+ *
61
+ * @param params
62
+ * @returns
63
+ */
64
+ export function usePaths(_ref) {
65
+ var data = _ref.data,
66
+ activeItem = _ref.activeItem,
67
+ selectedItem = _ref.selectedItem,
68
+ getParent = _ref.getParent,
69
+ getChildren = _ref.getChildren;
70
+ var pathTowardsSelectedItem = useMemo(function () {
71
+ return getPathTowardsItem(selectedItem, getParent);
72
+ }, [getParent, selectedItem]);
80
73
 
81
74
  var _useMemo = useMemo(function () {
82
- return getColumnsAndPaths(data, value, {
83
- valueKey: valueKey,
84
- childrenKey: childrenKey
75
+ return getColumnsAndPaths(data, activeItem, {
76
+ getParent: getParent,
77
+ getChildren: getChildren
85
78
  });
86
- }, [data, value, valueKey, childrenKey]),
87
- columns = _useMemo.columns,
88
- paths = _useMemo.paths; // The columns displayed in the cascading panel.
89
-
79
+ }, [data, activeItem, getParent, getChildren]),
80
+ columnsToDisplay = _useMemo.columns,
81
+ pathTowardsActiveItem = _useMemo.path;
90
82
 
91
- var _useState = useState(columns),
92
- columnData = _useState[0],
93
- setColumnData = _useState[1]; // The path after cascading data selection.
94
-
95
-
96
- var _useState2 = useState(paths),
97
- selectedPaths = _useState2[0],
98
- setSelectedPaths = _useState2[1]; // The path corresponding to the selected value.
83
+ return {
84
+ columnsToDisplay: columnsToDisplay,
85
+ pathTowardsSelectedItem: pathTowardsSelectedItem,
86
+ pathTowardsActiveItem: pathTowardsActiveItem
87
+ };
88
+ }
89
+ /**
90
+ * Returns a WeakMap that maps each item in `items` to its parent
91
+ * indicated by `getChildren` function
92
+ */
99
93
 
94
+ export function getParentMap(items, getChildren) {
95
+ var map = new WeakMap();
100
96
 
101
- var _useState3 = useState(paths),
102
- valueToPaths = _useState3[0],
103
- setValueToPaths = _useState3[1];
104
- /**
105
- * Add a list of options to the cascading panel. Used for lazy loading options.
106
- * @param column
107
- * @param index The index of the current column.
108
- */
97
+ for (var queue = [].concat(items); queue.length > 0;) {
98
+ var _item = queue.shift();
109
99
 
100
+ var children = getChildren(_item);
110
101
 
111
- function addColumn(column, index) {
112
- setColumnData([].concat(slice(columnData, 0, index), [column]));
102
+ if (children) {
103
+ for (var _iterator = _createForOfIteratorHelperLoose(children), _step; !(_step = _iterator()).done;) {
104
+ var child = _step.value;
105
+ map.set(child, _item);
106
+ queue.push(child);
107
+ }
108
+ }
113
109
  }
114
- /**
115
- * Remove subsequent columns of the specified column
116
- * @param index
117
- */
118
110
 
111
+ return map;
112
+ }
113
+ /**
114
+ * Returns an array indicating the hirearchy path from root towards `target` item
115
+ */
119
116
 
120
- function removeColumnByIndex(index) {
121
- setColumnData([].concat(slice(columnData, 0, index)));
122
- }
123
- /**
124
- * Enforce update of columns and paths.
125
- * @param nextValue Selected value
126
- * @param isAttachChildren Whether to attach the children of the selected node.
127
- */
128
-
129
-
130
- function enforceUpdate(nextValue, isAttachChildren) {
131
- var _getColumnsAndPaths = getColumnsAndPaths(data, nextValue, {
132
- valueKey: valueKey,
133
- childrenKey: childrenKey,
134
- isAttachChildren: isAttachChildren
135
- }),
136
- columns = _getColumnsAndPaths.columns,
137
- paths = _getColumnsAndPaths.paths;
138
-
139
- setColumnData(columns);
140
- setSelectedPaths(paths);
117
+ export function getPathTowardsItem(target, getParent) {
118
+ if (!target) return [];
119
+ var path = [target];
120
+
121
+ for (var parent = getParent(target); !!parent; parent = getParent(parent)) {
122
+ path.unshift(parent);
141
123
  }
142
124
 
143
- useUpdateEffect(function () {
144
- // Update paths when value is updated, then update valueToPaths.
145
- setValueToPaths(paths);
146
- }, [paths]);
147
- useUpdateEffect(function () {
148
- enforceUpdate(value);
149
- }, [data]);
150
- return {
151
- enforceUpdate: enforceUpdate,
152
- columnData: columnData,
153
- valueToPaths: valueToPaths,
154
- selectedPaths: selectedPaths,
155
- setValueToPaths: setValueToPaths,
156
- setColumnData: setColumnData,
157
- setSelectedPaths: setSelectedPaths,
158
- addColumn: addColumn,
159
- removeColumnByIndex: removeColumnByIndex
160
- };
125
+ return path;
161
126
  }
@@ -21,8 +21,10 @@ export interface DatePickerProps extends PickerBaseProps<DatePickerLocale>, Form
21
21
  inline?: boolean;
22
22
  /** ISO 8601 standard, each calendar week begins on Monday and Sunday on the seventh day */
23
23
  isoWeek?: boolean;
24
- /** Set the lower limit of the available year relative to the current selection date */
24
+ /** Set the upper limit of the available year relative to the current selection date */
25
25
  limitEndYear?: number;
26
+ /** Set the lower limit of the available year relative to the current selection date */
27
+ limitStartYear?: number;
26
28
  /** Whether to show week numbers */
27
29
  showWeekNumbers?: boolean;
28
30
  /** Meridian format */
@@ -35,6 +35,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
35
35
  isoWeek = props.isoWeek,
36
36
  _props$limitEndYear = props.limitEndYear,
37
37
  limitEndYear = _props$limitEndYear === void 0 ? 1000 : _props$limitEndYear,
38
+ limitStartYear = props.limitStartYear,
38
39
  overrideLocale = props.locale,
39
40
  menuClassName = props.menuClassName,
40
41
  _props$appearance = props.appearance,
@@ -73,7 +74,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
73
74
  onSelect = props.onSelect,
74
75
  onToggleMonthDropdown = props.onToggleMonthDropdown,
75
76
  onToggleTimeDropdown = props.onToggleTimeDropdown,
76
- rest = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "calendarDefaultDate", "cleanable", "editable", "defaultValue", "disabled", "format", "isoWeek", "limitEndYear", "locale", "menuClassName", "appearance", "placement", "oneTap", "placeholder", "ranges", "value", "showMeridian", "showWeekNumbers", "style", "toggleAs", "caretAs", "disabledDate", "disabledHours", "disabledMinutes", "disabledSeconds", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "renderValue", "onChange", "onChangeCalendarDate", "onClean", "onClose", "onEntered", "onExited", "onNextMonth", "onOk", "onOpen", "onPrevMonth", "onSelect", "onToggleMonthDropdown", "onToggleTimeDropdown"]);
77
+ rest = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "calendarDefaultDate", "cleanable", "editable", "defaultValue", "disabled", "format", "isoWeek", "limitEndYear", "limitStartYear", "locale", "menuClassName", "appearance", "placement", "oneTap", "placeholder", "ranges", "value", "showMeridian", "showWeekNumbers", "style", "toggleAs", "caretAs", "disabledDate", "disabledHours", "disabledMinutes", "disabledSeconds", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "renderValue", "onChange", "onChangeCalendarDate", "onClean", "onClose", "onEntered", "onExited", "onNextMonth", "onOk", "onOpen", "onPrevMonth", "onSelect", "onToggleMonthDropdown", "onToggleTimeDropdown"]);
77
78
 
78
79
  var _useCustom = useCustom('DatePicker', overrideLocale),
79
80
  locale = _useCustom.locale,
@@ -343,9 +344,6 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
343
344
  };
344
345
  });
345
346
  }, [props]);
346
- var inSameMonth = useCallback(function (date) {
347
- return DateUtils.isSameMonth(date, calendarDate);
348
- }, [calendarDate]);
349
347
  var calendar = /*#__PURE__*/React.createElement(CalendarContainer, _extends({}, calendarProps, {
350
348
  locale: locale,
351
349
  showWeekNumbers: showWeekNumbers,
@@ -355,9 +353,9 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
355
353
  disabledMinutes: shouldDisableMinute !== null && shouldDisableMinute !== void 0 ? shouldDisableMinute : DEPRECATED_disabledMinutes,
356
354
  disabledSeconds: shouldDisableSecond !== null && shouldDisableSecond !== void 0 ? shouldDisableSecond : DEPRECATED_disabledSeconds,
357
355
  limitEndYear: limitEndYear,
356
+ limitStartYear: limitStartYear,
358
357
  format: formatStr,
359
358
  isoWeek: isoWeek,
360
- inSameMonth: inSameMonth,
361
359
  calendarDate: calendarDate,
362
360
  onMoveForward: handleMoveForward,
363
361
  onMoveBackward: handleMoveBackward,
@@ -499,6 +497,7 @@ DatePicker.propTypes = _extends({}, pickerPropTypes, {
499
497
  hideSeconds: PropTypes.func,
500
498
  isoWeek: PropTypes.bool,
501
499
  limitEndYear: PropTypes.number,
500
+ limitStartYear: PropTypes.number,
502
501
  onChange: PropTypes.func,
503
502
  onChangeCalendarDate: PropTypes.func,
504
503
  onNextMonth: PropTypes.func,
@@ -13,6 +13,7 @@ export interface CalendarProps extends WithAsProps, Omit<CalendarCoreProps, Omit
13
13
  index: number;
14
14
  isoWeek?: boolean;
15
15
  limitEndYear?: number;
16
+ limitStartYear?: number;
16
17
  locale?: DatePickerLocale;
17
18
  onChangeCalendarMonth?: (index: number, date: Date) => void;
18
19
  onChangeCalendarTime?: (index: number, date: Date) => void;
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  import PropTypes from 'prop-types';
4
4
  import React, { useCallback } from 'react';
5
- import { addMonths, isSameMonth } from '../utils/dateUtils';
5
+ import { addMonths } from '../utils/dateUtils';
6
6
  import CalendarCore from '../Calendar/CalendarContainer';
7
7
  import { DATERANGE_DISABLED_TARGET } from '../utils';
8
8
  var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -16,13 +16,14 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
16
16
  _props$index = props.index,
17
17
  index = _props$index === void 0 ? 0 : _props$index,
18
18
  limitEndYear = props.limitEndYear,
19
+ limitStartYear = props.limitStartYear,
19
20
  onChangeCalendarMonth = props.onChangeCalendarMonth,
20
21
  onChangeCalendarTime = props.onChangeCalendarTime,
21
22
  onToggleMeridian = props.onToggleMeridian,
22
23
  onSelect = props.onSelect,
23
24
  _props$value = props.value,
24
25
  value = _props$value === void 0 ? [] : _props$value,
25
- rest = _objectWithoutPropertiesLoose(props, ["as", "calendarDate", "format", "disabledDate", "index", "limitEndYear", "onChangeCalendarMonth", "onChangeCalendarTime", "onToggleMeridian", "onSelect", "value"]);
26
+ rest = _objectWithoutPropertiesLoose(props, ["as", "calendarDate", "format", "disabledDate", "index", "limitEndYear", "limitStartYear", "onChangeCalendarMonth", "onChangeCalendarTime", "onToggleMeridian", "onSelect", "value"]);
26
27
 
27
28
  var onMoveForward = useCallback(function (nextPageDate) {
28
29
  onChangeCalendarMonth === null || onChangeCalendarMonth === void 0 ? void 0 : onChangeCalendarMonth(index, nextPageDate);
@@ -42,9 +43,6 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
42
43
  var handleToggleMeridian = useCallback(function (event) {
43
44
  onToggleMeridian(index, event);
44
45
  }, [index, onToggleMeridian]);
45
- var inSameMonth = useCallback(function (date) {
46
- return isSameMonth(date, calendarDate[index]);
47
- }, [calendarDate, index]);
48
46
  var getCalendarDate = useCallback(function () {
49
47
  return calendarDate[index];
50
48
  }, [calendarDate, index]);
@@ -61,9 +59,9 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
61
59
  format: format,
62
60
  dateRange: value,
63
61
  disabledDate: disabledMonth,
64
- inSameMonth: inSameMonth,
65
62
  index: index,
66
63
  limitEndYear: limitEndYear,
64
+ limitStartYear: limitStartYear,
67
65
  onChangeMonth: handleChangeMonth,
68
66
  onChangeTime: handleChangeTime,
69
67
  onMoveBackward: handleMoveBackward,
@@ -83,6 +81,7 @@ Calendar.propTypes = {
83
81
  format: PropTypes.string,
84
82
  isoWeek: PropTypes.bool,
85
83
  limitEndYear: PropTypes.number,
84
+ limitStartYear: PropTypes.number,
86
85
  classPrefix: PropTypes.string,
87
86
  disabledDate: PropTypes.func,
88
87
  onSelect: PropTypes.func,
@@ -15,8 +15,10 @@ export interface DateRangePickerProps extends PickerBaseProps, FormControlBasePr
15
15
  oneTap?: boolean;
16
16
  /** ISO 8601 standard, each calendar week begins on Monday and Sunday on the seventh day */
17
17
  isoWeek?: boolean;
18
- /** Set the lower limit of the available year relative to the current selection date */
18
+ /** Set the upper limit of the available year relative to the current selection date */
19
19
  limitEndYear?: number;
20
+ /** Set the lower limit of the available year relative to the current selection date */
21
+ limitStartYear?: number;
20
22
  /** Whether to show week numbers */
21
23
  showWeekNumbers?: boolean;
22
24
  /** Show only one calendar select */
@@ -47,6 +47,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
47
47
  isoWeek = _props$isoWeek === void 0 ? false : _props$isoWeek,
48
48
  _props$limitEndYear = props.limitEndYear,
49
49
  limitEndYear = _props$limitEndYear === void 0 ? 1000 : _props$limitEndYear,
50
+ limitStartYear = props.limitStartYear,
50
51
  overrideLocale = props.locale,
51
52
  menuClassName = props.menuClassName,
52
53
  menuStyle = props.menuStyle,
@@ -75,7 +76,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
75
76
  onOpen = props.onOpen,
76
77
  onSelect = props.onSelect,
77
78
  renderTitle = props.renderTitle,
78
- rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "className", "appearance", "editable", "cleanable", "character", "defaultCalendarValue", "defaultValue", "disabled", "disabledDate", "shouldDisableDate", "format", "hoverRange", "isoWeek", "limitEndYear", "locale", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "renderValue", "showOneCalendar", "showWeekNumbers", "showMeridian", "style", "toggleAs", "caretAs", "value", "onChange", "onClean", "onClose", "onEnter", "onEntered", "onExited", "onOk", "onOpen", "onSelect", "renderTitle"]);
79
+ rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "className", "appearance", "editable", "cleanable", "character", "defaultCalendarValue", "defaultValue", "disabled", "disabledDate", "shouldDisableDate", "format", "hoverRange", "isoWeek", "limitEndYear", "limitStartYear", "locale", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "renderValue", "showOneCalendar", "showWeekNumbers", "showMeridian", "style", "toggleAs", "caretAs", "value", "onChange", "onClean", "onClose", "onEnter", "onEntered", "onExited", "onOk", "onOpen", "onSelect", "renderTitle"]);
79
80
 
80
81
  var _useClassNames = useClassNames(classPrefix),
81
82
  merge = _useClassNames.merge,
@@ -621,6 +622,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
621
622
  hoverRangeValue: hoverDateRange !== null && hoverDateRange !== void 0 ? hoverDateRange : undefined,
622
623
  isoWeek: isoWeek,
623
624
  limitEndYear: limitEndYear,
625
+ limitStartYear: limitStartYear,
624
626
  locale: locale,
625
627
  showWeekNumbers: showWeekNumbers,
626
628
  value: selectedDates,
@@ -747,6 +749,7 @@ DateRangePicker.propTypes = _extends({}, pickerPropTypes, {
747
749
  isoWeek: PropTypes.bool,
748
750
  oneTap: PropTypes.bool,
749
751
  limitEndYear: PropTypes.number,
752
+ limitStartYear: PropTypes.number,
750
753
  onChange: PropTypes.func,
751
754
  onOk: PropTypes.func,
752
755
  disabledDate: deprecatePropTypeNew(PropTypes.func, 'Use "shouldDisableDate" property instead.'),
@@ -10,11 +10,11 @@ export interface DropdownMenuProps extends WithAsProps {
10
10
  menuWidth?: number;
11
11
  menuHeight?: number | string;
12
12
  cascade?: boolean;
13
- cascadeData: ItemDataType[][];
13
+ cascadeData: (readonly ItemDataType[])[];
14
14
  cascadePaths?: ItemDataType[];
15
15
  uncheckableItemValues: ValueType;
16
16
  renderMenuItem?: (itemLabel: React.MouseEventHandler, item: ItemDataType) => React.ReactNode;
17
- renderMenu?: (children: ItemDataType[], menu: React.ReactNode, parentNode?: ItemDataType, layer?: number) => React.ReactNode;
17
+ renderMenu?: (children: readonly ItemDataType[], menu: React.ReactNode, parentNode?: ItemDataType, layer?: number) => React.ReactNode;
18
18
  onCheck?: (node: ItemDataType, event: React.SyntheticEvent, checked: boolean) => void;
19
19
  onSelect?: (node: ItemDataType, cascadePaths: ItemDataType[], event: React.SyntheticEvent) => void;
20
20
  }
@@ -18,7 +18,7 @@ export interface MultiCascaderProps<T = ValueType> extends FormControlPickerProp
18
18
  /** The menu is displayed directly when the component is initialized */
19
19
  inline?: boolean;
20
20
  /** Custom render menu */
21
- renderMenu?: (items: ItemDataType[], menu: React.ReactNode, parentNode?: any, layer?: number) => React.ReactNode;
21
+ renderMenu?: (items: readonly ItemDataType[], menu: React.ReactNode, parentNode?: any, layer?: number) => React.ReactNode;
22
22
  /** Custom render menu items */
23
23
  renderMenuItem?: (itemLabel: React.ReactNode, item: any) => React.ReactNode;
24
24
  /** Custom render selected items */
@@ -143,17 +143,22 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
143
143
  return overlayRef.current;
144
144
  },
145
145
  callback: useCallback(function (value) {
146
- var _getColumnsAndPaths = getColumnsAndPaths(data, value, {
147
- valueKey: valueKey,
148
- childrenKey: childrenKey,
149
- isAttachChildren: true
146
+ var _getColumnsAndPaths = getColumnsAndPaths(data, flattenData.find(function (item) {
147
+ return item[valueKey] === value;
148
+ }), {
149
+ getParent: function getParent() {
150
+ return undefined;
151
+ },
152
+ getChildren: function getChildren(item) {
153
+ return item[childrenKey];
154
+ }
150
155
  }),
151
156
  columns = _getColumnsAndPaths.columns,
152
- paths = _getColumnsAndPaths.paths;
157
+ path = _getColumnsAndPaths.path;
153
158
 
154
159
  setColumnData(columns);
155
- setSelectedPaths(paths);
156
- }, [childrenKey, data, setColumnData, valueKey])
160
+ setSelectedPaths(path);
161
+ }, [childrenKey, data, flattenData, setColumnData, valueKey])
157
162
  }),
158
163
  focusItemValue = _useFocusItemValue.focusItemValue,
159
164
  setLayer = _useFocusItemValue.setLayer,
@@ -49,10 +49,10 @@ export declare function useFlattenData<T>(data: T[], itemKeys: ItemKeys): {
49
49
  * @param flattenData
50
50
  */
51
51
  export declare function useColumnData<T extends MayHasParent<Record<string, unknown>>>(flattenData: T[]): {
52
- columnData: T[][];
52
+ columnData: (readonly T[])[];
53
53
  addColumn: (column: T[], index: number) => void;
54
54
  removeColumnByIndex: (index: number) => void;
55
- setColumnData: import("react").Dispatch<import("react").SetStateAction<T[][]>>;
55
+ setColumnData: import("react").Dispatch<import("react").SetStateAction<(readonly T[])[]>>;
56
56
  enforceUpdateColumnData: (nextData: T[]) => void;
57
57
  };
58
58
  /**
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';
2
2
  import uniq from 'lodash/uniq';
3
3
  import remove from 'lodash/remove';
4
4
  import slice from 'lodash/slice';
5
- import { flattenTree } from '../utils/treeUtils';
5
+ import { UNSAFE_flattenTree } from '../utils/treeUtils';
6
6
  import { attachParent } from '../utils/attachParent';
7
7
 
8
8
  /**
@@ -162,7 +162,7 @@ export var removeAllChildrenValue = function removeAllChildrenValue(value, item,
162
162
  export function useFlattenData(data, itemKeys) {
163
163
  var childrenKey = itemKeys.childrenKey;
164
164
 
165
- var _useState = useState(flattenTree(data, itemKeys.childrenKey)),
165
+ var _useState = useState(UNSAFE_flattenTree(data, itemKeys.childrenKey)),
166
166
  flattenData = _useState[0],
167
167
  setFlattenData = _useState[1];
168
168
 
@@ -174,7 +174,7 @@ export function useFlattenData(data, itemKeys) {
174
174
  setFlattenData([].concat(flattenData, nodes));
175
175
  }, [childrenKey, flattenData]);
176
176
  useEffect(function () {
177
- setFlattenData(flattenTree(data, itemKeys.childrenKey));
177
+ setFlattenData(UNSAFE_flattenTree(data, itemKeys.childrenKey));
178
178
  }, [data, itemKeys.childrenKey]);
179
179
  return {
180
180
  addFlattenData: addFlattenData,
@@ -214,7 +214,7 @@ export function useColumnData(flattenData) {
214
214
  }
215
215
 
216
216
  function enforceUpdateColumnData(nextData) {
217
- var nextFlattenData = flattenTree(nextData);
217
+ var nextFlattenData = UNSAFE_flattenTree(nextData);
218
218
  setColumnData([nextFlattenData.filter(function (item) {
219
219
  return !item.parent;
220
220
  })]);
@@ -42,21 +42,22 @@ export interface EventsProps {
42
42
  * @param events Event callback functions
43
43
  */
44
44
  export declare function onMenuKeyDown(event: React.KeyboardEvent, events: EventsProps): void;
45
- export interface FocusItemValueProps {
45
+ export interface FocusItemValueProps<T = unknown> {
46
46
  target: HTMLElement | null | (() => HTMLElement | null);
47
- data?: any[];
47
+ data?: T[];
48
48
  valueKey?: string;
49
49
  focusableQueryKey?: string;
50
50
  defaultLayer?: number;
51
51
  rtl?: boolean;
52
52
  callback?: (value: any, event: React.KeyboardEvent) => void;
53
+ getParent?: (node: T) => T | undefined;
53
54
  }
54
55
  /**
55
56
  * A hook that manages the focus state of the option.
56
57
  * @param defaultFocusItemValue
57
58
  * @param props
58
59
  */
59
- export declare const useFocusItemValue: <T>(defaultFocusItemValue: T | null | undefined, props: FocusItemValueProps) => {
60
+ export declare const useFocusItemValue: <T, D>(defaultFocusItemValue: T | null | undefined, props: FocusItemValueProps<D>) => {
60
61
  focusItemValue: T | null | undefined;
61
62
  setFocusItemValue: React.Dispatch<React.SetStateAction<T | null | undefined>>;
62
63
  layer: number;
@@ -191,7 +191,11 @@ export var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue,
191
191
  data = props.data,
192
192
  target = props.target,
193
193
  rtl = props.rtl,
194
- callback = props.callback;
194
+ callback = props.callback,
195
+ _props$getParent = props.getParent,
196
+ getParent = _props$getParent === void 0 ? function (item) {
197
+ return item === null || item === void 0 ? void 0 : item.parent;
198
+ } : _props$getParent;
195
199
 
196
200
  var _useState = useState(defaultFocusItemValue),
197
201
  focusItemValue = _useState[0],
@@ -353,21 +357,21 @@ export var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue,
353
357
  var nextKeys = getSubMenuKeys(nextLayer);
354
358
 
355
359
  if (nextKeys) {
356
- var _focusItem$parent;
360
+ var _getParent;
357
361
 
358
362
  setKeys(nextKeys);
359
363
  setLayer(nextLayer);
360
364
  var focusItem = findNodeOfTree(data, function (item) {
361
365
  return item[valueKey] === focusItemValue;
362
366
  });
363
- var parentItemValue = focusItem === null || focusItem === void 0 ? void 0 : (_focusItem$parent = focusItem.parent) === null || _focusItem$parent === void 0 ? void 0 : _focusItem$parent[valueKey];
367
+ var parentItemValue = (_getParent = getParent(focusItem)) === null || _getParent === void 0 ? void 0 : _getParent[valueKey];
364
368
 
365
369
  if (parentItemValue) {
366
370
  setFocusItemValue(parentItemValue);
367
371
  callback === null || callback === void 0 ? void 0 : callback(parentItemValue, event);
368
372
  }
369
373
  }
370
- }, [callback, data, focusItemValue, getSubMenuKeys, layer, valueKey]);
374
+ }, [callback, data, focusItemValue, getParent, getSubMenuKeys, layer, valueKey]);
371
375
  var handleKeyDown = useCallback(function (event) {
372
376
  var _onMenuKeyDown;
373
377
 
@@ -15,7 +15,7 @@ var Calendar = {
15
15
  minutes: 'Минут',
16
16
  seconds: 'Секунд',
17
17
  formattedMonthPattern: 'MMM, yyyy',
18
- formattedDayPattern: 'MMM dd, yyyy',
18
+ formattedDayPattern: 'dd MMM yyyy',
19
19
  dateLocale: ru
20
20
  };
21
21
  export default {
@@ -25,8 +25,8 @@ export default {
25
25
  },
26
26
  Plaintext: {
27
27
  unfilled: 'незаполненной',
28
- notSelected: 'Није изабран',
29
- notUploaded: 'Није отпремљено'
28
+ notSelected: 'Не выбрано',
29
+ notUploaded: 'Не загружено'
30
30
  },
31
31
  Pagination: {
32
32
  more: 'Больше',
@@ -36,7 +36,7 @@ export default {
36
36
  last: 'Последняя',
37
37
  limit: '{0} / страниц',
38
38
  total: 'всего: {0}',
39
- skip: 'Идти к{0}'
39
+ skip: 'Перейти к {0}'
40
40
  },
41
41
  Calendar: Calendar,
42
42
  DatePicker: _extends({}, Calendar),
@@ -55,9 +55,9 @@ export default {
55
55
  },
56
56
  Uploader: {
57
57
  inited: 'Начало',
58
- progress: 'Выгрузка',
58
+ progress: 'Загрузка',
59
59
  error: 'Ошибка',
60
- complete: 'Завершенно',
60
+ complete: 'Завершено',
61
61
  emptyFile: 'Пусто',
62
62
  upload: 'Загрузить'
63
63
  },