-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into not-contain-not-equal-filter-operators
- Loading branch information
Showing
75 changed files
with
963 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from 'react'; | ||
import FlightTakeoffIcon from '@mui/icons-material/FlightTakeoff'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
export default function CustomSlot() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker slots={{ openPickerIcon: FlightTakeoffIcon }} /> | ||
</LocalizationProvider> | ||
); | ||
} |
13 changes: 13 additions & 0 deletions
13
docs/data/common-concepts/custom-components/CustomSlot.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from 'react'; | ||
import FlightTakeoffIcon from '@mui/icons-material/FlightTakeoff'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
export default function CustomSlot() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker slots={{ openPickerIcon: FlightTakeoffIcon }} /> | ||
</LocalizationProvider> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
docs/data/common-concepts/custom-components/CustomSlot.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<DatePicker slots={{ openPickerIcon: FlightTakeoffIcon }} /> |
20 changes: 20 additions & 0 deletions
20
docs/data/common-concepts/custom-components/CustomSlotAndSlotProps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from 'react'; | ||
import FlightTakeoffIcon from '@mui/icons-material/FlightTakeoff'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
export default function CustomSlotAndSlotProps() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker | ||
slots={{ openPickerIcon: FlightTakeoffIcon }} | ||
slotProps={{ | ||
openPickerIcon: { | ||
color: 'primary', | ||
}, | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
docs/data/common-concepts/custom-components/CustomSlotAndSlotProps.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from 'react'; | ||
import FlightTakeoffIcon from '@mui/icons-material/FlightTakeoff'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
export default function CustomSlotAndSlotProps() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker | ||
slots={{ openPickerIcon: FlightTakeoffIcon }} | ||
slotProps={{ | ||
openPickerIcon: { | ||
color: 'primary', | ||
}, | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
docs/data/common-concepts/custom-components/CustomSlotAndSlotProps.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<DatePicker | ||
slots={{ openPickerIcon: FlightTakeoffIcon }} | ||
slotProps={{ | ||
openPickerIcon: { | ||
color: 'primary', | ||
}, | ||
}} | ||
/> |
18 changes: 18 additions & 0 deletions
18
docs/data/common-concepts/custom-components/CustomSlotProps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as React from 'react'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
export default function CustomSlotProps() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker | ||
slotProps={{ | ||
openPickerIcon: { | ||
color: 'primary', | ||
}, | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
18 changes: 18 additions & 0 deletions
18
docs/data/common-concepts/custom-components/CustomSlotProps.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as React from 'react'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
export default function CustomSlotProps() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker | ||
slotProps={{ | ||
openPickerIcon: { | ||
color: 'primary', | ||
}, | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
7 changes: 7 additions & 0 deletions
7
docs/data/common-concepts/custom-components/CustomSlotProps.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<DatePicker | ||
slotProps={{ | ||
openPickerIcon: { | ||
color: 'primary', | ||
}, | ||
}} | ||
/> |
18 changes: 18 additions & 0 deletions
18
docs/data/common-concepts/custom-components/CustomSlotPropsCallback.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as React from 'react'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
export default function CustomSlotPropsCallback() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker | ||
slotProps={{ | ||
openPickerIcon: (ownerState) => ({ | ||
color: ownerState.open ? 'secondary' : 'primary', | ||
}), | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
18 changes: 18 additions & 0 deletions
18
docs/data/common-concepts/custom-components/CustomSlotPropsCallback.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as React from 'react'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
|
||
export default function CustomSlotPropsCallback() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker | ||
slotProps={{ | ||
openPickerIcon: (ownerState) => ({ | ||
color: ownerState.open ? 'secondary' : 'primary', | ||
}), | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
7 changes: 7 additions & 0 deletions
7
docs/data/common-concepts/custom-components/CustomSlotPropsCallback.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<DatePicker | ||
slotProps={{ | ||
openPickerIcon: (ownerState) => ({ | ||
color: ownerState.open ? 'secondary' : 'primary', | ||
}), | ||
}} | ||
/> |
63 changes: 63 additions & 0 deletions
63
docs/data/common-concepts/custom-components/TypescriptCasting.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import * as React from 'react'; | ||
|
||
import Stack from '@mui/material/Stack'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import Switch from '@mui/material/Switch'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { DateCalendar } from '@mui/x-date-pickers/DateCalendar'; | ||
|
||
import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader'; | ||
|
||
function DisplayWeekNumberToggle({ value, onChange }) { | ||
return ( | ||
<FormControlLabel | ||
sx={{ ml: 2 }} | ||
control={ | ||
<Switch | ||
checked={value} | ||
onChange={(event) => onChange(event.target.checked)} | ||
/> | ||
} | ||
label="Display week number" | ||
/> | ||
); | ||
} | ||
|
||
function CustomCalendarHeader({ | ||
displayWeekNumber, | ||
setDisplayWeekNumber, | ||
...other | ||
}) { | ||
return ( | ||
<Stack> | ||
<DisplayWeekNumberToggle | ||
value={displayWeekNumber} | ||
onChange={setDisplayWeekNumber} | ||
/> | ||
<PickersCalendarHeader {...other} /> | ||
</Stack> | ||
); | ||
} | ||
|
||
export default function TypescriptCasting() { | ||
const [displayWeekNumber, setDisplayWeekNumber] = React.useState(false); | ||
|
||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DateCalendar | ||
displayWeekNumber={displayWeekNumber} | ||
// Cast the custom component to the type expected by the X component | ||
slots={{ | ||
calendarHeader: CustomCalendarHeader, | ||
}} | ||
slotProps={{ | ||
calendarHeader: { | ||
displayWeekNumber, | ||
setDisplayWeekNumber, | ||
}, | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
80 changes: 80 additions & 0 deletions
80
docs/data/common-concepts/custom-components/TypescriptCasting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import * as React from 'react'; | ||
import { Dayjs } from 'dayjs'; | ||
import Stack from '@mui/material/Stack'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import Switch from '@mui/material/Switch'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { | ||
DateCalendar, | ||
DateCalendarSlots, | ||
DateCalendarSlotProps, | ||
} from '@mui/x-date-pickers/DateCalendar'; | ||
import { PropsFromSlot } from '@mui/x-date-pickers/models'; | ||
import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader'; | ||
|
||
function DisplayWeekNumberToggle({ | ||
value, | ||
onChange, | ||
}: { | ||
value: boolean; | ||
onChange: (value: boolean) => void; | ||
}) { | ||
return ( | ||
<FormControlLabel | ||
sx={{ ml: 2 }} | ||
control={ | ||
<Switch | ||
checked={value} | ||
onChange={(event) => onChange(event.target.checked)} | ||
/> | ||
} | ||
label="Display week number" | ||
/> | ||
); | ||
} | ||
|
||
interface CustomCalendarHeaderProps | ||
extends PropsFromSlot<DateCalendarSlots<Dayjs>['calendarHeader']> { | ||
displayWeekNumber: boolean; | ||
setDisplayWeekNumber: (displayWeekNumber: boolean) => void; | ||
} | ||
|
||
function CustomCalendarHeader({ | ||
displayWeekNumber, | ||
setDisplayWeekNumber, | ||
...other | ||
}: CustomCalendarHeaderProps) { | ||
return ( | ||
<Stack> | ||
<DisplayWeekNumberToggle | ||
value={displayWeekNumber} | ||
onChange={setDisplayWeekNumber} | ||
/> | ||
<PickersCalendarHeader {...other} /> | ||
</Stack> | ||
); | ||
} | ||
|
||
export default function TypescriptCasting() { | ||
const [displayWeekNumber, setDisplayWeekNumber] = React.useState(false); | ||
|
||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DateCalendar | ||
displayWeekNumber={displayWeekNumber} | ||
// Cast the custom component to the type expected by the X component | ||
slots={{ | ||
calendarHeader: | ||
CustomCalendarHeader as DateCalendarSlots<Dayjs>['calendarHeader'], | ||
}} | ||
slotProps={{ | ||
calendarHeader: { | ||
displayWeekNumber, | ||
setDisplayWeekNumber, | ||
} as DateCalendarSlotProps<Dayjs>['calendarHeader'], | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
docs/data/common-concepts/custom-components/TypescriptCasting.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<DateCalendar | ||
displayWeekNumber={displayWeekNumber} | ||
// Cast the custom component to the type expected by the X component | ||
slots={{ | ||
calendarHeader: | ||
CustomCalendarHeader as DateCalendarSlots<Dayjs>['calendarHeader'], | ||
}} | ||
slotProps={{ | ||
calendarHeader: { | ||
displayWeekNumber, | ||
setDisplayWeekNumber, | ||
} as DateCalendarSlotProps<Dayjs>['calendarHeader'], | ||
}} | ||
/> |
Oops, something went wrong.