@ionic/core 8.7.13-dev.11765558154.1273081d → 8.7.13-dev.11765560568.1a8772e8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ion-datetime.js +41 -29
- package/dist/cjs/ion-datetime_3.cjs.entry.js +41 -29
- package/dist/collection/components/datetime/datetime.js +41 -29
- package/dist/docs.json +1 -1
- package/dist/esm/ion-datetime_3.entry.js +41 -29
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-ebcfc1d2.entry.js +4 -0
- package/dist/types/components/datetime/datetime.d.ts +10 -0
- package/hydrate/index.js +41 -29
- package/hydrate/index.mjs +41 -29
- package/package.json +1 -1
- package/dist/ionic/p-8611adcf.entry.js +0 -4
|
@@ -1080,20 +1080,17 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1080
1080
|
this.initializeCalendarListener();
|
|
1081
1081
|
this.initializeKeyboardListeners();
|
|
1082
1082
|
}
|
|
1083
|
-
|
|
1083
|
+
/**
|
|
1084
|
+
* Sets up visibility detection for the datetime component.
|
|
1085
|
+
*
|
|
1086
|
+
* Uses multiple strategies to reliably detect when the datetime becomes
|
|
1087
|
+
* visible, which is necessary for proper initialization of scrollable areas:
|
|
1088
|
+
* 1. ResizeObserver - detects dimension changes
|
|
1089
|
+
* 2. Overlay event listeners - for datetime inside modals/popovers
|
|
1090
|
+
* 3. Polling fallback - for browsers where observers are unreliable (WebKit)
|
|
1091
|
+
*/
|
|
1092
|
+
initializeVisibilityObserver() {
|
|
1084
1093
|
const { el } = this;
|
|
1085
|
-
/**
|
|
1086
|
-
* If a scrollable element is hidden using `display: none`,
|
|
1087
|
-
* it will not have a scroll height meaning we cannot scroll elements
|
|
1088
|
-
* into view. As a result, we will need to wait for the datetime to become
|
|
1089
|
-
* visible if used inside of a modal or a popover otherwise the scrollable
|
|
1090
|
-
* areas will not have the correct values snapped into place.
|
|
1091
|
-
*
|
|
1092
|
-
* We use ResizeObserver to detect when the element transitions between
|
|
1093
|
-
* having dimensions (visible) and zero dimensions (hidden). This is more
|
|
1094
|
-
* reliable than IntersectionObserver for detecting visibility changes,
|
|
1095
|
-
* especially when the element is inside a modal or popover.
|
|
1096
|
-
*/
|
|
1097
1094
|
const markReady = () => {
|
|
1098
1095
|
if (el.classList.contains('datetime-ready')) {
|
|
1099
1096
|
return;
|
|
@@ -1109,12 +1106,31 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1109
1106
|
writeTask(() => {
|
|
1110
1107
|
el.classList.remove('datetime-ready');
|
|
1111
1108
|
});
|
|
1109
|
+
startVisibilityPolling();
|
|
1112
1110
|
};
|
|
1113
1111
|
/**
|
|
1114
|
-
* FW-6931:
|
|
1115
|
-
*
|
|
1116
|
-
|
|
1117
|
-
|
|
1112
|
+
* FW-6931: Poll for visibility as a fallback for browsers where
|
|
1113
|
+
* ResizeObserver doesn't fire reliably (e.g., WebKit).
|
|
1114
|
+
*/
|
|
1115
|
+
const startVisibilityPolling = () => {
|
|
1116
|
+
let pollCount = 0;
|
|
1117
|
+
const poll = () => {
|
|
1118
|
+
if (el.classList.contains('datetime-ready') || pollCount++ >= 60) {
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
const { width, height } = el.getBoundingClientRect();
|
|
1122
|
+
if (width > 0 && height > 0) {
|
|
1123
|
+
markReady();
|
|
1124
|
+
}
|
|
1125
|
+
else {
|
|
1126
|
+
raf(poll);
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
raf(poll);
|
|
1130
|
+
};
|
|
1131
|
+
/**
|
|
1132
|
+
* FW-6931: Listen for overlay present/dismiss events when datetime
|
|
1133
|
+
* is inside a modal or popover.
|
|
1118
1134
|
*/
|
|
1119
1135
|
const parentOverlay = el.closest('ion-modal, ion-popover');
|
|
1120
1136
|
if (parentOverlay) {
|
|
@@ -1129,8 +1145,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1129
1145
|
}
|
|
1130
1146
|
if (typeof ResizeObserver !== 'undefined') {
|
|
1131
1147
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
1132
|
-
const
|
|
1133
|
-
const { width, height } = entry.contentRect;
|
|
1148
|
+
const { width, height } = entries[0].contentRect;
|
|
1134
1149
|
const isVisible = width > 0 && height > 0;
|
|
1135
1150
|
const isReady = el.classList.contains('datetime-ready');
|
|
1136
1151
|
if (isVisible && !isReady) {
|
|
@@ -1140,22 +1155,19 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1140
1155
|
markHidden();
|
|
1141
1156
|
}
|
|
1142
1157
|
});
|
|
1143
|
-
|
|
1144
|
-
* Use raf to avoid a race condition between the component loading and
|
|
1145
|
-
* its display animation starting (such as when shown in a modal).
|
|
1146
|
-
*/
|
|
1158
|
+
// Use raf to avoid race condition with modal/popover animations
|
|
1147
1159
|
raf(() => { var _a; return (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el); });
|
|
1160
|
+
startVisibilityPolling();
|
|
1148
1161
|
}
|
|
1149
1162
|
else {
|
|
1150
|
-
|
|
1151
|
-
* Fallback for test environments where ResizeObserver is not available.
|
|
1152
|
-
* Just mark as ready without initializing scroll/keyboard listeners
|
|
1153
|
-
* since those also require browser APIs not available in Jest.
|
|
1154
|
-
*/
|
|
1163
|
+
// Test environment fallback - mark ready immediately
|
|
1155
1164
|
writeTask(() => {
|
|
1156
1165
|
el.classList.add('datetime-ready');
|
|
1157
1166
|
});
|
|
1158
1167
|
}
|
|
1168
|
+
}
|
|
1169
|
+
componentDidLoad() {
|
|
1170
|
+
this.initializeVisibilityObserver();
|
|
1159
1171
|
/**
|
|
1160
1172
|
* Datetime uses Ionic components that emit
|
|
1161
1173
|
* ionFocus and ionBlur. These events are
|
|
@@ -1884,7 +1896,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1884
1896
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1885
1897
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1886
1898
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1887
|
-
return (h(Host, { key: '
|
|
1899
|
+
return (h(Host, { key: '2fb2938db507a134622a3feac44804f11071c589', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1888
1900
|
[mode]: true,
|
|
1889
1901
|
['datetime-readonly']: readonly,
|
|
1890
1902
|
['datetime-disabled']: disabled,
|
|
@@ -1076,20 +1076,17 @@ const Datetime = class {
|
|
|
1076
1076
|
this.initializeCalendarListener();
|
|
1077
1077
|
this.initializeKeyboardListeners();
|
|
1078
1078
|
}
|
|
1079
|
-
|
|
1079
|
+
/**
|
|
1080
|
+
* Sets up visibility detection for the datetime component.
|
|
1081
|
+
*
|
|
1082
|
+
* Uses multiple strategies to reliably detect when the datetime becomes
|
|
1083
|
+
* visible, which is necessary for proper initialization of scrollable areas:
|
|
1084
|
+
* 1. ResizeObserver - detects dimension changes
|
|
1085
|
+
* 2. Overlay event listeners - for datetime inside modals/popovers
|
|
1086
|
+
* 3. Polling fallback - for browsers where observers are unreliable (WebKit)
|
|
1087
|
+
*/
|
|
1088
|
+
initializeVisibilityObserver() {
|
|
1080
1089
|
const { el } = this;
|
|
1081
|
-
/**
|
|
1082
|
-
* If a scrollable element is hidden using `display: none`,
|
|
1083
|
-
* it will not have a scroll height meaning we cannot scroll elements
|
|
1084
|
-
* into view. As a result, we will need to wait for the datetime to become
|
|
1085
|
-
* visible if used inside of a modal or a popover otherwise the scrollable
|
|
1086
|
-
* areas will not have the correct values snapped into place.
|
|
1087
|
-
*
|
|
1088
|
-
* We use ResizeObserver to detect when the element transitions between
|
|
1089
|
-
* having dimensions (visible) and zero dimensions (hidden). This is more
|
|
1090
|
-
* reliable than IntersectionObserver for detecting visibility changes,
|
|
1091
|
-
* especially when the element is inside a modal or popover.
|
|
1092
|
-
*/
|
|
1093
1090
|
const markReady = () => {
|
|
1094
1091
|
if (el.classList.contains('datetime-ready')) {
|
|
1095
1092
|
return;
|
|
@@ -1105,12 +1102,31 @@ const Datetime = class {
|
|
|
1105
1102
|
index.writeTask(() => {
|
|
1106
1103
|
el.classList.remove('datetime-ready');
|
|
1107
1104
|
});
|
|
1105
|
+
startVisibilityPolling();
|
|
1108
1106
|
};
|
|
1109
1107
|
/**
|
|
1110
|
-
* FW-6931:
|
|
1111
|
-
*
|
|
1112
|
-
|
|
1113
|
-
|
|
1108
|
+
* FW-6931: Poll for visibility as a fallback for browsers where
|
|
1109
|
+
* ResizeObserver doesn't fire reliably (e.g., WebKit).
|
|
1110
|
+
*/
|
|
1111
|
+
const startVisibilityPolling = () => {
|
|
1112
|
+
let pollCount = 0;
|
|
1113
|
+
const poll = () => {
|
|
1114
|
+
if (el.classList.contains('datetime-ready') || pollCount++ >= 60) {
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
const { width, height } = el.getBoundingClientRect();
|
|
1118
|
+
if (width > 0 && height > 0) {
|
|
1119
|
+
markReady();
|
|
1120
|
+
}
|
|
1121
|
+
else {
|
|
1122
|
+
helpers.raf(poll);
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
helpers.raf(poll);
|
|
1126
|
+
};
|
|
1127
|
+
/**
|
|
1128
|
+
* FW-6931: Listen for overlay present/dismiss events when datetime
|
|
1129
|
+
* is inside a modal or popover.
|
|
1114
1130
|
*/
|
|
1115
1131
|
const parentOverlay = el.closest('ion-modal, ion-popover');
|
|
1116
1132
|
if (parentOverlay) {
|
|
@@ -1125,8 +1141,7 @@ const Datetime = class {
|
|
|
1125
1141
|
}
|
|
1126
1142
|
if (typeof ResizeObserver !== 'undefined') {
|
|
1127
1143
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
1128
|
-
const
|
|
1129
|
-
const { width, height } = entry.contentRect;
|
|
1144
|
+
const { width, height } = entries[0].contentRect;
|
|
1130
1145
|
const isVisible = width > 0 && height > 0;
|
|
1131
1146
|
const isReady = el.classList.contains('datetime-ready');
|
|
1132
1147
|
if (isVisible && !isReady) {
|
|
@@ -1136,22 +1151,19 @@ const Datetime = class {
|
|
|
1136
1151
|
markHidden();
|
|
1137
1152
|
}
|
|
1138
1153
|
});
|
|
1139
|
-
|
|
1140
|
-
* Use raf to avoid a race condition between the component loading and
|
|
1141
|
-
* its display animation starting (such as when shown in a modal).
|
|
1142
|
-
*/
|
|
1154
|
+
// Use raf to avoid race condition with modal/popover animations
|
|
1143
1155
|
helpers.raf(() => { var _a; return (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el); });
|
|
1156
|
+
startVisibilityPolling();
|
|
1144
1157
|
}
|
|
1145
1158
|
else {
|
|
1146
|
-
|
|
1147
|
-
* Fallback for test environments where ResizeObserver is not available.
|
|
1148
|
-
* Just mark as ready without initializing scroll/keyboard listeners
|
|
1149
|
-
* since those also require browser APIs not available in Jest.
|
|
1150
|
-
*/
|
|
1159
|
+
// Test environment fallback - mark ready immediately
|
|
1151
1160
|
index.writeTask(() => {
|
|
1152
1161
|
el.classList.add('datetime-ready');
|
|
1153
1162
|
});
|
|
1154
1163
|
}
|
|
1164
|
+
}
|
|
1165
|
+
componentDidLoad() {
|
|
1166
|
+
this.initializeVisibilityObserver();
|
|
1155
1167
|
/**
|
|
1156
1168
|
* Datetime uses Ionic components that emit
|
|
1157
1169
|
* ionFocus and ionBlur. These events are
|
|
@@ -1880,7 +1892,7 @@ const Datetime = class {
|
|
|
1880
1892
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1881
1893
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1882
1894
|
helpers.renderHiddenInput(true, el, name, data.formatValue(value), disabled);
|
|
1883
|
-
return (index.h(index.Host, { key: '
|
|
1895
|
+
return (index.h(index.Host, { key: '2fb2938db507a134622a3feac44804f11071c589', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, theme.createColorClasses(color, {
|
|
1884
1896
|
[mode]: true,
|
|
1885
1897
|
['datetime-readonly']: readonly,
|
|
1886
1898
|
['datetime-disabled']: disabled,
|
|
@@ -875,20 +875,17 @@ export class Datetime {
|
|
|
875
875
|
this.initializeCalendarListener();
|
|
876
876
|
this.initializeKeyboardListeners();
|
|
877
877
|
}
|
|
878
|
-
|
|
878
|
+
/**
|
|
879
|
+
* Sets up visibility detection for the datetime component.
|
|
880
|
+
*
|
|
881
|
+
* Uses multiple strategies to reliably detect when the datetime becomes
|
|
882
|
+
* visible, which is necessary for proper initialization of scrollable areas:
|
|
883
|
+
* 1. ResizeObserver - detects dimension changes
|
|
884
|
+
* 2. Overlay event listeners - for datetime inside modals/popovers
|
|
885
|
+
* 3. Polling fallback - for browsers where observers are unreliable (WebKit)
|
|
886
|
+
*/
|
|
887
|
+
initializeVisibilityObserver() {
|
|
879
888
|
const { el } = this;
|
|
880
|
-
/**
|
|
881
|
-
* If a scrollable element is hidden using `display: none`,
|
|
882
|
-
* it will not have a scroll height meaning we cannot scroll elements
|
|
883
|
-
* into view. As a result, we will need to wait for the datetime to become
|
|
884
|
-
* visible if used inside of a modal or a popover otherwise the scrollable
|
|
885
|
-
* areas will not have the correct values snapped into place.
|
|
886
|
-
*
|
|
887
|
-
* We use ResizeObserver to detect when the element transitions between
|
|
888
|
-
* having dimensions (visible) and zero dimensions (hidden). This is more
|
|
889
|
-
* reliable than IntersectionObserver for detecting visibility changes,
|
|
890
|
-
* especially when the element is inside a modal or popover.
|
|
891
|
-
*/
|
|
892
889
|
const markReady = () => {
|
|
893
890
|
if (el.classList.contains('datetime-ready')) {
|
|
894
891
|
return;
|
|
@@ -904,12 +901,31 @@ export class Datetime {
|
|
|
904
901
|
writeTask(() => {
|
|
905
902
|
el.classList.remove('datetime-ready');
|
|
906
903
|
});
|
|
904
|
+
startVisibilityPolling();
|
|
907
905
|
};
|
|
908
906
|
/**
|
|
909
|
-
* FW-6931:
|
|
910
|
-
*
|
|
911
|
-
|
|
912
|
-
|
|
907
|
+
* FW-6931: Poll for visibility as a fallback for browsers where
|
|
908
|
+
* ResizeObserver doesn't fire reliably (e.g., WebKit).
|
|
909
|
+
*/
|
|
910
|
+
const startVisibilityPolling = () => {
|
|
911
|
+
let pollCount = 0;
|
|
912
|
+
const poll = () => {
|
|
913
|
+
if (el.classList.contains('datetime-ready') || pollCount++ >= 60) {
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
const { width, height } = el.getBoundingClientRect();
|
|
917
|
+
if (width > 0 && height > 0) {
|
|
918
|
+
markReady();
|
|
919
|
+
}
|
|
920
|
+
else {
|
|
921
|
+
raf(poll);
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
raf(poll);
|
|
925
|
+
};
|
|
926
|
+
/**
|
|
927
|
+
* FW-6931: Listen for overlay present/dismiss events when datetime
|
|
928
|
+
* is inside a modal or popover.
|
|
913
929
|
*/
|
|
914
930
|
const parentOverlay = el.closest('ion-modal, ion-popover');
|
|
915
931
|
if (parentOverlay) {
|
|
@@ -924,8 +940,7 @@ export class Datetime {
|
|
|
924
940
|
}
|
|
925
941
|
if (typeof ResizeObserver !== 'undefined') {
|
|
926
942
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
927
|
-
const
|
|
928
|
-
const { width, height } = entry.contentRect;
|
|
943
|
+
const { width, height } = entries[0].contentRect;
|
|
929
944
|
const isVisible = width > 0 && height > 0;
|
|
930
945
|
const isReady = el.classList.contains('datetime-ready');
|
|
931
946
|
if (isVisible && !isReady) {
|
|
@@ -935,22 +950,19 @@ export class Datetime {
|
|
|
935
950
|
markHidden();
|
|
936
951
|
}
|
|
937
952
|
});
|
|
938
|
-
|
|
939
|
-
* Use raf to avoid a race condition between the component loading and
|
|
940
|
-
* its display animation starting (such as when shown in a modal).
|
|
941
|
-
*/
|
|
953
|
+
// Use raf to avoid race condition with modal/popover animations
|
|
942
954
|
raf(() => { var _a; return (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el); });
|
|
955
|
+
startVisibilityPolling();
|
|
943
956
|
}
|
|
944
957
|
else {
|
|
945
|
-
|
|
946
|
-
* Fallback for test environments where ResizeObserver is not available.
|
|
947
|
-
* Just mark as ready without initializing scroll/keyboard listeners
|
|
948
|
-
* since those also require browser APIs not available in Jest.
|
|
949
|
-
*/
|
|
958
|
+
// Test environment fallback - mark ready immediately
|
|
950
959
|
writeTask(() => {
|
|
951
960
|
el.classList.add('datetime-ready');
|
|
952
961
|
});
|
|
953
962
|
}
|
|
963
|
+
}
|
|
964
|
+
componentDidLoad() {
|
|
965
|
+
this.initializeVisibilityObserver();
|
|
954
966
|
/**
|
|
955
967
|
* Datetime uses Ionic components that emit
|
|
956
968
|
* ionFocus and ionBlur. These events are
|
|
@@ -1679,7 +1691,7 @@ export class Datetime {
|
|
|
1679
1691
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1680
1692
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1681
1693
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1682
|
-
return (h(Host, { key: '
|
|
1694
|
+
return (h(Host, { key: '2fb2938db507a134622a3feac44804f11071c589', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1683
1695
|
[mode]: true,
|
|
1684
1696
|
['datetime-readonly']: readonly,
|
|
1685
1697
|
['datetime-disabled']: disabled,
|
package/dist/docs.json
CHANGED
|
@@ -1074,20 +1074,17 @@ const Datetime = class {
|
|
|
1074
1074
|
this.initializeCalendarListener();
|
|
1075
1075
|
this.initializeKeyboardListeners();
|
|
1076
1076
|
}
|
|
1077
|
-
|
|
1077
|
+
/**
|
|
1078
|
+
* Sets up visibility detection for the datetime component.
|
|
1079
|
+
*
|
|
1080
|
+
* Uses multiple strategies to reliably detect when the datetime becomes
|
|
1081
|
+
* visible, which is necessary for proper initialization of scrollable areas:
|
|
1082
|
+
* 1. ResizeObserver - detects dimension changes
|
|
1083
|
+
* 2. Overlay event listeners - for datetime inside modals/popovers
|
|
1084
|
+
* 3. Polling fallback - for browsers where observers are unreliable (WebKit)
|
|
1085
|
+
*/
|
|
1086
|
+
initializeVisibilityObserver() {
|
|
1078
1087
|
const { el } = this;
|
|
1079
|
-
/**
|
|
1080
|
-
* If a scrollable element is hidden using `display: none`,
|
|
1081
|
-
* it will not have a scroll height meaning we cannot scroll elements
|
|
1082
|
-
* into view. As a result, we will need to wait for the datetime to become
|
|
1083
|
-
* visible if used inside of a modal or a popover otherwise the scrollable
|
|
1084
|
-
* areas will not have the correct values snapped into place.
|
|
1085
|
-
*
|
|
1086
|
-
* We use ResizeObserver to detect when the element transitions between
|
|
1087
|
-
* having dimensions (visible) and zero dimensions (hidden). This is more
|
|
1088
|
-
* reliable than IntersectionObserver for detecting visibility changes,
|
|
1089
|
-
* especially when the element is inside a modal or popover.
|
|
1090
|
-
*/
|
|
1091
1088
|
const markReady = () => {
|
|
1092
1089
|
if (el.classList.contains('datetime-ready')) {
|
|
1093
1090
|
return;
|
|
@@ -1103,12 +1100,31 @@ const Datetime = class {
|
|
|
1103
1100
|
writeTask(() => {
|
|
1104
1101
|
el.classList.remove('datetime-ready');
|
|
1105
1102
|
});
|
|
1103
|
+
startVisibilityPolling();
|
|
1106
1104
|
};
|
|
1107
1105
|
/**
|
|
1108
|
-
* FW-6931:
|
|
1109
|
-
*
|
|
1110
|
-
|
|
1111
|
-
|
|
1106
|
+
* FW-6931: Poll for visibility as a fallback for browsers where
|
|
1107
|
+
* ResizeObserver doesn't fire reliably (e.g., WebKit).
|
|
1108
|
+
*/
|
|
1109
|
+
const startVisibilityPolling = () => {
|
|
1110
|
+
let pollCount = 0;
|
|
1111
|
+
const poll = () => {
|
|
1112
|
+
if (el.classList.contains('datetime-ready') || pollCount++ >= 60) {
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
const { width, height } = el.getBoundingClientRect();
|
|
1116
|
+
if (width > 0 && height > 0) {
|
|
1117
|
+
markReady();
|
|
1118
|
+
}
|
|
1119
|
+
else {
|
|
1120
|
+
raf(poll);
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
raf(poll);
|
|
1124
|
+
};
|
|
1125
|
+
/**
|
|
1126
|
+
* FW-6931: Listen for overlay present/dismiss events when datetime
|
|
1127
|
+
* is inside a modal or popover.
|
|
1112
1128
|
*/
|
|
1113
1129
|
const parentOverlay = el.closest('ion-modal, ion-popover');
|
|
1114
1130
|
if (parentOverlay) {
|
|
@@ -1123,8 +1139,7 @@ const Datetime = class {
|
|
|
1123
1139
|
}
|
|
1124
1140
|
if (typeof ResizeObserver !== 'undefined') {
|
|
1125
1141
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
1126
|
-
const
|
|
1127
|
-
const { width, height } = entry.contentRect;
|
|
1142
|
+
const { width, height } = entries[0].contentRect;
|
|
1128
1143
|
const isVisible = width > 0 && height > 0;
|
|
1129
1144
|
const isReady = el.classList.contains('datetime-ready');
|
|
1130
1145
|
if (isVisible && !isReady) {
|
|
@@ -1134,22 +1149,19 @@ const Datetime = class {
|
|
|
1134
1149
|
markHidden();
|
|
1135
1150
|
}
|
|
1136
1151
|
});
|
|
1137
|
-
|
|
1138
|
-
* Use raf to avoid a race condition between the component loading and
|
|
1139
|
-
* its display animation starting (such as when shown in a modal).
|
|
1140
|
-
*/
|
|
1152
|
+
// Use raf to avoid race condition with modal/popover animations
|
|
1141
1153
|
raf(() => { var _a; return (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el); });
|
|
1154
|
+
startVisibilityPolling();
|
|
1142
1155
|
}
|
|
1143
1156
|
else {
|
|
1144
|
-
|
|
1145
|
-
* Fallback for test environments where ResizeObserver is not available.
|
|
1146
|
-
* Just mark as ready without initializing scroll/keyboard listeners
|
|
1147
|
-
* since those also require browser APIs not available in Jest.
|
|
1148
|
-
*/
|
|
1157
|
+
// Test environment fallback - mark ready immediately
|
|
1149
1158
|
writeTask(() => {
|
|
1150
1159
|
el.classList.add('datetime-ready');
|
|
1151
1160
|
});
|
|
1152
1161
|
}
|
|
1162
|
+
}
|
|
1163
|
+
componentDidLoad() {
|
|
1164
|
+
this.initializeVisibilityObserver();
|
|
1153
1165
|
/**
|
|
1154
1166
|
* Datetime uses Ionic components that emit
|
|
1155
1167
|
* ionFocus and ionBlur. These events are
|
|
@@ -1878,7 +1890,7 @@ const Datetime = class {
|
|
|
1878
1890
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1879
1891
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1880
1892
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1881
|
-
return (h(Host, { key: '
|
|
1893
|
+
return (h(Host, { key: '2fb2938db507a134622a3feac44804f11071c589', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1882
1894
|
[mode]: true,
|
|
1883
1895
|
['datetime-readonly']: readonly,
|
|
1884
1896
|
['datetime-disabled']: disabled,
|