@c8y/ngx-components 1024.13.0 → 1024.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs +18 -7
- package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-scada.mjs +8 -4
- package/fesm2022/c8y-ngx-components-widgets-implementations-scada.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/locales/de.po +43 -48
- package/locales/es.po +42 -47
- package/locales/fr.po +44 -49
- package/locales/ja_JP.po +38 -42
- package/locales/ko.po +41 -46
- package/locales/nl.po +43 -48
- package/locales/pl.po +41 -46
- package/locales/pt_BR.po +43 -48
- package/locales/zh_CN.po +40 -45
- package/locales/zh_TW.po +43 -48
- package/package.json +1 -1
- package/types/c8y-ngx-components-widgets-implementations-scada.d.ts +2 -1
- package/types/c8y-ngx-components-widgets-implementations-scada.d.ts.map +1 -1
- package/types/c8y-ngx-components.d.ts +5 -0
- package/types/c8y-ngx-components.d.ts.map +1 -1
|
@@ -228,10 +228,10 @@ class IconCellRendererComponent {
|
|
|
228
228
|
if (!Array.isArray(iconConfigs))
|
|
229
229
|
return null;
|
|
230
230
|
return (iconConfigs.find(config => {
|
|
231
|
-
const { comparison, value } = config;
|
|
231
|
+
const { comparison, value, dataType } = config;
|
|
232
232
|
if (!comparison || value === undefined || value === null)
|
|
233
233
|
return false;
|
|
234
|
-
return this.evaluateCondition(cellValue, comparison.value, value);
|
|
234
|
+
return this.evaluateCondition(cellValue, comparison.value, value, dataType?.value);
|
|
235
235
|
}) ?? null);
|
|
236
236
|
}
|
|
237
237
|
resolveValue(context) {
|
|
@@ -245,16 +245,27 @@ class IconCellRendererComponent {
|
|
|
245
245
|
}
|
|
246
246
|
return item[path];
|
|
247
247
|
}
|
|
248
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Whether `cellValue`/`value` may be compared as numbers instead of their native types.
|
|
250
|
+
* Skipped when the condition's declared data type is explicitly `'string'`; a missing
|
|
251
|
+
* data type (e.g. after a legacy config round-trip) still allows numeric comparison.
|
|
252
|
+
*/
|
|
253
|
+
canCompareNumerically(cellValue, value, dataType) {
|
|
254
|
+
if (dataType === 'string')
|
|
255
|
+
return false;
|
|
256
|
+
return [cellValue, value].every(v => v != null && String(v).trim() !== '' && typeof v !== 'boolean' && !Number.isNaN(Number(v)));
|
|
257
|
+
}
|
|
258
|
+
evaluateCondition(cellValue, operator, value, dataType) {
|
|
259
|
+
const numeric = this.canCompareNumerically(cellValue, value, dataType);
|
|
249
260
|
switch (operator) {
|
|
250
261
|
case 'GREATER_THAN':
|
|
251
|
-
return cellValue > value;
|
|
262
|
+
return numeric ? Number(cellValue) > Number(value) : cellValue > value;
|
|
252
263
|
case 'LESS_THAN':
|
|
253
|
-
return cellValue < value;
|
|
264
|
+
return numeric ? Number(cellValue) < Number(value) : cellValue < value;
|
|
254
265
|
case 'EQUAL':
|
|
255
|
-
return cellValue === value;
|
|
266
|
+
return cellValue === value || (numeric && Number(cellValue) === Number(value));
|
|
256
267
|
case 'NOT_EQUAL':
|
|
257
|
-
return cellValue !== value;
|
|
268
|
+
return cellValue !== value && !(numeric && Number(cellValue) === Number(value));
|
|
258
269
|
case 'CONTAINS':
|
|
259
270
|
return typeof cellValue === 'string' && cellValue.includes(value);
|
|
260
271
|
case 'STARTS_WITH':
|