|
|
|
@ -40,7 +40,7 @@ import { |
|
|
|
import { IWidgetSubscription } from '@core/api/widget-api.models'; |
|
|
|
import { UtilsService } from '@core/services/utils.service'; |
|
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
|
import { createLabelFromDatasource, deepClone, hashCode, isDefined, isNumber } from '@core/utils'; |
|
|
|
import { createLabelFromDatasource, deepClone, hashCode, isDefined, isNumber, isObject } from '@core/utils'; |
|
|
|
import cssjs from '@core/css/css'; |
|
|
|
import { CollectionViewer, DataSource } from '@angular/cdk/collections'; |
|
|
|
import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; |
|
|
|
@ -515,8 +515,16 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni |
|
|
|
if (styleInfo.useCellStyleFunction && styleInfo.cellStyleFunction) { |
|
|
|
try { |
|
|
|
style = styleInfo.cellStyleFunction(value); |
|
|
|
if (!isObject(style)) { |
|
|
|
throw new TypeError(`${style === null ? 'null' : typeof style} instead of style object`); |
|
|
|
} |
|
|
|
if (Array.isArray(style)) { |
|
|
|
throw new TypeError(`Array instead of style object`); |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
style = {}; |
|
|
|
console.warn(`Cell style function for data key '${key.label}' in widget '${this.ctx.widgetTitle}' ` + |
|
|
|
`returns '${e}'. Please check your cell style function.`); |
|
|
|
} |
|
|
|
} else { |
|
|
|
style = {}; |
|
|
|
@ -538,7 +546,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni |
|
|
|
try { |
|
|
|
content = contentInfo.cellContentFunction(value, entity, this.ctx); |
|
|
|
} catch (e) { |
|
|
|
content = '' + value; |
|
|
|
content = '' + value; |
|
|
|
} |
|
|
|
} else { |
|
|
|
content = this.defaultContent(key, contentInfo, value); |
|
|
|
|