@ionic/core 8.5.2-nightly.20250326 → 8.5.2

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/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2025-03-26T06:09:34",
2
+ "timestamp": "2025-03-26T21:29:53",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.20.0",
@@ -1427,7 +1427,7 @@ const Datetime = class {
1427
1427
  const activePart = this.getActivePartsWithFallback();
1428
1428
  return (h("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
1429
1429
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
1430
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
1430
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
1431
1431
  ev.stopPropagation();
1432
1432
  } }, hoursData.map((hour) => (h("ion-picker-column-option", { part: hour.value === activePart.hour ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: hour.value, disabled: hour.disabled, value: hour.value }, hour.text)))));
1433
1433
  }
@@ -1438,7 +1438,7 @@ const Datetime = class {
1438
1438
  const activePart = this.getActivePartsWithFallback();
1439
1439
  return (h("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
1440
1440
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
1441
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
1441
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
1442
1442
  ev.stopPropagation();
1443
1443
  } }, minutesData.map((minute) => (h("ion-picker-column-option", { part: minute.value === activePart.minute ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: minute.value, disabled: minute.disabled, value: minute.value }, minute.text)))));
1444
1444
  }
@@ -1452,7 +1452,7 @@ const Datetime = class {
1452
1452
  return (h("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
1453
1453
  const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
1454
1454
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
1455
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
1455
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
1456
1456
  ev.stopPropagation();
1457
1457
  } }, dayPeriodData.map((dayPeriod) => (h("ion-picker-column-option", { part: dayPeriod.value === activePart.ampm ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: dayPeriod.value, disabled: dayPeriod.disabled, value: dayPeriod.value }, dayPeriod.text)))));
1458
1458
  }
@@ -1759,7 +1759,7 @@ const Datetime = class {
1759
1759
  const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1760
1760
  const hasWheelVariant = hasDatePresentation && preferWheel;
1761
1761
  renderHiddenInput(true, el, name, formatValue(value), disabled);
1762
- return (h(Host, { key: '7afbb1a7e6c78389b4588999779e5c90e010e85d', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1762
+ return (h(Host, { key: '08d429533a09c600b936ad1e022658051c765595', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1763
1763
  [mode]: true,
1764
1764
  ['datetime-readonly']: readonly,
1765
1765
  ['datetime-disabled']: disabled,
@@ -1769,7 +1769,7 @@ const Datetime = class {
1769
1769
  [`datetime-size-${size}`]: true,
1770
1770
  [`datetime-prefer-wheel`]: hasWheelVariant,
1771
1771
  [`datetime-grid`]: isGridStyle,
1772
- })) }, h("div", { key: '297c458d4d17154cb297e2ef5926505bcb2d1fce', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
1772
+ })) }, h("div", { key: 'f4ff0fcd1e059767a7ef14fcc76ebfd55d23a97b', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
1773
1773
  }
1774
1774
  get el() { return getElement(this); }
1775
1775
  static get watchers() { return {
@@ -319,13 +319,59 @@ const Picker = class {
319
319
  * or trailing zeros when looking at the item text.
320
320
  */
321
321
  this.searchColumn = (colEl, value, zeroBehavior = 'start') => {
322
+ if (!value) {
323
+ return false;
324
+ }
322
325
  const behavior = zeroBehavior === 'start' ? /^0+/ : /0$/;
326
+ value = value.replace(behavior, '');
323
327
  const option = Array.from(colEl.querySelectorAll('ion-picker-column-option')).find((el) => {
324
328
  return el.disabled !== true && el.textContent.replace(behavior, '') === value;
325
329
  });
326
330
  if (option) {
327
331
  colEl.setValue(option.value);
328
332
  }
333
+ return !!option;
334
+ };
335
+ /**
336
+ * Attempts to intelligently search the first and second
337
+ * column as if they're number columns for the provided numbers
338
+ * where the first two numbers are the first column
339
+ * and the last 2 are the last column. Tries to allow for the first
340
+ * number to be ignored for situations where typos occurred.
341
+ */
342
+ this.multiColumnSearch = (firstColumn, secondColumn, input) => {
343
+ if (input.length === 0) {
344
+ return;
345
+ }
346
+ const inputArray = input.split('');
347
+ const hourValue = inputArray.slice(0, 2).join('');
348
+ // Try to find a match for the first two digits in the first column
349
+ const foundHour = this.searchColumn(firstColumn, hourValue);
350
+ // If we have more than 2 digits and found a match for hours,
351
+ // use the remaining digits for the second column (minutes)
352
+ if (inputArray.length > 2 && foundHour) {
353
+ const minuteValue = inputArray.slice(2, 4).join('');
354
+ this.searchColumn(secondColumn, minuteValue);
355
+ }
356
+ // If we couldn't find a match for the two-digit hour, try single digit approaches
357
+ else if (!foundHour && inputArray.length >= 1) {
358
+ // First try the first digit as a single-digit hour
359
+ let singleDigitHour = inputArray[0];
360
+ let singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
361
+ // If that didn't work, try the second digit as a single-digit hour
362
+ // (handles case where user made a typo in the first digit, or they typed over themselves)
363
+ if (!singleDigitFound) {
364
+ inputArray.shift();
365
+ singleDigitHour = inputArray[0];
366
+ singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
367
+ }
368
+ // If we found a single-digit hour and have remaining digits,
369
+ // use up to 2 of the remaining digits for the second column
370
+ if (singleDigitFound && inputArray.length > 1) {
371
+ const remainingDigits = inputArray.slice(1, 3).join('');
372
+ this.searchColumn(secondColumn, remainingDigits);
373
+ }
374
+ }
329
375
  };
330
376
  this.selectMultiColumn = () => {
331
377
  const { inputEl, el } = this;
@@ -336,82 +382,13 @@ const Picker = class {
336
382
  const firstColumn = numericPickers[0];
337
383
  const lastColumn = numericPickers[1];
338
384
  let value = inputEl.value;
339
- let minuteValue;
340
- switch (value.length) {
341
- case 1:
342
- this.searchColumn(firstColumn, value);
343
- break;
344
- case 2:
345
- /**
346
- * If the first character is `0` or `1` it is
347
- * possible that users are trying to type `09`
348
- * or `11` into the hour field, so we should look
349
- * at that first.
350
- */
351
- const firstCharacter = inputEl.value.substring(0, 1);
352
- value = firstCharacter === '0' || firstCharacter === '1' ? inputEl.value : firstCharacter;
353
- this.searchColumn(firstColumn, value);
354
- /**
355
- * If only checked the first value,
356
- * we can check the second value
357
- * for a match in the minutes column
358
- */
359
- if (value.length === 1) {
360
- minuteValue = inputEl.value.substring(inputEl.value.length - 1);
361
- this.searchColumn(lastColumn, minuteValue, 'end');
362
- }
363
- break;
364
- case 3:
365
- /**
366
- * If the first character is `0` or `1` it is
367
- * possible that users are trying to type `09`
368
- * or `11` into the hour field, so we should look
369
- * at that first.
370
- */
371
- const firstCharacterAgain = inputEl.value.substring(0, 1);
372
- value =
373
- firstCharacterAgain === '0' || firstCharacterAgain === '1'
374
- ? inputEl.value.substring(0, 2)
375
- : firstCharacterAgain;
376
- this.searchColumn(firstColumn, value);
377
- /**
378
- * If only checked the first value,
379
- * we can check the second value
380
- * for a match in the minutes column
381
- */
382
- minuteValue = value.length === 1 ? inputEl.value.substring(1) : inputEl.value.substring(2);
383
- this.searchColumn(lastColumn, minuteValue, 'end');
384
- break;
385
- case 4:
386
- /**
387
- * If the first character is `0` or `1` it is
388
- * possible that users are trying to type `09`
389
- * or `11` into the hour field, so we should look
390
- * at that first.
391
- */
392
- const firstCharacterAgainAgain = inputEl.value.substring(0, 1);
393
- value =
394
- firstCharacterAgainAgain === '0' || firstCharacterAgainAgain === '1'
395
- ? inputEl.value.substring(0, 2)
396
- : firstCharacterAgainAgain;
397
- this.searchColumn(firstColumn, value);
398
- /**
399
- * If only checked the first value,
400
- * we can check the second value
401
- * for a match in the minutes column
402
- */
403
- const minuteValueAgain = value.length === 1
404
- ? inputEl.value.substring(1, inputEl.value.length)
405
- : inputEl.value.substring(2, inputEl.value.length);
406
- this.searchColumn(lastColumn, minuteValueAgain, 'end');
407
- break;
408
- default:
409
- const startIndex = inputEl.value.length - 4;
410
- const newString = inputEl.value.substring(startIndex);
411
- inputEl.value = newString;
412
- this.selectMultiColumn();
413
- break;
385
+ if (value.length > 4) {
386
+ const startIndex = inputEl.value.length - 4;
387
+ const newString = inputEl.value.substring(startIndex);
388
+ inputEl.value = newString;
389
+ value = newString;
414
390
  }
391
+ this.multiColumnSearch(firstColumn, lastColumn, value);
415
392
  };
416
393
  /**
417
394
  * Searches the value of the active column
@@ -480,7 +457,7 @@ const Picker = class {
480
457
  this.emitInputModeChange();
481
458
  }
482
459
  render() {
483
- return (h(Host, { key: 'f92214a09dc85b65873676f40fde2b802960e704', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, h("input", { key: '6da37f75aca4ea1c9cb3bc733ebda2116279f313', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
460
+ return (h(Host, { key: '28f81e4ed44a633178561757c5199c2c98f94b74', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, h("input", { key: 'abb3d1ad25ef63856af7804111175a4d50008bc0', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
484
461
  var _a;
485
462
  /**
486
463
  * The "Enter" key represents
@@ -495,7 +472,7 @@ const Picker = class {
495
472
  if (ev.key === 'Enter') {
496
473
  (_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.blur();
497
474
  }
498
- }, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), h("div", { key: '298e99d83dd3f5bf2798150bab0bb4024af472fa', class: "picker-before" }), h("div", { key: 'ea578f04eb562a4dc6d6cc92de133dcb9fb7f42a', class: "picker-after" }), h("div", { key: '84567824956dfe967992a629904836ba8b75b3ec', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), h("slot", { key: 'df81f8fb90e1f649b608328034528f5c31c70c3b' })));
475
+ }, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), h("div", { key: '334a5abdc02e6b127c57177f626d7e4ff5526183', class: "picker-before" }), h("div", { key: 'ffd6271931129e88fc7c820e919d684899e420c5', class: "picker-after" }), h("div", { key: '78d1d95fd09e04f154ea59f24a1cece72c47ed7b', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), h("slot", { key: '0bd5b9f875d3c71f6cbbde2054baeb1b0a2e8cd5' })));
499
476
  }
500
477
  get el() { return getElement(this); }
501
478
  };