@mui/x-date-pickers 5.0.0-alpha.7 → 5.0.0-beta.2
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 +147 -1
- package/CalendarPicker/DayPicker.js +1 -1
- package/README.md +30 -28
- package/index.js +1 -1
- package/internals/components/KeyboardDateInput.js +1 -10
- package/internals/components/PureDateInput.js +1 -6
- package/internals/hooks/useMaskedInput.js +20 -6
- package/legacy/CalendarPicker/DayPicker.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/components/KeyboardDateInput.js +1 -10
- package/legacy/internals/components/PureDateInput.js +1 -6
- package/legacy/internals/hooks/useMaskedInput.js +20 -6
- package/legacy/locales/deDE.js +34 -13
- package/legacy/locales/esES.js +50 -0
- package/legacy/locales/frFR.js +31 -13
- package/legacy/locales/index.js +3 -0
- package/legacy/locales/itIT.js +50 -0
- package/legacy/locales/nbNO.js +44 -0
- package/locales/deDE.d.ts +5 -4
- package/locales/deDE.js +22 -13
- package/locales/esES.d.ts +30 -0
- package/locales/esES.js +36 -0
- package/locales/frFR.d.ts +5 -4
- package/locales/frFR.js +17 -13
- package/locales/index.d.ts +3 -0
- package/locales/index.js +3 -0
- package/locales/itIT.d.ts +30 -0
- package/locales/itIT.js +36 -0
- package/locales/nbNO.d.ts +30 -0
- package/locales/nbNO.js +30 -0
- package/modern/CalendarPicker/DayPicker.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/KeyboardDateInput.js +1 -10
- package/modern/internals/components/PureDateInput.js +1 -6
- package/modern/internals/hooks/useMaskedInput.js +20 -6
- package/modern/locales/deDE.js +18 -13
- package/modern/locales/esES.js +36 -0
- package/modern/locales/frFR.js +17 -13
- package/modern/locales/index.js +3 -0
- package/modern/locales/itIT.js +36 -0
- package/modern/locales/nbNO.js +30 -0
- package/node/CalendarPicker/DayPicker.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/KeyboardDateInput.js +1 -11
- package/node/internals/components/PureDateInput.js +1 -7
- package/node/internals/hooks/useMaskedInput.js +20 -6
- package/node/locales/deDE.js +21 -12
- package/node/locales/esES.js +45 -0
- package/node/locales/frFR.js +16 -12
- package/node/locales/index.js +39 -0
- package/node/locales/itIT.js +45 -0
- package/node/locales/nbNO.js +39 -0
- package/package.json +6 -4
- package/themeAugmentation/components.d.ts +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,152 @@
|
|
|
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.14.0
|
|
7
|
+
|
|
8
|
+
_Jul 21, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🧪 Export `GridBooleanCell` component from data grid (#5537) @cliedeman
|
|
13
|
+
- ⚙️ Improve accessibility of the Export menu (#5486) @nogalpaulina
|
|
14
|
+
- 🌍 Improvements to different locales
|
|
15
|
+
- 📚 Documentation improvements
|
|
16
|
+
- 🐞 Bugfixes
|
|
17
|
+
|
|
18
|
+
### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
|
|
19
|
+
|
|
20
|
+
#### Changes
|
|
21
|
+
|
|
22
|
+
- [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
|
|
23
|
+
- [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
|
|
24
|
+
- [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
|
|
25
|
+
- [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
|
|
26
|
+
- [DataGrid] Fix loading overlay position (#5558) @DanailH
|
|
27
|
+
- [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
|
|
28
|
+
- [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
|
|
29
|
+
- [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
|
|
30
|
+
- [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
|
|
31
|
+
|
|
32
|
+
### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
|
|
33
|
+
|
|
34
|
+
#### Changes
|
|
35
|
+
|
|
36
|
+
- [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
|
|
37
|
+
|
|
38
|
+
### Docs
|
|
39
|
+
|
|
40
|
+
- [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
|
|
41
|
+
- [docs] Remove blank line @oliviertassinari
|
|
42
|
+
|
|
43
|
+
### Core
|
|
44
|
+
|
|
45
|
+
- [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
|
|
46
|
+
- [core] Polish on the bug issue template (#5525) @oliviertassinari
|
|
47
|
+
- [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
|
|
48
|
+
|
|
49
|
+
## 5.13.1
|
|
50
|
+
|
|
51
|
+
_Jul 15, 2022_
|
|
52
|
+
|
|
53
|
+
We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
54
|
+
|
|
55
|
+
- ✏️ Enter edit mode when pasting in a cell with Ctrl+V (Cmd+V on macOS) (#5405) @alexfauquette
|
|
56
|
+
- 🌍 Many improvements to the locales
|
|
57
|
+
- 📚 Documentation improvements
|
|
58
|
+
- 🐞 Bugfixes
|
|
59
|
+
|
|
60
|
+
### `@mui/x-data-grid@v5.13.1` / `@mui/x-data-grid-pro@v5.13.1` / `@mui/x-data-grid-premium@v5.13.1`
|
|
61
|
+
|
|
62
|
+
#### Changes
|
|
63
|
+
|
|
64
|
+
- [DataGrid] Fix blank space when using dynamic row height with pagination (#5315) @m4theushw
|
|
65
|
+
- [DataGrid] Start editing with uppercase letter and Ctrl+V (#5405) @alexfauquette
|
|
66
|
+
- [DataGrid] Fix some filters being removed from filter model on filter panel open (#5403) @cherniavskii
|
|
67
|
+
- [DataGridPro] Improve pinned column headers accessibility (#5370) @cherniavskii
|
|
68
|
+
- [l10n] Improve Dutch (nl-NL) locale (#5464) @developenguin
|
|
69
|
+
- [l10n] Improve French (fr-FR) locale (#3211) (#5420) @Zenoo
|
|
70
|
+
- [l10n] Improve German (de-DE) locale (#5448) @sebastianfrey
|
|
71
|
+
- [l10n] Improve Brazilian Portuguese (pt-BR) locale (#5394) @andrepxa
|
|
72
|
+
- [l10n] Improve Romanian (ro-RO) locale (#5449) @rolule
|
|
73
|
+
|
|
74
|
+
### `@mui/x-date-pickers@v5.0.0-beta.1` / `@mui/x-date-picker-pro@5.0.0-beta.1`
|
|
75
|
+
|
|
76
|
+
#### Changes
|
|
77
|
+
|
|
78
|
+
- [pickers] Add Italian (it-IT) locale (#5467) @felixh10r
|
|
79
|
+
- [pickers] Add Spanish (es-ES) locale (#5468) @felixh10r
|
|
80
|
+
- [pickers] Improve French (fr-FR) locale (#5446) @Zenoo
|
|
81
|
+
- [pickers] Improve German (de-DE) locale (#5447) @sebastianfrey
|
|
82
|
+
|
|
83
|
+
### Docs
|
|
84
|
+
|
|
85
|
+
- [docs] Fix typo in the sorting page (#5431) @JosephMarinier
|
|
86
|
+
- [docs] Fix description for "Striped rows" example (#5432) @lindapaiste
|
|
87
|
+
- [docs] Make a clear difference between the license and license key (#5316) @oliviertassinari
|
|
88
|
+
- [docs] Update pickers README files (#5456) @cherniavskii
|
|
89
|
+
- [docs] Clarify the scope of support for MUI X (#5423) @joserodolfofreitas
|
|
90
|
+
|
|
91
|
+
### Core
|
|
92
|
+
|
|
93
|
+
- [core] Add technical support link to \_redirects (#5428) @joserodolfofreitas
|
|
94
|
+
- [core] Improve GitHub bug reproduction template (#5067) @joserodolfofreitas
|
|
95
|
+
- [core] Include playground pages in tsconfig (#5367) @cherniavskii
|
|
96
|
+
- [core] Sort keys like in material-ui @oliviertassinari
|
|
97
|
+
- [test] Wait for flags to load on regression tests (#5473) @m4theushw
|
|
98
|
+
|
|
99
|
+
## 5.13.0
|
|
100
|
+
|
|
101
|
+
_Jul 7, 2022_
|
|
102
|
+
|
|
103
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
104
|
+
|
|
105
|
+
- 🎁 `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` are now in beta!
|
|
106
|
+
|
|
107
|
+
- ✨ Allow detail panel's height to match its content (#5163) @m4theushw
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<DataGridPro getDetailPanelHeight={() => 'auto'} />
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- 🌍 Add Romanian (ro-RO) locale on the data grid (#5345) @rolule
|
|
114
|
+
- 📚 Documentation improvements
|
|
115
|
+
- 🐞 Bugfixes
|
|
116
|
+
|
|
117
|
+
### `@mui/x-data-grid@v5.13.0` / `@mui/x-data-grid-pro@v5.13.0` / `@mui/x-data-grid-premium@v5.13.0`
|
|
118
|
+
|
|
119
|
+
#### Changes
|
|
120
|
+
|
|
121
|
+
- [DataGrid] Allows to customize variant of value input in filter panel (#4826) @alexfauquette
|
|
122
|
+
- [DataGrid] Add Romanian (ro-RO) locale (#5345) @rolule
|
|
123
|
+
- [DataGrid] Export Norwegian (nb-NO) locale (#5407) @cherniavskii
|
|
124
|
+
- [DataGrid] Fix broken "start editing" integration with Japanese (#5414) @mnajdova
|
|
125
|
+
- [DataGrid] Fix "stop editing" integration with IME e.g. Japanese (#5257) @Gumichocopengin8
|
|
126
|
+
- [DataGrid] Fix dimensions computation with `autoHeight` and scroll x (#5401) @flaviendelangle
|
|
127
|
+
- [DataGrid] Improve Slovak (sk-SK) locale (#5332) @msidlo
|
|
128
|
+
- [DataGrid] Mention Premium plan in error messages and docs warnings (#5328) @cherniavskii
|
|
129
|
+
- [DataGrid] Remove trailing spaces in filter input (#5279) @alexfauquette
|
|
130
|
+
- [DataGridPro] Allow to infer detail panel height from content (#5163) @m4theushw
|
|
131
|
+
- [DataGridPro] Fix the depth of nodes when switching from a non-flat tree to a flat tree (#5362) @flaviendelangle
|
|
132
|
+
|
|
133
|
+
### `@mui/x-date-pickers@v5.0.0-beta.0` / `@mui/x-date-picker-pro@5.0.0-beta.0`
|
|
134
|
+
|
|
135
|
+
#### Changes
|
|
136
|
+
|
|
137
|
+
- [DateRangePicker] Fix keyboard selection (#5265) @alexfauquette
|
|
138
|
+
- [DayPicker] Remove empty space at the bottom of the day view (#5073) @flaviendelangle
|
|
139
|
+
- [pickers] Add missing type dependencies (#5331) @Methuselah96
|
|
140
|
+
- [pickers] Pass the generics to the components in the theme augmentation (#5199) @toruticas
|
|
141
|
+
|
|
142
|
+
### Docs
|
|
143
|
+
|
|
144
|
+
- [docs] Explain how to use hooks inside a cell renderer (#5158) @flaviendelangle
|
|
145
|
+
- [docs] Fix server-side pagination demo (#5361) @cherniavskii
|
|
146
|
+
- [docs] Fix typo in the quick filter docs (#5313) @alexfauquette
|
|
147
|
+
- [docs] Improve the "Getting started" page (#5293) @alexfauquette
|
|
148
|
+
- [docs] New page for the pickers action bar customization (#5267) @flaviendelangle
|
|
149
|
+
- [docs] Revise and split up "Overview" page into "Introduction" (#4692) @samuelsycamore
|
|
150
|
+
- [docs] Use `useKeepGroupedColumnsHiddren` from the grid package on remaining demo (#5382) @flaviendelangle
|
|
151
|
+
|
|
6
152
|
## v5.12.3
|
|
7
153
|
|
|
8
154
|
_Jun 23, 2022_
|
|
@@ -1363,7 +1509,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
|
|
|
1363
1509
|
- [core] Fix `yarn prettier` script (#3292) @oliviertassinari
|
|
1364
1510
|
- [core] Improve tests for Tree Data (#3366) @flaviendelangle
|
|
1365
1511
|
- [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
|
|
1366
|
-
- [core] Transition to a new
|
|
1512
|
+
- [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
|
|
1367
1513
|
- [core] Update monorepo (#3370) @flaviendelangle
|
|
1368
1514
|
- [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
|
|
1369
1515
|
- [test] Replace `useFakeTimers` (#3323) @m4theushw
|
|
@@ -9,7 +9,7 @@ import { PickersSlideTransition } from './PickersSlideTransition';
|
|
|
9
9
|
import { useIsDayDisabled } from '../internals/hooks/validation/useDateValidation';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const weeksContainerHeight = (DAY_SIZE + DAY_MARGIN *
|
|
12
|
+
const weeksContainerHeight = (DAY_SIZE + DAY_MARGIN * 2) * 6;
|
|
13
13
|
const PickersCalendarDayHeader = styled('div')({
|
|
14
14
|
display: 'flex',
|
|
15
15
|
justifyContent: 'center',
|
package/README.md
CHANGED
|
@@ -8,11 +8,26 @@ It's part of MUI X, an open core extension of MUI, with advanced components.
|
|
|
8
8
|
Install the package in your project directory with:
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
// with npm
|
|
12
11
|
npm install @mui/x-date-pickers
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Then install the date library of your choice (if not already installed).
|
|
15
|
+
We currently support 4 different date-libraries:
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
- [date-fns](https://date-fns.org/)
|
|
18
|
+
- [Day.js](https://day.js.org/)
|
|
19
|
+
- [Luxon](https://moment.github.io/luxon/#/)
|
|
20
|
+
- [Moment.js](https://momentjs.com/)
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
// date-fns
|
|
24
|
+
npm install date-fns
|
|
25
|
+
// or dayjs
|
|
26
|
+
npm install dayjs
|
|
27
|
+
// or luxon
|
|
28
|
+
npm install luxon
|
|
29
|
+
// or moment
|
|
30
|
+
npm install moment
|
|
16
31
|
```
|
|
17
32
|
|
|
18
33
|
This component has the following peer dependencies that you will need to install as well.
|
|
@@ -25,40 +40,27 @@ This component has the following peer dependencies that you will need to install
|
|
|
25
40
|
},
|
|
26
41
|
```
|
|
27
42
|
|
|
28
|
-
You need to provide a date-library that is used by the pickers by setting the `dateAdapter` to an adapter of your choosing.
|
|
29
|
-
|
|
30
|
-
We currently support 4 different date-libraries:
|
|
31
|
-
|
|
32
|
-
- [date-fns](https://date-fns.org/)
|
|
33
|
-
- [Day.js](https://day.js.org/)
|
|
34
|
-
- [Luxon](https://moment.github.io/luxon/#/)
|
|
35
|
-
- [Moment.js](https://momentjs.com/)
|
|
36
|
-
|
|
37
43
|
If you need to use `js-joda`, `date-fns-jalali`, `jalaali`, or `hijri` library, you should be able to find the corresponding date-library from [`@date-io`](https://github.com/dmtrKovalenko/date-io#projects).
|
|
44
|
+
In such a case, you will have to install both the date-library and the corresponding @date-io adapter.
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
npm install @date-io/date-fns
|
|
44
|
-
// or for Day.js
|
|
45
|
-
npm install @date-io/dayjs
|
|
46
|
-
// or for Luxon
|
|
47
|
-
npm install @date-io/luxon
|
|
48
|
-
// or for Moment.js
|
|
49
|
-
npm install @date-io/moment
|
|
46
|
+
```jsx
|
|
47
|
+
// To use moment-jalaali
|
|
48
|
+
npm install moment-jalaali
|
|
49
|
+
npm install @date-io/jalaali
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
After installation completed, you have to set the `dateAdapter` prop of the `LocalizationProvider` accordingly.
|
|
53
|
+
The supported adapters are exported from `@mui/x-date-pickers`.
|
|
53
54
|
|
|
54
|
-
```
|
|
55
|
+
```jsx
|
|
56
|
+
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
55
57
|
// date-fns
|
|
56
58
|
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
57
|
-
// or for
|
|
59
|
+
// or for dayjs
|
|
58
60
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
59
|
-
// or for
|
|
61
|
+
// or for luxon
|
|
60
62
|
import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
|
|
61
|
-
// or for
|
|
63
|
+
// or for moment
|
|
62
64
|
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
63
65
|
|
|
64
66
|
function App({ children }) {
|
package/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["components", "disableOpenPicker", "getOpenDialogAriaText", "InputAdornmentProps", "InputProps", "inputRef", "openPicker", "OpenPickerButtonProps", "renderInput"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import IconButton from '@mui/material/IconButton';
|
|
7
6
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
8
7
|
import { useLocaleText, useUtils } from '../hooks/useUtils';
|
|
@@ -48,12 +47,4 @@ export const KeyboardDateInput = /*#__PURE__*/React.forwardRef(function Keyboard
|
|
|
48
47
|
}))
|
|
49
48
|
})
|
|
50
49
|
}));
|
|
51
|
-
});
|
|
52
|
-
process.env.NODE_ENV !== "production" ? KeyboardDateInput.propTypes = {
|
|
53
|
-
acceptRegex: PropTypes.instanceOf(RegExp),
|
|
54
|
-
getOpenDialogAriaText: PropTypes.func,
|
|
55
|
-
mask: PropTypes.string,
|
|
56
|
-
OpenPickerButtonProps: PropTypes.object,
|
|
57
|
-
renderInput: PropTypes.func.isRequired,
|
|
58
|
-
rifmFormatter: PropTypes.func
|
|
59
|
-
} : void 0;
|
|
50
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { onSpaceOrEnter } from '../utils/utils';
|
|
5
4
|
import { useLocaleText, useUtils } from '../hooks/useUtils';
|
|
6
5
|
import { getDisplayDate } from '../utils/text-field-helper';
|
|
@@ -47,8 +46,4 @@ export const PureDateInput = /*#__PURE__*/React.forwardRef(function PureDateInpu
|
|
|
47
46
|
onKeyDown: onSpaceOrEnter(onOpen)
|
|
48
47
|
})
|
|
49
48
|
}, TextFieldProps));
|
|
50
|
-
});
|
|
51
|
-
PureDateInput.propTypes = {
|
|
52
|
-
getOpenDialogAriaText: PropTypes.func,
|
|
53
|
-
renderInput: PropTypes.func.isRequired
|
|
54
|
-
};
|
|
49
|
+
});
|
|
@@ -45,15 +45,29 @@ export const useMaskedInput = ({
|
|
|
45
45
|
|
|
46
46
|
const [innerInputValue, setInnerInputValue] = React.useState(parsedValue); // control the input text
|
|
47
47
|
|
|
48
|
-
const [innerDisplayedInputValue, setInnerDisplayedInputValue] = React.useState(getDisplayDate(utils, rawValue, inputFormat));
|
|
49
|
-
|
|
48
|
+
const [innerDisplayedInputValue, setInnerDisplayedInputValue] = React.useState(getDisplayDate(utils, rawValue, inputFormat)); // Inspired from autocomplete: https://github.com/mui/material-ui/blob/2c89d036dc2e16f100528f161600dffc83241768/packages/mui-base/src/AutocompleteUnstyled/useAutocomplete.js#L185:L201
|
|
49
|
+
|
|
50
|
+
const prevRawValue = React.useRef();
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
const rawValueChange = rawValue !== prevRawValue.current;
|
|
53
|
+
prevRawValue.current = rawValue;
|
|
54
|
+
|
|
55
|
+
if (!rawValueChange) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const newParsedValue = rawValue === null ? null : utils.date(rawValue);
|
|
60
|
+
const isAcceptedValue = rawValue === null || utils.isValid(newParsedValue);
|
|
61
|
+
|
|
62
|
+
if (!isAcceptedValue || utils.isEqual(innerInputValue, newParsedValue)) {
|
|
63
|
+
return;
|
|
64
|
+
} // When dev set a new valid value, we trust them
|
|
65
|
+
|
|
50
66
|
|
|
51
|
-
if (isAcceptedValue && !utils.isEqual(innerInputValue, parsedValue)) {
|
|
52
|
-
// When dev set a new valid value, we trust them
|
|
53
67
|
const newDisplayDate = getDisplayDate(utils, rawValue, inputFormat);
|
|
54
|
-
setInnerInputValue(
|
|
68
|
+
setInnerInputValue(newParsedValue);
|
|
55
69
|
setInnerDisplayedInputValue(newDisplayDate);
|
|
56
|
-
}
|
|
70
|
+
}, [utils, rawValue, inputFormat, innerInputValue]);
|
|
57
71
|
|
|
58
72
|
const handleChange = text => {
|
|
59
73
|
const finalString = text === '' || text === mask ? '' : text;
|
|
@@ -9,7 +9,7 @@ import { PickersSlideTransition } from './PickersSlideTransition';
|
|
|
9
9
|
import { useIsDayDisabled } from '../internals/hooks/validation/useDateValidation';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
var weeksContainerHeight = (DAY_SIZE + DAY_MARGIN *
|
|
12
|
+
var weeksContainerHeight = (DAY_SIZE + DAY_MARGIN * 2) * 6;
|
|
13
13
|
var PickersCalendarDayHeader = styled('div')({
|
|
14
14
|
display: 'flex',
|
|
15
15
|
justifyContent: 'center',
|
package/legacy/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["components", "disableOpenPicker", "getOpenDialogAriaText", "InputAdornmentProps", "InputProps", "inputRef", "openPicker", "OpenPickerButtonProps", "renderInput"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
6
|
import IconButton from '@mui/material/IconButton';
|
|
8
7
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
9
8
|
import { useLocaleText, useUtils } from '../hooks/useUtils';
|
|
@@ -46,12 +45,4 @@ export var KeyboardDateInput = /*#__PURE__*/React.forwardRef(function KeyboardDa
|
|
|
46
45
|
}))
|
|
47
46
|
}))))
|
|
48
47
|
}));
|
|
49
|
-
});
|
|
50
|
-
process.env.NODE_ENV !== "production" ? KeyboardDateInput.propTypes = {
|
|
51
|
-
acceptRegex: PropTypes.instanceOf(RegExp),
|
|
52
|
-
getOpenDialogAriaText: PropTypes.func,
|
|
53
|
-
mask: PropTypes.string,
|
|
54
|
-
OpenPickerButtonProps: PropTypes.object,
|
|
55
|
-
renderInput: PropTypes.func.isRequired,
|
|
56
|
-
rifmFormatter: PropTypes.func
|
|
57
|
-
} : void 0;
|
|
48
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { onSpaceOrEnter } from '../utils/utils';
|
|
5
4
|
import { useLocaleText, useUtils } from '../hooks/useUtils';
|
|
6
5
|
import { getDisplayDate } from '../utils/text-field-helper';
|
|
@@ -48,8 +47,4 @@ export var PureDateInput = /*#__PURE__*/React.forwardRef(function PureDateInput(
|
|
|
48
47
|
onKeyDown: onSpaceOrEnter(onOpen)
|
|
49
48
|
})
|
|
50
49
|
}, TextFieldProps));
|
|
51
|
-
});
|
|
52
|
-
PureDateInput.propTypes = {
|
|
53
|
-
getOpenDialogAriaText: PropTypes.func,
|
|
54
|
-
renderInput: PropTypes.func.isRequired
|
|
55
|
-
};
|
|
50
|
+
});
|
|
@@ -58,16 +58,30 @@ export var useMaskedInput = function useMaskedInput(_ref) {
|
|
|
58
58
|
var _React$useState3 = React.useState(getDisplayDate(utils, rawValue, inputFormat)),
|
|
59
59
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
60
60
|
innerDisplayedInputValue = _React$useState4[0],
|
|
61
|
-
setInnerDisplayedInputValue = _React$useState4[1];
|
|
61
|
+
setInnerDisplayedInputValue = _React$useState4[1]; // Inspired from autocomplete: https://github.com/mui/material-ui/blob/2c89d036dc2e16f100528f161600dffc83241768/packages/mui-base/src/AutocompleteUnstyled/useAutocomplete.js#L185:L201
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
var prevRawValue = React.useRef();
|
|
65
|
+
React.useEffect(function () {
|
|
66
|
+
var rawValueChange = rawValue !== prevRawValue.current;
|
|
67
|
+
prevRawValue.current = rawValue;
|
|
68
|
+
|
|
69
|
+
if (!rawValueChange) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var newParsedValue = rawValue === null ? null : utils.date(rawValue);
|
|
74
|
+
var isAcceptedValue = rawValue === null || utils.isValid(newParsedValue);
|
|
75
|
+
|
|
76
|
+
if (!isAcceptedValue || utils.isEqual(innerInputValue, newParsedValue)) {
|
|
77
|
+
return;
|
|
78
|
+
} // When dev set a new valid value, we trust them
|
|
62
79
|
|
|
63
|
-
var isAcceptedValue = rawValue === null || utils.isValid(parsedValue);
|
|
64
80
|
|
|
65
|
-
if (isAcceptedValue && !utils.isEqual(innerInputValue, parsedValue)) {
|
|
66
|
-
// When dev set a new valid value, we trust them
|
|
67
81
|
var newDisplayDate = getDisplayDate(utils, rawValue, inputFormat);
|
|
68
|
-
setInnerInputValue(
|
|
82
|
+
setInnerInputValue(newParsedValue);
|
|
69
83
|
setInnerDisplayedInputValue(newDisplayDate);
|
|
70
|
-
}
|
|
84
|
+
}, [utils, rawValue, inputFormat, innerInputValue]);
|
|
71
85
|
|
|
72
86
|
var handleChange = function handleChange(text) {
|
|
73
87
|
var finalString = text === '' || text === mask ? '' : text;
|
package/legacy/locales/deDE.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { getPickersLocalization } from './utils/getPickersLocalization';
|
|
2
|
-
|
|
1
|
+
import { getPickersLocalization } from './utils/getPickersLocalization';
|
|
2
|
+
// maps ClockPickerView to its translation
|
|
3
|
+
var views = {
|
|
4
|
+
hours: 'Stunden',
|
|
5
|
+
minutes: 'Minuten',
|
|
6
|
+
seconds: 'Sekunden'
|
|
7
|
+
};
|
|
3
8
|
var deDEPickers = {
|
|
4
9
|
// Calendar navigation
|
|
5
10
|
previousMonth: 'Letzter Monat',
|
|
@@ -7,7 +12,9 @@ var deDEPickers = {
|
|
|
7
12
|
// View navigation
|
|
8
13
|
openPreviousView: 'Letzte Ansicht öffnen',
|
|
9
14
|
openNextView: 'Nächste Ansicht öffnen',
|
|
10
|
-
|
|
15
|
+
calendarViewSwitchingButtonAriaLabel: function calendarViewSwitchingButtonAriaLabel(view) {
|
|
16
|
+
return view === 'year' ? 'Jahresansicht ist geöffnet, zur Kalenderansicht wechseln' : 'Kalenderansicht ist geöffnet, zur Jahresansicht wechseln';
|
|
17
|
+
},
|
|
11
18
|
// DateRange placeholders
|
|
12
19
|
start: 'Beginn',
|
|
13
20
|
end: 'Ende',
|
|
@@ -15,17 +22,31 @@ var deDEPickers = {
|
|
|
15
22
|
cancelButtonLabel: 'Abbrechen',
|
|
16
23
|
clearButtonLabel: 'Löschen',
|
|
17
24
|
okButtonLabel: 'OK',
|
|
18
|
-
todayButtonLabel: 'Heute'
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
todayButtonLabel: 'Heute',
|
|
26
|
+
// Clock labels
|
|
27
|
+
clockLabelText: function clockLabelText(view, time, adapter) {
|
|
28
|
+
var _views$view;
|
|
29
|
+
|
|
30
|
+
return "".concat((_views$view = views[view]) != null ? _views$view : view, " ausw\xE4hlen. ").concat(time === null ? 'Keine Uhrzeit ausgewählt' : "Gew\xE4hlte Uhrzeit ist ".concat(adapter.format(time, 'fullTime')));
|
|
31
|
+
},
|
|
32
|
+
hoursClockNumberText: function hoursClockNumberText(hours) {
|
|
33
|
+
return "".concat(hours, " ").concat(views.hours);
|
|
34
|
+
},
|
|
35
|
+
minutesClockNumberText: function minutesClockNumberText(minutes) {
|
|
36
|
+
return "".concat(minutes, " ").concat(views.minutes);
|
|
37
|
+
},
|
|
38
|
+
secondsClockNumberText: function secondsClockNumberText(seconds) {
|
|
39
|
+
return "".concat(seconds, " ").concat(views.seconds);
|
|
40
|
+
},
|
|
23
41
|
// Open picker labels
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
openDatePickerDialogue: function openDatePickerDialogue(rawValue, utils) {
|
|
43
|
+
return rawValue && utils.isValid(utils.date(rawValue)) ? "Datum ausw\xE4hlen, gew\xE4hltes Datum ist ".concat(utils.format(utils.date(rawValue), 'fullDate')) : 'Datum auswählen';
|
|
44
|
+
},
|
|
45
|
+
openTimePickerDialogue: function openTimePickerDialogue(rawValue, utils) {
|
|
46
|
+
return rawValue && utils.isValid(utils.date(rawValue)) ? "Uhrzeit ausw\xE4hlen, gew\xE4hlte Uhrzeit ist ".concat(utils.format(utils.date(rawValue), 'fullTime')) : 'Uhrzeit auswählen';
|
|
47
|
+
},
|
|
26
48
|
// Table labels
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
49
|
+
timeTableLabel: 'Uhrzeit auswählen',
|
|
50
|
+
dateTableLabel: 'Datum auswählen'
|
|
30
51
|
};
|
|
31
52
|
export var deDE = getPickersLocalization(deDEPickers);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getPickersLocalization } from './utils/getPickersLocalization';
|
|
2
|
+
var views = {
|
|
3
|
+
hours: 'las horas',
|
|
4
|
+
minutes: 'los minutos',
|
|
5
|
+
seconds: 'los segundos'
|
|
6
|
+
}; // This object is not Partial<PickersLocaleText> because it is the default values
|
|
7
|
+
|
|
8
|
+
var esESPickers = {
|
|
9
|
+
// Calendar navigation
|
|
10
|
+
previousMonth: 'Último mes',
|
|
11
|
+
nextMonth: 'Próximo mes',
|
|
12
|
+
// View navigation
|
|
13
|
+
openPreviousView: 'abrir la última vista',
|
|
14
|
+
openNextView: 'abrir la siguiente vista',
|
|
15
|
+
calendarViewSwitchingButtonAriaLabel: function calendarViewSwitchingButtonAriaLabel(view) {
|
|
16
|
+
return view === 'year' ? 'la vista del año está abierta, cambie a la vista de calendario' : 'la vista de calendario está abierta, cambie a la vista del año';
|
|
17
|
+
},
|
|
18
|
+
// DateRange placeholders
|
|
19
|
+
start: 'Empezar',
|
|
20
|
+
end: 'Terminar',
|
|
21
|
+
// Action bar
|
|
22
|
+
cancelButtonLabel: 'Cancelar',
|
|
23
|
+
clearButtonLabel: 'Limpia',
|
|
24
|
+
okButtonLabel: 'OK',
|
|
25
|
+
todayButtonLabel: 'Hoy',
|
|
26
|
+
// Clock labels
|
|
27
|
+
clockLabelText: function clockLabelText(view, time, adapter) {
|
|
28
|
+
return "Seleccione ".concat(views[view], ". ").concat(time === null ? 'Sin tiempo seleccionado' : "El tiempo seleccionado es ".concat(adapter.format(time, 'fullTime')));
|
|
29
|
+
},
|
|
30
|
+
hoursClockNumberText: function hoursClockNumberText(hours) {
|
|
31
|
+
return "".concat(hours, " horas");
|
|
32
|
+
},
|
|
33
|
+
minutesClockNumberText: function minutesClockNumberText(minutes) {
|
|
34
|
+
return "".concat(minutes, " minutos");
|
|
35
|
+
},
|
|
36
|
+
secondsClockNumberText: function secondsClockNumberText(seconds) {
|
|
37
|
+
return "".concat(seconds, " segundos");
|
|
38
|
+
},
|
|
39
|
+
// Open picker labels
|
|
40
|
+
openDatePickerDialogue: function openDatePickerDialogue(rawValue, utils) {
|
|
41
|
+
return rawValue && utils.isValid(utils.date(rawValue)) ? "Elige la fecha, la fecha elegida es ".concat(utils.format(utils.date(rawValue), 'fullDate')) : 'Elige la fecha';
|
|
42
|
+
},
|
|
43
|
+
openTimePickerDialogue: function openTimePickerDialogue(rawValue, utils) {
|
|
44
|
+
return rawValue && utils.isValid(utils.date(rawValue)) ? "Elige la hora, la hora elegido es ".concat(utils.format(utils.date(rawValue), 'fullTime')) : 'Elige la hora';
|
|
45
|
+
},
|
|
46
|
+
// Table labels
|
|
47
|
+
timeTableLabel: 'elige la fecha',
|
|
48
|
+
dateTableLabel: 'elige la hora'
|
|
49
|
+
};
|
|
50
|
+
export var esES = getPickersLocalization(esESPickers);
|
package/legacy/locales/frFR.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { getPickersLocalization } from './utils/getPickersLocalization';
|
|
2
|
-
|
|
1
|
+
import { getPickersLocalization } from './utils/getPickersLocalization';
|
|
2
|
+
var views = {
|
|
3
|
+
hours: 'heures',
|
|
4
|
+
minutes: 'minutes',
|
|
5
|
+
seconds: 'secondes'
|
|
6
|
+
};
|
|
3
7
|
var frFRPickers = {
|
|
4
8
|
// Calendar navigation
|
|
5
9
|
previousMonth: 'Mois précédent',
|
|
@@ -7,7 +11,9 @@ var frFRPickers = {
|
|
|
7
11
|
// View navigation
|
|
8
12
|
openPreviousView: 'Ouvrir la vue précédente',
|
|
9
13
|
openNextView: 'Ouvrir la vue suivante',
|
|
10
|
-
|
|
14
|
+
calendarViewSwitchingButtonAriaLabel: function calendarViewSwitchingButtonAriaLabel(view) {
|
|
15
|
+
return view === 'year' ? 'La vue année est ouverte, ouvrir la vue calendrier' : 'La vue calendrier est ouverte, ouvrir la vue année';
|
|
16
|
+
},
|
|
11
17
|
// DateRange placeholders
|
|
12
18
|
start: 'Début',
|
|
13
19
|
end: 'Fin',
|
|
@@ -15,17 +21,29 @@ var frFRPickers = {
|
|
|
15
21
|
cancelButtonLabel: 'Annuler',
|
|
16
22
|
clearButtonLabel: 'Vider',
|
|
17
23
|
okButtonLabel: 'OK',
|
|
18
|
-
todayButtonLabel: "Aujourd'hui"
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
todayButtonLabel: "Aujourd'hui",
|
|
25
|
+
// Clock labels
|
|
26
|
+
clockLabelText: function clockLabelText(view, time, adapter) {
|
|
27
|
+
return "Choix des ".concat(views[view], ". ").concat(time === null ? 'Aucune heure choisie' : "L'heure choisie est ".concat(adapter.format(time, 'fullTime')));
|
|
28
|
+
},
|
|
29
|
+
hoursClockNumberText: function hoursClockNumberText(hours) {
|
|
30
|
+
return "".concat(hours, " heures");
|
|
31
|
+
},
|
|
32
|
+
minutesClockNumberText: function minutesClockNumberText(minutes) {
|
|
33
|
+
return "".concat(minutes, " minutes");
|
|
34
|
+
},
|
|
35
|
+
secondsClockNumberText: function secondsClockNumberText(seconds) {
|
|
36
|
+
return "".concat(seconds, " secondes");
|
|
37
|
+
},
|
|
23
38
|
// Open picker labels
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
openDatePickerDialogue: function openDatePickerDialogue(rawValue, utils) {
|
|
40
|
+
return rawValue && utils.isValid(utils.date(rawValue)) ? "Choisir la date, la date s\xE9lectionn\xE9e est ".concat(utils.format(utils.date(rawValue), 'fullDate')) : 'Choisir la date';
|
|
41
|
+
},
|
|
42
|
+
openTimePickerDialogue: function openTimePickerDialogue(rawValue, utils) {
|
|
43
|
+
return rawValue && utils.isValid(utils.date(rawValue)) ? "Choisir l'heure, l'heure s\xE9lectionn\xE9e est ".concat(utils.format(utils.date(rawValue), 'fullTime')) : "Choisir l'heure";
|
|
44
|
+
},
|
|
26
45
|
// Table labels
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
46
|
+
timeTableLabel: "choix de l'heure",
|
|
47
|
+
dateTableLabel: 'choix de la date'
|
|
30
48
|
};
|
|
31
49
|
export var frFR = getPickersLocalization(frFRPickers);
|
package/legacy/locales/index.js
CHANGED
|
@@ -2,7 +2,10 @@ export * from './nlNL';
|
|
|
2
2
|
export * from './ptBR';
|
|
3
3
|
export * from './trTR';
|
|
4
4
|
export * from './deDE';
|
|
5
|
+
export * from './esES';
|
|
5
6
|
export * from './frFR';
|
|
6
7
|
export * from './enUS';
|
|
8
|
+
export * from './nbNO';
|
|
7
9
|
export * from './svSE';
|
|
10
|
+
export * from './itIT';
|
|
8
11
|
export * from './utils/pickersLocaleTextApi';
|