Added Statistics calculation
Statistics now show calculated values
This commit is contained in:
parent
fe87374e47
commit
fc0f69dacb
2147 changed files with 141321 additions and 39 deletions
68
'
Normal file
68
'
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
import { useTranslation, withTranslation, Trans } from 'react-i18next';
|
||||
import Container from '@mui/material/Container';
|
||||
import * as React from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
import InputLabel from '@mui/material/InputLabel';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
import FormControl from '@mui/material/FormControl';
|
||||
import Select, { SelectChangeEvent } from '@mui/material/Select';
|
||||
import Grid from '@mui/material/Grid'
|
||||
|
||||
const uid = "39e9009e-50e1-4277-bbf7-69e5e0f6c6dc"
|
||||
const expenses_response = await fetch(`/GarageApp/api/expenses/${uid}`);
|
||||
const fillups_response = await fetch(`/GarageApp/api/fillups/${uid}`);
|
||||
console.log(expenses_response,fillups_response);
|
||||
const expenses = await expenses_response.json();
|
||||
const fillups = await fillups_response.json();
|
||||
|
||||
|
||||
function BasicSelect() {
|
||||
|
||||
const [age, setAge] = React.useState('');
|
||||
|
||||
const handleChange = (event: SelectChangeEvent) => {
|
||||
setAge(event.target.value as string);
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ minWidth: 120 }}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel id="demo-simple-select-label">Age</InputLabel>
|
||||
<Select
|
||||
labelId="demo-simple-select-label"
|
||||
id="demo-simple-select"
|
||||
value={age}
|
||||
label="Age"
|
||||
onChange={handleChange}
|
||||
>
|
||||
<MenuItem value={10}>This Week</MenuItem>
|
||||
<MenuItem value={20}>This Month</MenuItem>
|
||||
<MenuItem value={30}>Past 30 days</MenuItem>
|
||||
<MenuItem value={40}>Past 3 Months</MenuItem>
|
||||
<MenuItem value={50}>This Year</MenuItem>
|
||||
<MenuItem value={60}>All Time</MenuItem>
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export default function StatisticsView() {
|
||||
const { t, i18n } = useTranslation();
|
||||
return (
|
||||
<Container>
|
||||
<Grid container spacing={2} sx={{alignItems: "center",justifyContent: "space-between"}}>
|
||||
<Grid size="grow" sx={{justifyContent: "flex-start"}}>
|
||||
<h1>
|
||||
{t ('statistics')}
|
||||
</h1>
|
||||
</Grid>
|
||||
<Grid size="auto">
|
||||
<BasicSelect />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Container>
|
||||
|
||||
);
|
||||
}
|
||||
88
node_modules/@mui/x-date-pickers/AdapterDateFns/AdapterDateFns.d.ts
generated
vendored
Normal file
88
node_modules/@mui/x-date-pickers/AdapterDateFns/AdapterDateFns.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
import { Locale as DateFnsLocale } from 'date-fns/locale';
|
||||
import { AdapterFormats, AdapterOptions, MuiPickersAdapter } from "../models/index.js";
|
||||
import { AdapterDateFnsBase } from "../AdapterDateFnsBase/index.js";
|
||||
declare module '@mui/x-date-pickers/models' {
|
||||
interface PickerValidDateLookup {
|
||||
'date-fns': Date;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Based on `@date-io/date-fns`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterDateFns extends AdapterDateFnsBase<DateFnsLocale> implements MuiPickersAdapter<DateFnsLocale> {
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
}?: AdapterOptions<DateFnsLocale, never>);
|
||||
parse: (value: string, format: string) => Date | null;
|
||||
isValid: (value: Date | null) => value is Date;
|
||||
format: (value: Date, formatKey: keyof AdapterFormats) => string;
|
||||
formatByString: (value: Date, formatString: string) => string;
|
||||
isEqual: (value: Date | null, comparing: Date | null) => boolean;
|
||||
isSameYear: (value: Date, comparing: Date) => boolean;
|
||||
isSameMonth: (value: Date, comparing: Date) => boolean;
|
||||
isSameDay: (value: Date, comparing: Date) => boolean;
|
||||
isSameHour: (value: Date, comparing: Date) => boolean;
|
||||
isAfter: (value: Date, comparing: Date) => boolean;
|
||||
isAfterYear: (value: Date, comparing: Date) => boolean;
|
||||
isAfterDay: (value: Date, comparing: Date) => boolean;
|
||||
isBefore: (value: Date, comparing: Date) => boolean;
|
||||
isBeforeYear: (value: Date, comparing: Date) => boolean;
|
||||
isBeforeDay: (value: Date, comparing: Date) => boolean;
|
||||
isWithinRange: (value: Date, [start, end]: [Date, Date]) => boolean;
|
||||
startOfYear: (value: Date) => Date;
|
||||
startOfMonth: (value: Date) => Date;
|
||||
startOfWeek: (value: Date) => Date;
|
||||
startOfDay: (value: Date) => Date;
|
||||
endOfYear: (value: Date) => Date;
|
||||
endOfMonth: (value: Date) => Date;
|
||||
endOfWeek: (value: Date) => Date;
|
||||
endOfDay: (value: Date) => Date;
|
||||
addYears: (value: Date, amount: number) => Date;
|
||||
addMonths: (value: Date, amount: number) => Date;
|
||||
addWeeks: (value: Date, amount: number) => Date;
|
||||
addDays: (value: Date, amount: number) => Date;
|
||||
addHours: (value: Date, amount: number) => Date;
|
||||
addMinutes: (value: Date, amount: number) => Date;
|
||||
addSeconds: (value: Date, amount: number) => Date;
|
||||
getYear: (value: Date) => number;
|
||||
getMonth: (value: Date) => number;
|
||||
getDate: (value: Date) => number;
|
||||
getHours: (value: Date) => number;
|
||||
getMinutes: (value: Date) => number;
|
||||
getSeconds: (value: Date) => number;
|
||||
getMilliseconds: (value: Date) => number;
|
||||
setYear: (value: Date, year: number) => Date;
|
||||
setMonth: (value: Date, month: number) => Date;
|
||||
setDate: (value: Date, date: number) => Date;
|
||||
setHours: (value: Date, hours: number) => Date;
|
||||
setMinutes: (value: Date, minutes: number) => Date;
|
||||
setSeconds: (value: Date, seconds: number) => Date;
|
||||
setMilliseconds: (value: Date, milliseconds: number) => Date;
|
||||
getDaysInMonth: (value: Date) => number;
|
||||
getWeekArray: (value: Date) => Date[][];
|
||||
getWeekNumber: (value: Date) => number;
|
||||
getYearRange: ([start, end]: [Date, Date]) => Date[];
|
||||
}
|
||||
292
node_modules/@mui/x-date-pickers/AdapterDateFns/AdapterDateFns.js
generated
vendored
Normal file
292
node_modules/@mui/x-date-pickers/AdapterDateFns/AdapterDateFns.js
generated
vendored
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterDateFns = void 0;
|
||||
var _addDays = require("date-fns/addDays");
|
||||
var _addSeconds = require("date-fns/addSeconds");
|
||||
var _addMinutes = require("date-fns/addMinutes");
|
||||
var _addHours = require("date-fns/addHours");
|
||||
var _addWeeks = require("date-fns/addWeeks");
|
||||
var _addMonths = require("date-fns/addMonths");
|
||||
var _addYears = require("date-fns/addYears");
|
||||
var _endOfDay = require("date-fns/endOfDay");
|
||||
var _endOfWeek = require("date-fns/endOfWeek");
|
||||
var _endOfYear = require("date-fns/endOfYear");
|
||||
var _format = require("date-fns/format");
|
||||
var _getDate = require("date-fns/getDate");
|
||||
var _getDaysInMonth = require("date-fns/getDaysInMonth");
|
||||
var _getHours = require("date-fns/getHours");
|
||||
var _getMinutes = require("date-fns/getMinutes");
|
||||
var _getMonth = require("date-fns/getMonth");
|
||||
var _getSeconds = require("date-fns/getSeconds");
|
||||
var _getMilliseconds = require("date-fns/getMilliseconds");
|
||||
var _getWeek = require("date-fns/getWeek");
|
||||
var _getYear = require("date-fns/getYear");
|
||||
var _isAfter = require("date-fns/isAfter");
|
||||
var _isBefore = require("date-fns/isBefore");
|
||||
var _isEqual = require("date-fns/isEqual");
|
||||
var _isSameDay = require("date-fns/isSameDay");
|
||||
var _isSameYear = require("date-fns/isSameYear");
|
||||
var _isSameMonth = require("date-fns/isSameMonth");
|
||||
var _isSameHour = require("date-fns/isSameHour");
|
||||
var _isValid = require("date-fns/isValid");
|
||||
var _parse = require("date-fns/parse");
|
||||
var _setDate = require("date-fns/setDate");
|
||||
var _setHours = require("date-fns/setHours");
|
||||
var _setMinutes = require("date-fns/setMinutes");
|
||||
var _setMonth = require("date-fns/setMonth");
|
||||
var _setSeconds = require("date-fns/setSeconds");
|
||||
var _setMilliseconds = require("date-fns/setMilliseconds");
|
||||
var _setYear = require("date-fns/setYear");
|
||||
var _startOfDay = require("date-fns/startOfDay");
|
||||
var _startOfMonth = require("date-fns/startOfMonth");
|
||||
var _endOfMonth = require("date-fns/endOfMonth");
|
||||
var _startOfWeek = require("date-fns/startOfWeek");
|
||||
var _startOfYear = require("date-fns/startOfYear");
|
||||
var _isWithinInterval = require("date-fns/isWithinInterval");
|
||||
var _enUS = require("date-fns/locale/en-US");
|
||||
var _AdapterDateFnsBase = require("../AdapterDateFnsBase");
|
||||
/**
|
||||
* Based on `@date-io/date-fns`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterDateFns extends _AdapterDateFnsBase.AdapterDateFnsBase {
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
} = {}) {
|
||||
/* v8 ignore start */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof _addDays.addDays !== 'function') {
|
||||
throw new Error(['MUI: The `date-fns` package v2.x is not compatible with this adapter.', 'Please, install v3.x or v4.x of the package or use the `AdapterDateFnsV2` instead.'].join('\n'));
|
||||
}
|
||||
if (!_format.longFormatters) {
|
||||
throw new Error('MUI: The minimum supported `date-fns` package version compatible with this adapter is `3.2.x`.');
|
||||
}
|
||||
}
|
||||
/* v8 ignore stop */
|
||||
super({
|
||||
locale: locale ?? _enUS.enUS,
|
||||
formats,
|
||||
longFormatters: _format.longFormatters
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: explicit return types can be removed once there is only one date-fns version supported
|
||||
parse = (value, format) => {
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
return (0, _parse.parse)(value, format, new Date(), {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
isValid = value => {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return (0, _isValid.isValid)(value);
|
||||
};
|
||||
format = (value, formatKey) => {
|
||||
return this.formatByString(value, this.formats[formatKey]);
|
||||
};
|
||||
formatByString = (value, formatString) => {
|
||||
return (0, _format.format)(value, formatString, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
isEqual = (value, comparing) => {
|
||||
if (value === null && comparing === null) {
|
||||
return true;
|
||||
}
|
||||
if (value === null || comparing === null) {
|
||||
return false;
|
||||
}
|
||||
return (0, _isEqual.isEqual)(value, comparing);
|
||||
};
|
||||
isSameYear = (value, comparing) => {
|
||||
return (0, _isSameYear.isSameYear)(value, comparing);
|
||||
};
|
||||
isSameMonth = (value, comparing) => {
|
||||
return (0, _isSameMonth.isSameMonth)(value, comparing);
|
||||
};
|
||||
isSameDay = (value, comparing) => {
|
||||
return (0, _isSameDay.isSameDay)(value, comparing);
|
||||
};
|
||||
isSameHour = (value, comparing) => {
|
||||
return (0, _isSameHour.isSameHour)(value, comparing);
|
||||
};
|
||||
isAfter = (value, comparing) => {
|
||||
return (0, _isAfter.isAfter)(value, comparing);
|
||||
};
|
||||
isAfterYear = (value, comparing) => {
|
||||
return (0, _isAfter.isAfter)(value, (0, _endOfYear.endOfYear)(comparing));
|
||||
};
|
||||
isAfterDay = (value, comparing) => {
|
||||
return (0, _isAfter.isAfter)(value, (0, _endOfDay.endOfDay)(comparing));
|
||||
};
|
||||
isBefore = (value, comparing) => {
|
||||
return (0, _isBefore.isBefore)(value, comparing);
|
||||
};
|
||||
isBeforeYear = (value, comparing) => {
|
||||
return (0, _isBefore.isBefore)(value, this.startOfYear(comparing));
|
||||
};
|
||||
isBeforeDay = (value, comparing) => {
|
||||
return (0, _isBefore.isBefore)(value, this.startOfDay(comparing));
|
||||
};
|
||||
isWithinRange = (value, [start, end]) => {
|
||||
return (0, _isWithinInterval.isWithinInterval)(value, {
|
||||
start,
|
||||
end
|
||||
});
|
||||
};
|
||||
startOfYear = value => {
|
||||
return (0, _startOfYear.startOfYear)(value);
|
||||
};
|
||||
startOfMonth = value => {
|
||||
return (0, _startOfMonth.startOfMonth)(value);
|
||||
};
|
||||
startOfWeek = value => {
|
||||
return (0, _startOfWeek.startOfWeek)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
startOfDay = value => {
|
||||
return (0, _startOfDay.startOfDay)(value);
|
||||
};
|
||||
endOfYear = value => {
|
||||
return (0, _endOfYear.endOfYear)(value);
|
||||
};
|
||||
endOfMonth = value => {
|
||||
return (0, _endOfMonth.endOfMonth)(value);
|
||||
};
|
||||
endOfWeek = value => {
|
||||
return (0, _endOfWeek.endOfWeek)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
endOfDay = value => {
|
||||
return (0, _endOfDay.endOfDay)(value);
|
||||
};
|
||||
addYears = (value, amount) => {
|
||||
return (0, _addYears.addYears)(value, amount);
|
||||
};
|
||||
addMonths = (value, amount) => {
|
||||
return (0, _addMonths.addMonths)(value, amount);
|
||||
};
|
||||
addWeeks = (value, amount) => {
|
||||
return (0, _addWeeks.addWeeks)(value, amount);
|
||||
};
|
||||
addDays = (value, amount) => {
|
||||
return (0, _addDays.addDays)(value, amount);
|
||||
};
|
||||
addHours = (value, amount) => {
|
||||
return (0, _addHours.addHours)(value, amount);
|
||||
};
|
||||
addMinutes = (value, amount) => {
|
||||
return (0, _addMinutes.addMinutes)(value, amount);
|
||||
};
|
||||
addSeconds = (value, amount) => {
|
||||
return (0, _addSeconds.addSeconds)(value, amount);
|
||||
};
|
||||
getYear = value => {
|
||||
return (0, _getYear.getYear)(value);
|
||||
};
|
||||
getMonth = value => {
|
||||
return (0, _getMonth.getMonth)(value);
|
||||
};
|
||||
getDate = value => {
|
||||
return (0, _getDate.getDate)(value);
|
||||
};
|
||||
getHours = value => {
|
||||
return (0, _getHours.getHours)(value);
|
||||
};
|
||||
getMinutes = value => {
|
||||
return (0, _getMinutes.getMinutes)(value);
|
||||
};
|
||||
getSeconds = value => {
|
||||
return (0, _getSeconds.getSeconds)(value);
|
||||
};
|
||||
getMilliseconds = value => {
|
||||
return (0, _getMilliseconds.getMilliseconds)(value);
|
||||
};
|
||||
setYear = (value, year) => {
|
||||
return (0, _setYear.setYear)(value, year);
|
||||
};
|
||||
setMonth = (value, month) => {
|
||||
return (0, _setMonth.setMonth)(value, month);
|
||||
};
|
||||
setDate = (value, date) => {
|
||||
return (0, _setDate.setDate)(value, date);
|
||||
};
|
||||
setHours = (value, hours) => {
|
||||
return (0, _setHours.setHours)(value, hours);
|
||||
};
|
||||
setMinutes = (value, minutes) => {
|
||||
return (0, _setMinutes.setMinutes)(value, minutes);
|
||||
};
|
||||
setSeconds = (value, seconds) => {
|
||||
return (0, _setSeconds.setSeconds)(value, seconds);
|
||||
};
|
||||
setMilliseconds = (value, milliseconds) => {
|
||||
return (0, _setMilliseconds.setMilliseconds)(value, milliseconds);
|
||||
};
|
||||
getDaysInMonth = value => {
|
||||
return (0, _getDaysInMonth.getDaysInMonth)(value);
|
||||
};
|
||||
getWeekArray = value => {
|
||||
const start = this.startOfWeek(this.startOfMonth(value));
|
||||
const end = this.endOfWeek(this.endOfMonth(value));
|
||||
let count = 0;
|
||||
let current = start;
|
||||
const nestedWeeks = [];
|
||||
while (this.isBefore(current, end)) {
|
||||
const weekNumber = Math.floor(count / 7);
|
||||
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
||||
nestedWeeks[weekNumber].push(current);
|
||||
current = this.addDays(current, 1);
|
||||
count += 1;
|
||||
}
|
||||
return nestedWeeks;
|
||||
};
|
||||
getWeekNumber = value => {
|
||||
return (0, _getWeek.getWeek)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
getYearRange = ([start, end]) => {
|
||||
const startDate = this.startOfYear(start);
|
||||
const endDate = this.endOfYear(end);
|
||||
const years = [];
|
||||
let current = startDate;
|
||||
while (this.isBefore(current, endDate)) {
|
||||
years.push(current);
|
||||
current = this.addYears(current, 1);
|
||||
}
|
||||
return years;
|
||||
};
|
||||
}
|
||||
exports.AdapterDateFns = AdapterDateFns;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterDateFns/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterDateFns/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterDateFns } from "./AdapterDateFns.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterDateFns/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterDateFns/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterDateFns", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterDateFns.AdapterDateFns;
|
||||
}
|
||||
});
|
||||
var _AdapterDateFns = require("./AdapterDateFns");
|
||||
64
node_modules/@mui/x-date-pickers/AdapterDateFnsBase/AdapterDateFnsBase.d.ts
generated
vendored
Normal file
64
node_modules/@mui/x-date-pickers/AdapterDateFnsBase/AdapterDateFnsBase.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import { MakeRequired } from '@mui/x-internals/types';
|
||||
import { AdapterFormats, AdapterOptions, DateBuilderReturnType, FieldFormatTokenMap, MuiPickersAdapter } from "../models/index.js";
|
||||
type DateFnsLocaleBase = {
|
||||
formatLong: {
|
||||
date: (...args: Array<any>) => any;
|
||||
time: (...args: Array<any>) => any;
|
||||
dateTime: (...args: Array<any>) => any;
|
||||
};
|
||||
code?: string;
|
||||
};
|
||||
type DateFnsAdapterBaseOptions<DateFnsLocale extends DateFnsLocaleBase> = MakeRequired<AdapterOptions<DateFnsLocale, never>, 'locale'> & {
|
||||
longFormatters: Record<'p' | 'P', (token: string, formatLong: DateFnsLocaleBase['formatLong']) => string>;
|
||||
lib?: string;
|
||||
};
|
||||
/**
|
||||
* Based on `@date-io/date-fns`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterDateFnsBase<DateFnsLocale extends DateFnsLocaleBase> implements Pick<MuiPickersAdapter<DateFnsLocale>, 'date' | 'getInvalidDate' | 'getTimezone' | 'setTimezone' | 'toJsDate' | 'getCurrentLocaleCode' | 'is12HourCycleInCurrentLocale' | 'expandFormat' | 'formatNumber'> {
|
||||
isMUIAdapter: boolean;
|
||||
isTimezoneCompatible: boolean;
|
||||
lib: string;
|
||||
locale: DateFnsLocale;
|
||||
formats: AdapterFormats;
|
||||
formatTokenMap: FieldFormatTokenMap;
|
||||
escapedCharacters: {
|
||||
start: string;
|
||||
end: string;
|
||||
};
|
||||
longFormatters: DateFnsAdapterBaseOptions<DateFnsLocale>['longFormatters'];
|
||||
constructor(props: DateFnsAdapterBaseOptions<DateFnsLocale>);
|
||||
date: <T extends string | null | undefined>(value?: T) => DateBuilderReturnType<T>;
|
||||
getInvalidDate: () => Date;
|
||||
getTimezone: () => string;
|
||||
setTimezone: (value: Date) => Date;
|
||||
toJsDate: (value: Date) => Date;
|
||||
getCurrentLocaleCode: () => string;
|
||||
is12HourCycleInCurrentLocale: () => boolean;
|
||||
expandFormat: (format: string) => string;
|
||||
formatNumber: (numberToFormat: string) => string;
|
||||
getDayOfWeek: (value: Date) => number;
|
||||
}
|
||||
export {};
|
||||
294
node_modules/@mui/x-date-pickers/AdapterDateFnsBase/AdapterDateFnsBase.js
generated
vendored
Normal file
294
node_modules/@mui/x-date-pickers/AdapterDateFnsBase/AdapterDateFnsBase.js
generated
vendored
Normal file
|
|
@ -0,0 +1,294 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterDateFnsBase = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
const formatTokenMap = {
|
||||
// Year
|
||||
y: {
|
||||
sectionType: 'year',
|
||||
contentType: 'digit',
|
||||
maxLength: 4
|
||||
},
|
||||
yy: 'year',
|
||||
yyy: {
|
||||
sectionType: 'year',
|
||||
contentType: 'digit',
|
||||
maxLength: 4
|
||||
},
|
||||
yyyy: 'year',
|
||||
// Month
|
||||
M: {
|
||||
sectionType: 'month',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
MM: 'month',
|
||||
MMMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
MMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
L: {
|
||||
sectionType: 'month',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
LL: 'month',
|
||||
LLL: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
LLLL: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Day of the month
|
||||
d: {
|
||||
sectionType: 'day',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
dd: 'day',
|
||||
do: {
|
||||
sectionType: 'day',
|
||||
contentType: 'digit-with-letter'
|
||||
},
|
||||
// Day of the week
|
||||
E: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
EE: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
EEE: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
EEEE: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
EEEEE: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
i: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'digit',
|
||||
maxLength: 1
|
||||
},
|
||||
ii: 'weekDay',
|
||||
iii: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
iiii: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// eslint-disable-next-line id-denylist
|
||||
e: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'digit',
|
||||
maxLength: 1
|
||||
},
|
||||
ee: 'weekDay',
|
||||
eee: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
eeee: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
eeeee: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
eeeeee: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
c: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'digit',
|
||||
maxLength: 1
|
||||
},
|
||||
cc: 'weekDay',
|
||||
ccc: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
cccc: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
ccccc: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
cccccc: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Meridiem
|
||||
a: 'meridiem',
|
||||
aa: 'meridiem',
|
||||
aaa: 'meridiem',
|
||||
// Hours
|
||||
H: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
HH: 'hours',
|
||||
h: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
hh: 'hours',
|
||||
// Minutes
|
||||
m: {
|
||||
sectionType: 'minutes',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
mm: 'minutes',
|
||||
// Seconds
|
||||
s: {
|
||||
sectionType: 'seconds',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
ss: 'seconds'
|
||||
};
|
||||
const defaultFormats = {
|
||||
year: 'yyyy',
|
||||
month: 'LLLL',
|
||||
monthShort: 'MMM',
|
||||
dayOfMonth: 'd',
|
||||
dayOfMonthFull: 'do',
|
||||
weekday: 'EEEE',
|
||||
weekdayShort: 'EEEEEE',
|
||||
hours24h: 'HH',
|
||||
hours12h: 'hh',
|
||||
meridiem: 'aa',
|
||||
minutes: 'mm',
|
||||
seconds: 'ss',
|
||||
fullDate: 'PP',
|
||||
keyboardDate: 'P',
|
||||
shortDate: 'MMM d',
|
||||
normalDate: 'd MMMM',
|
||||
normalDateWithWeekday: 'EEE, MMM d',
|
||||
fullTime12h: 'hh:mm aa',
|
||||
fullTime24h: 'HH:mm',
|
||||
keyboardDateTime12h: 'P hh:mm aa',
|
||||
keyboardDateTime24h: 'P HH:mm'
|
||||
};
|
||||
/**
|
||||
* Based on `@date-io/date-fns`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterDateFnsBase {
|
||||
isMUIAdapter = true;
|
||||
isTimezoneCompatible = false;
|
||||
formatTokenMap = formatTokenMap;
|
||||
escapedCharacters = {
|
||||
start: "'",
|
||||
end: "'"
|
||||
};
|
||||
constructor(props) {
|
||||
const {
|
||||
locale,
|
||||
formats,
|
||||
longFormatters,
|
||||
lib
|
||||
} = props;
|
||||
this.locale = locale;
|
||||
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
||||
this.longFormatters = longFormatters;
|
||||
this.lib = lib || 'date-fns';
|
||||
}
|
||||
date = value => {
|
||||
if (typeof value === 'undefined') {
|
||||
return new Date();
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
}
|
||||
return new Date(value);
|
||||
};
|
||||
getInvalidDate = () => new Date('Invalid Date');
|
||||
getTimezone = () => {
|
||||
return 'default';
|
||||
};
|
||||
setTimezone = value => {
|
||||
return value;
|
||||
};
|
||||
toJsDate = value => {
|
||||
return value;
|
||||
};
|
||||
getCurrentLocaleCode = () => {
|
||||
// `code` is undefined only in `date-fns` types, but all locales have it
|
||||
return this.locale.code;
|
||||
};
|
||||
|
||||
// Note: date-fns input types are more lenient than this adapter, so we need to expose our more
|
||||
// strict signature and delegate to the more lenient signature. Otherwise, we have downstream type errors upon usage.
|
||||
is12HourCycleInCurrentLocale = () => {
|
||||
return /a/.test(this.locale.formatLong.time({
|
||||
width: 'short'
|
||||
}));
|
||||
};
|
||||
expandFormat = format => {
|
||||
const longFormatRegexp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
||||
|
||||
// @see https://github.com/date-fns/date-fns/blob/master/src/format/index.js#L31
|
||||
return format.match(longFormatRegexp).map(token => {
|
||||
const firstCharacter = token[0];
|
||||
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
||||
const longFormatter = this.longFormatters[firstCharacter];
|
||||
return longFormatter(token, this.locale.formatLong);
|
||||
}
|
||||
return token;
|
||||
}).join('');
|
||||
};
|
||||
formatNumber = numberToFormat => {
|
||||
return numberToFormat;
|
||||
};
|
||||
getDayOfWeek = value => {
|
||||
return value.getDay() + 1;
|
||||
};
|
||||
}
|
||||
exports.AdapterDateFnsBase = AdapterDateFnsBase;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterDateFnsBase/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterDateFnsBase/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterDateFnsBase } from "./AdapterDateFnsBase.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterDateFnsBase/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterDateFnsBase/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterDateFnsBase", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterDateFnsBase.AdapterDateFnsBase;
|
||||
}
|
||||
});
|
||||
var _AdapterDateFnsBase = require("./AdapterDateFnsBase");
|
||||
89
node_modules/@mui/x-date-pickers/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts
generated
vendored
Normal file
89
node_modules/@mui/x-date-pickers/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import { Locale as DateFnsLocale } from 'date-fns-jalali/locale';
|
||||
import { AdapterFormats, AdapterOptions, MuiPickersAdapter } from "../models/index.js";
|
||||
import { AdapterDateFnsBase } from "../AdapterDateFnsBase/index.js";
|
||||
declare module '@mui/x-date-pickers/models' {
|
||||
interface PickerValidDateLookup {
|
||||
'date-fns-jalali': Date;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Based on `@date-io/date-fns-jalali`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterDateFnsJalali extends AdapterDateFnsBase<DateFnsLocale> implements MuiPickersAdapter<DateFnsLocale> {
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
}?: AdapterOptions<DateFnsLocale, never>);
|
||||
parse: (value: string, format: string) => Date | null;
|
||||
isValid: (value: Date | null) => value is Date;
|
||||
format: (value: Date, formatKey: keyof AdapterFormats) => string;
|
||||
formatByString: (value: Date, formatString: string) => string;
|
||||
formatNumber: (numberToFormat: string) => string;
|
||||
isEqual: (value: Date | null, comparing: Date | null) => boolean;
|
||||
isSameYear: (value: Date, comparing: Date) => boolean;
|
||||
isSameMonth: (value: Date, comparing: Date) => boolean;
|
||||
isSameDay: (value: Date, comparing: Date) => boolean;
|
||||
isSameHour: (value: Date, comparing: Date) => boolean;
|
||||
isAfter: (value: Date, comparing: Date) => boolean;
|
||||
isAfterYear: (value: Date, comparing: Date) => boolean;
|
||||
isAfterDay: (value: Date, comparing: Date) => boolean;
|
||||
isBefore: (value: Date, comparing: Date) => boolean;
|
||||
isBeforeYear: (value: Date, comparing: Date) => boolean;
|
||||
isBeforeDay: (value: Date, comparing: Date) => boolean;
|
||||
isWithinRange: (value: Date, [start, end]: [Date, Date]) => boolean;
|
||||
startOfYear: (value: Date) => Date;
|
||||
startOfMonth: (value: Date) => Date;
|
||||
startOfWeek: (value: Date) => Date;
|
||||
startOfDay: (value: Date) => Date;
|
||||
endOfYear: (value: Date) => Date;
|
||||
endOfMonth: (value: Date) => Date;
|
||||
endOfWeek: (value: Date) => Date;
|
||||
endOfDay: (value: Date) => Date;
|
||||
addYears: (value: Date, amount: number) => Date;
|
||||
addMonths: (value: Date, amount: number) => Date;
|
||||
addWeeks: (value: Date, amount: number) => Date;
|
||||
addDays: (value: Date, amount: number) => Date;
|
||||
addHours: (value: Date, amount: number) => Date;
|
||||
addMinutes: (value: Date, amount: number) => Date;
|
||||
addSeconds: (value: Date, amount: number) => Date;
|
||||
getYear: (value: Date) => number;
|
||||
getMonth: (value: Date) => number;
|
||||
getDate: (value: Date) => number;
|
||||
getHours: (value: Date) => number;
|
||||
getMinutes: (value: Date) => number;
|
||||
getSeconds: (value: Date) => number;
|
||||
getMilliseconds: (value: Date) => number;
|
||||
setYear: (value: Date, year: number) => Date;
|
||||
setMonth: (value: Date, month: number) => Date;
|
||||
setDate: (value: Date, date: number) => Date;
|
||||
setHours: (value: Date, hours: number) => Date;
|
||||
setMinutes: (value: Date, minutes: number) => Date;
|
||||
setSeconds: (value: Date, seconds: number) => Date;
|
||||
setMilliseconds: (value: Date, milliseconds: number) => Date;
|
||||
getDaysInMonth: (value: Date) => number;
|
||||
getWeekArray: (value: Date) => Date[][];
|
||||
getWeekNumber: (date: Date) => number;
|
||||
getYearRange: ([start, end]: [Date, Date]) => Date[];
|
||||
}
|
||||
335
node_modules/@mui/x-date-pickers/AdapterDateFnsJalali/AdapterDateFnsJalali.js
generated
vendored
Normal file
335
node_modules/@mui/x-date-pickers/AdapterDateFnsJalali/AdapterDateFnsJalali.js
generated
vendored
Normal file
|
|
@ -0,0 +1,335 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterDateFnsJalali = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _addSeconds = require("date-fns-jalali/addSeconds");
|
||||
var _addMinutes = require("date-fns-jalali/addMinutes");
|
||||
var _addHours = require("date-fns-jalali/addHours");
|
||||
var _addDays = require("date-fns-jalali/addDays");
|
||||
var _addWeeks = require("date-fns-jalali/addWeeks");
|
||||
var _addMonths = require("date-fns-jalali/addMonths");
|
||||
var _addYears = require("date-fns-jalali/addYears");
|
||||
var _endOfDay = require("date-fns-jalali/endOfDay");
|
||||
var _endOfWeek = require("date-fns-jalali/endOfWeek");
|
||||
var _endOfYear = require("date-fns-jalali/endOfYear");
|
||||
var _format = require("date-fns-jalali/format");
|
||||
var _getHours = require("date-fns-jalali/getHours");
|
||||
var _getSeconds = require("date-fns-jalali/getSeconds");
|
||||
var _getMilliseconds = require("date-fns-jalali/getMilliseconds");
|
||||
var _getWeek = require("date-fns-jalali/getWeek");
|
||||
var _getYear = require("date-fns-jalali/getYear");
|
||||
var _getMonth = require("date-fns-jalali/getMonth");
|
||||
var _getDate = require("date-fns-jalali/getDate");
|
||||
var _getDaysInMonth = require("date-fns-jalali/getDaysInMonth");
|
||||
var _getMinutes = require("date-fns-jalali/getMinutes");
|
||||
var _isAfter = require("date-fns-jalali/isAfter");
|
||||
var _isBefore = require("date-fns-jalali/isBefore");
|
||||
var _isEqual = require("date-fns-jalali/isEqual");
|
||||
var _isSameDay = require("date-fns-jalali/isSameDay");
|
||||
var _isSameYear = require("date-fns-jalali/isSameYear");
|
||||
var _isSameMonth = require("date-fns-jalali/isSameMonth");
|
||||
var _isSameHour = require("date-fns-jalali/isSameHour");
|
||||
var _isValid = require("date-fns-jalali/isValid");
|
||||
var _parse = require("date-fns-jalali/parse");
|
||||
var _setDate = require("date-fns-jalali/setDate");
|
||||
var _setHours = require("date-fns-jalali/setHours");
|
||||
var _setMinutes = require("date-fns-jalali/setMinutes");
|
||||
var _setMonth = require("date-fns-jalali/setMonth");
|
||||
var _setSeconds = require("date-fns-jalali/setSeconds");
|
||||
var _setMilliseconds = require("date-fns-jalali/setMilliseconds");
|
||||
var _setYear = require("date-fns-jalali/setYear");
|
||||
var _startOfDay = require("date-fns-jalali/startOfDay");
|
||||
var _startOfMonth = require("date-fns-jalali/startOfMonth");
|
||||
var _endOfMonth = require("date-fns-jalali/endOfMonth");
|
||||
var _startOfWeek = require("date-fns-jalali/startOfWeek");
|
||||
var _startOfYear = require("date-fns-jalali/startOfYear");
|
||||
var _isWithinInterval = require("date-fns-jalali/isWithinInterval");
|
||||
var _faIR = require("date-fns-jalali/locale/fa-IR");
|
||||
var _AdapterDateFnsBase = require("../AdapterDateFnsBase");
|
||||
const defaultFormats = {
|
||||
year: 'yyyy',
|
||||
month: 'LLLL',
|
||||
monthShort: 'MMM',
|
||||
dayOfMonth: 'd',
|
||||
dayOfMonthFull: 'do',
|
||||
weekday: 'EEEE',
|
||||
weekdayShort: 'EEEEEE',
|
||||
hours24h: 'HH',
|
||||
hours12h: 'hh',
|
||||
meridiem: 'aa',
|
||||
minutes: 'mm',
|
||||
seconds: 'ss',
|
||||
fullDate: 'PPP',
|
||||
keyboardDate: 'P',
|
||||
shortDate: 'd MMM',
|
||||
normalDate: 'd MMMM',
|
||||
normalDateWithWeekday: 'EEE, d MMMM',
|
||||
fullTime12h: 'hh:mm aaa',
|
||||
fullTime24h: 'HH:mm',
|
||||
keyboardDateTime12h: 'P hh:mm aa',
|
||||
keyboardDateTime24h: 'P HH:mm'
|
||||
};
|
||||
const NUMBER_SYMBOL_MAP = {
|
||||
'1': '۱',
|
||||
'2': '۲',
|
||||
'3': '۳',
|
||||
'4': '۴',
|
||||
'5': '۵',
|
||||
'6': '۶',
|
||||
'7': '۷',
|
||||
'8': '۸',
|
||||
'9': '۹',
|
||||
'0': '۰'
|
||||
};
|
||||
/**
|
||||
* Based on `@date-io/date-fns-jalali`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterDateFnsJalali extends _AdapterDateFnsBase.AdapterDateFnsBase {
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
} = {}) {
|
||||
/* v8 ignore start */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof _addDays.addDays !== 'function') {
|
||||
throw new Error(['MUI: The `date-fns-jalali` package v2.x is not compatible with this adapter.', 'Please, install v3.x or v4.x of the package or use the `AdapterDateFnsJalaliV2` instead.'].join('\n'));
|
||||
}
|
||||
if (!_format.longFormatters) {
|
||||
throw new Error('MUI: The minimum supported `date-fns-jalali` package version compatible with this adapter is `3.2.x`.');
|
||||
}
|
||||
}
|
||||
/* v8 ignore stop */
|
||||
super({
|
||||
locale: locale ?? _faIR.faIR,
|
||||
// some formats are different in jalali adapter,
|
||||
// this ensures that `AdapterDateFnsBase` formats are overridden
|
||||
formats: (0, _extends2.default)({}, defaultFormats, formats),
|
||||
longFormatters: _format.longFormatters,
|
||||
lib: 'date-fns-jalali'
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: explicit return types can be removed once there is only one date-fns version supported
|
||||
parse = (value, format) => {
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
return (0, _parse.parse)(value, format, new Date(), {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
isValid = value => {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return (0, _isValid.isValid)(value);
|
||||
};
|
||||
format = (value, formatKey) => {
|
||||
return this.formatByString(value, this.formats[formatKey]);
|
||||
};
|
||||
formatByString = (value, formatString) => {
|
||||
return (0, _format.format)(value, formatString, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
formatNumber = numberToFormat => {
|
||||
return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
|
||||
};
|
||||
isEqual = (value, comparing) => {
|
||||
if (value === null && comparing === null) {
|
||||
return true;
|
||||
}
|
||||
if (value === null || comparing === null) {
|
||||
return false;
|
||||
}
|
||||
return (0, _isEqual.isEqual)(value, comparing);
|
||||
};
|
||||
isSameYear = (value, comparing) => {
|
||||
return (0, _isSameYear.isSameYear)(value, comparing);
|
||||
};
|
||||
isSameMonth = (value, comparing) => {
|
||||
return (0, _isSameMonth.isSameMonth)(value, comparing);
|
||||
};
|
||||
isSameDay = (value, comparing) => {
|
||||
return (0, _isSameDay.isSameDay)(value, comparing);
|
||||
};
|
||||
isSameHour = (value, comparing) => {
|
||||
return (0, _isSameHour.isSameHour)(value, comparing);
|
||||
};
|
||||
isAfter = (value, comparing) => {
|
||||
return (0, _isAfter.isAfter)(value, comparing);
|
||||
};
|
||||
isAfterYear = (value, comparing) => {
|
||||
return (0, _isAfter.isAfter)(value, this.endOfYear(comparing));
|
||||
};
|
||||
isAfterDay = (value, comparing) => {
|
||||
return (0, _isAfter.isAfter)(value, this.endOfDay(comparing));
|
||||
};
|
||||
isBefore = (value, comparing) => {
|
||||
return (0, _isBefore.isBefore)(value, comparing);
|
||||
};
|
||||
isBeforeYear = (value, comparing) => {
|
||||
return (0, _isBefore.isBefore)(value, this.startOfYear(comparing));
|
||||
};
|
||||
isBeforeDay = (value, comparing) => {
|
||||
return (0, _isBefore.isBefore)(value, this.startOfDay(comparing));
|
||||
};
|
||||
isWithinRange = (value, [start, end]) => {
|
||||
return (0, _isWithinInterval.isWithinInterval)(value, {
|
||||
start,
|
||||
end
|
||||
});
|
||||
};
|
||||
startOfYear = value => {
|
||||
return (0, _startOfYear.startOfYear)(value);
|
||||
};
|
||||
startOfMonth = value => {
|
||||
return (0, _startOfMonth.startOfMonth)(value);
|
||||
};
|
||||
startOfWeek = value => {
|
||||
return (0, _startOfWeek.startOfWeek)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
startOfDay = value => {
|
||||
return (0, _startOfDay.startOfDay)(value);
|
||||
};
|
||||
endOfYear = value => {
|
||||
return (0, _endOfYear.endOfYear)(value);
|
||||
};
|
||||
endOfMonth = value => {
|
||||
return (0, _endOfMonth.endOfMonth)(value);
|
||||
};
|
||||
endOfWeek = value => {
|
||||
return (0, _endOfWeek.endOfWeek)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
endOfDay = value => {
|
||||
return (0, _endOfDay.endOfDay)(value);
|
||||
};
|
||||
addYears = (value, amount) => {
|
||||
return (0, _addYears.addYears)(value, amount);
|
||||
};
|
||||
addMonths = (value, amount) => {
|
||||
return (0, _addMonths.addMonths)(value, amount);
|
||||
};
|
||||
addWeeks = (value, amount) => {
|
||||
return (0, _addWeeks.addWeeks)(value, amount);
|
||||
};
|
||||
addDays = (value, amount) => {
|
||||
return (0, _addDays.addDays)(value, amount);
|
||||
};
|
||||
addHours = (value, amount) => {
|
||||
return (0, _addHours.addHours)(value, amount);
|
||||
};
|
||||
addMinutes = (value, amount) => {
|
||||
return (0, _addMinutes.addMinutes)(value, amount);
|
||||
};
|
||||
addSeconds = (value, amount) => {
|
||||
return (0, _addSeconds.addSeconds)(value, amount);
|
||||
};
|
||||
getYear = value => {
|
||||
return (0, _getYear.getYear)(value);
|
||||
};
|
||||
getMonth = value => {
|
||||
return (0, _getMonth.getMonth)(value);
|
||||
};
|
||||
getDate = value => {
|
||||
return (0, _getDate.getDate)(value);
|
||||
};
|
||||
getHours = value => {
|
||||
return (0, _getHours.getHours)(value);
|
||||
};
|
||||
getMinutes = value => {
|
||||
return (0, _getMinutes.getMinutes)(value);
|
||||
};
|
||||
getSeconds = value => {
|
||||
return (0, _getSeconds.getSeconds)(value);
|
||||
};
|
||||
getMilliseconds = value => {
|
||||
return (0, _getMilliseconds.getMilliseconds)(value);
|
||||
};
|
||||
setYear = (value, year) => {
|
||||
return (0, _setYear.setYear)(value, year);
|
||||
};
|
||||
setMonth = (value, month) => {
|
||||
return (0, _setMonth.setMonth)(value, month);
|
||||
};
|
||||
setDate = (value, date) => {
|
||||
return (0, _setDate.setDate)(value, date);
|
||||
};
|
||||
setHours = (value, hours) => {
|
||||
return (0, _setHours.setHours)(value, hours);
|
||||
};
|
||||
setMinutes = (value, minutes) => {
|
||||
return (0, _setMinutes.setMinutes)(value, minutes);
|
||||
};
|
||||
setSeconds = (value, seconds) => {
|
||||
return (0, _setSeconds.setSeconds)(value, seconds);
|
||||
};
|
||||
setMilliseconds = (value, milliseconds) => {
|
||||
return (0, _setMilliseconds.setMilliseconds)(value, milliseconds);
|
||||
};
|
||||
getDaysInMonth = value => {
|
||||
return (0, _getDaysInMonth.getDaysInMonth)(value);
|
||||
};
|
||||
getWeekArray = value => {
|
||||
const start = this.startOfWeek(this.startOfMonth(value));
|
||||
const end = this.endOfWeek(this.endOfMonth(value));
|
||||
let count = 0;
|
||||
let current = start;
|
||||
const nestedWeeks = [];
|
||||
while (this.isBefore(current, end)) {
|
||||
const weekNumber = Math.floor(count / 7);
|
||||
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
||||
nestedWeeks[weekNumber].push(current);
|
||||
current = this.addDays(current, 1);
|
||||
count += 1;
|
||||
}
|
||||
return nestedWeeks;
|
||||
};
|
||||
getWeekNumber = date => {
|
||||
return (0, _getWeek.getWeek)(date, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
getYearRange = ([start, end]) => {
|
||||
const startDate = this.startOfYear(start);
|
||||
const endDate = this.endOfYear(end);
|
||||
const years = [];
|
||||
let current = startDate;
|
||||
while (this.isBefore(current, endDate)) {
|
||||
years.push(current);
|
||||
current = this.addYears(current, 1);
|
||||
}
|
||||
return years;
|
||||
};
|
||||
}
|
||||
exports.AdapterDateFnsJalali = AdapterDateFnsJalali;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterDateFnsJalali/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterDateFnsJalali/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterDateFnsJalali } from "./AdapterDateFnsJalali.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterDateFnsJalali/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterDateFnsJalali/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterDateFnsJalali", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterDateFnsJalali.AdapterDateFnsJalali;
|
||||
}
|
||||
});
|
||||
var _AdapterDateFnsJalali = require("./AdapterDateFnsJalali");
|
||||
89
node_modules/@mui/x-date-pickers/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts
generated
vendored
Normal file
89
node_modules/@mui/x-date-pickers/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import type { Locale as DateFnsLocale } from 'date-fns-jalali';
|
||||
import { AdapterFormats, AdapterOptions, MuiPickersAdapter } from "../models/index.js";
|
||||
import { AdapterDateFnsBase } from "../AdapterDateFnsBase/index.js";
|
||||
declare module '@mui/x-date-pickers/models' {
|
||||
interface PickerValidDateLookup {
|
||||
'date-fns-jalali': Date;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Based on `@date-io/date-fns-jalali`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterDateFnsJalali extends AdapterDateFnsBase<DateFnsLocale> implements MuiPickersAdapter<DateFnsLocale> {
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
}?: AdapterOptions<DateFnsLocale, never>);
|
||||
parse: (value: string, format: string) => Date | null;
|
||||
isValid: (value: Date | null) => value is Date;
|
||||
format: (value: Date, formatKey: keyof AdapterFormats) => string;
|
||||
formatByString: (value: Date, formatString: string) => string;
|
||||
formatNumber: (numberToFormat: string) => string;
|
||||
isEqual: (value: Date | null, comparing: Date | null) => boolean;
|
||||
isSameYear: (value: Date, comparing: Date) => boolean;
|
||||
isSameMonth: (value: Date, comparing: Date) => boolean;
|
||||
isSameDay: (value: Date, comparing: Date) => boolean;
|
||||
isSameHour: (value: Date, comparing: Date) => boolean;
|
||||
isAfter: (value: Date, comparing: Date) => boolean;
|
||||
isAfterYear: (value: Date, comparing: Date) => boolean;
|
||||
isAfterDay: (value: Date, comparing: Date) => boolean;
|
||||
isBefore: (value: Date, comparing: Date) => boolean;
|
||||
isBeforeYear: (value: Date, comparing: Date) => boolean;
|
||||
isBeforeDay: (value: Date, comparing: Date) => boolean;
|
||||
isWithinRange: (value: Date, [start, end]: [Date, Date]) => boolean;
|
||||
startOfYear: (value: Date) => Date;
|
||||
startOfMonth: (value: Date) => Date;
|
||||
startOfWeek: (value: Date) => Date;
|
||||
startOfDay: (value: Date) => Date;
|
||||
endOfYear: (value: Date) => Date;
|
||||
endOfMonth: (value: Date) => Date;
|
||||
endOfWeek: (value: Date) => Date;
|
||||
endOfDay: (value: Date) => Date;
|
||||
addYears: (value: Date, amount: number) => Date;
|
||||
addMonths: (value: Date, amount: number) => Date;
|
||||
addWeeks: (value: Date, amount: number) => Date;
|
||||
addDays: (value: Date, amount: number) => Date;
|
||||
addHours: (value: Date, amount: number) => Date;
|
||||
addMinutes: (value: Date, amount: number) => Date;
|
||||
addSeconds: (value: Date, amount: number) => Date;
|
||||
getYear: (value: Date) => number;
|
||||
getMonth: (value: Date) => number;
|
||||
getDate: (value: Date) => number;
|
||||
getHours: (value: Date) => number;
|
||||
getMinutes: (value: Date) => number;
|
||||
getSeconds: (value: Date) => number;
|
||||
getMilliseconds: (value: Date) => number;
|
||||
setYear: (value: Date, year: number) => Date;
|
||||
setMonth: (value: Date, month: number) => Date;
|
||||
setDate: (value: Date, date: number) => Date;
|
||||
setHours: (value: Date, hours: number) => Date;
|
||||
setMinutes: (value: Date, minutes: number) => Date;
|
||||
setSeconds: (value: Date, seconds: number) => Date;
|
||||
setMilliseconds: (value: Date, milliseconds: number) => Date;
|
||||
getDaysInMonth: (value: Date) => number;
|
||||
getWeekArray: (value: Date) => Date[][];
|
||||
getWeekNumber: (date: Date) => number;
|
||||
getYearRange: ([start, end]: [Date, Date]) => Date[];
|
||||
}
|
||||
339
node_modules/@mui/x-date-pickers/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js
generated
vendored
Normal file
339
node_modules/@mui/x-date-pickers/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js
generated
vendored
Normal file
|
|
@ -0,0 +1,339 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterDateFnsJalali = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _index = _interopRequireDefault(require("date-fns-jalali/addSeconds/index.js"));
|
||||
var _index2 = _interopRequireDefault(require("date-fns-jalali/addMinutes/index.js"));
|
||||
var _index3 = _interopRequireDefault(require("date-fns-jalali/addHours/index.js"));
|
||||
var _index4 = _interopRequireDefault(require("date-fns-jalali/addDays/index.js"));
|
||||
var _index5 = _interopRequireDefault(require("date-fns-jalali/addWeeks/index.js"));
|
||||
var _index6 = _interopRequireDefault(require("date-fns-jalali/addMonths/index.js"));
|
||||
var _index7 = _interopRequireDefault(require("date-fns-jalali/addYears/index.js"));
|
||||
var _index8 = _interopRequireDefault(require("date-fns-jalali/endOfDay/index.js"));
|
||||
var _index9 = _interopRequireDefault(require("date-fns-jalali/endOfWeek/index.js"));
|
||||
var _index0 = _interopRequireDefault(require("date-fns-jalali/endOfYear/index.js"));
|
||||
var _index1 = _interopRequireDefault(require("date-fns-jalali/format/index.js"));
|
||||
var _index10 = _interopRequireDefault(require("date-fns-jalali/getHours/index.js"));
|
||||
var _index11 = _interopRequireDefault(require("date-fns-jalali/getSeconds/index.js"));
|
||||
var _index12 = _interopRequireDefault(require("date-fns-jalali/getMilliseconds/index.js"));
|
||||
var _index13 = _interopRequireDefault(require("date-fns-jalali/getWeek/index.js"));
|
||||
var _index14 = _interopRequireDefault(require("date-fns-jalali/getYear/index.js"));
|
||||
var _index15 = _interopRequireDefault(require("date-fns-jalali/getMonth/index.js"));
|
||||
var _index16 = _interopRequireDefault(require("date-fns-jalali/getDate/index.js"));
|
||||
var _index17 = _interopRequireDefault(require("date-fns-jalali/getDaysInMonth/index.js"));
|
||||
var _index18 = _interopRequireDefault(require("date-fns-jalali/getMinutes/index.js"));
|
||||
var _index19 = _interopRequireDefault(require("date-fns-jalali/isAfter/index.js"));
|
||||
var _index20 = _interopRequireDefault(require("date-fns-jalali/isBefore/index.js"));
|
||||
var _index21 = _interopRequireDefault(require("date-fns-jalali/isEqual/index.js"));
|
||||
var _index22 = _interopRequireDefault(require("date-fns-jalali/isSameDay/index.js"));
|
||||
var _index23 = _interopRequireDefault(require("date-fns-jalali/isSameYear/index.js"));
|
||||
var _index24 = _interopRequireDefault(require("date-fns-jalali/isSameMonth/index.js"));
|
||||
var _index25 = _interopRequireDefault(require("date-fns-jalali/isSameHour/index.js"));
|
||||
var _index26 = _interopRequireDefault(require("date-fns-jalali/isValid/index.js"));
|
||||
var _index27 = _interopRequireDefault(require("date-fns-jalali/parse/index.js"));
|
||||
var _index28 = _interopRequireDefault(require("date-fns-jalali/setDate/index.js"));
|
||||
var _index29 = _interopRequireDefault(require("date-fns-jalali/setHours/index.js"));
|
||||
var _index30 = _interopRequireDefault(require("date-fns-jalali/setMinutes/index.js"));
|
||||
var _index31 = _interopRequireDefault(require("date-fns-jalali/setMonth/index.js"));
|
||||
var _index32 = _interopRequireDefault(require("date-fns-jalali/setSeconds/index.js"));
|
||||
var _index33 = _interopRequireDefault(require("date-fns-jalali/setMilliseconds/index.js"));
|
||||
var _index34 = _interopRequireDefault(require("date-fns-jalali/setYear/index.js"));
|
||||
var _index35 = _interopRequireDefault(require("date-fns-jalali/startOfDay/index.js"));
|
||||
var _index36 = _interopRequireDefault(require("date-fns-jalali/startOfMonth/index.js"));
|
||||
var _index37 = _interopRequireDefault(require("date-fns-jalali/endOfMonth/index.js"));
|
||||
var _index38 = _interopRequireDefault(require("date-fns-jalali/startOfWeek/index.js"));
|
||||
var _index39 = _interopRequireDefault(require("date-fns-jalali/startOfYear/index.js"));
|
||||
var _index40 = _interopRequireDefault(require("date-fns-jalali/isWithinInterval/index.js"));
|
||||
var _index41 = _interopRequireDefault(require("date-fns-jalali/locale/fa-IR/index.js"));
|
||||
var _index42 = _interopRequireDefault(require("date-fns-jalali/_lib/format/longFormatters/index.js"));
|
||||
var _AdapterDateFnsBase = require("../AdapterDateFnsBase");
|
||||
// date-fns-jalali@<3 has no exports field defined
|
||||
// See https://github.com/date-fns/date-fns/issues/1781
|
||||
/* eslint-disable import/extensions */
|
||||
/* v8 ignore start */
|
||||
// @ts-nocheck
|
||||
|
||||
/* v8 ignore end */
|
||||
|
||||
const defaultFormats = {
|
||||
year: 'yyyy',
|
||||
month: 'LLLL',
|
||||
monthShort: 'MMM',
|
||||
dayOfMonth: 'd',
|
||||
dayOfMonthFull: 'do',
|
||||
weekday: 'EEEE',
|
||||
weekdayShort: 'EEEEEE',
|
||||
hours24h: 'HH',
|
||||
hours12h: 'hh',
|
||||
meridiem: 'aa',
|
||||
minutes: 'mm',
|
||||
seconds: 'ss',
|
||||
fullDate: 'PPP',
|
||||
keyboardDate: 'P',
|
||||
shortDate: 'd MMM',
|
||||
normalDate: 'd MMMM',
|
||||
normalDateWithWeekday: 'EEE, d MMMM',
|
||||
fullTime12h: 'hh:mm aaa',
|
||||
fullTime24h: 'HH:mm',
|
||||
keyboardDateTime12h: 'P hh:mm aa',
|
||||
keyboardDateTime24h: 'P HH:mm'
|
||||
};
|
||||
const NUMBER_SYMBOL_MAP = {
|
||||
'1': '۱',
|
||||
'2': '۲',
|
||||
'3': '۳',
|
||||
'4': '۴',
|
||||
'5': '۵',
|
||||
'6': '۶',
|
||||
'7': '۷',
|
||||
'8': '۸',
|
||||
'9': '۹',
|
||||
'0': '۰'
|
||||
};
|
||||
/**
|
||||
* Based on `@date-io/date-fns-jalali`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterDateFnsJalali extends _AdapterDateFnsBase.AdapterDateFnsBase {
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
} = {}) {
|
||||
/* v8 ignore start */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof _index4.default !== 'function') {
|
||||
throw new Error(['MUI: This adapter is only compatible with `date-fns-jalali` v2.x package versions.', 'Please, install v2.x of the package or use the `AdapterDateFnsJalali` instead.'].join('\n'));
|
||||
}
|
||||
}
|
||||
/* v8 ignore stop */
|
||||
super({
|
||||
locale: locale ?? _index41.default,
|
||||
// some formats are different in jalali adapter,
|
||||
// this ensures that `AdapterDateFnsBase` formats are overridden
|
||||
formats: (0, _extends2.default)({}, defaultFormats, formats),
|
||||
longFormatters: _index42.default,
|
||||
lib: 'date-fns-jalali'
|
||||
});
|
||||
}
|
||||
parse = (value, format) => {
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
return (0, _index27.default)(value, format, new Date(), {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
isValid = value => {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return (0, _index26.default)(value);
|
||||
};
|
||||
format = (value, formatKey) => {
|
||||
return this.formatByString(value, this.formats[formatKey]);
|
||||
};
|
||||
formatByString = (value, formatString) => {
|
||||
return (0, _index1.default)(value, formatString, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
formatNumber = numberToFormat => {
|
||||
return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
|
||||
};
|
||||
isEqual = (value, comparing) => {
|
||||
if (value === null && comparing === null) {
|
||||
return true;
|
||||
}
|
||||
if (value === null || comparing === null) {
|
||||
return false;
|
||||
}
|
||||
return (0, _index21.default)(value, comparing);
|
||||
};
|
||||
isSameYear = (value, comparing) => {
|
||||
return (0, _index23.default)(value, comparing);
|
||||
};
|
||||
isSameMonth = (value, comparing) => {
|
||||
return (0, _index24.default)(value, comparing);
|
||||
};
|
||||
isSameDay = (value, comparing) => {
|
||||
return (0, _index22.default)(value, comparing);
|
||||
};
|
||||
isSameHour = (value, comparing) => {
|
||||
return (0, _index25.default)(value, comparing);
|
||||
};
|
||||
isAfter = (value, comparing) => {
|
||||
return (0, _index19.default)(value, comparing);
|
||||
};
|
||||
isAfterYear = (value, comparing) => {
|
||||
return (0, _index19.default)(value, this.endOfYear(comparing));
|
||||
};
|
||||
isAfterDay = (value, comparing) => {
|
||||
return (0, _index19.default)(value, this.endOfDay(comparing));
|
||||
};
|
||||
isBefore = (value, comparing) => {
|
||||
return (0, _index20.default)(value, comparing);
|
||||
};
|
||||
isBeforeYear = (value, comparing) => {
|
||||
return (0, _index20.default)(value, this.startOfYear(comparing));
|
||||
};
|
||||
isBeforeDay = (value, comparing) => {
|
||||
return (0, _index20.default)(value, this.startOfDay(comparing));
|
||||
};
|
||||
isWithinRange = (value, [start, end]) => {
|
||||
return (0, _index40.default)(value, {
|
||||
start,
|
||||
end
|
||||
});
|
||||
};
|
||||
startOfYear = value => {
|
||||
return (0, _index39.default)(value);
|
||||
};
|
||||
startOfMonth = value => {
|
||||
return (0, _index36.default)(value);
|
||||
};
|
||||
startOfWeek = value => {
|
||||
return (0, _index38.default)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
startOfDay = value => {
|
||||
return (0, _index35.default)(value);
|
||||
};
|
||||
endOfYear = value => {
|
||||
return (0, _index0.default)(value);
|
||||
};
|
||||
endOfMonth = value => {
|
||||
return (0, _index37.default)(value);
|
||||
};
|
||||
endOfWeek = value => {
|
||||
return (0, _index9.default)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
endOfDay = value => {
|
||||
return (0, _index8.default)(value);
|
||||
};
|
||||
addYears = (value, amount) => {
|
||||
return (0, _index7.default)(value, amount);
|
||||
};
|
||||
addMonths = (value, amount) => {
|
||||
return (0, _index6.default)(value, amount);
|
||||
};
|
||||
addWeeks = (value, amount) => {
|
||||
return (0, _index5.default)(value, amount);
|
||||
};
|
||||
addDays = (value, amount) => {
|
||||
return (0, _index4.default)(value, amount);
|
||||
};
|
||||
addHours = (value, amount) => {
|
||||
return (0, _index3.default)(value, amount);
|
||||
};
|
||||
addMinutes = (value, amount) => {
|
||||
return (0, _index2.default)(value, amount);
|
||||
};
|
||||
addSeconds = (value, amount) => {
|
||||
return (0, _index.default)(value, amount);
|
||||
};
|
||||
getYear = value => {
|
||||
return (0, _index14.default)(value);
|
||||
};
|
||||
getMonth = value => {
|
||||
return (0, _index15.default)(value);
|
||||
};
|
||||
getDate = value => {
|
||||
return (0, _index16.default)(value);
|
||||
};
|
||||
getHours = value => {
|
||||
return (0, _index10.default)(value);
|
||||
};
|
||||
getMinutes = value => {
|
||||
return (0, _index18.default)(value);
|
||||
};
|
||||
getSeconds = value => {
|
||||
return (0, _index11.default)(value);
|
||||
};
|
||||
getMilliseconds = value => {
|
||||
return (0, _index12.default)(value);
|
||||
};
|
||||
setYear = (value, year) => {
|
||||
return (0, _index34.default)(value, year);
|
||||
};
|
||||
setMonth = (value, month) => {
|
||||
return (0, _index31.default)(value, month);
|
||||
};
|
||||
setDate = (value, date) => {
|
||||
return (0, _index28.default)(value, date);
|
||||
};
|
||||
setHours = (value, hours) => {
|
||||
return (0, _index29.default)(value, hours);
|
||||
};
|
||||
setMinutes = (value, minutes) => {
|
||||
return (0, _index30.default)(value, minutes);
|
||||
};
|
||||
setSeconds = (value, seconds) => {
|
||||
return (0, _index32.default)(value, seconds);
|
||||
};
|
||||
setMilliseconds = (value, milliseconds) => {
|
||||
return (0, _index33.default)(value, milliseconds);
|
||||
};
|
||||
getDaysInMonth = value => {
|
||||
return (0, _index17.default)(value);
|
||||
};
|
||||
getWeekArray = value => {
|
||||
const start = this.startOfWeek(this.startOfMonth(value));
|
||||
const end = this.endOfWeek(this.endOfMonth(value));
|
||||
let count = 0;
|
||||
let current = start;
|
||||
const nestedWeeks = [];
|
||||
while (this.isBefore(current, end)) {
|
||||
const weekNumber = Math.floor(count / 7);
|
||||
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
||||
nestedWeeks[weekNumber].push(current);
|
||||
current = this.addDays(current, 1);
|
||||
count += 1;
|
||||
}
|
||||
return nestedWeeks;
|
||||
};
|
||||
getWeekNumber = date => {
|
||||
return (0, _index13.default)(date, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
getYearRange = ([start, end]) => {
|
||||
const startDate = this.startOfYear(start);
|
||||
const endDate = this.endOfYear(end);
|
||||
const years = [];
|
||||
let current = startDate;
|
||||
while (this.isBefore(current, endDate)) {
|
||||
years.push(current);
|
||||
current = this.addYears(current, 1);
|
||||
}
|
||||
return years;
|
||||
};
|
||||
}
|
||||
exports.AdapterDateFnsJalali = AdapterDateFnsJalali;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterDateFnsJalaliV2/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterDateFnsJalaliV2/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterDateFnsJalali } from "./AdapterDateFnsJalaliV2.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterDateFnsJalaliV2/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterDateFnsJalaliV2/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterDateFnsJalali", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterDateFnsJalaliV.AdapterDateFnsJalali;
|
||||
}
|
||||
});
|
||||
var _AdapterDateFnsJalaliV = require("./AdapterDateFnsJalaliV2");
|
||||
88
node_modules/@mui/x-date-pickers/AdapterDateFnsV2/AdapterDateFnsV2.d.ts
generated
vendored
Normal file
88
node_modules/@mui/x-date-pickers/AdapterDateFnsV2/AdapterDateFnsV2.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
import type { Locale as DateFnsLocale } from 'date-fns';
|
||||
import { AdapterFormats, AdapterOptions, MuiPickersAdapter } from "../models/index.js";
|
||||
import { AdapterDateFnsBase } from "../AdapterDateFnsBase/index.js";
|
||||
declare module '@mui/x-date-pickers/models' {
|
||||
interface PickerValidDateLookup {
|
||||
'date-fns': Date;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Based on `@date-io/date-fns`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterDateFns extends AdapterDateFnsBase<DateFnsLocale> implements MuiPickersAdapter<DateFnsLocale> {
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
}?: AdapterOptions<DateFnsLocale, never>);
|
||||
parse: (value: string, format: string) => Date | null;
|
||||
isValid: (value: Date | null) => value is Date;
|
||||
format: (value: Date, formatKey: keyof AdapterFormats) => string;
|
||||
formatByString: (value: Date, formatString: string) => string;
|
||||
isEqual: (value: Date | null, comparing: Date | null) => boolean;
|
||||
isSameYear: (value: Date, comparing: Date) => boolean;
|
||||
isSameMonth: (value: Date, comparing: Date) => boolean;
|
||||
isSameDay: (value: Date, comparing: Date) => boolean;
|
||||
isSameHour: (value: Date, comparing: Date) => boolean;
|
||||
isAfter: (value: Date, comparing: Date) => boolean;
|
||||
isAfterYear: (value: Date, comparing: Date) => boolean;
|
||||
isAfterDay: (value: Date, comparing: Date) => boolean;
|
||||
isBefore: (value: Date, comparing: Date) => boolean;
|
||||
isBeforeYear: (value: Date, comparing: Date) => boolean;
|
||||
isBeforeDay: (value: Date, comparing: Date) => boolean;
|
||||
isWithinRange: (value: Date, [start, end]: [Date, Date]) => boolean;
|
||||
startOfYear: (value: Date) => Date;
|
||||
startOfMonth: (value: Date) => Date;
|
||||
startOfWeek: (value: Date) => Date;
|
||||
startOfDay: (value: Date) => Date;
|
||||
endOfYear: (value: Date) => Date;
|
||||
endOfMonth: (value: Date) => Date;
|
||||
endOfWeek: (value: Date) => Date;
|
||||
endOfDay: (value: Date) => Date;
|
||||
addYears: (value: Date, amount: number) => Date;
|
||||
addMonths: (value: Date, amount: number) => Date;
|
||||
addWeeks: (value: Date, amount: number) => Date;
|
||||
addDays: (value: Date, amount: number) => Date;
|
||||
addHours: (value: Date, amount: number) => Date;
|
||||
addMinutes: (value: Date, amount: number) => Date;
|
||||
addSeconds: (value: Date, amount: number) => Date;
|
||||
getYear: (value: Date) => number;
|
||||
getMonth: (value: Date) => number;
|
||||
getDate: (value: Date) => number;
|
||||
getHours: (value: Date) => number;
|
||||
getMinutes: (value: Date) => number;
|
||||
getSeconds: (value: Date) => number;
|
||||
getMilliseconds: (value: Date) => number;
|
||||
setYear: (value: Date, year: number) => Date;
|
||||
setMonth: (value: Date, month: number) => Date;
|
||||
setDate: (value: Date, date: number) => Date;
|
||||
setHours: (value: Date, hours: number) => Date;
|
||||
setMinutes: (value: Date, minutes: number) => Date;
|
||||
setSeconds: (value: Date, seconds: number) => Date;
|
||||
setMilliseconds: (value: Date, milliseconds: number) => Date;
|
||||
getDaysInMonth: (value: Date) => number;
|
||||
getWeekArray: (value: Date) => Date[][];
|
||||
getWeekNumber: (value: Date) => number;
|
||||
getYearRange: ([start, end]: [Date, Date]) => Date[];
|
||||
}
|
||||
297
node_modules/@mui/x-date-pickers/AdapterDateFnsV2/AdapterDateFnsV2.js
generated
vendored
Normal file
297
node_modules/@mui/x-date-pickers/AdapterDateFnsV2/AdapterDateFnsV2.js
generated
vendored
Normal file
|
|
@ -0,0 +1,297 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterDateFns = void 0;
|
||||
var _index = _interopRequireDefault(require("date-fns/addDays/index.js"));
|
||||
var _index2 = _interopRequireDefault(require("date-fns/addSeconds/index.js"));
|
||||
var _index3 = _interopRequireDefault(require("date-fns/addMinutes/index.js"));
|
||||
var _index4 = _interopRequireDefault(require("date-fns/addHours/index.js"));
|
||||
var _index5 = _interopRequireDefault(require("date-fns/addWeeks/index.js"));
|
||||
var _index6 = _interopRequireDefault(require("date-fns/addMonths/index.js"));
|
||||
var _index7 = _interopRequireDefault(require("date-fns/addYears/index.js"));
|
||||
var _index8 = _interopRequireDefault(require("date-fns/endOfDay/index.js"));
|
||||
var _index9 = _interopRequireDefault(require("date-fns/endOfWeek/index.js"));
|
||||
var _index0 = _interopRequireDefault(require("date-fns/endOfYear/index.js"));
|
||||
var _index1 = _interopRequireDefault(require("date-fns/format/index.js"));
|
||||
var _index10 = _interopRequireDefault(require("date-fns/getDate/index.js"));
|
||||
var _index11 = _interopRequireDefault(require("date-fns/getDaysInMonth/index.js"));
|
||||
var _index12 = _interopRequireDefault(require("date-fns/getHours/index.js"));
|
||||
var _index13 = _interopRequireDefault(require("date-fns/getMinutes/index.js"));
|
||||
var _index14 = _interopRequireDefault(require("date-fns/getMonth/index.js"));
|
||||
var _index15 = _interopRequireDefault(require("date-fns/getSeconds/index.js"));
|
||||
var _index16 = _interopRequireDefault(require("date-fns/getMilliseconds/index.js"));
|
||||
var _index17 = _interopRequireDefault(require("date-fns/getWeek/index.js"));
|
||||
var _index18 = _interopRequireDefault(require("date-fns/getYear/index.js"));
|
||||
var _index19 = _interopRequireDefault(require("date-fns/isAfter/index.js"));
|
||||
var _index20 = _interopRequireDefault(require("date-fns/isBefore/index.js"));
|
||||
var _index21 = _interopRequireDefault(require("date-fns/isEqual/index.js"));
|
||||
var _index22 = _interopRequireDefault(require("date-fns/isSameDay/index.js"));
|
||||
var _index23 = _interopRequireDefault(require("date-fns/isSameYear/index.js"));
|
||||
var _index24 = _interopRequireDefault(require("date-fns/isSameMonth/index.js"));
|
||||
var _index25 = _interopRequireDefault(require("date-fns/isSameHour/index.js"));
|
||||
var _index26 = _interopRequireDefault(require("date-fns/isValid/index.js"));
|
||||
var _index27 = _interopRequireDefault(require("date-fns/parse/index.js"));
|
||||
var _index28 = _interopRequireDefault(require("date-fns/setDate/index.js"));
|
||||
var _index29 = _interopRequireDefault(require("date-fns/setHours/index.js"));
|
||||
var _index30 = _interopRequireDefault(require("date-fns/setMinutes/index.js"));
|
||||
var _index31 = _interopRequireDefault(require("date-fns/setMonth/index.js"));
|
||||
var _index32 = _interopRequireDefault(require("date-fns/setSeconds/index.js"));
|
||||
var _index33 = _interopRequireDefault(require("date-fns/setMilliseconds/index.js"));
|
||||
var _index34 = _interopRequireDefault(require("date-fns/setYear/index.js"));
|
||||
var _index35 = _interopRequireDefault(require("date-fns/startOfDay/index.js"));
|
||||
var _index36 = _interopRequireDefault(require("date-fns/startOfMonth/index.js"));
|
||||
var _index37 = _interopRequireDefault(require("date-fns/endOfMonth/index.js"));
|
||||
var _index38 = _interopRequireDefault(require("date-fns/startOfWeek/index.js"));
|
||||
var _index39 = _interopRequireDefault(require("date-fns/startOfYear/index.js"));
|
||||
var _index40 = _interopRequireDefault(require("date-fns/isWithinInterval/index.js"));
|
||||
var _index41 = _interopRequireDefault(require("date-fns/locale/en-US/index.js"));
|
||||
var _index42 = _interopRequireDefault(require("date-fns/_lib/format/longFormatters/index.js"));
|
||||
var _AdapterDateFnsBase = require("../AdapterDateFnsBase");
|
||||
// date-fns@<3 has no exports field defined
|
||||
// See https://github.com/date-fns/date-fns/issues/1781
|
||||
/* eslint-disable import/extensions */
|
||||
/* v8 ignore start */
|
||||
// @ts-nocheck
|
||||
|
||||
/* v8 ignore end */
|
||||
|
||||
/**
|
||||
* Based on `@date-io/date-fns`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterDateFns extends _AdapterDateFnsBase.AdapterDateFnsBase {
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
} = {}) {
|
||||
/* v8 ignore start */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof _index.default !== 'function') {
|
||||
throw new Error(['MUI: This adapter is only compatible with `date-fns` v2.x package versions.', 'Please, install v2.x of the package or use the `AdapterDateFns` instead.'].join('\n'));
|
||||
}
|
||||
}
|
||||
/* v8 ignore stop */
|
||||
super({
|
||||
locale: locale ?? _index41.default,
|
||||
formats,
|
||||
longFormatters: _index42.default
|
||||
});
|
||||
}
|
||||
parse = (value, format) => {
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
return (0, _index27.default)(value, format, new Date(), {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
isValid = value => {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return (0, _index26.default)(value);
|
||||
};
|
||||
format = (value, formatKey) => {
|
||||
return this.formatByString(value, this.formats[formatKey]);
|
||||
};
|
||||
formatByString = (value, formatString) => {
|
||||
return (0, _index1.default)(value, formatString, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
isEqual = (value, comparing) => {
|
||||
if (value === null && comparing === null) {
|
||||
return true;
|
||||
}
|
||||
if (value === null || comparing === null) {
|
||||
return false;
|
||||
}
|
||||
return (0, _index21.default)(value, comparing);
|
||||
};
|
||||
isSameYear = (value, comparing) => {
|
||||
return (0, _index23.default)(value, comparing);
|
||||
};
|
||||
isSameMonth = (value, comparing) => {
|
||||
return (0, _index24.default)(value, comparing);
|
||||
};
|
||||
isSameDay = (value, comparing) => {
|
||||
return (0, _index22.default)(value, comparing);
|
||||
};
|
||||
isSameHour = (value, comparing) => {
|
||||
return (0, _index25.default)(value, comparing);
|
||||
};
|
||||
isAfter = (value, comparing) => {
|
||||
return (0, _index19.default)(value, comparing);
|
||||
};
|
||||
isAfterYear = (value, comparing) => {
|
||||
return (0, _index19.default)(value, (0, _index0.default)(comparing));
|
||||
};
|
||||
isAfterDay = (value, comparing) => {
|
||||
return (0, _index19.default)(value, (0, _index8.default)(comparing));
|
||||
};
|
||||
isBefore = (value, comparing) => {
|
||||
return (0, _index20.default)(value, comparing);
|
||||
};
|
||||
isBeforeYear = (value, comparing) => {
|
||||
return (0, _index20.default)(value, this.startOfYear(comparing));
|
||||
};
|
||||
isBeforeDay = (value, comparing) => {
|
||||
return (0, _index20.default)(value, this.startOfDay(comparing));
|
||||
};
|
||||
isWithinRange = (value, [start, end]) => {
|
||||
return (0, _index40.default)(value, {
|
||||
start,
|
||||
end
|
||||
});
|
||||
};
|
||||
startOfYear = value => {
|
||||
return (0, _index39.default)(value);
|
||||
};
|
||||
startOfMonth = value => {
|
||||
return (0, _index36.default)(value);
|
||||
};
|
||||
startOfWeek = value => {
|
||||
return (0, _index38.default)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
startOfDay = value => {
|
||||
return (0, _index35.default)(value);
|
||||
};
|
||||
endOfYear = value => {
|
||||
return (0, _index0.default)(value);
|
||||
};
|
||||
endOfMonth = value => {
|
||||
return (0, _index37.default)(value);
|
||||
};
|
||||
endOfWeek = value => {
|
||||
return (0, _index9.default)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
endOfDay = value => {
|
||||
return (0, _index8.default)(value);
|
||||
};
|
||||
addYears = (value, amount) => {
|
||||
return (0, _index7.default)(value, amount);
|
||||
};
|
||||
addMonths = (value, amount) => {
|
||||
return (0, _index6.default)(value, amount);
|
||||
};
|
||||
addWeeks = (value, amount) => {
|
||||
return (0, _index5.default)(value, amount);
|
||||
};
|
||||
addDays = (value, amount) => {
|
||||
return (0, _index.default)(value, amount);
|
||||
};
|
||||
addHours = (value, amount) => {
|
||||
return (0, _index4.default)(value, amount);
|
||||
};
|
||||
addMinutes = (value, amount) => {
|
||||
return (0, _index3.default)(value, amount);
|
||||
};
|
||||
addSeconds = (value, amount) => {
|
||||
return (0, _index2.default)(value, amount);
|
||||
};
|
||||
getYear = value => {
|
||||
return (0, _index18.default)(value);
|
||||
};
|
||||
getMonth = value => {
|
||||
return (0, _index14.default)(value);
|
||||
};
|
||||
getDate = value => {
|
||||
return (0, _index10.default)(value);
|
||||
};
|
||||
getHours = value => {
|
||||
return (0, _index12.default)(value);
|
||||
};
|
||||
getMinutes = value => {
|
||||
return (0, _index13.default)(value);
|
||||
};
|
||||
getSeconds = value => {
|
||||
return (0, _index15.default)(value);
|
||||
};
|
||||
getMilliseconds = value => {
|
||||
return (0, _index16.default)(value);
|
||||
};
|
||||
setYear = (value, year) => {
|
||||
return (0, _index34.default)(value, year);
|
||||
};
|
||||
setMonth = (value, month) => {
|
||||
return (0, _index31.default)(value, month);
|
||||
};
|
||||
setDate = (value, date) => {
|
||||
return (0, _index28.default)(value, date);
|
||||
};
|
||||
setHours = (value, hours) => {
|
||||
return (0, _index29.default)(value, hours);
|
||||
};
|
||||
setMinutes = (value, minutes) => {
|
||||
return (0, _index30.default)(value, minutes);
|
||||
};
|
||||
setSeconds = (value, seconds) => {
|
||||
return (0, _index32.default)(value, seconds);
|
||||
};
|
||||
setMilliseconds = (value, milliseconds) => {
|
||||
return (0, _index33.default)(value, milliseconds);
|
||||
};
|
||||
getDaysInMonth = value => {
|
||||
return (0, _index11.default)(value);
|
||||
};
|
||||
getWeekArray = value => {
|
||||
const start = this.startOfWeek(this.startOfMonth(value));
|
||||
const end = this.endOfWeek(this.endOfMonth(value));
|
||||
let count = 0;
|
||||
let current = start;
|
||||
const nestedWeeks = [];
|
||||
while (this.isBefore(current, end)) {
|
||||
const weekNumber = Math.floor(count / 7);
|
||||
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
||||
nestedWeeks[weekNumber].push(current);
|
||||
current = this.addDays(current, 1);
|
||||
count += 1;
|
||||
}
|
||||
return nestedWeeks;
|
||||
};
|
||||
getWeekNumber = value => {
|
||||
return (0, _index17.default)(value, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
getYearRange = ([start, end]) => {
|
||||
const startDate = this.startOfYear(start);
|
||||
const endDate = this.endOfYear(end);
|
||||
const years = [];
|
||||
let current = startDate;
|
||||
while (this.isBefore(current, endDate)) {
|
||||
years.push(current);
|
||||
current = this.addYears(current, 1);
|
||||
}
|
||||
return years;
|
||||
};
|
||||
}
|
||||
exports.AdapterDateFns = AdapterDateFns;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterDateFnsV2/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterDateFnsV2/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterDateFns } from "./AdapterDateFnsV2.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterDateFnsV2/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterDateFnsV2/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterDateFns", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterDateFnsV.AdapterDateFns;
|
||||
}
|
||||
});
|
||||
var _AdapterDateFnsV = require("./AdapterDateFnsV2");
|
||||
126
node_modules/@mui/x-date-pickers/AdapterDayjs/AdapterDayjs.d.ts
generated
vendored
Normal file
126
node_modules/@mui/x-date-pickers/AdapterDayjs/AdapterDayjs.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
import dayjs, { Dayjs } from 'dayjs';
|
||||
import { FieldFormatTokenMap, MuiPickersAdapter, AdapterFormats, AdapterOptions, PickersTimezone, DateBuilderReturnType } from "../models/index.js";
|
||||
declare module '@mui/x-date-pickers/models' {
|
||||
interface PickerValidDateLookup {
|
||||
dayjs: Dayjs;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Based on `@date-io/dayjs`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterDayjs implements MuiPickersAdapter<string> {
|
||||
isMUIAdapter: boolean;
|
||||
isTimezoneCompatible: boolean;
|
||||
lib: string;
|
||||
locale?: string;
|
||||
formats: AdapterFormats;
|
||||
escapedCharacters: {
|
||||
start: string;
|
||||
end: string;
|
||||
};
|
||||
formatTokenMap: FieldFormatTokenMap;
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
}?: AdapterOptions<string, never>);
|
||||
private setLocaleToValue;
|
||||
private hasUTCPlugin;
|
||||
private hasTimezonePlugin;
|
||||
private isSame;
|
||||
/**
|
||||
* Replaces "default" by undefined and "system" by the system timezone before passing it to `dayjs`.
|
||||
*/
|
||||
private cleanTimezone;
|
||||
private createSystemDate;
|
||||
private createUTCDate;
|
||||
private createTZDate;
|
||||
private getLocaleFormats;
|
||||
/**
|
||||
* If the new day does not have the same offset as the old one (when switching to summer day time for example),
|
||||
* Then dayjs will not automatically adjust the offset (moment does).
|
||||
* We have to parse again the value to make sure the `fixOffset` method is applied.
|
||||
* See https://github.com/iamkun/dayjs/blob/b3624de619d6e734cd0ffdbbd3502185041c1b60/src/plugin/timezone/index.js#L72
|
||||
*/
|
||||
private adjustOffset;
|
||||
date: <T extends string | null | undefined>(value?: T, timezone?: PickersTimezone) => DateBuilderReturnType<T>;
|
||||
getInvalidDate: () => dayjs.Dayjs;
|
||||
getTimezone: (value: Dayjs) => string;
|
||||
setTimezone: (value: Dayjs, timezone: PickersTimezone) => Dayjs;
|
||||
toJsDate: (value: Dayjs) => Date;
|
||||
parse: (value: string, format: string) => dayjs.Dayjs | null;
|
||||
getCurrentLocaleCode: () => string;
|
||||
is12HourCycleInCurrentLocale: () => boolean;
|
||||
expandFormat: (format: string) => string;
|
||||
isValid: (value: Dayjs | null) => value is Dayjs;
|
||||
format: (value: Dayjs, formatKey: keyof AdapterFormats) => string;
|
||||
formatByString: (value: Dayjs, formatString: string) => string;
|
||||
formatNumber: (numberToFormat: string) => string;
|
||||
isEqual: (value: Dayjs | null, comparing: Dayjs | null) => boolean;
|
||||
isSameYear: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isSameMonth: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isSameDay: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isSameHour: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isAfter: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isAfterYear: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isAfterDay: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isBefore: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isBeforeYear: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isBeforeDay: (value: Dayjs, comparing: Dayjs) => boolean;
|
||||
isWithinRange: (value: Dayjs, [start, end]: [Dayjs, Dayjs]) => boolean;
|
||||
startOfYear: (value: Dayjs) => dayjs.Dayjs;
|
||||
startOfMonth: (value: Dayjs) => dayjs.Dayjs;
|
||||
startOfWeek: (value: Dayjs) => dayjs.Dayjs;
|
||||
startOfDay: (value: Dayjs) => dayjs.Dayjs;
|
||||
endOfYear: (value: Dayjs) => dayjs.Dayjs;
|
||||
endOfMonth: (value: Dayjs) => dayjs.Dayjs;
|
||||
endOfWeek: (value: Dayjs) => dayjs.Dayjs;
|
||||
endOfDay: (value: Dayjs) => dayjs.Dayjs;
|
||||
addYears: (value: Dayjs, amount: number) => dayjs.Dayjs;
|
||||
addMonths: (value: Dayjs, amount: number) => dayjs.Dayjs;
|
||||
addWeeks: (value: Dayjs, amount: number) => dayjs.Dayjs;
|
||||
addDays: (value: Dayjs, amount: number) => dayjs.Dayjs;
|
||||
addHours: (value: Dayjs, amount: number) => dayjs.Dayjs;
|
||||
addMinutes: (value: Dayjs, amount: number) => dayjs.Dayjs;
|
||||
addSeconds: (value: Dayjs, amount: number) => dayjs.Dayjs;
|
||||
getYear: (value: Dayjs) => number;
|
||||
getMonth: (value: Dayjs) => number;
|
||||
getDate: (value: Dayjs) => number;
|
||||
getHours: (value: Dayjs) => number;
|
||||
getMinutes: (value: Dayjs) => number;
|
||||
getSeconds: (value: Dayjs) => number;
|
||||
getMilliseconds: (value: Dayjs) => number;
|
||||
setYear: (value: Dayjs, year: number) => dayjs.Dayjs;
|
||||
setMonth: (value: Dayjs, month: number) => dayjs.Dayjs;
|
||||
setDate: (value: Dayjs, date: number) => dayjs.Dayjs;
|
||||
setHours: (value: Dayjs, hours: number) => dayjs.Dayjs;
|
||||
setMinutes: (value: Dayjs, minutes: number) => dayjs.Dayjs;
|
||||
setSeconds: (value: Dayjs, seconds: number) => dayjs.Dayjs;
|
||||
setMilliseconds: (value: Dayjs, milliseconds: number) => dayjs.Dayjs;
|
||||
getDaysInMonth: (value: Dayjs) => number;
|
||||
getWeekArray: (value: Dayjs) => dayjs.Dayjs[][];
|
||||
getWeekNumber: (value: Dayjs) => number;
|
||||
getDayOfWeek(value: Dayjs): number;
|
||||
getYearRange: ([start, end]: [Dayjs, Dayjs]) => dayjs.Dayjs[];
|
||||
}
|
||||
564
node_modules/@mui/x-date-pickers/AdapterDayjs/AdapterDayjs.js
generated
vendored
Normal file
564
node_modules/@mui/x-date-pickers/AdapterDayjs/AdapterDayjs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,564 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterDayjs = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _dayjs = _interopRequireDefault(require("dayjs"));
|
||||
var _weekOfYear = _interopRequireDefault(require("dayjs/plugin/weekOfYear.js"));
|
||||
var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat.js"));
|
||||
var _localizedFormat = _interopRequireDefault(require("dayjs/plugin/localizedFormat.js"));
|
||||
var _isBetween = _interopRequireDefault(require("dayjs/plugin/isBetween.js"));
|
||||
var _advancedFormat = _interopRequireDefault(require("dayjs/plugin/advancedFormat.js"));
|
||||
var _warning = require("@mui/x-internals/warning");
|
||||
/* v8 ignore start */
|
||||
|
||||
// dayjs has no exports field defined
|
||||
// See https://github.com/iamkun/dayjs/issues/2562
|
||||
/* eslint-disable import/extensions */
|
||||
|
||||
/* v8 ignore stop */
|
||||
/* eslint-enable import/extensions */
|
||||
|
||||
_dayjs.default.extend(_localizedFormat.default);
|
||||
_dayjs.default.extend(_weekOfYear.default);
|
||||
_dayjs.default.extend(_isBetween.default);
|
||||
_dayjs.default.extend(_advancedFormat.default);
|
||||
const formatTokenMap = {
|
||||
// Year
|
||||
YY: 'year',
|
||||
YYYY: {
|
||||
sectionType: 'year',
|
||||
contentType: 'digit',
|
||||
maxLength: 4
|
||||
},
|
||||
// Month
|
||||
M: {
|
||||
sectionType: 'month',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
MM: 'month',
|
||||
MMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
MMMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Day of the month
|
||||
D: {
|
||||
sectionType: 'day',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
DD: 'day',
|
||||
Do: {
|
||||
sectionType: 'day',
|
||||
contentType: 'digit-with-letter'
|
||||
},
|
||||
// Day of the week
|
||||
d: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
dd: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
ddd: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
dddd: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Meridiem
|
||||
A: 'meridiem',
|
||||
a: 'meridiem',
|
||||
// Hours
|
||||
H: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
HH: 'hours',
|
||||
h: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
hh: 'hours',
|
||||
// Minutes
|
||||
m: {
|
||||
sectionType: 'minutes',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
mm: 'minutes',
|
||||
// Seconds
|
||||
s: {
|
||||
sectionType: 'seconds',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
ss: 'seconds'
|
||||
};
|
||||
const defaultFormats = {
|
||||
year: 'YYYY',
|
||||
month: 'MMMM',
|
||||
monthShort: 'MMM',
|
||||
dayOfMonth: 'D',
|
||||
dayOfMonthFull: 'Do',
|
||||
weekday: 'dddd',
|
||||
weekdayShort: 'dd',
|
||||
hours24h: 'HH',
|
||||
hours12h: 'hh',
|
||||
meridiem: 'A',
|
||||
minutes: 'mm',
|
||||
seconds: 'ss',
|
||||
fullDate: 'll',
|
||||
keyboardDate: 'L',
|
||||
shortDate: 'MMM D',
|
||||
normalDate: 'D MMMM',
|
||||
normalDateWithWeekday: 'ddd, MMM D',
|
||||
fullTime12h: 'hh:mm A',
|
||||
fullTime24h: 'HH:mm',
|
||||
keyboardDateTime12h: 'L hh:mm A',
|
||||
keyboardDateTime24h: 'L HH:mm'
|
||||
};
|
||||
const MISSING_UTC_PLUGIN = ['Missing UTC plugin', 'To be able to use UTC or timezones, you have to enable the `utc` plugin', 'Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc'].join('\n');
|
||||
const MISSING_TIMEZONE_PLUGIN = ['Missing timezone plugin', 'To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin', 'Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone'].join('\n');
|
||||
/**
|
||||
* Based on `@date-io/dayjs`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterDayjs {
|
||||
isMUIAdapter = true;
|
||||
isTimezoneCompatible = true;
|
||||
lib = 'dayjs';
|
||||
escapedCharacters = {
|
||||
start: '[',
|
||||
end: ']'
|
||||
};
|
||||
formatTokenMap = formatTokenMap;
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
} = {}) {
|
||||
this.locale = locale;
|
||||
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
||||
|
||||
// Moved plugins to the constructor to allow for users to use options on the library
|
||||
// for reference: https://github.com/mui/mui-x/pull/11151
|
||||
_dayjs.default.extend(_customParseFormat.default);
|
||||
}
|
||||
setLocaleToValue = value => {
|
||||
const expectedLocale = this.getCurrentLocaleCode();
|
||||
if (expectedLocale === value.locale()) {
|
||||
return value;
|
||||
}
|
||||
return value.locale(expectedLocale);
|
||||
};
|
||||
hasUTCPlugin = () => typeof _dayjs.default.utc !== 'undefined';
|
||||
hasTimezonePlugin = () => typeof _dayjs.default.tz !== 'undefined';
|
||||
isSame = (value, comparing, comparisonTemplate) => {
|
||||
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
||||
return value.format(comparisonTemplate) === comparingInValueTimezone.format(comparisonTemplate);
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces "default" by undefined and "system" by the system timezone before passing it to `dayjs`.
|
||||
*/
|
||||
cleanTimezone = timezone => {
|
||||
switch (timezone) {
|
||||
case 'default':
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
case 'system':
|
||||
{
|
||||
return _dayjs.default.tz.guess();
|
||||
}
|
||||
default:
|
||||
{
|
||||
return timezone;
|
||||
}
|
||||
}
|
||||
};
|
||||
createSystemDate = value => {
|
||||
let date;
|
||||
if (this.hasUTCPlugin() && this.hasTimezonePlugin()) {
|
||||
const timezone = _dayjs.default.tz.guess();
|
||||
if (timezone === 'UTC') {
|
||||
date = (0, _dayjs.default)(value);
|
||||
} /* v8 ignore next 3 */else {
|
||||
// We can't change the system timezone in the tests
|
||||
date = _dayjs.default.tz(value, timezone);
|
||||
}
|
||||
} else {
|
||||
date = (0, _dayjs.default)(value);
|
||||
}
|
||||
return this.setLocaleToValue(date);
|
||||
};
|
||||
createUTCDate = value => {
|
||||
/* v8 ignore next 3 */
|
||||
if (!this.hasUTCPlugin()) {
|
||||
throw new Error(MISSING_UTC_PLUGIN);
|
||||
}
|
||||
return this.setLocaleToValue(_dayjs.default.utc(value));
|
||||
};
|
||||
createTZDate = (value, timezone) => {
|
||||
/* v8 ignore next 3 */
|
||||
if (!this.hasUTCPlugin()) {
|
||||
throw new Error(MISSING_UTC_PLUGIN);
|
||||
}
|
||||
|
||||
/* v8 ignore next 3 */
|
||||
if (!this.hasTimezonePlugin()) {
|
||||
throw new Error(MISSING_TIMEZONE_PLUGIN);
|
||||
}
|
||||
const keepLocalTime = value !== undefined && !value.endsWith('Z');
|
||||
return this.setLocaleToValue((0, _dayjs.default)(value).tz(this.cleanTimezone(timezone), keepLocalTime));
|
||||
};
|
||||
getLocaleFormats = () => {
|
||||
const locales = _dayjs.default.Ls;
|
||||
const locale = this.locale || 'en';
|
||||
let localeObject = locales[locale];
|
||||
if (localeObject === undefined) {
|
||||
/* v8 ignore start */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
(0, _warning.warnOnce)(['MUI X: Your locale has not been found.', 'Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale.', "Or you forget to import the locale from 'dayjs/locale/{localeUsed}'", 'fallback on English locale.']);
|
||||
}
|
||||
/* v8 ignore stop */
|
||||
localeObject = locales.en;
|
||||
}
|
||||
return localeObject.formats;
|
||||
};
|
||||
|
||||
/**
|
||||
* If the new day does not have the same offset as the old one (when switching to summer day time for example),
|
||||
* Then dayjs will not automatically adjust the offset (moment does).
|
||||
* We have to parse again the value to make sure the `fixOffset` method is applied.
|
||||
* See https://github.com/iamkun/dayjs/blob/b3624de619d6e734cd0ffdbbd3502185041c1b60/src/plugin/timezone/index.js#L72
|
||||
*/
|
||||
adjustOffset = value => {
|
||||
if (!this.hasTimezonePlugin()) {
|
||||
return value;
|
||||
}
|
||||
const timezone = this.getTimezone(value);
|
||||
if (timezone !== 'UTC') {
|
||||
const fixedValue = value.tz(this.cleanTimezone(timezone), true);
|
||||
// TODO: Simplify the case when we raise the `dayjs` peer dep to 1.11.12 (https://github.com/iamkun/dayjs/releases/tag/v1.11.12)
|
||||
/* v8 ignore next 3 */
|
||||
// @ts-ignore
|
||||
if (fixedValue.$offset === (value.$offset ?? 0)) {
|
||||
return value;
|
||||
}
|
||||
// Change only what is needed to avoid creating a new object with unwanted data
|
||||
// Especially important when used in an environment where utc or timezone dates are used only in some places
|
||||
// Reference: https://github.com/mui/mui-x/issues/13290
|
||||
// @ts-ignore
|
||||
value.$offset = fixedValue.$offset;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
date = (value, timezone = 'default') => {
|
||||
if (value === null) {
|
||||
return null;
|
||||
}
|
||||
if (timezone === 'UTC') {
|
||||
return this.createUTCDate(value);
|
||||
}
|
||||
if (timezone === 'system' || timezone === 'default' && !this.hasTimezonePlugin()) {
|
||||
return this.createSystemDate(value);
|
||||
}
|
||||
return this.createTZDate(value, timezone);
|
||||
};
|
||||
getInvalidDate = () => (0, _dayjs.default)(new Date('Invalid date'));
|
||||
getTimezone = value => {
|
||||
if (this.hasTimezonePlugin()) {
|
||||
// @ts-ignore
|
||||
const zone = value.$x?.$timezone;
|
||||
if (zone) {
|
||||
return zone;
|
||||
}
|
||||
}
|
||||
if (this.hasUTCPlugin() && value.isUTC()) {
|
||||
return 'UTC';
|
||||
}
|
||||
return 'system';
|
||||
};
|
||||
setTimezone = (value, timezone) => {
|
||||
if (this.getTimezone(value) === timezone) {
|
||||
return value;
|
||||
}
|
||||
if (timezone === 'UTC') {
|
||||
/* v8 ignore next 3 */
|
||||
if (!this.hasUTCPlugin()) {
|
||||
throw new Error(MISSING_UTC_PLUGIN);
|
||||
}
|
||||
return value.utc();
|
||||
}
|
||||
|
||||
// We know that we have the UTC plugin.
|
||||
// Otherwise, the value timezone would always equal "system".
|
||||
// And it would be caught by the first "if" of this method.
|
||||
if (timezone === 'system') {
|
||||
return value.local();
|
||||
}
|
||||
if (!this.hasTimezonePlugin()) {
|
||||
if (timezone === 'default') {
|
||||
return value;
|
||||
}
|
||||
|
||||
/* v8 ignore next */
|
||||
throw new Error(MISSING_TIMEZONE_PLUGIN);
|
||||
}
|
||||
return this.setLocaleToValue(_dayjs.default.tz(value, this.cleanTimezone(timezone)));
|
||||
};
|
||||
toJsDate = value => {
|
||||
return value.toDate();
|
||||
};
|
||||
parse = (value, format) => {
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
return (0, _dayjs.default)(value, format, this.locale, true);
|
||||
};
|
||||
getCurrentLocaleCode = () => {
|
||||
return this.locale || 'en';
|
||||
};
|
||||
is12HourCycleInCurrentLocale = () => {
|
||||
/* v8 ignore next */
|
||||
return /A|a/.test(this.getLocaleFormats().LT || '');
|
||||
};
|
||||
expandFormat = format => {
|
||||
const localeFormats = this.getLocaleFormats();
|
||||
|
||||
// @see https://github.com/iamkun/dayjs/blob/dev/src/plugin/localizedFormat/index.js
|
||||
const t = formatBis => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
|
||||
return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
|
||||
const B = b && b.toUpperCase();
|
||||
return a || localeFormats[b] || t(localeFormats[B]);
|
||||
});
|
||||
};
|
||||
isValid = value => {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return value.isValid();
|
||||
};
|
||||
format = (value, formatKey) => {
|
||||
return this.formatByString(value, this.formats[formatKey]);
|
||||
};
|
||||
formatByString = (value, formatString) => {
|
||||
return this.setLocaleToValue(value).format(formatString);
|
||||
};
|
||||
formatNumber = numberToFormat => {
|
||||
return numberToFormat;
|
||||
};
|
||||
isEqual = (value, comparing) => {
|
||||
if (value === null && comparing === null) {
|
||||
return true;
|
||||
}
|
||||
if (value === null || comparing === null) {
|
||||
return false;
|
||||
}
|
||||
return value.toDate().getTime() === comparing.toDate().getTime();
|
||||
};
|
||||
isSameYear = (value, comparing) => {
|
||||
return this.isSame(value, comparing, 'YYYY');
|
||||
};
|
||||
isSameMonth = (value, comparing) => {
|
||||
return this.isSame(value, comparing, 'YYYY-MM');
|
||||
};
|
||||
isSameDay = (value, comparing) => {
|
||||
return this.isSame(value, comparing, 'YYYY-MM-DD');
|
||||
};
|
||||
isSameHour = (value, comparing) => {
|
||||
return value.isSame(comparing, 'hour');
|
||||
};
|
||||
isAfter = (value, comparing) => {
|
||||
return value > comparing;
|
||||
};
|
||||
isAfterYear = (value, comparing) => {
|
||||
if (!this.hasUTCPlugin()) {
|
||||
return value.isAfter(comparing, 'year');
|
||||
}
|
||||
return !this.isSameYear(value, comparing) && value.utc() > comparing.utc();
|
||||
};
|
||||
isAfterDay = (value, comparing) => {
|
||||
if (!this.hasUTCPlugin()) {
|
||||
return value.isAfter(comparing, 'day');
|
||||
}
|
||||
return !this.isSameDay(value, comparing) && value.utc() > comparing.utc();
|
||||
};
|
||||
isBefore = (value, comparing) => {
|
||||
return value < comparing;
|
||||
};
|
||||
isBeforeYear = (value, comparing) => {
|
||||
if (!this.hasUTCPlugin()) {
|
||||
return value.isBefore(comparing, 'year');
|
||||
}
|
||||
return !this.isSameYear(value, comparing) && value.utc() < comparing.utc();
|
||||
};
|
||||
isBeforeDay = (value, comparing) => {
|
||||
if (!this.hasUTCPlugin()) {
|
||||
return value.isBefore(comparing, 'day');
|
||||
}
|
||||
return !this.isSameDay(value, comparing) && value.utc() < comparing.utc();
|
||||
};
|
||||
isWithinRange = (value, [start, end]) => {
|
||||
return value >= start && value <= end;
|
||||
};
|
||||
startOfYear = value => {
|
||||
return this.adjustOffset(value.startOf('year'));
|
||||
};
|
||||
startOfMonth = value => {
|
||||
return this.adjustOffset(value.startOf('month'));
|
||||
};
|
||||
startOfWeek = value => {
|
||||
return this.adjustOffset(this.setLocaleToValue(value).startOf('week'));
|
||||
};
|
||||
startOfDay = value => {
|
||||
return this.adjustOffset(value.startOf('day'));
|
||||
};
|
||||
endOfYear = value => {
|
||||
return this.adjustOffset(value.endOf('year'));
|
||||
};
|
||||
endOfMonth = value => {
|
||||
return this.adjustOffset(value.endOf('month'));
|
||||
};
|
||||
endOfWeek = value => {
|
||||
return this.adjustOffset(this.setLocaleToValue(value).endOf('week'));
|
||||
};
|
||||
endOfDay = value => {
|
||||
return this.adjustOffset(value.endOf('day'));
|
||||
};
|
||||
addYears = (value, amount) => {
|
||||
return this.adjustOffset(value.add(amount, 'year'));
|
||||
};
|
||||
addMonths = (value, amount) => {
|
||||
return this.adjustOffset(value.add(amount, 'month'));
|
||||
};
|
||||
addWeeks = (value, amount) => {
|
||||
return this.adjustOffset(value.add(amount, 'week'));
|
||||
};
|
||||
addDays = (value, amount) => {
|
||||
return this.adjustOffset(value.add(amount, 'day'));
|
||||
};
|
||||
addHours = (value, amount) => {
|
||||
return this.adjustOffset(value.add(amount, 'hour'));
|
||||
};
|
||||
addMinutes = (value, amount) => {
|
||||
return this.adjustOffset(value.add(amount, 'minute'));
|
||||
};
|
||||
addSeconds = (value, amount) => {
|
||||
return this.adjustOffset(value.add(amount, 'second'));
|
||||
};
|
||||
getYear = value => {
|
||||
return value.year();
|
||||
};
|
||||
getMonth = value => {
|
||||
return value.month();
|
||||
};
|
||||
getDate = value => {
|
||||
return value.date();
|
||||
};
|
||||
getHours = value => {
|
||||
return value.hour();
|
||||
};
|
||||
getMinutes = value => {
|
||||
return value.minute();
|
||||
};
|
||||
getSeconds = value => {
|
||||
return value.second();
|
||||
};
|
||||
getMilliseconds = value => {
|
||||
return value.millisecond();
|
||||
};
|
||||
setYear = (value, year) => {
|
||||
return this.adjustOffset(value.set('year', year));
|
||||
};
|
||||
setMonth = (value, month) => {
|
||||
return this.adjustOffset(value.set('month', month));
|
||||
};
|
||||
setDate = (value, date) => {
|
||||
return this.adjustOffset(value.set('date', date));
|
||||
};
|
||||
setHours = (value, hours) => {
|
||||
return this.adjustOffset(value.set('hour', hours));
|
||||
};
|
||||
setMinutes = (value, minutes) => {
|
||||
return this.adjustOffset(value.set('minute', minutes));
|
||||
};
|
||||
setSeconds = (value, seconds) => {
|
||||
return this.adjustOffset(value.set('second', seconds));
|
||||
};
|
||||
setMilliseconds = (value, milliseconds) => {
|
||||
return this.adjustOffset(value.set('millisecond', milliseconds));
|
||||
};
|
||||
getDaysInMonth = value => {
|
||||
return value.daysInMonth();
|
||||
};
|
||||
getWeekArray = value => {
|
||||
const start = this.startOfWeek(this.startOfMonth(value));
|
||||
const end = this.endOfWeek(this.endOfMonth(value));
|
||||
let count = 0;
|
||||
let current = start;
|
||||
const nestedWeeks = [];
|
||||
while (current < end) {
|
||||
const weekNumber = Math.floor(count / 7);
|
||||
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
||||
nestedWeeks[weekNumber].push(current);
|
||||
current = this.addDays(current, 1);
|
||||
count += 1;
|
||||
}
|
||||
return nestedWeeks;
|
||||
};
|
||||
getWeekNumber = value => {
|
||||
return value.week();
|
||||
};
|
||||
getDayOfWeek(value) {
|
||||
return value.day() + 1;
|
||||
}
|
||||
getYearRange = ([start, end]) => {
|
||||
const startDate = this.startOfYear(start);
|
||||
const endDate = this.endOfYear(end);
|
||||
const years = [];
|
||||
let current = startDate;
|
||||
while (this.isBefore(current, endDate)) {
|
||||
years.push(current);
|
||||
current = this.addYears(current, 1);
|
||||
}
|
||||
return years;
|
||||
};
|
||||
}
|
||||
exports.AdapterDayjs = AdapterDayjs;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterDayjs/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterDayjs/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterDayjs } from "./AdapterDayjs.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterDayjs/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterDayjs/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterDayjs", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterDayjs.AdapterDayjs;
|
||||
}
|
||||
});
|
||||
var _AdapterDayjs = require("./AdapterDayjs");
|
||||
108
node_modules/@mui/x-date-pickers/AdapterLuxon/AdapterLuxon.d.ts
generated
vendored
Normal file
108
node_modules/@mui/x-date-pickers/AdapterLuxon/AdapterLuxon.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
import { DateTime } from 'luxon';
|
||||
import { AdapterFormats, AdapterOptions, DateBuilderReturnType, FieldFormatTokenMap, MuiPickersAdapter, PickersTimezone } from "../models/index.js";
|
||||
declare module '@mui/x-date-pickers/models' {
|
||||
interface PickerValidDateLookup {
|
||||
luxon: DateTime;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Based on `@date-io/luxon`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterLuxon implements MuiPickersAdapter<string> {
|
||||
isMUIAdapter: boolean;
|
||||
isTimezoneCompatible: boolean;
|
||||
lib: string;
|
||||
locale: string;
|
||||
formats: AdapterFormats;
|
||||
escapedCharacters: {
|
||||
start: string;
|
||||
end: string;
|
||||
};
|
||||
formatTokenMap: FieldFormatTokenMap;
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
}?: AdapterOptions<string, never>);
|
||||
private setLocaleToValue;
|
||||
date: <T extends string | null | undefined>(value?: T, timezone?: PickersTimezone) => DateBuilderReturnType<T>;
|
||||
getInvalidDate: () => DateTime<true> | DateTime<false>;
|
||||
getTimezone: (value: DateTime) => string;
|
||||
setTimezone: (value: DateTime, timezone: PickersTimezone) => DateTime;
|
||||
toJsDate: (value: DateTime) => Date;
|
||||
parse: (value: string, formatString: string) => DateTime<true> | DateTime<false> | null;
|
||||
getCurrentLocaleCode: () => string;
|
||||
is12HourCycleInCurrentLocale: () => boolean;
|
||||
expandFormat: (format: string) => string;
|
||||
isValid: (value: DateTime | null) => value is DateTime;
|
||||
format: (value: DateTime, formatKey: keyof AdapterFormats) => string;
|
||||
formatByString: (value: DateTime, format: string) => string;
|
||||
formatNumber: (numberToFormat: string) => string;
|
||||
isEqual: (value: DateTime | null, comparing: DateTime | null) => boolean;
|
||||
isSameYear: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isSameMonth: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isSameDay: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isSameHour: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isAfter: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isAfterYear: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isAfterDay: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isBefore: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isBeforeYear: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isBeforeDay: (value: DateTime, comparing: DateTime) => boolean;
|
||||
isWithinRange: (value: DateTime, [start, end]: [DateTime, DateTime]) => boolean;
|
||||
startOfYear: (value: DateTime) => DateTime<boolean>;
|
||||
startOfMonth: (value: DateTime) => DateTime<boolean>;
|
||||
startOfWeek: (value: DateTime) => DateTime<boolean>;
|
||||
startOfDay: (value: DateTime) => DateTime<boolean>;
|
||||
endOfYear: (value: DateTime) => DateTime<boolean>;
|
||||
endOfMonth: (value: DateTime) => DateTime<boolean>;
|
||||
endOfWeek: (value: DateTime) => DateTime<boolean>;
|
||||
endOfDay: (value: DateTime) => DateTime<boolean>;
|
||||
addYears: (value: DateTime, amount: number) => DateTime<boolean>;
|
||||
addMonths: (value: DateTime, amount: number) => DateTime<boolean>;
|
||||
addWeeks: (value: DateTime, amount: number) => DateTime<boolean>;
|
||||
addDays: (value: DateTime, amount: number) => DateTime<boolean>;
|
||||
addHours: (value: DateTime, amount: number) => DateTime<boolean>;
|
||||
addMinutes: (value: DateTime, amount: number) => DateTime<boolean>;
|
||||
addSeconds: (value: DateTime, amount: number) => DateTime<boolean>;
|
||||
getYear: (value: DateTime) => number;
|
||||
getMonth: (value: DateTime) => number;
|
||||
getDate: (value: DateTime) => number;
|
||||
getHours: (value: DateTime) => number;
|
||||
getMinutes: (value: DateTime) => number;
|
||||
getSeconds: (value: DateTime) => number;
|
||||
getMilliseconds: (value: DateTime) => number;
|
||||
setYear: (value: DateTime, year: number) => DateTime<boolean>;
|
||||
setMonth: (value: DateTime, month: number) => DateTime<boolean>;
|
||||
setDate: (value: DateTime, date: number) => DateTime<boolean>;
|
||||
setHours: (value: DateTime, hours: number) => DateTime<boolean>;
|
||||
setMinutes: (value: DateTime, minutes: number) => DateTime<boolean>;
|
||||
setSeconds: (value: DateTime, seconds: number) => DateTime<boolean>;
|
||||
setMilliseconds: (value: DateTime, milliseconds: number) => DateTime<boolean>;
|
||||
getDaysInMonth: (value: DateTime) => import("luxon").PossibleDaysInMonth;
|
||||
getWeekArray: (value: DateTime) => DateTime<boolean>[][];
|
||||
getWeekNumber: (value: DateTime) => number;
|
||||
getDayOfWeek: (value: DateTime) => number;
|
||||
getYearRange: ([start, end]: [DateTime, DateTime]) => DateTime<boolean>[];
|
||||
}
|
||||
508
node_modules/@mui/x-date-pickers/AdapterLuxon/AdapterLuxon.js
generated
vendored
Normal file
508
node_modules/@mui/x-date-pickers/AdapterLuxon/AdapterLuxon.js
generated
vendored
Normal file
|
|
@ -0,0 +1,508 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterLuxon = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _luxon = require("luxon");
|
||||
const formatTokenMap = {
|
||||
// Year
|
||||
y: {
|
||||
sectionType: 'year',
|
||||
contentType: 'digit',
|
||||
maxLength: 4
|
||||
},
|
||||
yy: 'year',
|
||||
yyyy: {
|
||||
sectionType: 'year',
|
||||
contentType: 'digit',
|
||||
maxLength: 4
|
||||
},
|
||||
// Month
|
||||
L: {
|
||||
sectionType: 'month',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
LL: 'month',
|
||||
LLL: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
LLLL: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
M: {
|
||||
sectionType: 'month',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
MM: 'month',
|
||||
MMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
MMMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Day of the month
|
||||
d: {
|
||||
sectionType: 'day',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
dd: 'day',
|
||||
// Day of the week
|
||||
c: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'digit',
|
||||
maxLength: 1
|
||||
},
|
||||
ccc: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
cccc: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
E: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
EEE: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
EEEE: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Meridiem
|
||||
a: 'meridiem',
|
||||
// Hours
|
||||
H: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
HH: 'hours',
|
||||
h: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
hh: 'hours',
|
||||
// Minutes
|
||||
m: {
|
||||
sectionType: 'minutes',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
mm: 'minutes',
|
||||
// Seconds
|
||||
s: {
|
||||
sectionType: 'seconds',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
ss: 'seconds'
|
||||
};
|
||||
const defaultFormats = {
|
||||
year: 'yyyy',
|
||||
month: 'LLLL',
|
||||
monthShort: 'MMM',
|
||||
dayOfMonth: 'd',
|
||||
// Full day of the month format (i.e. 3rd) is not supported
|
||||
// Falling back to regular format
|
||||
dayOfMonthFull: 'd',
|
||||
weekday: 'cccc',
|
||||
weekdayShort: 'ccccc',
|
||||
hours24h: 'HH',
|
||||
hours12h: 'hh',
|
||||
meridiem: 'a',
|
||||
minutes: 'mm',
|
||||
seconds: 'ss',
|
||||
fullDate: 'DD',
|
||||
keyboardDate: 'D',
|
||||
shortDate: 'MMM d',
|
||||
normalDate: 'd MMMM',
|
||||
normalDateWithWeekday: 'EEE, MMM d',
|
||||
fullTime12h: 'hh:mm a',
|
||||
fullTime24h: 'HH:mm',
|
||||
keyboardDateTime12h: 'D hh:mm a',
|
||||
keyboardDateTime24h: 'D T'
|
||||
};
|
||||
/**
|
||||
* Based on `@date-io/luxon`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterLuxon {
|
||||
isMUIAdapter = true;
|
||||
isTimezoneCompatible = true;
|
||||
lib = 'luxon';
|
||||
escapedCharacters = {
|
||||
start: "'",
|
||||
end: "'"
|
||||
};
|
||||
formatTokenMap = formatTokenMap;
|
||||
constructor({
|
||||
locale,
|
||||
formats
|
||||
} = {}) {
|
||||
this.locale = locale || 'en-US';
|
||||
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
||||
}
|
||||
setLocaleToValue = value => {
|
||||
const expectedLocale = this.getCurrentLocaleCode();
|
||||
if (expectedLocale === value.locale) {
|
||||
return value;
|
||||
}
|
||||
return value.setLocale(expectedLocale);
|
||||
};
|
||||
date = (value, timezone = 'default') => {
|
||||
if (value === null) {
|
||||
return null;
|
||||
}
|
||||
if (typeof value === 'undefined') {
|
||||
// @ts-ignore
|
||||
return _luxon.DateTime.fromJSDate(new Date(), {
|
||||
locale: this.locale,
|
||||
zone: timezone
|
||||
});
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return _luxon.DateTime.fromISO(value, {
|
||||
locale: this.locale,
|
||||
zone: timezone
|
||||
});
|
||||
};
|
||||
getInvalidDate = () => _luxon.DateTime.fromJSDate(new Date('Invalid Date'));
|
||||
getTimezone = value => {
|
||||
// When using the system zone, we want to return "system", not something like "Europe/Paris"
|
||||
if (value.zone.type === 'system') {
|
||||
return 'system';
|
||||
}
|
||||
return value.zoneName;
|
||||
};
|
||||
setTimezone = (value, timezone) => {
|
||||
if (!value.zone.equals(_luxon.Info.normalizeZone(timezone))) {
|
||||
return value.setZone(timezone);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
toJsDate = value => {
|
||||
return value.toJSDate();
|
||||
};
|
||||
parse = (value, formatString) => {
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
return _luxon.DateTime.fromFormat(value, formatString, {
|
||||
locale: this.locale
|
||||
});
|
||||
};
|
||||
getCurrentLocaleCode = () => {
|
||||
return this.locale;
|
||||
};
|
||||
|
||||
/* v8 ignore start */
|
||||
is12HourCycleInCurrentLocale = () => {
|
||||
if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat === 'undefined') {
|
||||
return true; // Luxon defaults to en-US if Intl not found
|
||||
}
|
||||
return Boolean(new Intl.DateTimeFormat(this.locale, {
|
||||
hour: 'numeric'
|
||||
})?.resolvedOptions()?.hour12);
|
||||
};
|
||||
/* v8 ignore stop */
|
||||
|
||||
expandFormat = format => {
|
||||
// Extract escaped section to avoid extending them
|
||||
const catchEscapedSectionsRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
|
||||
|
||||
// This RegExp tests if a string is only mad of supported tokens
|
||||
const validTokens = [...Object.keys(this.formatTokenMap), 'yyyyy'];
|
||||
const isWordComposedOfTokens = new RegExp(`^(${validTokens.join('|')})+$`);
|
||||
|
||||
// Extract words to test if they are a token or a word to escape.
|
||||
const catchWordsRegexp = /(?:^|[^a-z])([a-z]+)(?:[^a-z]|$)|([a-z]+)/gi;
|
||||
return format.match(catchEscapedSectionsRegexp).map(token => {
|
||||
const firstCharacter = token[0];
|
||||
if (firstCharacter === "'") {
|
||||
return token;
|
||||
}
|
||||
const expandedToken = _luxon.DateTime.expandFormat(token, {
|
||||
locale: this.locale
|
||||
});
|
||||
return expandedToken.replace(catchWordsRegexp, (substring, g1, g2) => {
|
||||
const word = g1 || g2; // words are either in group 1 or group 2
|
||||
|
||||
if (isWordComposedOfTokens.test(word)) {
|
||||
return substring;
|
||||
}
|
||||
return `'${substring}'`;
|
||||
});
|
||||
}).join('')
|
||||
// The returned format can contain `yyyyy` which means year between 4 and 6 digits.
|
||||
// This value is supported by luxon parser but not luxon formatter.
|
||||
// To avoid conflicts, we replace it by 4 digits which is enough for most use-cases.
|
||||
.replace('yyyyy', 'yyyy');
|
||||
};
|
||||
isValid = value => {
|
||||
if (value === null) {
|
||||
return false;
|
||||
}
|
||||
return value.isValid;
|
||||
};
|
||||
format = (value, formatKey) => {
|
||||
return this.formatByString(value, this.formats[formatKey]);
|
||||
};
|
||||
formatByString = (value, format) => {
|
||||
return value.setLocale(this.locale).toFormat(format);
|
||||
};
|
||||
formatNumber = numberToFormat => {
|
||||
return numberToFormat;
|
||||
};
|
||||
isEqual = (value, comparing) => {
|
||||
if (value === null && comparing === null) {
|
||||
return true;
|
||||
}
|
||||
if (value === null || comparing === null) {
|
||||
return false;
|
||||
}
|
||||
return +value === +comparing;
|
||||
};
|
||||
isSameYear = (value, comparing) => {
|
||||
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
||||
return value.hasSame(comparingInValueTimezone, 'year');
|
||||
};
|
||||
isSameMonth = (value, comparing) => {
|
||||
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
||||
return value.hasSame(comparingInValueTimezone, 'month');
|
||||
};
|
||||
isSameDay = (value, comparing) => {
|
||||
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
||||
return value.hasSame(comparingInValueTimezone, 'day');
|
||||
};
|
||||
isSameHour = (value, comparing) => {
|
||||
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
||||
return value.hasSame(comparingInValueTimezone, 'hour');
|
||||
};
|
||||
isAfter = (value, comparing) => {
|
||||
return value > comparing;
|
||||
};
|
||||
isAfterYear = (value, comparing) => {
|
||||
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
||||
const diff = value.diff(this.endOfYear(comparingInValueTimezone), 'years').toObject();
|
||||
return diff.years > 0;
|
||||
};
|
||||
isAfterDay = (value, comparing) => {
|
||||
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
||||
const diff = value.diff(this.endOfDay(comparingInValueTimezone), 'days').toObject();
|
||||
return diff.days > 0;
|
||||
};
|
||||
isBefore = (value, comparing) => {
|
||||
return value < comparing;
|
||||
};
|
||||
isBeforeYear = (value, comparing) => {
|
||||
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
||||
const diff = value.diff(this.startOfYear(comparingInValueTimezone), 'years').toObject();
|
||||
return diff.years < 0;
|
||||
};
|
||||
isBeforeDay = (value, comparing) => {
|
||||
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
||||
const diff = value.diff(this.startOfDay(comparingInValueTimezone), 'days').toObject();
|
||||
return diff.days < 0;
|
||||
};
|
||||
isWithinRange = (value, [start, end]) => {
|
||||
return this.isEqual(value, start) || this.isEqual(value, end) || this.isAfter(value, start) && this.isBefore(value, end);
|
||||
};
|
||||
startOfYear = value => {
|
||||
return value.startOf('year');
|
||||
};
|
||||
startOfMonth = value => {
|
||||
return value.startOf('month');
|
||||
};
|
||||
startOfWeek = value => {
|
||||
return this.setLocaleToValue(value).startOf('week', {
|
||||
useLocaleWeeks: true
|
||||
});
|
||||
};
|
||||
startOfDay = value => {
|
||||
return value.startOf('day');
|
||||
};
|
||||
endOfYear = value => {
|
||||
return value.endOf('year');
|
||||
};
|
||||
endOfMonth = value => {
|
||||
return value.endOf('month');
|
||||
};
|
||||
endOfWeek = value => {
|
||||
return this.setLocaleToValue(value).endOf('week', {
|
||||
useLocaleWeeks: true
|
||||
});
|
||||
};
|
||||
endOfDay = value => {
|
||||
return value.endOf('day');
|
||||
};
|
||||
addYears = (value, amount) => {
|
||||
return value.plus({
|
||||
years: amount
|
||||
});
|
||||
};
|
||||
addMonths = (value, amount) => {
|
||||
return value.plus({
|
||||
months: amount
|
||||
});
|
||||
};
|
||||
addWeeks = (value, amount) => {
|
||||
return value.plus({
|
||||
weeks: amount
|
||||
});
|
||||
};
|
||||
addDays = (value, amount) => {
|
||||
return value.plus({
|
||||
days: amount
|
||||
});
|
||||
};
|
||||
addHours = (value, amount) => {
|
||||
return value.plus({
|
||||
hours: amount
|
||||
});
|
||||
};
|
||||
addMinutes = (value, amount) => {
|
||||
return value.plus({
|
||||
minutes: amount
|
||||
});
|
||||
};
|
||||
addSeconds = (value, amount) => {
|
||||
return value.plus({
|
||||
seconds: amount
|
||||
});
|
||||
};
|
||||
getYear = value => {
|
||||
return value.get('year');
|
||||
};
|
||||
getMonth = value => {
|
||||
// See https://github.com/moment/luxon/blob/master/docs/moment.md#major-functional-differences
|
||||
return value.get('month') - 1;
|
||||
};
|
||||
getDate = value => {
|
||||
return value.get('day');
|
||||
};
|
||||
getHours = value => {
|
||||
return value.get('hour');
|
||||
};
|
||||
getMinutes = value => {
|
||||
return value.get('minute');
|
||||
};
|
||||
getSeconds = value => {
|
||||
return value.get('second');
|
||||
};
|
||||
getMilliseconds = value => {
|
||||
return value.get('millisecond');
|
||||
};
|
||||
setYear = (value, year) => {
|
||||
return value.set({
|
||||
year
|
||||
});
|
||||
};
|
||||
setMonth = (value, month) => {
|
||||
return value.set({
|
||||
month: month + 1
|
||||
});
|
||||
};
|
||||
setDate = (value, date) => {
|
||||
return value.set({
|
||||
day: date
|
||||
});
|
||||
};
|
||||
setHours = (value, hours) => {
|
||||
return value.set({
|
||||
hour: hours
|
||||
});
|
||||
};
|
||||
setMinutes = (value, minutes) => {
|
||||
return value.set({
|
||||
minute: minutes
|
||||
});
|
||||
};
|
||||
setSeconds = (value, seconds) => {
|
||||
return value.set({
|
||||
second: seconds
|
||||
});
|
||||
};
|
||||
setMilliseconds = (value, milliseconds) => {
|
||||
return value.set({
|
||||
millisecond: milliseconds
|
||||
});
|
||||
};
|
||||
getDaysInMonth = value => {
|
||||
return value.daysInMonth;
|
||||
};
|
||||
getWeekArray = value => {
|
||||
const firstDay = this.startOfWeek(this.startOfMonth(value));
|
||||
const lastDay = this.endOfWeek(this.endOfMonth(value));
|
||||
const {
|
||||
days
|
||||
} = lastDay.diff(firstDay, 'days').toObject();
|
||||
const weeks = [];
|
||||
new Array(Math.round(days)).fill(0).map((_, i) => i).map(day => firstDay.plus({
|
||||
days: day
|
||||
})).forEach((v, i) => {
|
||||
if (i === 0 || i % 7 === 0 && i > 6) {
|
||||
weeks.push([v]);
|
||||
return;
|
||||
}
|
||||
weeks[weeks.length - 1].push(v);
|
||||
});
|
||||
return weeks;
|
||||
};
|
||||
getWeekNumber = value => {
|
||||
/* v8 ignore next */
|
||||
return value.localWeekNumber ?? value.weekNumber;
|
||||
};
|
||||
getDayOfWeek = value => {
|
||||
return value.localWeekday ?? value.weekday;
|
||||
};
|
||||
getYearRange = ([start, end]) => {
|
||||
const startDate = this.startOfYear(start);
|
||||
const endDate = this.endOfYear(end);
|
||||
const years = [];
|
||||
let current = startDate;
|
||||
while (this.isBefore(current, endDate)) {
|
||||
years.push(current);
|
||||
current = this.addYears(current, 1);
|
||||
}
|
||||
return years;
|
||||
};
|
||||
}
|
||||
exports.AdapterLuxon = AdapterLuxon;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterLuxon/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterLuxon/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterLuxon } from "./AdapterLuxon.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterLuxon/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterLuxon/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterLuxon", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterLuxon.AdapterLuxon;
|
||||
}
|
||||
});
|
||||
var _AdapterLuxon = require("./AdapterLuxon");
|
||||
114
node_modules/@mui/x-date-pickers/AdapterMoment/AdapterMoment.d.ts
generated
vendored
Normal file
114
node_modules/@mui/x-date-pickers/AdapterMoment/AdapterMoment.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
import defaultMoment, { Moment } from 'moment';
|
||||
import { AdapterFormats, AdapterOptions, DateBuilderReturnType, FieldFormatTokenMap, MuiPickersAdapter, PickersTimezone } from "../models/index.js";
|
||||
declare module '@mui/x-date-pickers/models' {
|
||||
interface PickerValidDateLookup {
|
||||
moment: Moment;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Based on `@date-io/moment`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterMoment implements MuiPickersAdapter<string> {
|
||||
isMUIAdapter: boolean;
|
||||
isTimezoneCompatible: boolean;
|
||||
lib: string;
|
||||
moment: typeof defaultMoment;
|
||||
locale?: string;
|
||||
formats: AdapterFormats;
|
||||
escapedCharacters: {
|
||||
start: string;
|
||||
end: string;
|
||||
};
|
||||
formatTokenMap: FieldFormatTokenMap;
|
||||
constructor({
|
||||
locale,
|
||||
formats,
|
||||
instance
|
||||
}?: AdapterOptions<string, typeof defaultMoment>);
|
||||
private setLocaleToValue;
|
||||
private hasTimezonePlugin;
|
||||
private createSystemDate;
|
||||
private createUTCDate;
|
||||
private createTZDate;
|
||||
date: <T extends string | null | undefined>(value?: T, timezone?: PickersTimezone) => DateBuilderReturnType<T>;
|
||||
getInvalidDate: () => defaultMoment.Moment;
|
||||
getTimezone: (value: Moment) => string;
|
||||
setTimezone: (value: Moment, timezone: PickersTimezone) => Moment;
|
||||
toJsDate: (value: Moment) => Date;
|
||||
parse: (value: string, format: string) => defaultMoment.Moment | null;
|
||||
getCurrentLocaleCode: () => string;
|
||||
is12HourCycleInCurrentLocale: () => boolean;
|
||||
expandFormat: (format: string) => string;
|
||||
isValid: (value: Moment | null) => value is Moment;
|
||||
format: (value: Moment, formatKey: keyof AdapterFormats) => string;
|
||||
formatByString: (value: Moment, formatString: string) => string;
|
||||
formatNumber: (numberToFormat: string) => string;
|
||||
isEqual: (value: Moment | null, comparing: Moment | null) => boolean;
|
||||
isSameYear: (value: Moment, comparing: Moment) => boolean;
|
||||
isSameMonth: (value: Moment, comparing: Moment) => boolean;
|
||||
isSameDay: (value: Moment, comparing: Moment) => boolean;
|
||||
isSameHour: (value: Moment, comparing: Moment) => boolean;
|
||||
isAfter: (value: Moment, comparing: Moment) => boolean;
|
||||
isAfterYear: (value: Moment, comparing: Moment) => boolean;
|
||||
isAfterDay: (value: Moment, comparing: Moment) => boolean;
|
||||
isBefore: (value: Moment, comparing: Moment) => boolean;
|
||||
isBeforeYear: (value: Moment, comparing: Moment) => boolean;
|
||||
isBeforeDay: (value: Moment, comparing: Moment) => boolean;
|
||||
isWithinRange: (value: Moment, [start, end]: [Moment, Moment]) => boolean;
|
||||
startOfYear: (value: Moment) => defaultMoment.Moment;
|
||||
startOfMonth: (value: Moment) => defaultMoment.Moment;
|
||||
startOfWeek: (value: Moment) => defaultMoment.Moment;
|
||||
startOfDay: (value: Moment) => defaultMoment.Moment;
|
||||
endOfYear: (value: Moment) => defaultMoment.Moment;
|
||||
endOfMonth: (value: Moment) => defaultMoment.Moment;
|
||||
endOfWeek: (value: Moment) => defaultMoment.Moment;
|
||||
endOfDay: (value: Moment) => defaultMoment.Moment;
|
||||
addYears: (value: Moment, amount: number) => defaultMoment.Moment;
|
||||
addMonths: (value: Moment, amount: number) => defaultMoment.Moment;
|
||||
addWeeks: (value: Moment, amount: number) => defaultMoment.Moment;
|
||||
addDays: (value: Moment, amount: number) => defaultMoment.Moment;
|
||||
addHours: (value: Moment, amount: number) => defaultMoment.Moment;
|
||||
addMinutes: (value: Moment, amount: number) => defaultMoment.Moment;
|
||||
addSeconds: (value: Moment, amount: number) => defaultMoment.Moment;
|
||||
getYear: (value: Moment) => number;
|
||||
getMonth: (value: Moment) => number;
|
||||
getDate: (value: Moment) => number;
|
||||
getHours: (value: Moment) => number;
|
||||
getMinutes: (value: Moment) => number;
|
||||
getSeconds: (value: Moment) => number;
|
||||
getMilliseconds: (value: Moment) => number;
|
||||
setYear: (value: Moment, year: number) => defaultMoment.Moment;
|
||||
setMonth: (value: Moment, month: number) => defaultMoment.Moment;
|
||||
setDate: (value: Moment, date: number) => defaultMoment.Moment;
|
||||
setHours: (value: Moment, hours: number) => defaultMoment.Moment;
|
||||
setMinutes: (value: Moment, minutes: number) => defaultMoment.Moment;
|
||||
setSeconds: (value: Moment, seconds: number) => defaultMoment.Moment;
|
||||
setMilliseconds: (value: Moment, milliseconds: number) => defaultMoment.Moment;
|
||||
getDaysInMonth: (value: Moment) => number;
|
||||
getWeekArray: (value: Moment) => defaultMoment.Moment[][];
|
||||
getWeekNumber: (value: Moment) => number;
|
||||
getDayOfWeek: (value: Moment) => number;
|
||||
getYearRange([start, end]: [Moment, Moment]): defaultMoment.Moment[];
|
||||
}
|
||||
476
node_modules/@mui/x-date-pickers/AdapterMoment/AdapterMoment.js
generated
vendored
Normal file
476
node_modules/@mui/x-date-pickers/AdapterMoment/AdapterMoment.js
generated
vendored
Normal file
|
|
@ -0,0 +1,476 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterMoment = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _moment = _interopRequireDefault(require("moment"));
|
||||
// From https://momentjs.com/docs/#/displaying/format/
|
||||
const formatTokenMap = {
|
||||
// Year
|
||||
Y: 'year',
|
||||
YY: 'year',
|
||||
YYYY: {
|
||||
sectionType: 'year',
|
||||
contentType: 'digit',
|
||||
maxLength: 4
|
||||
},
|
||||
// Month
|
||||
M: {
|
||||
sectionType: 'month',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
MM: 'month',
|
||||
MMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
MMMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Day of the month
|
||||
D: {
|
||||
sectionType: 'day',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
DD: 'day',
|
||||
Do: {
|
||||
sectionType: 'day',
|
||||
contentType: 'digit-with-letter'
|
||||
},
|
||||
// Day of the week
|
||||
E: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'digit',
|
||||
maxLength: 1
|
||||
},
|
||||
// eslint-disable-next-line id-denylist
|
||||
e: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'digit',
|
||||
maxLength: 1
|
||||
},
|
||||
d: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'digit',
|
||||
maxLength: 1
|
||||
},
|
||||
dd: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
ddd: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
dddd: {
|
||||
sectionType: 'weekDay',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Meridiem
|
||||
A: 'meridiem',
|
||||
a: 'meridiem',
|
||||
// Hours
|
||||
H: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
HH: 'hours',
|
||||
h: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
hh: 'hours',
|
||||
// Minutes
|
||||
m: {
|
||||
sectionType: 'minutes',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
mm: 'minutes',
|
||||
// Seconds
|
||||
s: {
|
||||
sectionType: 'seconds',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
ss: 'seconds'
|
||||
};
|
||||
const defaultFormats = {
|
||||
year: 'YYYY',
|
||||
month: 'MMMM',
|
||||
monthShort: 'MMM',
|
||||
dayOfMonth: 'D',
|
||||
dayOfMonthFull: 'Do',
|
||||
weekday: 'dddd',
|
||||
weekdayShort: 'ddd',
|
||||
hours24h: 'HH',
|
||||
hours12h: 'hh',
|
||||
meridiem: 'A',
|
||||
minutes: 'mm',
|
||||
seconds: 'ss',
|
||||
fullDate: 'll',
|
||||
keyboardDate: 'L',
|
||||
shortDate: 'MMM D',
|
||||
normalDate: 'D MMMM',
|
||||
normalDateWithWeekday: 'ddd, MMM D',
|
||||
fullTime12h: 'hh:mm A',
|
||||
fullTime24h: 'HH:mm',
|
||||
keyboardDateTime12h: 'L hh:mm A',
|
||||
keyboardDateTime24h: 'L HH:mm'
|
||||
};
|
||||
const MISSING_TIMEZONE_PLUGIN = ['Missing timezone plugin', 'To be able to use timezones, you have to pass the default export from `moment-timezone` to the `dateLibInstance` prop of `LocalizationProvider`', 'Find more information on https://mui.com/x/react-date-pickers/timezone/#moment-and-timezone'].join('\n');
|
||||
/**
|
||||
* Based on `@date-io/moment`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterMoment {
|
||||
isMUIAdapter = true;
|
||||
isTimezoneCompatible = true;
|
||||
lib = 'moment';
|
||||
escapedCharacters = {
|
||||
start: '[',
|
||||
end: ']'
|
||||
};
|
||||
formatTokenMap = formatTokenMap;
|
||||
constructor({
|
||||
locale,
|
||||
formats,
|
||||
instance
|
||||
} = {}) {
|
||||
this.moment = instance || _moment.default;
|
||||
this.locale = locale;
|
||||
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
||||
}
|
||||
setLocaleToValue = value => {
|
||||
const expectedLocale = this.getCurrentLocaleCode();
|
||||
if (expectedLocale === value.locale()) {
|
||||
return value;
|
||||
}
|
||||
return value.locale(expectedLocale);
|
||||
};
|
||||
hasTimezonePlugin = () => typeof this.moment.tz !== 'undefined';
|
||||
createSystemDate = value => {
|
||||
const parsedValue = this.moment(value).local();
|
||||
if (this.locale === undefined) {
|
||||
return parsedValue;
|
||||
}
|
||||
return parsedValue.locale(this.locale);
|
||||
};
|
||||
createUTCDate = value => {
|
||||
const parsedValue = this.moment.utc(value);
|
||||
if (this.locale === undefined) {
|
||||
return parsedValue;
|
||||
}
|
||||
return parsedValue.locale(this.locale);
|
||||
};
|
||||
createTZDate = (value, timezone) => {
|
||||
/* v8 ignore next 3 */
|
||||
if (!this.hasTimezonePlugin()) {
|
||||
throw new Error(MISSING_TIMEZONE_PLUGIN);
|
||||
}
|
||||
const parsedValue = timezone === 'default' ? this.moment(value) : this.moment.tz(value, timezone);
|
||||
if (this.locale === undefined) {
|
||||
return parsedValue;
|
||||
}
|
||||
return parsedValue.locale(this.locale);
|
||||
};
|
||||
date = (value, timezone = 'default') => {
|
||||
if (value === null) {
|
||||
return null;
|
||||
}
|
||||
if (timezone === 'UTC') {
|
||||
return this.createUTCDate(value);
|
||||
}
|
||||
if (timezone === 'system' || timezone === 'default' && !this.hasTimezonePlugin()) {
|
||||
return this.createSystemDate(value);
|
||||
}
|
||||
return this.createTZDate(value, timezone);
|
||||
};
|
||||
getInvalidDate = () => this.moment(new Date('Invalid Date'));
|
||||
getTimezone = value => {
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
const zone = value._z?.name;
|
||||
const defaultZone = value.isUTC() ? 'UTC' : 'system';
|
||||
|
||||
// @ts-ignore
|
||||
return zone ?? this.moment.defaultZone?.name ?? defaultZone;
|
||||
};
|
||||
setTimezone = (value, timezone) => {
|
||||
if (this.getTimezone(value) === timezone) {
|
||||
return value;
|
||||
}
|
||||
if (timezone === 'UTC') {
|
||||
return value.clone().utc();
|
||||
}
|
||||
if (timezone === 'system') {
|
||||
return value.clone().local();
|
||||
}
|
||||
if (!this.hasTimezonePlugin()) {
|
||||
/* v8 ignore next 3 */
|
||||
if (timezone !== 'default') {
|
||||
throw new Error(MISSING_TIMEZONE_PLUGIN);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
const cleanZone = timezone === 'default' ?
|
||||
// @ts-ignore
|
||||
this.moment.defaultZone?.name ?? 'system' : timezone;
|
||||
if (cleanZone === 'system') {
|
||||
return value.clone().local();
|
||||
}
|
||||
const newValue = value.clone();
|
||||
newValue.tz(cleanZone);
|
||||
return newValue;
|
||||
};
|
||||
toJsDate = value => {
|
||||
return value.toDate();
|
||||
};
|
||||
parse = (value, format) => {
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
if (this.locale) {
|
||||
return this.moment(value, format, this.locale, true);
|
||||
}
|
||||
return this.moment(value, format, true);
|
||||
};
|
||||
getCurrentLocaleCode = () => {
|
||||
return this.locale || _moment.default.locale();
|
||||
};
|
||||
is12HourCycleInCurrentLocale = () => {
|
||||
return /A|a/.test(_moment.default.localeData(this.getCurrentLocaleCode()).longDateFormat('LT'));
|
||||
};
|
||||
expandFormat = format => {
|
||||
// @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
|
||||
const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
|
||||
return format.match(localFormattingTokens).map(token => {
|
||||
const firstCharacter = token[0];
|
||||
if (firstCharacter === 'L' || firstCharacter === ';') {
|
||||
return _moment.default.localeData(this.getCurrentLocaleCode()).longDateFormat(token);
|
||||
}
|
||||
return token;
|
||||
}).join('');
|
||||
};
|
||||
isValid = value => {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return value.isValid();
|
||||
};
|
||||
format = (value, formatKey) => {
|
||||
return this.formatByString(value, this.formats[formatKey]);
|
||||
};
|
||||
formatByString = (value, formatString) => {
|
||||
const clonedDate = value.clone();
|
||||
clonedDate.locale(this.getCurrentLocaleCode());
|
||||
return clonedDate.format(formatString);
|
||||
};
|
||||
formatNumber = numberToFormat => {
|
||||
return numberToFormat;
|
||||
};
|
||||
isEqual = (value, comparing) => {
|
||||
if (value === null && comparing === null) {
|
||||
return true;
|
||||
}
|
||||
if (value === null || comparing === null) {
|
||||
return false;
|
||||
}
|
||||
return value.isSame(comparing);
|
||||
};
|
||||
isSameYear = (value, comparing) => {
|
||||
return value.isSame(comparing, 'year');
|
||||
};
|
||||
isSameMonth = (value, comparing) => {
|
||||
return value.isSame(comparing, 'month');
|
||||
};
|
||||
isSameDay = (value, comparing) => {
|
||||
return value.isSame(comparing, 'day');
|
||||
};
|
||||
isSameHour = (value, comparing) => {
|
||||
return value.isSame(comparing, 'hour');
|
||||
};
|
||||
isAfter = (value, comparing) => {
|
||||
return value.isAfter(comparing);
|
||||
};
|
||||
isAfterYear = (value, comparing) => {
|
||||
return value.isAfter(comparing, 'year');
|
||||
};
|
||||
isAfterDay = (value, comparing) => {
|
||||
return value.isAfter(comparing, 'day');
|
||||
};
|
||||
isBefore = (value, comparing) => {
|
||||
return value.isBefore(comparing);
|
||||
};
|
||||
isBeforeYear = (value, comparing) => {
|
||||
return value.isBefore(comparing, 'year');
|
||||
};
|
||||
isBeforeDay = (value, comparing) => {
|
||||
return value.isBefore(comparing, 'day');
|
||||
};
|
||||
isWithinRange = (value, [start, end]) => {
|
||||
return value.isBetween(start, end, null, '[]');
|
||||
};
|
||||
startOfYear = value => {
|
||||
return value.clone().startOf('year');
|
||||
};
|
||||
startOfMonth = value => {
|
||||
return value.clone().startOf('month');
|
||||
};
|
||||
startOfWeek = value => {
|
||||
return this.setLocaleToValue(value.clone()).startOf('week');
|
||||
};
|
||||
startOfDay = value => {
|
||||
return value.clone().startOf('day');
|
||||
};
|
||||
endOfYear = value => {
|
||||
return value.clone().endOf('year');
|
||||
};
|
||||
endOfMonth = value => {
|
||||
return value.clone().endOf('month');
|
||||
};
|
||||
endOfWeek = value => {
|
||||
return this.setLocaleToValue(value.clone()).endOf('week');
|
||||
};
|
||||
endOfDay = value => {
|
||||
return value.clone().endOf('day');
|
||||
};
|
||||
addYears = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'years') : value.clone().add(amount, 'years');
|
||||
};
|
||||
addMonths = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'months') : value.clone().add(amount, 'months');
|
||||
};
|
||||
addWeeks = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'weeks') : value.clone().add(amount, 'weeks');
|
||||
};
|
||||
addDays = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'days') : value.clone().add(amount, 'days');
|
||||
};
|
||||
addHours = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'hours') : value.clone().add(amount, 'hours');
|
||||
};
|
||||
addMinutes = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'minutes') : value.clone().add(amount, 'minutes');
|
||||
};
|
||||
addSeconds = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'seconds') : value.clone().add(amount, 'seconds');
|
||||
};
|
||||
getYear = value => {
|
||||
return value.get('year');
|
||||
};
|
||||
getMonth = value => {
|
||||
return value.get('month');
|
||||
};
|
||||
getDate = value => {
|
||||
return value.get('date');
|
||||
};
|
||||
getHours = value => {
|
||||
return value.get('hours');
|
||||
};
|
||||
getMinutes = value => {
|
||||
return value.get('minutes');
|
||||
};
|
||||
getSeconds = value => {
|
||||
return value.get('seconds');
|
||||
};
|
||||
getMilliseconds = value => {
|
||||
return value.get('milliseconds');
|
||||
};
|
||||
setYear = (value, year) => {
|
||||
return value.clone().year(year);
|
||||
};
|
||||
setMonth = (value, month) => {
|
||||
return value.clone().month(month);
|
||||
};
|
||||
setDate = (value, date) => {
|
||||
return value.clone().date(date);
|
||||
};
|
||||
setHours = (value, hours) => {
|
||||
return value.clone().hours(hours);
|
||||
};
|
||||
setMinutes = (value, minutes) => {
|
||||
return value.clone().minutes(minutes);
|
||||
};
|
||||
setSeconds = (value, seconds) => {
|
||||
return value.clone().seconds(seconds);
|
||||
};
|
||||
setMilliseconds = (value, milliseconds) => {
|
||||
return value.clone().milliseconds(milliseconds);
|
||||
};
|
||||
getDaysInMonth = value => {
|
||||
return value.daysInMonth();
|
||||
};
|
||||
getWeekArray = value => {
|
||||
const start = this.startOfWeek(this.startOfMonth(value));
|
||||
const end = this.endOfWeek(this.endOfMonth(value));
|
||||
let count = 0;
|
||||
let current = start;
|
||||
let currentDayOfYear = current.get('dayOfYear');
|
||||
const nestedWeeks = [];
|
||||
while (current.isBefore(end)) {
|
||||
const weekNumber = Math.floor(count / 7);
|
||||
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
||||
nestedWeeks[weekNumber].push(current);
|
||||
const prevDayOfYear = currentDayOfYear;
|
||||
current = this.addDays(current, 1);
|
||||
currentDayOfYear = current.get('dayOfYear');
|
||||
|
||||
// If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
|
||||
// To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
|
||||
// See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
|
||||
if (prevDayOfYear === currentDayOfYear) {
|
||||
current = current.add(12, 'h').startOf('day');
|
||||
}
|
||||
count += 1;
|
||||
}
|
||||
return nestedWeeks;
|
||||
};
|
||||
getWeekNumber = value => {
|
||||
return value.week();
|
||||
};
|
||||
getDayOfWeek = value => {
|
||||
return value.day() + 1;
|
||||
};
|
||||
getYearRange([start, end]) {
|
||||
const startDate = this.startOfYear(start);
|
||||
const endDate = this.endOfYear(end);
|
||||
const years = [];
|
||||
let current = startDate;
|
||||
while (this.isBefore(current, endDate)) {
|
||||
years.push(current);
|
||||
current = this.addYears(current, 1);
|
||||
}
|
||||
return years;
|
||||
}
|
||||
}
|
||||
exports.AdapterMoment = AdapterMoment;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterMoment/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterMoment/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterMoment } from "./AdapterMoment.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterMoment/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterMoment/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterMoment", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterMoment.AdapterMoment;
|
||||
}
|
||||
});
|
||||
var _AdapterMoment = require("./AdapterMoment");
|
||||
62
node_modules/@mui/x-date-pickers/AdapterMomentHijri/AdapterMomentHijri.d.ts
generated
vendored
Normal file
62
node_modules/@mui/x-date-pickers/AdapterMomentHijri/AdapterMomentHijri.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import defaultHMoment, { Moment } from 'moment-hijri';
|
||||
import { AdapterMoment } from "../AdapterMoment/index.js";
|
||||
import { AdapterOptions, DateBuilderReturnType, FieldFormatTokenMap, MuiPickersAdapter } from "../models/index.js";
|
||||
declare module '@mui/x-date-pickers/models' {
|
||||
interface PickerValidDateLookup {
|
||||
'moment-hijri': Moment;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Based on `@date-io/hijri`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterMomentHijri extends AdapterMoment implements MuiPickersAdapter<string> {
|
||||
lib: string;
|
||||
moment: typeof defaultHMoment;
|
||||
isTimezoneCompatible: boolean;
|
||||
formatTokenMap: FieldFormatTokenMap;
|
||||
constructor({
|
||||
formats,
|
||||
instance
|
||||
}?: AdapterOptions<string, typeof defaultHMoment>);
|
||||
date: <T extends string | null | undefined>(value?: T) => DateBuilderReturnType<T>;
|
||||
getTimezone: () => string;
|
||||
setTimezone: (value: Moment) => Moment;
|
||||
parse: (value: string, format: string) => defaultHMoment.Moment | null;
|
||||
formatNumber: (numberToFormat: string) => string;
|
||||
startOfYear: (value: Moment) => defaultHMoment.Moment;
|
||||
startOfMonth: (value: Moment) => defaultHMoment.Moment;
|
||||
endOfYear: (value: Moment) => defaultHMoment.Moment;
|
||||
endOfMonth: (value: Moment) => defaultHMoment.Moment;
|
||||
addYears: (value: Moment, amount: number) => defaultHMoment.Moment;
|
||||
addMonths: (value: Moment, amount: number) => defaultHMoment.Moment;
|
||||
getYear: (value: Moment) => number;
|
||||
getMonth: (value: Moment) => number;
|
||||
getDate: (value: Moment) => number;
|
||||
setYear: (value: Moment, year: number) => defaultHMoment.Moment;
|
||||
setMonth: (value: Moment, month: number) => defaultHMoment.Moment;
|
||||
setDate: (value: Moment, date: number) => defaultHMoment.Moment;
|
||||
getWeekNumber: (value: Moment) => number;
|
||||
getYearRange: ([start, end]: [Moment, Moment]) => defaultHMoment.Moment[];
|
||||
}
|
||||
231
node_modules/@mui/x-date-pickers/AdapterMomentHijri/AdapterMomentHijri.js
generated
vendored
Normal file
231
node_modules/@mui/x-date-pickers/AdapterMomentHijri/AdapterMomentHijri.js
generated
vendored
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterMomentHijri = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _momentHijri = _interopRequireDefault(require("moment-hijri"));
|
||||
var _AdapterMoment = require("../AdapterMoment");
|
||||
/* v8 ignore next */
|
||||
|
||||
// From https://momentjs.com/docs/#/displaying/format/
|
||||
const formatTokenMap = {
|
||||
// Year
|
||||
iY: {
|
||||
sectionType: 'year',
|
||||
contentType: 'letter'
|
||||
},
|
||||
iYY: {
|
||||
sectionType: 'year',
|
||||
contentType: 'letter'
|
||||
},
|
||||
iYYYY: {
|
||||
sectionType: 'year',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Month
|
||||
iM: 'month',
|
||||
iMM: 'month',
|
||||
iMMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
iMMMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Day of the month
|
||||
iD: {
|
||||
sectionType: 'day',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
iDD: 'day',
|
||||
// Meridiem
|
||||
A: 'meridiem',
|
||||
a: 'meridiem',
|
||||
// Hours
|
||||
H: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
HH: 'hours',
|
||||
h: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
hh: 'hours',
|
||||
// Minutes
|
||||
m: {
|
||||
sectionType: 'minutes',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
mm: 'minutes',
|
||||
// Seconds
|
||||
s: {
|
||||
sectionType: 'seconds',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
ss: 'seconds'
|
||||
};
|
||||
const defaultFormats = {
|
||||
year: 'iYYYY',
|
||||
month: 'iMMMM',
|
||||
monthShort: 'iMMM',
|
||||
dayOfMonth: 'iD',
|
||||
// Full day of the month format (i.e. 3rd) is not supported
|
||||
// Falling back to regular format
|
||||
dayOfMonthFull: 'iD',
|
||||
weekday: 'dddd',
|
||||
weekdayShort: 'ddd',
|
||||
hours24h: 'HH',
|
||||
hours12h: 'hh',
|
||||
meridiem: 'A',
|
||||
minutes: 'mm',
|
||||
seconds: 'ss',
|
||||
fullDate: 'iYYYY, iMMMM Do',
|
||||
shortDate: 'iD iMMM',
|
||||
normalDate: 'dddd, iD iMMM',
|
||||
normalDateWithWeekday: 'DD iMMMM',
|
||||
fullTime12h: 'hh:mm A',
|
||||
fullTime24h: 'HH:mm',
|
||||
keyboardDate: 'iYYYY/iMM/iDD',
|
||||
keyboardDateTime12h: 'iYYYY/iMM/iDD hh:mm A',
|
||||
keyboardDateTime24h: 'iYYYY/iMM/iDD HH:mm'
|
||||
};
|
||||
const NUMBER_SYMBOL_MAP = {
|
||||
'1': '١',
|
||||
'2': '٢',
|
||||
'3': '٣',
|
||||
'4': '٤',
|
||||
'5': '٥',
|
||||
'6': '٦',
|
||||
'7': '٧',
|
||||
'8': '٨',
|
||||
'9': '٩',
|
||||
'0': '٠'
|
||||
};
|
||||
/**
|
||||
* Based on `@date-io/hijri`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
|
||||
lib = 'moment-hijri';
|
||||
isTimezoneCompatible = false;
|
||||
formatTokenMap = formatTokenMap;
|
||||
constructor({
|
||||
formats,
|
||||
instance
|
||||
} = {}) {
|
||||
super({
|
||||
locale: 'ar-SA',
|
||||
instance
|
||||
});
|
||||
this.moment = instance || _momentHijri.default;
|
||||
this.locale = 'ar-SA';
|
||||
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
||||
}
|
||||
date = value => {
|
||||
if (value === null) {
|
||||
return null;
|
||||
}
|
||||
return this.moment(value).locale('ar-SA');
|
||||
};
|
||||
|
||||
/* v8 ignore next 3 */
|
||||
getTimezone = () => {
|
||||
return 'default';
|
||||
};
|
||||
|
||||
/* v8 ignore next 3 */
|
||||
setTimezone = value => {
|
||||
return value;
|
||||
};
|
||||
parse = (value, format) => {
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
return this.moment(value, format, true).locale('ar-SA');
|
||||
};
|
||||
formatNumber = numberToFormat => {
|
||||
return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
|
||||
};
|
||||
startOfYear = value => {
|
||||
return value.clone().startOf('iYear');
|
||||
};
|
||||
startOfMonth = value => {
|
||||
return value.clone().startOf('iMonth');
|
||||
};
|
||||
endOfYear = value => {
|
||||
return value.clone().endOf('iYear');
|
||||
};
|
||||
endOfMonth = value => {
|
||||
return value.clone().endOf('iMonth');
|
||||
};
|
||||
addYears = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'iYear') : value.clone().add(amount, 'iYear');
|
||||
};
|
||||
addMonths = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'iMonth') : value.clone().add(amount, 'iMonth');
|
||||
};
|
||||
getYear = value => {
|
||||
return value.iYear();
|
||||
};
|
||||
getMonth = value => {
|
||||
return value.iMonth();
|
||||
};
|
||||
getDate = value => {
|
||||
return value.iDate();
|
||||
};
|
||||
setYear = (value, year) => {
|
||||
return value.clone().iYear(year);
|
||||
};
|
||||
setMonth = (value, month) => {
|
||||
return value.clone().iMonth(month);
|
||||
};
|
||||
setDate = (value, date) => {
|
||||
return value.clone().iDate(date);
|
||||
};
|
||||
getWeekNumber = value => {
|
||||
return value.iWeek();
|
||||
};
|
||||
getYearRange = ([start, end]) => {
|
||||
// moment-hijri only supports dates between 1356-01-01 H and 1499-12-29 H
|
||||
// We need to throw if outside min/max bounds, otherwise the while loop below will be infinite.
|
||||
if (start.isBefore('1937-03-14')) {
|
||||
throw new Error('min date must be on or after 1356-01-01 H (1937-03-14)');
|
||||
}
|
||||
if (end.isAfter('2076-11-26')) {
|
||||
throw new Error('max date must be on or before 1499-12-29 H (2076-11-26)');
|
||||
}
|
||||
return super.getYearRange([start, end]);
|
||||
};
|
||||
}
|
||||
exports.AdapterMomentHijri = AdapterMomentHijri;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterMomentHijri/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterMomentHijri/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterMomentHijri } from "./AdapterMomentHijri.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterMomentHijri/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterMomentHijri/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterMomentHijri", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterMomentHijri.AdapterMomentHijri;
|
||||
}
|
||||
});
|
||||
var _AdapterMomentHijri = require("./AdapterMomentHijri");
|
||||
66
node_modules/@mui/x-date-pickers/AdapterMomentJalaali/AdapterMomentJalaali.d.ts
generated
vendored
Normal file
66
node_modules/@mui/x-date-pickers/AdapterMomentJalaali/AdapterMomentJalaali.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
import defaultJMoment, { Moment } from 'moment-jalaali';
|
||||
import { AdapterMoment } from "../AdapterMoment/index.js";
|
||||
import { AdapterOptions, DateBuilderReturnType, FieldFormatTokenMap, MuiPickersAdapter } from "../models/index.js";
|
||||
declare module '@mui/x-date-pickers/models' {
|
||||
interface PickerValidDateLookup {
|
||||
'moment-jalaali': Moment;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Based on `@date-io/jalaali`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
export declare class AdapterMomentJalaali extends AdapterMoment implements MuiPickersAdapter<string> {
|
||||
isTimezoneCompatible: boolean;
|
||||
lib: string;
|
||||
moment: typeof defaultJMoment;
|
||||
formatTokenMap: FieldFormatTokenMap;
|
||||
constructor({
|
||||
formats,
|
||||
instance
|
||||
}?: AdapterOptions<string, typeof defaultJMoment>);
|
||||
date: <T extends string | null | undefined>(value?: T) => DateBuilderReturnType<T>;
|
||||
getTimezone: () => string;
|
||||
setTimezone: (value: Moment) => Moment;
|
||||
parse: (value: string, format: string) => defaultJMoment.Moment | null;
|
||||
formatNumber: (numberToFormat: string) => string;
|
||||
isSameYear: (value: Moment, comparing: Moment) => boolean;
|
||||
isSameMonth: (value: Moment, comparing: Moment) => boolean;
|
||||
isAfterYear: (value: Moment, comparing: Moment) => boolean;
|
||||
isBeforeYear: (value: Moment, comparing: Moment) => boolean;
|
||||
startOfYear: (value: Moment) => defaultJMoment.Moment;
|
||||
startOfMonth: (value: Moment) => defaultJMoment.Moment;
|
||||
endOfYear: (value: Moment) => defaultJMoment.Moment;
|
||||
endOfMonth: (value: Moment) => defaultJMoment.Moment;
|
||||
addYears: (value: Moment, amount: number) => defaultJMoment.Moment;
|
||||
addMonths: (value: Moment, amount: number) => defaultJMoment.Moment;
|
||||
getYear: (value: Moment) => number;
|
||||
getMonth: (value: Moment) => number;
|
||||
getDate: (value: Moment) => number;
|
||||
getDaysInMonth: (value: Moment) => number;
|
||||
setYear: (value: Moment, year: number) => defaultJMoment.Moment;
|
||||
setMonth: (value: Moment, month: number) => defaultJMoment.Moment;
|
||||
setDate: (value: Moment, date: number) => defaultJMoment.Moment;
|
||||
getWeekNumber: (value: Moment) => number;
|
||||
}
|
||||
229
node_modules/@mui/x-date-pickers/AdapterMomentJalaali/AdapterMomentJalaali.js
generated
vendored
Normal file
229
node_modules/@mui/x-date-pickers/AdapterMomentJalaali/AdapterMomentJalaali.js
generated
vendored
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterMomentJalaali = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _momentJalaali = _interopRequireDefault(require("moment-jalaali"));
|
||||
var _AdapterMoment = require("../AdapterMoment");
|
||||
/* v8 ignore next */
|
||||
|
||||
// From https://momentjs.com/docs/#/displaying/format/
|
||||
const formatTokenMap = {
|
||||
// Year
|
||||
jYY: 'year',
|
||||
jYYYY: {
|
||||
sectionType: 'year',
|
||||
contentType: 'digit',
|
||||
maxLength: 4
|
||||
},
|
||||
// Month
|
||||
jM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
jMM: 'month',
|
||||
jMMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
jMMMM: {
|
||||
sectionType: 'month',
|
||||
contentType: 'letter'
|
||||
},
|
||||
// Day of the month
|
||||
jD: {
|
||||
sectionType: 'day',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
jDD: 'day',
|
||||
// Meridiem
|
||||
A: 'meridiem',
|
||||
a: 'meridiem',
|
||||
// Hours
|
||||
H: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
HH: 'hours',
|
||||
h: {
|
||||
sectionType: 'hours',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
hh: 'hours',
|
||||
// Minutes
|
||||
m: {
|
||||
sectionType: 'minutes',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
mm: 'minutes',
|
||||
// Seconds
|
||||
s: {
|
||||
sectionType: 'seconds',
|
||||
contentType: 'digit',
|
||||
maxLength: 2
|
||||
},
|
||||
ss: 'seconds'
|
||||
};
|
||||
const defaultFormats = {
|
||||
year: 'jYYYY',
|
||||
month: 'jMMMM',
|
||||
monthShort: 'jMMM',
|
||||
dayOfMonth: 'jD',
|
||||
// Full day of the month format (i.e. 3rd) is not supported
|
||||
// Falling back to regular format
|
||||
dayOfMonthFull: 'jD',
|
||||
weekday: 'dddd',
|
||||
weekdayShort: 'ddd',
|
||||
hours24h: 'HH',
|
||||
hours12h: 'hh',
|
||||
meridiem: 'A',
|
||||
minutes: 'mm',
|
||||
seconds: 'ss',
|
||||
fullDate: 'jYYYY, jMMMM Do',
|
||||
keyboardDate: 'jYYYY/jMM/jDD',
|
||||
shortDate: 'jD jMMM',
|
||||
normalDate: 'dddd, jD jMMM',
|
||||
normalDateWithWeekday: 'DD MMMM',
|
||||
fullTime12h: 'hh:mm A',
|
||||
fullTime24h: 'HH:mm',
|
||||
keyboardDateTime12h: 'jYYYY/jMM/jDD hh:mm A',
|
||||
keyboardDateTime24h: 'jYYYY/jMM/jDD HH:mm'
|
||||
};
|
||||
const NUMBER_SYMBOL_MAP = {
|
||||
'1': '۱',
|
||||
'2': '۲',
|
||||
'3': '۳',
|
||||
'4': '۴',
|
||||
'5': '۵',
|
||||
'6': '۶',
|
||||
'7': '۷',
|
||||
'8': '۸',
|
||||
'9': '۹',
|
||||
'0': '۰'
|
||||
};
|
||||
/**
|
||||
* Based on `@date-io/jalaali`
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Dmitriy Kovalenko
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
|
||||
isTimezoneCompatible = false;
|
||||
lib = 'moment-jalaali';
|
||||
formatTokenMap = formatTokenMap;
|
||||
constructor({
|
||||
formats,
|
||||
instance
|
||||
} = {}) {
|
||||
super({
|
||||
locale: 'fa',
|
||||
instance
|
||||
});
|
||||
this.moment = instance || _momentJalaali.default;
|
||||
this.locale = 'fa';
|
||||
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
||||
}
|
||||
date = value => {
|
||||
if (value === null) {
|
||||
return null;
|
||||
}
|
||||
return this.moment(value).locale('fa');
|
||||
};
|
||||
getTimezone = () => {
|
||||
return 'default';
|
||||
};
|
||||
setTimezone = value => {
|
||||
return value;
|
||||
};
|
||||
parse = (value, format) => {
|
||||
if (value === '') {
|
||||
return null;
|
||||
}
|
||||
return this.moment(value, format, true).locale('fa');
|
||||
};
|
||||
formatNumber = numberToFormat => {
|
||||
return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
|
||||
};
|
||||
isSameYear = (value, comparing) => {
|
||||
return value.jYear() === comparing.jYear();
|
||||
};
|
||||
isSameMonth = (value, comparing) => {
|
||||
return value.jYear() === comparing.jYear() && value.jMonth() === comparing.jMonth();
|
||||
};
|
||||
isAfterYear = (value, comparing) => {
|
||||
return value.jYear() > comparing.jYear();
|
||||
};
|
||||
isBeforeYear = (value, comparing) => {
|
||||
return value.jYear() < comparing.jYear();
|
||||
};
|
||||
startOfYear = value => {
|
||||
return value.clone().startOf('jYear');
|
||||
};
|
||||
startOfMonth = value => {
|
||||
return value.clone().startOf('jMonth');
|
||||
};
|
||||
endOfYear = value => {
|
||||
return value.clone().endOf('jYear');
|
||||
};
|
||||
endOfMonth = value => {
|
||||
return value.clone().endOf('jMonth');
|
||||
};
|
||||
addYears = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'jYear') : value.clone().add(amount, 'jYear');
|
||||
};
|
||||
addMonths = (value, amount) => {
|
||||
return amount < 0 ? value.clone().subtract(Math.abs(amount), 'jMonth') : value.clone().add(amount, 'jMonth');
|
||||
};
|
||||
getYear = value => {
|
||||
return value.jYear();
|
||||
};
|
||||
getMonth = value => {
|
||||
return value.jMonth();
|
||||
};
|
||||
getDate = value => {
|
||||
return value.jDate();
|
||||
};
|
||||
getDaysInMonth = value => {
|
||||
return this.moment.jDaysInMonth(value.jYear(), value.jMonth());
|
||||
};
|
||||
setYear = (value, year) => {
|
||||
return value.clone().jYear(year);
|
||||
};
|
||||
setMonth = (value, month) => {
|
||||
return value.clone().jMonth(month);
|
||||
};
|
||||
setDate = (value, date) => {
|
||||
return value.clone().jDate(date);
|
||||
};
|
||||
getWeekNumber = value => {
|
||||
return value.jWeek();
|
||||
};
|
||||
}
|
||||
exports.AdapterMomentJalaali = AdapterMomentJalaali;
|
||||
1
node_modules/@mui/x-date-pickers/AdapterMomentJalaali/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/x-date-pickers/AdapterMomentJalaali/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { AdapterMomentJalaali } from "./AdapterMomentJalaali.js";
|
||||
12
node_modules/@mui/x-date-pickers/AdapterMomentJalaali/index.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/AdapterMomentJalaali/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AdapterMomentJalaali", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AdapterMomentJalaali.AdapterMomentJalaali;
|
||||
}
|
||||
});
|
||||
var _AdapterMomentJalaali = require("./AdapterMomentJalaali");
|
||||
11069
node_modules/@mui/x-date-pickers/CHANGELOG.md
generated
vendored
Normal file
11069
node_modules/@mui/x-date-pickers/CHANGELOG.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
18
node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar.d.ts
generated
vendored
Normal file
18
node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import * as React from 'react';
|
||||
import { DateCalendarProps } from "./DateCalendar.types.js";
|
||||
type DateCalendarComponent = ((props: DateCalendarProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
||||
propTypes?: any;
|
||||
};
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
||||
* - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
|
||||
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateCalendar API](https://mui.com/x/api/date-pickers/date-calendar/)
|
||||
*/
|
||||
export declare const DateCalendar: DateCalendarComponent;
|
||||
export {};
|
||||
598
node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar.js
generated
vendored
Normal file
598
node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar.js
generated
vendored
Normal file
|
|
@ -0,0 +1,598 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DateCalendar = void 0;
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
||||
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
||||
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
||||
var _useCalendarState = require("./useCalendarState");
|
||||
var _PickersFadeTransitionGroup = require("./PickersFadeTransitionGroup");
|
||||
var _DayCalendar = require("./DayCalendar");
|
||||
var _MonthCalendar = require("../MonthCalendar");
|
||||
var _YearCalendar = require("../YearCalendar");
|
||||
var _useViews = require("../internals/hooks/useViews");
|
||||
var _PickersCalendarHeader = require("../PickersCalendarHeader");
|
||||
var _dateUtils = require("../internals/utils/date-utils");
|
||||
var _PickerViewRoot = require("../internals/components/PickerViewRoot");
|
||||
var _useReduceAnimations = require("../internals/hooks/useReduceAnimations");
|
||||
var _dateCalendarClasses = require("./dateCalendarClasses");
|
||||
var _useControlledValue = require("../internals/hooks/useControlledValue");
|
||||
var _valueManagers = require("../internals/utils/valueManagers");
|
||||
var _dimensions = require("../internals/constants/dimensions");
|
||||
var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
|
||||
var _useDateManager = require("../managers/useDateManager");
|
||||
var _usePickerAdapter = require("../hooks/usePickerAdapter");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["autoFocus", "onViewChange", "value", "defaultValue", "referenceDate", "disableFuture", "disablePast", "onChange", "onYearChange", "onMonthChange", "reduceAnimations", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "view", "views", "openTo", "className", "classes", "disabled", "readOnly", "minDate", "maxDate", "disableHighlightToday", "focusedView", "onFocusedViewChange", "showDaysOutsideCurrentMonth", "fixedWeekNumber", "dayOfWeekFormatter", "slots", "slotProps", "loading", "renderLoading", "displayWeekNumber", "yearsOrder", "yearsPerRow", "monthsPerRow", "timezone"];
|
||||
const useUtilityClasses = classes => {
|
||||
const slots = {
|
||||
root: ['root'],
|
||||
viewTransitionContainer: ['viewTransitionContainer']
|
||||
};
|
||||
return (0, _composeClasses.default)(slots, _dateCalendarClasses.getDateCalendarUtilityClass, classes);
|
||||
};
|
||||
function useDateCalendarDefaultizedProps(props, name) {
|
||||
const themeProps = (0, _styles.useThemeProps)({
|
||||
props,
|
||||
name
|
||||
});
|
||||
const reduceAnimations = (0, _useReduceAnimations.useReduceAnimations)(themeProps.reduceAnimations);
|
||||
const validationProps = (0, _useDateManager.useApplyDefaultValuesToDateValidationProps)(themeProps);
|
||||
return (0, _extends2.default)({}, themeProps, validationProps, {
|
||||
loading: themeProps.loading ?? false,
|
||||
openTo: themeProps.openTo ?? 'day',
|
||||
views: themeProps.views ?? ['year', 'day'],
|
||||
reduceAnimations,
|
||||
renderLoading: themeProps.renderLoading ?? (() => /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
||||
children: "..."
|
||||
}))
|
||||
});
|
||||
}
|
||||
const DateCalendarRoot = (0, _styles.styled)(_PickerViewRoot.PickerViewRoot, {
|
||||
name: 'MuiDateCalendar',
|
||||
slot: 'Root'
|
||||
})({
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
height: _dimensions.VIEW_HEIGHT
|
||||
});
|
||||
const DateCalendarViewTransitionContainer = (0, _styles.styled)(_PickersFadeTransitionGroup.PickersFadeTransitionGroup, {
|
||||
name: 'MuiDateCalendar',
|
||||
slot: 'ViewTransitionContainer'
|
||||
})({});
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
||||
* - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
|
||||
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateCalendar API](https://mui.com/x/api/date-pickers/date-calendar/)
|
||||
*/
|
||||
const DateCalendar = exports.DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(inProps, ref) {
|
||||
const adapter = (0, _usePickerAdapter.usePickerAdapter)();
|
||||
const {
|
||||
ownerState
|
||||
} = (0, _usePickerPrivateContext.usePickerPrivateContext)();
|
||||
const id = (0, _useId.default)();
|
||||
const props = useDateCalendarDefaultizedProps(inProps, 'MuiDateCalendar');
|
||||
const {
|
||||
autoFocus,
|
||||
onViewChange,
|
||||
value: valueProp,
|
||||
defaultValue,
|
||||
referenceDate: referenceDateProp,
|
||||
disableFuture,
|
||||
disablePast,
|
||||
onChange,
|
||||
onMonthChange,
|
||||
reduceAnimations,
|
||||
shouldDisableDate,
|
||||
shouldDisableMonth,
|
||||
shouldDisableYear,
|
||||
view: inView,
|
||||
views,
|
||||
openTo,
|
||||
className,
|
||||
classes: classesProp,
|
||||
disabled,
|
||||
readOnly,
|
||||
minDate,
|
||||
maxDate,
|
||||
disableHighlightToday,
|
||||
focusedView: focusedViewProp,
|
||||
onFocusedViewChange,
|
||||
showDaysOutsideCurrentMonth,
|
||||
fixedWeekNumber,
|
||||
dayOfWeekFormatter,
|
||||
slots,
|
||||
slotProps,
|
||||
loading,
|
||||
renderLoading,
|
||||
displayWeekNumber,
|
||||
yearsOrder,
|
||||
yearsPerRow,
|
||||
monthsPerRow,
|
||||
timezone: timezoneProp
|
||||
} = props,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
||||
const {
|
||||
value,
|
||||
handleValueChange,
|
||||
timezone
|
||||
} = (0, _useControlledValue.useControlledValue)({
|
||||
name: 'DateCalendar',
|
||||
timezone: timezoneProp,
|
||||
value: valueProp,
|
||||
defaultValue,
|
||||
referenceDate: referenceDateProp,
|
||||
onChange,
|
||||
valueManager: _valueManagers.singleItemValueManager
|
||||
});
|
||||
const {
|
||||
view,
|
||||
setView,
|
||||
focusedView,
|
||||
setFocusedView,
|
||||
goToNextView,
|
||||
setValueAndGoToNextView
|
||||
} = (0, _useViews.useViews)({
|
||||
view: inView,
|
||||
views,
|
||||
openTo,
|
||||
onChange: handleValueChange,
|
||||
onViewChange,
|
||||
autoFocus,
|
||||
focusedView: focusedViewProp,
|
||||
onFocusedViewChange
|
||||
});
|
||||
const {
|
||||
referenceDate,
|
||||
calendarState,
|
||||
setVisibleDate,
|
||||
isDateDisabled,
|
||||
onMonthSwitchingAnimationEnd
|
||||
} = (0, _useCalendarState.useCalendarState)({
|
||||
value,
|
||||
referenceDate: referenceDateProp,
|
||||
reduceAnimations,
|
||||
onMonthChange,
|
||||
minDate,
|
||||
maxDate,
|
||||
shouldDisableDate,
|
||||
disablePast,
|
||||
disableFuture,
|
||||
timezone,
|
||||
getCurrentMonthFromVisibleDate: (visibleDate, prevMonth) => {
|
||||
if (adapter.isSameMonth(visibleDate, prevMonth)) {
|
||||
return prevMonth;
|
||||
}
|
||||
return adapter.startOfMonth(visibleDate);
|
||||
}
|
||||
});
|
||||
|
||||
// When disabled, limit the view to the selected date
|
||||
const minDateWithDisabled = disabled && value || minDate;
|
||||
const maxDateWithDisabled = disabled && value || maxDate;
|
||||
const gridLabelId = `${id}-grid-label`;
|
||||
const hasFocus = focusedView !== null;
|
||||
const CalendarHeader = slots?.calendarHeader ?? _PickersCalendarHeader.PickersCalendarHeader;
|
||||
const calendarHeaderProps = (0, _useSlotProps.default)({
|
||||
elementType: CalendarHeader,
|
||||
externalSlotProps: slotProps?.calendarHeader,
|
||||
additionalProps: {
|
||||
views,
|
||||
view,
|
||||
currentMonth: calendarState.currentMonth,
|
||||
onViewChange: setView,
|
||||
onMonthChange: month => setVisibleDate({
|
||||
target: month,
|
||||
reason: 'header-navigation'
|
||||
}),
|
||||
minDate: minDateWithDisabled,
|
||||
maxDate: maxDateWithDisabled,
|
||||
disabled,
|
||||
disablePast,
|
||||
disableFuture,
|
||||
reduceAnimations,
|
||||
timezone,
|
||||
labelId: gridLabelId
|
||||
},
|
||||
ownerState
|
||||
});
|
||||
const handleDateMonthChange = (0, _useEventCallback.default)(newDate => {
|
||||
const startOfMonth = adapter.startOfMonth(newDate);
|
||||
const endOfMonth = adapter.endOfMonth(newDate);
|
||||
const closestEnabledDate = isDateDisabled(newDate) ? (0, _dateUtils.findClosestEnabledDate)({
|
||||
adapter,
|
||||
date: newDate,
|
||||
minDate: adapter.isBefore(minDate, startOfMonth) ? startOfMonth : minDate,
|
||||
maxDate: adapter.isAfter(maxDate, endOfMonth) ? endOfMonth : maxDate,
|
||||
disablePast,
|
||||
disableFuture,
|
||||
isDateDisabled,
|
||||
timezone
|
||||
}) : newDate;
|
||||
if (closestEnabledDate) {
|
||||
setValueAndGoToNextView(closestEnabledDate, 'finish');
|
||||
setVisibleDate({
|
||||
target: closestEnabledDate,
|
||||
reason: 'cell-interaction'
|
||||
});
|
||||
} else {
|
||||
goToNextView();
|
||||
setVisibleDate({
|
||||
target: startOfMonth,
|
||||
reason: 'cell-interaction'
|
||||
});
|
||||
}
|
||||
});
|
||||
const handleDateYearChange = (0, _useEventCallback.default)(newDate => {
|
||||
const startOfYear = adapter.startOfYear(newDate);
|
||||
const endOfYear = adapter.endOfYear(newDate);
|
||||
const closestEnabledDate = isDateDisabled(newDate) ? (0, _dateUtils.findClosestEnabledDate)({
|
||||
adapter,
|
||||
date: newDate,
|
||||
minDate: adapter.isBefore(minDate, startOfYear) ? startOfYear : minDate,
|
||||
maxDate: adapter.isAfter(maxDate, endOfYear) ? endOfYear : maxDate,
|
||||
disablePast,
|
||||
disableFuture,
|
||||
isDateDisabled,
|
||||
timezone
|
||||
}) : newDate;
|
||||
if (closestEnabledDate) {
|
||||
setValueAndGoToNextView(closestEnabledDate, 'finish');
|
||||
setVisibleDate({
|
||||
target: closestEnabledDate,
|
||||
reason: 'cell-interaction'
|
||||
});
|
||||
} else {
|
||||
goToNextView();
|
||||
setVisibleDate({
|
||||
target: startOfYear,
|
||||
reason: 'cell-interaction'
|
||||
});
|
||||
}
|
||||
});
|
||||
const handleSelectedDayChange = (0, _useEventCallback.default)(day => {
|
||||
if (day) {
|
||||
// If there is a date already selected, then we want to keep its time
|
||||
return handleValueChange((0, _dateUtils.mergeDateAndTime)(adapter, day, value ?? referenceDate), 'finish', view);
|
||||
}
|
||||
return handleValueChange(day, 'finish', view);
|
||||
});
|
||||
React.useEffect(() => {
|
||||
if (adapter.isValid(value)) {
|
||||
setVisibleDate({
|
||||
target: value,
|
||||
reason: 'controlled-value-change'
|
||||
});
|
||||
}
|
||||
}, [value]); // eslint-disable-line
|
||||
|
||||
const classes = useUtilityClasses(classesProp);
|
||||
const baseDateValidationProps = {
|
||||
disablePast,
|
||||
disableFuture,
|
||||
maxDate,
|
||||
minDate
|
||||
};
|
||||
const commonViewProps = {
|
||||
disableHighlightToday,
|
||||
readOnly,
|
||||
disabled,
|
||||
timezone,
|
||||
gridLabelId,
|
||||
slots,
|
||||
slotProps
|
||||
};
|
||||
const prevOpenViewRef = React.useRef(view);
|
||||
React.useEffect(() => {
|
||||
// If the view change and the focus was on the previous view
|
||||
// Then we update the focus.
|
||||
if (prevOpenViewRef.current === view) {
|
||||
return;
|
||||
}
|
||||
if (focusedView === prevOpenViewRef.current) {
|
||||
setFocusedView(view, true);
|
||||
}
|
||||
prevOpenViewRef.current = view;
|
||||
}, [focusedView, setFocusedView, view]);
|
||||
const selectedDays = React.useMemo(() => [value], [value]);
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateCalendarRoot, (0, _extends2.default)({
|
||||
ref: ref,
|
||||
className: (0, _clsx.default)(classes.root, className),
|
||||
ownerState: ownerState
|
||||
}, other, {
|
||||
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CalendarHeader, (0, _extends2.default)({}, calendarHeaderProps, {
|
||||
slots: slots,
|
||||
slotProps: slotProps
|
||||
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(DateCalendarViewTransitionContainer, {
|
||||
reduceAnimations: reduceAnimations,
|
||||
className: classes.viewTransitionContainer,
|
||||
transKey: view,
|
||||
ownerState: ownerState,
|
||||
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
||||
children: [view === 'year' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_YearCalendar.YearCalendar, (0, _extends2.default)({}, baseDateValidationProps, commonViewProps, {
|
||||
value: value,
|
||||
onChange: handleDateYearChange,
|
||||
shouldDisableYear: shouldDisableYear,
|
||||
hasFocus: hasFocus,
|
||||
onFocusedViewChange: isViewFocused => setFocusedView('year', isViewFocused),
|
||||
yearsOrder: yearsOrder,
|
||||
yearsPerRow: yearsPerRow,
|
||||
referenceDate: referenceDate
|
||||
})), view === 'month' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MonthCalendar.MonthCalendar, (0, _extends2.default)({}, baseDateValidationProps, commonViewProps, {
|
||||
hasFocus: hasFocus,
|
||||
className: className,
|
||||
value: value,
|
||||
onChange: handleDateMonthChange,
|
||||
shouldDisableMonth: shouldDisableMonth,
|
||||
onFocusedViewChange: isViewFocused => setFocusedView('month', isViewFocused),
|
||||
monthsPerRow: monthsPerRow,
|
||||
referenceDate: referenceDate
|
||||
})), view === 'day' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DayCalendar.DayCalendar, (0, _extends2.default)({}, calendarState, baseDateValidationProps, commonViewProps, {
|
||||
onMonthSwitchingAnimationEnd: onMonthSwitchingAnimationEnd,
|
||||
hasFocus: hasFocus,
|
||||
onFocusedDayChange: focusedDate => setVisibleDate({
|
||||
target: focusedDate,
|
||||
reason: 'cell-interaction'
|
||||
}),
|
||||
reduceAnimations: reduceAnimations,
|
||||
selectedDays: selectedDays,
|
||||
onSelectedDaysChange: handleSelectedDayChange,
|
||||
shouldDisableDate: shouldDisableDate,
|
||||
shouldDisableMonth: shouldDisableMonth,
|
||||
shouldDisableYear: shouldDisableYear,
|
||||
onFocusedViewChange: isViewFocused => setFocusedView('day', isViewFocused),
|
||||
showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth,
|
||||
fixedWeekNumber: fixedWeekNumber,
|
||||
dayOfWeekFormatter: dayOfWeekFormatter,
|
||||
displayWeekNumber: displayWeekNumber,
|
||||
loading: loading,
|
||||
renderLoading: renderLoading
|
||||
}))]
|
||||
})
|
||||
})]
|
||||
}));
|
||||
});
|
||||
if (process.env.NODE_ENV !== "production") DateCalendar.displayName = "DateCalendar";
|
||||
process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
/**
|
||||
* If `true`, the main element is focused during the first mount.
|
||||
* This main element is:
|
||||
* - the element chosen by the visible view if any (i.e: the selected day on the `day` view).
|
||||
* - the `input` element if there is a field rendered.
|
||||
*/
|
||||
autoFocus: _propTypes.default.bool,
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: _propTypes.default.object,
|
||||
className: _propTypes.default.string,
|
||||
/**
|
||||
* Formats the day of week displayed in the calendar header.
|
||||
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
||||
* @returns {string} The name to display.
|
||||
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
||||
*/
|
||||
dayOfWeekFormatter: _propTypes.default.func,
|
||||
/**
|
||||
* The default selected value.
|
||||
* Used when the component is not controlled.
|
||||
*/
|
||||
defaultValue: _propTypes.default.object,
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* When disabled, the value cannot be changed and no interaction is possible.
|
||||
* @default false
|
||||
*/
|
||||
disabled: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values after the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disableFuture: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, today's date is rendering without highlighting with circle.
|
||||
* @default false
|
||||
*/
|
||||
disableHighlightToday: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values before the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disablePast: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, the week number will be display in the calendar.
|
||||
*/
|
||||
displayWeekNumber: _propTypes.default.bool,
|
||||
/**
|
||||
* The day view will show as many weeks as needed after the end of the current month to match this value.
|
||||
* Put it to 6 to have a fixed number of weeks in Gregorian calendars
|
||||
*/
|
||||
fixedWeekNumber: _propTypes.default.number,
|
||||
/**
|
||||
* Controlled focused view.
|
||||
*/
|
||||
focusedView: _propTypes.default.oneOf(['day', 'month', 'year']),
|
||||
/**
|
||||
* If `true`, calls `renderLoading` instead of rendering the day calendar.
|
||||
* Can be used to preload information and show it in calendar.
|
||||
* @default false
|
||||
*/
|
||||
loading: _propTypes.default.bool,
|
||||
/**
|
||||
* Maximal selectable date.
|
||||
* @default 2099-12-31
|
||||
*/
|
||||
maxDate: _propTypes.default.object,
|
||||
/**
|
||||
* Minimal selectable date.
|
||||
* @default 1900-01-01
|
||||
*/
|
||||
minDate: _propTypes.default.object,
|
||||
/**
|
||||
* Months rendered per row.
|
||||
* @default 3
|
||||
*/
|
||||
monthsPerRow: _propTypes.default.oneOf([3, 4]),
|
||||
/**
|
||||
* Callback fired when the value changes.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TView The view type. Will be one of date or time views.
|
||||
* @param {TValue} value The new value.
|
||||
* @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
|
||||
* @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
|
||||
*/
|
||||
onChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on focused view change.
|
||||
* @template TView Type of the view. It will vary based on the Picker type and the `views` it uses.
|
||||
* @param {TView} view The new view to focus or not.
|
||||
* @param {boolean} hasFocus `true` if the view should be focused.
|
||||
*/
|
||||
onFocusedViewChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on month change.
|
||||
* @param {PickerValidDate} month The new month.
|
||||
*/
|
||||
onMonthChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on view change.
|
||||
* @template TView Type of the view. It will vary based on the Picker type and the `views` it uses.
|
||||
* @param {TView} view The new view.
|
||||
*/
|
||||
onViewChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on year change.
|
||||
* @param {PickerValidDate} year The new year.
|
||||
*/
|
||||
onYearChange: _propTypes.default.func,
|
||||
/**
|
||||
* The default visible view.
|
||||
* Used when the component view is not controlled.
|
||||
* Must be a valid option from `views` list.
|
||||
*/
|
||||
openTo: _propTypes.default.oneOf(['day', 'month', 'year']),
|
||||
/**
|
||||
* If `true`, the component is read-only.
|
||||
* When read-only, the value cannot be changed but the user can interact with the interface.
|
||||
* @default false
|
||||
*/
|
||||
readOnly: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable heavy animations.
|
||||
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
||||
*/
|
||||
reduceAnimations: _propTypes.default.bool,
|
||||
/**
|
||||
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
||||
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`.
|
||||
*/
|
||||
referenceDate: _propTypes.default.object,
|
||||
/**
|
||||
* Component displaying when passed `loading` true.
|
||||
* @returns {React.ReactNode} The node to render when loading.
|
||||
* @default () => <span>...</span>
|
||||
*/
|
||||
renderLoading: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific date.
|
||||
*
|
||||
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
||||
*
|
||||
* @param {PickerValidDate} day The date to test.
|
||||
* @returns {boolean} If `true` the date will be disabled.
|
||||
*/
|
||||
shouldDisableDate: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific month.
|
||||
* @param {PickerValidDate} month The month to test.
|
||||
* @returns {boolean} If `true`, the month will be disabled.
|
||||
*/
|
||||
shouldDisableMonth: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific year.
|
||||
* @param {PickerValidDate} year The year to test.
|
||||
* @returns {boolean} If `true`, the year will be disabled.
|
||||
*/
|
||||
shouldDisableYear: _propTypes.default.func,
|
||||
/**
|
||||
* If `true`, days outside the current month are rendered:
|
||||
*
|
||||
* - if `fixedWeekNumber` is defined, renders days to have the weeks requested.
|
||||
*
|
||||
* - if `fixedWeekNumber` is not defined, renders day to fill the first and last week of the current month.
|
||||
*
|
||||
* - ignored if `calendars` equals more than `1` on range pickers.
|
||||
* @default false
|
||||
*/
|
||||
showDaysOutsideCurrentMonth: _propTypes.default.bool,
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: _propTypes.default.object,
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots: _propTypes.default.object,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
||||
/**
|
||||
* Choose which timezone to use for the value.
|
||||
* Example: "default", "system", "UTC", "America/New_York".
|
||||
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
||||
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
||||
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
||||
*/
|
||||
timezone: _propTypes.default.string,
|
||||
/**
|
||||
* The selected value.
|
||||
* Used when the component is controlled.
|
||||
*/
|
||||
value: _propTypes.default.object,
|
||||
/**
|
||||
* The visible view.
|
||||
* Used when the component view is controlled.
|
||||
* Must be a valid option from `views` list.
|
||||
*/
|
||||
view: _propTypes.default.oneOf(['day', 'month', 'year']),
|
||||
/**
|
||||
* Available views.
|
||||
*/
|
||||
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['day', 'month', 'year']).isRequired),
|
||||
/**
|
||||
* Years are displayed in ascending (chronological) order by default.
|
||||
* If `desc`, years are displayed in descending order.
|
||||
* @default 'asc'
|
||||
*/
|
||||
yearsOrder: _propTypes.default.oneOf(['asc', 'desc']),
|
||||
/**
|
||||
* Years rendered per row.
|
||||
* @default 3
|
||||
*/
|
||||
yearsPerRow: _propTypes.default.oneOf([3, 4])
|
||||
} : void 0;
|
||||
87
node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar.types.d.ts
generated
vendored
Normal file
87
node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar.types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
import * as React from 'react';
|
||||
import { SxProps } from '@mui/system';
|
||||
import { Theme } from '@mui/material/styles';
|
||||
import { SlotComponentProps } from '@mui/utils/types';
|
||||
import { DefaultizedProps } from '@mui/x-internals/types';
|
||||
import { PickersCalendarHeader, PickersCalendarHeaderProps, PickersCalendarHeaderSlots, PickersCalendarHeaderSlotProps } from "../PickersCalendarHeader/index.js";
|
||||
import { DayCalendarSlots, DayCalendarSlotProps, ExportedDayCalendarProps } from "./DayCalendar.js";
|
||||
import { DateCalendarClasses } from "./dateCalendarClasses.js";
|
||||
import { BaseDateValidationProps } from "../internals/models/validation.js";
|
||||
import { ExportedUseViewsOptions } from "../internals/hooks/useViews.js";
|
||||
import { DateView, PickerOwnerState, PickerValidDate, TimezoneProps } from "../models/index.js";
|
||||
import { ExportedYearCalendarProps, YearCalendarSlots, YearCalendarSlotProps } from "../YearCalendar/YearCalendar.types.js";
|
||||
import { ExportedMonthCalendarProps, MonthCalendarSlots, MonthCalendarSlotProps } from "../MonthCalendar/MonthCalendar.types.js";
|
||||
import { ExportedValidateDateProps } from "../validation/validateDate.js";
|
||||
import { FormProps } from "../internals/models/formProps.js";
|
||||
import { PickerValue } from "../internals/models/index.js";
|
||||
export interface DateCalendarSlots extends PickersCalendarHeaderSlots, DayCalendarSlots, MonthCalendarSlots, YearCalendarSlots {
|
||||
/**
|
||||
* Custom component for calendar header.
|
||||
* Check the [PickersCalendarHeader](https://mui.com/x/api/date-pickers/pickers-calendar-header/) component.
|
||||
* @default PickersCalendarHeader
|
||||
*/
|
||||
calendarHeader?: React.ElementType<PickersCalendarHeaderProps>;
|
||||
}
|
||||
export interface DateCalendarSlotProps extends PickersCalendarHeaderSlotProps, DayCalendarSlotProps, MonthCalendarSlotProps, YearCalendarSlotProps {
|
||||
calendarHeader?: SlotComponentProps<typeof PickersCalendarHeader, {}, PickerOwnerState>;
|
||||
}
|
||||
export interface ExportedDateCalendarProps extends ExportedDayCalendarProps, ExportedMonthCalendarProps, ExportedYearCalendarProps, ExportedValidateDateProps, TimezoneProps, FormProps {
|
||||
/**
|
||||
* If `true`, disable heavy animations.
|
||||
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
||||
*/
|
||||
reduceAnimations?: boolean;
|
||||
/**
|
||||
* Component displaying when passed `loading` true.
|
||||
* @returns {React.ReactNode} The node to render when loading.
|
||||
* @default () => <span>...</span>
|
||||
*/
|
||||
renderLoading?: () => React.ReactNode;
|
||||
/**
|
||||
* Callback fired on year change.
|
||||
* @param {PickerValidDate} year The new year.
|
||||
*/
|
||||
onYearChange?: (year: PickerValidDate) => void;
|
||||
/**
|
||||
* Callback fired on month change.
|
||||
* @param {PickerValidDate} month The new month.
|
||||
*/
|
||||
onMonthChange?: (month: PickerValidDate) => void;
|
||||
}
|
||||
export interface DateCalendarProps extends ExportedDateCalendarProps, ExportedUseViewsOptions<PickerValue, DateView> {
|
||||
/**
|
||||
* The selected value.
|
||||
* Used when the component is controlled.
|
||||
*/
|
||||
value?: PickerValidDate | null;
|
||||
/**
|
||||
* The default selected value.
|
||||
* Used when the component is not controlled.
|
||||
*/
|
||||
defaultValue?: PickerValidDate | null;
|
||||
/**
|
||||
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
||||
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`.
|
||||
*/
|
||||
referenceDate?: PickerValidDate;
|
||||
className?: string;
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: Partial<DateCalendarClasses>;
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx?: SxProps<Theme>;
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: DateCalendarSlots;
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: DateCalendarSlotProps;
|
||||
}
|
||||
export type DateCalendarDefaultizedProps = DefaultizedProps<DateCalendarProps, 'views' | 'openTo' | 'loading' | 'reduceAnimations' | 'renderLoading' | keyof BaseDateValidationProps>;
|
||||
5
node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar.types.js
generated
vendored
Normal file
5
node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar.types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
85
node_modules/@mui/x-date-pickers/DateCalendar/DayCalendar.d.ts
generated
vendored
Normal file
85
node_modules/@mui/x-date-pickers/DateCalendar/DayCalendar.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
import * as React from 'react';
|
||||
import { DefaultizedProps, SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
||||
import { PickerDayOwnerState, PickersDayProps } from "../PickersDay/index.js";
|
||||
import { ExportedPickersDayProps } from "../PickersDay/PickersDay.types.js";
|
||||
import { PickerOnChangeFn } from "../internals/hooks/useViews.js";
|
||||
import { SlideDirection, SlideTransitionProps } from "./PickersSlideTransition.js";
|
||||
import { BaseDateValidationProps, DayValidationProps, MonthValidationProps, YearValidationProps } from "../internals/models/validation.js";
|
||||
import { DayCalendarClasses } from "./dayCalendarClasses.js";
|
||||
import { PickerValidDate, TimezoneProps } from "../models/index.js";
|
||||
import { FormProps } from "../internals/models/formProps.js";
|
||||
export interface DayCalendarSlots {
|
||||
/**
|
||||
* Custom component for day.
|
||||
* Check the [PickersDay](https://mui.com/x/api/date-pickers/pickers-day/) component.
|
||||
* @default PickersDay
|
||||
*/
|
||||
day?: React.ElementType<PickersDayProps>;
|
||||
}
|
||||
export interface DayCalendarSlotProps {
|
||||
day?: SlotComponentPropsFromProps<PickersDayProps, {}, PickerDayOwnerState>;
|
||||
}
|
||||
export interface ExportedDayCalendarProps extends ExportedPickersDayProps {
|
||||
/**
|
||||
* If `true`, calls `renderLoading` instead of rendering the day calendar.
|
||||
* Can be used to preload information and show it in calendar.
|
||||
* @default false
|
||||
*/
|
||||
loading?: boolean;
|
||||
/**
|
||||
* Component rendered on the "day" view when `props.loading` is true.
|
||||
* @returns {React.ReactNode} The node to render when loading.
|
||||
* @default () => "..."
|
||||
*/
|
||||
renderLoading?: () => React.ReactNode;
|
||||
/**
|
||||
* Formats the day of week displayed in the calendar header.
|
||||
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
||||
* @returns {string} The name to display.
|
||||
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
||||
*/
|
||||
dayOfWeekFormatter?: (date: PickerValidDate) => string;
|
||||
/**
|
||||
* If `true`, the week number will be display in the calendar.
|
||||
*/
|
||||
displayWeekNumber?: boolean;
|
||||
/**
|
||||
* The day view will show as many weeks as needed after the end of the current month to match this value.
|
||||
* Put it to 6 to have a fixed number of weeks in Gregorian calendars
|
||||
*/
|
||||
fixedWeekNumber?: number;
|
||||
}
|
||||
export interface DayCalendarProps extends ExportedDayCalendarProps, DayValidationProps, MonthValidationProps, YearValidationProps, Required<BaseDateValidationProps>, DefaultizedProps<TimezoneProps, 'timezone'>, FormProps {
|
||||
className?: string;
|
||||
currentMonth: PickerValidDate;
|
||||
selectedDays: (PickerValidDate | null)[];
|
||||
onSelectedDaysChange: PickerOnChangeFn;
|
||||
focusedDay: PickerValidDate | null;
|
||||
isMonthSwitchingAnimating: boolean;
|
||||
onFocusedDayChange: (newFocusedDay: PickerValidDate) => void;
|
||||
onMonthSwitchingAnimationEnd: () => void;
|
||||
reduceAnimations: boolean;
|
||||
slideDirection: SlideDirection;
|
||||
TransitionProps?: Partial<SlideTransitionProps>;
|
||||
hasFocus: boolean;
|
||||
onFocusedViewChange?: (newHasFocus: boolean) => void;
|
||||
gridLabelId?: string;
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: Partial<DayCalendarClasses>;
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: DayCalendarSlots;
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: DayCalendarSlotProps;
|
||||
}
|
||||
/**
|
||||
* @ignore - do not document.
|
||||
*/
|
||||
export declare function DayCalendar(inProps: DayCalendarProps): React.JSX.Element;
|
||||
447
node_modules/@mui/x-date-pickers/DateCalendar/DayCalendar.js
generated
vendored
Normal file
447
node_modules/@mui/x-date-pickers/DateCalendar/DayCalendar.js
generated
vendored
Normal file
|
|
@ -0,0 +1,447 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DayCalendar = DayCalendar;
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
||||
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
||||
var _useSlotProps2 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
||||
var _RtlProvider = require("@mui/system/RtlProvider");
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _PickersDay = require("../PickersDay");
|
||||
var _hooks = require("../hooks");
|
||||
var _useUtils = require("../internals/hooks/useUtils");
|
||||
var _dimensions = require("../internals/constants/dimensions");
|
||||
var _PickersSlideTransition = require("./PickersSlideTransition");
|
||||
var _useIsDateDisabled = require("./useIsDateDisabled");
|
||||
var _dateUtils = require("../internals/utils/date-utils");
|
||||
var _dayCalendarClasses = require("./dayCalendarClasses");
|
||||
var _usePickerDayOwnerState = require("../PickersDay/usePickerDayOwnerState");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["parentProps", "day", "focusedDay", "selectedDays", "isDateDisabled", "currentMonthNumber", "isViewFocused"],
|
||||
_excluded2 = ["ownerState"];
|
||||
const useUtilityClasses = classes => {
|
||||
const slots = {
|
||||
root: ['root'],
|
||||
header: ['header'],
|
||||
weekDayLabel: ['weekDayLabel'],
|
||||
loadingContainer: ['loadingContainer'],
|
||||
slideTransition: ['slideTransition'],
|
||||
monthContainer: ['monthContainer'],
|
||||
weekContainer: ['weekContainer'],
|
||||
weekNumberLabel: ['weekNumberLabel'],
|
||||
weekNumber: ['weekNumber']
|
||||
};
|
||||
return (0, _composeClasses.default)(slots, _dayCalendarClasses.getDayCalendarUtilityClass, classes);
|
||||
};
|
||||
const weeksContainerHeight = (_dimensions.DAY_SIZE + _dimensions.DAY_MARGIN * 2) * 6;
|
||||
const PickersCalendarDayRoot = (0, _styles.styled)('div', {
|
||||
name: 'MuiDayCalendar',
|
||||
slot: 'Root'
|
||||
})({});
|
||||
const PickersCalendarDayHeader = (0, _styles.styled)('div', {
|
||||
name: 'MuiDayCalendar',
|
||||
slot: 'Header'
|
||||
})({
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
});
|
||||
const PickersCalendarWeekDayLabel = (0, _styles.styled)(_Typography.default, {
|
||||
name: 'MuiDayCalendar',
|
||||
slot: 'WeekDayLabel'
|
||||
})(({
|
||||
theme
|
||||
}) => ({
|
||||
width: 36,
|
||||
height: 40,
|
||||
margin: '0 2px',
|
||||
textAlign: 'center',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
color: (theme.vars || theme).palette.text.secondary
|
||||
}));
|
||||
const PickersCalendarWeekNumberLabel = (0, _styles.styled)(_Typography.default, {
|
||||
name: 'MuiDayCalendar',
|
||||
slot: 'WeekNumberLabel'
|
||||
})(({
|
||||
theme
|
||||
}) => ({
|
||||
width: 36,
|
||||
height: 40,
|
||||
margin: '0 2px',
|
||||
textAlign: 'center',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
color: (theme.vars || theme).palette.text.disabled
|
||||
}));
|
||||
const PickersCalendarWeekNumber = (0, _styles.styled)(_Typography.default, {
|
||||
name: 'MuiDayCalendar',
|
||||
slot: 'WeekNumber'
|
||||
})(({
|
||||
theme
|
||||
}) => (0, _extends2.default)({}, theme.typography.caption, {
|
||||
width: _dimensions.DAY_SIZE,
|
||||
height: _dimensions.DAY_SIZE,
|
||||
padding: 0,
|
||||
margin: `0 ${_dimensions.DAY_MARGIN}px`,
|
||||
color: (theme.vars || theme).palette.text.disabled,
|
||||
fontSize: '0.75rem',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
display: 'inline-flex'
|
||||
}));
|
||||
const PickersCalendarLoadingContainer = (0, _styles.styled)('div', {
|
||||
name: 'MuiDayCalendar',
|
||||
slot: 'LoadingContainer'
|
||||
})({
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
minHeight: weeksContainerHeight
|
||||
});
|
||||
const PickersCalendarSlideTransition = (0, _styles.styled)(_PickersSlideTransition.PickersSlideTransition, {
|
||||
name: 'MuiDayCalendar',
|
||||
slot: 'SlideTransition'
|
||||
})({
|
||||
minHeight: weeksContainerHeight
|
||||
});
|
||||
const PickersCalendarWeekContainer = (0, _styles.styled)('div', {
|
||||
name: 'MuiDayCalendar',
|
||||
slot: 'MonthContainer'
|
||||
})({
|
||||
overflow: 'hidden'
|
||||
});
|
||||
const PickersCalendarWeek = (0, _styles.styled)('div', {
|
||||
name: 'MuiDayCalendar',
|
||||
slot: 'WeekContainer'
|
||||
})({
|
||||
margin: `${_dimensions.DAY_MARGIN}px 0`,
|
||||
display: 'flex',
|
||||
justifyContent: 'center'
|
||||
});
|
||||
function WrappedDay(_ref) {
|
||||
let {
|
||||
parentProps,
|
||||
day,
|
||||
focusedDay,
|
||||
selectedDays,
|
||||
isDateDisabled,
|
||||
currentMonthNumber,
|
||||
isViewFocused
|
||||
} = _ref,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
||||
const {
|
||||
disabled,
|
||||
disableHighlightToday,
|
||||
isMonthSwitchingAnimating,
|
||||
showDaysOutsideCurrentMonth,
|
||||
slots,
|
||||
slotProps,
|
||||
timezone
|
||||
} = parentProps;
|
||||
const adapter = (0, _hooks.usePickerAdapter)();
|
||||
const now = (0, _useUtils.useNow)(timezone);
|
||||
const isFocusableDay = focusedDay != null && adapter.isSameDay(day, focusedDay);
|
||||
const isFocusedDay = isViewFocused && isFocusableDay;
|
||||
const isSelected = selectedDays.some(selectedDay => adapter.isSameDay(selectedDay, day));
|
||||
const isToday = adapter.isSameDay(day, now);
|
||||
const isDisabled = React.useMemo(() => disabled || isDateDisabled(day), [disabled, isDateDisabled, day]);
|
||||
const isOutsideCurrentMonth = React.useMemo(() => adapter.getMonth(day) !== currentMonthNumber, [adapter, day, currentMonthNumber]);
|
||||
const ownerState = (0, _usePickerDayOwnerState.usePickerDayOwnerState)({
|
||||
day,
|
||||
selected: isSelected,
|
||||
disabled: isDisabled,
|
||||
today: isToday,
|
||||
outsideCurrentMonth: isOutsideCurrentMonth,
|
||||
disableMargin: undefined,
|
||||
// This prop can only be defined using slotProps.day so the ownerState for useSlotProps cannot have its value.
|
||||
disableHighlightToday,
|
||||
showDaysOutsideCurrentMonth
|
||||
});
|
||||
const Day = slots?.day ?? _PickersDay.PickersDay;
|
||||
// We don't want to pass to ownerState down, to avoid re-rendering all the day whenever a prop changes.
|
||||
const _useSlotProps = (0, _useSlotProps2.default)({
|
||||
elementType: Day,
|
||||
externalSlotProps: slotProps?.day,
|
||||
additionalProps: (0, _extends2.default)({
|
||||
disableHighlightToday,
|
||||
showDaysOutsideCurrentMonth,
|
||||
role: 'gridcell',
|
||||
isAnimating: isMonthSwitchingAnimating,
|
||||
// it is used in date range dragging logic by accessing `dataset.timestamp`
|
||||
'data-timestamp': adapter.toJsDate(day).valueOf()
|
||||
}, other),
|
||||
ownerState: (0, _extends2.default)({}, ownerState, {
|
||||
day,
|
||||
isDayDisabled: isDisabled,
|
||||
isDaySelected: isSelected
|
||||
})
|
||||
}),
|
||||
dayProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded2);
|
||||
const isFirstVisibleCell = React.useMemo(() => {
|
||||
const startOfMonth = adapter.startOfMonth(adapter.setMonth(day, currentMonthNumber));
|
||||
if (!showDaysOutsideCurrentMonth) {
|
||||
return adapter.isSameDay(day, startOfMonth);
|
||||
}
|
||||
return adapter.isSameDay(day, adapter.startOfWeek(startOfMonth));
|
||||
}, [currentMonthNumber, day, showDaysOutsideCurrentMonth, adapter]);
|
||||
const isLastVisibleCell = React.useMemo(() => {
|
||||
const endOfMonth = adapter.endOfMonth(adapter.setMonth(day, currentMonthNumber));
|
||||
if (!showDaysOutsideCurrentMonth) {
|
||||
return adapter.isSameDay(day, endOfMonth);
|
||||
}
|
||||
return adapter.isSameDay(day, adapter.endOfWeek(endOfMonth));
|
||||
}, [currentMonthNumber, day, showDaysOutsideCurrentMonth, adapter]);
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Day, (0, _extends2.default)({}, dayProps, {
|
||||
day: day,
|
||||
disabled: isDisabled,
|
||||
autoFocus: !isOutsideCurrentMonth && isFocusedDay,
|
||||
today: isToday,
|
||||
outsideCurrentMonth: isOutsideCurrentMonth,
|
||||
isFirstVisibleCell: isFirstVisibleCell,
|
||||
isLastVisibleCell: isLastVisibleCell,
|
||||
selected: isSelected,
|
||||
tabIndex: isFocusableDay ? 0 : -1,
|
||||
"aria-selected": isSelected,
|
||||
"aria-current": isToday ? 'date' : undefined
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore - do not document.
|
||||
*/
|
||||
function DayCalendar(inProps) {
|
||||
const props = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiDayCalendar'
|
||||
});
|
||||
const adapter = (0, _hooks.usePickerAdapter)();
|
||||
const {
|
||||
onFocusedDayChange,
|
||||
className,
|
||||
classes: classesProp,
|
||||
currentMonth,
|
||||
selectedDays,
|
||||
focusedDay,
|
||||
loading,
|
||||
onSelectedDaysChange,
|
||||
onMonthSwitchingAnimationEnd,
|
||||
readOnly,
|
||||
reduceAnimations,
|
||||
renderLoading = () => /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
||||
children: "..."
|
||||
}),
|
||||
slideDirection,
|
||||
TransitionProps,
|
||||
disablePast,
|
||||
disableFuture,
|
||||
minDate,
|
||||
maxDate,
|
||||
shouldDisableDate,
|
||||
shouldDisableMonth,
|
||||
shouldDisableYear,
|
||||
dayOfWeekFormatter = date => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase(),
|
||||
hasFocus,
|
||||
onFocusedViewChange,
|
||||
gridLabelId,
|
||||
displayWeekNumber,
|
||||
fixedWeekNumber,
|
||||
timezone
|
||||
} = props;
|
||||
const now = (0, _useUtils.useNow)(timezone);
|
||||
const classes = useUtilityClasses(classesProp);
|
||||
const isRtl = (0, _RtlProvider.useRtl)();
|
||||
const isDateDisabled = (0, _useIsDateDisabled.useIsDateDisabled)({
|
||||
shouldDisableDate,
|
||||
shouldDisableMonth,
|
||||
shouldDisableYear,
|
||||
minDate,
|
||||
maxDate,
|
||||
disablePast,
|
||||
disableFuture,
|
||||
timezone
|
||||
});
|
||||
const translations = (0, _hooks.usePickerTranslations)();
|
||||
const handleDaySelect = (0, _useEventCallback.default)(day => {
|
||||
if (readOnly) {
|
||||
return;
|
||||
}
|
||||
onSelectedDaysChange(day);
|
||||
});
|
||||
const focusDay = day => {
|
||||
if (!isDateDisabled(day)) {
|
||||
onFocusedDayChange(day);
|
||||
onFocusedViewChange?.(true);
|
||||
}
|
||||
};
|
||||
const handleKeyDown = (0, _useEventCallback.default)((event, day) => {
|
||||
switch (event.key) {
|
||||
case 'ArrowUp':
|
||||
focusDay(adapter.addDays(day, -7));
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'ArrowDown':
|
||||
focusDay(adapter.addDays(day, 7));
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'ArrowLeft':
|
||||
{
|
||||
const newFocusedDayDefault = adapter.addDays(day, isRtl ? 1 : -1);
|
||||
const nextAvailableMonth = adapter.addMonths(day, isRtl ? 1 : -1);
|
||||
const closestDayToFocus = (0, _dateUtils.findClosestEnabledDate)({
|
||||
adapter,
|
||||
date: newFocusedDayDefault,
|
||||
minDate: isRtl ? newFocusedDayDefault : adapter.startOfMonth(nextAvailableMonth),
|
||||
maxDate: isRtl ? adapter.endOfMonth(nextAvailableMonth) : newFocusedDayDefault,
|
||||
isDateDisabled,
|
||||
timezone
|
||||
});
|
||||
focusDay(closestDayToFocus || newFocusedDayDefault);
|
||||
event.preventDefault();
|
||||
break;
|
||||
}
|
||||
case 'ArrowRight':
|
||||
{
|
||||
const newFocusedDayDefault = adapter.addDays(day, isRtl ? -1 : 1);
|
||||
const nextAvailableMonth = adapter.addMonths(day, isRtl ? -1 : 1);
|
||||
const closestDayToFocus = (0, _dateUtils.findClosestEnabledDate)({
|
||||
adapter,
|
||||
date: newFocusedDayDefault,
|
||||
minDate: isRtl ? adapter.startOfMonth(nextAvailableMonth) : newFocusedDayDefault,
|
||||
maxDate: isRtl ? newFocusedDayDefault : adapter.endOfMonth(nextAvailableMonth),
|
||||
isDateDisabled,
|
||||
timezone
|
||||
});
|
||||
focusDay(closestDayToFocus || newFocusedDayDefault);
|
||||
event.preventDefault();
|
||||
break;
|
||||
}
|
||||
case 'Home':
|
||||
focusDay(adapter.startOfWeek(day));
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'End':
|
||||
focusDay(adapter.endOfWeek(day));
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'PageUp':
|
||||
focusDay(adapter.addMonths(day, 1));
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'PageDown':
|
||||
focusDay(adapter.addMonths(day, -1));
|
||||
event.preventDefault();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
const handleFocus = (0, _useEventCallback.default)((event, day) => focusDay(day));
|
||||
const handleBlur = (0, _useEventCallback.default)((event, day) => {
|
||||
if (focusedDay != null && adapter.isSameDay(focusedDay, day)) {
|
||||
onFocusedViewChange?.(false);
|
||||
}
|
||||
});
|
||||
const currentMonthNumber = adapter.getMonth(currentMonth);
|
||||
const currentYearNumber = adapter.getYear(currentMonth);
|
||||
const validSelectedDays = React.useMemo(() => selectedDays.filter(day => !!day).map(day => adapter.startOfDay(day)), [adapter, selectedDays]);
|
||||
|
||||
// need a new ref whenever the `key` of the transition changes: https://reactcommunity.org/react-transition-group/transition/#Transition-prop-nodeRef.
|
||||
const transitionKey = `${currentYearNumber}-${currentMonthNumber}`;
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const slideNodeRef = React.useMemo(() => /*#__PURE__*/React.createRef(), [transitionKey]);
|
||||
const weeksToDisplay = React.useMemo(() => {
|
||||
const toDisplay = adapter.getWeekArray(currentMonth);
|
||||
let nextMonth = adapter.addMonths(currentMonth, 1);
|
||||
while (fixedWeekNumber && toDisplay.length < fixedWeekNumber) {
|
||||
const additionalWeeks = adapter.getWeekArray(nextMonth);
|
||||
const hasCommonWeek = adapter.isSameDay(toDisplay[toDisplay.length - 1][0], additionalWeeks[0][0]);
|
||||
additionalWeeks.slice(hasCommonWeek ? 1 : 0).forEach(week => {
|
||||
if (toDisplay.length < fixedWeekNumber) {
|
||||
toDisplay.push(week);
|
||||
}
|
||||
});
|
||||
nextMonth = adapter.addMonths(nextMonth, 1);
|
||||
}
|
||||
return toDisplay;
|
||||
}, [currentMonth, fixedWeekNumber, adapter]);
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickersCalendarDayRoot, {
|
||||
role: "grid",
|
||||
"aria-labelledby": gridLabelId,
|
||||
className: classes.root,
|
||||
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(PickersCalendarDayHeader, {
|
||||
role: "row",
|
||||
className: classes.header,
|
||||
children: [displayWeekNumber && /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarWeekNumberLabel, {
|
||||
variant: "caption",
|
||||
role: "columnheader",
|
||||
"aria-label": translations.calendarWeekNumberHeaderLabel,
|
||||
className: classes.weekNumberLabel,
|
||||
children: translations.calendarWeekNumberHeaderText
|
||||
}), (0, _dateUtils.getWeekdays)(adapter, now).map((weekday, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarWeekDayLabel, {
|
||||
variant: "caption",
|
||||
role: "columnheader",
|
||||
"aria-label": adapter.format(weekday, 'weekday'),
|
||||
className: classes.weekDayLabel,
|
||||
children: dayOfWeekFormatter(weekday)
|
||||
}, i.toString()))]
|
||||
}), loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarLoadingContainer, {
|
||||
className: classes.loadingContainer,
|
||||
children: renderLoading()
|
||||
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarSlideTransition, (0, _extends2.default)({
|
||||
transKey: transitionKey,
|
||||
onExited: onMonthSwitchingAnimationEnd,
|
||||
reduceAnimations: reduceAnimations,
|
||||
slideDirection: slideDirection,
|
||||
className: (0, _clsx.default)(className, classes.slideTransition)
|
||||
}, TransitionProps, {
|
||||
nodeRef: slideNodeRef,
|
||||
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarWeekContainer, {
|
||||
ref: slideNodeRef,
|
||||
role: "rowgroup",
|
||||
className: classes.monthContainer,
|
||||
children: weeksToDisplay.map((week, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickersCalendarWeek, {
|
||||
role: "row",
|
||||
className: classes.weekContainer
|
||||
// fix issue of announcing row 1 as row 2
|
||||
// caused by week day labels row
|
||||
,
|
||||
"aria-rowindex": index + 1,
|
||||
children: [displayWeekNumber && /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarWeekNumber, {
|
||||
className: classes.weekNumber,
|
||||
role: "rowheader",
|
||||
"aria-label": translations.calendarWeekNumberAriaLabelText(adapter.getWeekNumber(week[0])),
|
||||
children: translations.calendarWeekNumberText(adapter.getWeekNumber(week[0]))
|
||||
}), week.map((day, dayIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedDay, {
|
||||
parentProps: props,
|
||||
day: day,
|
||||
selectedDays: validSelectedDays,
|
||||
isViewFocused: hasFocus,
|
||||
focusedDay: focusedDay,
|
||||
onKeyDown: handleKeyDown,
|
||||
onFocus: handleFocus,
|
||||
onBlur: handleBlur,
|
||||
onDaySelect: handleDaySelect,
|
||||
isDateDisabled: isDateDisabled,
|
||||
currentMonthNumber: currentMonthNumber
|
||||
// fix issue of announcing column 1 as column 2 when `displayWeekNumber` is enabled
|
||||
,
|
||||
"aria-colindex": dayIndex + 1
|
||||
}, day.toString()))]
|
||||
}, `week-${week[0]}`))
|
||||
})
|
||||
}))]
|
||||
});
|
||||
}
|
||||
18
node_modules/@mui/x-date-pickers/DateCalendar/PickersFadeTransitionGroup.d.ts
generated
vendored
Normal file
18
node_modules/@mui/x-date-pickers/DateCalendar/PickersFadeTransitionGroup.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import * as React from 'react';
|
||||
import { PickersFadeTransitionGroupClasses } from "./pickersFadeTransitionGroupClasses.js";
|
||||
export interface ExportedPickersFadeTransitionGroupProps {
|
||||
className?: string;
|
||||
reduceAnimations: boolean;
|
||||
transKey: React.Key;
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: Partial<PickersFadeTransitionGroupClasses>;
|
||||
}
|
||||
export interface PickersFadeTransitionGroupProps extends ExportedPickersFadeTransitionGroupProps {
|
||||
children: React.ReactElement<any>;
|
||||
}
|
||||
/**
|
||||
* @ignore - do not document.
|
||||
*/
|
||||
export declare function PickersFadeTransitionGroup(inProps: PickersFadeTransitionGroupProps): React.JSX.Element;
|
||||
71
node_modules/@mui/x-date-pickers/DateCalendar/PickersFadeTransitionGroup.js
generated
vendored
Normal file
71
node_modules/@mui/x-date-pickers/DateCalendar/PickersFadeTransitionGroup.js
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PickersFadeTransitionGroup = PickersFadeTransitionGroup;
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _reactTransitionGroup = require("react-transition-group");
|
||||
var _Fade = _interopRequireDefault(require("@mui/material/Fade"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
||||
var _pickersFadeTransitionGroupClasses = require("./pickersFadeTransitionGroupClasses");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["children"];
|
||||
const useUtilityClasses = classes => {
|
||||
const slots = {
|
||||
root: ['root']
|
||||
};
|
||||
return (0, _composeClasses.default)(slots, _pickersFadeTransitionGroupClasses.getPickersFadeTransitionGroupUtilityClass, classes);
|
||||
};
|
||||
const PickersFadeTransitionGroupRoot = (0, _styles.styled)(_reactTransitionGroup.TransitionGroup, {
|
||||
name: 'MuiPickersFadeTransitionGroup',
|
||||
slot: 'Root'
|
||||
})({
|
||||
display: 'block',
|
||||
position: 'relative'
|
||||
});
|
||||
|
||||
/**
|
||||
* @ignore - do not document.
|
||||
*/
|
||||
function PickersFadeTransitionGroup(inProps) {
|
||||
const props = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiPickersFadeTransitionGroup'
|
||||
});
|
||||
const {
|
||||
className,
|
||||
reduceAnimations,
|
||||
transKey,
|
||||
classes: classesProp
|
||||
} = props;
|
||||
const {
|
||||
children
|
||||
} = props,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
||||
const classes = useUtilityClasses(classesProp);
|
||||
const theme = (0, _styles.useTheme)();
|
||||
if (reduceAnimations) {
|
||||
return children;
|
||||
}
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersFadeTransitionGroupRoot, {
|
||||
className: (0, _clsx.default)(classes.root, className),
|
||||
ownerState: other,
|
||||
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Fade.default, {
|
||||
appear: false,
|
||||
mountOnEnter: true,
|
||||
unmountOnExit: true,
|
||||
timeout: {
|
||||
appear: theme.transitions.duration.enteringScreen,
|
||||
enter: theme.transitions.duration.enteringScreen,
|
||||
exit: 0
|
||||
},
|
||||
children: children
|
||||
}, transKey)
|
||||
});
|
||||
}
|
||||
25
node_modules/@mui/x-date-pickers/DateCalendar/PickersSlideTransition.d.ts
generated
vendored
Normal file
25
node_modules/@mui/x-date-pickers/DateCalendar/PickersSlideTransition.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import * as React from 'react';
|
||||
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
||||
import { PickersSlideTransitionClasses } from "./pickersSlideTransitionClasses.js";
|
||||
import { PickerOwnerState } from "../models/pickers.js";
|
||||
export type SlideDirection = 'right' | 'left';
|
||||
export interface PickerSlideTransitionOwnerState extends PickerOwnerState {
|
||||
slideDirection: SlideDirection;
|
||||
}
|
||||
export interface ExportedSlideTransitionProps {
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: Partial<PickersSlideTransitionClasses>;
|
||||
}
|
||||
export interface SlideTransitionProps extends Omit<CSSTransitionProps, 'timeout'>, ExportedSlideTransitionProps {
|
||||
children: React.ReactElement<any>;
|
||||
className?: string;
|
||||
reduceAnimations: boolean;
|
||||
slideDirection: SlideDirection;
|
||||
transKey: React.Key;
|
||||
}
|
||||
/**
|
||||
* @ignore - do not document.
|
||||
*/
|
||||
export declare function PickersSlideTransition(inProps: SlideTransitionProps): React.JSX.Element;
|
||||
151
node_modules/@mui/x-date-pickers/DateCalendar/PickersSlideTransition.js
generated
vendored
Normal file
151
node_modules/@mui/x-date-pickers/DateCalendar/PickersSlideTransition.js
generated
vendored
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PickersSlideTransition = PickersSlideTransition;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
||||
var _reactTransitionGroup = require("react-transition-group");
|
||||
var _pickersSlideTransitionClasses = require("./pickersSlideTransitionClasses");
|
||||
var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["children", "className", "reduceAnimations", "slideDirection", "transKey", "classes"];
|
||||
const useUtilityClasses = (classes, ownerState) => {
|
||||
const {
|
||||
slideDirection
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root'],
|
||||
exit: ['slideExit'],
|
||||
enterActive: ['slideEnterActive'],
|
||||
enter: [`slideEnter-${slideDirection}`],
|
||||
exitActive: [`slideExitActiveLeft-${slideDirection}`]
|
||||
};
|
||||
return (0, _composeClasses.default)(slots, _pickersSlideTransitionClasses.getPickersSlideTransitionUtilityClass, classes);
|
||||
};
|
||||
const PickersSlideTransitionRoot = (0, _styles.styled)(_reactTransitionGroup.TransitionGroup, {
|
||||
name: 'MuiPickersSlideTransition',
|
||||
slot: 'Root',
|
||||
overridesResolver: (_, styles) => [styles.root, {
|
||||
[`.${_pickersSlideTransitionClasses.pickersSlideTransitionClasses['slideEnter-left']}`]: styles['slideEnter-left']
|
||||
}, {
|
||||
[`.${_pickersSlideTransitionClasses.pickersSlideTransitionClasses['slideEnter-right']}`]: styles['slideEnter-right']
|
||||
}, {
|
||||
[`.${_pickersSlideTransitionClasses.pickersSlideTransitionClasses.slideEnterActive}`]: styles.slideEnterActive
|
||||
}, {
|
||||
[`.${_pickersSlideTransitionClasses.pickersSlideTransitionClasses.slideExit}`]: styles.slideExit
|
||||
}, {
|
||||
[`.${_pickersSlideTransitionClasses.pickersSlideTransitionClasses['slideExitActiveLeft-left']}`]: styles['slideExitActiveLeft-left']
|
||||
}, {
|
||||
[`.${_pickersSlideTransitionClasses.pickersSlideTransitionClasses['slideExitActiveLeft-right']}`]: styles['slideExitActiveLeft-right']
|
||||
}]
|
||||
})(({
|
||||
theme
|
||||
}) => {
|
||||
const slideTransition = theme.transitions.create('transform', {
|
||||
duration: theme.transitions.duration.complex,
|
||||
easing: 'cubic-bezier(0.35, 0.8, 0.4, 1)'
|
||||
});
|
||||
return {
|
||||
display: 'block',
|
||||
position: 'relative',
|
||||
overflowX: 'hidden',
|
||||
'& > *': {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
left: 0
|
||||
},
|
||||
[`& .${_pickersSlideTransitionClasses.pickersSlideTransitionClasses['slideEnter-left']}`]: {
|
||||
willChange: 'transform',
|
||||
transform: 'translate(100%)',
|
||||
zIndex: 1
|
||||
},
|
||||
[`& .${_pickersSlideTransitionClasses.pickersSlideTransitionClasses['slideEnter-right']}`]: {
|
||||
willChange: 'transform',
|
||||
transform: 'translate(-100%)',
|
||||
zIndex: 1
|
||||
},
|
||||
[`& .${_pickersSlideTransitionClasses.pickersSlideTransitionClasses.slideEnterActive}`]: {
|
||||
transform: 'translate(0%)',
|
||||
transition: slideTransition
|
||||
},
|
||||
[`& .${_pickersSlideTransitionClasses.pickersSlideTransitionClasses.slideExit}`]: {
|
||||
transform: 'translate(0%)'
|
||||
},
|
||||
[`& .${_pickersSlideTransitionClasses.pickersSlideTransitionClasses['slideExitActiveLeft-left']}`]: {
|
||||
willChange: 'transform',
|
||||
transform: 'translate(-100%)',
|
||||
transition: slideTransition,
|
||||
zIndex: 0
|
||||
},
|
||||
[`& .${_pickersSlideTransitionClasses.pickersSlideTransitionClasses['slideExitActiveLeft-right']}`]: {
|
||||
willChange: 'transform',
|
||||
transform: 'translate(100%)',
|
||||
transition: slideTransition,
|
||||
zIndex: 0
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* @ignore - do not document.
|
||||
*/
|
||||
function PickersSlideTransition(inProps) {
|
||||
const props = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiPickersSlideTransition'
|
||||
});
|
||||
const {
|
||||
children,
|
||||
className,
|
||||
reduceAnimations,
|
||||
slideDirection,
|
||||
transKey,
|
||||
classes: classesProp
|
||||
} = props,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
||||
const {
|
||||
ownerState: pickerOwnerState
|
||||
} = (0, _usePickerPrivateContext.usePickerPrivateContext)();
|
||||
const ownerState = (0, _extends2.default)({}, pickerOwnerState, {
|
||||
slideDirection
|
||||
});
|
||||
const classes = useUtilityClasses(classesProp, ownerState);
|
||||
const theme = (0, _styles.useTheme)();
|
||||
if (reduceAnimations) {
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
||||
className: (0, _clsx.default)(classes.root, className),
|
||||
children: children
|
||||
});
|
||||
}
|
||||
const transitionClasses = {
|
||||
exit: classes.exit,
|
||||
enterActive: classes.enterActive,
|
||||
enter: classes.enter,
|
||||
exitActive: classes.exitActive
|
||||
};
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersSlideTransitionRoot, {
|
||||
className: (0, _clsx.default)(classes.root, className),
|
||||
childFactory: element => /*#__PURE__*/React.cloneElement(element, {
|
||||
classNames: transitionClasses
|
||||
}),
|
||||
role: "presentation",
|
||||
ownerState: ownerState,
|
||||
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, (0, _extends2.default)({
|
||||
mountOnEnter: true,
|
||||
unmountOnExit: true,
|
||||
timeout: theme.transitions.duration.complex,
|
||||
classNames: transitionClasses
|
||||
}, other, {
|
||||
children: children
|
||||
}), transKey)
|
||||
});
|
||||
}
|
||||
9
node_modules/@mui/x-date-pickers/DateCalendar/dateCalendarClasses.d.ts
generated
vendored
Normal file
9
node_modules/@mui/x-date-pickers/DateCalendar/dateCalendarClasses.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export interface DateCalendarClasses {
|
||||
/** Styles applied to the root element. */
|
||||
root: string;
|
||||
/** Styles applied to the transition group element. */
|
||||
viewTransitionContainer: string;
|
||||
}
|
||||
export type DateCalendarClassKey = keyof DateCalendarClasses;
|
||||
export declare const getDateCalendarUtilityClass: (slot: string) => string;
|
||||
export declare const dateCalendarClasses: DateCalendarClasses;
|
||||
12
node_modules/@mui/x-date-pickers/DateCalendar/dateCalendarClasses.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/DateCalendar/dateCalendarClasses.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getDateCalendarUtilityClass = exports.dateCalendarClasses = void 0;
|
||||
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
||||
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
||||
const getDateCalendarUtilityClass = slot => (0, _generateUtilityClass.default)('MuiDateCalendar', slot);
|
||||
exports.getDateCalendarUtilityClass = getDateCalendarUtilityClass;
|
||||
const dateCalendarClasses = exports.dateCalendarClasses = (0, _generateUtilityClasses.default)('MuiDateCalendar', ['root', 'viewTransitionContainer']);
|
||||
23
node_modules/@mui/x-date-pickers/DateCalendar/dayCalendarClasses.d.ts
generated
vendored
Normal file
23
node_modules/@mui/x-date-pickers/DateCalendar/dayCalendarClasses.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
export interface DayCalendarClasses {
|
||||
/** Styles applied to the root element. */
|
||||
root: string;
|
||||
/** Styles applied to the header element. */
|
||||
header: string;
|
||||
/** Styles applied to the week day label element. */
|
||||
weekDayLabel: string;
|
||||
/** Styles applied to the loading container element. */
|
||||
loadingContainer: string;
|
||||
/** Styles applied to the slide transition element. */
|
||||
slideTransition: string;
|
||||
/** Styles applied to the month container element. */
|
||||
monthContainer: string;
|
||||
/** Styles applied to the week container element. */
|
||||
weekContainer: string;
|
||||
/** Styles applied to the week number header */
|
||||
weekNumberLabel: string;
|
||||
/** Styles applied to the week number element */
|
||||
weekNumber: string;
|
||||
}
|
||||
export type DayCalendarClassKey = keyof DayCalendarClasses;
|
||||
export declare const getDayCalendarUtilityClass: (slot: string) => string;
|
||||
export declare const dayCalendarClasses: DayCalendarClasses;
|
||||
12
node_modules/@mui/x-date-pickers/DateCalendar/dayCalendarClasses.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/DateCalendar/dayCalendarClasses.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getDayCalendarUtilityClass = exports.dayCalendarClasses = void 0;
|
||||
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
||||
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
||||
const getDayCalendarUtilityClass = slot => (0, _generateUtilityClass.default)('MuiDayCalendar', slot);
|
||||
exports.getDayCalendarUtilityClass = getDayCalendarUtilityClass;
|
||||
const dayCalendarClasses = exports.dayCalendarClasses = (0, _generateUtilityClasses.default)('MuiDayCalendar', ['root', 'header', 'weekDayLabel', 'loadingContainer', 'slideTransition', 'monthContainer', 'weekContainer', 'weekNumberLabel', 'weekNumber']);
|
||||
12
node_modules/@mui/x-date-pickers/DateCalendar/index.d.ts
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/DateCalendar/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export { DateCalendar } from "./DateCalendar.js";
|
||||
export type { DateCalendarProps, DateCalendarSlots, DateCalendarSlotProps } from "./DateCalendar.types.js";
|
||||
export { getDateCalendarUtilityClass, dateCalendarClasses } from "./dateCalendarClasses.js";
|
||||
export type { DateCalendarClassKey, DateCalendarClasses } from "./dateCalendarClasses.js";
|
||||
export { dayCalendarClasses } from "./dayCalendarClasses.js";
|
||||
export type { DayCalendarClassKey, DayCalendarClasses } from "./dayCalendarClasses.js";
|
||||
export type { PickersFadeTransitionGroupProps, ExportedPickersFadeTransitionGroupProps } from "./PickersFadeTransitionGroup.js";
|
||||
export { pickersFadeTransitionGroupClasses } from "./pickersFadeTransitionGroupClasses.js";
|
||||
export type { PickersFadeTransitionGroupClassKey, PickersFadeTransitionGroupClasses } from "./pickersFadeTransitionGroupClasses.js";
|
||||
export { pickersSlideTransitionClasses } from "./pickersSlideTransitionClasses.js";
|
||||
export type { PickersSlideTransitionClassKey, PickersSlideTransitionClasses } from "./pickersSlideTransitionClasses.js";
|
||||
export type { ExportedSlideTransitionProps } from "./PickersSlideTransition.js";
|
||||
46
node_modules/@mui/x-date-pickers/DateCalendar/index.js
generated
vendored
Normal file
46
node_modules/@mui/x-date-pickers/DateCalendar/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "DateCalendar", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _DateCalendar.DateCalendar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "dateCalendarClasses", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _dateCalendarClasses.dateCalendarClasses;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "dayCalendarClasses", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _dayCalendarClasses.dayCalendarClasses;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getDateCalendarUtilityClass", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _dateCalendarClasses.getDateCalendarUtilityClass;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "pickersFadeTransitionGroupClasses", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _pickersFadeTransitionGroupClasses.pickersFadeTransitionGroupClasses;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "pickersSlideTransitionClasses", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _pickersSlideTransitionClasses.pickersSlideTransitionClasses;
|
||||
}
|
||||
});
|
||||
var _DateCalendar = require("./DateCalendar");
|
||||
var _dateCalendarClasses = require("./dateCalendarClasses");
|
||||
var _dayCalendarClasses = require("./dayCalendarClasses");
|
||||
var _pickersFadeTransitionGroupClasses = require("./pickersFadeTransitionGroupClasses");
|
||||
var _pickersSlideTransitionClasses = require("./pickersSlideTransitionClasses");
|
||||
7
node_modules/@mui/x-date-pickers/DateCalendar/pickersFadeTransitionGroupClasses.d.ts
generated
vendored
Normal file
7
node_modules/@mui/x-date-pickers/DateCalendar/pickersFadeTransitionGroupClasses.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export interface PickersFadeTransitionGroupClasses {
|
||||
/** Styles applied to the root element. */
|
||||
root: string;
|
||||
}
|
||||
export type PickersFadeTransitionGroupClassKey = keyof PickersFadeTransitionGroupClasses;
|
||||
export declare const getPickersFadeTransitionGroupUtilityClass: (slot: string) => string;
|
||||
export declare const pickersFadeTransitionGroupClasses: PickersFadeTransitionGroupClasses;
|
||||
12
node_modules/@mui/x-date-pickers/DateCalendar/pickersFadeTransitionGroupClasses.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/DateCalendar/pickersFadeTransitionGroupClasses.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.pickersFadeTransitionGroupClasses = exports.getPickersFadeTransitionGroupUtilityClass = void 0;
|
||||
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
||||
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
||||
const getPickersFadeTransitionGroupUtilityClass = slot => (0, _generateUtilityClass.default)('MuiPickersFadeTransitionGroup', slot);
|
||||
exports.getPickersFadeTransitionGroupUtilityClass = getPickersFadeTransitionGroupUtilityClass;
|
||||
const pickersFadeTransitionGroupClasses = exports.pickersFadeTransitionGroupClasses = (0, _generateUtilityClasses.default)('MuiPickersFadeTransitionGroup', ['root']);
|
||||
19
node_modules/@mui/x-date-pickers/DateCalendar/pickersSlideTransitionClasses.d.ts
generated
vendored
Normal file
19
node_modules/@mui/x-date-pickers/DateCalendar/pickersSlideTransitionClasses.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
export interface PickersSlideTransitionClasses {
|
||||
/** Styles applied to the root element. */
|
||||
root: string;
|
||||
/** Styles applied to content element sliding in from left. */
|
||||
'slideEnter-left': string;
|
||||
/** Styles applied to content element sliding in from right. */
|
||||
'slideEnter-right': string;
|
||||
/** Styles applied to the element entering (transitioning into) the container. */
|
||||
slideEnterActive: string;
|
||||
/** Styles applied to the element leaving (transitioning out of) the container. */
|
||||
slideExit: string;
|
||||
/** Styles applied to the element on the left leaving (transitioning out of) the container. */
|
||||
'slideExitActiveLeft-left': string;
|
||||
/** Styles applied to the element on the right leaving (transitioning out of) the container. */
|
||||
'slideExitActiveLeft-right': string;
|
||||
}
|
||||
export type PickersSlideTransitionClassKey = keyof PickersSlideTransitionClasses;
|
||||
export declare const getPickersSlideTransitionUtilityClass: (slot: string) => string;
|
||||
export declare const pickersSlideTransitionClasses: PickersSlideTransitionClasses;
|
||||
12
node_modules/@mui/x-date-pickers/DateCalendar/pickersSlideTransitionClasses.js
generated
vendored
Normal file
12
node_modules/@mui/x-date-pickers/DateCalendar/pickersSlideTransitionClasses.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.pickersSlideTransitionClasses = exports.getPickersSlideTransitionUtilityClass = void 0;
|
||||
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
||||
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
||||
const getPickersSlideTransitionUtilityClass = slot => (0, _generateUtilityClass.default)('MuiPickersSlideTransition', slot);
|
||||
exports.getPickersSlideTransitionUtilityClass = getPickersSlideTransitionUtilityClass;
|
||||
const pickersSlideTransitionClasses = exports.pickersSlideTransitionClasses = (0, _generateUtilityClasses.default)('MuiPickersSlideTransition', ['root', 'slideEnter-left', 'slideEnter-right', 'slideEnterActive', 'slideExit', 'slideExitActiveLeft-left', 'slideExitActiveLeft-right']);
|
||||
27
node_modules/@mui/x-date-pickers/DateCalendar/useCalendarState.d.ts
generated
vendored
Normal file
27
node_modules/@mui/x-date-pickers/DateCalendar/useCalendarState.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { SlideDirection } from "./PickersSlideTransition.js";
|
||||
import { PickersTimezone, PickerValidDate } from "../models/index.js";
|
||||
import { DateCalendarDefaultizedProps } from "./DateCalendar.types.js";
|
||||
interface CalendarState {
|
||||
currentMonth: PickerValidDate;
|
||||
focusedDay: PickerValidDate | null;
|
||||
isMonthSwitchingAnimating: boolean;
|
||||
slideDirection: SlideDirection;
|
||||
}
|
||||
interface UseCalendarStateParameters extends Pick<DateCalendarDefaultizedProps, 'referenceDate' | 'disableFuture' | 'disablePast' | 'minDate' | 'maxDate' | 'onMonthChange' | 'onYearChange' | 'reduceAnimations' | 'shouldDisableDate'> {
|
||||
value: PickerValidDate | null;
|
||||
timezone: PickersTimezone;
|
||||
getCurrentMonthFromVisibleDate: (focusedDay: PickerValidDate, prevMonth: PickerValidDate) => PickerValidDate;
|
||||
}
|
||||
interface UseCalendarStateReturnValue {
|
||||
referenceDate: PickerValidDate;
|
||||
calendarState: CalendarState;
|
||||
setVisibleDate: (parameters: SetVisibleDateParameters) => void;
|
||||
isDateDisabled: (day: PickerValidDate | null) => boolean;
|
||||
onMonthSwitchingAnimationEnd: () => void;
|
||||
}
|
||||
export declare const useCalendarState: (params: UseCalendarStateParameters) => UseCalendarStateReturnValue;
|
||||
interface SetVisibleDateParameters {
|
||||
target: PickerValidDate;
|
||||
reason: 'header-navigation' | 'cell-interaction' | 'controlled-value-change';
|
||||
}
|
||||
export {};
|
||||
164
node_modules/@mui/x-date-pickers/DateCalendar/useCalendarState.js
generated
vendored
Normal file
164
node_modules/@mui/x-date-pickers/DateCalendar/useCalendarState.js
generated
vendored
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useCalendarState = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
||||
var _useIsDateDisabled = require("./useIsDateDisabled");
|
||||
var _valueManagers = require("../internals/utils/valueManagers");
|
||||
var _getDefaultReferenceDate = require("../internals/utils/getDefaultReferenceDate");
|
||||
var _dateUtils = require("../internals/utils/date-utils");
|
||||
var _usePickerAdapter = require("../hooks/usePickerAdapter");
|
||||
const createCalendarStateReducer = (reduceAnimations, adapter) => (state, action) => {
|
||||
switch (action.type) {
|
||||
case 'setVisibleDate':
|
||||
return (0, _extends2.default)({}, state, {
|
||||
slideDirection: action.direction,
|
||||
currentMonth: action.month,
|
||||
isMonthSwitchingAnimating: !adapter.isSameMonth(action.month, state.currentMonth) && !reduceAnimations && !action.skipAnimation,
|
||||
focusedDay: action.focusedDay
|
||||
});
|
||||
case 'changeMonthTimezone':
|
||||
{
|
||||
const newTimezone = action.newTimezone;
|
||||
if (adapter.getTimezone(state.currentMonth) === newTimezone) {
|
||||
return state;
|
||||
}
|
||||
let newCurrentMonth = adapter.setTimezone(state.currentMonth, newTimezone);
|
||||
if (adapter.getMonth(newCurrentMonth) !== adapter.getMonth(state.currentMonth)) {
|
||||
newCurrentMonth = adapter.setMonth(newCurrentMonth, adapter.getMonth(state.currentMonth));
|
||||
}
|
||||
return (0, _extends2.default)({}, state, {
|
||||
currentMonth: newCurrentMonth
|
||||
});
|
||||
}
|
||||
case 'finishMonthSwitchingAnimation':
|
||||
return (0, _extends2.default)({}, state, {
|
||||
isMonthSwitchingAnimating: false
|
||||
});
|
||||
default:
|
||||
throw new Error('missing support');
|
||||
}
|
||||
};
|
||||
const useCalendarState = params => {
|
||||
const {
|
||||
value,
|
||||
referenceDate: referenceDateProp,
|
||||
disableFuture,
|
||||
disablePast,
|
||||
maxDate,
|
||||
minDate,
|
||||
onMonthChange,
|
||||
onYearChange,
|
||||
reduceAnimations,
|
||||
shouldDisableDate,
|
||||
timezone,
|
||||
getCurrentMonthFromVisibleDate
|
||||
} = params;
|
||||
const adapter = (0, _usePickerAdapter.usePickerAdapter)();
|
||||
const reducerFn = React.useRef(createCalendarStateReducer(Boolean(reduceAnimations), adapter)).current;
|
||||
const referenceDate = React.useMemo(() => {
|
||||
return _valueManagers.singleItemValueManager.getInitialReferenceValue({
|
||||
value,
|
||||
adapter,
|
||||
timezone,
|
||||
props: params,
|
||||
referenceDate: referenceDateProp,
|
||||
granularity: _getDefaultReferenceDate.SECTION_TYPE_GRANULARITY.day
|
||||
});
|
||||
},
|
||||
// We want the `referenceDate` to update on prop and `timezone` change (https://github.com/mui/mui-x/issues/10804)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[referenceDateProp, timezone]);
|
||||
const [calendarState, dispatch] = React.useReducer(reducerFn, {
|
||||
isMonthSwitchingAnimating: false,
|
||||
focusedDay: referenceDate,
|
||||
currentMonth: adapter.startOfMonth(referenceDate),
|
||||
slideDirection: 'left'
|
||||
});
|
||||
const isDateDisabled = (0, _useIsDateDisabled.useIsDateDisabled)({
|
||||
shouldDisableDate,
|
||||
minDate,
|
||||
maxDate,
|
||||
disableFuture,
|
||||
disablePast,
|
||||
timezone
|
||||
});
|
||||
|
||||
// Ensure that `calendarState.currentMonth` timezone is updated when `referenceDate` (or timezone changes)
|
||||
// https://github.com/mui/mui-x/issues/10804
|
||||
React.useEffect(() => {
|
||||
dispatch({
|
||||
type: 'changeMonthTimezone',
|
||||
newTimezone: adapter.getTimezone(referenceDate)
|
||||
});
|
||||
}, [referenceDate, adapter]);
|
||||
const setVisibleDate = (0, _useEventCallback.default)(({
|
||||
target,
|
||||
reason
|
||||
}) => {
|
||||
if (reason === 'cell-interaction' && calendarState.focusedDay != null && adapter.isSameDay(target, calendarState.focusedDay)) {
|
||||
return;
|
||||
}
|
||||
const skipAnimation = reason === 'cell-interaction';
|
||||
let month;
|
||||
let focusedDay;
|
||||
if (reason === 'cell-interaction') {
|
||||
month = getCurrentMonthFromVisibleDate(target, calendarState.currentMonth);
|
||||
focusedDay = target;
|
||||
} else {
|
||||
month = adapter.isSameMonth(target, calendarState.currentMonth) ? calendarState.currentMonth : adapter.startOfMonth(target);
|
||||
focusedDay = target;
|
||||
|
||||
// If the date is disabled, we try to find a non-disabled date inside the same month.
|
||||
if (isDateDisabled(focusedDay)) {
|
||||
const startOfMonth = adapter.startOfMonth(target);
|
||||
const endOfMonth = adapter.endOfMonth(target);
|
||||
focusedDay = (0, _dateUtils.findClosestEnabledDate)({
|
||||
adapter,
|
||||
date: focusedDay,
|
||||
minDate: adapter.isBefore(minDate, startOfMonth) ? startOfMonth : minDate,
|
||||
maxDate: adapter.isAfter(maxDate, endOfMonth) ? endOfMonth : maxDate,
|
||||
disablePast,
|
||||
disableFuture,
|
||||
isDateDisabled,
|
||||
timezone
|
||||
});
|
||||
}
|
||||
}
|
||||
const hasChangedMonth = !adapter.isSameMonth(calendarState.currentMonth, month);
|
||||
const hasChangedYear = !adapter.isSameYear(calendarState.currentMonth, month);
|
||||
if (hasChangedMonth) {
|
||||
onMonthChange?.(month);
|
||||
}
|
||||
if (hasChangedYear) {
|
||||
onYearChange?.(adapter.startOfYear(month));
|
||||
}
|
||||
dispatch({
|
||||
type: 'setVisibleDate',
|
||||
month,
|
||||
direction: adapter.isAfterDay(month, calendarState.currentMonth) ? 'left' : 'right',
|
||||
focusedDay: calendarState.focusedDay != null && focusedDay != null && adapter.isSameDay(focusedDay, calendarState.focusedDay) ? calendarState.focusedDay : focusedDay,
|
||||
skipAnimation
|
||||
});
|
||||
});
|
||||
const onMonthSwitchingAnimationEnd = React.useCallback(() => {
|
||||
dispatch({
|
||||
type: 'finishMonthSwitchingAnimation'
|
||||
});
|
||||
}, []);
|
||||
return {
|
||||
referenceDate,
|
||||
calendarState,
|
||||
setVisibleDate,
|
||||
isDateDisabled,
|
||||
onMonthSwitchingAnimationEnd
|
||||
};
|
||||
};
|
||||
exports.useCalendarState = useCalendarState;
|
||||
13
node_modules/@mui/x-date-pickers/DateCalendar/useIsDateDisabled.d.ts
generated
vendored
Normal file
13
node_modules/@mui/x-date-pickers/DateCalendar/useIsDateDisabled.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { DefaultizedProps } from '@mui/x-internals/types';
|
||||
import { ValidateDateProps } from "../validation/index.js";
|
||||
import { PickerValidDate, TimezoneProps } from "../models/index.js";
|
||||
export declare const useIsDateDisabled: ({
|
||||
shouldDisableDate,
|
||||
shouldDisableMonth,
|
||||
shouldDisableYear,
|
||||
minDate,
|
||||
maxDate,
|
||||
disableFuture,
|
||||
disablePast,
|
||||
timezone
|
||||
}: ValidateDateProps & DefaultizedProps<TimezoneProps, "timezone">) => (day: PickerValidDate | null) => boolean;
|
||||
38
node_modules/@mui/x-date-pickers/DateCalendar/useIsDateDisabled.js
generated
vendored
Normal file
38
node_modules/@mui/x-date-pickers/DateCalendar/useIsDateDisabled.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useIsDateDisabled = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _validation = require("../validation");
|
||||
var _usePickerAdapter = require("../hooks/usePickerAdapter");
|
||||
const useIsDateDisabled = ({
|
||||
shouldDisableDate,
|
||||
shouldDisableMonth,
|
||||
shouldDisableYear,
|
||||
minDate,
|
||||
maxDate,
|
||||
disableFuture,
|
||||
disablePast,
|
||||
timezone
|
||||
}) => {
|
||||
const adapter = (0, _usePickerAdapter.usePickerAdapter)();
|
||||
return React.useCallback(day => (0, _validation.validateDate)({
|
||||
adapter,
|
||||
value: day,
|
||||
timezone,
|
||||
props: {
|
||||
shouldDisableDate,
|
||||
shouldDisableMonth,
|
||||
shouldDisableYear,
|
||||
minDate,
|
||||
maxDate,
|
||||
disableFuture,
|
||||
disablePast
|
||||
}
|
||||
}) !== null, [adapter, shouldDisableDate, shouldDisableMonth, shouldDisableYear, minDate, maxDate, disableFuture, disablePast, timezone]);
|
||||
};
|
||||
exports.useIsDateDisabled = useIsDateDisabled;
|
||||
17
node_modules/@mui/x-date-pickers/DateField/DateField.d.ts
generated
vendored
Normal file
17
node_modules/@mui/x-date-pickers/DateField/DateField.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import * as React from 'react';
|
||||
import { DateFieldProps } from "./DateField.types.js";
|
||||
type DateFieldComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DateFieldProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
||||
propTypes?: any;
|
||||
};
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DateField](http://mui.com/x/react-date-pickers/date-field/)
|
||||
* - [Fields](https://mui.com/x/react-date-pickers/fields/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateField API](https://mui.com/x/api/date-pickers/date-field/)
|
||||
*/
|
||||
declare const DateField: DateFieldComponent;
|
||||
export { DateField };
|
||||
334
node_modules/@mui/x-date-pickers/DateField/DateField.js
generated
vendored
Normal file
334
node_modules/@mui/x-date-pickers/DateField/DateField.js
generated
vendored
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DateField = void 0;
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
||||
var _useDateField = require("./useDateField");
|
||||
var _PickerFieldUI = require("../internals/components/PickerFieldUI");
|
||||
var _icons = require("../icons");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["slots", "slotProps"];
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DateField](http://mui.com/x/react-date-pickers/date-field/)
|
||||
* - [Fields](https://mui.com/x/react-date-pickers/fields/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateField API](https://mui.com/x/api/date-pickers/date-field/)
|
||||
*/
|
||||
const DateField = exports.DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRef) {
|
||||
const themeProps = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiDateField'
|
||||
});
|
||||
const {
|
||||
slots,
|
||||
slotProps
|
||||
} = themeProps,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
|
||||
const textFieldProps = (0, _PickerFieldUI.useFieldTextFieldProps)({
|
||||
slotProps,
|
||||
ref: inRef,
|
||||
externalForwardedProps: other
|
||||
});
|
||||
const fieldResponse = (0, _useDateField.useDateField)(textFieldProps);
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
|
||||
slots: slots,
|
||||
slotProps: slotProps,
|
||||
fieldResponse: fieldResponse,
|
||||
defaultOpenPickerIcon: _icons.CalendarIcon
|
||||
});
|
||||
});
|
||||
if (process.env.NODE_ENV !== "production") DateField.displayName = "DateField";
|
||||
process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
/**
|
||||
* If `true`, the `input` element is focused during the first mount.
|
||||
* @default false
|
||||
*/
|
||||
autoFocus: _propTypes.default.bool,
|
||||
className: _propTypes.default.string,
|
||||
/**
|
||||
* If `true`, a clear button will be shown in the field allowing value clearing.
|
||||
* @default false
|
||||
*/
|
||||
clearable: _propTypes.default.bool,
|
||||
/**
|
||||
* The position at which the clear button is placed.
|
||||
* If the field is not clearable, the button is not rendered.
|
||||
* @default 'end'
|
||||
*/
|
||||
clearButtonPosition: _propTypes.default.oneOf(['end', 'start']),
|
||||
/**
|
||||
* The color of the component.
|
||||
* It supports both default and custom theme colors, which can be added as shown in the
|
||||
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
||||
* @default 'primary'
|
||||
*/
|
||||
color: _propTypes.default.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
||||
component: _propTypes.default.elementType,
|
||||
/**
|
||||
* The default value. Use when the component is not controlled.
|
||||
*/
|
||||
defaultValue: _propTypes.default.object,
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* When disabled, the value cannot be changed and no interaction is possible.
|
||||
* @default false
|
||||
*/
|
||||
disabled: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values after the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disableFuture: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values before the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disablePast: _propTypes.default.bool,
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
enableAccessibleFieldDOMStructure: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, the component is displayed in focused state.
|
||||
*/
|
||||
focused: _propTypes.default.bool,
|
||||
/**
|
||||
* Format of the date when rendered in the input(s).
|
||||
*/
|
||||
format: _propTypes.default.string,
|
||||
/**
|
||||
* Density of the format when rendered in the input.
|
||||
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
||||
* @default "dense"
|
||||
*/
|
||||
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
||||
/**
|
||||
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
||||
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
FormHelperTextProps: _propTypes.default.object,
|
||||
/**
|
||||
* If `true`, the input will take up the full width of its container.
|
||||
* @default false
|
||||
*/
|
||||
fullWidth: _propTypes.default.bool,
|
||||
/**
|
||||
* The helper text content.
|
||||
*/
|
||||
helperText: _propTypes.default.node,
|
||||
/**
|
||||
* If `true`, the label is hidden.
|
||||
* This is used to increase density for a `FilledInput`.
|
||||
* Be sure to add `aria-label` to the `input` element.
|
||||
* @default false
|
||||
*/
|
||||
hiddenLabel: _propTypes.default.bool,
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
* Use this prop to make `label` and `helperText` accessible for screen readers.
|
||||
*/
|
||||
id: _propTypes.default.string,
|
||||
/**
|
||||
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
||||
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
||||
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
InputLabelProps: _propTypes.default.object,
|
||||
/**
|
||||
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
||||
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
inputProps: _propTypes.default.object,
|
||||
/**
|
||||
* Props applied to the Input element.
|
||||
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
||||
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
||||
* component depending on the `variant` prop value.
|
||||
* @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
InputProps: _propTypes.default.object,
|
||||
/**
|
||||
* Pass a ref to the `input` element.
|
||||
*/
|
||||
inputRef: _refType.default,
|
||||
/**
|
||||
* The label content.
|
||||
*/
|
||||
label: _propTypes.default.node,
|
||||
/**
|
||||
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
||||
* @default 'none'
|
||||
*/
|
||||
margin: _propTypes.default.oneOf(['dense', 'none', 'normal']),
|
||||
/**
|
||||
* Maximal selectable date.
|
||||
* @default 2099-12-31
|
||||
*/
|
||||
maxDate: _propTypes.default.object,
|
||||
/**
|
||||
* Minimal selectable date.
|
||||
* @default 1900-01-01
|
||||
*/
|
||||
minDate: _propTypes.default.object,
|
||||
/**
|
||||
* Name attribute of the `input` element.
|
||||
*/
|
||||
name: _propTypes.default.string,
|
||||
onBlur: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the value changes.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TValue} value The new value.
|
||||
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
||||
*/
|
||||
onChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the clear button is clicked.
|
||||
*/
|
||||
onClear: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the error associated with the current value changes.
|
||||
* When a validation error is detected, the `error` parameter contains a non-null value.
|
||||
* This can be used to render an appropriate form error.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TError} error The reason why the current value is not valid.
|
||||
* @param {TValue} value The value associated with the error.
|
||||
*/
|
||||
onError: _propTypes.default.func,
|
||||
onFocus: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the selected sections change.
|
||||
* @param {FieldSelectedSections} newValue The new selected sections.
|
||||
*/
|
||||
onSelectedSectionsChange: _propTypes.default.func,
|
||||
/**
|
||||
* The position at which the opening button is placed.
|
||||
* If there is no Picker to open, the button is not rendered
|
||||
* @default 'end'
|
||||
*/
|
||||
openPickerButtonPosition: _propTypes.default.oneOf(['end', 'start']),
|
||||
/**
|
||||
* If `true`, the component is read-only.
|
||||
* When read-only, the value cannot be changed but the user can interact with the interface.
|
||||
* @default false
|
||||
*/
|
||||
readOnly: _propTypes.default.bool,
|
||||
/**
|
||||
* The date used to generate a part of the new value that is not present in the format when both `value` and `defaultValue` are empty.
|
||||
* For example, on time fields it will be used to determine the date to set.
|
||||
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
||||
*/
|
||||
referenceDate: _propTypes.default.object,
|
||||
/**
|
||||
* If `true`, the label is displayed as required and the `input` element is required.
|
||||
* @default false
|
||||
*/
|
||||
required: _propTypes.default.bool,
|
||||
/**
|
||||
* The currently selected sections.
|
||||
* This prop accepts four formats:
|
||||
* 1. If a number is provided, the section at this index will be selected.
|
||||
* 2. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
|
||||
* 3. If `"all"` is provided, all the sections will be selected.
|
||||
* 4. If `null` is provided, no section will be selected.
|
||||
* If not provided, the selected sections will be handled internally.
|
||||
*/
|
||||
selectedSections: _propTypes.default.oneOfType([_propTypes.default.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), _propTypes.default.number]),
|
||||
/**
|
||||
* Disable specific date.
|
||||
*
|
||||
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
||||
*
|
||||
* @param {PickerValidDate} day The date to test.
|
||||
* @returns {boolean} If `true` the date will be disabled.
|
||||
*/
|
||||
shouldDisableDate: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific month.
|
||||
* @param {PickerValidDate} month The month to test.
|
||||
* @returns {boolean} If `true`, the month will be disabled.
|
||||
*/
|
||||
shouldDisableMonth: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific year.
|
||||
* @param {PickerValidDate} year The year to test.
|
||||
* @returns {boolean} If `true`, the year will be disabled.
|
||||
*/
|
||||
shouldDisableYear: _propTypes.default.func,
|
||||
/**
|
||||
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
||||
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
||||
*
|
||||
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
||||
*
|
||||
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
||||
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
||||
*
|
||||
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
||||
* This mean that when using `shouldRespectLeadingZeros={false}`, if you retrieve the value directly from the input (not listening to `onChange`) and your format contains tokens without leading zeros, the value will not be parsed by your library.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
shouldRespectLeadingZeros: _propTypes.default.bool,
|
||||
/**
|
||||
* The size of the component.
|
||||
* @default 'medium'
|
||||
*/
|
||||
size: _propTypes.default.oneOf(['medium', 'small']),
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: _propTypes.default.object,
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots: _propTypes.default.object,
|
||||
style: _propTypes.default.object,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
||||
/**
|
||||
* Choose which timezone to use for the value.
|
||||
* Example: "default", "system", "UTC", "America/New_York".
|
||||
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
||||
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
||||
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
||||
*/
|
||||
timezone: _propTypes.default.string,
|
||||
/**
|
||||
* The ref object used to imperatively interact with the field.
|
||||
*/
|
||||
unstableFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
||||
/**
|
||||
* The selected value.
|
||||
* Used when the component is controlled.
|
||||
*/
|
||||
value: _propTypes.default.object,
|
||||
/**
|
||||
* The variant to use.
|
||||
* @default 'outlined'
|
||||
*/
|
||||
variant: _propTypes.default.oneOf(['filled', 'outlined', 'standard'])
|
||||
} : void 0;
|
||||
22
node_modules/@mui/x-date-pickers/DateField/DateField.types.d.ts
generated
vendored
Normal file
22
node_modules/@mui/x-date-pickers/DateField/DateField.types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { MakeOptional } from '@mui/x-internals/types';
|
||||
import { DateValidationError, BuiltInFieldTextFieldProps } from "../models/index.js";
|
||||
import { UseFieldInternalProps } from "../internals/hooks/useField/index.js";
|
||||
import { ExportedValidateDateProps } from "../validation/validateDate.js";
|
||||
import { PickerValue } from "../internals/models/index.js";
|
||||
import { ExportedPickerFieldUIProps, PickerFieldUISlotProps, PickerFieldUISlots } from "../internals/components/PickerFieldUI.js";
|
||||
export interface UseDateFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateValidationError>, 'format'>, ExportedValidateDateProps, ExportedPickerFieldUIProps {}
|
||||
export type DateFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseDateFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseDateFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: DateFieldSlots;
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: DateFieldSlotProps;
|
||||
};
|
||||
export type DateFieldOwnerState<TEnableAccessibleFieldDOMStructure extends boolean> = DateFieldProps<TEnableAccessibleFieldDOMStructure>;
|
||||
export interface DateFieldSlots extends PickerFieldUISlots {}
|
||||
export interface DateFieldSlotProps extends PickerFieldUISlotProps {}
|
||||
5
node_modules/@mui/x-date-pickers/DateField/DateField.types.js
generated
vendored
Normal file
5
node_modules/@mui/x-date-pickers/DateField/DateField.types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
3
node_modules/@mui/x-date-pickers/DateField/index.d.ts
generated
vendored
Normal file
3
node_modules/@mui/x-date-pickers/DateField/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export { DateField } from "./DateField.js";
|
||||
export { useDateField as unstable_useDateField } from "./useDateField.js";
|
||||
export type { UseDateFieldProps, DateFieldProps } from "./DateField.types.js";
|
||||
19
node_modules/@mui/x-date-pickers/DateField/index.js
generated
vendored
Normal file
19
node_modules/@mui/x-date-pickers/DateField/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "DateField", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _DateField.DateField;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "unstable_useDateField", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _useDateField.useDateField;
|
||||
}
|
||||
});
|
||||
var _DateField = require("./DateField");
|
||||
var _useDateField = require("./useDateField");
|
||||
2
node_modules/@mui/x-date-pickers/DateField/useDateField.d.ts
generated
vendored
Normal file
2
node_modules/@mui/x-date-pickers/DateField/useDateField.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { UseDateFieldProps } from "./DateField.types.js";
|
||||
export declare const useDateField: <TEnableAccessibleFieldDOMStructure extends boolean, TProps extends UseDateFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TProps) => import("../internals/index.js").UseFieldReturnValue<TEnableAccessibleFieldDOMStructure, TProps>;
|
||||
17
node_modules/@mui/x-date-pickers/DateField/useDateField.js
generated
vendored
Normal file
17
node_modules/@mui/x-date-pickers/DateField/useDateField.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDateField = void 0;
|
||||
var _useField = require("../internals/hooks/useField");
|
||||
var _managers = require("../managers");
|
||||
const useDateField = props => {
|
||||
const manager = (0, _managers.useDateManager)(props);
|
||||
return (0, _useField.useField)({
|
||||
manager,
|
||||
props
|
||||
});
|
||||
};
|
||||
exports.useDateField = useDateField;
|
||||
17
node_modules/@mui/x-date-pickers/DatePicker/DatePicker.d.ts
generated
vendored
Normal file
17
node_modules/@mui/x-date-pickers/DatePicker/DatePicker.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import * as React from 'react';
|
||||
import { DatePickerProps } from "./DatePicker.types.js";
|
||||
type DatePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DatePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
||||
propTypes?: any;
|
||||
};
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
||||
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DatePicker API](https://mui.com/x/api/date-pickers/date-picker/)
|
||||
*/
|
||||
declare const DatePicker: DatePickerComponent;
|
||||
export { DatePicker };
|
||||
375
node_modules/@mui/x-date-pickers/DatePicker/DatePicker.js
generated
vendored
Normal file
375
node_modules/@mui/x-date-pickers/DatePicker/DatePicker.js
generated
vendored
Normal file
|
|
@ -0,0 +1,375 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DatePicker = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
||||
var _DesktopDatePicker = require("../DesktopDatePicker");
|
||||
var _MobileDatePicker = require("../MobileDatePicker");
|
||||
var _utils = require("../internals/utils/utils");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["desktopModeMediaQuery"];
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
||||
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DatePicker API](https://mui.com/x/api/date-pickers/date-picker/)
|
||||
*/
|
||||
const DatePicker = exports.DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker(inProps, ref) {
|
||||
const props = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiDatePicker'
|
||||
});
|
||||
const {
|
||||
desktopModeMediaQuery = _utils.DEFAULT_DESKTOP_MODE_MEDIA_QUERY
|
||||
} = props,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
||||
|
||||
// defaults to `true` in environments where `window.matchMedia` would not be available (i.e. test/jsdom)
|
||||
const isDesktop = (0, _useMediaQuery.default)(desktopModeMediaQuery, {
|
||||
defaultMatches: true
|
||||
});
|
||||
if (isDesktop) {
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DesktopDatePicker.DesktopDatePicker, (0, _extends2.default)({
|
||||
ref: ref
|
||||
}, other));
|
||||
}
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MobileDatePicker.MobileDatePicker, (0, _extends2.default)({
|
||||
ref: ref
|
||||
}, other));
|
||||
});
|
||||
if (process.env.NODE_ENV !== "production") DatePicker.displayName = "DatePicker";
|
||||
process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
/**
|
||||
* If `true`, the main element is focused during the first mount.
|
||||
* This main element is:
|
||||
* - the element chosen by the visible view if any (i.e: the selected day on the `day` view).
|
||||
* - the `input` element if there is a field rendered.
|
||||
*/
|
||||
autoFocus: _propTypes.default.bool,
|
||||
className: _propTypes.default.string,
|
||||
/**
|
||||
* If `true`, the Picker will close after submitting the full date.
|
||||
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
||||
*/
|
||||
closeOnSelect: _propTypes.default.bool,
|
||||
/**
|
||||
* Formats the day of week displayed in the calendar header.
|
||||
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
||||
* @returns {string} The name to display.
|
||||
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
||||
*/
|
||||
dayOfWeekFormatter: _propTypes.default.func,
|
||||
/**
|
||||
* The default value.
|
||||
* Used when the component is not controlled.
|
||||
*/
|
||||
defaultValue: _propTypes.default.object,
|
||||
/**
|
||||
* CSS media query when `Mobile` mode will be changed to `Desktop`.
|
||||
* @default '@media (pointer: fine)'
|
||||
* @example '@media (min-width: 720px)' or theme.breakpoints.up("sm")
|
||||
*/
|
||||
desktopModeMediaQuery: _propTypes.default.string,
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* When disabled, the value cannot be changed and no interaction is possible.
|
||||
* @default false
|
||||
*/
|
||||
disabled: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values after the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disableFuture: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, today's date is rendering without highlighting with circle.
|
||||
* @default false
|
||||
*/
|
||||
disableHighlightToday: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
||||
* @deprecated Use the [field component](https://mui.com/x/react-date-pickers/fields/) instead.
|
||||
* @default false
|
||||
*/
|
||||
disableOpenPicker: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values before the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disablePast: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, the week number will be display in the calendar.
|
||||
*/
|
||||
displayWeekNumber: _propTypes.default.bool,
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
enableAccessibleFieldDOMStructure: _propTypes.default.any,
|
||||
/**
|
||||
* The day view will show as many weeks as needed after the end of the current month to match this value.
|
||||
* Put it to 6 to have a fixed number of weeks in Gregorian calendars
|
||||
*/
|
||||
fixedWeekNumber: _propTypes.default.number,
|
||||
/**
|
||||
* Format of the date when rendered in the input(s).
|
||||
* Defaults to localized format based on the used `views`.
|
||||
*/
|
||||
format: _propTypes.default.string,
|
||||
/**
|
||||
* Density of the format when rendered in the input.
|
||||
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
||||
* @default "dense"
|
||||
*/
|
||||
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
||||
/**
|
||||
* Pass a ref to the `input` element.
|
||||
*/
|
||||
inputRef: _refType.default,
|
||||
/**
|
||||
* The label content.
|
||||
*/
|
||||
label: _propTypes.default.node,
|
||||
/**
|
||||
* If `true`, calls `renderLoading` instead of rendering the day calendar.
|
||||
* Can be used to preload information and show it in calendar.
|
||||
* @default false
|
||||
*/
|
||||
loading: _propTypes.default.bool,
|
||||
/**
|
||||
* Locale for components texts.
|
||||
* Allows overriding texts coming from `LocalizationProvider` and `theme`.
|
||||
*/
|
||||
localeText: _propTypes.default.object,
|
||||
/**
|
||||
* Maximal selectable date.
|
||||
* @default 2099-12-31
|
||||
*/
|
||||
maxDate: _propTypes.default.object,
|
||||
/**
|
||||
* Minimal selectable date.
|
||||
* @default 1900-01-01
|
||||
*/
|
||||
minDate: _propTypes.default.object,
|
||||
/**
|
||||
* Months rendered per row.
|
||||
* @default 3
|
||||
*/
|
||||
monthsPerRow: _propTypes.default.oneOf([3, 4]),
|
||||
/**
|
||||
* Name attribute used by the `input` element in the Field.
|
||||
*/
|
||||
name: _propTypes.default.string,
|
||||
/**
|
||||
* Callback fired when the value is accepted.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TValue} value The value that was just accepted.
|
||||
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
||||
*/
|
||||
onAccept: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the value changes.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TValue} value The new value.
|
||||
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
||||
*/
|
||||
onChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the popup requests to be closed.
|
||||
* Use in controlled mode (see `open`).
|
||||
*/
|
||||
onClose: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the error associated with the current value changes.
|
||||
* When a validation error is detected, the `error` parameter contains a non-null value.
|
||||
* This can be used to render an appropriate form error.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TError} error The reason why the current value is not valid.
|
||||
* @param {TValue} value The value associated with the error.
|
||||
*/
|
||||
onError: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on month change.
|
||||
* @param {PickerValidDate} month The new month.
|
||||
*/
|
||||
onMonthChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the popup requests to be opened.
|
||||
* Use in controlled mode (see `open`).
|
||||
*/
|
||||
onOpen: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the selected sections change.
|
||||
* @param {FieldSelectedSections} newValue The new selected sections.
|
||||
*/
|
||||
onSelectedSectionsChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on view change.
|
||||
* @template TView Type of the view. It will vary based on the Picker type and the `views` it uses.
|
||||
* @param {TView} view The new view.
|
||||
*/
|
||||
onViewChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on year change.
|
||||
* @param {PickerValidDate} year The new year.
|
||||
*/
|
||||
onYearChange: _propTypes.default.func,
|
||||
/**
|
||||
* Control the popup or dialog open state.
|
||||
* @default false
|
||||
*/
|
||||
open: _propTypes.default.bool,
|
||||
/**
|
||||
* The default visible view.
|
||||
* Used when the component view is not controlled.
|
||||
* Must be a valid option from `views` list.
|
||||
*/
|
||||
openTo: _propTypes.default.oneOf(['day', 'month', 'year']),
|
||||
/**
|
||||
* Force rendering in particular orientation.
|
||||
*/
|
||||
orientation: _propTypes.default.oneOf(['landscape', 'portrait']),
|
||||
/**
|
||||
* If `true`, the component is read-only.
|
||||
* When read-only, the value cannot be changed but the user can interact with the interface.
|
||||
* @default false
|
||||
*/
|
||||
readOnly: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable heavy animations.
|
||||
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
||||
*/
|
||||
reduceAnimations: _propTypes.default.bool,
|
||||
/**
|
||||
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
||||
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
||||
*/
|
||||
referenceDate: _propTypes.default.object,
|
||||
/**
|
||||
* Component displaying when passed `loading` true.
|
||||
* @returns {React.ReactNode} The node to render when loading.
|
||||
* @default () => <span>...</span>
|
||||
*/
|
||||
renderLoading: _propTypes.default.func,
|
||||
/**
|
||||
* The currently selected sections.
|
||||
* This prop accepts four formats:
|
||||
* 1. If a number is provided, the section at this index will be selected.
|
||||
* 2. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
|
||||
* 3. If `"all"` is provided, all the sections will be selected.
|
||||
* 4. If `null` is provided, no section will be selected.
|
||||
* If not provided, the selected sections will be handled internally.
|
||||
*/
|
||||
selectedSections: _propTypes.default.oneOfType([_propTypes.default.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), _propTypes.default.number]),
|
||||
/**
|
||||
* Disable specific date.
|
||||
*
|
||||
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
||||
*
|
||||
* @param {PickerValidDate} day The date to test.
|
||||
* @returns {boolean} If `true` the date will be disabled.
|
||||
*/
|
||||
shouldDisableDate: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific month.
|
||||
* @param {PickerValidDate} month The month to test.
|
||||
* @returns {boolean} If `true`, the month will be disabled.
|
||||
*/
|
||||
shouldDisableMonth: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific year.
|
||||
* @param {PickerValidDate} year The year to test.
|
||||
* @returns {boolean} If `true`, the year will be disabled.
|
||||
*/
|
||||
shouldDisableYear: _propTypes.default.func,
|
||||
/**
|
||||
* If `true`, days outside the current month are rendered:
|
||||
*
|
||||
* - if `fixedWeekNumber` is defined, renders days to have the weeks requested.
|
||||
*
|
||||
* - if `fixedWeekNumber` is not defined, renders day to fill the first and last week of the current month.
|
||||
*
|
||||
* - ignored if `calendars` equals more than `1` on range pickers.
|
||||
* @default false
|
||||
*/
|
||||
showDaysOutsideCurrentMonth: _propTypes.default.bool,
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: _propTypes.default.object,
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots: _propTypes.default.object,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
||||
/**
|
||||
* Choose which timezone to use for the value.
|
||||
* Example: "default", "system", "UTC", "America/New_York".
|
||||
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
||||
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
||||
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
||||
*/
|
||||
timezone: _propTypes.default.string,
|
||||
/**
|
||||
* The selected value.
|
||||
* Used when the component is controlled.
|
||||
*/
|
||||
value: _propTypes.default.object,
|
||||
/**
|
||||
* The visible view.
|
||||
* Used when the component view is controlled.
|
||||
* Must be a valid option from `views` list.
|
||||
*/
|
||||
view: _propTypes.default.oneOf(['day', 'month', 'year']),
|
||||
/**
|
||||
* Define custom view renderers for each section.
|
||||
* If `null`, the section will only have field editing.
|
||||
* If `undefined`, internally defined view will be used.
|
||||
*/
|
||||
viewRenderers: _propTypes.default.shape({
|
||||
day: _propTypes.default.func,
|
||||
month: _propTypes.default.func,
|
||||
year: _propTypes.default.func
|
||||
}),
|
||||
/**
|
||||
* Available views.
|
||||
*/
|
||||
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['day', 'month', 'year']).isRequired),
|
||||
/**
|
||||
* Years are displayed in ascending (chronological) order by default.
|
||||
* If `desc`, years are displayed in descending order.
|
||||
* @default 'asc'
|
||||
*/
|
||||
yearsOrder: _propTypes.default.oneOf(['asc', 'desc']),
|
||||
/**
|
||||
* Years rendered per row.
|
||||
* @default 4 on desktop, 3 on mobile
|
||||
*/
|
||||
yearsPerRow: _propTypes.default.oneOf([3, 4])
|
||||
} : void 0;
|
||||
38
node_modules/@mui/x-date-pickers/DatePicker/DatePicker.types.d.ts
generated
vendored
Normal file
38
node_modules/@mui/x-date-pickers/DatePicker/DatePicker.types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { DesktopDatePickerProps, DesktopDatePickerSlots, DesktopDatePickerSlotProps } from "../DesktopDatePicker/index.js";
|
||||
import { BaseSingleInputFieldProps } from "../internals/models/index.js";
|
||||
import { MobileDatePickerProps, MobileDatePickerSlots, MobileDatePickerSlotProps } from "../MobileDatePicker/index.js";
|
||||
import { ValidateDateProps } from "../validation/validateDate.js";
|
||||
export interface DatePickerSlots extends DesktopDatePickerSlots, MobileDatePickerSlots {}
|
||||
export interface DatePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopDatePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileDatePickerSlotProps<TEnableAccessibleFieldDOMStructure> {}
|
||||
export interface DatePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends DesktopDatePickerProps<TEnableAccessibleFieldDOMStructure>, MobileDatePickerProps<TEnableAccessibleFieldDOMStructure> {
|
||||
/**
|
||||
* CSS media query when `Mobile` mode will be changed to `Desktop`.
|
||||
* @default '@media (pointer: fine)'
|
||||
* @example '@media (min-width: 720px)' or theme.breakpoints.up("sm")
|
||||
*/
|
||||
desktopModeMediaQuery?: string;
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: DatePickerSlots;
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: DatePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
||||
/**
|
||||
* Years rendered per row.
|
||||
* @default 4 on desktop, 3 on mobile
|
||||
*/
|
||||
yearsPerRow?: 3 | 4;
|
||||
/**
|
||||
* If `true`, the Picker will close after submitting the full date.
|
||||
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
||||
*/
|
||||
closeOnSelect?: boolean;
|
||||
}
|
||||
/**
|
||||
* Props the field can receive when used inside a Date Picker (<DatePicker />, <DesktopDatePicker /> or <MobileDatePicker /> component).
|
||||
*/
|
||||
export type DatePickerFieldProps = ValidateDateProps & BaseSingleInputFieldProps;
|
||||
5
node_modules/@mui/x-date-pickers/DatePicker/DatePicker.types.js
generated
vendored
Normal file
5
node_modules/@mui/x-date-pickers/DatePicker/DatePicker.types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
25
node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar.d.ts
generated
vendored
Normal file
25
node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import * as React from 'react';
|
||||
import { BaseToolbarProps, ExportedBaseToolbarProps } from "../internals/models/props/toolbar.js";
|
||||
import { DatePickerToolbarClasses } from "./datePickerToolbarClasses.js";
|
||||
export interface DatePickerToolbarProps extends BaseToolbarProps, ExportedDatePickerToolbarProps {}
|
||||
export interface ExportedDatePickerToolbarProps extends ExportedBaseToolbarProps {
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: Partial<DatePickerToolbarClasses>;
|
||||
}
|
||||
type DatePickerToolbarComponent = ((props: DatePickerToolbarProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
||||
propTypes?: any;
|
||||
};
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
||||
* - [Custom components](https://mui.com/x/react-date-pickers/custom-components/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DatePickerToolbar API](https://mui.com/x/api/date-pickers/date-picker-toolbar/)
|
||||
*/
|
||||
export declare const DatePickerToolbar: DatePickerToolbarComponent;
|
||||
export {};
|
||||
134
node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar.js
generated
vendored
Normal file
134
node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar.js
generated
vendored
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DatePickerToolbar = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
||||
var _PickersToolbar = require("../internals/components/PickersToolbar");
|
||||
var _hooks = require("../hooks");
|
||||
var _datePickerToolbarClasses = require("./datePickerToolbarClasses");
|
||||
var _dateUtils = require("../internals/utils/date-utils");
|
||||
var _useToolbarOwnerState = require("../internals/hooks/useToolbarOwnerState");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["toolbarFormat", "toolbarPlaceholder", "className", "classes"];
|
||||
const useUtilityClasses = classes => {
|
||||
const slots = {
|
||||
root: ['root'],
|
||||
title: ['title']
|
||||
};
|
||||
return (0, _composeClasses.default)(slots, _datePickerToolbarClasses.getDatePickerToolbarUtilityClass, classes);
|
||||
};
|
||||
const DatePickerToolbarRoot = (0, _styles.styled)(_PickersToolbar.PickersToolbar, {
|
||||
name: 'MuiDatePickerToolbar',
|
||||
slot: 'Root'
|
||||
})({});
|
||||
const DatePickerToolbarTitle = (0, _styles.styled)(_Typography.default, {
|
||||
name: 'MuiDatePickerToolbar',
|
||||
slot: 'Title'
|
||||
})({
|
||||
variants: [{
|
||||
props: {
|
||||
pickerOrientation: 'landscape'
|
||||
},
|
||||
style: {
|
||||
margin: 'auto 16px auto auto'
|
||||
}
|
||||
}]
|
||||
});
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
||||
* - [Custom components](https://mui.com/x/react-date-pickers/custom-components/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DatePickerToolbar API](https://mui.com/x/api/date-pickers/date-picker-toolbar/)
|
||||
*/
|
||||
const DatePickerToolbar = exports.DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePickerToolbar(inProps, ref) {
|
||||
const props = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiDatePickerToolbar'
|
||||
});
|
||||
const {
|
||||
toolbarFormat,
|
||||
toolbarPlaceholder = '––',
|
||||
className,
|
||||
classes: classesProp
|
||||
} = props,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
||||
const adapter = (0, _hooks.usePickerAdapter)();
|
||||
const {
|
||||
value,
|
||||
views,
|
||||
orientation
|
||||
} = (0, _hooks.usePickerContext)();
|
||||
const translations = (0, _hooks.usePickerTranslations)();
|
||||
const ownerState = (0, _useToolbarOwnerState.useToolbarOwnerState)();
|
||||
const classes = useUtilityClasses(classesProp);
|
||||
const dateText = React.useMemo(() => {
|
||||
if (!adapter.isValid(value)) {
|
||||
return toolbarPlaceholder;
|
||||
}
|
||||
const formatFromViews = (0, _dateUtils.resolveDateFormat)(adapter, {
|
||||
format: toolbarFormat,
|
||||
views
|
||||
}, true);
|
||||
return adapter.formatByString(value, formatFromViews);
|
||||
}, [value, toolbarFormat, toolbarPlaceholder, adapter, views]);
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DatePickerToolbarRoot, (0, _extends2.default)({
|
||||
ref: ref,
|
||||
toolbarTitle: translations.datePickerToolbarTitle,
|
||||
className: (0, _clsx.default)(classes.root, className)
|
||||
}, other, {
|
||||
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DatePickerToolbarTitle, {
|
||||
variant: "h4",
|
||||
align: orientation === 'landscape' ? 'left' : 'center',
|
||||
ownerState: ownerState,
|
||||
className: classes.title,
|
||||
children: dateText
|
||||
})
|
||||
}));
|
||||
});
|
||||
if (process.env.NODE_ENV !== "production") DatePickerToolbar.displayName = "DatePickerToolbar";
|
||||
process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: _propTypes.default.object,
|
||||
className: _propTypes.default.string,
|
||||
/**
|
||||
* If `true`, show the toolbar even in desktop mode.
|
||||
* @default `true` for Desktop, `false` for Mobile.
|
||||
*/
|
||||
hidden: _propTypes.default.bool,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
||||
titleId: _propTypes.default.string,
|
||||
/**
|
||||
* Toolbar date format.
|
||||
*/
|
||||
toolbarFormat: _propTypes.default.string,
|
||||
/**
|
||||
* Toolbar value placeholder—it is displayed when the value is empty.
|
||||
* @default "––"
|
||||
*/
|
||||
toolbarPlaceholder: _propTypes.default.node
|
||||
} : void 0;
|
||||
9
node_modules/@mui/x-date-pickers/DatePicker/datePickerToolbarClasses.d.ts
generated
vendored
Normal file
9
node_modules/@mui/x-date-pickers/DatePicker/datePickerToolbarClasses.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export interface DatePickerToolbarClasses {
|
||||
/** Styles applied to the root element. */
|
||||
root: string;
|
||||
/** Styles applied to the title element. */
|
||||
title: string;
|
||||
}
|
||||
export type DatePickerToolbarClassKey = keyof DatePickerToolbarClasses;
|
||||
export declare function getDatePickerToolbarUtilityClass(slot: string): string;
|
||||
export declare const datePickerToolbarClasses: DatePickerToolbarClasses;
|
||||
14
node_modules/@mui/x-date-pickers/DatePicker/datePickerToolbarClasses.js
generated
vendored
Normal file
14
node_modules/@mui/x-date-pickers/DatePicker/datePickerToolbarClasses.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.datePickerToolbarClasses = void 0;
|
||||
exports.getDatePickerToolbarUtilityClass = getDatePickerToolbarUtilityClass;
|
||||
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
||||
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
||||
function getDatePickerToolbarUtilityClass(slot) {
|
||||
return (0, _generateUtilityClass.default)('MuiDatePickerToolbar', slot);
|
||||
}
|
||||
const datePickerToolbarClasses = exports.datePickerToolbarClasses = (0, _generateUtilityClasses.default)('MuiDatePickerToolbar', ['root', 'title']);
|
||||
6
node_modules/@mui/x-date-pickers/DatePicker/index.d.ts
generated
vendored
Normal file
6
node_modules/@mui/x-date-pickers/DatePicker/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export { DatePicker } from "./DatePicker.js";
|
||||
export type { DatePickerProps, DatePickerSlots, DatePickerSlotProps, DatePickerFieldProps } from "./DatePicker.types.js";
|
||||
export { DatePickerToolbar } from "./DatePickerToolbar.js";
|
||||
export type { DatePickerToolbarProps } from "./DatePickerToolbar.js";
|
||||
export { datePickerToolbarClasses } from "./datePickerToolbarClasses.js";
|
||||
export type { DatePickerToolbarClassKey, DatePickerToolbarClasses } from "./datePickerToolbarClasses.js";
|
||||
26
node_modules/@mui/x-date-pickers/DatePicker/index.js
generated
vendored
Normal file
26
node_modules/@mui/x-date-pickers/DatePicker/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "DatePicker", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _DatePicker.DatePicker;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "DatePickerToolbar", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _DatePickerToolbar.DatePickerToolbar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "datePickerToolbarClasses", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _datePickerToolbarClasses.datePickerToolbarClasses;
|
||||
}
|
||||
});
|
||||
var _DatePicker = require("./DatePicker");
|
||||
var _DatePickerToolbar = require("./DatePickerToolbar");
|
||||
var _datePickerToolbarClasses = require("./datePickerToolbarClasses");
|
||||
43
node_modules/@mui/x-date-pickers/DatePicker/shared.d.ts
generated
vendored
Normal file
43
node_modules/@mui/x-date-pickers/DatePicker/shared.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import * as React from 'react';
|
||||
import { DefaultizedProps } from '@mui/x-internals/types';
|
||||
import { DateCalendarSlots, DateCalendarSlotProps, ExportedDateCalendarProps } from "../DateCalendar/DateCalendar.types.js";
|
||||
import { DateValidationError, DateView } from "../models/index.js";
|
||||
import { BasePickerInputProps } from "../internals/models/props/basePickerProps.js";
|
||||
import { LocalizedComponent } from "../locales/utils/pickersLocaleTextApi.js";
|
||||
import { DatePickerToolbarProps, ExportedDatePickerToolbarProps } from "./DatePickerToolbar.js";
|
||||
import { PickerViewRendererLookup } from "../internals/hooks/usePicker/index.js";
|
||||
import { DateViewRendererProps } from "../dateViewRenderers/index.js";
|
||||
import { PickerValue } from "../internals/models/index.js";
|
||||
import { ValidateDatePropsToDefault } from "../validation/validateDate.js";
|
||||
export interface BaseDatePickerSlots extends DateCalendarSlots {
|
||||
/**
|
||||
* Custom component for the toolbar rendered above the views.
|
||||
* @default DatePickerToolbar
|
||||
*/
|
||||
toolbar?: React.JSXElementConstructor<DatePickerToolbarProps>;
|
||||
}
|
||||
export interface BaseDatePickerSlotProps extends DateCalendarSlotProps {
|
||||
toolbar?: ExportedDatePickerToolbarProps;
|
||||
}
|
||||
export type DatePickerViewRenderers<TView extends DateView> = PickerViewRendererLookup<PickerValue, TView, DateViewRendererProps<TView>>;
|
||||
export interface BaseDatePickerProps extends BasePickerInputProps<PickerValue, DateView, DateValidationError>, ExportedDateCalendarProps {
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: BaseDatePickerSlots;
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: BaseDatePickerSlotProps;
|
||||
/**
|
||||
* Define custom view renderers for each section.
|
||||
* If `null`, the section will only have field editing.
|
||||
* If `undefined`, internally defined view will be used.
|
||||
*/
|
||||
viewRenderers?: Partial<DatePickerViewRenderers<DateView>>;
|
||||
}
|
||||
type UseDatePickerDefaultizedProps<Props extends BaseDatePickerProps> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | ValidateDatePropsToDefault>>;
|
||||
export declare function useDatePickerDefaultizedProps<Props extends BaseDatePickerProps>(props: Props, name: string): UseDatePickerDefaultizedProps<Props>;
|
||||
export {};
|
||||
41
node_modules/@mui/x-date-pickers/DatePicker/shared.js
generated
vendored
Normal file
41
node_modules/@mui/x-date-pickers/DatePicker/shared.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDatePickerDefaultizedProps = useDatePickerDefaultizedProps;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _views = require("../internals/utils/views");
|
||||
var _DatePickerToolbar = require("./DatePickerToolbar");
|
||||
var _useDateManager = require("../managers/useDateManager");
|
||||
function useDatePickerDefaultizedProps(props, name) {
|
||||
const themeProps = (0, _styles.useThemeProps)({
|
||||
props,
|
||||
name
|
||||
});
|
||||
const validationProps = (0, _useDateManager.useApplyDefaultValuesToDateValidationProps)(themeProps);
|
||||
const localeText = React.useMemo(() => {
|
||||
if (themeProps.localeText?.toolbarTitle == null) {
|
||||
return themeProps.localeText;
|
||||
}
|
||||
return (0, _extends2.default)({}, themeProps.localeText, {
|
||||
datePickerToolbarTitle: themeProps.localeText.toolbarTitle
|
||||
});
|
||||
}, [themeProps.localeText]);
|
||||
return (0, _extends2.default)({}, themeProps, validationProps, {
|
||||
localeText
|
||||
}, (0, _views.applyDefaultViewProps)({
|
||||
views: themeProps.views,
|
||||
openTo: themeProps.openTo,
|
||||
defaultViews: ['year', 'day'],
|
||||
defaultOpenTo: 'day'
|
||||
}), {
|
||||
slots: (0, _extends2.default)({
|
||||
toolbar: _DatePickerToolbar.DatePickerToolbar
|
||||
}, themeProps.slots)
|
||||
});
|
||||
}
|
||||
17
node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField.d.ts
generated
vendored
Normal file
17
node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import * as React from 'react';
|
||||
import { DateTimeFieldProps } from "./DateTimeField.types.js";
|
||||
type DateTimeFieldComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DateTimeFieldProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
||||
propTypes?: any;
|
||||
};
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DateTimeField](http://mui.com/x/react-date-pickers/date-time-field/)
|
||||
* - [Fields](https://mui.com/x/react-date-pickers/fields/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateTimeField API](https://mui.com/x/api/date-pickers/date-time-field/)
|
||||
*/
|
||||
declare const DateTimeField: DateTimeFieldComponent;
|
||||
export { DateTimeField };
|
||||
374
node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField.js
generated
vendored
Normal file
374
node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField.js
generated
vendored
Normal file
|
|
@ -0,0 +1,374 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DateTimeField = void 0;
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
||||
var _useDateTimeField = require("./useDateTimeField");
|
||||
var _PickerFieldUI = require("../internals/components/PickerFieldUI");
|
||||
var _icons = require("../icons");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["slots", "slotProps"];
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DateTimeField](http://mui.com/x/react-date-pickers/date-time-field/)
|
||||
* - [Fields](https://mui.com/x/react-date-pickers/fields/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateTimeField API](https://mui.com/x/api/date-pickers/date-time-field/)
|
||||
*/
|
||||
const DateTimeField = exports.DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inProps, inRef) {
|
||||
const themeProps = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiDateTimeField'
|
||||
});
|
||||
const {
|
||||
slots,
|
||||
slotProps
|
||||
} = themeProps,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
|
||||
const textFieldProps = (0, _PickerFieldUI.useFieldTextFieldProps)({
|
||||
slotProps,
|
||||
ref: inRef,
|
||||
externalForwardedProps: other
|
||||
});
|
||||
const fieldResponse = (0, _useDateTimeField.useDateTimeField)(textFieldProps);
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
|
||||
slots: slots,
|
||||
slotProps: slotProps,
|
||||
fieldResponse: fieldResponse,
|
||||
defaultOpenPickerIcon: _icons.CalendarIcon
|
||||
});
|
||||
});
|
||||
if (process.env.NODE_ENV !== "production") DateTimeField.displayName = "DateTimeField";
|
||||
process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
/**
|
||||
* 12h/24h view for hour selection clock.
|
||||
* @default adapter.is12HourCycleInCurrentLocale()
|
||||
*/
|
||||
ampm: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, the `input` element is focused during the first mount.
|
||||
* @default false
|
||||
*/
|
||||
autoFocus: _propTypes.default.bool,
|
||||
className: _propTypes.default.string,
|
||||
/**
|
||||
* If `true`, a clear button will be shown in the field allowing value clearing.
|
||||
* @default false
|
||||
*/
|
||||
clearable: _propTypes.default.bool,
|
||||
/**
|
||||
* The position at which the clear button is placed.
|
||||
* If the field is not clearable, the button is not rendered.
|
||||
* @default 'end'
|
||||
*/
|
||||
clearButtonPosition: _propTypes.default.oneOf(['end', 'start']),
|
||||
/**
|
||||
* The color of the component.
|
||||
* It supports both default and custom theme colors, which can be added as shown in the
|
||||
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
||||
* @default 'primary'
|
||||
*/
|
||||
color: _propTypes.default.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
||||
component: _propTypes.default.elementType,
|
||||
/**
|
||||
* The default value. Use when the component is not controlled.
|
||||
*/
|
||||
defaultValue: _propTypes.default.object,
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* When disabled, the value cannot be changed and no interaction is possible.
|
||||
* @default false
|
||||
*/
|
||||
disabled: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values after the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disableFuture: _propTypes.default.bool,
|
||||
/**
|
||||
* Do not ignore date part when validating min/max time.
|
||||
* @default false
|
||||
*/
|
||||
disableIgnoringDatePartForTimeValidation: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values before the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disablePast: _propTypes.default.bool,
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
enableAccessibleFieldDOMStructure: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, the component is displayed in focused state.
|
||||
*/
|
||||
focused: _propTypes.default.bool,
|
||||
/**
|
||||
* Format of the date when rendered in the input(s).
|
||||
*/
|
||||
format: _propTypes.default.string,
|
||||
/**
|
||||
* Density of the format when rendered in the input.
|
||||
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
||||
* @default "dense"
|
||||
*/
|
||||
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
||||
/**
|
||||
* Props applied to the [`FormHelperText`](https://mui.com/material-ui/api/form-helper-text/) element.
|
||||
* @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
FormHelperTextProps: _propTypes.default.object,
|
||||
/**
|
||||
* If `true`, the input will take up the full width of its container.
|
||||
* @default false
|
||||
*/
|
||||
fullWidth: _propTypes.default.bool,
|
||||
/**
|
||||
* The helper text content.
|
||||
*/
|
||||
helperText: _propTypes.default.node,
|
||||
/**
|
||||
* If `true`, the label is hidden.
|
||||
* This is used to increase density for a `FilledInput`.
|
||||
* Be sure to add `aria-label` to the `input` element.
|
||||
* @default false
|
||||
*/
|
||||
hiddenLabel: _propTypes.default.bool,
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
* Use this prop to make `label` and `helperText` accessible for screen readers.
|
||||
*/
|
||||
id: _propTypes.default.string,
|
||||
/**
|
||||
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
|
||||
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
|
||||
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
InputLabelProps: _propTypes.default.object,
|
||||
/**
|
||||
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
||||
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
inputProps: _propTypes.default.object,
|
||||
/**
|
||||
* Props applied to the Input element.
|
||||
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
|
||||
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
|
||||
* component depending on the `variant` prop value.
|
||||
* @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
||||
*/
|
||||
InputProps: _propTypes.default.object,
|
||||
/**
|
||||
* Pass a ref to the `input` element.
|
||||
*/
|
||||
inputRef: _refType.default,
|
||||
/**
|
||||
* The label content.
|
||||
*/
|
||||
label: _propTypes.default.node,
|
||||
/**
|
||||
* If `dense` or `normal`, will adjust vertical spacing of this and contained components.
|
||||
* @default 'none'
|
||||
*/
|
||||
margin: _propTypes.default.oneOf(['dense', 'none', 'normal']),
|
||||
/**
|
||||
* Maximal selectable date.
|
||||
* @default 2099-12-31
|
||||
*/
|
||||
maxDate: _propTypes.default.object,
|
||||
/**
|
||||
* Maximal selectable moment of time with binding to date, to set max time in each day use `maxTime`.
|
||||
*/
|
||||
maxDateTime: _propTypes.default.object,
|
||||
/**
|
||||
* Maximal selectable time.
|
||||
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
||||
*/
|
||||
maxTime: _propTypes.default.object,
|
||||
/**
|
||||
* Minimal selectable date.
|
||||
* @default 1900-01-01
|
||||
*/
|
||||
minDate: _propTypes.default.object,
|
||||
/**
|
||||
* Minimal selectable moment of time with binding to date, to set min time in each day use `minTime`.
|
||||
*/
|
||||
minDateTime: _propTypes.default.object,
|
||||
/**
|
||||
* Minimal selectable time.
|
||||
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
||||
*/
|
||||
minTime: _propTypes.default.object,
|
||||
/**
|
||||
* Step over minutes.
|
||||
* @default 1
|
||||
*/
|
||||
minutesStep: _propTypes.default.number,
|
||||
/**
|
||||
* Name attribute of the `input` element.
|
||||
*/
|
||||
name: _propTypes.default.string,
|
||||
onBlur: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the value changes.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TValue} value The new value.
|
||||
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
||||
*/
|
||||
onChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the clear button is clicked.
|
||||
*/
|
||||
onClear: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the error associated with the current value changes.
|
||||
* When a validation error is detected, the `error` parameter contains a non-null value.
|
||||
* This can be used to render an appropriate form error.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TError} error The reason why the current value is not valid.
|
||||
* @param {TValue} value The value associated with the error.
|
||||
*/
|
||||
onError: _propTypes.default.func,
|
||||
onFocus: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the selected sections change.
|
||||
* @param {FieldSelectedSections} newValue The new selected sections.
|
||||
*/
|
||||
onSelectedSectionsChange: _propTypes.default.func,
|
||||
/**
|
||||
* The position at which the opening button is placed.
|
||||
* If there is no Picker to open, the button is not rendered
|
||||
* @default 'end'
|
||||
*/
|
||||
openPickerButtonPosition: _propTypes.default.oneOf(['end', 'start']),
|
||||
/**
|
||||
* If `true`, the component is read-only.
|
||||
* When read-only, the value cannot be changed but the user can interact with the interface.
|
||||
* @default false
|
||||
*/
|
||||
readOnly: _propTypes.default.bool,
|
||||
/**
|
||||
* The date used to generate a part of the new value that is not present in the format when both `value` and `defaultValue` are empty.
|
||||
* For example, on time fields it will be used to determine the date to set.
|
||||
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
||||
*/
|
||||
referenceDate: _propTypes.default.object,
|
||||
/**
|
||||
* If `true`, the label is displayed as required and the `input` element is required.
|
||||
* @default false
|
||||
*/
|
||||
required: _propTypes.default.bool,
|
||||
/**
|
||||
* The currently selected sections.
|
||||
* This prop accepts four formats:
|
||||
* 1. If a number is provided, the section at this index will be selected.
|
||||
* 2. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
|
||||
* 3. If `"all"` is provided, all the sections will be selected.
|
||||
* 4. If `null` is provided, no section will be selected.
|
||||
* If not provided, the selected sections will be handled internally.
|
||||
*/
|
||||
selectedSections: _propTypes.default.oneOfType([_propTypes.default.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), _propTypes.default.number]),
|
||||
/**
|
||||
* Disable specific date.
|
||||
*
|
||||
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
||||
*
|
||||
* @param {PickerValidDate} day The date to test.
|
||||
* @returns {boolean} If `true` the date will be disabled.
|
||||
*/
|
||||
shouldDisableDate: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific month.
|
||||
* @param {PickerValidDate} month The month to test.
|
||||
* @returns {boolean} If `true`, the month will be disabled.
|
||||
*/
|
||||
shouldDisableMonth: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific time.
|
||||
* @param {PickerValidDate} value The value to check.
|
||||
* @param {TimeView} view The clock type of the timeValue.
|
||||
* @returns {boolean} If `true` the time will be disabled.
|
||||
*/
|
||||
shouldDisableTime: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific year.
|
||||
* @param {PickerValidDate} year The year to test.
|
||||
* @returns {boolean} If `true`, the year will be disabled.
|
||||
*/
|
||||
shouldDisableYear: _propTypes.default.func,
|
||||
/**
|
||||
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
||||
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
||||
*
|
||||
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
||||
*
|
||||
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
||||
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
||||
*
|
||||
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
||||
* This mean that when using `shouldRespectLeadingZeros={false}`, if you retrieve the value directly from the input (not listening to `onChange`) and your format contains tokens without leading zeros, the value will not be parsed by your library.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
shouldRespectLeadingZeros: _propTypes.default.bool,
|
||||
/**
|
||||
* The size of the component.
|
||||
* @default 'medium'
|
||||
*/
|
||||
size: _propTypes.default.oneOf(['medium', 'small']),
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: _propTypes.default.object,
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots: _propTypes.default.object,
|
||||
style: _propTypes.default.object,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
||||
/**
|
||||
* Choose which timezone to use for the value.
|
||||
* Example: "default", "system", "UTC", "America/New_York".
|
||||
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
||||
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
||||
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
||||
*/
|
||||
timezone: _propTypes.default.string,
|
||||
/**
|
||||
* The ref object used to imperatively interact with the field.
|
||||
*/
|
||||
unstableFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
||||
/**
|
||||
* The selected value.
|
||||
* Used when the component is controlled.
|
||||
*/
|
||||
value: _propTypes.default.object,
|
||||
/**
|
||||
* The variant to use.
|
||||
* @default 'outlined'
|
||||
*/
|
||||
variant: _propTypes.default.oneOf(['filled', 'outlined', 'standard'])
|
||||
} : void 0;
|
||||
22
node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField.types.d.ts
generated
vendored
Normal file
22
node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField.types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { MakeOptional } from '@mui/x-internals/types';
|
||||
import { DateTimeValidationError, BuiltInFieldTextFieldProps } from "../models/index.js";
|
||||
import { UseFieldInternalProps } from "../internals/hooks/useField/index.js";
|
||||
import { ExportedValidateDateTimeProps } from "../validation/validateDateTime.js";
|
||||
import { AmPmProps } from "../internals/models/props/time.js";
|
||||
import { PickerValue } from "../internals/models/index.js";
|
||||
import { ExportedPickerFieldUIProps, PickerFieldUISlotProps, PickerFieldUISlots } from "../internals/components/PickerFieldUI.js";
|
||||
export interface UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateTimeValidationError>, 'format'>, ExportedValidateDateTimeProps, ExportedPickerFieldUIProps, AmPmProps {}
|
||||
export type DateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: DateTimeFieldSlots;
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: DateTimeFieldSlotProps;
|
||||
};
|
||||
export interface DateTimeFieldSlots extends PickerFieldUISlots {}
|
||||
export interface DateTimeFieldSlotProps extends PickerFieldUISlotProps {}
|
||||
5
node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField.types.js
generated
vendored
Normal file
5
node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField.types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
3
node_modules/@mui/x-date-pickers/DateTimeField/index.d.ts
generated
vendored
Normal file
3
node_modules/@mui/x-date-pickers/DateTimeField/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export { DateTimeField } from "./DateTimeField.js";
|
||||
export { useDateTimeField as unstable_useDateTimeField } from "./useDateTimeField.js";
|
||||
export type { UseDateTimeFieldProps, DateTimeFieldProps } from "./DateTimeField.types.js";
|
||||
19
node_modules/@mui/x-date-pickers/DateTimeField/index.js
generated
vendored
Normal file
19
node_modules/@mui/x-date-pickers/DateTimeField/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "DateTimeField", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _DateTimeField.DateTimeField;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "unstable_useDateTimeField", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _useDateTimeField.useDateTimeField;
|
||||
}
|
||||
});
|
||||
var _DateTimeField = require("./DateTimeField");
|
||||
var _useDateTimeField = require("./useDateTimeField");
|
||||
2
node_modules/@mui/x-date-pickers/DateTimeField/useDateTimeField.d.ts
generated
vendored
Normal file
2
node_modules/@mui/x-date-pickers/DateTimeField/useDateTimeField.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { UseDateTimeFieldProps } from "./DateTimeField.types.js";
|
||||
export declare const useDateTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TProps extends UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TProps) => import("../internals/index.js").UseFieldReturnValue<TEnableAccessibleFieldDOMStructure, TProps>;
|
||||
17
node_modules/@mui/x-date-pickers/DateTimeField/useDateTimeField.js
generated
vendored
Normal file
17
node_modules/@mui/x-date-pickers/DateTimeField/useDateTimeField.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDateTimeField = void 0;
|
||||
var _useField = require("../internals/hooks/useField");
|
||||
var _managers = require("../managers");
|
||||
const useDateTimeField = props => {
|
||||
const manager = (0, _managers.useDateTimeManager)(props);
|
||||
return (0, _useField.useField)({
|
||||
manager,
|
||||
props
|
||||
});
|
||||
};
|
||||
exports.useDateTimeField = useDateTimeField;
|
||||
17
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker.d.ts
generated
vendored
Normal file
17
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import * as React from 'react';
|
||||
import { DateTimePickerProps } from "./DateTimePicker.types.js";
|
||||
type DateTimePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DateTimePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
||||
propTypes?: any;
|
||||
};
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DateTimePicker](https://mui.com/x/react-date-pickers/date-time-picker/)
|
||||
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateTimePicker API](https://mui.com/x/api/date-pickers/date-time-picker/)
|
||||
*/
|
||||
declare const DateTimePicker: DateTimePickerComponent;
|
||||
export { DateTimePicker };
|
||||
445
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker.js
generated
vendored
Normal file
445
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker.js
generated
vendored
Normal file
|
|
@ -0,0 +1,445 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DateTimePicker = void 0;
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
||||
var _DesktopDateTimePicker = require("../DesktopDateTimePicker");
|
||||
var _MobileDateTimePicker = require("../MobileDateTimePicker");
|
||||
var _utils = require("../internals/utils/utils");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["desktopModeMediaQuery"];
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DateTimePicker](https://mui.com/x/react-date-pickers/date-time-picker/)
|
||||
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateTimePicker API](https://mui.com/x/api/date-pickers/date-time-picker/)
|
||||
*/
|
||||
const DateTimePicker = exports.DateTimePicker = /*#__PURE__*/React.forwardRef(function DateTimePicker(inProps, ref) {
|
||||
const props = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiDateTimePicker'
|
||||
});
|
||||
const {
|
||||
desktopModeMediaQuery = _utils.DEFAULT_DESKTOP_MODE_MEDIA_QUERY
|
||||
} = props,
|
||||
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
||||
|
||||
// defaults to `true` in environments where `window.matchMedia` would not be available (i.e. test/jsdom)
|
||||
const isDesktop = (0, _useMediaQuery.default)(desktopModeMediaQuery, {
|
||||
defaultMatches: true
|
||||
});
|
||||
if (isDesktop) {
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DesktopDateTimePicker.DesktopDateTimePicker, (0, _extends2.default)({
|
||||
ref: ref
|
||||
}, other));
|
||||
}
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MobileDateTimePicker.MobileDateTimePicker, (0, _extends2.default)({
|
||||
ref: ref
|
||||
}, other));
|
||||
});
|
||||
if (process.env.NODE_ENV !== "production") DateTimePicker.displayName = "DateTimePicker";
|
||||
process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
/**
|
||||
* 12h/24h view for hour selection clock.
|
||||
* @default adapter.is12HourCycleInCurrentLocale()
|
||||
*/
|
||||
ampm: _propTypes.default.bool,
|
||||
/**
|
||||
* Display ampm controls under the clock (instead of in the toolbar).
|
||||
* @default true on desktop, false on mobile
|
||||
*/
|
||||
ampmInClock: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, the main element is focused during the first mount.
|
||||
* This main element is:
|
||||
* - the element chosen by the visible view if any (i.e: the selected day on the `day` view).
|
||||
* - the `input` element if there is a field rendered.
|
||||
*/
|
||||
autoFocus: _propTypes.default.bool,
|
||||
className: _propTypes.default.string,
|
||||
/**
|
||||
* If `true`, the Picker will close after submitting the full date.
|
||||
* @default false
|
||||
*/
|
||||
closeOnSelect: _propTypes.default.bool,
|
||||
/**
|
||||
* Formats the day of week displayed in the calendar header.
|
||||
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
||||
* @returns {string} The name to display.
|
||||
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
||||
*/
|
||||
dayOfWeekFormatter: _propTypes.default.func,
|
||||
/**
|
||||
* The default value.
|
||||
* Used when the component is not controlled.
|
||||
*/
|
||||
defaultValue: _propTypes.default.object,
|
||||
/**
|
||||
* CSS media query when `Mobile` mode will be changed to `Desktop`.
|
||||
* @default '@media (pointer: fine)'
|
||||
* @example '@media (min-width: 720px)' or theme.breakpoints.up("sm")
|
||||
*/
|
||||
desktopModeMediaQuery: _propTypes.default.string,
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* When disabled, the value cannot be changed and no interaction is possible.
|
||||
* @default false
|
||||
*/
|
||||
disabled: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values after the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disableFuture: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, today's date is rendering without highlighting with circle.
|
||||
* @default false
|
||||
*/
|
||||
disableHighlightToday: _propTypes.default.bool,
|
||||
/**
|
||||
* Do not ignore date part when validating min/max time.
|
||||
* @default false
|
||||
*/
|
||||
disableIgnoringDatePartForTimeValidation: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
||||
* @deprecated Use the [field component](https://mui.com/x/react-date-pickers/fields/) instead.
|
||||
* @default false
|
||||
*/
|
||||
disableOpenPicker: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable values before the current date for date components, time for time components and both for date time components.
|
||||
* @default false
|
||||
*/
|
||||
disablePast: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, the week number will be display in the calendar.
|
||||
*/
|
||||
displayWeekNumber: _propTypes.default.bool,
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
enableAccessibleFieldDOMStructure: _propTypes.default.any,
|
||||
/**
|
||||
* The day view will show as many weeks as needed after the end of the current month to match this value.
|
||||
* Put it to 6 to have a fixed number of weeks in Gregorian calendars
|
||||
*/
|
||||
fixedWeekNumber: _propTypes.default.number,
|
||||
/**
|
||||
* Format of the date when rendered in the input(s).
|
||||
* Defaults to localized format based on the used `views`.
|
||||
*/
|
||||
format: _propTypes.default.string,
|
||||
/**
|
||||
* Density of the format when rendered in the input.
|
||||
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
||||
* @default "dense"
|
||||
*/
|
||||
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
||||
/**
|
||||
* Pass a ref to the `input` element.
|
||||
*/
|
||||
inputRef: _refType.default,
|
||||
/**
|
||||
* The label content.
|
||||
*/
|
||||
label: _propTypes.default.node,
|
||||
/**
|
||||
* If `true`, calls `renderLoading` instead of rendering the day calendar.
|
||||
* Can be used to preload information and show it in calendar.
|
||||
* @default false
|
||||
*/
|
||||
loading: _propTypes.default.bool,
|
||||
/**
|
||||
* Locale for components texts.
|
||||
* Allows overriding texts coming from `LocalizationProvider` and `theme`.
|
||||
*/
|
||||
localeText: _propTypes.default.object,
|
||||
/**
|
||||
* Maximal selectable date.
|
||||
* @default 2099-12-31
|
||||
*/
|
||||
maxDate: _propTypes.default.object,
|
||||
/**
|
||||
* Maximal selectable moment of time with binding to date, to set max time in each day use `maxTime`.
|
||||
*/
|
||||
maxDateTime: _propTypes.default.object,
|
||||
/**
|
||||
* Maximal selectable time.
|
||||
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
||||
*/
|
||||
maxTime: _propTypes.default.object,
|
||||
/**
|
||||
* Minimal selectable date.
|
||||
* @default 1900-01-01
|
||||
*/
|
||||
minDate: _propTypes.default.object,
|
||||
/**
|
||||
* Minimal selectable moment of time with binding to date, to set min time in each day use `minTime`.
|
||||
*/
|
||||
minDateTime: _propTypes.default.object,
|
||||
/**
|
||||
* Minimal selectable time.
|
||||
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
||||
*/
|
||||
minTime: _propTypes.default.object,
|
||||
/**
|
||||
* Step over minutes.
|
||||
* @default 1
|
||||
*/
|
||||
minutesStep: _propTypes.default.number,
|
||||
/**
|
||||
* Months rendered per row.
|
||||
* @default 3
|
||||
*/
|
||||
monthsPerRow: _propTypes.default.oneOf([3, 4]),
|
||||
/**
|
||||
* Name attribute used by the `input` element in the Field.
|
||||
*/
|
||||
name: _propTypes.default.string,
|
||||
/**
|
||||
* Callback fired when the value is accepted.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TValue} value The value that was just accepted.
|
||||
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
||||
*/
|
||||
onAccept: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the value changes.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TValue} value The new value.
|
||||
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
||||
*/
|
||||
onChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the popup requests to be closed.
|
||||
* Use in controlled mode (see `open`).
|
||||
*/
|
||||
onClose: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the error associated with the current value changes.
|
||||
* When a validation error is detected, the `error` parameter contains a non-null value.
|
||||
* This can be used to render an appropriate form error.
|
||||
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
||||
* @param {TError} error The reason why the current value is not valid.
|
||||
* @param {TValue} value The value associated with the error.
|
||||
*/
|
||||
onError: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on month change.
|
||||
* @param {PickerValidDate} month The new month.
|
||||
*/
|
||||
onMonthChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the popup requests to be opened.
|
||||
* Use in controlled mode (see `open`).
|
||||
*/
|
||||
onOpen: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired when the selected sections change.
|
||||
* @param {FieldSelectedSections} newValue The new selected sections.
|
||||
*/
|
||||
onSelectedSectionsChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on view change.
|
||||
* @template TView Type of the view. It will vary based on the Picker type and the `views` it uses.
|
||||
* @param {TView} view The new view.
|
||||
*/
|
||||
onViewChange: _propTypes.default.func,
|
||||
/**
|
||||
* Callback fired on year change.
|
||||
* @param {PickerValidDate} year The new year.
|
||||
*/
|
||||
onYearChange: _propTypes.default.func,
|
||||
/**
|
||||
* Control the popup or dialog open state.
|
||||
* @default false
|
||||
*/
|
||||
open: _propTypes.default.bool,
|
||||
/**
|
||||
* The default visible view.
|
||||
* Used when the component view is not controlled.
|
||||
* Must be a valid option from `views` list.
|
||||
*/
|
||||
openTo: _propTypes.default.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
|
||||
/**
|
||||
* Force rendering in particular orientation.
|
||||
*/
|
||||
orientation: _propTypes.default.oneOf(['landscape', 'portrait']),
|
||||
/**
|
||||
* If `true`, the component is read-only.
|
||||
* When read-only, the value cannot be changed but the user can interact with the interface.
|
||||
* @default false
|
||||
*/
|
||||
readOnly: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disable heavy animations.
|
||||
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
||||
*/
|
||||
reduceAnimations: _propTypes.default.bool,
|
||||
/**
|
||||
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
||||
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
||||
*/
|
||||
referenceDate: _propTypes.default.object,
|
||||
/**
|
||||
* Component displaying when passed `loading` true.
|
||||
* @returns {React.ReactNode} The node to render when loading.
|
||||
* @default () => <span>...</span>
|
||||
*/
|
||||
renderLoading: _propTypes.default.func,
|
||||
/**
|
||||
* The currently selected sections.
|
||||
* This prop accepts four formats:
|
||||
* 1. If a number is provided, the section at this index will be selected.
|
||||
* 2. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
|
||||
* 3. If `"all"` is provided, all the sections will be selected.
|
||||
* 4. If `null` is provided, no section will be selected.
|
||||
* If not provided, the selected sections will be handled internally.
|
||||
*/
|
||||
selectedSections: _propTypes.default.oneOfType([_propTypes.default.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), _propTypes.default.number]),
|
||||
/**
|
||||
* Disable specific date.
|
||||
*
|
||||
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
||||
*
|
||||
* @param {PickerValidDate} day The date to test.
|
||||
* @returns {boolean} If `true` the date will be disabled.
|
||||
*/
|
||||
shouldDisableDate: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific month.
|
||||
* @param {PickerValidDate} month The month to test.
|
||||
* @returns {boolean} If `true`, the month will be disabled.
|
||||
*/
|
||||
shouldDisableMonth: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific time.
|
||||
* @param {PickerValidDate} value The value to check.
|
||||
* @param {TimeView} view The clock type of the timeValue.
|
||||
* @returns {boolean} If `true` the time will be disabled.
|
||||
*/
|
||||
shouldDisableTime: _propTypes.default.func,
|
||||
/**
|
||||
* Disable specific year.
|
||||
* @param {PickerValidDate} year The year to test.
|
||||
* @returns {boolean} If `true`, the year will be disabled.
|
||||
*/
|
||||
shouldDisableYear: _propTypes.default.func,
|
||||
/**
|
||||
* If `true`, days outside the current month are rendered:
|
||||
*
|
||||
* - if `fixedWeekNumber` is defined, renders days to have the weeks requested.
|
||||
*
|
||||
* - if `fixedWeekNumber` is not defined, renders day to fill the first and last week of the current month.
|
||||
*
|
||||
* - ignored if `calendars` equals more than `1` on range pickers.
|
||||
* @default false
|
||||
*/
|
||||
showDaysOutsideCurrentMonth: _propTypes.default.bool,
|
||||
/**
|
||||
* If `true`, disabled digital clock items will not be rendered.
|
||||
* @default false
|
||||
*/
|
||||
skipDisabled: _propTypes.default.bool,
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: _propTypes.default.object,
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots: _propTypes.default.object,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
||||
/**
|
||||
* Amount of time options below or at which the single column time renderer is used.
|
||||
* @default 24
|
||||
*/
|
||||
thresholdToRenderTimeInASingleColumn: _propTypes.default.number,
|
||||
/**
|
||||
* The time steps between two time unit options.
|
||||
* For example, if `timeSteps.minutes = 8`, then the available minute options will be `[0, 8, 16, 24, 32, 40, 48, 56]`.
|
||||
* When single column time renderer is used, only `timeSteps.minutes` will be used.
|
||||
* @default{ hours: 1, minutes: 5, seconds: 5 }
|
||||
*/
|
||||
timeSteps: _propTypes.default.shape({
|
||||
hours: _propTypes.default.number,
|
||||
minutes: _propTypes.default.number,
|
||||
seconds: _propTypes.default.number
|
||||
}),
|
||||
/**
|
||||
* Choose which timezone to use for the value.
|
||||
* Example: "default", "system", "UTC", "America/New_York".
|
||||
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
||||
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
||||
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
||||
*/
|
||||
timezone: _propTypes.default.string,
|
||||
/**
|
||||
* The selected value.
|
||||
* Used when the component is controlled.
|
||||
*/
|
||||
value: _propTypes.default.object,
|
||||
/**
|
||||
* The visible view.
|
||||
* Used when the component view is controlled.
|
||||
* Must be a valid option from `views` list.
|
||||
*/
|
||||
view: _propTypes.default.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
|
||||
/**
|
||||
* Define custom view renderers for each section.
|
||||
* If `null`, the section will only have field editing.
|
||||
* If `undefined`, internally defined view will be used.
|
||||
*/
|
||||
viewRenderers: _propTypes.default.shape({
|
||||
day: _propTypes.default.func,
|
||||
hours: _propTypes.default.func,
|
||||
meridiem: _propTypes.default.func,
|
||||
minutes: _propTypes.default.func,
|
||||
month: _propTypes.default.func,
|
||||
seconds: _propTypes.default.func,
|
||||
year: _propTypes.default.func
|
||||
}),
|
||||
/**
|
||||
* Available views.
|
||||
*/
|
||||
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']).isRequired),
|
||||
/**
|
||||
* Years are displayed in ascending (chronological) order by default.
|
||||
* If `desc`, years are displayed in descending order.
|
||||
* @default 'asc'
|
||||
*/
|
||||
yearsOrder: _propTypes.default.oneOf(['asc', 'desc']),
|
||||
/**
|
||||
* Years rendered per row.
|
||||
* @default 4 on desktop, 3 on mobile
|
||||
*/
|
||||
yearsPerRow: _propTypes.default.oneOf([3, 4])
|
||||
} : void 0;
|
||||
34
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker.types.d.ts
generated
vendored
Normal file
34
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker.types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { DesktopDateTimePickerProps, DesktopDateTimePickerSlots, DesktopDateTimePickerSlotProps } from "../DesktopDateTimePicker/index.js";
|
||||
import { BaseSingleInputFieldProps } from "../internals/models/index.js";
|
||||
import { MobileDateTimePickerProps, MobileDateTimePickerSlots, MobileDateTimePickerSlotProps } from "../MobileDateTimePicker/index.js";
|
||||
import { ValidateDateTimeProps } from "../validation/index.js";
|
||||
import { ExportedYearCalendarProps } from "../YearCalendar/YearCalendar.types.js";
|
||||
export interface DateTimePickerSlots extends DesktopDateTimePickerSlots, MobileDateTimePickerSlots {}
|
||||
export interface DateTimePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopDateTimePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileDateTimePickerSlotProps<TEnableAccessibleFieldDOMStructure> {}
|
||||
export interface DateTimePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends DesktopDateTimePickerProps<TEnableAccessibleFieldDOMStructure>, ExportedYearCalendarProps, Omit<MobileDateTimePickerProps<TEnableAccessibleFieldDOMStructure>, 'views'> {
|
||||
/**
|
||||
* CSS media query when `Mobile` mode will be changed to `Desktop`.
|
||||
* @default '@media (pointer: fine)'
|
||||
* @example '@media (min-width: 720px)' or theme.breakpoints.up("sm")
|
||||
*/
|
||||
desktopModeMediaQuery?: string;
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: DateTimePickerSlots;
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: DateTimePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
||||
/**
|
||||
* Years rendered per row.
|
||||
* @default 4 on desktop, 3 on mobile
|
||||
*/
|
||||
yearsPerRow?: 3 | 4;
|
||||
}
|
||||
/**
|
||||
* Props the field can receive when used inside a Date Time Picker (<DateTimePicker />, <DesktopDateTimePicker /> or <MobileDateTimePicker /> component).
|
||||
*/
|
||||
export type DateTimePickerFieldProps = ValidateDateTimeProps & BaseSingleInputFieldProps;
|
||||
5
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker.types.js
generated
vendored
Normal file
5
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker.types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
39
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs.d.ts
generated
vendored
Normal file
39
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import * as React from 'react';
|
||||
import { DateTimePickerTabsClasses } from "./dateTimePickerTabsClasses.js";
|
||||
import { ExportedBaseTabsProps } from "../internals/models/props/tabs.js";
|
||||
export interface DateTimePickerTabsProps extends ExportedBaseTabsProps {
|
||||
/**
|
||||
* Toggles visibility of the tabs allowing view switching.
|
||||
* @default `window.innerHeight < 667` for `DesktopDateTimePicker` and `MobileDateTimePicker`, `displayStaticWrapperAs === 'desktop'` for `StaticDateTimePicker`
|
||||
*/
|
||||
hidden?: boolean;
|
||||
/**
|
||||
* Date tab icon.
|
||||
* @default DateRange
|
||||
*/
|
||||
dateIcon?: React.ReactNode;
|
||||
/**
|
||||
* Time tab icon.
|
||||
* @default Time
|
||||
*/
|
||||
timeIcon?: React.ReactNode;
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: Partial<DateTimePickerTabsClasses>;
|
||||
}
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DateTimePicker](https://mui.com/x/react-date-pickers/date-time-picker/)
|
||||
* - [Custom slots and subcomponents](https://mui.com/x/react-date-pickers/custom-components/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateTimePickerTabs API](https://mui.com/x/api/date-pickers/date-time-picker-tabs/)
|
||||
*/
|
||||
declare const DateTimePickerTabs: {
|
||||
(inProps: DateTimePickerTabsProps): React.JSX.Element | null;
|
||||
propTypes: any;
|
||||
};
|
||||
export { DateTimePickerTabs };
|
||||
148
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs.js
generated
vendored
Normal file
148
node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DateTimePickerTabs = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _Tab = _interopRequireDefault(require("@mui/material/Tab"));
|
||||
var _Tabs = _interopRequireWildcard(require("@mui/material/Tabs"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
||||
var _icons = require("../icons");
|
||||
var _usePickerTranslations = require("../hooks/usePickerTranslations");
|
||||
var _dateTimePickerTabsClasses = require("./dateTimePickerTabsClasses");
|
||||
var _dateUtils = require("../internals/utils/date-utils");
|
||||
var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
|
||||
var _hooks = require("../hooks");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const viewToTab = view => {
|
||||
if ((0, _dateUtils.isDatePickerView)(view)) {
|
||||
return 'date';
|
||||
}
|
||||
return 'time';
|
||||
};
|
||||
const tabToView = tab => {
|
||||
if (tab === 'date') {
|
||||
return 'day';
|
||||
}
|
||||
return 'hours';
|
||||
};
|
||||
const useUtilityClasses = classes => {
|
||||
const slots = {
|
||||
root: ['root']
|
||||
};
|
||||
return (0, _composeClasses.default)(slots, _dateTimePickerTabsClasses.getDateTimePickerTabsUtilityClass, classes);
|
||||
};
|
||||
const DateTimePickerTabsRoot = (0, _styles.styled)(_Tabs.default, {
|
||||
name: 'MuiDateTimePickerTabs',
|
||||
slot: 'Root'
|
||||
})(({
|
||||
theme
|
||||
}) => ({
|
||||
boxShadow: `0 -1px 0 0 inset ${(theme.vars || theme).palette.divider}`,
|
||||
'&:last-child': {
|
||||
boxShadow: `0 1px 0 0 inset ${(theme.vars || theme).palette.divider}`,
|
||||
[`& .${_Tabs.tabsClasses.indicator}`]: {
|
||||
bottom: 'auto',
|
||||
top: 0
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [DateTimePicker](https://mui.com/x/react-date-pickers/date-time-picker/)
|
||||
* - [Custom slots and subcomponents](https://mui.com/x/react-date-pickers/custom-components/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [DateTimePickerTabs API](https://mui.com/x/api/date-pickers/date-time-picker-tabs/)
|
||||
*/
|
||||
const DateTimePickerTabs = exports.DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
||||
const props = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiDateTimePickerTabs'
|
||||
});
|
||||
const {
|
||||
dateIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DateRangeIcon, {}),
|
||||
timeIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.TimeIcon, {}),
|
||||
hidden = typeof window === 'undefined' || window.innerHeight < 667,
|
||||
className,
|
||||
classes: classesProp,
|
||||
sx
|
||||
} = props;
|
||||
const translations = (0, _usePickerTranslations.usePickerTranslations)();
|
||||
const {
|
||||
ownerState
|
||||
} = (0, _usePickerPrivateContext.usePickerPrivateContext)();
|
||||
const {
|
||||
view,
|
||||
setView
|
||||
} = (0, _hooks.usePickerContext)();
|
||||
const classes = useUtilityClasses(classesProp);
|
||||
const handleChange = (event, value) => {
|
||||
setView(tabToView(value));
|
||||
};
|
||||
if (hidden) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateTimePickerTabsRoot, {
|
||||
ownerState: ownerState,
|
||||
variant: "fullWidth",
|
||||
value: viewToTab(view),
|
||||
onChange: handleChange,
|
||||
className: (0, _clsx.default)(className, classes.root),
|
||||
sx: sx,
|
||||
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tab.default, {
|
||||
value: "date",
|
||||
"aria-label": translations.dateTableLabel,
|
||||
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
||||
children: dateIcon
|
||||
})
|
||||
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tab.default, {
|
||||
value: "time",
|
||||
"aria-label": translations.timeTableLabel,
|
||||
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
||||
children: timeIcon
|
||||
})
|
||||
})]
|
||||
});
|
||||
};
|
||||
if (process.env.NODE_ENV !== "production") DateTimePickerTabs.displayName = "DateTimePickerTabs";
|
||||
process.env.NODE_ENV !== "production" ? DateTimePickerTabs.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: _propTypes.default.object,
|
||||
className: _propTypes.default.string,
|
||||
/**
|
||||
* Date tab icon.
|
||||
* @default DateRange
|
||||
*/
|
||||
dateIcon: _propTypes.default.node,
|
||||
/**
|
||||
* Toggles visibility of the tabs allowing view switching.
|
||||
* @default `window.innerHeight < 667` for `DesktopDateTimePicker` and `MobileDateTimePicker`, `displayStaticWrapperAs === 'desktop'` for `StaticDateTimePicker`
|
||||
*/
|
||||
hidden: _propTypes.default.bool,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
||||
/**
|
||||
* Time tab icon.
|
||||
* @default Time
|
||||
*/
|
||||
timeIcon: _propTypes.default.node
|
||||
} : void 0;
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue