iv-npm 1.7.33 → 1.7.35
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/package.json +1 -1
- package/packages/shared/dist/utils/index.d.ts +7 -2
- package/packages/shared/dist/utils/index.mjs +24 -0
- package/packages/ui/dist/index.cjs.js +2 -2
- package/packages/ui/dist/index.cjs.js.map +1 -1
- package/packages/ui/dist/index.esm.js +6 -6
- package/packages/ui/dist/index.esm.js.map +1 -1
- package/packages/ui/dist/index.umd.js +2 -2
- package/packages/ui/dist/index.umd.js.map +1 -1
package/package.json
CHANGED
|
@@ -133,6 +133,11 @@ declare function getAmountByUnit(amount: number): string;
|
|
|
133
133
|
* @description 将金额保留两位小数。如果包含元字,处理结果也会返回元
|
|
134
134
|
* @param amount
|
|
135
135
|
* */
|
|
136
|
-
declare const amountToFixed: (_v?: number | string) => string | 0;
|
|
136
|
+
declare const amountToFixed: (_v?: number | string) => string | 0;
|
|
137
|
+
/**
|
|
138
|
+
* @description 将金额加千分符并保留两位小数。如果包含元字,处理结果也会返回元
|
|
139
|
+
* @param amount
|
|
140
|
+
* */
|
|
141
|
+
declare const amountToThousandthFixed: (num?: number | string, fixed?: number) => string | 0;
|
|
137
142
|
|
|
138
|
-
export { LineIDEnum, ProjectStausEnum, SignStatusEnum, amountToFixed, apiConfiger, arrToTree, arraySum, arraySumByKey, assign, buildURL as buildUrl, dateFormat, filterOptionHeadle, findTree, formatPercentage, formatType, getAmountByUnit, hostConfiger, isArraySumCompared, isDate, isObject, isPlainObject, isURLSearchParams, numFormat, onChangeTail, tranListToTreeData, yearMonthDayFormat, yearMonthFormat };
|
|
143
|
+
export { LineIDEnum, ProjectStausEnum, SignStatusEnum, amountToFixed, amountToThousandthFixed, apiConfiger, arrToTree, arraySum, arraySumByKey, assign, buildURL as buildUrl, dateFormat, filterOptionHeadle, findTree, formatPercentage, formatType, getAmountByUnit, hostConfiger, isArraySumCompared, isDate, isObject, isPlainObject, isURLSearchParams, numFormat, onChangeTail, tranListToTreeData, yearMonthDayFormat, yearMonthFormat };
|
|
@@ -464,11 +464,35 @@ var amountToFixed = (_v) => {
|
|
|
464
464
|
}
|
|
465
465
|
return (!Number.isNaN(value) ? value.toFixed(2) : 0) + (flag ? " \u5143" : "");
|
|
466
466
|
};
|
|
467
|
+
var amountToThousandthFixed = (num, fixed = 2) => {
|
|
468
|
+
if (!num)
|
|
469
|
+
return 0;
|
|
470
|
+
let value = num;
|
|
471
|
+
let flag = false;
|
|
472
|
+
if (typeof num === "string") {
|
|
473
|
+
if (num.includes("\u5143")) {
|
|
474
|
+
flag = true;
|
|
475
|
+
value = parseFloat(num.split("\u5143")[0]);
|
|
476
|
+
} else {
|
|
477
|
+
value = parseFloat(num);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
value = isNaN(Number(value)) ? 0 : Number(value);
|
|
481
|
+
if (fixed)
|
|
482
|
+
value = value.toFixed(fixed);
|
|
483
|
+
value = value.toString().replace(/\d+/, function(n) {
|
|
484
|
+
return n.replace(/(\d)(?=(\d{3})+$)/g, function($1) {
|
|
485
|
+
return $1 + ",";
|
|
486
|
+
});
|
|
487
|
+
});
|
|
488
|
+
return (!Number.isNaN(value) ? value : 0) + (flag ? " \u5143" : "");
|
|
489
|
+
};
|
|
467
490
|
export {
|
|
468
491
|
LineIDEnum,
|
|
469
492
|
ProjectStausEnum,
|
|
470
493
|
SignStatusEnum,
|
|
471
494
|
amountToFixed,
|
|
495
|
+
amountToThousandthFixed,
|
|
472
496
|
apiConfiger,
|
|
473
497
|
arrToTree,
|
|
474
498
|
arraySum,
|