mapa-library-ui 2.0.3 → 2.0.5

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.
@@ -1041,6 +1041,18 @@ class MapaDatepicker {
1041
1041
  this.isPresetsOpenState = signal(false, ...(ngDevMode ? [{ debugName: "isPresetsOpenState" }] : []));
1042
1042
  this.localeState = null;
1043
1043
  this.syncing = false;
1044
+ this.minDateCache = {
1045
+ initialized: false,
1046
+ source: undefined,
1047
+ sourceTimestamp: null,
1048
+ value: null,
1049
+ };
1050
+ this.maxDateCache = {
1051
+ initialized: false,
1052
+ source: undefined,
1053
+ sourceTimestamp: null,
1054
+ value: null,
1055
+ };
1044
1056
  this.overlayPositions = [
1045
1057
  {
1046
1058
  originX: 'start',
@@ -1151,10 +1163,10 @@ class MapaDatepicker {
1151
1163
  return getActiveDateFormat(this.locale());
1152
1164
  }
1153
1165
  minDate() {
1154
- return parseDateValue(this.element.minDate);
1166
+ return this.resolveDateBoundary(this.element.minDate, this.minDateCache);
1155
1167
  }
1156
1168
  maxDate() {
1157
- return parseDateValue(this.element.maxDate);
1169
+ return this.resolveDateBoundary(this.element.maxDate, this.maxDateCache);
1158
1170
  }
1159
1171
  disabledDates() {
1160
1172
  return this.element.disabledDates ?? this.emptyDisabledDates;
@@ -1162,6 +1174,20 @@ class MapaDatepicker {
1162
1174
  isInvalidDate() {
1163
1175
  return this.element.isInvalidDate ?? this.neverInvalid;
1164
1176
  }
1177
+ resolveDateBoundary(source, cache) {
1178
+ const sourceTimestamp = source instanceof Date && !Number.isNaN(source.getTime())
1179
+ ? source.getTime()
1180
+ : null;
1181
+ if (!cache.initialized ||
1182
+ cache.source !== source ||
1183
+ cache.sourceTimestamp !== sourceTimestamp) {
1184
+ cache.initialized = true;
1185
+ cache.source = source;
1186
+ cache.sourceTimestamp = sourceTimestamp;
1187
+ cache.value = parseDateValue(source);
1188
+ }
1189
+ return cache.value;
1190
+ }
1165
1191
  /**
1166
1192
  * Um mês por padrão em todos os modos, para o painel ficar na largura do
1167
1193
  * campo. Dois meses são opt-in via `element.calendars`.