diff --git a/ui/nuxeo-aggregation/nuxeo-checkbox-aggregation.js b/ui/nuxeo-aggregation/nuxeo-checkbox-aggregation.js index 180fc4d01..fbc031d7a 100644 --- a/ui/nuxeo-aggregation/nuxeo-checkbox-aggregation.js +++ b/ui/nuxeo-aggregation/nuxeo-checkbox-aggregation.js @@ -146,9 +146,9 @@ import { AggregationBehavior } from './nuxeo-aggregation-behavior.js'; noink checked="{{item.checked}}" on-change="_computeValues" - aria-label$="[[item.label]] ([[item.docCount]])" + aria-label$="[[item.label]] ([[_formatDocCount(item.docCount)]])" > - [[item.label]] ([[item.docCount]]) + [[item.label]] ([[_formatDocCount(item.docCount)]]) @@ -179,9 +179,9 @@ import { AggregationBehavior } from './nuxeo-aggregation-behavior.js'; noink checked="{{item.checked}}" on-change="_computeValues" - aria-label$="[[item.label]] ([[item.docCount]])" + aria-label$="[[item.label]] ([[_formatDocCount(item.docCount)]])" > - [[item.label]] ([[item.docCount]]) + [[item.label]] ([[_formatDocCount(item.docCount)]]) @@ -257,6 +257,22 @@ import { AggregationBehavior } from './nuxeo-aggregation-behavior.js'; this.setAttribute('tabindex', 0); } + _formatDocCount(docCount) { + // Fetch the property value from web-ui-properties.xml + const isNumberFormattingEnabled = + Nuxeo && + Nuxeo.UI && + Nuxeo.UI.config && + Nuxeo.UI.config.numberFormattingEnabled !== undefined + ? Nuxeo.UI.config.numberFormattingEnabled + : false; // Default to false if the property is not set + + if (isNumberFormattingEnabled) { + return new Intl.NumberFormat().format(docCount); // Apply formatting if enabled + } + return docCount.toString(); // Return if formatting is disabled + } + _computeVisibleBuckets(buckets, visibleItems, _showAll) { if (!buckets || buckets.length === 0) { return [];