@ionic/core 7.6.6-dev.11705526292.1bc0acb5 → 7.6.6-dev.11705595500.109bc77e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ion-datetime.js +34 -15
- package/dist/cjs/ion-datetime_3.cjs.entry.js +34 -15
- package/dist/collection/components/datetime/datetime.js +34 -15
- package/dist/collection/components/datetime/test/multiple/datetime.e2e.js +8 -4
- package/dist/docs.json +1 -1
- package/dist/esm/ion-datetime_3.entry.js +34 -15
- package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-024e2739.entry.js +4 -0
- package/dist/ionic/p-1a5f0313.system.js +1 -1
- package/dist/ionic/p-8bad1486.system.entry.js +4 -0
- package/hydrate/index.js +34 -15
- package/package.json +1 -1
- package/dist/ionic/p-c3ef6da5.entry.js +0 -4
- package/dist/ionic/p-d9585c3f.system.entry.js +0 -4
|
@@ -689,22 +689,41 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
689
689
|
const didChangeMonth = (month !== undefined && month !== workingParts.month) || (year !== undefined && year !== workingParts.year);
|
|
690
690
|
const bodyIsVisible = el.classList.contains('datetime-ready');
|
|
691
691
|
const { isGridStyle, showMonthAndYear } = this;
|
|
692
|
-
|
|
693
|
-
|
|
692
|
+
let areAllSelectedDatesInSameMonth = true;
|
|
693
|
+
if (Array.isArray(valueToProcess)) {
|
|
694
|
+
const firstMonth = valueToProcess[0].month;
|
|
695
|
+
for (const date of valueToProcess) {
|
|
696
|
+
if (date.month !== firstMonth) {
|
|
697
|
+
areAllSelectedDatesInSameMonth = false;
|
|
698
|
+
break;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
694
701
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
702
|
+
/**
|
|
703
|
+
* If there is more than one date selected
|
|
704
|
+
* and the dates aren't all in the same month,
|
|
705
|
+
* then we should neither animate to the date
|
|
706
|
+
* nor update the working parts because we do
|
|
707
|
+
* not know which date the user wants to view.
|
|
708
|
+
*/
|
|
709
|
+
if (areAllSelectedDatesInSameMonth) {
|
|
710
|
+
if (isGridStyle && didChangeMonth && bodyIsVisible && !showMonthAndYear) {
|
|
711
|
+
this.animateToDate(targetValue);
|
|
712
|
+
}
|
|
713
|
+
else {
|
|
714
|
+
/**
|
|
715
|
+
* We only need to do this if we didn't just animate to a new month,
|
|
716
|
+
* since that calls prevMonth/nextMonth which calls setWorkingParts for us.
|
|
717
|
+
*/
|
|
718
|
+
this.setWorkingParts({
|
|
719
|
+
month,
|
|
720
|
+
day,
|
|
721
|
+
year,
|
|
722
|
+
hour,
|
|
723
|
+
minute,
|
|
724
|
+
ampm,
|
|
725
|
+
});
|
|
726
|
+
}
|
|
708
727
|
}
|
|
709
728
|
};
|
|
710
729
|
this.animateToDate = async (targetValue) => {
|
|
@@ -688,22 +688,41 @@ const Datetime = class {
|
|
|
688
688
|
const didChangeMonth = (month !== undefined && month !== workingParts.month) || (year !== undefined && year !== workingParts.year);
|
|
689
689
|
const bodyIsVisible = el.classList.contains('datetime-ready');
|
|
690
690
|
const { isGridStyle, showMonthAndYear } = this;
|
|
691
|
-
|
|
692
|
-
|
|
691
|
+
let areAllSelectedDatesInSameMonth = true;
|
|
692
|
+
if (Array.isArray(valueToProcess)) {
|
|
693
|
+
const firstMonth = valueToProcess[0].month;
|
|
694
|
+
for (const date of valueToProcess) {
|
|
695
|
+
if (date.month !== firstMonth) {
|
|
696
|
+
areAllSelectedDatesInSameMonth = false;
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
693
700
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
701
|
+
/**
|
|
702
|
+
* If there is more than one date selected
|
|
703
|
+
* and the dates aren't all in the same month,
|
|
704
|
+
* then we should neither animate to the date
|
|
705
|
+
* nor update the working parts because we do
|
|
706
|
+
* not know which date the user wants to view.
|
|
707
|
+
*/
|
|
708
|
+
if (areAllSelectedDatesInSameMonth) {
|
|
709
|
+
if (isGridStyle && didChangeMonth && bodyIsVisible && !showMonthAndYear) {
|
|
710
|
+
this.animateToDate(targetValue);
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
/**
|
|
714
|
+
* We only need to do this if we didn't just animate to a new month,
|
|
715
|
+
* since that calls prevMonth/nextMonth which calls setWorkingParts for us.
|
|
716
|
+
*/
|
|
717
|
+
this.setWorkingParts({
|
|
718
|
+
month,
|
|
719
|
+
day,
|
|
720
|
+
year,
|
|
721
|
+
hour,
|
|
722
|
+
minute,
|
|
723
|
+
ampm,
|
|
724
|
+
});
|
|
725
|
+
}
|
|
707
726
|
}
|
|
708
727
|
};
|
|
709
728
|
this.animateToDate = async (targetValue) => {
|
|
@@ -526,22 +526,41 @@ export class Datetime {
|
|
|
526
526
|
const didChangeMonth = (month !== undefined && month !== workingParts.month) || (year !== undefined && year !== workingParts.year);
|
|
527
527
|
const bodyIsVisible = el.classList.contains('datetime-ready');
|
|
528
528
|
const { isGridStyle, showMonthAndYear } = this;
|
|
529
|
-
|
|
530
|
-
|
|
529
|
+
let areAllSelectedDatesInSameMonth = true;
|
|
530
|
+
if (Array.isArray(valueToProcess)) {
|
|
531
|
+
const firstMonth = valueToProcess[0].month;
|
|
532
|
+
for (const date of valueToProcess) {
|
|
533
|
+
if (date.month !== firstMonth) {
|
|
534
|
+
areAllSelectedDatesInSameMonth = false;
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
531
538
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
539
|
+
/**
|
|
540
|
+
* If there is more than one date selected
|
|
541
|
+
* and the dates aren't all in the same month,
|
|
542
|
+
* then we should neither animate to the date
|
|
543
|
+
* nor update the working parts because we do
|
|
544
|
+
* not know which date the user wants to view.
|
|
545
|
+
*/
|
|
546
|
+
if (areAllSelectedDatesInSameMonth) {
|
|
547
|
+
if (isGridStyle && didChangeMonth && bodyIsVisible && !showMonthAndYear) {
|
|
548
|
+
this.animateToDate(targetValue);
|
|
549
|
+
}
|
|
550
|
+
else {
|
|
551
|
+
/**
|
|
552
|
+
* We only need to do this if we didn't just animate to a new month,
|
|
553
|
+
* since that calls prevMonth/nextMonth which calls setWorkingParts for us.
|
|
554
|
+
*/
|
|
555
|
+
this.setWorkingParts({
|
|
556
|
+
month,
|
|
557
|
+
day,
|
|
558
|
+
year,
|
|
559
|
+
hour,
|
|
560
|
+
minute,
|
|
561
|
+
ampm,
|
|
562
|
+
});
|
|
563
|
+
}
|
|
545
564
|
}
|
|
546
565
|
};
|
|
547
566
|
this.animateToDate = async (targetValue) => {
|
|
@@ -5,7 +5,7 @@ import { expect } from "@playwright/test";
|
|
|
5
5
|
import { configs, test } from "../../../../utils/test/playwright/index";
|
|
6
6
|
const SINGLE_DATE = '2022-06-01';
|
|
7
7
|
const MULTIPLE_DATES = ['2022-06-01', '2022-06-02', '2022-06-03'];
|
|
8
|
-
const MULTIPLE_DATES_SEPARATE_MONTHS = ['2022-
|
|
8
|
+
const MULTIPLE_DATES_SEPARATE_MONTHS = ['2022-03-01', '2022-04-01', '2022-05-01'];
|
|
9
9
|
class DatetimeMultipleFixture {
|
|
10
10
|
constructor(page) {
|
|
11
11
|
this.page = page;
|
|
@@ -118,10 +118,14 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|
|
118
118
|
value: ['2022-06-01', '2022-06-02'],
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
|
-
test('
|
|
122
|
-
const datetime = await datetimeFixture.goto(config,
|
|
121
|
+
test('should not scroll to new month when value is updated with dates in different months', async ({ page }) => {
|
|
122
|
+
const datetime = await datetimeFixture.goto(config, MULTIPLE_DATES);
|
|
123
|
+
await datetime.evaluate((el, dates) => {
|
|
124
|
+
el.value = dates;
|
|
125
|
+
}, MULTIPLE_DATES_SEPARATE_MONTHS);
|
|
126
|
+
await page.waitForChanges();
|
|
123
127
|
const monthYear = datetime.locator('.calendar-month-year');
|
|
124
|
-
await expect(monthYear).toHaveText(/
|
|
128
|
+
await expect(monthYear).toHaveText(/June 2022/);
|
|
125
129
|
});
|
|
126
130
|
test('with buttons, should only update value when confirm is called', async ({ page }) => {
|
|
127
131
|
const datetime = await datetimeFixture.goto(config, SINGLE_DATE, { showDefaultButtons: true });
|
package/dist/docs.json
CHANGED
|
@@ -684,22 +684,41 @@ const Datetime = class {
|
|
|
684
684
|
const didChangeMonth = (month !== undefined && month !== workingParts.month) || (year !== undefined && year !== workingParts.year);
|
|
685
685
|
const bodyIsVisible = el.classList.contains('datetime-ready');
|
|
686
686
|
const { isGridStyle, showMonthAndYear } = this;
|
|
687
|
-
|
|
688
|
-
|
|
687
|
+
let areAllSelectedDatesInSameMonth = true;
|
|
688
|
+
if (Array.isArray(valueToProcess)) {
|
|
689
|
+
const firstMonth = valueToProcess[0].month;
|
|
690
|
+
for (const date of valueToProcess) {
|
|
691
|
+
if (date.month !== firstMonth) {
|
|
692
|
+
areAllSelectedDatesInSameMonth = false;
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
689
696
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
697
|
+
/**
|
|
698
|
+
* If there is more than one date selected
|
|
699
|
+
* and the dates aren't all in the same month,
|
|
700
|
+
* then we should neither animate to the date
|
|
701
|
+
* nor update the working parts because we do
|
|
702
|
+
* not know which date the user wants to view.
|
|
703
|
+
*/
|
|
704
|
+
if (areAllSelectedDatesInSameMonth) {
|
|
705
|
+
if (isGridStyle && didChangeMonth && bodyIsVisible && !showMonthAndYear) {
|
|
706
|
+
this.animateToDate(targetValue);
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
/**
|
|
710
|
+
* We only need to do this if we didn't just animate to a new month,
|
|
711
|
+
* since that calls prevMonth/nextMonth which calls setWorkingParts for us.
|
|
712
|
+
*/
|
|
713
|
+
this.setWorkingParts({
|
|
714
|
+
month,
|
|
715
|
+
day,
|
|
716
|
+
year,
|
|
717
|
+
hour,
|
|
718
|
+
minute,
|
|
719
|
+
ampm,
|
|
720
|
+
});
|
|
721
|
+
}
|
|
703
722
|
}
|
|
704
723
|
};
|
|
705
724
|
this.animateToDate = async (targetValue) => {
|