rsuite 5.21.0 → 5.22.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +21 -973
  2. package/DatePicker/styles/index.less +11 -0
  3. package/Table/styles/index.less +12 -7
  4. package/cjs/Calendar/Calendar.js +1 -1
  5. package/cjs/Calendar/CalendarContainer.d.ts +2 -2
  6. package/cjs/Calendar/CalendarContainer.js +11 -11
  7. package/cjs/Calendar/MonthDropdownItem.js +1 -1
  8. package/cjs/Calendar/TimeDropdown.js +1 -1
  9. package/cjs/Calendar/types.d.ts +2 -2
  10. package/cjs/DatePicker/DatePicker.js +29 -7
  11. package/cjs/DatePicker/types.d.ts +1 -0
  12. package/cjs/DateRangePicker/Calendar.d.ts +2 -2
  13. package/cjs/DateRangePicker/Calendar.js +18 -13
  14. package/cjs/DateRangePicker/DateRangePicker.js +100 -55
  15. package/cjs/DateRangePicker/utils.d.ts +1 -1
  16. package/cjs/DateRangePicker/utils.js +11 -6
  17. package/cjs/utils/dateUtils.d.ts +16 -0
  18. package/cjs/utils/dateUtils.js +62 -8
  19. package/dist/rsuite-rtl.css +20 -6
  20. package/dist/rsuite-rtl.min.css +1 -1
  21. package/dist/rsuite-rtl.min.css.map +1 -1
  22. package/dist/rsuite.css +20 -6
  23. package/dist/rsuite.js +35 -24
  24. package/dist/rsuite.js.map +1 -1
  25. package/dist/rsuite.min.css +1 -1
  26. package/dist/rsuite.min.css.map +1 -1
  27. package/dist/rsuite.min.js +1 -1
  28. package/dist/rsuite.min.js.map +1 -1
  29. package/esm/Calendar/Calendar.js +1 -1
  30. package/esm/Calendar/CalendarContainer.d.ts +2 -2
  31. package/esm/Calendar/CalendarContainer.js +11 -11
  32. package/esm/Calendar/MonthDropdownItem.js +1 -1
  33. package/esm/Calendar/TimeDropdown.js +1 -1
  34. package/esm/Calendar/types.d.ts +2 -2
  35. package/esm/DatePicker/DatePicker.js +26 -7
  36. package/esm/DatePicker/types.d.ts +1 -0
  37. package/esm/DateRangePicker/Calendar.d.ts +2 -2
  38. package/esm/DateRangePicker/Calendar.js +18 -13
  39. package/esm/DateRangePicker/DateRangePicker.js +102 -55
  40. package/esm/DateRangePicker/utils.d.ts +1 -1
  41. package/esm/DateRangePicker/utils.js +11 -6
  42. package/esm/utils/dateUtils.d.ts +16 -0
  43. package/esm/utils/dateUtils.js +47 -1
  44. package/package.json +3 -3
  45. package/styles/variables.less +1 -0
@@ -1,10 +1,12 @@
1
1
  import pick from 'lodash/pick';
2
2
  import omitBy from 'lodash/omitBy';
3
3
  import getHours from 'date-fns/getHours';
4
+ import setHours from 'date-fns/setHours';
4
5
  import getDay from 'date-fns/getDay';
5
6
  import getMinutes from 'date-fns/getMinutes';
6
7
  import getSeconds from 'date-fns/getSeconds';
7
8
  import addDays from 'date-fns/addDays';
9
+ import set from 'date-fns/set';
8
10
  export { default as addDays } from 'date-fns/addDays';
9
11
  export { default as addMonths } from 'date-fns/addMonths';
10
12
  export { default as compareAsc } from 'date-fns/compareAsc';
@@ -43,6 +45,7 @@ export { default as subDays } from 'date-fns/subDays';
43
45
  export { default as isMatch } from 'date-fns/isMatch';
44
46
  export { default as isValid } from 'date-fns/isValid';
45
47
  export { default as set } from 'date-fns/set';
48
+ export { default as differenceInCalendarMonths } from 'date-fns/differenceInCalendarMonths';
46
49
  var disabledTimeProps = ['disabledHours', 'disabledMinutes', 'disabledSeconds'];
47
50
  var hideTimeProps = ['hideHours', 'hideMinutes', 'hideSeconds'];
48
51
  export var calendarOnlyProps = disabledTimeProps.concat(hideTimeProps);
@@ -132,4 +135,47 @@ export function getDateMask(formatStr) {
132
135
  return Array.from(formatStr).map(function (i) {
133
136
  return i.match(/[A-Za-z]/) ? /[\d|A-Za-z]/ : i;
134
137
  });
135
- }
138
+ }
139
+ /**
140
+ * Copy the time of one date to another
141
+ */
142
+
143
+ export function copyTime(_ref) {
144
+ var from = _ref.from,
145
+ to = _ref.to;
146
+ return set(to, {
147
+ hours: getHours(from),
148
+ minutes: getMinutes(from),
149
+ seconds: getSeconds(from)
150
+ });
151
+ }
152
+ /**
153
+ * Swap two dates without swapping the time.
154
+ */
155
+
156
+ export function reverseDateRangeOmitTime(dateRange) {
157
+ var start = dateRange[0],
158
+ end = dateRange[1];
159
+
160
+ if (start && end) {
161
+ return [copyTime({
162
+ from: start,
163
+ to: end
164
+ }), copyTime({
165
+ from: end,
166
+ to: start
167
+ })];
168
+ }
169
+
170
+ return dateRange;
171
+ }
172
+ /**
173
+ * Get the time with AM and PM reversed.
174
+ */
175
+
176
+ export var getReversedTimeMeridian = function getReversedTimeMeridian(date) {
177
+ var clonedDate = new Date(date.valueOf());
178
+ var hours = getHours(clonedDate);
179
+ var nextHours = hours >= 12 ? hours - 12 : hours + 12;
180
+ return setHours(clonedDate, nextHours);
181
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.21.0",
3
+ "version": "5.22.1",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -24,7 +24,7 @@
24
24
  "url": "git@github.com:rsuite/rsuite.git"
25
25
  },
26
26
  "dependencies": {
27
- "@babel/runtime": "^7.19.0",
27
+ "@babel/runtime": "^7.19.4",
28
28
  "@juggle/resize-observer": "^3.4.0",
29
29
  "@rsuite/icons": "^1.0.2",
30
30
  "@types/chai": "^4.3.3",
@@ -37,7 +37,7 @@
37
37
  "lodash": "^4.17.11",
38
38
  "prop-types": "^15.8.1",
39
39
  "react-window": "^1.8.7",
40
- "rsuite-table": "^5.7.2",
40
+ "rsuite-table": "^5.8.0",
41
41
  "schema-typed": "^2.0.3"
42
42
  },
43
43
  "peerDependencies": {
@@ -224,6 +224,7 @@
224
224
  @table-content-padding-horizontal: 10px; // @deprecated use @table-cell-padding-x instead
225
225
  @table-cell-padding-y: @table-body-content-padding-vertical;
226
226
  @table-cell-padding-x: @table-content-padding-horizontal;
227
+ @table-cell-hover-color: var(--rs-primary-500);
227
228
 
228
229
  @table-scrollbar-timing-duration: 0.1s;
229
230
  @table-scrollbar-width: 10px;