@dra2020/baseclient 1.0.137 → 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 +19 -6
- package/dist/baseclient.js.map +1 -1
- package/dist/detail/detail.d.ts +1 -1
- package/lib/detail/detail.ts +13 -5
- package/lib/filterexpr/filterexpr.ts +8 -1
- 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('') };
|
|
@@ -1523,6 +1531,11 @@ const UpperR = 82;
|
|
|
1523
1531
|
function isWhite(c) {
|
|
1524
1532
|
return c === Space || c === Newline || c === Tab || c == CR;
|
|
1525
1533
|
}
|
|
1534
|
+
function toString(a) {
|
|
1535
|
+
if (typeof a === 'object' && a && typeof a.value === 'string')
|
|
1536
|
+
return a.value;
|
|
1537
|
+
return String(a);
|
|
1538
|
+
}
|
|
1526
1539
|
var TokType;
|
|
1527
1540
|
(function (TokType) {
|
|
1528
1541
|
TokType[TokType["Text"] = 0] = "Text";
|
|
@@ -1995,7 +2008,7 @@ class FilterExpr {
|
|
|
1995
2008
|
case TokType.Text:
|
|
1996
2009
|
for (let p in o)
|
|
1997
2010
|
if (o.hasOwnProperty(p) && (prop == null || p.toLowerCase() === prop)) {
|
|
1998
|
-
let s =
|
|
2011
|
+
let s = toString(o[p]);
|
|
1999
2012
|
if (s) {
|
|
2000
2013
|
let t = types ? types[p] : undefined;
|
|
2001
2014
|
if (t === 'skip')
|