@masterteam/components 0.0.198 → 0.0.199

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.
@@ -275,10 +275,12 @@ class EntityPercentage {
275
275
  displayName = computed(() => this.data()?.name ?? this.name() ?? '', ...(ngDevMode ? [{ debugName: "displayName" }] : /* istanbul ignore next */ []));
276
276
  displayValue = computed(() => {
277
277
  const d = this.data();
278
- if (d) {
279
- return displayOrPlaceholder(typeof d.value === 'string' ? d.value : null);
280
- }
281
- return displayOrPlaceholder(this.value());
278
+ const raw = d
279
+ ? typeof d.value === 'string'
280
+ ? d.value
281
+ : null
282
+ : this.value();
283
+ return displayOrPlaceholder(this.formatPercentageDisplay(raw));
282
284
  }, ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
283
285
  rawNumericValue = computed(() => this.data()?.rawValue ??
284
286
  this.rawValue() ??
@@ -305,6 +307,18 @@ class EntityPercentage {
305
307
  const fromProperty = d?.propertyConfiguration?.color?.trim();
306
308
  return direct || fromProperty || 'primary';
307
309
  }, ...(ngDevMode ? [{ debugName: "progressColor" }] : /* istanbul ignore next */ []));
310
+ /** Rounds a numeric percentage to one decimal place, preserving a `%` suffix. */
311
+ formatPercentageDisplay(raw) {
312
+ if (isValueMissing(raw)) {
313
+ return raw;
314
+ }
315
+ const num = this.parseNumericValue(raw);
316
+ if (num === null) {
317
+ return raw;
318
+ }
319
+ const rounded = String(Number(num.toFixed(1)));
320
+ return String(raw).includes('%') ? `${rounded}%` : rounded;
321
+ }
308
322
  parseNumericValue(raw) {
309
323
  if (isValueMissing(raw)) {
310
324
  return null;