@quickbi/bi-open 4.0.0

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/esm/index.mjs ADDED
@@ -0,0 +1,623 @@
1
+ // src/basic/bi-open/src/utils/format.ts
2
+ import Big from "big.js";
3
+ var KMG = [
4
+ "",
5
+ "K",
6
+ "M",
7
+ "B",
8
+ "T",
9
+ "P",
10
+ "Z"
11
+ ];
12
+ var CN = [
13
+ "",
14
+ "\u4E07",
15
+ "\u4EBF",
16
+ "\u4E07\u4EBF",
17
+ "\u4EBF\u4EBF",
18
+ "\u4E07\u4EBF\u4EBF"
19
+ ];
20
+ var CNT = [
21
+ "",
22
+ "\u842C",
23
+ "\u5104",
24
+ "\u842C\u5104"
25
+ ];
26
+ var CN2 = [
27
+ "",
28
+ "\u4E07",
29
+ "\u5341\u4E07",
30
+ "\u767E\u4E07",
31
+ "\u5343\u4E07",
32
+ "\u4EBF",
33
+ "\u5341\u4EBF",
34
+ "\u767E\u4EBF",
35
+ "\u5343\u4EBF",
36
+ "\u4E07\u4EBF"
37
+ ];
38
+ var BLANK = /^\s*$/;
39
+ function NE(n) {
40
+ var ne = typeof n === "string" ? n : Number(n).toString();
41
+ var e = Math.max(ne.indexOf("e"), ne.indexOf("E"));
42
+ if (e > 0) {
43
+ var z = parseInt(ne.substring(e + 1), 10);
44
+ if (z < 0) {
45
+ ne = Number(n).toFixed(Math.min(Math.abs(z) + e - 1, 20)).toString();
46
+ } else {
47
+ ne = Number(n / Math.pow(10, z - e + 1)).toFixed(0).toString();
48
+ for (var i = 0; i < z - e + 2; i++) {
49
+ ne += "0";
50
+ }
51
+ }
52
+ }
53
+ return ne;
54
+ }
55
+ function fmtNumber(num, partten) {
56
+ var fmtarr = partten ? partten.split(".") : [
57
+ ""
58
+ ];
59
+ var multiple = 1;
60
+ if (/%$/.test(partten)) {
61
+ multiple = 2;
62
+ } else if (/‰$/.test(partten)) {
63
+ multiple = 3;
64
+ }
65
+ if (multiple > 1) {
66
+ num *= Math.pow(10, multiple);
67
+ }
68
+ var fix = 0;
69
+ var len = fmtarr.length > 1 ? fmtarr[1].length : 0;
70
+ for (var fi = 0; fi < len; fi++) {
71
+ switch (fmtarr[1].substr(fi, 1)) {
72
+ case "#":
73
+ case "0":
74
+ fix += 1;
75
+ break;
76
+ default:
77
+ }
78
+ }
79
+ var numFixed = Number(num).toFixed(Math.min(fix, 20));
80
+ var neg = num < 0;
81
+ numFixed = Math.abs(parseFloat(numFixed));
82
+ var strarr = NE(numFixed).split(".");
83
+ var retstr = "";
84
+ var str = strarr[0];
85
+ var fmt = fmtarr[0];
86
+ var i = str.length - 1;
87
+ var f;
88
+ var comma = false;
89
+ for (var j = fmt.length - 1; j >= 0; --j) {
90
+ f = fmt.substr(j, 1);
91
+ switch (f) {
92
+ case "#":
93
+ case "0":
94
+ if (i >= 0) {
95
+ retstr = str.substr(i--, 1) + retstr;
96
+ } else if (f === "0") {
97
+ retstr = "0".concat(retstr);
98
+ }
99
+ break;
100
+ case ",":
101
+ comma = true;
102
+ retstr = ",".concat(retstr);
103
+ break;
104
+ default:
105
+ retstr = fmt.substr(j, 1) + retstr;
106
+ }
107
+ }
108
+ if (i >= 0) {
109
+ if (comma) {
110
+ var l = str.length;
111
+ for (; i >= 0; i--) {
112
+ retstr = str.substr(i, 1) + retstr;
113
+ if (i > 0 && (l - i) % 3 === 0) {
114
+ retstr = ",".concat(retstr);
115
+ }
116
+ }
117
+ } else {
118
+ retstr = str.substr(0, i + 1) + retstr;
119
+ }
120
+ }
121
+ var tail = [];
122
+ str = strarr.length > 1 ? strarr[1] : "";
123
+ fmt = fmtarr.length > 1 ? fmtarr[1] : "";
124
+ i = 0;
125
+ var m = 0;
126
+ for (var k = 0; k < fmt.length; ++k) {
127
+ f = fmt.substr(k, 1);
128
+ switch (f) {
129
+ case "#":
130
+ case "0":
131
+ m = Math.max(m, f == 0 ? k + 1 : m);
132
+ if (i < str.length) {
133
+ tail.push(str.substr(i++, 1));
134
+ } else {
135
+ tail.push("0");
136
+ }
137
+ break;
138
+ default:
139
+ tail.push(f);
140
+ }
141
+ }
142
+ if (tail.length > 0) {
143
+ tail = tail.join("").replace(new RegExp(m > 0 ? "(\\d{1,".concat(m, "})0*(\\D*)$") : "0*(\\D*)$", "g"), m > 0 ? "$1$2" : "$1");
144
+ retstr += /^\d/.test(tail) ? ".".concat(tail) : tail;
145
+ }
146
+ return (neg ? "-" : "") + retstr.replace(/^,+/, "").replace(/\.$/, "");
147
+ }
148
+ function toThousandth(inputString) {
149
+ var regExpInfo = /(\d{1,3})(?=(\d{3})+(?:$|\.))/g;
150
+ var parts = inputString.toString().split(".");
151
+ parts[0] = parts[0].replace(regExpInfo, "$1,");
152
+ return parts.join(".");
153
+ }
154
+ function formatNumber(num, partten) {
155
+ var invalidString = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "N/A";
156
+ if (num === null || num === void 0 || isNaN(Number(num)) || BLANK.test("".concat(num))) {
157
+ return num || invalidString;
158
+ }
159
+ if (!partten) {
160
+ return num;
161
+ }
162
+ var $num = Number(num);
163
+ var neg = $num < 0;
164
+ var i;
165
+ var j;
166
+ var d;
167
+ var r;
168
+ var p;
169
+ var fmt;
170
+ $num = Math.abs($num);
171
+ if (partten === "CN") {
172
+ for (i = 0, d = 1; i < 4; i++) {
173
+ if ($num < 1e4 * d - 1) {
174
+ r = NE($num / d);
175
+ p = r.indexOf(".");
176
+ fmt = [];
177
+ for (j = 0; j < 4; j++) {
178
+ if (j === p) {
179
+ fmt.push(".");
180
+ }
181
+ fmt.push("#");
182
+ }
183
+ return (neg ? "-" : "") + fmtNumber(r, fmt.join("")) + CN[Math.max(i - 1, 0)];
184
+ }
185
+ d = Math.pow(1e4, i);
186
+ }
187
+ return num;
188
+ }
189
+ if (partten === "CNT") {
190
+ for (i = 0, d = 1; i < 4; i++) {
191
+ if ($num < 1e4 * d - 1) {
192
+ r = NE($num / d);
193
+ p = r.indexOf(".");
194
+ fmt = [];
195
+ for (j = 0; j < 4; j++) {
196
+ if (j === p) {
197
+ fmt.push(".");
198
+ }
199
+ fmt.push("#");
200
+ }
201
+ return (neg ? "-" : "") + fmtNumber(r, fmt.join("")) + CNT[Math.max(i - 1, 0)];
202
+ }
203
+ d = Math.pow(1e4, i);
204
+ }
205
+ return num;
206
+ }
207
+ if (partten === "EN") {
208
+ for (i = 0, d = 1; i < 4; i++) {
209
+ if ($num < 1e4 * d - 1) {
210
+ r = NE($num / d);
211
+ p = r.indexOf(".");
212
+ fmt = [];
213
+ for (j = 0; j < 4; j++) {
214
+ if (j === p) {
215
+ fmt.push(".");
216
+ }
217
+ fmt.push("#");
218
+ }
219
+ var unit = "";
220
+ var floatNum = parseFloat(r);
221
+ if (CN[Math.max(i - 1, 0)] === "\u4E07") {
222
+ if (parseFloat(r) / 100 < 1) {
223
+ floatNum = parseFloat(r) * 10;
224
+ unit = "K";
225
+ } else {
226
+ num = parseFloat(r) / 100;
227
+ unit = "M";
228
+ }
229
+ }
230
+ if (CN[Math.max(i - 1, 0)] === "\u4EBF") {
231
+ if (parseFloat(r) / 10 < 1) {
232
+ floatNum = parseFloat(r) * 100;
233
+ unit = "M";
234
+ } else {
235
+ floatNum = parseFloat(r) / 10;
236
+ unit = "B";
237
+ }
238
+ }
239
+ if (CN[Math.max(i - 1, 0)] === "\u4E07\u4EBF") {
240
+ floatNum = parseFloat(r) * 1e3;
241
+ unit = "B";
242
+ }
243
+ floatNum = floatNum.toFixed(2);
244
+ var numArray = "".concat(floatNum).split(".");
245
+ if (numArray[1] === "00") {
246
+ floatNum = numArray[0];
247
+ }
248
+ return (neg ? "-" : "") + floatNum + unit;
249
+ }
250
+ d = Math.pow(1e4, i);
251
+ }
252
+ return num;
253
+ }
254
+ if (partten === "CN2") {
255
+ if ($num < 1e4) {
256
+ return fmtNumber($num, "###.#");
257
+ }
258
+ for (i = 0, d = 1e3; i < 10; i++) {
259
+ if ($num < d - 1) {
260
+ return (neg ? "-" : "") + fmtNumber($num / d * 10, "#.##") + CN2[Math.max(i - 1, 0)];
261
+ }
262
+ d *= 10;
263
+ }
264
+ return num;
265
+ }
266
+ if (partten === "KMG") {
267
+ for (i = 0, d = 1; i < 8; i++) {
268
+ if ($num < 1e3 * d - 1) {
269
+ r = NE($num / d);
270
+ p = r.indexOf(".");
271
+ fmt = [];
272
+ for (j = 0; j < 3; j++) {
273
+ if (j === p) {
274
+ fmt.push(".");
275
+ }
276
+ fmt.push("#");
277
+ }
278
+ return (neg ? "-" : "") + fmtNumber(r, fmt.join("")) + KMG[Math.max(i - 1, 0)];
279
+ }
280
+ d = Math.pow(1e3, i);
281
+ }
282
+ return num;
283
+ }
284
+ return fmtNumber(num, partten);
285
+ }
286
+ function formatNumberWithConfig(num, config) {
287
+ if (num == null || num === void 0 || isNaN(Number(num)) || BLANK.test("".concat(num)) || !config) {
288
+ return num || "N/A";
289
+ }
290
+ var $num = Number(num);
291
+ var neg = $num < 0;
292
+ var i;
293
+ var j;
294
+ var d;
295
+ var r;
296
+ var p;
297
+ var fmt;
298
+ var reg;
299
+ $num = Math.abs($num);
300
+ var fmtType;
301
+ if (config.fmtType) {
302
+ fmtType = config.fmtType;
303
+ } else {
304
+ fmtType = config.fmt !== "CN" && config.fmt !== "KMG" && config.fmt !== "CNT" ? "Custom" : config.fmt;
305
+ }
306
+ if (fmtType === "CN") {
307
+ for (i = 0, d = 1; i < 7; i++) {
308
+ if ($num < 1e4 * d - 1) {
309
+ r = NE($num / d);
310
+ p = r.indexOf(".");
311
+ fmt = [];
312
+ reg = "####.";
313
+ if (config.decimalPlaces !== "" && !isNaN(Number(config.decimalPlaces))) {
314
+ for (j = 0; j < Number(config.decimalPlaces); j++) {
315
+ reg += "#";
316
+ }
317
+ return (neg ? "-" : "") + Number(fmtNumber(r, reg)).toFixed(config.decimalPlaces) + CN[Math.max(i - 1, 0)];
318
+ }
319
+ for (j = 0; j < 4; j++) {
320
+ if (j === p) {
321
+ fmt.push(".");
322
+ }
323
+ fmt.push("#");
324
+ }
325
+ reg = fmt.join("");
326
+ return (neg ? "-" : "") + fmtNumber(r, reg) + CN[Math.max(i - 1, 0)];
327
+ }
328
+ d = Math.pow(1e4, i);
329
+ }
330
+ return num;
331
+ }
332
+ if (fmtType === "CNT") {
333
+ for (i = 0, d = 1; i < 5; i++) {
334
+ if ($num < 1e4 * d - 1) {
335
+ r = NE($num / d);
336
+ p = r.indexOf(".");
337
+ fmt = [];
338
+ reg = "####.";
339
+ if (config.decimalPlaces !== "" && !isNaN(Number(config.decimalPlaces))) {
340
+ for (j = 0; j < Number(config.decimalPlaces); j++) {
341
+ reg += "#";
342
+ }
343
+ return (neg ? "-" : "") + Number(fmtNumber(r, reg)).toFixed(config.decimalPlaces) + CNT[Math.max(i - 1, 0)];
344
+ }
345
+ for (j = 0; j < 4; j++) {
346
+ if (j === p) {
347
+ fmt.push(".");
348
+ }
349
+ fmt.push("#");
350
+ }
351
+ reg = fmt.join("");
352
+ return (neg ? "-" : "") + fmtNumber(r, reg) + CNT[Math.max(i - 1, 0)];
353
+ }
354
+ d = Math.pow(1e4, i);
355
+ }
356
+ return num;
357
+ }
358
+ if (fmtType === "KMG") {
359
+ for (i = 0, d = 1; i < 8; i++) {
360
+ if ($num < 1e3 * d - 1) {
361
+ r = NE($num / d);
362
+ p = r.indexOf(".");
363
+ fmt = [];
364
+ reg = "###.";
365
+ if (config.decimalPlaces !== "" && !isNaN(Number(config.decimalPlaces))) {
366
+ for (j = 0; j < Number(config.decimalPlaces); j++) {
367
+ reg += "#";
368
+ }
369
+ return (neg ? "-" : "") + Number(fmtNumber(r, reg)).toFixed(config.decimalPlaces) + KMG[Math.max(i - 1, 0)];
370
+ }
371
+ for (j = 0; j < 3; j++) {
372
+ if (j === p) {
373
+ fmt.push(".");
374
+ }
375
+ fmt.push("#");
376
+ }
377
+ reg = fmt.join("");
378
+ return (neg ? "-" : "") + fmtNumber(r, reg) + KMG[Math.max(i - 1, 0)];
379
+ }
380
+ d = Math.pow(1e3, i);
381
+ }
382
+ return num;
383
+ }
384
+ if (fmtType === "Custom") {
385
+ return formatNumber(num, config.fmt);
386
+ }
387
+ if (fmtType === "None") {
388
+ if (!config.showPercent && config.magnitudeFormat) {
389
+ num = NE(Number(num) / Math.pow(10, config === null || config === void 0 ? void 0 : config.magnitudeFormat));
390
+ }
391
+ $num = Number(num);
392
+ var showPercent = config.showPercent || [
393
+ "oneDecimalPercent",
394
+ "twoDecimalPercent",
395
+ "percent"
396
+ ].includes(config.selectType);
397
+ if (showPercent) {
398
+ $num = Number(Big($num).times(100).valueOf());
399
+ num = $num.toString();
400
+ }
401
+ if (config.decimalPlaces !== "" && !isNaN(Number(config.decimalPlaces))) {
402
+ num = $num.toFixed(Number(config.decimalPlaces));
403
+ }
404
+ if (showPercent) {
405
+ num += "%";
406
+ } else {
407
+ if (config.thousandth) {
408
+ num = toThousandth(num);
409
+ }
410
+ if (config.dataMagnitude) {
411
+ return num + config.dataMagnitude;
412
+ }
413
+ }
414
+ return num;
415
+ }
416
+ return formatNumber(num, config.fmt);
417
+ }
418
+
419
+ // src/basic/bi-open/src/utils/i18n.ts
420
+ function _class_call_check(instance, Constructor) {
421
+ if (!(instance instanceof Constructor)) {
422
+ throw new TypeError("Cannot call a class as a function");
423
+ }
424
+ }
425
+ function _defineProperties(target, props) {
426
+ for (var i = 0; i < props.length; i++) {
427
+ var descriptor = props[i];
428
+ descriptor.enumerable = descriptor.enumerable || false;
429
+ descriptor.configurable = true;
430
+ if ("value" in descriptor) descriptor.writable = true;
431
+ Object.defineProperty(target, descriptor.key, descriptor);
432
+ }
433
+ }
434
+ function _create_class(Constructor, protoProps, staticProps) {
435
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
436
+ if (staticProps) _defineProperties(Constructor, staticProps);
437
+ return Constructor;
438
+ }
439
+ function _define_property(obj, key, value) {
440
+ if (key in obj) {
441
+ Object.defineProperty(obj, key, {
442
+ value,
443
+ enumerable: true,
444
+ configurable: true,
445
+ writable: true
446
+ });
447
+ } else {
448
+ obj[key] = value;
449
+ }
450
+ return obj;
451
+ }
452
+ var I18n = /* @__PURE__ */ function() {
453
+ "use strict";
454
+ function I18n2(options) {
455
+ _class_call_check(this, I18n2);
456
+ var _window_globalConfig, _window;
457
+ _define_property(this, "lng", void 0);
458
+ _define_property(this, "resources", void 0);
459
+ var _options_lng = options.lng, lng = _options_lng === void 0 ? (_window = window) === null || _window === void 0 ? void 0 : (_window_globalConfig = _window.globalConfig) === null || _window_globalConfig === void 0 ? void 0 : _window_globalConfig.currentLang : _options_lng, resources = options.resources;
460
+ this.lng = lng;
461
+ this.resources = resources;
462
+ }
463
+ _create_class(I18n2, [
464
+ {
465
+ /**
466
+ * 翻译函数
467
+ * 例如: t("{{who}}吃{{count}}个苹果", { who: t("我们"), count: 2 })
468
+ * @param key
469
+ * @param param
470
+ */
471
+ key: "t",
472
+ value: function t(key, param) {
473
+ var _this_resources;
474
+ var _this_resources_this_lng;
475
+ var dict = (_this_resources_this_lng = (_this_resources = this.resources) === null || _this_resources === void 0 ? void 0 : _this_resources[this.lng]) !== null && _this_resources_this_lng !== void 0 ? _this_resources_this_lng : {};
476
+ var _ref, _ref1;
477
+ var res = (_ref1 = (_ref = typeof (param === null || param === void 0 ? void 0 : param.count) === "number" && (param === null || param === void 0 ? void 0 : param.count) > 1 ? dict["".concat(key, "_plural")] : dict[key]) !== null && _ref !== void 0 ? _ref : dict[key]) !== null && _ref1 !== void 0 ? _ref1 : key;
478
+ Object.keys(param !== null && param !== void 0 ? param : {}).forEach(function(paramKey) {
479
+ var paramValue = "".concat(param[paramKey]);
480
+ res = res.replace(new RegExp("{{\\s*".concat(paramKey, "\\s*}}"), "g"), paramValue);
481
+ });
482
+ return res;
483
+ }
484
+ }
485
+ ], [
486
+ {
487
+ key: "init",
488
+ value: (
489
+ /**
490
+ * 初始化
491
+ * 国际化词条绑定在全局对象上, meta 和 component 就可以复用
492
+ * 从而减少打包体积
493
+ */
494
+ function init(options) {
495
+ var i18n = new I18n2(options);
496
+ return i18n;
497
+ }
498
+ )
499
+ }
500
+ ]);
501
+ return I18n2;
502
+ }();
503
+
504
+ // src/basic/bi-open/src/revisal/index.ts
505
+ import compareVersion2 from "compare-versions";
506
+
507
+ // src/basic/bi-open/src/revisal/changelog.ts
508
+ import compareVersion from "compare-versions";
509
+
510
+ // src/basic/bi-open/src/revisal/guards/4.1/index.ts
511
+ import { FieldType, OperationTypes } from "@quickbi/bi-types";
512
+ import { set } from "lodash/fp";
513
+ function reviser(componentMeta) {
514
+ var _componentMeta_propsSchema_dataSchema, _componentMeta_propsSchema;
515
+ var schema = componentMeta === null || componentMeta === void 0 ? void 0 : (_componentMeta_propsSchema = componentMeta.propsSchema) === null || _componentMeta_propsSchema === void 0 ? void 0 : (_componentMeta_propsSchema_dataSchema = _componentMeta_propsSchema.dataSchema) === null || _componentMeta_propsSchema_dataSchema === void 0 ? void 0 : _componentMeta_propsSchema_dataSchema.schema;
516
+ var _schema_area;
517
+ var drillArea = ((_schema_area = schema === null || schema === void 0 ? void 0 : schema.area) !== null && _schema_area !== void 0 ? _schema_area : []).find(function(each) {
518
+ return each.queryAxis === "drill";
519
+ });
520
+ var _schema_area1;
521
+ var newDataSchema = {
522
+ areas: ((_schema_area1 = schema === null || schema === void 0 ? void 0 : schema.area) !== null && _schema_area1 !== void 0 ? _schema_area1 : []).map(function(each) {
523
+ var _each_rule, _drillArea_rule, _each_rule1, _each_rule2;
524
+ var fieldTypes = [];
525
+ switch ((_each_rule = each.rule) === null || _each_rule === void 0 ? void 0 : _each_rule.type) {
526
+ case "dimension":
527
+ fieldTypes.push(FieldType.dimension);
528
+ break;
529
+ case "measure":
530
+ fieldTypes.push(FieldType.measure);
531
+ break;
532
+ case "all":
533
+ fieldTypes.push(FieldType.measure, FieldType.dimension);
534
+ break;
535
+ default:
536
+ }
537
+ var operationList = [];
538
+ if (each.queryAxis === "row" && drillArea && ((_drillArea_rule = drillArea.rule) === null || _drillArea_rule === void 0 ? void 0 : _drillArea_rule.show) !== false) {
539
+ operationList.push({
540
+ type: OperationTypes.DRILL,
541
+ visible: true
542
+ });
543
+ }
544
+ return {
545
+ id: each.id,
546
+ name: each.areaName,
547
+ queryAxis: each.queryAxis,
548
+ rule: {
549
+ maxColNum: (_each_rule1 = each.rule) === null || _each_rule1 === void 0 ? void 0 : _each_rule1.maxColNum,
550
+ required: (_each_rule2 = each.rule) === null || _each_rule2 === void 0 ? void 0 : _each_rule2.required,
551
+ fieldTypes
552
+ },
553
+ operationList
554
+ };
555
+ }),
556
+ resultDisplay: {
557
+ upLimit: schema === null || schema === void 0 ? void 0 : schema.limitNum
558
+ }
559
+ };
560
+ var newComponentMeta = set("propsSchema.dataSchema", newDataSchema, componentMeta);
561
+ return newComponentMeta;
562
+ }
563
+
564
+ // src/basic/bi-open/src/revisal/changelog.ts
565
+ var OLDEST_VERSION = "4.0.3";
566
+ var CHANGE_LOGS = [
567
+ /**
568
+ * 2021年09月18日14:31:46 自定义组件首次数字订正 (v4.1.1.1) 上线
569
+ */
570
+ {
571
+ /** 订正的版本 */
572
+ version: "4.1",
573
+ /** 要订正的组件 */
574
+ guards: [
575
+ reviser
576
+ ]
577
+ }
578
+ ].sort(function(prev, next) {
579
+ return compareVersion(prev.version, next.version);
580
+ });
581
+ var LATEST_VERSION = CHANGE_LOGS.map(function(log) {
582
+ return log.version;
583
+ }).reduce(function(pre, next) {
584
+ if (compareVersion(pre, next) > 0) {
585
+ return pre;
586
+ }
587
+ return next;
588
+ }, OLDEST_VERSION);
589
+
590
+ // src/basic/bi-open/src/revisal/index.ts
591
+ function getRevisalRange(version) {
592
+ var changeLog = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : CHANGE_LOGS;
593
+ return changeLog.filter(function(log) {
594
+ return compareVersion2(log.version, version) > 0;
595
+ });
596
+ }
597
+ function revisal(componentMeta, currentVersion) {
598
+ var changeLog = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : CHANGE_LOGS;
599
+ var revisalRange = getRevisalRange(currentVersion, changeLog);
600
+ return revisalRange.reduce(function(meta, currChangeLog) {
601
+ var _currChangeLog_guards;
602
+ return ((_currChangeLog_guards = currChangeLog.guards) !== null && _currChangeLog_guards !== void 0 ? _currChangeLog_guards : []).reduce(function(preMeta, reviser2) {
603
+ return reviser2(preMeta);
604
+ }, meta);
605
+ }, componentMeta);
606
+ }
607
+ function isOldestVersion(componentMeta) {
608
+ var _componentMeta_propsSchema_dataSchema_schema, _componentMeta_propsSchema_dataSchema, _componentMeta_propsSchema, _componentMeta_propsSchema_dataSchema1, _componentMeta_propsSchema1;
609
+ if ((componentMeta === null || componentMeta === void 0 ? void 0 : (_componentMeta_propsSchema = componentMeta.propsSchema) === null || _componentMeta_propsSchema === void 0 ? void 0 : (_componentMeta_propsSchema_dataSchema = _componentMeta_propsSchema.dataSchema) === null || _componentMeta_propsSchema_dataSchema === void 0 ? void 0 : (_componentMeta_propsSchema_dataSchema_schema = _componentMeta_propsSchema_dataSchema.schema) === null || _componentMeta_propsSchema_dataSchema_schema === void 0 ? void 0 : _componentMeta_propsSchema_dataSchema_schema.area) && !(componentMeta === null || componentMeta === void 0 ? void 0 : (_componentMeta_propsSchema1 = componentMeta.propsSchema) === null || _componentMeta_propsSchema1 === void 0 ? void 0 : (_componentMeta_propsSchema_dataSchema1 = _componentMeta_propsSchema1.dataSchema) === null || _componentMeta_propsSchema_dataSchema1 === void 0 ? void 0 : _componentMeta_propsSchema_dataSchema1.areas)) {
610
+ return true;
611
+ }
612
+ return false;
613
+ }
614
+ export {
615
+ I18n,
616
+ LATEST_VERSION,
617
+ OLDEST_VERSION,
618
+ formatNumber,
619
+ formatNumberWithConfig,
620
+ getRevisalRange,
621
+ isOldestVersion,
622
+ revisal
623
+ };
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@quickbi/bi-open",
3
+ "version": "4.0.0",
4
+ "publishConfig": {
5
+ "registry": "https://registry.npmjs.org",
6
+ "access": "public"
7
+ },
8
+ "dependencies": {
9
+ "compare-versions": "3.4.0",
10
+ "big.js": "5.2.2",
11
+ "@quickbi/bi-types": "3.2.0",
12
+ "lodash": "4.17.21"
13
+ },
14
+ "sideEffects": false,
15
+ "files": [
16
+ "esm",
17
+ "cjs"
18
+ ],
19
+ "author": "Quick BI team",
20
+ "peerDependencies": {},
21
+ "main": "./cjs/index.js",
22
+ "module": "./esm/index.mjs",
23
+ "browser": "./esm/index.mjs",
24
+ "exports": {
25
+ ".": {
26
+ "import": "./esm/index.mjs",
27
+ "require": "./cjs/index.js",
28
+ "default": "./esm/index.mjs",
29
+ "types": "./esm/index.d.ts"
30
+ },
31
+ "./*.css": {
32
+ "import": "./esm/*.css",
33
+ "require": "./cjs/*.css",
34
+ "default": "./esm/*.css"
35
+ }
36
+ },
37
+ "revisalInfo": {
38
+ "version": "4.1"
39
+ }
40
+ }