@mui/x-date-pickers-pro 7.0.0-beta.7 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +195 -12
- package/DateRangeCalendar/DateRangeCalendar.js +17 -22
- package/DateRangeCalendar/useDragRange.js +1 -2
- package/DateRangePicker/DateRangePicker.js +1 -1
- package/DateRangePicker/shared.js +3 -5
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +10 -0
- package/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +4 -5
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +2 -3
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +2 -2
- package/DateTimeRangePicker/shared.d.ts +5 -4
- package/DateTimeRangePicker/shared.js +9 -10
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -10
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +10 -0
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +31 -28
- package/MobileDateRangePicker/MobileDateRangePicker.js +5 -9
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +10 -0
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -14
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -15
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -15
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -14
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -1
- package/README.md +1 -1
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +8 -4
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +8 -4
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +7 -3
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
- package/StaticDateRangePicker/StaticDateRangePicker.js +4 -5
- package/index.js +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -11
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +25 -31
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -10
- package/internals/hooks/useMultiInputFieldSelectedSections.js +3 -6
- package/internals/hooks/useRangePosition.js +3 -5
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -18
- package/internals/models/dateRange.d.ts +3 -3
- package/internals/models/dateTimeRange.d.ts +2 -2
- package/internals/models/timeRange.d.ts +2 -2
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/validation/validateDateRange.js +2 -2
- package/internals/utils/validation/validateDateTimeRange.js +2 -2
- package/internals/utils/valueManagers.d.ts +3 -1
- package/internals/utils/valueManagers.js +9 -7
- package/models/fields.d.ts +8 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +1 -1
- package/modern/DateRangePicker/DateRangePicker.js +1 -1
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -4
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -4
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -3
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/utils/valueManagers.js +7 -5
- package/node/DateRangeCalendar/DateRangeCalendar.js +1 -1
- package/node/DateRangePicker/DateRangePicker.js +1 -1
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -4
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -4
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -3
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +7 -1
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +7 -1
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +7 -1
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/internals/utils/valueManagers.js +9 -6
- package/package.json +7 -7
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.d.ts +0 -9
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -52
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -51
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -59
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.rangeValueManager = exports.
|
|
7
|
+
exports.rangeValueManager = exports.getRangeFieldValueManager = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
@@ -42,7 +42,9 @@ const rangeValueManager = exports.rangeValueManager = {
|
|
|
42
42
|
},
|
|
43
43
|
setTimezone: (utils, timezone, value) => [value[0] == null ? null : utils.setTimezone(value[0], timezone), value[1] == null ? null : utils.setTimezone(value[1], timezone)]
|
|
44
44
|
};
|
|
45
|
-
const
|
|
45
|
+
const getRangeFieldValueManager = ({
|
|
46
|
+
dateSeparator = '–'
|
|
47
|
+
}) => ({
|
|
46
48
|
updateReferenceValue: (utils, value, prevReferenceValue) => {
|
|
47
49
|
const shouldKeepStartDate = value[0] != null && utils.isValid(value[0]);
|
|
48
50
|
const shouldKeepEndDate = value[1] != null && utils.isValid(value[1]);
|
|
@@ -73,7 +75,7 @@ const rangeFieldValueManager = exports.rangeFieldValueManager = {
|
|
|
73
75
|
return (0, _extends2.default)({}, section, {
|
|
74
76
|
dateName: position,
|
|
75
77
|
// TODO: Check if RTL still works
|
|
76
|
-
endSeparator: `${section.endSeparator}
|
|
78
|
+
endSeparator: `${section.endSeparator} ${dateSeparator} `
|
|
77
79
|
});
|
|
78
80
|
}
|
|
79
81
|
return (0, _extends2.default)({}, section, {
|
|
@@ -92,8 +94,8 @@ const rangeFieldValueManager = exports.rangeFieldValueManager = {
|
|
|
92
94
|
return (0, _internals.createDateStrForV6InputFromSections)([...dateRangeSections.startDate, ...dateRangeSections.endDate], localizedDigits, isRTL);
|
|
93
95
|
},
|
|
94
96
|
parseValueStr: (valueStr, referenceValue, parseDate) => {
|
|
95
|
-
// TODO: Improve because it would not work if
|
|
96
|
-
const [startStr, endStr] = valueStr.split(
|
|
97
|
+
// TODO: Improve because it would not work if some section have the same separator as the dateSeparator.
|
|
98
|
+
const [startStr, endStr] = valueStr.split(dateSeparator);
|
|
97
99
|
return [startStr, endStr].map((dateStr, index) => {
|
|
98
100
|
if (dateStr == null) {
|
|
99
101
|
return null;
|
|
@@ -120,4 +122,5 @@ const rangeFieldValueManager = exports.rangeFieldValueManager = {
|
|
|
120
122
|
})
|
|
121
123
|
};
|
|
122
124
|
}
|
|
123
|
-
};
|
|
125
|
+
});
|
|
126
|
+
exports.getRangeFieldValueManager = getRangeFieldValueManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers-pro",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "The commercial edition of the date picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.24.0",
|
|
35
|
-
"@mui/base": "^5.0.0-beta.
|
|
36
|
-
"@mui/system": "^5.15.
|
|
37
|
-
"@mui/utils": "^5.15.
|
|
38
|
-
"@mui/x-date-pickers": "7.0.0
|
|
39
|
-
"@mui/x-license": "7.0.0
|
|
35
|
+
"@mui/base": "^5.0.0-beta.40",
|
|
36
|
+
"@mui/system": "^5.15.14",
|
|
37
|
+
"@mui/utils": "^5.15.14",
|
|
38
|
+
"@mui/x-date-pickers": "7.0.0",
|
|
39
|
+
"@mui/x-license": "7.0.0",
|
|
40
40
|
"clsx": "^2.1.0",
|
|
41
41
|
"prop-types": "^15.8.1",
|
|
42
42
|
"react-transition-group": "^4.4.5"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@emotion/react": "^11.9.0",
|
|
46
46
|
"@emotion/styled": "^11.8.1",
|
|
47
|
-
"@mui/material": "^5.15.
|
|
47
|
+
"@mui/material": "^5.15.14",
|
|
48
48
|
"date-fns": "^2.25.0 || ^3.2.0",
|
|
49
49
|
"date-fns-jalali": "^2.13.0-0",
|
|
50
50
|
"dayjs": "^1.10.7",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { PickersLayoutProps } from '@mui/x-date-pickers/PickersLayout';
|
|
3
|
-
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
|
-
import { DateRange } from '../models';
|
|
5
|
-
import { DateTimeRangePickerView } from '../internals/models/dateTimeRange';
|
|
6
|
-
/**
|
|
7
|
-
* @ignore - internal component.
|
|
8
|
-
*/
|
|
9
|
-
export declare function DesktopDateTimeRangePickerLayout<TDate extends PickerValidDate>(props: PickersLayoutProps<DateRange<TDate>, TDate, DateTimeRangePickerView>): React.JSX.Element;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import Divider from '@mui/material/Divider';
|
|
4
|
-
import { PickersLayoutContentWrapper, PickersLayoutRoot, pickersLayoutClasses, usePickerLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
/**
|
|
8
|
-
* @ignore - internal component.
|
|
9
|
-
*/
|
|
10
|
-
export function DesktopDateTimeRangePickerLayout(props) {
|
|
11
|
-
var _actionBar$props$acti, _actionBar$props$acti2;
|
|
12
|
-
const {
|
|
13
|
-
toolbar,
|
|
14
|
-
tabs,
|
|
15
|
-
content,
|
|
16
|
-
actionBar,
|
|
17
|
-
shortcuts
|
|
18
|
-
} = usePickerLayout(props);
|
|
19
|
-
const {
|
|
20
|
-
sx,
|
|
21
|
-
className,
|
|
22
|
-
isLandscape,
|
|
23
|
-
ref
|
|
24
|
-
} = props;
|
|
25
|
-
const isActionBarVisible = actionBar && ((_actionBar$props$acti = (_actionBar$props$acti2 = actionBar.props.actions) == null ? void 0 : _actionBar$props$acti2.length) != null ? _actionBar$props$acti : 0) > 0;
|
|
26
|
-
return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
|
|
27
|
-
ref: ref,
|
|
28
|
-
className: clsx(className, pickersLayoutClasses.root),
|
|
29
|
-
sx: [{
|
|
30
|
-
[`& .${pickersLayoutClasses.tabs}`]: {
|
|
31
|
-
gridRow: 4,
|
|
32
|
-
gridColumn: '1 / 4'
|
|
33
|
-
},
|
|
34
|
-
[`& .${pickersLayoutClasses.actionBar}`]: {
|
|
35
|
-
gridRow: 5
|
|
36
|
-
}
|
|
37
|
-
}, ...(Array.isArray(sx) ? sx : [sx])],
|
|
38
|
-
ownerState: props,
|
|
39
|
-
children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/_jsx(PickersLayoutContentWrapper, {
|
|
40
|
-
className: pickersLayoutClasses.contentWrapper,
|
|
41
|
-
sx: {
|
|
42
|
-
flexDirection: 'row'
|
|
43
|
-
},
|
|
44
|
-
children: content
|
|
45
|
-
}), isActionBarVisible && /*#__PURE__*/_jsx(Divider, {
|
|
46
|
-
sx: {
|
|
47
|
-
gridRow: 3,
|
|
48
|
-
gridColumn: '1/4'
|
|
49
|
-
}
|
|
50
|
-
}), tabs, actionBar]
|
|
51
|
-
});
|
|
52
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import Divider from '@mui/material/Divider';
|
|
4
|
-
import { PickersLayoutContentWrapper, PickersLayoutRoot, pickersLayoutClasses, usePickerLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
/**
|
|
8
|
-
* @ignore - internal component.
|
|
9
|
-
*/
|
|
10
|
-
export function DesktopDateTimeRangePickerLayout(props) {
|
|
11
|
-
const {
|
|
12
|
-
toolbar,
|
|
13
|
-
tabs,
|
|
14
|
-
content,
|
|
15
|
-
actionBar,
|
|
16
|
-
shortcuts
|
|
17
|
-
} = usePickerLayout(props);
|
|
18
|
-
const {
|
|
19
|
-
sx,
|
|
20
|
-
className,
|
|
21
|
-
isLandscape,
|
|
22
|
-
ref
|
|
23
|
-
} = props;
|
|
24
|
-
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
25
|
-
return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
|
|
26
|
-
ref: ref,
|
|
27
|
-
className: clsx(className, pickersLayoutClasses.root),
|
|
28
|
-
sx: [{
|
|
29
|
-
[`& .${pickersLayoutClasses.tabs}`]: {
|
|
30
|
-
gridRow: 4,
|
|
31
|
-
gridColumn: '1 / 4'
|
|
32
|
-
},
|
|
33
|
-
[`& .${pickersLayoutClasses.actionBar}`]: {
|
|
34
|
-
gridRow: 5
|
|
35
|
-
}
|
|
36
|
-
}, ...(Array.isArray(sx) ? sx : [sx])],
|
|
37
|
-
ownerState: props,
|
|
38
|
-
children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/_jsx(PickersLayoutContentWrapper, {
|
|
39
|
-
className: pickersLayoutClasses.contentWrapper,
|
|
40
|
-
sx: {
|
|
41
|
-
flexDirection: 'row'
|
|
42
|
-
},
|
|
43
|
-
children: content
|
|
44
|
-
}), isActionBarVisible && /*#__PURE__*/_jsx(Divider, {
|
|
45
|
-
sx: {
|
|
46
|
-
gridRow: 3,
|
|
47
|
-
gridColumn: '1/4'
|
|
48
|
-
}
|
|
49
|
-
}), tabs, actionBar]
|
|
50
|
-
});
|
|
51
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.DesktopDateTimeRangePickerLayout = DesktopDateTimeRangePickerLayout;
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
|
-
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
11
|
-
var _PickersLayout = require("@mui/x-date-pickers/PickersLayout");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
-
/**
|
|
16
|
-
* @ignore - internal component.
|
|
17
|
-
*/
|
|
18
|
-
function DesktopDateTimeRangePickerLayout(props) {
|
|
19
|
-
const {
|
|
20
|
-
toolbar,
|
|
21
|
-
tabs,
|
|
22
|
-
content,
|
|
23
|
-
actionBar,
|
|
24
|
-
shortcuts
|
|
25
|
-
} = (0, _PickersLayout.usePickerLayout)(props);
|
|
26
|
-
const {
|
|
27
|
-
sx,
|
|
28
|
-
className,
|
|
29
|
-
isLandscape,
|
|
30
|
-
ref
|
|
31
|
-
} = props;
|
|
32
|
-
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
33
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickersLayout.PickersLayoutRoot, {
|
|
34
|
-
ref: ref,
|
|
35
|
-
className: (0, _clsx.default)(className, _PickersLayout.pickersLayoutClasses.root),
|
|
36
|
-
sx: [{
|
|
37
|
-
[`& .${_PickersLayout.pickersLayoutClasses.tabs}`]: {
|
|
38
|
-
gridRow: 4,
|
|
39
|
-
gridColumn: '1 / 4'
|
|
40
|
-
},
|
|
41
|
-
[`& .${_PickersLayout.pickersLayoutClasses.actionBar}`]: {
|
|
42
|
-
gridRow: 5
|
|
43
|
-
}
|
|
44
|
-
}, ...(Array.isArray(sx) ? sx : [sx])],
|
|
45
|
-
ownerState: props,
|
|
46
|
-
children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersLayout.PickersLayoutContentWrapper, {
|
|
47
|
-
className: _PickersLayout.pickersLayoutClasses.contentWrapper,
|
|
48
|
-
sx: {
|
|
49
|
-
flexDirection: 'row'
|
|
50
|
-
},
|
|
51
|
-
children: content
|
|
52
|
-
}), isActionBarVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
53
|
-
sx: {
|
|
54
|
-
gridRow: 3,
|
|
55
|
-
gridColumn: '1/4'
|
|
56
|
-
}
|
|
57
|
-
}), tabs, actionBar]
|
|
58
|
-
});
|
|
59
|
-
}
|