@den4ik92/ng2-smart-table 19.7.0 → 19.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.
@@ -14,9 +14,12 @@ export declare class Ng2SmartTableTbodyComponent<T extends BaseDataType = any> {
14
14
  readonly createConfirmed: import("@angular/core").OutputEmitterRef<void>;
15
15
  readonly deleteEmitter: import("@angular/core").OutputEmitterRef<Row>;
16
16
  readonly customActionEmitter: import("@angular/core").OutputEmitterRef<SmartTableCustomEvent<T>>;
17
- readonly userClickedRow: import("@angular/core").OutputEmitterRef<Row>;
17
+ readonly userClickedRow: import("@angular/core").OutputEmitterRef<{
18
+ row: Row;
19
+ event: MouseEvent;
20
+ }>;
18
21
  readonly multipleSelectRow: import("@angular/core").OutputEmitterRef<Row>;
19
- rowClicked(row: Row): void;
22
+ rowClicked(row: Row, event: MouseEvent): void;
20
23
  readonly noDataMessage: import("@angular/core").Signal<string>;
21
24
  protected customActionEmitted(actionName: string, row: Row): void;
22
25
  protected trackByIdOrIndex(index: number, item: any): string | number;
@@ -5,6 +5,7 @@ export declare class DataSet {
5
5
  protected columnSettings: SmartTableColumnSettings[];
6
6
  readonly editorInputClass: string;
7
7
  readonly cellEmptyText?: string | undefined;
8
+ idKey?: string | undefined;
8
9
  newRow: Row;
9
10
  protected readonly data: import("@angular/core").WritableSignal<any[]>;
10
11
  protected readonly columns: import("@angular/core").WritableSignal<Column[]>;
@@ -14,7 +15,7 @@ export declare class DataSet {
14
15
  readonly getVisibleColumns: import("@angular/core").Signal<Column[]>;
15
16
  readonly getRows: import("@angular/core").Signal<Row[]>;
16
17
  readonly isAllSelected: import("@angular/core").Signal<boolean>;
17
- constructor(dataList: any[] | undefined, columnSettings: SmartTableColumnSettings[], editorInputClass: string, cellEmptyText?: string | undefined);
18
+ constructor(dataList: any[] | undefined, columnSettings: SmartTableColumnSettings[], editorInputClass: string, cellEmptyText?: string | undefined, idKey?: string | undefined);
18
19
  setData(data: any[]): void;
19
20
  setColumnsConfig(columnSettings: SmartTableColumnSettings[]): void;
20
21
  findRowByData(data: any): Row | undefined;
@@ -5,6 +5,7 @@ export declare abstract class DataSource<T extends BaseDataType = any> {
5
5
  protected readonly onChangedSource: Subject<SmartTableOnChangedEvent>;
6
6
  protected readonly sortConf: import("@angular/core").WritableSignal<SmartTableSortItem | null>;
7
7
  protected readonly filters: import("@angular/core").WritableSignal<SmartTableFilterItem[]>;
8
+ idKey?: string;
8
9
  readonly pagingConf: import("@angular/core").WritableSignal<SmartTablePagerSettings>;
9
10
  protected readonly data: import("@angular/core").WritableSignal<T[]>;
10
11
  /**
@@ -21,5 +21,5 @@ export declare function getRandomId(prefix?: string, suffix?: string): string;
21
21
  export declare function setLocalStorage(key: string, value: string | object | boolean): void;
22
22
  export declare function getLocalStorage<T = string>(key: string): T | null;
23
23
  export declare function compareObjectsAsJSON<T extends Record<string, unknown>>(a: T, b: T): boolean;
24
- export declare function isObjectsIdentical<T extends Record<string, unknown>>(a: T, b: T): boolean;
24
+ export declare function isObjectsIdentical<T extends Record<string, unknown>>(a: T, b: T, idKey?: string): boolean;
25
25
  export declare function CheckParentElementClassRecursive(element: HTMLElement | null, className: string): boolean;
@@ -22,6 +22,12 @@ export interface ColumnPositionState {
22
22
  export interface SmartTableSettings<T extends BaseDataType = any> {
23
23
  selectMode?: 'single' | 'multi';
24
24
  mode?: 'inline' | 'external';
25
+ /**
26
+ * @description Key used to identify and compare row objects. When set, objects are compared
27
+ * by this field instead of the default heuristic (uuid → id → deep equality).
28
+ * @example 'id' | 'uuid' | 'code'
29
+ */
30
+ idKey?: keyof T & string;
25
31
  cellEmptyText?: string;
26
32
  resetSortOnThirdClick?: boolean;
27
33
  columnSort?: {
@@ -194,7 +200,9 @@ interface SmartTableDefaultEvent<T extends BaseDataType = any> {
194
200
  source: DataSource<T>;
195
201
  }
196
202
  export type SmartTableConfirmDeleteEvent<T extends BaseDataType = any> = SmartTableDefaultEvent<T>;
197
- export type SmartTableRowClickedEvent<T extends BaseDataType = any> = Omit<SmartTableDefaultEvent<T>, 'confirm'>;
203
+ export interface SmartTableRowClickedEvent<T extends BaseDataType = any> extends Omit<SmartTableDefaultEvent<T>, 'confirm'> {
204
+ event: MouseEvent;
205
+ }
198
206
  export interface SmartTableCustomEvent<T extends BaseDataType = any> extends Omit<SmartTableDefaultEvent<T>, 'confirm'> {
199
207
  action: string;
200
208
  }
@@ -1,13 +1,13 @@
1
- import { AfterViewInit, ElementRef, Injector, NgZone, OnChanges, OnDestroy, SimpleChange, TemplateRef, ViewContainerRef } from '@angular/core';
1
+ import { AfterViewInit, OnChanges, OnDestroy, SimpleChange, TemplateRef, ViewContainerRef } from '@angular/core';
2
2
  import { Row } from './lib/data-set/row';
3
3
  import { DataSource } from './lib/data-source/data-source';
4
4
  import { Grid } from './lib/grid';
5
5
  import { BaseDataType, ColumnPositionState, SmartTableBaseEvent, SmartTableConfirmDeleteEvent, SmartTableConfirmEditEvent, SmartTableCreateConfirm, SmartTableCustomEvent, SmartTableRowClickedEvent, SmartTableRowSelectEvent, SmartTableSettings } from './lib/interfaces/smart-table.models';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class Ng2SmartTableComponent<T extends BaseDataType = any> implements OnChanges, OnDestroy, AfterViewInit {
8
- private elementRef;
9
- private ngZone;
10
- private injector;
8
+ private readonly elementRef;
9
+ private readonly ngZone;
10
+ private readonly injector;
11
11
  readonly source: import("@angular/core").InputSignal<DataSource<T>>;
12
12
  readonly settings: import("@angular/core").InputSignal<SmartTableSettings<T>>;
13
13
  /**
@@ -67,14 +67,16 @@ export declare class Ng2SmartTableComponent<T extends BaseDataType = any> implem
67
67
  private resizeObserver;
68
68
  private resizeDebounceTimer;
69
69
  private paginationComponentRef;
70
- constructor(elementRef: ElementRef, ngZone: NgZone, injector: Injector);
71
70
  ngOnChanges({ settings }: Record<string, SimpleChange>): void;
72
71
  ngAfterViewInit(): void;
73
72
  ngOnDestroy(): void;
74
73
  protected multipleSelectRow(row: Row): void;
75
74
  protected onSelectAllRows(): void;
76
75
  protected onSelectRow(row: Row, state: boolean): void;
77
- protected emitUserRowClicked(row: Row): void;
76
+ protected emitUserRowClicked({ row, event }: {
77
+ row: Row;
78
+ event: MouseEvent;
79
+ }): void;
78
80
  protected customActionEmitted(event: SmartTableCustomEvent<T>): void;
79
81
  protected editEmitted(row: Row): void;
80
82
  protected editConfirmed(row: Row): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@den4ik92/ng2-smart-table",
3
- "version": "19.7.0",
3
+ "version": "19.7.21",
4
4
  "description": "Angular Smart Table",
5
5
  "author": "Den4ik92",
6
6
  "license": "MIT",