@mui/x-date-pickers 5.0.5 → 5.0.7
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 +62 -0
- package/index.js +1 -1
- package/internals/hooks/useMaskedInput.js +6 -2
- package/internals/utils/utils.d.ts +1 -1
- package/internals/utils/utils.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/useMaskedInput.js +6 -2
- package/legacy/internals/utils/utils.js +1 -1
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/ukUA.js +53 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/ukUA.d.ts +35 -0
- package/locales/ukUA.js +37 -0
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useMaskedInput.js +6 -2
- package/modern/internals/utils/utils.js +1 -1
- package/modern/locales/index.js +1 -0
- package/modern/locales/ukUA.js +37 -0
- package/node/index.js +1 -1
- package/node/internals/hooks/useMaskedInput.js +6 -2
- package/node/internals/utils/utils.js +1 -1
- package/node/locales/index.js +13 -0
- package/node/locales/ukUA.js +46 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,68 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 5.17.10
|
|
7
|
+
|
|
8
|
+
_Nov 4, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Add Ukrainian (uk-UA) locale to pickers (#6661) @Dufran
|
|
13
|
+
|
|
14
|
+
### `@mui/x-data-grid@v5.17.10` / `@mui/x-data-grid-pro@v5.17.10` / `@mui/x-data-grid-premium@v5.17.10`
|
|
15
|
+
|
|
16
|
+
#### Changes
|
|
17
|
+
|
|
18
|
+
- [DataGrid] Remove `React.memo` from `GridCellCheckboxRenderer` (#6688) @mattcorner
|
|
19
|
+
|
|
20
|
+
### `@mui/x-date-pickers@v5.0.7` / `@mui/x-date-pickers-pro@v5.0.7`
|
|
21
|
+
|
|
22
|
+
#### Changes
|
|
23
|
+
|
|
24
|
+
- [DateRangePicker] Fix input focused style and mobile behaviour (#6645) (#6714) @LukasTy
|
|
25
|
+
- [pickers] Add Ukrainian (uk-UA) locale on the date picker (#6661) @Dufran
|
|
26
|
+
|
|
27
|
+
### Docs
|
|
28
|
+
|
|
29
|
+
- [docs] Mark data grid column group available (#6659) @alexfauquette
|
|
30
|
+
|
|
31
|
+
## 5.17.9
|
|
32
|
+
|
|
33
|
+
_Oct 28, 2022_
|
|
34
|
+
|
|
35
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
36
|
+
|
|
37
|
+
- ⚡ Fix memory leak during unmount of the DataGrid (#6579) @cherniavskii
|
|
38
|
+
- 🎁 Allow to disable the autofocus of the search field when opening the column visibility panel (#6630) @e-cloud
|
|
39
|
+
- 🐞 Bugfixes
|
|
40
|
+
|
|
41
|
+
### `@mui/x-data-grid@v5.17.9` / `@mui/x-data-grid-pro@v5.17.9` / `@mui/x-data-grid-premium@v5.17.9`
|
|
42
|
+
|
|
43
|
+
#### Changes
|
|
44
|
+
|
|
45
|
+
- [DataGrid] Allow to disable autofocusing the search field in the columns panel (#6630) @e-cloud
|
|
46
|
+
- [DataGrid] Fix `setRows` method not persisting new rows data after `loading` prop change (#6637) @cherniavskii
|
|
47
|
+
- [DataGrid] Fix memory leak on grid unmount (#6579) @cherniavskii
|
|
48
|
+
- [l10n] Improve Bulgarian (bg-BG) locale (#6635) @AtanasVA
|
|
49
|
+
|
|
50
|
+
### `@mui/x-date-pickers@v5.0.6` / `@mui/x-date-pickers-pro@v5.0.6`
|
|
51
|
+
|
|
52
|
+
#### Changes
|
|
53
|
+
|
|
54
|
+
- [pickers] Ignore milliseconds in mask logic (#6618) @alexfauquette
|
|
55
|
+
- [pickers] Update input when `inputFormat` is modified (#6617) @alexfauquette
|
|
56
|
+
|
|
57
|
+
### Docs
|
|
58
|
+
|
|
59
|
+
- [docs] Add token to redirect feedbacks on slack (#6592) @alexfauquette
|
|
60
|
+
- [docs] Disable translations (#6639) @cherniavskii
|
|
61
|
+
- [docs] Fix code edit for when v6 will be stable (#6600) @oliviertassinari
|
|
62
|
+
- [docs] Fix typo in DataGrid demo page (#6632) (#6634) @LukasTy
|
|
63
|
+
|
|
64
|
+
### Core
|
|
65
|
+
|
|
66
|
+
- [core] Upgrade monorepo (#6570) @cherniavskii
|
|
67
|
+
|
|
6
68
|
## 5.17.8
|
|
7
69
|
|
|
8
70
|
_Oct 20, 2022_
|
package/index.js
CHANGED
|
@@ -49,20 +49,24 @@ export const useMaskedInput = ({
|
|
|
49
49
|
|
|
50
50
|
const prevRawValue = React.useRef();
|
|
51
51
|
const prevLocale = React.useRef(utils.locale);
|
|
52
|
+
const prevInputFormat = React.useRef(inputFormat);
|
|
52
53
|
React.useEffect(() => {
|
|
53
54
|
const rawValueHasChanged = rawValue !== prevRawValue.current;
|
|
54
55
|
const localeHasChanged = utils.locale !== prevLocale.current;
|
|
56
|
+
const inputFormatHasChanged = inputFormat !== prevInputFormat.current;
|
|
55
57
|
prevRawValue.current = rawValue;
|
|
56
58
|
prevLocale.current = utils.locale;
|
|
59
|
+
prevInputFormat.current = inputFormat;
|
|
57
60
|
|
|
58
|
-
if (!rawValueHasChanged && !localeHasChanged) {
|
|
61
|
+
if (!rawValueHasChanged && !localeHasChanged && !inputFormatHasChanged) {
|
|
59
62
|
return;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
const newParsedValue = rawValue === null ? null : utils.date(rawValue);
|
|
63
66
|
const isAcceptedValue = rawValue === null || utils.isValid(newParsedValue);
|
|
67
|
+
const innerEqualsParsed = innerInputValue === null ? newParsedValue === null : newParsedValue !== null && Math.abs(utils.getDiff(innerInputValue, newParsedValue, 'seconds')) === 0;
|
|
64
68
|
|
|
65
|
-
if (!localeHasChanged && (!isAcceptedValue ||
|
|
69
|
+
if (!localeHasChanged && !inputFormatHasChanged && (!isAcceptedValue || innerEqualsParsed)) {
|
|
66
70
|
return;
|
|
67
71
|
} // When dev set a new valid value, we trust them
|
|
68
72
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export declare function arrayIncludes<T>(array: T[] | readonly T[], itemOrItems: T | T[]): boolean;
|
|
3
|
-
export declare const onSpaceOrEnter: (innerFn: () => void, onFocus?: ((event: React.KeyboardEvent<any>) => void) | undefined) => (event: React.KeyboardEvent) => void;
|
|
3
|
+
export declare const onSpaceOrEnter: (innerFn: (ev: React.MouseEvent<any> | React.KeyboardEvent<any>) => void, onFocus?: ((event: React.KeyboardEvent<any>) => void) | undefined) => (event: React.KeyboardEvent) => void;
|
|
4
4
|
export declare const executeInTheNextEventLoopTick: (fn: () => void) => void;
|
|
5
5
|
export declare const doNothing: () => void;
|
package/internals/utils/utils.js
CHANGED
|
@@ -8,7 +8,7 @@ export function arrayIncludes(array, itemOrItems) {
|
|
|
8
8
|
}
|
|
9
9
|
export const onSpaceOrEnter = (innerFn, onFocus) => event => {
|
|
10
10
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
11
|
-
innerFn(); // prevent any side effects
|
|
11
|
+
innerFn(event); // prevent any side effects
|
|
12
12
|
|
|
13
13
|
event.preventDefault();
|
|
14
14
|
event.stopPropagation();
|
package/legacy/index.js
CHANGED
|
@@ -63,20 +63,24 @@ export var useMaskedInput = function useMaskedInput(_ref) {
|
|
|
63
63
|
|
|
64
64
|
var prevRawValue = React.useRef();
|
|
65
65
|
var prevLocale = React.useRef(utils.locale);
|
|
66
|
+
var prevInputFormat = React.useRef(inputFormat);
|
|
66
67
|
React.useEffect(function () {
|
|
67
68
|
var rawValueHasChanged = rawValue !== prevRawValue.current;
|
|
68
69
|
var localeHasChanged = utils.locale !== prevLocale.current;
|
|
70
|
+
var inputFormatHasChanged = inputFormat !== prevInputFormat.current;
|
|
69
71
|
prevRawValue.current = rawValue;
|
|
70
72
|
prevLocale.current = utils.locale;
|
|
73
|
+
prevInputFormat.current = inputFormat;
|
|
71
74
|
|
|
72
|
-
if (!rawValueHasChanged && !localeHasChanged) {
|
|
75
|
+
if (!rawValueHasChanged && !localeHasChanged && !inputFormatHasChanged) {
|
|
73
76
|
return;
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
var newParsedValue = rawValue === null ? null : utils.date(rawValue);
|
|
77
80
|
var isAcceptedValue = rawValue === null || utils.isValid(newParsedValue);
|
|
81
|
+
var innerEqualsParsed = innerInputValue === null ? newParsedValue === null : newParsedValue !== null && Math.abs(utils.getDiff(innerInputValue, newParsedValue, 'seconds')) === 0;
|
|
78
82
|
|
|
79
|
-
if (!localeHasChanged && (!isAcceptedValue ||
|
|
83
|
+
if (!localeHasChanged && !inputFormatHasChanged && (!isAcceptedValue || innerEqualsParsed)) {
|
|
80
84
|
return;
|
|
81
85
|
} // When dev set a new valid value, we trust them
|
|
82
86
|
|
|
@@ -11,7 +11,7 @@ export function arrayIncludes(array, itemOrItems) {
|
|
|
11
11
|
export var onSpaceOrEnter = function onSpaceOrEnter(innerFn, onFocus) {
|
|
12
12
|
return function (event) {
|
|
13
13
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
14
|
-
innerFn(); // prevent any side effects
|
|
14
|
+
innerFn(event); // prevent any side effects
|
|
15
15
|
|
|
16
16
|
event.preventDefault();
|
|
17
17
|
event.stopPropagation();
|
package/legacy/locales/index.js
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { getPickersLocalization } from './utils/getPickersLocalization';
|
|
2
|
+
// This object is not Partial<PickersLocaleText> because it is the default values
|
|
3
|
+
var ukUAPickers = {
|
|
4
|
+
// Calendar navigation
|
|
5
|
+
previousMonth: 'Попередній місяць',
|
|
6
|
+
nextMonth: 'Наступний місяць',
|
|
7
|
+
// View navigation
|
|
8
|
+
openPreviousView: 'відкрити попередній вигляд',
|
|
9
|
+
openNextView: 'відкрити наступний вигляд',
|
|
10
|
+
calendarViewSwitchingButtonAriaLabel: function calendarViewSwitchingButtonAriaLabel(view) {
|
|
11
|
+
return view === 'year' ? 'річний вигляд відкрито, перейти до календарного вигляду' : 'календарний вигляд відкрито, перейти до річного вигляду';
|
|
12
|
+
},
|
|
13
|
+
inputModeToggleButtonAriaLabel: function inputModeToggleButtonAriaLabel(isKeyboardInputOpen, viewType) {
|
|
14
|
+
return isKeyboardInputOpen ? "\u0442\u0435\u043A\u0441\u0442\u043E\u0432\u0435 \u043F\u043E\u043B\u0435 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0435, \u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u0434\u043E ".concat(viewType, " \u0432\u0438\u0433\u043B\u044F\u0434\u0443") : "".concat(viewType, " \u0432\u0438\u0433\u043B\u044F\u0434 \u043D\u0430\u0440\u0430\u0437\u0456 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u043E, \u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u0434\u043E \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u043E\u0433\u043E \u043F\u043E\u043B\u044F");
|
|
15
|
+
},
|
|
16
|
+
// DateRange placeholders
|
|
17
|
+
start: 'Початок',
|
|
18
|
+
end: 'Кінець',
|
|
19
|
+
// Action bar
|
|
20
|
+
cancelButtonLabel: 'Відміна',
|
|
21
|
+
clearButtonLabel: 'Очистити',
|
|
22
|
+
okButtonLabel: 'OK',
|
|
23
|
+
todayButtonLabel: 'Сьогодні',
|
|
24
|
+
// Toolbar titles
|
|
25
|
+
datePickerDefaultToolbarTitle: 'Вибрати дату',
|
|
26
|
+
dateTimePickerDefaultToolbarTitle: 'Вибрати дату і час',
|
|
27
|
+
timePickerDefaultToolbarTitle: 'Вибрати час',
|
|
28
|
+
dateRangePickerDefaultToolbarTitle: 'Вибрати календарний період',
|
|
29
|
+
// Clock labels
|
|
30
|
+
clockLabelText: function clockLabelText(view, time, adapter) {
|
|
31
|
+
return "Select ".concat(view, ". ").concat(time === null ? 'Час не вибраний' : "\u0412\u0438\u0431\u0440\u0430\u043D\u043E \u0447\u0430\u0441 ".concat(adapter.format(time, 'fullTime')));
|
|
32
|
+
},
|
|
33
|
+
hoursClockNumberText: function hoursClockNumberText(hours) {
|
|
34
|
+
return "".concat(hours, " \u0433\u043E\u0434\u0438\u043D");
|
|
35
|
+
},
|
|
36
|
+
minutesClockNumberText: function minutesClockNumberText(minutes) {
|
|
37
|
+
return "".concat(minutes, " \u0445\u0432\u0438\u043B\u0438\u043D");
|
|
38
|
+
},
|
|
39
|
+
secondsClockNumberText: function secondsClockNumberText(seconds) {
|
|
40
|
+
return "".concat(seconds, " \u0441\u0435\u043A\u0443\u043D\u0434");
|
|
41
|
+
},
|
|
42
|
+
// Open picker labels
|
|
43
|
+
openDatePickerDialogue: function openDatePickerDialogue(value, utils) {
|
|
44
|
+
return value !== null && utils.isValid(value) ? "\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u0434\u0430\u0442\u0443, \u043E\u0431\u0440\u0430\u043D\u0430 \u0434\u0430\u0442\u0430 ".concat(utils.format(value, 'fullDate')) : 'Оберіть дату';
|
|
45
|
+
},
|
|
46
|
+
openTimePickerDialogue: function openTimePickerDialogue(value, utils) {
|
|
47
|
+
return value !== null && utils.isValid(value) ? "\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u0447\u0430\u0441, \u043E\u0431\u0440\u0430\u043D\u0438\u0439 \u0447\u0430\u0441 ".concat(utils.format(value, 'fullTime')) : 'Оберіть час';
|
|
48
|
+
},
|
|
49
|
+
// Table labels
|
|
50
|
+
timeTableLabel: 'оберіть час',
|
|
51
|
+
dateTableLabel: 'оберіть дату'
|
|
52
|
+
};
|
|
53
|
+
export var ukUA = getPickersLocalization(ukUAPickers);
|
package/locales/index.d.ts
CHANGED
package/locales/index.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CalendarPickerView } from '../internals/models';
|
|
2
|
+
export declare const ukUA: {
|
|
3
|
+
components: {
|
|
4
|
+
MuiLocalizationProvider: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
localeText: {
|
|
7
|
+
previousMonth?: string | undefined;
|
|
8
|
+
nextMonth?: string | undefined;
|
|
9
|
+
openPreviousView?: string | undefined;
|
|
10
|
+
openNextView?: string | undefined;
|
|
11
|
+
cancelButtonLabel?: string | undefined;
|
|
12
|
+
clearButtonLabel?: string | undefined;
|
|
13
|
+
okButtonLabel?: string | undefined;
|
|
14
|
+
todayButtonLabel?: string | undefined;
|
|
15
|
+
start?: string | undefined;
|
|
16
|
+
end?: string | undefined;
|
|
17
|
+
calendarViewSwitchingButtonAriaLabel?: ((currentView: CalendarPickerView) => string) | undefined;
|
|
18
|
+
inputModeToggleButtonAriaLabel?: ((isKeyboardInputOpen: boolean, viewType: "calendar" | "clock") => string) | undefined;
|
|
19
|
+
clockLabelText?: ((view: import("../internals/models").ClockPickerView, time: any, adapter: import("../internals/models").MuiPickersAdapter<any>) => string) | undefined;
|
|
20
|
+
hoursClockNumberText?: ((hours: string) => string) | undefined;
|
|
21
|
+
minutesClockNumberText?: ((minutes: string) => string) | undefined;
|
|
22
|
+
secondsClockNumberText?: ((seconds: string) => string) | undefined;
|
|
23
|
+
openDatePickerDialogue?: ((date: any, utils: import("../internals/models").MuiPickersAdapter<any>) => string) | undefined;
|
|
24
|
+
openTimePickerDialogue?: ((date: any, utils: import("../internals/models").MuiPickersAdapter<any>) => string) | undefined;
|
|
25
|
+
timeTableLabel?: string | undefined;
|
|
26
|
+
dateTableLabel?: string | undefined;
|
|
27
|
+
datePickerDefaultToolbarTitle?: string | undefined;
|
|
28
|
+
dateTimePickerDefaultToolbarTitle?: string | undefined;
|
|
29
|
+
timePickerDefaultToolbarTitle?: string | undefined;
|
|
30
|
+
dateRangePickerDefaultToolbarTitle?: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
package/locales/ukUA.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getPickersLocalization } from './utils/getPickersLocalization';
|
|
2
|
+
// This object is not Partial<PickersLocaleText> because it is the default values
|
|
3
|
+
const ukUAPickers = {
|
|
4
|
+
// Calendar navigation
|
|
5
|
+
previousMonth: 'Попередній місяць',
|
|
6
|
+
nextMonth: 'Наступний місяць',
|
|
7
|
+
// View navigation
|
|
8
|
+
openPreviousView: 'відкрити попередній вигляд',
|
|
9
|
+
openNextView: 'відкрити наступний вигляд',
|
|
10
|
+
calendarViewSwitchingButtonAriaLabel: view => view === 'year' ? 'річний вигляд відкрито, перейти до календарного вигляду' : 'календарний вигляд відкрито, перейти до річного вигляду',
|
|
11
|
+
inputModeToggleButtonAriaLabel: (isKeyboardInputOpen, viewType) => isKeyboardInputOpen ? `текстове поле відкрите, перейти до ${viewType} вигляду` : `${viewType} вигляд наразі відкрито, перейти до текстового поля`,
|
|
12
|
+
// DateRange placeholders
|
|
13
|
+
start: 'Початок',
|
|
14
|
+
end: 'Кінець',
|
|
15
|
+
// Action bar
|
|
16
|
+
cancelButtonLabel: 'Відміна',
|
|
17
|
+
clearButtonLabel: 'Очистити',
|
|
18
|
+
okButtonLabel: 'OK',
|
|
19
|
+
todayButtonLabel: 'Сьогодні',
|
|
20
|
+
// Toolbar titles
|
|
21
|
+
datePickerDefaultToolbarTitle: 'Вибрати дату',
|
|
22
|
+
dateTimePickerDefaultToolbarTitle: 'Вибрати дату і час',
|
|
23
|
+
timePickerDefaultToolbarTitle: 'Вибрати час',
|
|
24
|
+
dateRangePickerDefaultToolbarTitle: 'Вибрати календарний період',
|
|
25
|
+
// Clock labels
|
|
26
|
+
clockLabelText: (view, time, adapter) => `Select ${view}. ${time === null ? 'Час не вибраний' : `Вибрано час ${adapter.format(time, 'fullTime')}`}`,
|
|
27
|
+
hoursClockNumberText: hours => `${hours} годин`,
|
|
28
|
+
minutesClockNumberText: minutes => `${minutes} хвилин`,
|
|
29
|
+
secondsClockNumberText: seconds => `${seconds} секунд`,
|
|
30
|
+
// Open picker labels
|
|
31
|
+
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Оберіть дату, обрана дата ${utils.format(value, 'fullDate')}` : 'Оберіть дату',
|
|
32
|
+
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Оберіть час, обраний час ${utils.format(value, 'fullTime')}` : 'Оберіть час',
|
|
33
|
+
// Table labels
|
|
34
|
+
timeTableLabel: 'оберіть час',
|
|
35
|
+
dateTableLabel: 'оберіть дату'
|
|
36
|
+
};
|
|
37
|
+
export const ukUA = getPickersLocalization(ukUAPickers);
|
package/modern/index.js
CHANGED
|
@@ -49,20 +49,24 @@ export const useMaskedInput = ({
|
|
|
49
49
|
|
|
50
50
|
const prevRawValue = React.useRef();
|
|
51
51
|
const prevLocale = React.useRef(utils.locale);
|
|
52
|
+
const prevInputFormat = React.useRef(inputFormat);
|
|
52
53
|
React.useEffect(() => {
|
|
53
54
|
const rawValueHasChanged = rawValue !== prevRawValue.current;
|
|
54
55
|
const localeHasChanged = utils.locale !== prevLocale.current;
|
|
56
|
+
const inputFormatHasChanged = inputFormat !== prevInputFormat.current;
|
|
55
57
|
prevRawValue.current = rawValue;
|
|
56
58
|
prevLocale.current = utils.locale;
|
|
59
|
+
prevInputFormat.current = inputFormat;
|
|
57
60
|
|
|
58
|
-
if (!rawValueHasChanged && !localeHasChanged) {
|
|
61
|
+
if (!rawValueHasChanged && !localeHasChanged && !inputFormatHasChanged) {
|
|
59
62
|
return;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
const newParsedValue = rawValue === null ? null : utils.date(rawValue);
|
|
63
66
|
const isAcceptedValue = rawValue === null || utils.isValid(newParsedValue);
|
|
67
|
+
const innerEqualsParsed = innerInputValue === null ? newParsedValue === null : newParsedValue !== null && Math.abs(utils.getDiff(innerInputValue, newParsedValue, 'seconds')) === 0;
|
|
64
68
|
|
|
65
|
-
if (!localeHasChanged && (!isAcceptedValue ||
|
|
69
|
+
if (!localeHasChanged && !inputFormatHasChanged && (!isAcceptedValue || innerEqualsParsed)) {
|
|
66
70
|
return;
|
|
67
71
|
} // When dev set a new valid value, we trust them
|
|
68
72
|
|
|
@@ -8,7 +8,7 @@ export function arrayIncludes(array, itemOrItems) {
|
|
|
8
8
|
}
|
|
9
9
|
export const onSpaceOrEnter = (innerFn, onFocus) => event => {
|
|
10
10
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
11
|
-
innerFn(); // prevent any side effects
|
|
11
|
+
innerFn(event); // prevent any side effects
|
|
12
12
|
|
|
13
13
|
event.preventDefault();
|
|
14
14
|
event.stopPropagation();
|
package/modern/locales/index.js
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getPickersLocalization } from './utils/getPickersLocalization';
|
|
2
|
+
// This object is not Partial<PickersLocaleText> because it is the default values
|
|
3
|
+
const ukUAPickers = {
|
|
4
|
+
// Calendar navigation
|
|
5
|
+
previousMonth: 'Попередній місяць',
|
|
6
|
+
nextMonth: 'Наступний місяць',
|
|
7
|
+
// View navigation
|
|
8
|
+
openPreviousView: 'відкрити попередній вигляд',
|
|
9
|
+
openNextView: 'відкрити наступний вигляд',
|
|
10
|
+
calendarViewSwitchingButtonAriaLabel: view => view === 'year' ? 'річний вигляд відкрито, перейти до календарного вигляду' : 'календарний вигляд відкрито, перейти до річного вигляду',
|
|
11
|
+
inputModeToggleButtonAriaLabel: (isKeyboardInputOpen, viewType) => isKeyboardInputOpen ? `текстове поле відкрите, перейти до ${viewType} вигляду` : `${viewType} вигляд наразі відкрито, перейти до текстового поля`,
|
|
12
|
+
// DateRange placeholders
|
|
13
|
+
start: 'Початок',
|
|
14
|
+
end: 'Кінець',
|
|
15
|
+
// Action bar
|
|
16
|
+
cancelButtonLabel: 'Відміна',
|
|
17
|
+
clearButtonLabel: 'Очистити',
|
|
18
|
+
okButtonLabel: 'OK',
|
|
19
|
+
todayButtonLabel: 'Сьогодні',
|
|
20
|
+
// Toolbar titles
|
|
21
|
+
datePickerDefaultToolbarTitle: 'Вибрати дату',
|
|
22
|
+
dateTimePickerDefaultToolbarTitle: 'Вибрати дату і час',
|
|
23
|
+
timePickerDefaultToolbarTitle: 'Вибрати час',
|
|
24
|
+
dateRangePickerDefaultToolbarTitle: 'Вибрати календарний період',
|
|
25
|
+
// Clock labels
|
|
26
|
+
clockLabelText: (view, time, adapter) => `Select ${view}. ${time === null ? 'Час не вибраний' : `Вибрано час ${adapter.format(time, 'fullTime')}`}`,
|
|
27
|
+
hoursClockNumberText: hours => `${hours} годин`,
|
|
28
|
+
minutesClockNumberText: minutes => `${minutes} хвилин`,
|
|
29
|
+
secondsClockNumberText: seconds => `${seconds} секунд`,
|
|
30
|
+
// Open picker labels
|
|
31
|
+
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Оберіть дату, обрана дата ${utils.format(value, 'fullDate')}` : 'Оберіть дату',
|
|
32
|
+
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Оберіть час, обраний час ${utils.format(value, 'fullTime')}` : 'Оберіть час',
|
|
33
|
+
// Table labels
|
|
34
|
+
timeTableLabel: 'оберіть час',
|
|
35
|
+
dateTableLabel: 'оберіть дату'
|
|
36
|
+
};
|
|
37
|
+
export const ukUA = getPickersLocalization(ukUAPickers);
|
package/node/index.js
CHANGED
|
@@ -67,20 +67,24 @@ const useMaskedInput = ({
|
|
|
67
67
|
|
|
68
68
|
const prevRawValue = React.useRef();
|
|
69
69
|
const prevLocale = React.useRef(utils.locale);
|
|
70
|
+
const prevInputFormat = React.useRef(inputFormat);
|
|
70
71
|
React.useEffect(() => {
|
|
71
72
|
const rawValueHasChanged = rawValue !== prevRawValue.current;
|
|
72
73
|
const localeHasChanged = utils.locale !== prevLocale.current;
|
|
74
|
+
const inputFormatHasChanged = inputFormat !== prevInputFormat.current;
|
|
73
75
|
prevRawValue.current = rawValue;
|
|
74
76
|
prevLocale.current = utils.locale;
|
|
77
|
+
prevInputFormat.current = inputFormat;
|
|
75
78
|
|
|
76
|
-
if (!rawValueHasChanged && !localeHasChanged) {
|
|
79
|
+
if (!rawValueHasChanged && !localeHasChanged && !inputFormatHasChanged) {
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
const newParsedValue = rawValue === null ? null : utils.date(rawValue);
|
|
81
84
|
const isAcceptedValue = rawValue === null || utils.isValid(newParsedValue);
|
|
85
|
+
const innerEqualsParsed = innerInputValue === null ? newParsedValue === null : newParsedValue !== null && Math.abs(utils.getDiff(innerInputValue, newParsedValue, 'seconds')) === 0;
|
|
82
86
|
|
|
83
|
-
if (!localeHasChanged && (!isAcceptedValue ||
|
|
87
|
+
if (!localeHasChanged && !inputFormatHasChanged && (!isAcceptedValue || innerEqualsParsed)) {
|
|
84
88
|
return;
|
|
85
89
|
} // When dev set a new valid value, we trust them
|
|
86
90
|
|
|
@@ -17,7 +17,7 @@ function arrayIncludes(array, itemOrItems) {
|
|
|
17
17
|
|
|
18
18
|
const onSpaceOrEnter = (innerFn, onFocus) => event => {
|
|
19
19
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
20
|
-
innerFn(); // prevent any side effects
|
|
20
|
+
innerFn(event); // prevent any side effects
|
|
21
21
|
|
|
22
22
|
event.preventDefault();
|
|
23
23
|
event.stopPropagation();
|
package/node/locales/index.js
CHANGED
|
@@ -225,6 +225,19 @@ Object.keys(_jaJP).forEach(function (key) {
|
|
|
225
225
|
});
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
+
var _ukUA = require("./ukUA");
|
|
229
|
+
|
|
230
|
+
Object.keys(_ukUA).forEach(function (key) {
|
|
231
|
+
if (key === "default" || key === "__esModule") return;
|
|
232
|
+
if (key in exports && exports[key] === _ukUA[key]) return;
|
|
233
|
+
Object.defineProperty(exports, key, {
|
|
234
|
+
enumerable: true,
|
|
235
|
+
get: function () {
|
|
236
|
+
return _ukUA[key];
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
228
241
|
var _pickersLocaleTextApi = require("./utils/pickersLocaleTextApi");
|
|
229
242
|
|
|
230
243
|
Object.keys(_pickersLocaleTextApi).forEach(function (key) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ukUA = void 0;
|
|
7
|
+
|
|
8
|
+
var _getPickersLocalization = require("./utils/getPickersLocalization");
|
|
9
|
+
|
|
10
|
+
// This object is not Partial<PickersLocaleText> because it is the default values
|
|
11
|
+
const ukUAPickers = {
|
|
12
|
+
// Calendar navigation
|
|
13
|
+
previousMonth: 'Попередній місяць',
|
|
14
|
+
nextMonth: 'Наступний місяць',
|
|
15
|
+
// View navigation
|
|
16
|
+
openPreviousView: 'відкрити попередній вигляд',
|
|
17
|
+
openNextView: 'відкрити наступний вигляд',
|
|
18
|
+
calendarViewSwitchingButtonAriaLabel: view => view === 'year' ? 'річний вигляд відкрито, перейти до календарного вигляду' : 'календарний вигляд відкрито, перейти до річного вигляду',
|
|
19
|
+
inputModeToggleButtonAriaLabel: (isKeyboardInputOpen, viewType) => isKeyboardInputOpen ? `текстове поле відкрите, перейти до ${viewType} вигляду` : `${viewType} вигляд наразі відкрито, перейти до текстового поля`,
|
|
20
|
+
// DateRange placeholders
|
|
21
|
+
start: 'Початок',
|
|
22
|
+
end: 'Кінець',
|
|
23
|
+
// Action bar
|
|
24
|
+
cancelButtonLabel: 'Відміна',
|
|
25
|
+
clearButtonLabel: 'Очистити',
|
|
26
|
+
okButtonLabel: 'OK',
|
|
27
|
+
todayButtonLabel: 'Сьогодні',
|
|
28
|
+
// Toolbar titles
|
|
29
|
+
datePickerDefaultToolbarTitle: 'Вибрати дату',
|
|
30
|
+
dateTimePickerDefaultToolbarTitle: 'Вибрати дату і час',
|
|
31
|
+
timePickerDefaultToolbarTitle: 'Вибрати час',
|
|
32
|
+
dateRangePickerDefaultToolbarTitle: 'Вибрати календарний період',
|
|
33
|
+
// Clock labels
|
|
34
|
+
clockLabelText: (view, time, adapter) => `Select ${view}. ${time === null ? 'Час не вибраний' : `Вибрано час ${adapter.format(time, 'fullTime')}`}`,
|
|
35
|
+
hoursClockNumberText: hours => `${hours} годин`,
|
|
36
|
+
minutesClockNumberText: minutes => `${minutes} хвилин`,
|
|
37
|
+
secondsClockNumberText: seconds => `${seconds} секунд`,
|
|
38
|
+
// Open picker labels
|
|
39
|
+
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Оберіть дату, обрана дата ${utils.format(value, 'fullDate')}` : 'Оберіть дату',
|
|
40
|
+
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Оберіть час, обраний час ${utils.format(value, 'fullTime')}` : 'Оберіть час',
|
|
41
|
+
// Table labels
|
|
42
|
+
timeTableLabel: 'оберіть час',
|
|
43
|
+
dateTableLabel: 'оберіть дату'
|
|
44
|
+
};
|
|
45
|
+
const ukUA = (0, _getPickersLocalization.getPickersLocalization)(ukUAPickers);
|
|
46
|
+
exports.ukUA = ukUA;
|