Merge remote-tracking branch 'origin/main' into sync-7-11-15-22
@@ -343,6 +343,8 @@ ion-picker-column-internal {
|
||||
background: none;
|
||||
color: currentColor;
|
||||
|
||||
font-family: $font-family-base;
|
||||
|
||||
cursor: pointer;
|
||||
|
||||
appearance: none;
|
||||
|
||||
@@ -576,10 +576,13 @@ export class Datetime implements ComponentInterface {
|
||||
* defaultParts if no active date is selected.
|
||||
*/
|
||||
private getActivePartsWithFallback = () => {
|
||||
const { activePartsClone, defaultParts } = this;
|
||||
const { defaultParts } = this;
|
||||
return this.getActivePart() ?? defaultParts;
|
||||
};
|
||||
|
||||
const firstPart = Array.isArray(activePartsClone) ? activePartsClone[0] : activePartsClone;
|
||||
return firstPart ?? defaultParts;
|
||||
private getActivePart = () => {
|
||||
const { activePartsClone } = this;
|
||||
return Array.isArray(activePartsClone) ? activePartsClone[0] : activePartsClone;
|
||||
};
|
||||
|
||||
private closeParentOverlay = () => {
|
||||
@@ -1047,7 +1050,7 @@ export class Datetime implements ComponentInterface {
|
||||
this.initializeListeners();
|
||||
|
||||
/**
|
||||
* TODO: Datetime needs a frame to ensure that it
|
||||
* TODO FW-2793: Datetime needs a frame to ensure that it
|
||||
* can properly scroll contents into view. As a result
|
||||
* we hide the scrollable content until after that frame
|
||||
* so users do not see the content quickly shifting. The downside
|
||||
@@ -1225,6 +1228,13 @@ export class Datetime implements ComponentInterface {
|
||||
ampm,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* Reset the active parts if the value is not set.
|
||||
* This will clear the selected calendar day when
|
||||
* performing a clear action or using the reset() method.
|
||||
*/
|
||||
this.activeParts = [];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1727,14 +1737,24 @@ export class Datetime implements ComponentInterface {
|
||||
return [];
|
||||
}
|
||||
|
||||
const valueIsDefined = this.value !== null && this.value !== undefined;
|
||||
/**
|
||||
* If a user has not selected a date,
|
||||
* then we should show all times. If the
|
||||
* user has selected a date (even if it has
|
||||
* not been confirmed yet), we should apply
|
||||
* the max and min restrictions so that the
|
||||
* time picker shows values that are
|
||||
* appropriate for the selected date.
|
||||
*/
|
||||
const activePart = this.getActivePart();
|
||||
const userHasSelectedDate = activePart !== undefined;
|
||||
|
||||
const { hoursData, minutesData, dayPeriodData } = getTimeColumnsData(
|
||||
this.locale,
|
||||
this.workingParts,
|
||||
this.hourCycle,
|
||||
valueIsDefined ? this.minParts : undefined,
|
||||
valueIsDefined ? this.maxParts : undefined,
|
||||
userHasSelectedDate ? this.minParts : undefined,
|
||||
userHasSelectedDate ? this.maxParts : undefined,
|
||||
this.parsedHourValues,
|
||||
this.parsedMinuteValues
|
||||
);
|
||||
@@ -1864,6 +1884,9 @@ export class Datetime implements ComponentInterface {
|
||||
const prevMonthDisabled = isPrevMonthDisabled(this.workingParts, this.minParts, this.maxParts);
|
||||
const nextMonthDisabled = isNextMonthDisabled(this.workingParts, this.maxParts);
|
||||
|
||||
// don't use the inheritAttributes util because it removes dir from the host, and we still need that
|
||||
const hostDir = this.el.getAttribute('dir') || undefined;
|
||||
|
||||
return (
|
||||
<div class="calendar-header">
|
||||
<div class="calendar-action-buttons">
|
||||
@@ -1883,10 +1906,24 @@ export class Datetime implements ComponentInterface {
|
||||
<div class="calendar-next-prev">
|
||||
<ion-buttons>
|
||||
<ion-button aria-label="previous month" disabled={prevMonthDisabled} onClick={() => this.prevMonth()}>
|
||||
<ion-icon aria-hidden="true" slot="icon-only" icon={chevronBack} lazy={false} flipRtl></ion-icon>
|
||||
<ion-icon
|
||||
dir={hostDir}
|
||||
aria-hidden="true"
|
||||
slot="icon-only"
|
||||
icon={chevronBack}
|
||||
lazy={false}
|
||||
flipRtl
|
||||
></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button aria-label="next month" disabled={nextMonthDisabled} onClick={() => this.nextMonth()}>
|
||||
<ion-icon aria-hidden="true" slot="icon-only" icon={chevronForward} lazy={false} flipRtl></ion-icon>
|
||||
<ion-icon
|
||||
dir={hostDir}
|
||||
aria-hidden="true"
|
||||
slot="icon-only"
|
||||
icon={chevronForward}
|
||||
lazy={false}
|
||||
flipRtl
|
||||
></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
</div>
|
||||
|
||||
@@ -309,6 +309,49 @@ test.describe('datetime: visibility', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('datetime: RTL set on component', () => {
|
||||
test('should flip icons when RTL is set on component directly', async ({ page, skip }) => {
|
||||
skip.rtl(); // we're setting RTL on the component instead
|
||||
skip.mode('md');
|
||||
|
||||
await page.setContent(`
|
||||
<ion-datetime dir="rtl"></ion-datetime>
|
||||
`);
|
||||
|
||||
const nextPrevIcons = page.locator('ion-datetime .calendar-next-prev ion-icon');
|
||||
await expect(nextPrevIcons.first()).toHaveClass(/flip-rtl/);
|
||||
await expect(nextPrevIcons.last()).toHaveClass(/flip-rtl/);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('datetime: clear button', () => {
|
||||
test('should clear the active calendar day', async ({ page, skip }, testInfo) => {
|
||||
skip.rtl();
|
||||
skip.mode('md');
|
||||
|
||||
testInfo.annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/ionic-team/ionic-framework/issues/26258',
|
||||
});
|
||||
|
||||
await page.setContent(`
|
||||
<ion-datetime value="2022-11-10" show-clear-button="true"></ion-datetime>
|
||||
`);
|
||||
|
||||
await page.waitForSelector('.datetime-ready');
|
||||
|
||||
const selectedDay = page.locator('ion-datetime .calendar-day-active');
|
||||
|
||||
await expect(selectedDay).toHaveText('10');
|
||||
|
||||
await page.click('ion-datetime #clear-button');
|
||||
|
||||
await page.waitForChanges();
|
||||
|
||||
await expect(selectedDay).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('datetime: ionChange', () => {
|
||||
test.beforeEach(({ skip }) => {
|
||||
skip.rtl();
|
||||
|
||||
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 169 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 168 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 223 KiB After Width: | Height: | Size: 216 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 224 KiB After Width: | Height: | Size: 218 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 74 KiB |