diff --git a/src/lib/listing/models/entity.model.ts b/src/lib/listing/models/entity.model.ts new file mode 100644 index 0000000..b8fc65f --- /dev/null +++ b/src/lib/listing/models/entity.model.ts @@ -0,0 +1,17 @@ +import { IListable } from './listable'; + +export abstract class Entity implements IListable { + abstract readonly id: string; + abstract readonly routerLink?: string; + abstract readonly searchKey: string; + + protected constructor(private readonly _interface: I) {} + + get model(): I { + return this._interface; + } + + isEqual(entity: Entity): boolean { + return JSON.stringify(this._interface) === JSON.stringify(entity?._interface); + } +} diff --git a/src/lib/listing/models/index.ts b/src/lib/listing/models/index.ts index 1096e80..586e11a 100644 --- a/src/lib/listing/models/index.ts +++ b/src/lib/listing/models/index.ts @@ -1,3 +1,4 @@ export * from './listable'; +export * from './entity.model'; export * from './table-column-config.model'; export * from './listing-modes'; diff --git a/src/lib/listing/workflow/workflow.component.ts b/src/lib/listing/workflow/workflow.component.ts index 2035962..d5f1149 100644 --- a/src/lib/listing/workflow/workflow.component.ts +++ b/src/lib/listing/workflow/workflow.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, + ChangeDetectorRef, Component, EventEmitter, forwardRef, @@ -63,6 +64,7 @@ export class WorkflowComponent extends Au constructor( @Inject(forwardRef(() => ListingComponent)) readonly listingComponent: ListingComponent, private readonly _loadingService: LoadingService, + private readonly _changeRef: ChangeDetectorRef, readonly listingService: ListingService, readonly entitiesService: EntitiesService, ) { @@ -152,6 +154,8 @@ export class WorkflowComponent extends Au this._addEntity(entity); } }); + + this._changeRef.detectChanges(); } private _addEntity(entity: T): void {