@den4ik92/ng2-smart-table 20.7.0 → 20.7.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.
package/index.d.ts CHANGED
@@ -10,6 +10,7 @@ declare abstract class DataSource<T extends BaseDataType = any> {
10
10
  protected readonly onChangedSource: Subject<SmartTableOnChangedEvent>;
11
11
  protected readonly sortConf: _angular_core.WritableSignal<SmartTableSortItem | null>;
12
12
  protected readonly filters: _angular_core.WritableSignal<SmartTableFilterItem[]>;
13
+ idKey?: string;
13
14
  readonly pagingConf: _angular_core.WritableSignal<SmartTablePagerSettings>;
14
15
  protected readonly data: _angular_core.WritableSignal<T[]>;
15
16
  /**
@@ -67,6 +68,12 @@ interface ColumnPositionState {
67
68
  interface SmartTableSettings<T extends BaseDataType = any> {
68
69
  selectMode?: 'single' | 'multi';
69
70
  mode?: 'inline' | 'external';
71
+ /**
72
+ * @description Key used to identify and compare row objects. When set, objects are compared
73
+ * by this field instead of the default heuristic (uuid → id → deep equality).
74
+ * @example 'id' | 'uuid' | 'code'
75
+ */
76
+ idKey?: keyof T & string;
70
77
  cellEmptyText?: string;
71
78
  resetSortOnThirdClick?: boolean;
72
79
  columnSort?: {
@@ -239,7 +246,9 @@ interface SmartTableDefaultEvent<T extends BaseDataType = any> {
239
246
  source: DataSource<T>;
240
247
  }
241
248
  type SmartTableConfirmDeleteEvent<T extends BaseDataType = any> = SmartTableDefaultEvent<T>;
242
- type SmartTableRowClickedEvent<T extends BaseDataType = any> = Omit<SmartTableDefaultEvent<T>, 'confirm'>;
249
+ interface SmartTableRowClickedEvent<T extends BaseDataType = any> extends Omit<SmartTableDefaultEvent<T>, 'confirm'> {
250
+ event: MouseEvent;
251
+ }
243
252
  interface SmartTableCustomEvent<T extends BaseDataType = any> extends Omit<SmartTableDefaultEvent<T>, 'confirm'> {
244
253
  action: string;
245
254
  }
@@ -332,6 +341,7 @@ declare class DataSet {
332
341
  protected columnSettings: SmartTableColumnSettings[];
333
342
  readonly editorInputClass: string;
334
343
  readonly cellEmptyText?: string | undefined;
344
+ idKey?: string | undefined;
335
345
  newRow: Row;
336
346
  protected readonly data: _angular_core.WritableSignal<any[]>;
337
347
  protected readonly columns: _angular_core.WritableSignal<Column[]>;
@@ -341,7 +351,7 @@ declare class DataSet {
341
351
  readonly getVisibleColumns: _angular_core.Signal<Column[]>;
342
352
  readonly getRows: _angular_core.Signal<Row[]>;
343
353
  readonly isAllSelected: _angular_core.Signal<boolean>;
344
- constructor(dataList: any[] | undefined, columnSettings: SmartTableColumnSettings[], editorInputClass: string, cellEmptyText?: string | undefined);
354
+ constructor(dataList: any[] | undefined, columnSettings: SmartTableColumnSettings[], editorInputClass: string, cellEmptyText?: string | undefined, idKey?: string | undefined);
345
355
  setData(data: any[]): void;
346
356
  setColumnsConfig(columnSettings: SmartTableColumnSettings[]): void;
347
357
  findRowByData(data: any): Row | undefined;
@@ -557,7 +567,10 @@ declare class Ng2SmartTableComponent<T extends BaseDataType = any> implements On
557
567
  protected multipleSelectRow(row: Row): void;
558
568
  protected onSelectAllRows(): void;
559
569
  protected onSelectRow(row: Row, state: boolean): void;
560
- protected emitUserRowClicked(row: Row): void;
570
+ protected emitUserRowClicked({ row, event }: {
571
+ row: Row;
572
+ event: MouseEvent;
573
+ }): void;
561
574
  protected customActionEmitted(event: SmartTableCustomEvent<T>): void;
562
575
  protected editEmitted(row: Row): void;
563
576
  protected editConfirmed(row: Row): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@den4ik92/ng2-smart-table",
3
- "version": "20.7.0",
3
+ "version": "20.7.21",
4
4
  "description": "Angular Smart Table",
5
5
  "author": "Den4ik92",
6
6
  "license": "MIT",