@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.
- package/dist/baseclient.js +13 -5
- package/dist/baseclient.js.map +1 -1
- package/dist/detail/detail.d.ts +1 -1
- package/lib/detail/detail.ts +13 -5
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -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
|
-
|
|
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
|
+
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
|
|
1377
|
+
return formatNumber(n, this.options.numberFormat);
|
|
1370
1378
|
}
|
|
1371
1379
|
});
|
|
1372
1380
|
return { n, v: av.join('') };
|