|
|
@ -35,7 +35,7 @@ import { DataKey, WidgetActionDescriptor, WidgetConfig } from '@shared/models/wi |
|
|
import { IWidgetSubscription } from '@core/api/widget-api.models'; |
|
|
import { IWidgetSubscription } from '@core/api/widget-api.models'; |
|
|
import { UtilsService } from '@core/services/utils.service'; |
|
|
import { UtilsService } from '@core/services/utils.service'; |
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
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 cssjs from '@core/css/css'; |
|
|
import { sortItems } from '@shared/models/page/page-link'; |
|
|
import { sortItems } from '@shared/models/page/page-link'; |
|
|
import { Direction } from '@shared/models/page/sort-order'; |
|
|
import { Direction } from '@shared/models/page/sort-order'; |
|
|
@ -598,8 +598,16 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, |
|
|
if (styleInfo.useCellStyleFunction && styleInfo.cellStyleFunction) { |
|
|
if (styleInfo.useCellStyleFunction && styleInfo.cellStyleFunction) { |
|
|
try { |
|
|
try { |
|
|
style = styleInfo.cellStyleFunction(value); |
|
|
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) { |
|
|
} catch (e) { |
|
|
style = {}; |
|
|
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 { |
|
|
} else { |
|
|
style = this.defaultStyle(key, value); |
|
|
style = this.defaultStyle(key, value); |
|
|
|