From 6f31165f6027ac9c876323ba63803ca8bfed7123 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 29 May 2025 13:25:34 +0300 Subject: [PATCH] UI: Fixed entities table widgets value formatter for legacy config --- .../widget/lib/entity/entities-table-widget.component.ts | 6 +++--- .../home/components/widget/lib/table-widget.models.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts index 93d9d09b6d..f95c8c26d7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts @@ -167,7 +167,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni private defaultPageSize; private defaultSortOrder = 'entityName'; - private contentsInfo: {[key: string]: CellContentInfo} = {}; + private contentsInfo: {[key: string]: WithOptional} = {}; private stylesInfo: {[key: string]: Observable} = {}; private columnWidth: {[key: string]: string} = {}; private columnDefaultVisibility: {[key: string]: boolean} = {}; @@ -760,7 +760,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni return content$; } - private defaultContent(key: EntityColumn, contentInfo: CellContentInfo, value: any): any { + private defaultContent(key: EntityColumn, contentInfo: WithOptional, value: any): any { if (isDefined(value)) { const entityField = entityFields[key.name]; if (entityField) { @@ -768,7 +768,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni return this.datePipe.transform(value, 'yyyy-MM-dd HH:mm:ss'); } } - return contentInfo.valueFormat.format(value); + return contentInfo.valueFormat?.format(value) ?? value; } else { return ''; } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts index ca57a9e26a..7e91a2f043 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts @@ -107,7 +107,7 @@ export interface CellContentFunctionInfo { export interface CellContentInfo { contentFunction: Observable; - valueFormat?: ValueFormatProcessor + valueFormat: ValueFormatProcessor } export type CellStyleFunction = (...args: any[]) => any;