Browse Source
Merge pull request #22561 from davidsi02/dev
[Angular] Provide row data injection for custom table components
pull/22847/head
Masum ULU
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
11 additions and
3 deletions
-
npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts
-
npm/ng-packs/packages/components/extensible/src/lib/tokens/extensions.token.ts
|
|
@ -46,6 +46,7 @@ import { |
|
|
ENTITY_PROP_TYPE_CLASSES, |
|
|
ENTITY_PROP_TYPE_CLASSES, |
|
|
EXTENSIONS_IDENTIFIER, |
|
|
EXTENSIONS_IDENTIFIER, |
|
|
PROP_DATA_STREAM, |
|
|
PROP_DATA_STREAM, |
|
|
|
|
|
ROW_RECORD, |
|
|
} from '../../tokens/extensions.token'; |
|
|
} from '../../tokens/extensions.token'; |
|
|
import { GridActionsComponent } from '../grid-actions/grid-actions.component'; |
|
|
import { GridActionsComponent } from '../grid-actions/grid-actions.component'; |
|
|
|
|
|
|
|
|
@ -187,6 +188,10 @@ export class ExtensibleTableComponent<R = any> implements OnChanges, AfterViewIn |
|
|
provide: PROP_DATA_STREAM, |
|
|
provide: PROP_DATA_STREAM, |
|
|
useValue: value, |
|
|
useValue: value, |
|
|
}, |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
provide: ROW_RECORD, |
|
|
|
|
|
useValue: record, |
|
|
|
|
|
}, |
|
|
], |
|
|
], |
|
|
parent: this.#injector, |
|
|
parent: this.#injector, |
|
|
}); |
|
|
}); |
|
|
@ -222,8 +227,8 @@ export class ExtensibleTableComponent<R = any> implements OnChanges, AfterViewIn |
|
|
|
|
|
|
|
|
ngAfterViewInit(): void { |
|
|
ngAfterViewInit(): void { |
|
|
this.list?.requestStatus$?.pipe(filter(status => status === 'loading')).subscribe(() => { |
|
|
this.list?.requestStatus$?.pipe(filter(status => status === 'loading')).subscribe(() => { |
|
|
this.data = []; |
|
|
this.data = []; |
|
|
this.cdr.markForCheck(); |
|
|
this.cdr.markForCheck(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
@ -18,6 +18,9 @@ export const PROP_DATA_STREAM = new InjectionToken<Observable<any>>('PROP_DATA_S |
|
|
type EntityPropTypeClassMap = { |
|
|
type EntityPropTypeClassMap = { |
|
|
[key in ePropType]: string; |
|
|
[key in ePropType]: string; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export const ROW_RECORD = new InjectionToken<any>('ROW_RECORD'); |
|
|
|
|
|
|
|
|
export type EntityPropTypeClass = Partial<EntityPropTypeClassMap>; |
|
|
export type EntityPropTypeClass = Partial<EntityPropTypeClassMap>; |
|
|
export const ENTITY_PROP_TYPE_CLASSES = new InjectionToken<EntityPropTypeClass>( |
|
|
export const ENTITY_PROP_TYPE_CLASSES = new InjectionToken<EntityPropTypeClass>( |
|
|
'ENTITY_PROP_TYPE_CLASSES', |
|
|
'ENTITY_PROP_TYPE_CLASSES', |
|
|
|