Add entity title function

This commit is contained in:
Igor Kulikov 2020-04-06 16:58:23 +03:00
parent 73da299aaf
commit eb1461a8a3
3 changed files with 5 additions and 1 deletions

View File

@ -16,7 +16,7 @@
-->
<tb-details-panel fxFlex
[headerTitle]="entity?.name"
[headerTitle]="entitiesTableConfig.entityTitle(entity)"
headerSubtitle="{{ translations.details | translate }}"
[isReadOnly]="entitiesTableConfig.detailsReadonly(entity)"
[isEdit]="isEditValue"

View File

@ -163,6 +163,7 @@ export class EntityTableConfig<T extends BaseData<HasId>, P extends PageLink = P
deleteEntity: EntityIdOneWayOperation = () => of();
entitiesFetchFunction: EntitiesFetchFunction<T, P> = () => of(emptyPageData<T>());
onEntityAction: EntityActionFunction<T> = () => false;
entityTitle: EntityStringFunction<T> = (entity) => entity?.name;
}
export function checkBoxCell(value: boolean): string {

View File

@ -56,6 +56,9 @@ export class WidgetsBundlesTableConfigResolver implements Resolve<EntityTableCon
this.config.entityTranslations = entityTypeTranslations.get(EntityType.WIDGETS_BUNDLE);
this.config.entityResources = entityTypeResources.get(EntityType.WIDGETS_BUNDLE);
this.config.entityTitle = (widgetsBundle) => widgetsBundle ?
widgetsBundle.title : '';
this.config.columns.push(
new DateEntityTableColumn<WidgetsBundle>('createdTime', 'common.created-time', this.datePipe, '150px'),
new EntityTableColumn<WidgetsBundle>('title', 'widgets-bundle.title', '100%'),