@shival99/z-ui 1.4.20 → 1.4.22

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();
@@ -344,10 +346,6 @@ class ZTableEditCellComponent {
344
346
  this._emitChange(oldValue, checked);
345
347
  }
346
348
  _emitChange(oldValue, newValue) {
347
- const config = this.editConfig();
348
- if (config?.onChange) {
349
- config.onChange(newValue, this.zRow(), this.zColumnId());
350
- }
351
349
  this.zChange.emit({
352
350
  row: this.zRow(),
353
351
  rowId: this.zRowId(),
@@ -357,6 +355,30 @@ class ZTableEditCellComponent {
357
355
  newValue,
358
356
  });
359
357
  }
358
+ _emitChangeWithDebounce(oldValue, newValue) {
359
+ const config = this.editConfig();
360
+ const debounceTime = config?.debounceTime;
361
+ // If no debounceTime configured, emit immediately
362
+ if (!debounceTime || debounceTime <= 0) {
363
+ this._emitChange(oldValue, newValue);
364
+ return;
365
+ }
366
+ // Clear previous timeout
367
+ if (this._debounceTimeout) {
368
+ clearTimeout(this._debounceTimeout);
369
+ }
370
+ // Schedule debounced emit
371
+ this._debounceTimeout = setTimeout(() => {
372
+ this._emitChange(oldValue, newValue);
373
+ this._debounceTimeout = null;
374
+ }, debounceTime);
375
+ }
376
+ ngOnDestroy() {
377
+ if (this._debounceTimeout) {
378
+ clearTimeout(this._debounceTimeout);
379
+ this._debounceTimeout = null;
380
+ }
381
+ }
360
382
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZTableEditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
361
383
  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
384
  @switch (editType()) {
@@ -378,6 +400,7 @@ class ZTableEditCellComponent {
378
400
  [zMin]="editConfig().min"
379
401
  [zMax]="editConfig().max"
380
402
  [zStep]="editConfig().step ?? 1"
403
+ [zThousandSeparator]="editConfig().thousandSeparator || ','"
381
404
  [zDisabled]="isDisabled()"
382
405
  [ngModel]="numericValue()"
383
406
  (ngModelChange)="onValueChange($event)"
@@ -459,6 +482,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
459
482
  [zMin]="editConfig().min"
460
483
  [zMax]="editConfig().max"
461
484
  [zStep]="editConfig().step ?? 1"
485
+ [zThousandSeparator]="editConfig().thousandSeparator || ','"
462
486
  [zDisabled]="isDisabled()"
463
487
  [ngModel]="numericValue()"
464
488
  (ngModelChange)="onValueChange($event)"