@dra2020/baseclient 1.0.138 → 1.0.140
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/dist/baseclient.js +12 -5
- package/dist/baseclient.js.map +1 -1
- package/dist/detail/detail.d.ts +1 -1
- package/lib/detail/detail.ts +12 -5
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -1246,10 +1246,17 @@ 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
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
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
|
+
// Only have implementation for 'locale'
|
|
1257
|
+
return n.toLocaleString(undefined, { maximumFractionDigits: precision, minimumFractionDigits: precision });
|
|
1258
|
+
}
|
|
1259
|
+
const DefaultDetailOptions = { numberFormat: 'locale.0' };
|
|
1253
1260
|
class Evaluator {
|
|
1254
1261
|
constructor(expr) {
|
|
1255
1262
|
this.expr = expr;
|
|
@@ -1366,7 +1373,7 @@ class FormatDetail {
|
|
|
1366
1373
|
n = e.eval(o);
|
|
1367
1374
|
if (!this._error)
|
|
1368
1375
|
this._error = e.error;
|
|
1369
|
-
return this.options.numberFormat
|
|
1376
|
+
return formatNumber(n, this.options.numberFormat);
|
|
1370
1377
|
}
|
|
1371
1378
|
});
|
|
1372
1379
|
return { n, v: av.join('') };
|