@dra2020/baseclient 1.0.138 → 1.0.139

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.
@@ -1246,10 +1246,18 @@ exports.FormatDetail = void 0;
1246
1246
  const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
1247
1247
  const reIdentifier = /\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g;
1248
1248
  const reParam = /^__\d+$/;
1249
- function defaultNumberFormat(n) {
1250
- return Util.precisionRound(n, 0).toLocaleString();
1251
- }
1252
- const DefaultDetailOptions = { numberFormat: defaultNumberFormat };
1249
+ // Number format: (locale|general|integer|currency).precision
1250
+ function formatNumber(n, format) {
1251
+ if (!format)
1252
+ format = 'locale.0';
1253
+ let parts = format.split('.');
1254
+ let fmt = parts[0];
1255
+ let precision = Number(parts[1] || '0');
1256
+ n = Util.precisionRound(n, precision);
1257
+ // Only have implementation for 'locale'
1258
+ return n.toLocaleString();
1259
+ }
1260
+ const DefaultDetailOptions = { numberFormat: 'locale.0' };
1253
1261
  class Evaluator {
1254
1262
  constructor(expr) {
1255
1263
  this.expr = expr;
@@ -1366,7 +1374,7 @@ class FormatDetail {
1366
1374
  n = e.eval(o);
1367
1375
  if (!this._error)
1368
1376
  this._error = e.error;
1369
- return this.options.numberFormat(n);
1377
+ return formatNumber(n, this.options.numberFormat);
1370
1378
  }
1371
1379
  });
1372
1380
  return { n, v: av.join('') };