semanticdb-core 1.1.32 → 1.1.34
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.
|
@@ -235,6 +235,10 @@ const getFormatter = (property) => {
|
|
|
235
235
|
return null;
|
|
236
236
|
};
|
|
237
237
|
exports.getFormatter = getFormatter;
|
|
238
|
+
const formatWithNumeralSafely = (value, format) => {
|
|
239
|
+
const formattedValue = (0, numeral_1.default)(value).format(format);
|
|
240
|
+
return formattedValue === 'NaN' ? `${value}` : formattedValue;
|
|
241
|
+
};
|
|
238
242
|
/**
|
|
239
243
|
*
|
|
240
244
|
* @param schema
|
|
@@ -264,19 +268,19 @@ const formatWithProperty = (schema, property, value, withUnit = false) => {
|
|
|
264
268
|
finalValue = value;
|
|
265
269
|
}
|
|
266
270
|
else if (formatter) {
|
|
267
|
-
finalValue = (
|
|
271
|
+
finalValue = formatWithNumeralSafely(value, formatter.formatter);
|
|
268
272
|
}
|
|
269
273
|
else if (property.type === 'percentage') {
|
|
270
|
-
finalValue = (
|
|
274
|
+
finalValue = formatWithNumeralSafely(value, '0.00%');
|
|
271
275
|
}
|
|
272
276
|
else if (property.type === 'int') {
|
|
273
|
-
finalValue = (
|
|
277
|
+
finalValue = formatWithNumeralSafely(value, '0,0');
|
|
274
278
|
}
|
|
275
279
|
else if (property.type === 'currency') {
|
|
276
|
-
finalValue = (
|
|
280
|
+
finalValue = formatWithNumeralSafely(value, '0,0.00');
|
|
277
281
|
}
|
|
278
282
|
else if (property.primal_type === 'number') {
|
|
279
|
-
finalValue = (
|
|
283
|
+
finalValue = formatWithNumeralSafely(value, '0,0.0');
|
|
280
284
|
}
|
|
281
285
|
if (withUnit && property.type !== 'percentage') {
|
|
282
286
|
let unit = '';
|
package/dist/schema/schema.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export interface SchemaTypeDraft {
|
|
|
14
14
|
name: string;
|
|
15
15
|
type: 'entity' | 'event';
|
|
16
16
|
syno?: string[];
|
|
17
|
-
db?: string;
|
|
18
17
|
properties: PropertyTypeDraft[];
|
|
19
18
|
tag?: string[];
|
|
20
19
|
alisa_rank?: number;
|
|
@@ -24,13 +23,16 @@ export interface SchemaTypeDraft {
|
|
|
24
23
|
drilldown_blacklist?: string[];
|
|
25
24
|
};
|
|
26
25
|
drilldown?: GroupbyItemType[];
|
|
27
|
-
projections?: any[];
|
|
28
26
|
etl?: any;
|
|
29
27
|
lastEventDate?: string;
|
|
30
28
|
agg_key?: {
|
|
31
29
|
key: string;
|
|
32
30
|
value: string;
|
|
33
31
|
};
|
|
32
|
+
db?: string;
|
|
33
|
+
from?: string;
|
|
34
|
+
fromSQL?: string;
|
|
35
|
+
projections?: any[];
|
|
34
36
|
}
|
|
35
37
|
export interface SchemaType extends SchemaTypeDraft {
|
|
36
38
|
properties: PropertyType[];
|