@ionic/core 7.3.2-nightly.20230825 → 7.3.2-nightly.20230829
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 +16 -2
- package/dist/cjs/{data-2a87e11f.js → data-967b9c15.js} +16 -2
- package/dist/cjs/ion-datetime-button.cjs.entry.js +1 -1
- package/dist/cjs/ion-datetime_3.cjs.entry.js +1 -1
- package/dist/collection/components/datetime/utils/parse.js +16 -2
- package/dist/docs.json +1 -1
- package/dist/esm/{data-834f9822.js → data-4b448e3a.js} +16 -2
- package/dist/esm/ion-datetime-button.entry.js +1 -1
- package/dist/esm/ion-datetime_3.entry.js +1 -1
- package/dist/esm-es5/data-4b448e3a.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/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-737a8573.entry.js → p-564aaba3.entry.js} +1 -1
- package/dist/ionic/p-601fd53c.js +4 -0
- package/dist/ionic/p-721933ff.system.js +1 -1
- package/dist/ionic/{p-77913af5.entry.js → p-b1e8f045.entry.js} +1 -1
- package/dist/ionic/{p-65403c81.system.entry.js → p-b3cfc6e1.system.entry.js} +1 -1
- package/dist/ionic/p-cc8910e7.system.js +4 -0
- package/dist/ionic/{p-b22ee955.system.entry.js → p-dd0b6889.system.entry.js} +1 -1
- package/dist/types/components/datetime/utils/parse.d.ts +2 -2
- package/hydrate/index.js +16 -2
- package/package.json +1 -1
- package/dist/esm-es5/data-834f9822.js +0 -4
- package/dist/ionic/p-7618d0c2.system.js +0 -4
- package/dist/ionic/p-a2d804ae.js +0 -4
package/components/data.js
CHANGED
|
@@ -245,7 +245,14 @@ const parseAmPm = (hour) => {
|
|
|
245
245
|
* month, day, hour, and minute information.
|
|
246
246
|
*/
|
|
247
247
|
const parseMaxParts = (max, todayParts) => {
|
|
248
|
-
const
|
|
248
|
+
const result = parseDate(max);
|
|
249
|
+
/**
|
|
250
|
+
* If min was not a valid date then return undefined.
|
|
251
|
+
*/
|
|
252
|
+
if (result === undefined) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const { month, day, year, hour, minute } = result;
|
|
249
256
|
/**
|
|
250
257
|
* When passing in `max` or `min`, developers
|
|
251
258
|
* can pass in any ISO-8601 string. This means
|
|
@@ -278,7 +285,14 @@ const parseMaxParts = (max, todayParts) => {
|
|
|
278
285
|
* month, day, hour, and minute information.
|
|
279
286
|
*/
|
|
280
287
|
const parseMinParts = (min, todayParts) => {
|
|
281
|
-
const
|
|
288
|
+
const result = parseDate(min);
|
|
289
|
+
/**
|
|
290
|
+
* If min was not a valid date then return undefined.
|
|
291
|
+
*/
|
|
292
|
+
if (result === undefined) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const { month, day, year, hour, minute } = result;
|
|
282
296
|
/**
|
|
283
297
|
* When passing in `max` or `min`, developers
|
|
284
298
|
* can pass in any ISO-8601 string. This means
|
|
@@ -247,7 +247,14 @@ const parseAmPm = (hour) => {
|
|
|
247
247
|
* month, day, hour, and minute information.
|
|
248
248
|
*/
|
|
249
249
|
const parseMaxParts = (max, todayParts) => {
|
|
250
|
-
const
|
|
250
|
+
const result = parseDate(max);
|
|
251
|
+
/**
|
|
252
|
+
* If min was not a valid date then return undefined.
|
|
253
|
+
*/
|
|
254
|
+
if (result === undefined) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const { month, day, year, hour, minute } = result;
|
|
251
258
|
/**
|
|
252
259
|
* When passing in `max` or `min`, developers
|
|
253
260
|
* can pass in any ISO-8601 string. This means
|
|
@@ -280,7 +287,14 @@ const parseMaxParts = (max, todayParts) => {
|
|
|
280
287
|
* month, day, hour, and minute information.
|
|
281
288
|
*/
|
|
282
289
|
const parseMinParts = (min, todayParts) => {
|
|
283
|
-
const
|
|
290
|
+
const result = parseDate(min);
|
|
291
|
+
/**
|
|
292
|
+
* If min was not a valid date then return undefined.
|
|
293
|
+
*/
|
|
294
|
+
if (result === undefined) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const { month, day, year, hour, minute } = result;
|
|
284
298
|
/**
|
|
285
299
|
* When passing in `max` or `min`, developers
|
|
286
300
|
* can pass in any ISO-8601 string. This means
|
|
@@ -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-f81d8b73.js');
|
|
13
|
-
const data = require('./data-
|
|
13
|
+
const data = require('./data-967b9c15.js');
|
|
14
14
|
|
|
15
15
|
const iosDatetimeButtonCss = ":host{display:-ms-flexbox;display:flex;-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:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden}: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-d8d1fc0b.js');
|
|
15
15
|
const ionicGlobal = require('./ionic-global-f81d8b73.js');
|
|
16
|
-
const data = require('./data-
|
|
16
|
+
const data = require('./data-967b9c15.js');
|
|
17
17
|
const overlays = require('./overlays-0ea06fcb.js');
|
|
18
18
|
const animation = require('./animation-2bb33618.js');
|
|
19
19
|
const haptic = require('./haptic-c5f6b4d5.js');
|
|
@@ -107,7 +107,14 @@ export const parseAmPm = (hour) => {
|
|
|
107
107
|
* month, day, hour, and minute information.
|
|
108
108
|
*/
|
|
109
109
|
export const parseMaxParts = (max, todayParts) => {
|
|
110
|
-
const
|
|
110
|
+
const result = parseDate(max);
|
|
111
|
+
/**
|
|
112
|
+
* If min was not a valid date then return undefined.
|
|
113
|
+
*/
|
|
114
|
+
if (result === undefined) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const { month, day, year, hour, minute } = result;
|
|
111
118
|
/**
|
|
112
119
|
* When passing in `max` or `min`, developers
|
|
113
120
|
* can pass in any ISO-8601 string. This means
|
|
@@ -140,7 +147,14 @@ export const parseMaxParts = (max, todayParts) => {
|
|
|
140
147
|
* month, day, hour, and minute information.
|
|
141
148
|
*/
|
|
142
149
|
export const parseMinParts = (min, todayParts) => {
|
|
143
|
-
const
|
|
150
|
+
const result = parseDate(min);
|
|
151
|
+
/**
|
|
152
|
+
* If min was not a valid date then return undefined.
|
|
153
|
+
*/
|
|
154
|
+
if (result === undefined) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const { month, day, year, hour, minute } = result;
|
|
144
158
|
/**
|
|
145
159
|
* When passing in `max` or `min`, developers
|
|
146
160
|
* can pass in any ISO-8601 string. This means
|
package/dist/docs.json
CHANGED
|
@@ -245,7 +245,14 @@ const parseAmPm = (hour) => {
|
|
|
245
245
|
* month, day, hour, and minute information.
|
|
246
246
|
*/
|
|
247
247
|
const parseMaxParts = (max, todayParts) => {
|
|
248
|
-
const
|
|
248
|
+
const result = parseDate(max);
|
|
249
|
+
/**
|
|
250
|
+
* If min was not a valid date then return undefined.
|
|
251
|
+
*/
|
|
252
|
+
if (result === undefined) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const { month, day, year, hour, minute } = result;
|
|
249
256
|
/**
|
|
250
257
|
* When passing in `max` or `min`, developers
|
|
251
258
|
* can pass in any ISO-8601 string. This means
|
|
@@ -278,7 +285,14 @@ const parseMaxParts = (max, todayParts) => {
|
|
|
278
285
|
* month, day, hour, and minute information.
|
|
279
286
|
*/
|
|
280
287
|
const parseMinParts = (min, todayParts) => {
|
|
281
|
-
const
|
|
288
|
+
const result = parseDate(min);
|
|
289
|
+
/**
|
|
290
|
+
* If min was not a valid date then return undefined.
|
|
291
|
+
*/
|
|
292
|
+
if (result === undefined) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const { month, day, year, hour, minute } = result;
|
|
282
296
|
/**
|
|
283
297
|
* When passing in `max` or `min`, developers
|
|
284
298
|
* can pass in any ISO-8601 string. This means
|
|
@@ -6,7 +6,7 @@ import { a as addEventListener, c as componentOnReady } from './helpers-3379ba19
|
|
|
6
6
|
import { a as printIonError } from './index-595d62c9.js';
|
|
7
7
|
import { c as createColorClasses } from './theme-17531cdf.js';
|
|
8
8
|
import { b as getIonMode } from './ionic-global-1ef19007.js';
|
|
9
|
-
import { q as parseDate, t as getToday, J as is24Hour, S as getLocalizedDateTime, G as getMonthAndYear, K as getLocalizedTime, T as getMonthDayAndYear } from './data-
|
|
9
|
+
import { q as parseDate, t as getToday, J as is24Hour, S as getLocalizedDateTime, G as getMonthAndYear, K as getLocalizedTime, T as getMonthDayAndYear } from './data-4b448e3a.js';
|
|
10
10
|
|
|
11
11
|
const iosDatetimeButtonCss = ":host{display:-ms-flexbox;display:flex;-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:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden}: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}";
|
|
12
12
|
|
|
@@ -9,7 +9,7 @@ import { i as isRTL } from './dir-912e3e13.js';
|
|
|
9
9
|
import { c as createColorClasses, g as getClassMap } from './theme-17531cdf.js';
|
|
10
10
|
import { c as chevronBack, o as chevronForward, l as chevronDown, p as caretUpSharp, q as caretDownSharp } from './index-ecfc2c9f.js';
|
|
11
11
|
import { b as getIonMode } from './ionic-global-1ef19007.js';
|
|
12
|
-
import { g as generateDayAriaLabel, a as getDay, i as isBefore, b as isAfter, c as isSameDay, d as getPreviousMonth, e as getNextMonth, v as validateParts, f as getPartsFromCalendarDay, h as getEndOfWeek, j as getStartOfWeek, k as getPreviousDay, l as getNextDay, m as getPreviousWeek, n as getNextWeek, p as parseMinParts, o as parseMaxParts, q as parseDate, w as warnIfValueOutOfBounds, r as convertToArrayOfNumbers, s as convertDataToISO, t as getToday, u as getClosestValidDate, x as getNumDaysInMonth, y as getCombinedDateColumnData, z as getMonthColumnData, A as getDayColumnData, B as getYearColumnData, C as isMonthFirstLocale, D as getTimeColumnsData, E as isLocaleDayPeriodRTL, F as getDaysOfWeek, G as getMonthAndYear, H as getDaysOfMonth, I as generateMonths, J as is24Hour, K as getLocalizedTime, L as getMonthAndDay, M as formatValue, N as getNextYear, O as getPreviousYear, P as clampDate, Q as parseAmPm, R as calculateHourFromAMPM } from './data-
|
|
12
|
+
import { g as generateDayAriaLabel, a as getDay, i as isBefore, b as isAfter, c as isSameDay, d as getPreviousMonth, e as getNextMonth, v as validateParts, f as getPartsFromCalendarDay, h as getEndOfWeek, j as getStartOfWeek, k as getPreviousDay, l as getNextDay, m as getPreviousWeek, n as getNextWeek, p as parseMinParts, o as parseMaxParts, q as parseDate, w as warnIfValueOutOfBounds, r as convertToArrayOfNumbers, s as convertDataToISO, t as getToday, u as getClosestValidDate, x as getNumDaysInMonth, y as getCombinedDateColumnData, z as getMonthColumnData, A as getDayColumnData, B as getYearColumnData, C as isMonthFirstLocale, D as getTimeColumnsData, E as isLocaleDayPeriodRTL, F as getDaysOfWeek, G as getMonthAndYear, H as getDaysOfMonth, I as generateMonths, J as is24Hour, K as getLocalizedTime, L as getMonthAndDay, M as formatValue, N as getNextYear, O as getPreviousYear, P as clampDate, Q as parseAmPm, R as calculateHourFromAMPM } from './data-4b448e3a.js';
|
|
13
13
|
import { d as createDelegateController, e as createTriggerController, B as BACKDROP, i as isCancel, j as prepareOverlay, k as setOverlayId, f as present, g as dismiss, h as eventMethod, s as safeCall } from './overlays-c3387ec0.js';
|
|
14
14
|
import { c as createAnimation } from './animation-a1d9e088.js';
|
|
15
15
|
import { b as hapticSelectionChanged, h as hapticSelectionEnd, a as hapticSelectionStart } from './haptic-6447af60.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{__spreadArray}from"tslib";
|
|
2
|
+
/*!
|
|
3
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
4
|
+
*/import{p as printIonWarning}from"./index-595d62c9.js";var isSameDay=function(e,a){return e.month===a.month&&e.day===a.day&&e.year===a.year};var isBefore=function(e,a){return!!(e.year<a.year||e.year===a.year&&e.month<a.month||e.year===a.year&&e.month===a.month&&e.day!==null&&e.day<a.day)};var isAfter=function(e,a){return!!(e.year>a.year||e.year===a.year&&e.month>a.month||e.year===a.year&&e.month===a.month&&e.day!==null&&e.day>a.day)};var warnIfValueOutOfBounds=function(e,a,r){var t=Array.isArray(e)?e:[e];for(var n=0,o=t;n<o.length;n++){var i=o[n];if(a!==undefined&&isBefore(i,a)||r!==undefined&&isAfter(i,r)){printIonWarning("The value provided to ion-datetime is out of bounds.\n\n"+"Min: ".concat(JSON.stringify(a),"\n")+"Max: ".concat(JSON.stringify(r),"\n")+"Value: ".concat(JSON.stringify(e)));break}}};var isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0};var is24Hour=function(e,a){if(a!==undefined){return a==="h23"}var r=new Intl.DateTimeFormat(e,{hour:"numeric"});var t=r.resolvedOptions();if(t.hourCycle!==undefined){return t.hourCycle==="h23"}var n=new Date("5/18/2021 00:00");var o=r.formatToParts(n);var i=o.find((function(e){return e.type==="hour"}));if(!i){throw new Error("Hour value not found from DateTimeFormat")}return i.value==="00"};var getNumDaysInMonth=function(e,a){return e===4||e===6||e===9||e===11?30:e===2?isLeapYear(a)?29:28:31};var isMonthFirstLocale=function(e,a){if(a===void 0){a={month:"numeric",year:"numeric"}}var r=new Intl.DateTimeFormat(e,a).formatToParts(new Date);return r[0].type==="month"};var isLocaleDayPeriodRTL=function(e){var a=new Intl.DateTimeFormat(e,{hour:"numeric"}).formatToParts(new Date);return a[0].type==="dayPeriod"};var ISO_8601_REGEXP=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;var TIME_REGEXP=/^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;var convertToArrayOfNumbers=function(e){if(e===undefined){return}var a=e;if(typeof e==="string"){a=e.replace(/\[|\]|\s/g,"").split(",")}var r;if(Array.isArray(a)){r=a.map((function(e){return parseInt(e,10)})).filter(isFinite)}else{r=[a]}return r};var getPartsFromCalendarDay=function(e){return{month:parseInt(e.getAttribute("data-month"),10),day:parseInt(e.getAttribute("data-day"),10),year:parseInt(e.getAttribute("data-year"),10),dayOfWeek:parseInt(e.getAttribute("data-day-of-week"),10)}};function parseDate(e){if(Array.isArray(e)){return e.map((function(e){return parseDate(e)}))}var a=null;if(e!=null&&e!==""){a=TIME_REGEXP.exec(e);if(a){a.unshift(undefined,undefined);a[2]=a[3]=undefined}else{a=ISO_8601_REGEXP.exec(e)}}if(a===null){return undefined}for(var r=1;r<8;r++){a[r]=a[r]!==undefined?parseInt(a[r],10):undefined}return{year:a[1],month:a[2],day:a[3],hour:a[4],minute:a[5],ampm:a[4]<12?"am":"pm"}}var clampDate=function(e,a,r){if(a&&isBefore(e,a)){return a}else if(r&&isAfter(e,r)){return r}return e};var parseAmPm=function(e){return e>=12?"pm":"am"};var parseMaxParts=function(e,a){var r=parseDate(e);if(r===undefined){return}var t=r.month,n=r.day,o=r.year,i=r.hour,u=r.minute;var d=o!==null&&o!==void 0?o:a.year;var f=t!==null&&t!==void 0?t:12;return{month:f,day:n!==null&&n!==void 0?n:getNumDaysInMonth(f,d),year:d,hour:i!==null&&i!==void 0?i:23,minute:u!==null&&u!==void 0?u:59}};var parseMinParts=function(e,a){var r=parseDate(e);if(r===undefined){return}var t=r.month,n=r.day,o=r.year,i=r.hour,u=r.minute;return{month:t!==null&&t!==void 0?t:1,day:n!==null&&n!==void 0?n:1,year:o!==null&&o!==void 0?o:a.year,hour:i!==null&&i!==void 0?i:0,minute:u!==null&&u!==void 0?u:0}};var twoDigit=function(e){return("0"+(e!==undefined?Math.abs(e):"0")).slice(-2)};var fourDigit=function(e){return("000"+(e!==undefined?Math.abs(e):"0")).slice(-4)};function convertDataToISO(e){if(Array.isArray(e)){return e.map((function(e){return convertDataToISO(e)}))}var a="";if(e.year!==undefined){a=fourDigit(e.year);if(e.month!==undefined){a+="-"+twoDigit(e.month);if(e.day!==undefined){a+="-"+twoDigit(e.day);if(e.hour!==undefined){a+="T".concat(twoDigit(e.hour),":").concat(twoDigit(e.minute),":00")}}}}else if(e.hour!==undefined){a=twoDigit(e.hour)+":"+twoDigit(e.minute)}return a}var convert12HourTo24Hour=function(e,a){if(a===undefined){return e}if(a==="am"){if(e===12){return 0}return e}if(e===12){return 12}return e+12};var getStartOfWeek=function(e){var a=e.dayOfWeek;if(a===null||a===undefined){throw new Error("No day of week provided")}return subtractDays(e,a)};var getEndOfWeek=function(e){var a=e.dayOfWeek;if(a===null||a===undefined){throw new Error("No day of week provided")}return addDays(e,6-a)};var getNextDay=function(e){return addDays(e,1)};var getPreviousDay=function(e){return subtractDays(e,1)};var getPreviousWeek=function(e){return subtractDays(e,7)};var getNextWeek=function(e){return addDays(e,7)};var subtractDays=function(e,a){var r=e.month,t=e.day,n=e.year;if(t===null){throw new Error("No day provided")}var o={month:r,day:t,year:n};o.day=t-a;if(o.day<1){o.month-=1}if(o.month<1){o.month=12;o.year-=1}if(o.day<1){var i=getNumDaysInMonth(o.month,o.year);o.day=i+o.day}return o};var addDays=function(e,a){var r=e.month,t=e.day,n=e.year;if(t===null){throw new Error("No day provided")}var o={month:r,day:t,year:n};var i=getNumDaysInMonth(r,n);o.day=t+a;if(o.day>i){o.day-=i;o.month+=1}if(o.month>12){o.month=1;o.year+=1}return o};var getPreviousMonth=function(e){var a=e.month===1?12:e.month-1;var r=e.month===1?e.year-1:e.year;var t=getNumDaysInMonth(a,r);var n=t<e.day?t:e.day;return{month:a,year:r,day:n}};var getNextMonth=function(e){var a=e.month===12?1:e.month+1;var r=e.month===12?e.year+1:e.year;var t=getNumDaysInMonth(a,r);var n=t<e.day?t:e.day;return{month:a,year:r,day:n}};var changeYear=function(e,a){var r=e.month;var t=e.year+a;var n=getNumDaysInMonth(r,t);var o=n<e.day?n:e.day;return{month:r,year:t,day:o}};var getPreviousYear=function(e){return changeYear(e,-1)};var getNextYear=function(e){return changeYear(e,1)};var getInternalHourValue=function(e,a,r){if(a){return e}return convert12HourTo24Hour(e,r)};var calculateHourFromAMPM=function(e,a){var r=e.ampm,t=e.hour;var n=t;if(r==="am"&&a==="pm"){n=convert12HourTo24Hour(n,"pm")}else if(r==="pm"&&a==="am"){n=Math.abs(n-12)}return n};var validateParts=function(e,a,r){var t=e.month,n=e.day,o=e.year;var i=clampDate(Object.assign({},e),a,r);var u=getNumDaysInMonth(t,o);if(n!==null&&u<n){i.day=u}if(a!==undefined&&isSameDay(i,a)){if(i.hour!==undefined&&a.hour!==undefined){if(i.hour<a.hour){i.hour=a.hour;i.minute=a.minute}else if(i.hour===a.hour&&i.minute!==undefined&&a.minute!==undefined&&i.minute<a.minute){i.minute=a.minute}}}if(r!==undefined&&isSameDay(e,r)){if(i.hour!==undefined&&r.hour!==undefined){if(i.hour>r.hour){i.hour=r.hour;i.minute=r.minute}else if(i.hour===r.hour&&i.minute!==undefined&&r.minute!==undefined&&i.minute>r.minute){i.minute=r.minute}}}return i};var getClosestValidDate=function(e,a,r,t,n,o){var i=e.hour,u=e.minute,d=e.day,f=e.month,m=e.year;var s=Object.assign(Object.assign({},e),{dayOfWeek:undefined});if(a!==undefined){s.month=findClosestValue(f,a)}if(d!==null&&r!==undefined){s.day=findClosestValue(d,r)}if(t!==undefined){s.year=findClosestValue(m,t)}if(i!==undefined&&n!==undefined){s.hour=findClosestValue(i,n);s.ampm=parseAmPm(s.hour)}if(u!==undefined&&o!==undefined){s.minute=findClosestValue(u,o)}return s};var findClosestValue=function(e,a){var r=a[0];var t=Math.abs(r-e);for(var n=1;n<a.length;n++){var o=a[n];var i=Math.abs(o-e);if(i<t){r=o;t=i}}return r};var getFormattedDayPeriod=function(e){if(e===undefined){return""}return e.toUpperCase()};var getLocalizedTime=function(e,a,r){var t={hour:a.hour,minute:a.minute};if(t.hour===undefined||t.minute===undefined){return"Invalid Time"}return new Intl.DateTimeFormat(e,{hour:"numeric",minute:"numeric",timeZone:"UTC",hourCycle:r?"h23":"h12"}).format(new Date(convertDataToISO(Object.assign({year:2023,day:1,month:1},t))+"Z"))};var addTimePadding=function(e){var a=e.toString();if(a.length>1){return a}return"0".concat(a)};var getFormattedHour=function(e,a){if(a){return addTimePadding(e)}if(e===0){return"12"}return e.toString()};var generateDayAriaLabel=function(e,a,r){if(r.day===null){return null}var t=getNormalizedDate(r);var n=new Intl.DateTimeFormat(e,{weekday:"long",month:"long",day:"numeric",timeZone:"UTC"}).format(t);return a?"Today, ".concat(n):n};var getMonthAndDay=function(e,a){var r=getNormalizedDate(a);return new Intl.DateTimeFormat(e,{weekday:"short",month:"short",day:"numeric",timeZone:"UTC"}).format(r)};var getMonthAndYear=function(e,a){var r=getNormalizedDate(a);return new Intl.DateTimeFormat(e,{month:"long",year:"numeric",timeZone:"UTC"}).format(r)};var getMonthDayAndYear=function(e,a){return getLocalizedDateTime(e,a,{month:"short",day:"numeric",year:"numeric"})};var getDay=function(e,a){return getLocalizedDateTimeParts(e,a,{day:"numeric"}).find((function(e){return e.type==="day"})).value};var getYear=function(e,a){return getLocalizedDateTime(e,a,{year:"numeric"})};var getNormalizedDate=function(e){var a,r,t;var n=e.hour!==undefined&&e.minute!==undefined?" ".concat(e.hour,":").concat(e.minute):"";return new Date("".concat((a=e.month)!==null&&a!==void 0?a:1,"/").concat((r=e.day)!==null&&r!==void 0?r:1,"/").concat((t=e.year)!==null&&t!==void 0?t:2023).concat(n," GMT+0000"))};var getLocalizedDateTime=function(e,a,r){var t=getNormalizedDate(a);return getDateTimeFormat(e,r).format(t)};var getLocalizedDateTimeParts=function(e,a,r){var t=getNormalizedDate(a);return getDateTimeFormat(e,r).formatToParts(t)};var getDateTimeFormat=function(e,a){return new Intl.DateTimeFormat(e,Object.assign(Object.assign({},a),{timeZone:"UTC"}))};var getTodayLabel=function(e){if("RelativeTimeFormat"in Intl){var a=new Intl.RelativeTimeFormat(e,{numeric:"auto"}).format(0,"day");return a.charAt(0).toUpperCase()+a.slice(1)}else{return"Today"}};var removeDateTzOffset=function(e){var a=e.getTimezoneOffset();e.setMinutes(e.getMinutes()-a);return e};var DATE_AM=removeDateTzOffset(new Date("2022T01:00"));var DATE_PM=removeDateTzOffset(new Date("2022T13:00"));var getLocalizedDayPeriod=function(e,a){var r=a==="am"?DATE_AM:DATE_PM;var t=new Intl.DateTimeFormat(e,{hour:"numeric",timeZone:"UTC"}).formatToParts(r).find((function(e){return e.type==="dayPeriod"}));if(t){return t.value}return getFormattedDayPeriod(a)};var formatValue=function(e){return Array.isArray(e)?e.join(","):e};var getToday=function(){return removeDateTzOffset(new Date).toISOString()};var minutes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59];var hour12=[0,1,2,3,4,5,6,7,8,9,10,11];var hour23=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23];var getDaysOfWeek=function(e,a,r){if(r===void 0){r=0}var t=a==="ios"?"short":"narrow";var n=new Intl.DateTimeFormat(e,{weekday:t});var o=new Date("11/01/2020");var i=[];for(var u=r;u<r+7;u++){var d=new Date(o);d.setDate(d.getDate()+u);i.push(n.format(d))}return i};var getDaysOfMonth=function(e,a,r){var t=getNumDaysInMonth(e,a);var n=new Date("".concat(e,"/1/").concat(a)).getDay();var o=n>=r?n-(r+1):6-(r-n);var i=[];for(var u=1;u<=t;u++){i.push({day:u,dayOfWeek:(o+u)%7})}for(var u=0;u<=o;u++){i=__spreadArray([{day:null,dayOfWeek:null}],i,true)}return i};var generateTime=function(e,a,r,t,n,o){if(a===void 0){a="h12"}var i=a==="h23";var u=i?hour23:hour12;var d=minutes;var f=true;var m=true;if(n){u=u.filter((function(e){return n.includes(e)}))}if(o){d=d.filter((function(e){return o.includes(e)}))}if(r){if(isSameDay(e,r)){if(r.hour!==undefined){u=u.filter((function(a){var t=e.ampm==="pm"?(a+12)%24:a;return(i?a:t)>=r.hour}));f=r.hour<13}if(r.minute!==undefined){var s=false;if(r.hour!==undefined&&e.hour!==undefined){if(e.hour>r.hour){s=true}}d=d.filter((function(e){if(s){return true}return e>=r.minute}))}}else if(isBefore(e,r)){u=[];d=[];f=m=false}}if(t){if(isSameDay(e,t)){if(t.hour!==undefined){u=u.filter((function(a){var r=e.ampm==="pm"?(a+12)%24:a;return(i?a:r)<=t.hour}));m=t.hour>=12}if(t.minute!==undefined&&e.hour===t.hour){d=d.filter((function(e){return e<=t.minute}))}}else if(isAfter(e,t)){u=[];d=[];f=m=false}}return{hours:u,minutes:d,am:f,pm:m}};var generateMonths=function(e){return[getPreviousMonth(e),{month:e.month,year:e.year,day:e.day},getNextMonth(e)]};var getMonthColumnData=function(e,a,r,t,n,o){if(o===void 0){o={month:"long"}}var i=a.year;var u=[];if(n!==undefined){var d=n;if((t===null||t===void 0?void 0:t.month)!==undefined){d=d.filter((function(e){return e<=t.month}))}if((r===null||r===void 0?void 0:r.month)!==undefined){d=d.filter((function(e){return e>=r.month}))}d.forEach((function(a){var r=new Date("".concat(a,"/1/").concat(i," GMT+0000"));var t=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},o),{timeZone:"UTC"})).format(r);u.push({text:t,value:a})}))}else{var f=t&&t.year===i?t.month:12;var m=r&&r.year===i?r.month:1;for(var s=m;s<=f;s++){var v=new Date("".concat(s,"/1/").concat(i," GMT+0000"));var l=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},o),{timeZone:"UTC"})).format(v);u.push({text:l,value:s})}}return u};var getDayColumnData=function(e,a,r,t,n,o){if(o===void 0){o={day:"numeric"}}var i=a.month,u=a.year;var d=[];var f=getNumDaysInMonth(i,u);var m=(t===null||t===void 0?void 0:t.day)!==null&&(t===null||t===void 0?void 0:t.day)!==undefined&&t.year===u&&t.month===i?t.day:f;var s=(r===null||r===void 0?void 0:r.day)!==null&&(r===null||r===void 0?void 0:r.day)!==undefined&&r.year===u&&r.month===i?r.day:1;if(n!==undefined){var v=n;v=v.filter((function(e){return e>=s&&e<=m}));v.forEach((function(a){var r=new Date("".concat(i,"/").concat(a,"/").concat(u," GMT+0000"));var t=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},o),{timeZone:"UTC"})).format(r);d.push({text:t,value:a})}))}else{for(var l=s;l<=m;l++){var y=new Date("".concat(i,"/").concat(l,"/").concat(u," GMT+0000"));var c=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},o),{timeZone:"UTC"})).format(y);d.push({text:c,value:l})}}return d};var getYearColumnData=function(e,a,r,t,n){var o,i;var u=[];if(n!==undefined){u=n;if((t===null||t===void 0?void 0:t.year)!==undefined){u=u.filter((function(e){return e<=t.year}))}if((r===null||r===void 0?void 0:r.year)!==undefined){u=u.filter((function(e){return e>=r.year}))}}else{var d=a.year;var f=(o=t===null||t===void 0?void 0:t.year)!==null&&o!==void 0?o:d;var m=(i=r===null||r===void 0?void 0:r.year)!==null&&i!==void 0?i:d-100;for(var s=m;s<=f;s++){u.push(s)}}return u.map((function(r){return{text:getYear(e,{year:r,month:a.month,day:a.day}),value:r}}))};var getAllMonthsInRange=function(e,a){if(e.month===a.month&&e.year===a.year){return[e]}return __spreadArray([e],getAllMonthsInRange(getNextMonth(e),a),true)};var getCombinedDateColumnData=function(e,a,r,t,n,o){var i=[];var u=[];var d=getAllMonthsInRange(r,t);if(o){d=d.filter((function(e){var a=e.month;return o.includes(a)}))}d.forEach((function(o){var d={month:o.month,day:null,year:o.year};var f=getDayColumnData(e,d,r,t,n,{month:"short",day:"numeric",weekday:"short"});var m=[];var s=[];f.forEach((function(r){var t=isSameDay(Object.assign(Object.assign({},d),{day:r.value}),a);s.push({text:t?getTodayLabel(e):r.text,value:"".concat(d.year,"-").concat(d.month,"-").concat(r.value)});m.push({month:d.month,year:d.year,day:r.value})}));u=__spreadArray(__spreadArray([],u,true),m,true);i=__spreadArray(__spreadArray([],i,true),s,true)}));return{parts:u,items:i}};var getTimeColumnsData=function(e,a,r,t,n,o,i){var u=is24Hour(e,r);var d=generateTime(a,u?"h23":"h12",t,n,o,i),f=d.hours,m=d.minutes,s=d.am,v=d.pm;var l=f.map((function(e){return{text:getFormattedHour(e,u),value:getInternalHourValue(e,u,a.ampm)}}));var y=m.map((function(e){return{text:addTimePadding(e),value:e}}));var c=[];if(s&&!u){c.push({text:getLocalizedDayPeriod(e,"am"),value:"am"})}if(v&&!u){c.push({text:getLocalizedDayPeriod(e,"pm"),value:"pm"})}return{minutesData:y,hoursData:l,dayPeriodData:c}};export{getDayColumnData as A,getYearColumnData as B,isMonthFirstLocale as C,getTimeColumnsData as D,isLocaleDayPeriodRTL as E,getDaysOfWeek as F,getMonthAndYear as G,getDaysOfMonth as H,generateMonths as I,is24Hour as J,getLocalizedTime as K,getMonthAndDay as L,formatValue as M,getNextYear as N,getPreviousYear as O,clampDate as P,parseAmPm as Q,calculateHourFromAMPM as R,getLocalizedDateTime as S,getMonthDayAndYear as T,getDay as a,isAfter as b,isSameDay as c,getPreviousMonth as d,getNextMonth as e,getPartsFromCalendarDay as f,generateDayAriaLabel as g,getEndOfWeek as h,isBefore as i,getStartOfWeek as j,getPreviousDay as k,getNextDay as l,getPreviousWeek as m,getNextWeek as n,parseMaxParts as o,parseMinParts as p,parseDate as q,convertToArrayOfNumbers as r,convertDataToISO as s,getToday as t,getClosestValidDate as u,validateParts as v,warnIfValueOutOfBounds as w,getNumDaysInMonth as x,getCombinedDateColumnData as y,getMonthColumnData as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{__awaiter,__generator}from"tslib";
|
|
2
2
|
/*!
|
|
3
3
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
4
|
-
*/import{r as registerInstance,h,H as Host,f as getElement}from"./index-847f2fde.js";import{a as addEventListener,c as componentOnReady}from"./helpers-3379ba19.js";import{a as printIonError}from"./index-595d62c9.js";import{c as createColorClasses}from"./theme-17531cdf.js";import{b as getIonMode}from"./ionic-global-1ef19007.js";import{q as parseDate,t as getToday,J as is24Hour,S as getLocalizedDateTime,G as getMonthAndYear,K as getLocalizedTime,T as getMonthDayAndYear}from"./data-
|
|
4
|
+
*/import{r as registerInstance,h,H as Host,f as getElement}from"./index-847f2fde.js";import{a as addEventListener,c as componentOnReady}from"./helpers-3379ba19.js";import{a as printIonError}from"./index-595d62c9.js";import{c as createColorClasses}from"./theme-17531cdf.js";import{b as getIonMode}from"./ionic-global-1ef19007.js";import{q as parseDate,t as getToday,J as is24Hour,S as getLocalizedDateTime,G as getMonthAndYear,K as getLocalizedTime,T as getMonthDayAndYear}from"./data-4b448e3a.js";var iosDatetimeButtonCss=":host{display:-ms-flexbox;display:flex;-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:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden}: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}";var mdDatetimeButtonCss=":host{display:-ms-flexbox;display:flex;-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:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden}: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}";var DatetimeButton=function(){function e(e){var t=this;registerInstance(this,e);this.datetimeEl=null;this.overlayEl=null;this.getParsedDateValues=function(e){if(e===undefined||e===null){return[]}if(Array.isArray(e)){return e}return[e]};this.setDateTimeText=function(){var e=t,a=e.datetimeEl,i=e.datetimePresentation;if(!a){return}var n=a.value,r=a.locale,o=a.hourCycle,s=a.preferWheel,d=a.multiple,c=a.titleSelectedDatesFormatter;var l=t.getParsedDateValues(n);var m=parseDate(l.length>0?l:[getToday()]);var u=m[0];var p=is24Hour(r,o);t.dateText=t.timeText=undefined;switch(i){case"date-time":case"time-date":var f=getMonthDayAndYear(r,u);var h=getLocalizedTime(r,u,p);if(s){t.dateText="".concat(f," ").concat(h)}else{t.dateText=f;t.timeText=h}break;case"date":if(d&&l.length!==1){var b="".concat(l.length," days");if(c!==undefined){try{b=c(l)}catch(e){printIonError("Exception in provided `titleSelectedDatesFormatter`: ",e)}}t.dateText=b}else{t.dateText=getMonthDayAndYear(r,u)}break;case"time":t.timeText=getLocalizedTime(r,u,p);break;case"month-year":t.dateText=getMonthAndYear(r,u);break;case"month":t.dateText=getLocalizedDateTime(r,u,{month:"long"});break;case"year":t.dateText=getLocalizedDateTime(r,u,{year:"numeric"});break}};this.waitForDatetimeChanges=function(){return __awaiter(t,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=this.datetimeEl;if(!e){return[2,Promise.resolve()]}return[2,new Promise((function(t){addEventListener(e,"ionRender",t,{once:true})}))]}))}))};this.handleDateClick=function(e){return __awaiter(t,void 0,void 0,(function(){var t,a,i,n,r;return __generator(this,(function(o){t=this,a=t.datetimeEl,i=t.datetimePresentation;if(!a){return[2]}n=false;switch(i){case"date-time":case"time-date":r=a.presentation!=="date";if(!a.preferWheel&&r){a.presentation="date";n=true}break}this.selectedButton="date";this.presentOverlay(e,n,this.dateTargetEl);return[2]}))}))};this.handleTimeClick=function(e){var a=t,i=a.datetimeEl,n=a.datetimePresentation;if(!i){return}var r=false;switch(n){case"date-time":case"time-date":var o=i.presentation!=="time";if(o){i.presentation="time";r=true}break}t.selectedButton="time";t.presentOverlay(e,r,t.timeTargetEl)};this.presentOverlay=function(e,a,i){return __awaiter(t,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:t=this.overlayEl;if(!t){return[2]}if(!(t.tagName==="ION-POPOVER"))return[3,3];if(!a)return[3,2];return[4,this.waitForDatetimeChanges()];case 1:n.sent();n.label=2;case 2:t.present(Object.assign(Object.assign({},e),{detail:{ionShadowTarget:i}}));return[3,4];case 3:t.present();n.label=4;case 4:return[2]}}))}))};this.datetimePresentation="date-time";this.dateText=undefined;this.timeText=undefined;this.datetimeActive=false;this.selectedButton=undefined;this.color="primary";this.disabled=false;this.datetime=undefined}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,a,i;var n=this;return __generator(this,(function(r){e=this.datetime;if(!e){printIonError("An ID associated with an ion-datetime instance is required for ion-datetime-button to function properly.",this.el);return[2]}t=this.datetimeEl=document.getElementById(e);if(!t){printIonError("No ion-datetime instance found for ID '".concat(e,"'."),this.el);return[2]}if(t.tagName!=="ION-DATETIME"){printIonError("Expected an ion-datetime instance for ID '".concat(e,"' but received '").concat(t.tagName.toLowerCase(),"' instead."),t);return[2]}a=new IntersectionObserver((function(e){var t=e[0];n.datetimeActive=t.isIntersecting}),{threshold:.01});a.observe(t);i=this.overlayEl=t.closest("ion-modal, ion-popover");if(i){i.classList.add("ion-datetime-button-overlay")}componentOnReady(t,(function(){var e=n.datetimePresentation=t.presentation||"date-time";n.setDateTimeText();addEventListener(t,"ionValueChange",n.setDateTimeText);switch(e){case"date-time":case"date":case"month-year":case"month":case"year":n.selectedButton="date";break;case"time-date":case"time":n.selectedButton="time";break}}));return[2]}))}))};e.prototype.render=function(){var e;var t=this;var a=this,i=a.color,n=a.dateText,r=a.timeText,o=a.selectedButton,s=a.datetimeActive,d=a.disabled;var c=getIonMode(this);return h(Host,{class:createColorClasses(i,(e={},e[c]=true,e["".concat(o,"-active")]=s,e["datetime-button-disabled"]=d,e))},n&&h("button",{class:"ion-activatable",id:"date-button","aria-expanded":s?"true":"false",onClick:this.handleDateClick,disabled:d,part:"native",ref:function(e){return t.dateTargetEl=e}},h("slot",{name:"date-target"},n),c==="md"&&h("ion-ripple-effect",null)),r&&h("button",{class:"ion-activatable",id:"time-button","aria-expanded":s?"true":"false",onClick:this.handleTimeClick,disabled:d,part:"native",ref:function(e){return t.timeTargetEl=e}},h("slot",{name:"time-target"},r),c==="md"&&h("ion-ripple-effect",null)))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();DatetimeButton.style={ios:iosDatetimeButtonCss,md:mdDatetimeButtonCss};export{DatetimeButton as ion_datetime_button};
|