@ionic/core 7.5.7-dev.11700601905.13f94170 → 7.5.7-dev.11701113479.149fdab6
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/backdrop.js +0 -12
- package/components/data.js +13 -41
- package/components/gesture-controller.js +1 -1
- package/components/ion-content.js +1 -1
- package/components/ion-datetime.js +32 -84
- package/components/ion-picker-legacy-column.d.ts +11 -0
- package/components/{ion-picker-column.js → ion-picker-legacy-column.js} +2 -2
- package/components/{ion-picker-column.d.ts → ion-picker-legacy.d.ts} +4 -4
- package/components/ion-picker-legacy.js +309 -0
- package/components/overlays.js +11 -4
- package/components/picker-column-internal.js +12 -7
- package/components/picker-column.js +3 -3
- package/dist/cjs/{button-active-af897e0e.js → button-active-cd07b55b.js} +1 -1
- package/dist/cjs/{data-88d0864d.js → data-c8d21093.js} +13 -41
- package/dist/cjs/{gesture-controller-b46721be.js → gesture-controller-d6a3f907.js} +1 -0
- package/dist/cjs/{index-0ee995e4.js → index-0f8b33f8.js} +1 -1
- package/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/ion-action-sheet.cjs.entry.js +4 -4
- package/dist/cjs/ion-alert.cjs.entry.js +4 -4
- package/dist/cjs/ion-app_8.cjs.entry.js +2 -2
- package/dist/cjs/ion-backdrop.cjs.entry.js +0 -12
- package/dist/cjs/ion-datetime-button.cjs.entry.js +1 -1
- package/dist/cjs/ion-datetime_3.cjs.entry.js +34 -66
- package/dist/cjs/ion-item-option_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-loading.cjs.entry.js +2 -1
- package/dist/cjs/ion-menu_3.cjs.entry.js +3 -3
- package/dist/cjs/ion-modal.cjs.entry.js +3 -3
- package/dist/cjs/ion-nav_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-picker-column-internal.cjs.entry.js +11 -7
- package/dist/cjs/ion-popover.cjs.entry.js +2 -1
- package/dist/cjs/ion-range.cjs.entry.js +1 -1
- package/dist/cjs/ion-refresher_2.cjs.entry.js +3 -3
- package/dist/cjs/ion-reorder_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-segment_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-select_3.cjs.entry.js +2 -1
- package/dist/cjs/ion-toast.cjs.entry.js +2 -1
- package/dist/cjs/ion-toggle.cjs.entry.js +1 -1
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{overlays-2ffc5f27.js → overlays-dbb71984.js} +11 -4
- package/dist/cjs/{swipe-back-d0412fb6.js → swipe-back-a6dc6e5d.js} +2 -2
- package/dist/collection/collection-manifest.json +6 -6
- package/dist/collection/components/backdrop/backdrop.js +0 -12
- package/dist/collection/components/content/content.css +0 -4
- package/dist/collection/components/datetime/datetime.ios.css +83 -24
- package/dist/collection/components/datetime/datetime.js +22 -56
- package/dist/collection/components/datetime/datetime.md.css +88 -24
- package/dist/collection/components/datetime/test/a11y/datetime.e2e.js +1 -1
- package/dist/collection/components/datetime/test/a11y/datetime.spec.js +6 -9
- package/dist/collection/components/datetime/test/basic/datetime.e2e.js +10 -0
- package/dist/collection/components/datetime/test/disabled/datetime.spec.js +33 -0
- package/dist/collection/components/datetime/test/manipulation.spec.js +1 -77
- package/dist/collection/components/datetime/test/month-year-picker/datetime.e2e.js +1 -1
- package/dist/collection/components/datetime/test/readonly/datetime.e2e.js +2 -2
- package/dist/collection/components/datetime/utils/manipulation.js +14 -42
- package/dist/collection/components/picker-column-internal/picker-column-internal.ios.css +11 -3
- package/dist/collection/components/picker-column-internal/picker-column-internal.js +27 -5
- package/dist/collection/components/picker-column-internal/picker-column-internal.md.css +11 -3
- package/dist/collection/components/picker-column-internal/test/disabled/picker-column-internal.e2e.js +34 -5
- package/dist/collection/components/{picker-column → picker-column-legacy}/picker-column.js +5 -5
- package/dist/collection/components/{picker-column → picker-column-legacy}/test/picker-column-aria.spec.js +3 -3
- package/dist/collection/components/{picker-column → picker-column-legacy}/test/picker-column-dynamic.spec.js +2 -2
- package/dist/collection/components/{picker-column → picker-column-legacy}/test/picker-column.spec.js +2 -2
- package/dist/collection/components/{picker-column → picker-column-legacy}/test/standalone/picker-column.e2e.js +3 -3
- package/dist/collection/components/{picker → picker-legacy}/picker.js +7 -5
- package/dist/collection/components/{picker → picker-legacy}/test/basic/picker.e2e.js +2 -2
- package/dist/collection/components/{picker → picker-legacy}/test/is-open/picker.e2e.js +4 -4
- package/dist/collection/components/{picker → picker-legacy}/test/picker-id.spec.js +5 -5
- package/dist/collection/components/{picker → picker-legacy}/test/trigger/picker.e2e.js +1 -1
- package/dist/collection/utils/gesture/gesture-controller.js +1 -1
- package/dist/collection/utils/overlays.js +11 -4
- package/dist/collection/utils/test/overlays/overlays-scroll-blocking.spec.js +65 -0
- package/dist/docs.json +32 -43
- package/dist/esm/{button-active-ce5cba4c.js → button-active-5b0516e7.js} +1 -1
- package/dist/esm/{data-2b019469.js → data-44d9e816.js} +13 -41
- package/dist/esm/{gesture-controller-0fa396c4.js → gesture-controller-3723db7c.js} +1 -1
- package/dist/esm/{index-ff313b19.js → index-32cbee52.js} +2 -2
- package/dist/esm/index.js +3 -3
- package/dist/esm/ion-action-sheet.entry.js +4 -4
- package/dist/esm/ion-alert.entry.js +4 -4
- package/dist/esm/ion-app_8.entry.js +2 -2
- package/dist/esm/ion-backdrop.entry.js +0 -12
- package/dist/esm/ion-datetime-button.entry.js +1 -1
- package/dist/esm/ion-datetime_3.entry.js +33 -65
- package/dist/esm/ion-item-option_3.entry.js +1 -1
- package/dist/esm/ion-loading.entry.js +2 -1
- package/dist/esm/ion-menu_3.entry.js +3 -3
- package/dist/esm/ion-modal.entry.js +3 -3
- package/dist/esm/ion-nav_2.entry.js +1 -1
- package/dist/esm/ion-picker-column-internal.entry.js +11 -7
- package/dist/esm/ion-popover.entry.js +2 -1
- package/dist/esm/ion-range.entry.js +1 -1
- package/dist/esm/ion-refresher_2.entry.js +3 -3
- package/dist/esm/ion-reorder_2.entry.js +1 -1
- package/dist/esm/ion-segment_2.entry.js +1 -1
- package/dist/esm/ion-select_3.entry.js +2 -1
- package/dist/esm/ion-toast.entry.js +2 -1
- package/dist/esm/ion-toggle.entry.js +1 -1
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{overlays-6c9feb7e.js → overlays-789cd7a7.js} +11 -4
- package/dist/esm/{swipe-back-0f3bfc8e.js → swipe-back-cc4c2bcb.js} +2 -2
- package/dist/esm-es5/{button-active-ce5cba4c.js → button-active-5b0516e7.js} +1 -1
- package/dist/esm-es5/data-44d9e816.js +4 -0
- package/dist/esm-es5/{gesture-controller-0fa396c4.js → gesture-controller-3723db7c.js} +1 -1
- package/dist/esm-es5/{index-ff313b19.js → index-32cbee52.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/ion-action-sheet.entry.js +1 -1
- package/dist/esm-es5/ion-alert.entry.js +1 -1
- package/dist/esm-es5/ion-app_8.entry.js +1 -1
- package/dist/esm-es5/ion-backdrop.entry.js +1 -1
- package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
- package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
- package/dist/esm-es5/ion-item-option_3.entry.js +1 -1
- package/dist/esm-es5/ion-loading.entry.js +1 -1
- package/dist/esm-es5/ion-menu_3.entry.js +1 -1
- package/dist/esm-es5/ion-modal.entry.js +1 -1
- package/dist/esm-es5/ion-nav_2.entry.js +1 -1
- package/dist/esm-es5/ion-picker-column-internal.entry.js +1 -1
- package/dist/esm-es5/ion-popover.entry.js +1 -1
- package/dist/esm-es5/ion-range.entry.js +1 -1
- package/dist/esm-es5/ion-refresher_2.entry.js +1 -1
- package/dist/esm-es5/ion-reorder_2.entry.js +1 -1
- package/dist/esm-es5/ion-segment_2.entry.js +1 -1
- package/dist/esm-es5/ion-select_3.entry.js +1 -1
- package/dist/esm-es5/ion-toast.entry.js +1 -1
- package/dist/esm-es5/ion-toggle.entry.js +1 -1
- package/dist/esm-es5/ionic.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/overlays-789cd7a7.js +4 -0
- package/dist/esm-es5/swipe-back-cc4c2bcb.js +4 -0
- package/dist/html.html-data.json +2 -2
- package/dist/ionic/index.esm.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-67e644bd.system.entry.js → p-02d8fdba.system.entry.js} +1 -1
- package/dist/ionic/{p-f3c82f74.system.entry.js → p-06e6d235.system.entry.js} +2 -2
- package/dist/ionic/p-0c244faf.entry.js +4 -0
- package/dist/ionic/{p-e0b06b65.js → p-100ef961.js} +1 -1
- package/dist/ionic/p-17240d90.js +4 -0
- package/dist/ionic/p-1a368f2e.system.entry.js +4 -0
- package/dist/ionic/{p-34d2de14.system.entry.js → p-22813b28.system.entry.js} +1 -1
- package/dist/ionic/p-234b9617.system.entry.js +4 -0
- package/dist/ionic/p-25c34422.system.entry.js +4 -0
- package/dist/ionic/p-2804781b.entry.js +4 -0
- package/dist/ionic/p-29fe18ef.entry.js +4 -0
- package/dist/ionic/p-2ad38423.system.entry.js +4 -0
- package/dist/ionic/{p-7176cea3.entry.js → p-2ba9414e.entry.js} +1 -1
- package/dist/ionic/{p-fa8d4788.system.js → p-2e1794df.system.js} +1 -1
- package/dist/ionic/{p-e627ed84.js → p-302091ab.js} +1 -1
- package/dist/ionic/{p-67ed452a.system.entry.js → p-3f88eab8.system.entry.js} +1 -1
- package/dist/ionic/p-40903d34.system.js +1 -1
- package/dist/ionic/{p-0dc0d9b5.entry.js → p-477a182e.entry.js} +1 -1
- package/dist/ionic/{p-2743f9a7.system.entry.js → p-4c80afe1.system.entry.js} +1 -1
- package/dist/ionic/{p-377c636c.system.entry.js → p-4f3e2767.system.entry.js} +1 -1
- package/dist/ionic/{p-3de79805.entry.js → p-56224549.entry.js} +1 -1
- package/dist/ionic/{p-965677f1.entry.js → p-5ce11143.entry.js} +1 -1
- package/dist/ionic/{p-9e852ff1.system.js → p-6500b298.system.js} +1 -1
- package/dist/ionic/p-6893f6e4.entry.js +4 -0
- package/dist/ionic/{p-b2a74a72.entry.js → p-835e0346.entry.js} +1 -1
- package/dist/ionic/{p-39044fe6.system.entry.js → p-878c7aa5.system.entry.js} +1 -1
- package/dist/ionic/{p-c4c7fd8f.entry.js → p-8ad82eb3.entry.js} +1 -1
- package/dist/ionic/p-8b4ab236.entry.js +4 -0
- package/dist/ionic/{p-f37b4b79.entry.js → p-939d903b.entry.js} +1 -1
- package/dist/ionic/{p-6d812360.system.entry.js → p-966cf574.system.entry.js} +1 -1
- package/dist/ionic/p-992d3bad.entry.js +4 -0
- package/dist/ionic/{p-1cb5f2f8.system.entry.js → p-9b5301cc.system.entry.js} +1 -1
- package/dist/ionic/p-9c967a65.system.entry.js +4 -0
- package/dist/ionic/{p-8e1bded3.entry.js → p-9e6bf9ed.entry.js} +1 -1
- package/dist/ionic/{p-6e23777e.system.entry.js → p-a4cda7a8.system.entry.js} +1 -1
- package/dist/ionic/{p-09d142b3.system.js → p-a57f223c.system.js} +1 -1
- package/dist/ionic/{p-8b1be026.js → p-a7e2ac5c.js} +1 -1
- package/dist/ionic/{p-bed722c4.system.entry.js → p-b3e79338.system.entry.js} +1 -1
- package/dist/ionic/p-b4cbb736.js +4 -0
- package/dist/ionic/{p-4fa201a7.entry.js → p-b6a8588f.entry.js} +1 -1
- package/dist/ionic/p-b8c3f071.system.js +4 -0
- package/dist/ionic/{p-73411c1b.entry.js → p-c1229981.entry.js} +1 -1
- package/dist/ionic/{p-db5043df.system.entry.js → p-c31fc05f.system.entry.js} +1 -1
- package/dist/ionic/p-c56b6570.system.entry.js +4 -0
- package/dist/ionic/p-c59d068a.entry.js +4 -0
- package/dist/ionic/{p-a936d224.system.js → p-c7fd81ba.system.js} +1 -1
- package/dist/ionic/p-dc565ca3.js +4 -0
- package/dist/ionic/{p-deab76dc.entry.js → p-dd837fa8.entry.js} +1 -1
- package/dist/ionic/p-e88ed07f.system.js +4 -0
- package/dist/ionic/p-eb07ec1a.system.entry.js +4 -0
- package/dist/ionic/p-eb5697b5.system.js +4 -0
- package/dist/ionic/{p-3ce8c3e3.entry.js → p-ee800093.entry.js} +1 -1
- package/dist/ionic/p-f0559c5d.system.entry.js +4 -0
- package/dist/ionic/p-fdd22426.entry.js +4 -0
- package/dist/types/components/backdrop/backdrop.d.ts +0 -3
- package/dist/types/components/datetime/datetime.d.ts +0 -1
- package/dist/types/components/datetime/utils/manipulation.d.ts +15 -34
- package/dist/types/components/menu/menu.d.ts +1 -1
- package/dist/types/components/picker-column-internal/picker-column-internal.d.ts +4 -0
- package/dist/types/components/{picker-column → picker-column-legacy}/picker-column.d.ts +1 -1
- package/dist/types/components/{picker → picker-legacy}/picker.d.ts +1 -1
- package/dist/types/components.d.ts +138 -130
- package/dist/types/interface.d.ts +1 -1
- package/dist/types/utils/config.d.ts +2 -2
- package/dist/types/utils/gesture/gesture-controller.d.ts +1 -0
- package/dist/types/utils/overlays.d.ts +5 -2
- package/hydrate/index.js +62 -126
- package/package.json +1 -1
- package/components/ion-picker.d.ts +0 -11
- package/components/ion-picker.js +0 -307
- package/dist/collection/components/datetime/test/prefer-wheel/datetime.spec.js +0 -27
- package/dist/esm-es5/data-2b019469.js +0 -4
- package/dist/esm-es5/overlays-6c9feb7e.js +0 -4
- package/dist/esm-es5/swipe-back-0f3bfc8e.js +0 -4
- package/dist/ionic/p-0d8e9393.entry.js +0 -4
- package/dist/ionic/p-1108f9bf.system.entry.js +0 -4
- package/dist/ionic/p-18e01b30.system.entry.js +0 -4
- package/dist/ionic/p-1e5165db.system.entry.js +0 -4
- package/dist/ionic/p-264c16e9.entry.js +0 -4
- package/dist/ionic/p-297741bc.system.js +0 -4
- package/dist/ionic/p-4794e0ac.system.entry.js +0 -4
- package/dist/ionic/p-4dbac22d.entry.js +0 -4
- package/dist/ionic/p-598cdf16.js +0 -4
- package/dist/ionic/p-64296b15.entry.js +0 -4
- package/dist/ionic/p-800ef057.js +0 -4
- package/dist/ionic/p-8dbdb163.system.js +0 -4
- package/dist/ionic/p-97e31c0a.system.js +0 -4
- package/dist/ionic/p-a5c1e6ce.entry.js +0 -4
- package/dist/ionic/p-a9c3699b.system.entry.js +0 -4
- package/dist/ionic/p-b203659a.system.entry.js +0 -4
- package/dist/ionic/p-b91fe549.entry.js +0 -4
- package/dist/ionic/p-c919498d.entry.js +0 -4
- package/dist/ionic/p-cf425ec5.system.entry.js +0 -4
- package/dist/ionic/p-ddfc4ef4.system.entry.js +0 -4
- package/dist/ionic/p-e6b240a0.js +0 -4
- package/dist/ionic/p-f54ddd19.entry.js +0 -4
- /package/dist/collection/components/{picker-column → picker-column-legacy}/picker-column.ios.css +0 -0
- /package/dist/collection/components/{picker-column → picker-column-legacy}/picker-column.md.css +0 -0
- /package/dist/collection/components/{picker-column → picker-column-legacy}/test/test.utils.js +0 -0
- /package/dist/collection/components/{picker → picker-legacy}/animations/ios.enter.js +0 -0
- /package/dist/collection/components/{picker → picker-legacy}/animations/ios.leave.js +0 -0
- /package/dist/collection/components/{picker → picker-legacy}/picker-interface.js +0 -0
- /package/dist/collection/components/{picker → picker-legacy}/picker.ios.css +0 -0
- /package/dist/collection/components/{picker → picker-legacy}/picker.md.css +0 -0
- /package/dist/types/components/{picker-column → picker-column-legacy}/test/test.utils.d.ts +0 -0
- /package/dist/types/components/{picker → picker-legacy}/animations/ios.enter.d.ts +0 -0
- /package/dist/types/components/{picker → picker-legacy}/animations/ios.leave.d.ts +0 -0
- /package/dist/types/components/{picker → picker-legacy}/picker-interface.d.ts +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
+
*/
|
|
4
|
+
import { h } from "@stencil/core";
|
|
5
|
+
import { newSpecPage } from "@stencil/core/testing";
|
|
6
|
+
import { Datetime } from "../../../datetime/datetime";
|
|
7
|
+
import { PickerColumnInternal } from "../../../picker-column-internal/picker-column-internal";
|
|
8
|
+
import { PickerInternal } from "../../../picker-internal/picker-internal";
|
|
9
|
+
describe('ion-datetime disabled', () => {
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
// IntersectionObserver isn't available in test environment
|
|
12
|
+
const mockIntersectionObserver = jest.fn();
|
|
13
|
+
mockIntersectionObserver.mockReturnValue({
|
|
14
|
+
observe: () => null,
|
|
15
|
+
unobserve: () => null,
|
|
16
|
+
disconnect: () => null,
|
|
17
|
+
});
|
|
18
|
+
global.IntersectionObserver = mockIntersectionObserver;
|
|
19
|
+
});
|
|
20
|
+
it('picker should be disabled in prefer wheel mode', async () => {
|
|
21
|
+
const page = await newSpecPage({
|
|
22
|
+
components: [Datetime, PickerColumnInternal, PickerInternal],
|
|
23
|
+
template: () => (h("ion-datetime", { id: "inline-datetime-wheel", disabled: true, "prefer-wheel": true, value: "2022-04-21T00:00:00" })),
|
|
24
|
+
});
|
|
25
|
+
await page.waitForChanges();
|
|
26
|
+
const datetime = page.body.querySelector('ion-datetime');
|
|
27
|
+
const columns = datetime.shadowRoot.querySelectorAll('ion-picker-column-internal');
|
|
28
|
+
await expect(columns.length).toEqual(4);
|
|
29
|
+
columns.forEach((column) => {
|
|
30
|
+
expect(column.disabled).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
|
-
import { getPreviousYear, getNextYear, getPreviousMonth, getNextMonth, getPreviousDay, getNextDay, getPreviousWeek, getNextWeek, getEndOfWeek, getStartOfWeek, convert12HourTo24Hour, getInternalHourValue, calculateHourFromAMPM, subtractDays, addDays, validateParts,
|
|
4
|
+
import { getPreviousYear, getNextYear, getPreviousMonth, getNextMonth, getPreviousDay, getNextDay, getPreviousWeek, getNextWeek, getEndOfWeek, getStartOfWeek, convert12HourTo24Hour, getInternalHourValue, calculateHourFromAMPM, subtractDays, addDays, validateParts, } from "../utils/manipulation";
|
|
5
5
|
describe('addDays()', () => {
|
|
6
6
|
it('should correctly add days', () => {
|
|
7
7
|
expect(addDays({
|
|
@@ -431,79 +431,3 @@ describe('validateParts()', () => {
|
|
|
431
431
|
})).toEqual({ month: 1, day: 1, year: 2022, hour: 9, minute: 30 });
|
|
432
432
|
});
|
|
433
433
|
});
|
|
434
|
-
describe('getClosestValidDate()', () => {
|
|
435
|
-
it('should match a date with only month/day/year', () => {
|
|
436
|
-
// October 10, 2023
|
|
437
|
-
const refParts = { month: 10, day: 10, year: 2023 };
|
|
438
|
-
// April 10, 2021
|
|
439
|
-
const minParts = { month: 4, day: 10, year: 2021 };
|
|
440
|
-
// September 14, 2021
|
|
441
|
-
const maxParts = { month: 9, day: 14, year: 2021 };
|
|
442
|
-
// September 4, 2021
|
|
443
|
-
const expected = { month: 9, day: 4, year: 2021, dayOfWeek: undefined };
|
|
444
|
-
expect(getClosestValidDate({
|
|
445
|
-
refParts,
|
|
446
|
-
monthValues: [2, 3, 7, 9, 10],
|
|
447
|
-
dayValues: [4, 15, 25],
|
|
448
|
-
yearValues: [2020, 2021, 2023],
|
|
449
|
-
maxParts,
|
|
450
|
-
minParts,
|
|
451
|
-
})).toEqual(expected);
|
|
452
|
-
});
|
|
453
|
-
it('should match a date when the reference date is before the min', () => {
|
|
454
|
-
// April 2, 2020 3:20 PM
|
|
455
|
-
const refParts = { month: 4, day: 2, year: 2020, hour: 15, minute: 20 };
|
|
456
|
-
// September 10, 2021 10:10 AM
|
|
457
|
-
const minParts = { month: 9, day: 10, year: 2021, hour: 10, minute: 10 };
|
|
458
|
-
// September 14, 2021 10:11 AM
|
|
459
|
-
const maxParts = { month: 9, day: 14, year: 2021, hour: 10, minute: 11 };
|
|
460
|
-
// September 11, 2021 11:15 AM
|
|
461
|
-
const expected = {
|
|
462
|
-
year: 2021,
|
|
463
|
-
day: 11,
|
|
464
|
-
month: 9,
|
|
465
|
-
hour: 11,
|
|
466
|
-
minute: 15,
|
|
467
|
-
ampm: 'am',
|
|
468
|
-
dayOfWeek: undefined,
|
|
469
|
-
};
|
|
470
|
-
expect(getClosestValidDate({
|
|
471
|
-
refParts,
|
|
472
|
-
monthValues: [4, 9, 11],
|
|
473
|
-
dayValues: [11, 12, 13, 14],
|
|
474
|
-
yearValues: [2020, 2021, 2023],
|
|
475
|
-
hourValues: [9, 10, 11],
|
|
476
|
-
minuteValues: [11, 12, 13, 14, 15],
|
|
477
|
-
maxParts,
|
|
478
|
-
minParts,
|
|
479
|
-
})).toEqual(expected);
|
|
480
|
-
});
|
|
481
|
-
it('should match a date when the reference date is before the min', () => {
|
|
482
|
-
// April 2, 2020 3:20 PM
|
|
483
|
-
const refParts = { month: 4, day: 2, year: 2020, hour: 15, minute: 20 };
|
|
484
|
-
// September 10, 2021 10:10 AM
|
|
485
|
-
const minParts = { month: 9, day: 10, year: 2021, hour: 10, minute: 10 };
|
|
486
|
-
// September 10, 2021 10:15 AM
|
|
487
|
-
const maxParts = { month: 9, day: 10, year: 2021, hour: 10, minute: 15 };
|
|
488
|
-
// September 10, 2021 10:15 AM
|
|
489
|
-
const expected = {
|
|
490
|
-
month: 9,
|
|
491
|
-
day: 10,
|
|
492
|
-
year: 2021,
|
|
493
|
-
hour: 10,
|
|
494
|
-
minute: 15,
|
|
495
|
-
ampm: 'am',
|
|
496
|
-
dayOfWeek: undefined,
|
|
497
|
-
};
|
|
498
|
-
expect(getClosestValidDate({
|
|
499
|
-
refParts,
|
|
500
|
-
monthValues: [4, 9, 11],
|
|
501
|
-
dayValues: [10, 12, 13, 14],
|
|
502
|
-
yearValues: [2020, 2021, 2023],
|
|
503
|
-
hourValues: [9, 10, 11],
|
|
504
|
-
minuteValues: [11, 12, 13, 14, 15],
|
|
505
|
-
minParts,
|
|
506
|
-
maxParts,
|
|
507
|
-
})).toEqual(expected);
|
|
508
|
-
});
|
|
509
|
-
});
|
|
@@ -16,7 +16,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
|
|
16
16
|
test('should hide the footer when picker is open', async ({ page }) => {
|
|
17
17
|
const datetimeFooter = page.locator('#date-time .datetime-footer');
|
|
18
18
|
await expect(datetimeFooter).toBeVisible();
|
|
19
|
-
const pickerButton = page.locator('#date-time .calendar-month-year >
|
|
19
|
+
const pickerButton = page.locator('#date-time .calendar-month-year > .calendar-month-year-toggle');
|
|
20
20
|
await pickerButton.click();
|
|
21
21
|
await page.waitForChanges();
|
|
22
22
|
await expect(datetimeFooter).not.toBeVisible();
|
|
@@ -46,7 +46,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config, scree
|
|
|
46
46
|
const tabKey = browserName === 'webkit' ? 'Alt+Tab' : 'Tab';
|
|
47
47
|
await page.waitForSelector('.datetime-ready');
|
|
48
48
|
const calendarMonthYear = page.locator('ion-datetime .calendar-month-year');
|
|
49
|
-
const monthYearButton = page.locator('.calendar-month-year
|
|
49
|
+
const monthYearButton = page.locator('.calendar-month-year-toggle');
|
|
50
50
|
await expect(calendarMonthYear).toHaveText('February 2022');
|
|
51
51
|
await page.keyboard.press(tabKey);
|
|
52
52
|
await expect(monthYearButton).toBeFocused();
|
|
@@ -75,7 +75,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config, scree
|
|
|
75
75
|
`, config);
|
|
76
76
|
const tabKey = browserName === 'webkit' ? 'Alt+Tab' : 'Tab';
|
|
77
77
|
const datetime = page.locator('ion-datetime');
|
|
78
|
-
const monthYearButton = page.locator('.calendar-month-year
|
|
78
|
+
const monthYearButton = page.locator('.calendar-month-year-toggle');
|
|
79
79
|
const prevButton = page.locator('.calendar-next-prev ion-button:nth-child(1)');
|
|
80
80
|
const nextButton = page.locator('.calendar-next-prev ion-button:nth-child(2)');
|
|
81
81
|
const calendarMonthYear = page.locator('ion-datetime .calendar-month-year');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { isSameDay } from "./comparison";
|
|
5
5
|
import { getNumDaysInMonth } from "./helpers";
|
|
6
6
|
import { clampDate, parseAmPm } from "./parse";
|
|
7
7
|
const twoDigit = (val) => {
|
|
@@ -355,60 +355,32 @@ export const validateParts = (parts, minParts, maxParts) => {
|
|
|
355
355
|
* Returns the closest date to refParts
|
|
356
356
|
* that also meets the constraints of
|
|
357
357
|
* the *Values params.
|
|
358
|
+
* @param refParts The reference date
|
|
359
|
+
* @param monthValues The allowed month values
|
|
360
|
+
* @param dayValues The allowed day (of the month) values
|
|
361
|
+
* @param yearValues The allowed year values
|
|
362
|
+
* @param hourValues The allowed hour values
|
|
363
|
+
* @param minuteValues The allowed minute values
|
|
358
364
|
*/
|
|
359
|
-
export const getClosestValidDate = (
|
|
365
|
+
export const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
|
|
360
366
|
const { hour, minute, day, month, year } = refParts;
|
|
361
|
-
const copyParts =
|
|
367
|
+
const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
|
|
362
368
|
if (monthValues !== undefined) {
|
|
363
|
-
|
|
364
|
-
const filteredMonths = monthValues.filter((month) => !(minParts !== undefined && month < minParts.month) && !(maxParts !== undefined && month > maxParts.month));
|
|
365
|
-
copyParts.month = findClosestValue(month, filteredMonths);
|
|
369
|
+
copyParts.month = findClosestValue(month, monthValues);
|
|
366
370
|
}
|
|
367
371
|
// Day is nullable but cannot be undefined
|
|
368
372
|
if (day !== null && dayValues !== undefined) {
|
|
369
|
-
|
|
370
|
-
const filteredDays = dayValues.filter((day) => {
|
|
371
|
-
if (minParts && isBefore(Object.assign(Object.assign({}, copyParts), { day }), minParts)) {
|
|
372
|
-
return false;
|
|
373
|
-
}
|
|
374
|
-
if (maxParts && isAfter(Object.assign(Object.assign({}, copyParts), { day }), maxParts)) {
|
|
375
|
-
return false;
|
|
376
|
-
}
|
|
377
|
-
return true;
|
|
378
|
-
});
|
|
379
|
-
copyParts.day = findClosestValue(day, filteredDays);
|
|
373
|
+
copyParts.day = findClosestValue(day, dayValues);
|
|
380
374
|
}
|
|
381
375
|
if (yearValues !== undefined) {
|
|
382
|
-
|
|
383
|
-
const filteredYears = yearValues.filter((year) => !(minParts !== undefined && year < minParts.year) && !(maxParts !== undefined && year > maxParts.year));
|
|
384
|
-
copyParts.year = findClosestValue(year, filteredYears);
|
|
376
|
+
copyParts.year = findClosestValue(year, yearValues);
|
|
385
377
|
}
|
|
386
378
|
if (hour !== undefined && hourValues !== undefined) {
|
|
387
|
-
|
|
388
|
-
const filteredHours = hourValues.filter((hour) => {
|
|
389
|
-
if ((minParts === null || minParts === void 0 ? void 0 : minParts.hour) !== undefined && isSameDay(copyParts, minParts) && hour < minParts.hour) {
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.hour) !== undefined && isSameDay(copyParts, maxParts) && hour > maxParts.hour) {
|
|
393
|
-
return false;
|
|
394
|
-
}
|
|
395
|
-
return true;
|
|
396
|
-
});
|
|
397
|
-
copyParts.hour = findClosestValue(hour, filteredHours);
|
|
379
|
+
copyParts.hour = findClosestValue(hour, hourValues);
|
|
398
380
|
copyParts.ampm = parseAmPm(copyParts.hour);
|
|
399
381
|
}
|
|
400
382
|
if (minute !== undefined && minuteValues !== undefined) {
|
|
401
|
-
|
|
402
|
-
const filteredMinutes = minuteValues.filter((minute) => {
|
|
403
|
-
if ((minParts === null || minParts === void 0 ? void 0 : minParts.minute) !== undefined && isSameDay(copyParts, minParts) && minute < minParts.minute) {
|
|
404
|
-
return false;
|
|
405
|
-
}
|
|
406
|
-
if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.minute) !== undefined && isSameDay(copyParts, maxParts) && minute > maxParts.minute) {
|
|
407
|
-
return false;
|
|
408
|
-
}
|
|
409
|
-
return true;
|
|
410
|
-
});
|
|
411
|
-
copyParts.minute = findClosestValue(minute, filteredMinutes);
|
|
383
|
+
copyParts.minute = findClosestValue(minute, minuteValues);
|
|
412
384
|
}
|
|
413
385
|
return copyParts;
|
|
414
386
|
};
|
|
@@ -109,12 +109,20 @@
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
:host .picker-item-empty,
|
|
112
|
-
:host .picker-item
|
|
113
|
-
scroll-snap-align: none;
|
|
112
|
+
:host .picker-item[disabled] {
|
|
114
113
|
cursor: default;
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
:host .picker-item
|
|
116
|
+
:host .picker-item-empty,
|
|
117
|
+
:host(:not([disabled])) .picker-item[disabled] {
|
|
118
|
+
scroll-snap-align: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host([disabled]) {
|
|
122
|
+
overflow-y: hidden;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host .picker-item[disabled] {
|
|
118
126
|
opacity: 0.4;
|
|
119
127
|
}
|
|
120
128
|
|
|
@@ -221,6 +221,7 @@ export class PickerColumnInternal {
|
|
|
221
221
|
this.el.classList.remove('picker-column-active');
|
|
222
222
|
};
|
|
223
223
|
this.isActive = false;
|
|
224
|
+
this.disabled = false;
|
|
224
225
|
this.items = [];
|
|
225
226
|
this.value = undefined;
|
|
226
227
|
this.color = 'primary';
|
|
@@ -318,10 +319,13 @@ export class PickerColumnInternal {
|
|
|
318
319
|
}
|
|
319
320
|
}
|
|
320
321
|
get activeItem() {
|
|
321
|
-
|
|
322
|
+
// If the whole picker column is disabled, the current value should appear active
|
|
323
|
+
// If the current value item is specifically disabled, it should not appear active
|
|
324
|
+
const selector = `.picker-item[data-value="${this.value}"]${this.disabled ? '' : ':not([disabled])'}`;
|
|
325
|
+
return getElementRoot(this.el).querySelector(selector);
|
|
322
326
|
}
|
|
323
327
|
render() {
|
|
324
|
-
const { items, color, isActive, numericInput } = this;
|
|
328
|
+
const { items, color, disabled: pickerDisabled, isActive, numericInput } = this;
|
|
325
329
|
const mode = getIonMode(this);
|
|
326
330
|
/**
|
|
327
331
|
* exportparts is needed so ion-datetime can expose the parts
|
|
@@ -329,11 +333,12 @@ export class PickerColumnInternal {
|
|
|
329
333
|
* the attribute can be moved to datetime.tsx and set on every
|
|
330
334
|
* instance of ion-picker-column-internal there instead.
|
|
331
335
|
*/
|
|
332
|
-
return (h(Host, { exportparts: `${PICKER_ITEM_PART}, ${PICKER_ITEM_ACTIVE_PART}`, tabindex: 0, class: createColorClasses(color, {
|
|
336
|
+
return (h(Host, { exportparts: `${PICKER_ITEM_PART}, ${PICKER_ITEM_ACTIVE_PART}`, disabled: pickerDisabled, tabindex: pickerDisabled ? null : 0, class: createColorClasses(color, {
|
|
333
337
|
[mode]: true,
|
|
334
338
|
['picker-column-active']: isActive,
|
|
335
339
|
['picker-column-numeric-input']: numericInput,
|
|
336
340
|
}) }, h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), items.map((item, index) => {
|
|
341
|
+
const isItemDisabled = pickerDisabled || item.disabled || false;
|
|
337
342
|
{
|
|
338
343
|
/*
|
|
339
344
|
Users should be able to tab
|
|
@@ -346,10 +351,9 @@ export class PickerColumnInternal {
|
|
|
346
351
|
}
|
|
347
352
|
return (h("button", { tabindex: "-1", class: {
|
|
348
353
|
'picker-item': true,
|
|
349
|
-
'picker-item-disabled': item.disabled || false,
|
|
350
354
|
}, "data-value": item.value, "data-index": index, onClick: (ev) => {
|
|
351
355
|
this.centerPickerItemInView(ev.target, true);
|
|
352
|
-
}, disabled:
|
|
356
|
+
}, disabled: isItemDisabled, part: PICKER_ITEM_PART }, item.text));
|
|
353
357
|
}), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0")));
|
|
354
358
|
}
|
|
355
359
|
static get is() { return "ion-picker-column-internal"; }
|
|
@@ -368,6 +372,24 @@ export class PickerColumnInternal {
|
|
|
368
372
|
}
|
|
369
373
|
static get properties() {
|
|
370
374
|
return {
|
|
375
|
+
"disabled": {
|
|
376
|
+
"type": "boolean",
|
|
377
|
+
"mutable": false,
|
|
378
|
+
"complexType": {
|
|
379
|
+
"original": "boolean",
|
|
380
|
+
"resolved": "boolean",
|
|
381
|
+
"references": {}
|
|
382
|
+
},
|
|
383
|
+
"required": false,
|
|
384
|
+
"optional": false,
|
|
385
|
+
"docs": {
|
|
386
|
+
"tags": [],
|
|
387
|
+
"text": "If `true`, the user cannot interact with the picker."
|
|
388
|
+
},
|
|
389
|
+
"attribute": "disabled",
|
|
390
|
+
"reflect": false,
|
|
391
|
+
"defaultValue": "false"
|
|
392
|
+
},
|
|
371
393
|
"items": {
|
|
372
394
|
"type": "unknown",
|
|
373
395
|
"mutable": false,
|
|
@@ -109,12 +109,20 @@
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
:host .picker-item-empty,
|
|
112
|
-
:host .picker-item
|
|
113
|
-
scroll-snap-align: none;
|
|
112
|
+
:host .picker-item[disabled] {
|
|
114
113
|
cursor: default;
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
:host .picker-item
|
|
116
|
+
:host .picker-item-empty,
|
|
117
|
+
:host(:not([disabled])) .picker-item[disabled] {
|
|
118
|
+
scroll-snap-align: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host([disabled]) {
|
|
122
|
+
overflow-y: hidden;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host .picker-item[disabled] {
|
|
118
126
|
opacity: 0.4;
|
|
119
127
|
}
|
|
120
128
|
|
|
@@ -32,7 +32,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
|
|
32
32
|
* This behavior does not vary across modes/directions.
|
|
33
33
|
*/
|
|
34
34
|
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|
35
|
-
test.describe(title('picker-column-internal: disabled'), () => {
|
|
35
|
+
test.describe(title('picker-column-internal: disabled items'), () => {
|
|
36
36
|
test('all picker items should be enabled by default', async ({ page }) => {
|
|
37
37
|
await page.setContent(`
|
|
38
38
|
<ion-picker-internal>
|
|
@@ -48,7 +48,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
|
|
48
48
|
]
|
|
49
49
|
</script>
|
|
50
50
|
`, config);
|
|
51
|
-
const pickerItems = page.locator('ion-picker-column-internal .picker-item:not(.picker-item-empty,
|
|
51
|
+
const pickerItems = page.locator('ion-picker-column-internal .picker-item:not(.picker-item-empty, [disabled])');
|
|
52
52
|
expect(await pickerItems.count()).toBe(3);
|
|
53
53
|
});
|
|
54
54
|
test('disabled picker item should not be interactive', async ({ page }) => {
|
|
@@ -66,7 +66,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
|
|
66
66
|
]
|
|
67
67
|
</script>
|
|
68
68
|
`, config);
|
|
69
|
-
const disabledItem = page.locator('ion-picker-column-internal .picker-item
|
|
69
|
+
const disabledItem = page.locator('ion-picker-column-internal .picker-item[disabled]');
|
|
70
70
|
await expect(disabledItem).not.toBeEnabled();
|
|
71
71
|
});
|
|
72
72
|
test('disabled picker item should not be considered active', async ({ page }) => {
|
|
@@ -106,7 +106,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
|
|
106
106
|
await pickerColumn.evaluate((el) => (el.value = 'b'));
|
|
107
107
|
await page.waitForChanges();
|
|
108
108
|
const disabledItem = page.locator('ion-picker-column-internal .picker-item[data-value="b"]');
|
|
109
|
-
await expect(disabledItem).
|
|
109
|
+
await expect(disabledItem).toBeDisabled();
|
|
110
110
|
await expect(disabledItem).not.toHaveClass(/picker-item-active/);
|
|
111
111
|
});
|
|
112
112
|
test('defaulting the value to a disabled item should not cause that item to be active', async ({ page }) => {
|
|
@@ -126,8 +126,37 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
|
|
126
126
|
</script>
|
|
127
127
|
`, config);
|
|
128
128
|
const disabledItem = page.locator('ion-picker-column-internal .picker-item[data-value="b"]');
|
|
129
|
-
await expect(disabledItem).
|
|
129
|
+
await expect(disabledItem).toBeDisabled();
|
|
130
130
|
await expect(disabledItem).not.toHaveClass(/picker-item-active/);
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
133
|
});
|
|
134
|
+
/**
|
|
135
|
+
* This behavior does not vary across directions.
|
|
136
|
+
*/
|
|
137
|
+
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
|
138
|
+
test.describe(title('picker-column-internal: disabled column rendering'), () => {
|
|
139
|
+
test.beforeEach(async ({ page }) => {
|
|
140
|
+
await page.goto('/src/components/picker-column-internal/test/disabled', config);
|
|
141
|
+
});
|
|
142
|
+
test('disabled column should not have visual regressions', async ({ page }) => {
|
|
143
|
+
const disabledColumn = page.locator('#column-disabled');
|
|
144
|
+
await page.waitForChanges();
|
|
145
|
+
await expect(disabledColumn).toHaveScreenshot(screenshot('picker-internal-disabled-column'));
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
/**
|
|
150
|
+
* This behavior does not vary across modes/directions.
|
|
151
|
+
*/
|
|
152
|
+
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|
153
|
+
test.describe(title('picker-column-internal: disabled column'), () => {
|
|
154
|
+
test.beforeEach(async ({ page }) => {
|
|
155
|
+
await page.goto('/src/components/picker-column-internal/test/disabled', config);
|
|
156
|
+
});
|
|
157
|
+
test('item in disabled column should not be interactive', async ({ page }) => {
|
|
158
|
+
const secondItem = page.locator('#column-disabled .picker-item:not(.picker-item-empty)').nth(1);
|
|
159
|
+
await expect(secondItem).toBeDisabled();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
});
|
|
@@ -340,7 +340,7 @@ export class PickerColumnCmp {
|
|
|
340
340
|
'max-width': this.col.columnWidth,
|
|
341
341
|
} }, col.prefix && (h("div", { class: "picker-prefix", style: { width: col.prefixWidth } }, col.prefix)), h("div", { class: "picker-opts", style: { maxWidth: col.optionsWidth }, ref: (el) => (this.optsEl = el) }, col.options.map((o, index) => (h("button", { "aria-label": o.ariaLabel, class: { 'picker-opt': true, 'picker-opt-disabled': !!o.disabled }, "opt-index": index }, o.text)))), col.suffix && (h("div", { class: "picker-suffix", style: { width: col.suffixWidth } }, col.suffix))));
|
|
342
342
|
}
|
|
343
|
-
static get is() { return "ion-picker-column"; }
|
|
343
|
+
static get is() { return "ion-picker-legacy-column"; }
|
|
344
344
|
static get originalStyleUrls() {
|
|
345
345
|
return {
|
|
346
346
|
"ios": ["picker-column.ios.scss"],
|
|
@@ -364,8 +364,8 @@ export class PickerColumnCmp {
|
|
|
364
364
|
"references": {
|
|
365
365
|
"PickerColumn": {
|
|
366
366
|
"location": "import",
|
|
367
|
-
"path": "../picker/picker-interface",
|
|
368
|
-
"id": "src/components/picker/picker-interface.ts::PickerColumn"
|
|
367
|
+
"path": "../picker-legacy/picker-interface",
|
|
368
|
+
"id": "src/components/picker-legacy/picker-interface.ts::PickerColumn"
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
},
|
|
@@ -398,8 +398,8 @@ export class PickerColumnCmp {
|
|
|
398
398
|
"references": {
|
|
399
399
|
"PickerColumn": {
|
|
400
400
|
"location": "import",
|
|
401
|
-
"path": "../picker/picker-interface",
|
|
402
|
-
"id": "src/components/picker/picker-interface.ts::PickerColumn"
|
|
401
|
+
"path": "../picker-legacy/picker-interface",
|
|
402
|
+
"id": "src/components/picker-legacy/picker-interface.ts::PickerColumn"
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
}
|
|
@@ -25,10 +25,10 @@ describe('picker-column', () => {
|
|
|
25
25
|
};
|
|
26
26
|
const page = await newSpecPage({
|
|
27
27
|
components: [PickerColumnCmp],
|
|
28
|
-
template: () => h("ion-picker-column", { col: col }),
|
|
28
|
+
template: () => h("ion-picker-legacy-column", { col: col }),
|
|
29
29
|
});
|
|
30
|
-
const firstOption = page.body.querySelector('ion-picker-column .picker-opt:nth-child(1)');
|
|
31
|
-
const secondOption = page.body.querySelector('ion-picker-column .picker-opt:nth-child(2)');
|
|
30
|
+
const firstOption = page.body.querySelector('ion-picker-legacy-column .picker-opt:nth-child(1)');
|
|
31
|
+
const secondOption = page.body.querySelector('ion-picker-legacy-column .picker-opt:nth-child(2)');
|
|
32
32
|
expect(firstOption.getAttribute('aria-label')).toBe('C Sharp');
|
|
33
33
|
expect(secondOption.getAttribute('aria-label')).toBe(null);
|
|
34
34
|
});
|
|
@@ -15,9 +15,9 @@ describe('picker-column: dynamic options', () => {
|
|
|
15
15
|
];
|
|
16
16
|
const page = await newSpecPage({
|
|
17
17
|
components: [PickerColumnCmp],
|
|
18
|
-
template: () => h("ion-picker-column", { col: { options: defaultOptions, name: 'animals' } }),
|
|
18
|
+
template: () => (h("ion-picker-legacy-column", { col: { options: defaultOptions, name: 'animals' } })),
|
|
19
19
|
});
|
|
20
|
-
const pickerCol = page.body.querySelector('ion-picker-column');
|
|
20
|
+
const pickerCol = page.body.querySelector('ion-picker-legacy-column');
|
|
21
21
|
pickerCol.col = {
|
|
22
22
|
options: [...defaultOptions, { text: 'Carrot', value: 'carrot' }],
|
|
23
23
|
name: 'vegetables',
|
package/dist/collection/components/{picker-column → picker-column-legacy}/test/picker-column.spec.js
RENAMED
|
@@ -9,9 +9,9 @@ describe('picker-column', () => {
|
|
|
9
9
|
const col = { cssClass: 'test-class', options: [], name: 'col' };
|
|
10
10
|
const page = await newSpecPage({
|
|
11
11
|
components: [PickerColumnCmp],
|
|
12
|
-
template: () => h("ion-picker-column", { col: col }),
|
|
12
|
+
template: () => h("ion-picker-legacy-column", { col: col }),
|
|
13
13
|
});
|
|
14
|
-
const pickerCol = page.body.querySelector('ion-picker-column');
|
|
14
|
+
const pickerCol = page.body.querySelector('ion-picker-legacy-column');
|
|
15
15
|
expect(pickerCol.classList.contains('test-class')).toBe(true);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
@@ -6,11 +6,11 @@ import { configs, test } from "../../../../utils/test/playwright/index";
|
|
|
6
6
|
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|
7
7
|
test.describe(title('picker-column'), () => {
|
|
8
8
|
test.beforeEach(async ({ page }) => {
|
|
9
|
-
await page.goto(`/src/components/picker-column/test/standalone`, config);
|
|
9
|
+
await page.goto(`/src/components/picker-column-legacy/test/standalone`, config);
|
|
10
10
|
});
|
|
11
11
|
test('should present picker without ion-app', async ({ page }) => {
|
|
12
12
|
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
|
13
|
-
const picker = page.locator('ion-picker');
|
|
13
|
+
const picker = page.locator('ion-picker-legacy');
|
|
14
14
|
await page.click('#single-column-button');
|
|
15
15
|
await ionPickerDidPresent.next();
|
|
16
16
|
await expect(picker).toBeVisible();
|
|
@@ -22,7 +22,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
|
|
22
22
|
});
|
|
23
23
|
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
|
24
24
|
const ionPickerColChangeEvent = await page.spyOnEvent('ionPickerColChange');
|
|
25
|
-
const column = page.locator('ion-picker-column');
|
|
25
|
+
const column = page.locator('ion-picker-legacy-column');
|
|
26
26
|
const secondOption = column.locator('.picker-opt').nth(1);
|
|
27
27
|
await page.click('#single-column-button');
|
|
28
28
|
await ionPickerDidPresent.next();
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Host, h } from "@stencil/core";
|
|
5
5
|
import { raf } from "../../utils/helpers";
|
|
6
6
|
import { createLockController } from "../../utils/lock-controller";
|
|
7
|
+
import { printIonWarning } from "../../utils/logging/index";
|
|
7
8
|
import { createDelegateController, createTriggerController, BACKDROP, dismiss, eventMethod, isCancel, prepareOverlay, present, safeCall, setOverlayId, } from "../../utils/overlays";
|
|
8
9
|
import { getClassMap } from "../../utils/theme";
|
|
9
10
|
import { getIonMode } from "../../global/ionic-global";
|
|
@@ -71,6 +72,7 @@ export class Picker {
|
|
|
71
72
|
setOverlayId(this.el);
|
|
72
73
|
}
|
|
73
74
|
componentDidLoad() {
|
|
75
|
+
printIonWarning('ion-picker-legacy and ion-picker-legacy-column have been deprecated in favor of the ion-picker and ion-picker-column components. These new components display inline with your page content allowing for more presentation flexibility than before.', this.el);
|
|
74
76
|
/**
|
|
75
77
|
* If picker was rendered with isOpen="true"
|
|
76
78
|
* then we should open picker immediately.
|
|
@@ -174,9 +176,9 @@ export class Picker {
|
|
|
174
176
|
zIndex: `${20000 + this.overlayIndex}`,
|
|
175
177
|
}, class: Object.assign({ [mode]: true,
|
|
176
178
|
// Used internally for styling
|
|
177
|
-
[`picker-${mode}`]: true, 'overlay-hidden': true }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonPickerWillDismiss: this.dispatchCancelHandler }), h("ion-backdrop", { visible: this.showBackdrop, tappable: this.backdropDismiss }), h("div", { tabindex: "0" }), h("div", { class: "picker-wrapper ion-overlay-wrapper", role: "dialog" }, h("div", { class: "picker-toolbar" }, this.buttons.map((b) => (h("div", { class: buttonWrapperClass(b) }, h("button", { type: "button", onClick: () => this.buttonClick(b), class: buttonClass(b) }, b.text))))), h("div", { class: "picker-columns" }, h("div", { class: "picker-above-highlight" }), this.presented && this.columns.map((c) => h("ion-picker-column", { col: c })), h("div", { class: "picker-below-highlight" }))), h("div", { tabindex: "0" })));
|
|
179
|
+
[`picker-${mode}`]: true, 'overlay-hidden': true }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonPickerWillDismiss: this.dispatchCancelHandler }), h("ion-backdrop", { visible: this.showBackdrop, tappable: this.backdropDismiss }), h("div", { tabindex: "0" }), h("div", { class: "picker-wrapper ion-overlay-wrapper", role: "dialog" }, h("div", { class: "picker-toolbar" }, this.buttons.map((b) => (h("div", { class: buttonWrapperClass(b) }, h("button", { type: "button", onClick: () => this.buttonClick(b), class: buttonClass(b) }, b.text))))), h("div", { class: "picker-columns" }, h("div", { class: "picker-above-highlight" }), this.presented && this.columns.map((c) => h("ion-picker-legacy-column", { col: c })), h("div", { class: "picker-below-highlight" }))), h("div", { tabindex: "0" })));
|
|
178
180
|
}
|
|
179
|
-
static get is() { return "ion-picker"; }
|
|
181
|
+
static get is() { return "ion-picker-legacy"; }
|
|
180
182
|
static get encapsulation() { return "scoped"; }
|
|
181
183
|
static get originalStyleUrls() {
|
|
182
184
|
return {
|
|
@@ -327,7 +329,7 @@ export class Picker {
|
|
|
327
329
|
"PickerButton": {
|
|
328
330
|
"location": "import",
|
|
329
331
|
"path": "./picker-interface",
|
|
330
|
-
"id": "src/components/picker/picker-interface.ts::PickerButton"
|
|
332
|
+
"id": "src/components/picker-legacy/picker-interface.ts::PickerButton"
|
|
331
333
|
}
|
|
332
334
|
}
|
|
333
335
|
},
|
|
@@ -349,7 +351,7 @@ export class Picker {
|
|
|
349
351
|
"PickerColumn": {
|
|
350
352
|
"location": "import",
|
|
351
353
|
"path": "./picker-interface",
|
|
352
|
-
"id": "src/components/picker/picker-interface.ts::PickerColumn"
|
|
354
|
+
"id": "src/components/picker-legacy/picker-interface.ts::PickerColumn"
|
|
353
355
|
}
|
|
354
356
|
}
|
|
355
357
|
},
|
|
@@ -778,7 +780,7 @@ export class Picker {
|
|
|
778
780
|
"PickerColumn": {
|
|
779
781
|
"location": "import",
|
|
780
782
|
"path": "./picker-interface",
|
|
781
|
-
"id": "src/components/picker/picker-interface.ts::PickerColumn"
|
|
783
|
+
"id": "src/components/picker-legacy/picker-interface.ts::PickerColumn"
|
|
782
784
|
}
|
|
783
785
|
},
|
|
784
786
|
"return": "Promise<PickerColumn | undefined>"
|
|
@@ -6,7 +6,7 @@ import { configs, test } from "../../../../utils/test/playwright/index";
|
|
|
6
6
|
configs().forEach(({ title, screenshot, config }) => {
|
|
7
7
|
test.describe(title('picker: basic'), () => {
|
|
8
8
|
test('should not have visual regressions', async ({ page }) => {
|
|
9
|
-
await page.goto('/src/components/picker/test/basic', config);
|
|
9
|
+
await page.goto('/src/components/picker-legacy/test/basic', config);
|
|
10
10
|
const didPresent = await page.spyOnEvent('ionPickerDidPresent');
|
|
11
11
|
const didDismiss = await page.spyOnEvent('ionPickerDidDismiss');
|
|
12
12
|
await page.click('#basic');
|
|
@@ -14,7 +14,7 @@ configs().forEach(({ title, screenshot, config }) => {
|
|
|
14
14
|
await page.waitForChanges();
|
|
15
15
|
await expect(page).toHaveScreenshot(screenshot(`picker-basic`));
|
|
16
16
|
await page.click('.picker-opt:nth-child(2)');
|
|
17
|
-
await page.click('ion-picker .save-btn');
|
|
17
|
+
await page.click('ion-picker-legacy .save-btn');
|
|
18
18
|
await didDismiss.next();
|
|
19
19
|
await page.click('#basic');
|
|
20
20
|
await didPresent.next();
|
|
@@ -9,10 +9,10 @@ import { configs, test } from "../../../../utils/test/playwright/index";
|
|
|
9
9
|
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|
10
10
|
test.describe(title('picker: isOpen'), () => {
|
|
11
11
|
test('should open and close the picker', async ({ page }) => {
|
|
12
|
-
await page.goto('/src/components/picker/test/is-open', config);
|
|
12
|
+
await page.goto('/src/components/picker-legacy/test/is-open', config);
|
|
13
13
|
const ionPickerDidPresent = await page.spyOnEvent('ionPickerDidPresent');
|
|
14
14
|
const ionPickerDidDismiss = await page.spyOnEvent('ionPickerDidDismiss');
|
|
15
|
-
const picker = page.locator('ion-picker');
|
|
15
|
+
const picker = page.locator('ion-picker-legacy');
|
|
16
16
|
await page.click('#default');
|
|
17
17
|
await ionPickerDidPresent.next();
|
|
18
18
|
await expect(picker).toBeVisible();
|
|
@@ -21,8 +21,8 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
|
|
21
21
|
await expect(picker).toBeHidden();
|
|
22
22
|
});
|
|
23
23
|
test('should open if isOpen is true on load', async ({ page }) => {
|
|
24
|
-
await page.setContent('<ion-picker is-open="true"></ion-picker>', config);
|
|
25
|
-
await expect(page.locator('ion-picker')).toBeVisible();
|
|
24
|
+
await page.setContent('<ion-picker-legacy is-open="true"></ion-picker-legacy>', config);
|
|
25
|
+
await expect(page.locator('ion-picker-legacy')).toBeVisible();
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
});
|