@shival99/z-ui 1.4.20 → 1.4.21

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.
@@ -249,6 +249,7 @@ class ZTableEditCellComponent {
249
249
  zChange = output();
250
250
  _currentValue = signal(undefined, ...(ngDevMode ? [{ debugName: "_currentValue" }] : []));
251
251
  _initialized = false;
252
+ _debounceTimeout = null;
252
253
  editConfig = computed(() => {
253
254
  const config = this.zEditConfig();
254
255
  if (!config || typeof config === 'boolean') {
@@ -319,7 +320,8 @@ class ZTableEditCellComponent {
319
320
  const oldValue = this.zValue();
320
321
  this._currentValue.set(newValue);
321
322
  this._initialized = true;
322
- this._emitChange(oldValue, newValue);
323
+ // Use debounce for typing controls (text, number, textarea)
324
+ this._emitChangeWithDebounce(oldValue, newValue);
323
325
  }
324
326
  onSelectChange(newValue) {
325
327
  const oldValue = this.zValue();
@@ -357,6 +359,30 @@ class ZTableEditCellComponent {
357
359
  newValue,
358
360
  });
359
361
  }
362
+ _emitChangeWithDebounce(oldValue, newValue) {
363
+ const config = this.editConfig();
364
+ const debounceTime = config?.debounceTime;
365
+ // If no debounceTime configured, emit immediately
366
+ if (!debounceTime || debounceTime <= 0) {
367
+ this._emitChange(oldValue, newValue);
368
+ return;
369
+ }
370
+ // Clear previous timeout
371
+ if (this._debounceTimeout) {
372
+ clearTimeout(this._debounceTimeout);
373
+ }
374
+ // Schedule debounced emit
375
+ this._debounceTimeout = setTimeout(() => {
376
+ this._emitChange(oldValue, newValue);
377
+ this._debounceTimeout = null;
378
+ }, debounceTime);
379
+ }
380
+ ngOnDestroy() {
381
+ if (this._debounceTimeout) {
382
+ clearTimeout(this._debounceTimeout);
383
+ this._debounceTimeout = null;
384
+ }
385
+ }
360
386
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZTableEditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
361
387
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ZTableEditCellComponent, isStandalone: true, selector: "z-table-edit-cell", inputs: { zRow: { classPropertyName: "zRow", publicName: "zRow", isSignal: true, isRequired: true, transformFunction: null }, zRowId: { classPropertyName: "zRowId", publicName: "zRowId", isSignal: true, isRequired: true, transformFunction: null }, zRowIndex: { classPropertyName: "zRowIndex", publicName: "zRowIndex", isSignal: true, isRequired: true, transformFunction: null }, zColumnId: { classPropertyName: "zColumnId", publicName: "zColumnId", isSignal: true, isRequired: true, transformFunction: null }, zValue: { classPropertyName: "zValue", publicName: "zValue", isSignal: true, isRequired: false, transformFunction: null }, zEditConfig: { classPropertyName: "zEditConfig", publicName: "zEditConfig", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zChange: "zChange" }, host: { classAttribute: "z-table-edit-cell block" }, ngImport: i0, template: `
362
388
  @switch (editType()) {
@@ -378,6 +404,7 @@ class ZTableEditCellComponent {
378
404
  [zMin]="editConfig().min"
379
405
  [zMax]="editConfig().max"
380
406
  [zStep]="editConfig().step ?? 1"
407
+ [zThousandSeparator]="editConfig().thousandSeparator || ','"
381
408
  [zDisabled]="isDisabled()"
382
409
  [ngModel]="numericValue()"
383
410
  (ngModelChange)="onValueChange($event)"
@@ -459,6 +486,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
459
486
  [zMin]="editConfig().min"
460
487
  [zMax]="editConfig().max"
461
488
  [zStep]="editConfig().step ?? 1"
489
+ [zThousandSeparator]="editConfig().thousandSeparator || ','"
462
490
  [zDisabled]="isDisabled()"
463
491
  [ngModel]="numericValue()"
464
492
  (ngModelChange)="onValueChange($event)"