@shival99/z-ui 1.4.23 → 1.4.24

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.
@@ -328,13 +328,11 @@ class ZTableEditCellComponent {
328
328
  this._currentValue.set(newValue);
329
329
  this._initialized = true;
330
330
  const config = this.editConfig();
331
- // If blurEdit is enabled, store pending value and wait for blur
332
331
  if (config?.blurEdit) {
333
332
  this._pendingBlurValue = newValue;
334
333
  this._hasPendingBlur = true;
335
334
  return;
336
335
  }
337
- // Use RxJS Subject for debounce
338
336
  this._valueChange$.next({ oldValue, newValue });
339
337
  }
340
338
  onInputControlReady(control) {
@@ -342,7 +340,6 @@ class ZTableEditCellComponent {
342
340
  this._setupBlurWatcher();
343
341
  }
344
342
  _handleInputBlur() {
345
- // Only emit if blurEdit is enabled and there's a pending value
346
343
  if (!this._hasPendingBlur)
347
344
  return;
348
345
  const oldValue = this.zValue();
@@ -390,27 +387,20 @@ class ZTableEditCellComponent {
390
387
  ngOnInit() {
391
388
  const config = this.editConfig();
392
389
  const debounceMs = config?.debounceTime ?? 0;
393
- // Setup debounced value change subscription
394
390
  this._valueChange$
395
391
  .pipe(debounceTime(debounceMs), distinctUntilChanged((a, b) => a.newValue === b.newValue), takeUntilDestroyed(this._destroyRef))
396
392
  .subscribe(({ oldValue, newValue }) => {
397
393
  this._emitChange(oldValue, newValue);
398
394
  });
399
- // Watch input control state for blur (for blurEdit feature)
400
- // This is done via effect-like polling since control is set async
401
395
  this._destroyRef.onDestroy(() => {
402
396
  this._valueChange$.complete();
403
397
  });
404
398
  }
405
- // Called from template when input control is ready
406
- // We watch the state signal for blur changes using toObservable
407
399
  _setupBlurWatcher() {
408
400
  if (!this._inputControl || !this.editConfig()?.blurEdit)
409
401
  return;
410
- // Convert state signal to observable and watch for blur transitions
411
402
  toObservable(this._inputControl.state)
412
- .pipe(map(state => state.blurred), pairwise(), filter(([prev, curr]) => !prev && curr), // Only when transitioning to blurred
413
- takeUntilDestroyed(this._destroyRef))
403
+ .pipe(map(state => state.blurred), pairwise(), filter(([prev, curr]) => !prev && curr), takeUntilDestroyed(this._destroyRef))
414
404
  .subscribe(() => {
415
405
  this._handleInputBlur();
416
406
  });