feat(datetime): add disabled part (#28134)
@ -430,6 +430,7 @@ ion-datetime,css-prop,--wheel-fade-background-rgb
|
|||||||
ion-datetime,css-prop,--wheel-highlight-background
|
ion-datetime,css-prop,--wheel-highlight-background
|
||||||
ion-datetime,part,calendar-day
|
ion-datetime,part,calendar-day
|
||||||
ion-datetime,part,calendar-day active
|
ion-datetime,part,calendar-day active
|
||||||
|
ion-datetime,part,calendar-day disabled
|
||||||
ion-datetime,part,calendar-day today
|
ion-datetime,part,calendar-day today
|
||||||
ion-datetime,part,month-year-button
|
ion-datetime,part,month-year-button
|
||||||
ion-datetime,part,time-button
|
ion-datetime,part,time-button
|
||||||
|
|||||||
@ -90,6 +90,7 @@ import {
|
|||||||
* calendar.
|
* calendar.
|
||||||
* @part calendar-day active - The currently selected calendar day.
|
* @part calendar-day active - The currently selected calendar day.
|
||||||
* @part calendar-day today - The calendar day that contains the current day.
|
* @part calendar-day today - The calendar day that contains the current day.
|
||||||
|
* @part calendar-day disabled - The calendar day that is disabled.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
tag: 'ion-datetime',
|
tag: 'ion-datetime',
|
||||||
@ -2126,7 +2127,9 @@ export class Datetime implements ComponentInterface {
|
|||||||
// "Filler days" at the beginning of the grid should not get the calendar day
|
// "Filler days" at the beginning of the grid should not get the calendar day
|
||||||
// CSS parts added to them
|
// CSS parts added to them
|
||||||
if (!isCalendarPadding) {
|
if (!isCalendarPadding) {
|
||||||
dateParts = `calendar-day${isActive ? ' active' : ''}${isToday ? ' today' : ''}`;
|
dateParts = `calendar-day${isActive ? ' active' : ''}${isToday ? ' today' : ''}${
|
||||||
|
isCalDayDisabled ? ' disabled' : ''
|
||||||
|
}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
@ -99,6 +99,11 @@
|
|||||||
box-shadow: 0px 0px 0px 4px rgb(154 209 98 / 0.2);
|
box-shadow: 0px 0px 0px 4px rgb(154 209 98 / 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#custom-calendar-days::part(calendar-day disabled) {
|
||||||
|
background: rgba(0 0 0 / 0.2);
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Custom Material Design Datetime Day Parts
|
* Custom Material Design Datetime Day Parts
|
||||||
* -------------------------------------------
|
* -------------------------------------------
|
||||||
@ -190,6 +195,14 @@
|
|||||||
backgroundColor: 'lightblue',
|
backgroundColor: 'lightblue',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
customDatetime.isDateEnabled = (date) => {
|
||||||
|
if (date === '2023-06-22') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||