Skip to content

Commit 0094648

Browse files
- change naming to adjacent-day;
1 parent 68f331d commit 0094648

File tree

181 files changed

+102
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+102
-102
lines changed

core/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,8 @@ ion-datetime,prop,name,string,this.inputId,false,false
528528
ion-datetime,prop,preferWheel,boolean,false,false,false
529529
ion-datetime,prop,presentation,"date" | "date-time" | "month" | "month-year" | "time" | "time-date" | "year",'date-time',false,false
530530
ion-datetime,prop,readonly,boolean,false,false,false
531+
ion-datetime,prop,showAdjacentDays,boolean,false,false,false
531532
ion-datetime,prop,showClearButton,boolean,false,false,false
532-
ion-datetime,prop,showDaysOutsideCurrentMonth,boolean | undefined,false,false,false
533533
ion-datetime,prop,showDefaultButtons,boolean,false,false,false
534534
ion-datetime,prop,showDefaultTimeLabel,boolean,true,false,false
535535
ion-datetime,prop,showDefaultTitle,boolean,false,false,false

core/src/components.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -933,13 +933,13 @@ export namespace Components {
933933
*/
934934
"reset": (startDate?: string) => Promise<void>;
935935
/**
936-
* If `true`, a "Clear" button will be rendered alongside the default "Cancel" and "OK" buttons at the bottom of the `ion-datetime` component. Developers can also use the `button` slot if they want to customize these buttons. If custom buttons are set in the `button` slot then the default buttons will not be rendered.
936+
* If `true`, the datetime will show the last days of the previous month and the first days of the next month on a table of 42 elements.
937937
*/
938-
"showClearButton": boolean;
938+
"showAdjacentDays": boolean;
939939
/**
940-
* If `true`, the datetime will show the last days of the previous month and the first days of the next month on a table of 42 elements.
940+
* If `true`, a "Clear" button will be rendered alongside the default "Cancel" and "OK" buttons at the bottom of the `ion-datetime` component. Developers can also use the `button` slot if they want to customize these buttons. If custom buttons are set in the `button` slot then the default buttons will not be rendered.
941941
*/
942-
"showDaysOutsideCurrentMonth"?: boolean;
942+
"showClearButton": boolean;
943943
/**
944944
* If `true`, the default "Cancel" and "OK" buttons will be rendered at the bottom of the `ion-datetime` component. Developers can also use the `button` slot if they want to customize these buttons. If custom buttons are set in the `button` slot then the default buttons will not be rendered.
945945
*/
@@ -5724,13 +5724,13 @@ declare namespace LocalJSX {
57245724
*/
57255725
"readonly"?: boolean;
57265726
/**
5727-
* If `true`, a "Clear" button will be rendered alongside the default "Cancel" and "OK" buttons at the bottom of the `ion-datetime` component. Developers can also use the `button` slot if they want to customize these buttons. If custom buttons are set in the `button` slot then the default buttons will not be rendered.
5727+
* If `true`, the datetime will show the last days of the previous month and the first days of the next month on a table of 42 elements.
57285728
*/
5729-
"showClearButton"?: boolean;
5729+
"showAdjacentDays"?: boolean;
57305730
/**
5731-
* If `true`, the datetime will show the last days of the previous month and the first days of the next month on a table of 42 elements.
5731+
* If `true`, a "Clear" button will be rendered alongside the default "Cancel" and "OK" buttons at the bottom of the `ion-datetime` component. Developers can also use the `button` slot if they want to customize these buttons. If custom buttons are set in the `button` slot then the default buttons will not be rendered.
57325732
*/
5733-
"showDaysOutsideCurrentMonth"?: boolean;
5733+
"showClearButton"?: boolean;
57345734
/**
57355735
* If `true`, the default "Cancel" and "OK" buttons will be rendered at the bottom of the `ion-datetime` component. Developers can also use the `button` slot if they want to customize these buttons. If custom buttons are set in the `button` slot then the default buttons will not be rendered.
57365736
*/

core/src/components/datetime/datetime-interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface DatetimeParts {
1515
hour?: number;
1616
minute?: number;
1717
ampm?: 'am' | 'pm';
18-
hiddenDay?: boolean;
18+
adjacentDay?: boolean;
1919
}
2020

2121
export type DatetimePresentation = 'date-time' | 'time-date' | 'date' | 'time' | 'month' | 'year' | 'month-year';

core/src/components/datetime/datetime.ios.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267
color: current-color(contrast);
268268
}
269269

270-
:host .calendar-day.calendar-day-hidden-day:not([disabled]) {
270+
:host .calendar-day.calendar-day-adjacent-day:not([disabled]) {
271271
color: $text-color-step-700;
272272

273273
opacity: 1;

core/src/components/datetime/datetime.md.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
background: current-color(base);
129129
}
130130

131-
:host .calendar-day.calendar-day-hidden-day:not([disabled]) {
131+
:host .calendar-day.calendar-day-adjacent-day:not([disabled]) {
132132
color: $text-color-step-500;
133133

134134
opacity: 1;

core/src/components/datetime/datetime.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,11 @@
364364
opacity: 0.4;
365365
}
366366

367-
:host .calendar-day.calendar-day-hidden-day {
367+
:host .calendar-day.calendar-day-adjacent-day {
368368
opacity: 0.4;
369369
}
370370

371-
.calendar-day:not(.calendar-day-hidden-day):focus {
371+
.calendar-day:not(.calendar-day-adjacent-day):focus {
372372
background: current-color(base, 0.2);
373373

374374
box-shadow: 0px 0px 0px 4px current-color(base, 0.2);

core/src/components/datetime/datetime.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,9 @@ export class Datetime implements ComponentInterface {
816816
* to grab the correct calendar-day element.
817817
*/
818818
const padding = currentMonth.querySelectorAll('.calendar-day-padding');
819-
const { day, hiddenDay } = this.workingParts;
819+
const { day, adjacentDay } = this.workingParts;
820820

821-
if (day === null || hiddenDay) {
821+
if (day === null || adjacentDay) {
822822
return;
823823
}
824824

@@ -2232,25 +2232,25 @@ export class Datetime implements ComponentInterface {
22322232
}}
22332233
>
22342234
<div class="calendar-month-grid">
2235-
{getDaysOfMonth(month, year, this.firstDayOfWeek % 7, this.showDaysOutsideCurrentMonth).map(
2235+
{getDaysOfMonth(month, year, this.firstDayOfWeek % 7, this.showAdjacentDays).map(
22362236
(dateObject, index) => {
2237-
const { day, dayOfWeek, hiddenDay } = dateObject;
2238-
const { el, highlightedDates, isDateEnabled, multiple, showDaysOutsideCurrentMonth } = this;
2237+
const { day, dayOfWeek, adjacentDay } = dateObject;
2238+
const { el, highlightedDates, isDateEnabled, multiple, showAdjacentDays } = this;
22392239
let _month = month;
22402240
let _year = year;
2241-
if (showDaysOutsideCurrentMonth && hiddenDay && day !== null) {
2241+
if (showAdjacentDays && adjacentDay && day !== null) {
22422242
if (day > 20) {
2243-
// Leading with the hidden day from the previous month
2244-
// if its a hidden day and is higher than '20' (last week even in feb)
2243+
// Leading with the adjacent day from the previous month
2244+
// if its a adjacent day and is higher than '20' (last week even in feb)
22452245
if (month === 1) {
22462246
_year = year - 1;
22472247
_month = 12;
22482248
} else {
22492249
_month = month - 1;
22502250
}
22512251
} else if (day < 15) {
2252-
// Leading with the hidden day from the next month
2253-
// if its a hidden day and is lower than '15' (first two weeks)
2252+
// Leading with the adjacent day from the next month
2253+
// if its a adjacent day and is lower than '15' (first two weeks)
22542254
if (month === 12) {
22552255
_year = year + 1;
22562256
_month = 1;
@@ -2260,7 +2260,7 @@ export class Datetime implements ComponentInterface {
22602260
}
22612261
}
22622262

2263-
const referenceParts = { month: _month, day, year: _year, hiddenDay };
2263+
const referenceParts = { month: _month, day, year: _year, adjacentDay };
22642264
const isCalendarPadding = day === null;
22652265
const {
22662266
isActive,
@@ -2315,19 +2315,19 @@ export class Datetime implements ComponentInterface {
23152315
* Custom highlight styles should not override the style for selected dates,
23162316
* nor apply to "filler days" at the start of the grid.
23172317
*/
2318-
if (highlightedDates !== undefined && !isActive && day !== null && !hiddenDay) {
2318+
if (highlightedDates !== undefined && !isActive && day !== null && !adjacentDay) {
23192319
dateStyle = getHighlightStyles(highlightedDates, dateIsoString, el);
23202320
}
23212321

23222322
let dateParts = undefined;
23232323

23242324
// "Filler days" at the beginning of the grid should not get the calendar day
23252325
// CSS parts added to them
2326-
if (!isCalendarPadding && !hiddenDay) {
2326+
if (!isCalendarPadding && !adjacentDay) {
23272327
dateParts = `calendar-day${isActive ? ' active' : ''}${isToday ? ' today' : ''}${
23282328
isCalDayDisabled ? ' disabled' : ''
23292329
}`;
2330-
} else if (hiddenDay) {
2330+
} else if (adjacentDay) {
23312331
dateParts = `calendar-day${isCalDayDisabled ? ' disabled' : ''}`;
23322332
}
23332333

@@ -2363,7 +2363,7 @@ export class Datetime implements ComponentInterface {
23632363
'calendar-day-active': isActive,
23642364
'calendar-day-constrained': isCalDayConstrained,
23652365
'calendar-day-today': isToday,
2366-
'calendar-day-hidden-day': hiddenDay,
2366+
'calendar-day-adjacent-day': adjacentDay,
23672367
}}
23682368
part={dateParts}
23692369
aria-hidden={isCalendarPadding ? 'true' : null}
@@ -2374,7 +2374,7 @@ export class Datetime implements ComponentInterface {
23742374
return;
23752375
}
23762376

2377-
if (hiddenDay) {
2377+
if (adjacentDay) {
23782378
//the user selected a day outside the current month, let's not focus on this button since the month will be re-render;
23792379
this.el.blur();
23802380
}
@@ -2384,7 +2384,7 @@ export class Datetime implements ComponentInterface {
23842384
month: _month,
23852385
day,
23862386
year: _year,
2387-
hiddenDay: hiddenDay,
2387+
adjacentDay: adjacentDay,
23882388
});
23892389

23902390
// multiple only needs date info, so we can wipe out other fields like time
@@ -2394,7 +2394,7 @@ export class Datetime implements ComponentInterface {
23942394
month: _month,
23952395
day,
23962396
year: _year,
2397-
hiddenDay: hiddenDay,
2397+
adjacentDay: adjacentDay,
23982398
},
23992399
isActive
24002400
);
@@ -2404,7 +2404,7 @@ export class Datetime implements ComponentInterface {
24042404
month: _month,
24052405
day,
24062406
year: _year,
2407-
hiddenDay: hiddenDay,
2407+
adjacentDay: adjacentDay,
24082408
});
24092409
}
24102410
}}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { expect } from '@playwright/test';
2+
import { configs, test } from '@utils/test/playwright';
3+
4+
configs().forEach(({ title, screenshot, config }) => {
5+
test.describe(title('datetime: ShowDaysOutsideCustomMonth'), () => {
6+
test('with custom-grid should not have any visual regressions', async ({ page }) => {
7+
await page.goto('/src/components/datetime/test/show-adjacent-days', config);
8+
const customGrid = page.locator('#custom-grid');
9+
await expect(customGrid).toHaveScreenshot(screenshot(`customGrid-with-adjacent-days`));
10+
});
11+
12+
test('should set the first day of the week correctly', async ({ page }) => {
13+
await page.goto('/src/components/datetime/test/show-adjacent-days', config);
14+
const customDatetime = page.locator('#custom-calendar-days');
15+
await expect(customDatetime).toHaveScreenshot(screenshot(`custom-calendar-with-adjacent-days`));
16+
});
17+
18+
test('with specific date disabled should not have any visual regressions', async ({ page }) => {
19+
await page.goto('/src/components/datetime/test/show-adjacent-days', config);
20+
const specificDateDisabled = page.locator('#specificDate');
21+
await expect(specificDateDisabled).toHaveScreenshot(screenshot(`specificDate-with-adjacent-days`));
22+
});
23+
24+
test('with weekends disabled should not have any visual regressions', async ({ page }) => {
25+
await page.goto('/src/components/datetime/test/show-adjacent-days', config);
26+
const weekendsDisabled = page.locator('#weekends');
27+
await expect(weekendsDisabled).toHaveScreenshot(screenshot(`weekendsDisabled-with-adjacent-days`));
28+
});
29+
30+
test('with date range disabled should not have any visual regressions', async ({ page }) => {
31+
await page.goto('/src/components/datetime/test/show-adjacent-days', config);
32+
const dateRangeDisabled = page.locator('#dateRange');
33+
await expect(dateRangeDisabled).toHaveScreenshot(screenshot(`dateRangeDisabled-with-adjacent-days`));
34+
});
35+
36+
test('with month disabled should not have any visual regressions', async ({ page }) => {
37+
await page.goto('/src/components/datetime/test/show-adjacent-days', config);
38+
const monthDisabled = page.locator('#month');
39+
await expect(monthDisabled).toHaveScreenshot(screenshot(`monthDisabled-with-adjacent-days`));
40+
});
41+
42+
test('with specific display should not have any visual regressions', async ({ page }) => {
43+
await page.goto('/src/components/datetime/test/show-adjacent-days', config);
44+
const display = page.locator('#display');
45+
await expect(display).toHaveScreenshot(screenshot(`display-with-adjacent-days`));
46+
});
47+
});
48+
});

0 commit comments

Comments
 (0)