ngx-datex 1.0.2 → 1.0.3

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.
@@ -2808,6 +2808,7 @@ class NgxDatex {
2808
2808
  oldStartDate = null;
2809
2809
  oldEndDate = null;
2810
2810
  previousRightTime = null;
2811
+ _isApplying = false; // Flag to prevent double emission during apply
2811
2812
  // Public getters for current dates
2812
2813
  get currentStartDate() {
2813
2814
  return this._internalStartDate;
@@ -3169,6 +3170,11 @@ class NgxDatex {
3169
3170
  * Used when calendar is closed without explicit apply (ESC, click outside, etc.)
3170
3171
  */
3171
3172
  closeCalendarWithChangeCheck() {
3173
+ // Don't emit if we're in the middle of an apply operation
3174
+ if (this._isApplying) {
3175
+ this.closeCalendar();
3176
+ return;
3177
+ }
3172
3178
  // Check for changes using appropriate precision based on timePicker
3173
3179
  if (this.oldStartDate && this.oldEndDate) {
3174
3180
  const precision = this.timePicker() ? 'minute' : 'day';
@@ -3195,6 +3201,8 @@ class NgxDatex {
3195
3201
  apply() {
3196
3202
  if (!this.canApplyValue())
3197
3203
  return;
3204
+ // Set flag to prevent double emission
3205
+ this._isApplying = true;
3198
3206
  // Ensure time values are applied to the dates before closing
3199
3207
  if (this.timePicker()) {
3200
3208
  const startTime = this._startTime();
@@ -3224,7 +3232,10 @@ class NgxDatex {
3224
3232
  // Emit value change when applying (following vanilla daterangepicker behavior)
3225
3233
  this.emitValueChange();
3226
3234
  this.updateElement();
3235
+ // Close calendar without checking for changes since we already applied them
3227
3236
  this.closeCalendar();
3237
+ // Reset flag after closing
3238
+ this._isApplying = false;
3228
3239
  }
3229
3240
  /**
3230
3241
  * Cancels the current selection and reverts to the previous values.
@@ -3367,7 +3378,12 @@ class NgxDatex {
3367
3378
  this.apply();
3368
3379
  }
3369
3380
  selectCustomRange() {
3370
- // Custom range selection logic - mainly visual
3381
+ // Following vanilla daterangepicker: custom range selection just shows calendars
3382
+ // It doesn't auto-apply like predefined ranges
3383
+ // The user needs to manually select dates and click Apply
3384
+ // Just ensure calendars are visible - no auto-apply for custom range
3385
+ // This matches vanilla daterangepicker behavior where custom range
3386
+ // requires manual Apply button click
3371
3387
  }
3372
3388
  /**
3373
3389
  * Gets the current checkbox state.