@ -2102,12 +2102,8 @@ export class Datetime implements ComponentInterface {
|
|||||||
</ion-popover>,
|
</ion-popover>,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
private renderCalendarViewHeader() {
|
|
||||||
const hasSlottedTitle = this.el.querySelector('[slot="title"]') !== null;
|
|
||||||
if (!hasSlottedTitle && !this.showDefaultTitle) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private getHeaderSelectedDateText() {
|
||||||
const { activeParts, multiple, titleSelectedDatesFormatter } = this;
|
const { activeParts, multiple, titleSelectedDatesFormatter } = this;
|
||||||
const isArray = Array.isArray(activeParts);
|
const isArray = Array.isArray(activeParts);
|
||||||
|
|
||||||
@ -2126,12 +2122,21 @@ export class Datetime implements ComponentInterface {
|
|||||||
headerText = getMonthAndDay(this.locale, this.getDefaultPart());
|
headerText = getMonthAndDay(this.locale, this.getDefaultPart());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return headerText;
|
||||||
|
}
|
||||||
|
|
||||||
|
private renderCalendarViewHeader(showExpandedHeader = true) {
|
||||||
|
const hasSlottedTitle = this.el.querySelector('[slot="title"]') !== null;
|
||||||
|
if (!hasSlottedTitle && !this.showDefaultTitle) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="datetime-header">
|
<div class="datetime-header">
|
||||||
<div class="datetime-title">
|
<div class="datetime-title">
|
||||||
<slot name="title">Select Date</slot>
|
<slot name="title">Select Date</slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="datetime-selected-date">{headerText}</div>
|
{showExpandedHeader && <div class="datetime-selected-date">{this.getHeaderSelectedDateText()}</div>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2178,7 +2183,7 @@ export class Datetime implements ComponentInterface {
|
|||||||
*/
|
*/
|
||||||
const hasWheelVariant = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
const hasWheelVariant = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
||||||
if (preferWheel && hasWheelVariant) {
|
if (preferWheel && hasWheelVariant) {
|
||||||
return [this.renderWheelView(), this.renderFooter()];
|
return [this.renderCalendarViewHeader(false), this.renderWheelView(), this.renderFooter()];
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (presentation) {
|
switch (presentation) {
|
||||||
|
@ -40,6 +40,18 @@ test.describe('datetime: prefer wheel', () => {
|
|||||||
`datetime-wheel-time-date-diff-${page.getSnapshotSettings()}.png`
|
`datetime-wheel-time-date-diff-${page.getSnapshotSettings()}.png`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
test('should render a condense header when specified', async ({ page }) => {
|
||||||
|
await page.setContent(`
|
||||||
|
<ion-datetime size="cover" presentation="time-date" prefer-wheel="true" value="2019-05-30T16:30:00"><div slot="title">My Custom Title</div></ion-datetime>
|
||||||
|
`);
|
||||||
|
await page.waitForSelector('.datetime-ready');
|
||||||
|
|
||||||
|
const datetime = page.locator('ion-datetime');
|
||||||
|
|
||||||
|
expect(await datetime.screenshot()).toMatchSnapshot(
|
||||||
|
`datetime-wheel-header-diff-${page.getSnapshotSettings()}.png`
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test.describe('datetime: date wheel', () => {
|
test.describe('datetime: date wheel', () => {
|
||||||
test.beforeEach(({ skip }) => {
|
test.beforeEach(({ skip }) => {
|
||||||
|
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 52 KiB |