@ionic/core 7.5.7-dev.11700601905.13f94170 → 7.5.7-nightly.20231123
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/data.js +13 -41
- package/components/ion-datetime.js +17 -36
- package/components/picker-column-internal.js +12 -7
- package/dist/cjs/{data-88d0864d.js → data-c8d21093.js} +13 -41
- package/dist/cjs/ion-datetime-button.cjs.entry.js +1 -1
- package/dist/cjs/ion-datetime_3.cjs.entry.js +18 -37
- package/dist/cjs/ion-picker-column-internal.cjs.entry.js +11 -7
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/datetime/datetime.js +17 -36
- 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/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/docs.json +11 -11
- package/dist/esm/{data-2b019469.js → data-44d9e816.js} +13 -41
- package/dist/esm/ion-datetime-button.entry.js +1 -1
- package/dist/esm/ion-datetime_3.entry.js +18 -37
- package/dist/esm/ion-picker-column-internal.entry.js +11 -7
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/data-44d9e816.js +4 -0
- 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-picker-column-internal.entry.js +1 -1
- package/dist/esm-es5/ionic.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-17240d90.js +4 -0
- package/dist/ionic/p-29fe18ef.entry.js +4 -0
- package/dist/ionic/p-40903d34.system.js +1 -1
- package/dist/ionic/{p-2743f9a7.system.entry.js → p-4c80afe1.system.entry.js} +1 -1
- package/dist/ionic/p-778af3a7.entry.js +4 -0
- package/dist/ionic/{p-c4c7fd8f.entry.js → p-8ad82eb3.entry.js} +1 -1
- package/dist/ionic/p-957601e8.system.entry.js +4 -0
- package/dist/ionic/p-b8c3f071.system.js +4 -0
- package/dist/ionic/p-c56b6570.system.entry.js +4 -0
- package/dist/types/components/datetime/utils/manipulation.d.ts +15 -34
- package/dist/types/components/picker-column-internal/picker-column-internal.d.ts +4 -0
- package/dist/types/components.d.ts +8 -0
- package/hydrate/index.js +42 -84
- package/package.json +1 -1
- package/dist/collection/components/datetime/test/prefer-wheel/datetime.spec.js +0 -27
- package/dist/esm-es5/data-2b019469.js +0 -4
- package/dist/ionic/p-1108f9bf.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/components/data.js
CHANGED
|
@@ -716,60 +716,32 @@ const validateParts = (parts, minParts, maxParts) => {
|
|
|
716
716
|
* Returns the closest date to refParts
|
|
717
717
|
* that also meets the constraints of
|
|
718
718
|
* the *Values params.
|
|
719
|
+
* @param refParts The reference date
|
|
720
|
+
* @param monthValues The allowed month values
|
|
721
|
+
* @param dayValues The allowed day (of the month) values
|
|
722
|
+
* @param yearValues The allowed year values
|
|
723
|
+
* @param hourValues The allowed hour values
|
|
724
|
+
* @param minuteValues The allowed minute values
|
|
719
725
|
*/
|
|
720
|
-
const getClosestValidDate = (
|
|
726
|
+
const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
|
|
721
727
|
const { hour, minute, day, month, year } = refParts;
|
|
722
|
-
const copyParts =
|
|
728
|
+
const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
|
|
723
729
|
if (monthValues !== undefined) {
|
|
724
|
-
|
|
725
|
-
const filteredMonths = monthValues.filter((month) => !(minParts !== undefined && month < minParts.month) && !(maxParts !== undefined && month > maxParts.month));
|
|
726
|
-
copyParts.month = findClosestValue(month, filteredMonths);
|
|
730
|
+
copyParts.month = findClosestValue(month, monthValues);
|
|
727
731
|
}
|
|
728
732
|
// Day is nullable but cannot be undefined
|
|
729
733
|
if (day !== null && dayValues !== undefined) {
|
|
730
|
-
|
|
731
|
-
const filteredDays = dayValues.filter((day) => {
|
|
732
|
-
if (minParts && isBefore(Object.assign(Object.assign({}, copyParts), { day }), minParts)) {
|
|
733
|
-
return false;
|
|
734
|
-
}
|
|
735
|
-
if (maxParts && isAfter(Object.assign(Object.assign({}, copyParts), { day }), maxParts)) {
|
|
736
|
-
return false;
|
|
737
|
-
}
|
|
738
|
-
return true;
|
|
739
|
-
});
|
|
740
|
-
copyParts.day = findClosestValue(day, filteredDays);
|
|
734
|
+
copyParts.day = findClosestValue(day, dayValues);
|
|
741
735
|
}
|
|
742
736
|
if (yearValues !== undefined) {
|
|
743
|
-
|
|
744
|
-
const filteredYears = yearValues.filter((year) => !(minParts !== undefined && year < minParts.year) && !(maxParts !== undefined && year > maxParts.year));
|
|
745
|
-
copyParts.year = findClosestValue(year, filteredYears);
|
|
737
|
+
copyParts.year = findClosestValue(year, yearValues);
|
|
746
738
|
}
|
|
747
739
|
if (hour !== undefined && hourValues !== undefined) {
|
|
748
|
-
|
|
749
|
-
const filteredHours = hourValues.filter((hour) => {
|
|
750
|
-
if ((minParts === null || minParts === void 0 ? void 0 : minParts.hour) !== undefined && isSameDay(copyParts, minParts) && hour < minParts.hour) {
|
|
751
|
-
return false;
|
|
752
|
-
}
|
|
753
|
-
if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.hour) !== undefined && isSameDay(copyParts, maxParts) && hour > maxParts.hour) {
|
|
754
|
-
return false;
|
|
755
|
-
}
|
|
756
|
-
return true;
|
|
757
|
-
});
|
|
758
|
-
copyParts.hour = findClosestValue(hour, filteredHours);
|
|
740
|
+
copyParts.hour = findClosestValue(hour, hourValues);
|
|
759
741
|
copyParts.ampm = parseAmPm(copyParts.hour);
|
|
760
742
|
}
|
|
761
743
|
if (minute !== undefined && minuteValues !== undefined) {
|
|
762
|
-
|
|
763
|
-
const filteredMinutes = minuteValues.filter((minute) => {
|
|
764
|
-
if ((minParts === null || minParts === void 0 ? void 0 : minParts.minute) !== undefined && isSameDay(copyParts, minParts) && minute < minParts.minute) {
|
|
765
|
-
return false;
|
|
766
|
-
}
|
|
767
|
-
if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.minute) !== undefined && isSameDay(copyParts, maxParts) && minute > maxParts.minute) {
|
|
768
|
-
return false;
|
|
769
|
-
}
|
|
770
|
-
return true;
|
|
771
|
-
});
|
|
772
|
-
copyParts.minute = findClosestValue(minute, filteredMinutes);
|
|
744
|
+
copyParts.minute = findClosestValue(minute, minuteValues);
|
|
773
745
|
}
|
|
774
746
|
return copyParts;
|
|
775
747
|
};
|
|
@@ -867,24 +867,14 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
867
867
|
* or modal that the datetime was presented in.
|
|
868
868
|
*/
|
|
869
869
|
async confirm(closeOverlay = false) {
|
|
870
|
-
const { isCalendarPicker, activeParts
|
|
870
|
+
const { isCalendarPicker, activeParts } = this;
|
|
871
871
|
/**
|
|
872
872
|
* We only update the value if the presentation is not a calendar picker.
|
|
873
873
|
*/
|
|
874
874
|
if (activeParts !== undefined || !isCalendarPicker) {
|
|
875
875
|
const activePartsIsArray = Array.isArray(activeParts);
|
|
876
876
|
if (activePartsIsArray && activeParts.length === 0) {
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
* If the datetime is using a wheel picker, but the
|
|
880
|
-
* active parts are empty, then the user has confirmed the
|
|
881
|
-
* initial value (working parts) presented to them.
|
|
882
|
-
*/
|
|
883
|
-
this.setValue(convertDataToISO(workingParts));
|
|
884
|
-
}
|
|
885
|
-
else {
|
|
886
|
-
this.setValue(undefined);
|
|
887
|
-
}
|
|
877
|
+
this.setValue(undefined);
|
|
888
878
|
}
|
|
889
879
|
else {
|
|
890
880
|
this.setValue(convertDataToISO(activeParts));
|
|
@@ -1088,18 +1078,9 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1088
1078
|
const yearValues = (this.parsedYearValues = convertToArrayOfNumbers(this.yearValues));
|
|
1089
1079
|
const dayValues = (this.parsedDayValues = convertToArrayOfNumbers(this.dayValues));
|
|
1090
1080
|
const todayParts = (this.todayParts = parseDate(getToday()));
|
|
1081
|
+
this.defaultParts = getClosestValidDate(todayParts, monthValues, dayValues, yearValues, hourValues, minuteValues);
|
|
1091
1082
|
this.processMinParts();
|
|
1092
1083
|
this.processMaxParts();
|
|
1093
|
-
this.defaultParts = getClosestValidDate({
|
|
1094
|
-
refParts: todayParts,
|
|
1095
|
-
monthValues,
|
|
1096
|
-
dayValues,
|
|
1097
|
-
yearValues,
|
|
1098
|
-
hourValues,
|
|
1099
|
-
minuteValues,
|
|
1100
|
-
minParts: this.minParts,
|
|
1101
|
-
maxParts: this.maxParts,
|
|
1102
|
-
});
|
|
1103
1084
|
this.processValue(this.value);
|
|
1104
1085
|
this.emitStyle();
|
|
1105
1086
|
}
|
|
@@ -1167,7 +1148,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1167
1148
|
: this.renderIndividualDatePickerColumns(forcePresentation);
|
|
1168
1149
|
}
|
|
1169
1150
|
renderCombinedDatePickerColumn() {
|
|
1170
|
-
const { defaultParts, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
|
|
1151
|
+
const { defaultParts, disabled, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
|
|
1171
1152
|
const activePart = this.getActivePartsWithFallback();
|
|
1172
1153
|
/**
|
|
1173
1154
|
* By default, generate a range of 3 months:
|
|
@@ -1218,7 +1199,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1218
1199
|
const todayString = workingParts.day !== null
|
|
1219
1200
|
? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
|
|
1220
1201
|
: `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
|
|
1221
|
-
return (h("ion-picker-column-internal", { class: "date-column", color: this.color, items: items, value: todayString, onIonChange: (ev) => {
|
|
1202
|
+
return (h("ion-picker-column-internal", { class: "date-column", color: this.color, disabled: disabled, items: items, value: todayString, onIonChange: (ev) => {
|
|
1222
1203
|
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1223
1204
|
// Due to a Safari 14 issue we need to destroy
|
|
1224
1205
|
// the scroll listener before we update state
|
|
@@ -1300,9 +1281,9 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1300
1281
|
if (days.length === 0) {
|
|
1301
1282
|
return [];
|
|
1302
1283
|
}
|
|
1303
|
-
const { workingParts } = this;
|
|
1284
|
+
const { disabled, workingParts } = this;
|
|
1304
1285
|
const activePart = this.getActivePartsWithFallback();
|
|
1305
|
-
return (h("ion-picker-column-internal", { class: "day-column", color: this.color, items: days, value: (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
|
|
1286
|
+
return (h("ion-picker-column-internal", { class: "day-column", color: this.color, disabled: disabled, items: days, value: (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
|
|
1306
1287
|
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1307
1288
|
// Due to a Safari 14 issue we need to destroy
|
|
1308
1289
|
// the scroll listener before we update state
|
|
@@ -1322,9 +1303,9 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1322
1303
|
if (months.length === 0) {
|
|
1323
1304
|
return [];
|
|
1324
1305
|
}
|
|
1325
|
-
const { workingParts } = this;
|
|
1306
|
+
const { disabled, workingParts } = this;
|
|
1326
1307
|
const activePart = this.getActivePartsWithFallback();
|
|
1327
|
-
return (h("ion-picker-column-internal", { class: "month-column", color: this.color, items: months, value: workingParts.month, onIonChange: (ev) => {
|
|
1308
|
+
return (h("ion-picker-column-internal", { class: "month-column", color: this.color, disabled: disabled, items: months, value: workingParts.month, onIonChange: (ev) => {
|
|
1328
1309
|
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1329
1310
|
// Due to a Safari 14 issue we need to destroy
|
|
1330
1311
|
// the scroll listener before we update state
|
|
@@ -1344,9 +1325,9 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1344
1325
|
if (years.length === 0) {
|
|
1345
1326
|
return [];
|
|
1346
1327
|
}
|
|
1347
|
-
const { workingParts } = this;
|
|
1328
|
+
const { disabled, workingParts } = this;
|
|
1348
1329
|
const activePart = this.getActivePartsWithFallback();
|
|
1349
|
-
return (h("ion-picker-column-internal", { class: "year-column", color: this.color, items: years, value: workingParts.year, onIonChange: (ev) => {
|
|
1330
|
+
return (h("ion-picker-column-internal", { class: "year-column", color: this.color, disabled: disabled, items: years, value: workingParts.year, onIonChange: (ev) => {
|
|
1350
1331
|
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1351
1332
|
// Due to a Safari 14 issue we need to destroy
|
|
1352
1333
|
// the scroll listener before we update state
|
|
@@ -1385,35 +1366,35 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1385
1366
|
];
|
|
1386
1367
|
}
|
|
1387
1368
|
renderHourPickerColumn(hoursData) {
|
|
1388
|
-
const { workingParts } = this;
|
|
1369
|
+
const { disabled, workingParts } = this;
|
|
1389
1370
|
if (hoursData.length === 0)
|
|
1390
1371
|
return [];
|
|
1391
1372
|
const activePart = this.getActivePartsWithFallback();
|
|
1392
|
-
return (h("ion-picker-column-internal", { color: this.color, value: activePart.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
|
|
1373
|
+
return (h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
|
|
1393
1374
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
|
1394
1375
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
|
|
1395
1376
|
ev.stopPropagation();
|
|
1396
1377
|
} }));
|
|
1397
1378
|
}
|
|
1398
1379
|
renderMinutePickerColumn(minutesData) {
|
|
1399
|
-
const { workingParts } = this;
|
|
1380
|
+
const { disabled, workingParts } = this;
|
|
1400
1381
|
if (minutesData.length === 0)
|
|
1401
1382
|
return [];
|
|
1402
1383
|
const activePart = this.getActivePartsWithFallback();
|
|
1403
|
-
return (h("ion-picker-column-internal", { color: this.color, value: activePart.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
|
|
1384
|
+
return (h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
|
|
1404
1385
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
|
1405
1386
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
|
|
1406
1387
|
ev.stopPropagation();
|
|
1407
1388
|
} }));
|
|
1408
1389
|
}
|
|
1409
1390
|
renderDayPeriodPickerColumn(dayPeriodData) {
|
|
1410
|
-
const { workingParts } = this;
|
|
1391
|
+
const { disabled, workingParts } = this;
|
|
1411
1392
|
if (dayPeriodData.length === 0) {
|
|
1412
1393
|
return [];
|
|
1413
1394
|
}
|
|
1414
1395
|
const activePart = this.getActivePartsWithFallback();
|
|
1415
1396
|
const isDayPeriodRTL = isLocaleDayPeriodRTL(this.locale);
|
|
1416
|
-
return (h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, value: activePart.ampm, items: dayPeriodData, onIonChange: (ev) => {
|
|
1397
|
+
return (h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, items: dayPeriodData, onIonChange: (ev) => {
|
|
1417
1398
|
const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
1418
1399
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
1419
1400
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
|
|
@@ -7,9 +7,9 @@ import { a as hapticSelectionStart, b as hapticSelectionChanged, h as hapticSele
|
|
|
7
7
|
import { a as isPlatform, b as getIonMode } from './ionic-global.js';
|
|
8
8
|
import { c as createColorClasses } from './theme.js';
|
|
9
9
|
|
|
10
|
-
const pickerColumnInternalIosCss = ":host{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item.picker-item-disabled{scroll-snap-align:none
|
|
10
|
+
const pickerColumnInternalIosCss = ":host{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item[disabled]{cursor:default}:host .picker-item-empty,:host(:not([disabled])) .picker-item[disabled]{scroll-snap-align:none}:host([disabled]){overflow-y:hidden}:host .picker-item[disabled]{opacity:0.4}:host(.picker-column-active) .picker-item.picker-item-active{color:var(--ion-color-base)}@media (any-hover: hover){:host(:focus){outline:none;background:rgba(var(--ion-color-base-rgb), 0.2)}}";
|
|
11
11
|
|
|
12
|
-
const pickerColumnInternalMdCss = ":host{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item.picker-item-disabled{scroll-snap-align:none
|
|
12
|
+
const pickerColumnInternalMdCss = ":host{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item[disabled]{cursor:default}:host .picker-item-empty,:host(:not([disabled])) .picker-item[disabled]{scroll-snap-align:none}:host([disabled]){overflow-y:hidden}:host .picker-item[disabled]{opacity:0.4}:host(.picker-column-active) .picker-item.picker-item-active{color:var(--ion-color-base)}@media (any-hover: hover){:host(:focus){outline:none;background:rgba(var(--ion-color-base-rgb), 0.2)}}:host .picker-item-active{color:var(--ion-color-base)}";
|
|
13
13
|
|
|
14
14
|
const PickerColumnInternal = /*@__PURE__*/ proxyCustomElement(class PickerColumnInternal extends HTMLElement {
|
|
15
15
|
constructor() {
|
|
@@ -225,6 +225,7 @@ const PickerColumnInternal = /*@__PURE__*/ proxyCustomElement(class PickerColumn
|
|
|
225
225
|
this.el.classList.remove('picker-column-active');
|
|
226
226
|
};
|
|
227
227
|
this.isActive = false;
|
|
228
|
+
this.disabled = false;
|
|
228
229
|
this.items = [];
|
|
229
230
|
this.value = undefined;
|
|
230
231
|
this.color = 'primary';
|
|
@@ -322,10 +323,13 @@ const PickerColumnInternal = /*@__PURE__*/ proxyCustomElement(class PickerColumn
|
|
|
322
323
|
}
|
|
323
324
|
}
|
|
324
325
|
get activeItem() {
|
|
325
|
-
|
|
326
|
+
// If the whole picker column is disabled, the current value should appear active
|
|
327
|
+
// If the current value item is specifically disabled, it should not appear active
|
|
328
|
+
const selector = `.picker-item[data-value="${this.value}"]${this.disabled ? '' : ':not([disabled])'}`;
|
|
329
|
+
return getElementRoot(this.el).querySelector(selector);
|
|
326
330
|
}
|
|
327
331
|
render() {
|
|
328
|
-
const { items, color, isActive, numericInput } = this;
|
|
332
|
+
const { items, color, disabled: pickerDisabled, isActive, numericInput } = this;
|
|
329
333
|
const mode = getIonMode(this);
|
|
330
334
|
/**
|
|
331
335
|
* exportparts is needed so ion-datetime can expose the parts
|
|
@@ -333,17 +337,17 @@ const PickerColumnInternal = /*@__PURE__*/ proxyCustomElement(class PickerColumn
|
|
|
333
337
|
* the attribute can be moved to datetime.tsx and set on every
|
|
334
338
|
* instance of ion-picker-column-internal there instead.
|
|
335
339
|
*/
|
|
336
|
-
return (h(Host, { exportparts: `${PICKER_ITEM_PART}, ${PICKER_ITEM_ACTIVE_PART}`, tabindex: 0, class: createColorClasses(color, {
|
|
340
|
+
return (h(Host, { exportparts: `${PICKER_ITEM_PART}, ${PICKER_ITEM_ACTIVE_PART}`, disabled: pickerDisabled, tabindex: pickerDisabled ? null : 0, class: createColorClasses(color, {
|
|
337
341
|
[mode]: true,
|
|
338
342
|
['picker-column-active']: isActive,
|
|
339
343
|
['picker-column-numeric-input']: numericInput,
|
|
340
344
|
}) }, 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) => {
|
|
345
|
+
const isItemDisabled = pickerDisabled || item.disabled || false;
|
|
341
346
|
return (h("button", { tabindex: "-1", class: {
|
|
342
347
|
'picker-item': true,
|
|
343
|
-
'picker-item-disabled': item.disabled || false,
|
|
344
348
|
}, "data-value": item.value, "data-index": index, onClick: (ev) => {
|
|
345
349
|
this.centerPickerItemInView(ev.target, true);
|
|
346
|
-
}, disabled:
|
|
350
|
+
}, disabled: isItemDisabled, part: PICKER_ITEM_PART }, item.text));
|
|
347
351
|
}), 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")));
|
|
348
352
|
}
|
|
349
353
|
get el() { return this; }
|
|
@@ -355,6 +359,7 @@ const PickerColumnInternal = /*@__PURE__*/ proxyCustomElement(class PickerColumn
|
|
|
355
359
|
md: pickerColumnInternalMdCss
|
|
356
360
|
}; }
|
|
357
361
|
}, [33, "ion-picker-column-internal", {
|
|
362
|
+
"disabled": [4],
|
|
358
363
|
"items": [16],
|
|
359
364
|
"value": [1032],
|
|
360
365
|
"color": [513],
|
|
@@ -718,60 +718,32 @@ const validateParts = (parts, minParts, maxParts) => {
|
|
|
718
718
|
* Returns the closest date to refParts
|
|
719
719
|
* that also meets the constraints of
|
|
720
720
|
* the *Values params.
|
|
721
|
+
* @param refParts The reference date
|
|
722
|
+
* @param monthValues The allowed month values
|
|
723
|
+
* @param dayValues The allowed day (of the month) values
|
|
724
|
+
* @param yearValues The allowed year values
|
|
725
|
+
* @param hourValues The allowed hour values
|
|
726
|
+
* @param minuteValues The allowed minute values
|
|
721
727
|
*/
|
|
722
|
-
const getClosestValidDate = (
|
|
728
|
+
const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
|
|
723
729
|
const { hour, minute, day, month, year } = refParts;
|
|
724
|
-
const copyParts =
|
|
730
|
+
const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
|
|
725
731
|
if (monthValues !== undefined) {
|
|
726
|
-
|
|
727
|
-
const filteredMonths = monthValues.filter((month) => !(minParts !== undefined && month < minParts.month) && !(maxParts !== undefined && month > maxParts.month));
|
|
728
|
-
copyParts.month = findClosestValue(month, filteredMonths);
|
|
732
|
+
copyParts.month = findClosestValue(month, monthValues);
|
|
729
733
|
}
|
|
730
734
|
// Day is nullable but cannot be undefined
|
|
731
735
|
if (day !== null && dayValues !== undefined) {
|
|
732
|
-
|
|
733
|
-
const filteredDays = dayValues.filter((day) => {
|
|
734
|
-
if (minParts && isBefore(Object.assign(Object.assign({}, copyParts), { day }), minParts)) {
|
|
735
|
-
return false;
|
|
736
|
-
}
|
|
737
|
-
if (maxParts && isAfter(Object.assign(Object.assign({}, copyParts), { day }), maxParts)) {
|
|
738
|
-
return false;
|
|
739
|
-
}
|
|
740
|
-
return true;
|
|
741
|
-
});
|
|
742
|
-
copyParts.day = findClosestValue(day, filteredDays);
|
|
736
|
+
copyParts.day = findClosestValue(day, dayValues);
|
|
743
737
|
}
|
|
744
738
|
if (yearValues !== undefined) {
|
|
745
|
-
|
|
746
|
-
const filteredYears = yearValues.filter((year) => !(minParts !== undefined && year < minParts.year) && !(maxParts !== undefined && year > maxParts.year));
|
|
747
|
-
copyParts.year = findClosestValue(year, filteredYears);
|
|
739
|
+
copyParts.year = findClosestValue(year, yearValues);
|
|
748
740
|
}
|
|
749
741
|
if (hour !== undefined && hourValues !== undefined) {
|
|
750
|
-
|
|
751
|
-
const filteredHours = hourValues.filter((hour) => {
|
|
752
|
-
if ((minParts === null || minParts === void 0 ? void 0 : minParts.hour) !== undefined && isSameDay(copyParts, minParts) && hour < minParts.hour) {
|
|
753
|
-
return false;
|
|
754
|
-
}
|
|
755
|
-
if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.hour) !== undefined && isSameDay(copyParts, maxParts) && hour > maxParts.hour) {
|
|
756
|
-
return false;
|
|
757
|
-
}
|
|
758
|
-
return true;
|
|
759
|
-
});
|
|
760
|
-
copyParts.hour = findClosestValue(hour, filteredHours);
|
|
742
|
+
copyParts.hour = findClosestValue(hour, hourValues);
|
|
761
743
|
copyParts.ampm = parseAmPm(copyParts.hour);
|
|
762
744
|
}
|
|
763
745
|
if (minute !== undefined && minuteValues !== undefined) {
|
|
764
|
-
|
|
765
|
-
const filteredMinutes = minuteValues.filter((minute) => {
|
|
766
|
-
if ((minParts === null || minParts === void 0 ? void 0 : minParts.minute) !== undefined && isSameDay(copyParts, minParts) && minute < minParts.minute) {
|
|
767
|
-
return false;
|
|
768
|
-
}
|
|
769
|
-
if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.minute) !== undefined && isSameDay(copyParts, maxParts) && minute > maxParts.minute) {
|
|
770
|
-
return false;
|
|
771
|
-
}
|
|
772
|
-
return true;
|
|
773
|
-
});
|
|
774
|
-
copyParts.minute = findClosestValue(minute, filteredMinutes);
|
|
746
|
+
copyParts.minute = findClosestValue(minute, minuteValues);
|
|
775
747
|
}
|
|
776
748
|
return copyParts;
|
|
777
749
|
};
|
|
@@ -10,7 +10,7 @@ const helpers = require('./helpers-ea4ccbcb.js');
|
|
|
10
10
|
const index$1 = require('./index-cc7dfb7c.js');
|
|
11
11
|
const theme = require('./theme-fbc56b3b.js');
|
|
12
12
|
const ionicGlobal = require('./ionic-global-ea2901a3.js');
|
|
13
|
-
const data = require('./data-
|
|
13
|
+
const data = require('./data-c8d21093.js');
|
|
14
14
|
|
|
15
15
|
const iosDatetimeButtonCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";
|
|
16
16
|
|
|
@@ -13,7 +13,7 @@ const dir = require('./dir-f1e0ca26.js');
|
|
|
13
13
|
const theme = require('./theme-fbc56b3b.js');
|
|
14
14
|
const index$2 = require('./index-09471526.js');
|
|
15
15
|
const ionicGlobal = require('./ionic-global-ea2901a3.js');
|
|
16
|
-
const data = require('./data-
|
|
16
|
+
const data = require('./data-c8d21093.js');
|
|
17
17
|
const lockController = require('./lock-controller-4ae2eb59.js');
|
|
18
18
|
const overlays = require('./overlays-2ffc5f27.js');
|
|
19
19
|
const animation = require('./animation-1083855c.js');
|
|
@@ -866,24 +866,14 @@ const Datetime = class {
|
|
|
866
866
|
* or modal that the datetime was presented in.
|
|
867
867
|
*/
|
|
868
868
|
async confirm(closeOverlay = false) {
|
|
869
|
-
const { isCalendarPicker, activeParts
|
|
869
|
+
const { isCalendarPicker, activeParts } = this;
|
|
870
870
|
/**
|
|
871
871
|
* We only update the value if the presentation is not a calendar picker.
|
|
872
872
|
*/
|
|
873
873
|
if (activeParts !== undefined || !isCalendarPicker) {
|
|
874
874
|
const activePartsIsArray = Array.isArray(activeParts);
|
|
875
875
|
if (activePartsIsArray && activeParts.length === 0) {
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* If the datetime is using a wheel picker, but the
|
|
879
|
-
* active parts are empty, then the user has confirmed the
|
|
880
|
-
* initial value (working parts) presented to them.
|
|
881
|
-
*/
|
|
882
|
-
this.setValue(data.convertDataToISO(workingParts));
|
|
883
|
-
}
|
|
884
|
-
else {
|
|
885
|
-
this.setValue(undefined);
|
|
886
|
-
}
|
|
876
|
+
this.setValue(undefined);
|
|
887
877
|
}
|
|
888
878
|
else {
|
|
889
879
|
this.setValue(data.convertDataToISO(activeParts));
|
|
@@ -1087,18 +1077,9 @@ const Datetime = class {
|
|
|
1087
1077
|
const yearValues = (this.parsedYearValues = data.convertToArrayOfNumbers(this.yearValues));
|
|
1088
1078
|
const dayValues = (this.parsedDayValues = data.convertToArrayOfNumbers(this.dayValues));
|
|
1089
1079
|
const todayParts = (this.todayParts = data.parseDate(data.getToday()));
|
|
1080
|
+
this.defaultParts = data.getClosestValidDate(todayParts, monthValues, dayValues, yearValues, hourValues, minuteValues);
|
|
1090
1081
|
this.processMinParts();
|
|
1091
1082
|
this.processMaxParts();
|
|
1092
|
-
this.defaultParts = data.getClosestValidDate({
|
|
1093
|
-
refParts: todayParts,
|
|
1094
|
-
monthValues,
|
|
1095
|
-
dayValues,
|
|
1096
|
-
yearValues,
|
|
1097
|
-
hourValues,
|
|
1098
|
-
minuteValues,
|
|
1099
|
-
minParts: this.minParts,
|
|
1100
|
-
maxParts: this.maxParts,
|
|
1101
|
-
});
|
|
1102
1083
|
this.processValue(this.value);
|
|
1103
1084
|
this.emitStyle();
|
|
1104
1085
|
}
|
|
@@ -1166,7 +1147,7 @@ const Datetime = class {
|
|
|
1166
1147
|
: this.renderIndividualDatePickerColumns(forcePresentation);
|
|
1167
1148
|
}
|
|
1168
1149
|
renderCombinedDatePickerColumn() {
|
|
1169
|
-
const { defaultParts, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
|
|
1150
|
+
const { defaultParts, disabled, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
|
|
1170
1151
|
const activePart = this.getActivePartsWithFallback();
|
|
1171
1152
|
/**
|
|
1172
1153
|
* By default, generate a range of 3 months:
|
|
@@ -1217,7 +1198,7 @@ const Datetime = class {
|
|
|
1217
1198
|
const todayString = workingParts.day !== null
|
|
1218
1199
|
? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
|
|
1219
1200
|
: `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
|
|
1220
|
-
return (index$1.h("ion-picker-column-internal", { class: "date-column", color: this.color, items: items, value: todayString, onIonChange: (ev) => {
|
|
1201
|
+
return (index$1.h("ion-picker-column-internal", { class: "date-column", color: this.color, disabled: disabled, items: items, value: todayString, onIonChange: (ev) => {
|
|
1221
1202
|
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1222
1203
|
// Due to a Safari 14 issue we need to destroy
|
|
1223
1204
|
// the scroll listener before we update state
|
|
@@ -1299,9 +1280,9 @@ const Datetime = class {
|
|
|
1299
1280
|
if (days.length === 0) {
|
|
1300
1281
|
return [];
|
|
1301
1282
|
}
|
|
1302
|
-
const { workingParts } = this;
|
|
1283
|
+
const { disabled, workingParts } = this;
|
|
1303
1284
|
const activePart = this.getActivePartsWithFallback();
|
|
1304
|
-
return (index$1.h("ion-picker-column-internal", { class: "day-column", color: this.color, items: days, value: (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
|
|
1285
|
+
return (index$1.h("ion-picker-column-internal", { class: "day-column", color: this.color, disabled: disabled, items: days, value: (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
|
|
1305
1286
|
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1306
1287
|
// Due to a Safari 14 issue we need to destroy
|
|
1307
1288
|
// the scroll listener before we update state
|
|
@@ -1321,9 +1302,9 @@ const Datetime = class {
|
|
|
1321
1302
|
if (months.length === 0) {
|
|
1322
1303
|
return [];
|
|
1323
1304
|
}
|
|
1324
|
-
const { workingParts } = this;
|
|
1305
|
+
const { disabled, workingParts } = this;
|
|
1325
1306
|
const activePart = this.getActivePartsWithFallback();
|
|
1326
|
-
return (index$1.h("ion-picker-column-internal", { class: "month-column", color: this.color, items: months, value: workingParts.month, onIonChange: (ev) => {
|
|
1307
|
+
return (index$1.h("ion-picker-column-internal", { class: "month-column", color: this.color, disabled: disabled, items: months, value: workingParts.month, onIonChange: (ev) => {
|
|
1327
1308
|
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1328
1309
|
// Due to a Safari 14 issue we need to destroy
|
|
1329
1310
|
// the scroll listener before we update state
|
|
@@ -1343,9 +1324,9 @@ const Datetime = class {
|
|
|
1343
1324
|
if (years.length === 0) {
|
|
1344
1325
|
return [];
|
|
1345
1326
|
}
|
|
1346
|
-
const { workingParts } = this;
|
|
1327
|
+
const { disabled, workingParts } = this;
|
|
1347
1328
|
const activePart = this.getActivePartsWithFallback();
|
|
1348
|
-
return (index$1.h("ion-picker-column-internal", { class: "year-column", color: this.color, items: years, value: workingParts.year, onIonChange: (ev) => {
|
|
1329
|
+
return (index$1.h("ion-picker-column-internal", { class: "year-column", color: this.color, disabled: disabled, items: years, value: workingParts.year, onIonChange: (ev) => {
|
|
1349
1330
|
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1350
1331
|
// Due to a Safari 14 issue we need to destroy
|
|
1351
1332
|
// the scroll listener before we update state
|
|
@@ -1384,35 +1365,35 @@ const Datetime = class {
|
|
|
1384
1365
|
];
|
|
1385
1366
|
}
|
|
1386
1367
|
renderHourPickerColumn(hoursData) {
|
|
1387
|
-
const { workingParts } = this;
|
|
1368
|
+
const { disabled, workingParts } = this;
|
|
1388
1369
|
if (hoursData.length === 0)
|
|
1389
1370
|
return [];
|
|
1390
1371
|
const activePart = this.getActivePartsWithFallback();
|
|
1391
|
-
return (index$1.h("ion-picker-column-internal", { color: this.color, value: activePart.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
|
|
1372
|
+
return (index$1.h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
|
|
1392
1373
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
|
1393
1374
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
|
|
1394
1375
|
ev.stopPropagation();
|
|
1395
1376
|
} }));
|
|
1396
1377
|
}
|
|
1397
1378
|
renderMinutePickerColumn(minutesData) {
|
|
1398
|
-
const { workingParts } = this;
|
|
1379
|
+
const { disabled, workingParts } = this;
|
|
1399
1380
|
if (minutesData.length === 0)
|
|
1400
1381
|
return [];
|
|
1401
1382
|
const activePart = this.getActivePartsWithFallback();
|
|
1402
|
-
return (index$1.h("ion-picker-column-internal", { color: this.color, value: activePart.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
|
|
1383
|
+
return (index$1.h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
|
|
1403
1384
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
|
1404
1385
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
|
|
1405
1386
|
ev.stopPropagation();
|
|
1406
1387
|
} }));
|
|
1407
1388
|
}
|
|
1408
1389
|
renderDayPeriodPickerColumn(dayPeriodData) {
|
|
1409
|
-
const { workingParts } = this;
|
|
1390
|
+
const { disabled, workingParts } = this;
|
|
1410
1391
|
if (dayPeriodData.length === 0) {
|
|
1411
1392
|
return [];
|
|
1412
1393
|
}
|
|
1413
1394
|
const activePart = this.getActivePartsWithFallback();
|
|
1414
1395
|
const isDayPeriodRTL = data.isLocaleDayPeriodRTL(this.locale);
|
|
1415
|
-
return (index$1.h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, value: activePart.ampm, items: dayPeriodData, onIonChange: (ev) => {
|
|
1396
|
+
return (index$1.h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, items: dayPeriodData, onIonChange: (ev) => {
|
|
1416
1397
|
const hour = data.calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
1417
1398
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
1418
1399
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
|
|
@@ -13,9 +13,9 @@ const theme = require('./theme-fbc56b3b.js');
|
|
|
13
13
|
require('./capacitor-2ffba62a.js');
|
|
14
14
|
require('./index-306a7476.js');
|
|
15
15
|
|
|
16
|
-
const pickerColumnInternalIosCss = ":host{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item.picker-item-disabled{scroll-snap-align:none
|
|
16
|
+
const pickerColumnInternalIosCss = ":host{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item[disabled]{cursor:default}:host .picker-item-empty,:host(:not([disabled])) .picker-item[disabled]{scroll-snap-align:none}:host([disabled]){overflow-y:hidden}:host .picker-item[disabled]{opacity:0.4}:host(.picker-column-active) .picker-item.picker-item-active{color:var(--ion-color-base)}@media (any-hover: hover){:host(:focus){outline:none;background:rgba(var(--ion-color-base-rgb), 0.2)}}";
|
|
17
17
|
|
|
18
|
-
const pickerColumnInternalMdCss = ":host{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item.picker-item-disabled{scroll-snap-align:none
|
|
18
|
+
const pickerColumnInternalMdCss = ":host{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item[disabled]{cursor:default}:host .picker-item-empty,:host(:not([disabled])) .picker-item[disabled]{scroll-snap-align:none}:host([disabled]){overflow-y:hidden}:host .picker-item[disabled]{opacity:0.4}:host(.picker-column-active) .picker-item.picker-item-active{color:var(--ion-color-base)}@media (any-hover: hover){:host(:focus){outline:none;background:rgba(var(--ion-color-base-rgb), 0.2)}}:host .picker-item-active{color:var(--ion-color-base)}";
|
|
19
19
|
|
|
20
20
|
const PickerColumnInternal = class {
|
|
21
21
|
constructor(hostRef) {
|
|
@@ -229,6 +229,7 @@ const PickerColumnInternal = class {
|
|
|
229
229
|
this.el.classList.remove('picker-column-active');
|
|
230
230
|
};
|
|
231
231
|
this.isActive = false;
|
|
232
|
+
this.disabled = false;
|
|
232
233
|
this.items = [];
|
|
233
234
|
this.value = undefined;
|
|
234
235
|
this.color = 'primary';
|
|
@@ -326,10 +327,13 @@ const PickerColumnInternal = class {
|
|
|
326
327
|
}
|
|
327
328
|
}
|
|
328
329
|
get activeItem() {
|
|
329
|
-
|
|
330
|
+
// If the whole picker column is disabled, the current value should appear active
|
|
331
|
+
// If the current value item is specifically disabled, it should not appear active
|
|
332
|
+
const selector = `.picker-item[data-value="${this.value}"]${this.disabled ? '' : ':not([disabled])'}`;
|
|
333
|
+
return helpers.getElementRoot(this.el).querySelector(selector);
|
|
330
334
|
}
|
|
331
335
|
render() {
|
|
332
|
-
const { items, color, isActive, numericInput } = this;
|
|
336
|
+
const { items, color, disabled: pickerDisabled, isActive, numericInput } = this;
|
|
333
337
|
const mode = ionicGlobal.getIonMode(this);
|
|
334
338
|
/**
|
|
335
339
|
* exportparts is needed so ion-datetime can expose the parts
|
|
@@ -337,17 +341,17 @@ const PickerColumnInternal = class {
|
|
|
337
341
|
* the attribute can be moved to datetime.tsx and set on every
|
|
338
342
|
* instance of ion-picker-column-internal there instead.
|
|
339
343
|
*/
|
|
340
|
-
return (index.h(index.Host, { exportparts: `${PICKER_ITEM_PART}, ${PICKER_ITEM_ACTIVE_PART}`, tabindex: 0, class: theme.createColorClasses(color, {
|
|
344
|
+
return (index.h(index.Host, { exportparts: `${PICKER_ITEM_PART}, ${PICKER_ITEM_ACTIVE_PART}`, disabled: pickerDisabled, tabindex: pickerDisabled ? null : 0, class: theme.createColorClasses(color, {
|
|
341
345
|
[mode]: true,
|
|
342
346
|
['picker-column-active']: isActive,
|
|
343
347
|
['picker-column-numeric-input']: numericInput,
|
|
344
348
|
}) }, index.h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), index.h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), index.h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), items.map((item, index$1) => {
|
|
349
|
+
const isItemDisabled = pickerDisabled || item.disabled || false;
|
|
345
350
|
return (index.h("button", { tabindex: "-1", class: {
|
|
346
351
|
'picker-item': true,
|
|
347
|
-
'picker-item-disabled': item.disabled || false,
|
|
348
352
|
}, "data-value": item.value, "data-index": index$1, onClick: (ev) => {
|
|
349
353
|
this.centerPickerItemInView(ev.target, true);
|
|
350
|
-
}, disabled:
|
|
354
|
+
}, disabled: isItemDisabled, part: PICKER_ITEM_PART }, item.text));
|
|
351
355
|
}), index.h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), index.h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), index.h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0")));
|
|
352
356
|
}
|
|
353
357
|
get el() { return index.getElement(this); }
|