vxe-pc-ui 4.14.38 → 4.14.39
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/all.esm.js +45 -18
- package/es/input/src/input.js +2 -2
- package/es/number-input/src/number-input.js +25 -10
- package/es/number-input/src/util.js +16 -4
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +45 -17
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +2 -2
- package/lib/input/src/input.min.js +1 -1
- package/lib/number-input/src/number-input.js +24 -7
- package/lib/number-input/src/number-input.min.js +1 -1
- package/lib/number-input/src/util.js +15 -4
- package/lib/number-input/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/input/src/input.ts +2 -2
- package/packages/number-input/src/number-input.ts +24 -11
- package/packages/number-input/src/util.ts +17 -4
- package/types/components/number-input.d.ts +12 -1
- /package/es/icon/{iconfont.1781439392102.ttf → iconfont.1781503194392.ttf} +0 -0
- /package/es/icon/{iconfont.1781439392102.woff → iconfont.1781503194392.woff} +0 -0
- /package/es/icon/{iconfont.1781439392102.woff2 → iconfont.1781503194392.woff2} +0 -0
- /package/es/{iconfont.1781439392102.ttf → iconfont.1781503194392.ttf} +0 -0
- /package/es/{iconfont.1781439392102.woff → iconfont.1781503194392.woff} +0 -0
- /package/es/{iconfont.1781439392102.woff2 → iconfont.1781503194392.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1781439392102.ttf → iconfont.1781503194392.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1781439392102.woff → iconfont.1781503194392.woff} +0 -0
- /package/lib/icon/style/{iconfont.1781439392102.woff2 → iconfont.1781503194392.woff2} +0 -0
- /package/lib/{iconfont.1781439392102.ttf → iconfont.1781503194392.ttf} +0 -0
- /package/lib/{iconfont.1781439392102.woff → iconfont.1781503194392.woff} +0 -0
- /package/lib/{iconfont.1781439392102.woff2 → iconfont.1781503194392.woff2} +0 -0
package/dist/all.esm.js
CHANGED
|
@@ -80,11 +80,11 @@ function checkDynamic() {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const version$1 = `ui v${"4.14.
|
|
83
|
+
const version$1 = `ui v${"4.14.39"}`;
|
|
84
84
|
const warnLog = log.create('warn', version$1);
|
|
85
85
|
const errLog = log.create('error', version$1);
|
|
86
86
|
|
|
87
|
-
const version = "4.14.
|
|
87
|
+
const version = "4.14.39";
|
|
88
88
|
VxeUI.uiVersion = version;
|
|
89
89
|
VxeUI.dynamicApp = dynamicApp;
|
|
90
90
|
function config(options) {
|
|
@@ -6702,11 +6702,23 @@ function calcTreeLine($xeTree, node, prevNode) {
|
|
|
6702
6702
|
function handleNumber(val) {
|
|
6703
6703
|
return XEUtils.isString(val) ? val.replace(/[^0-9e.-]/g, '') : val;
|
|
6704
6704
|
}
|
|
6705
|
-
function toFloatValueFixed(inputValue, digitsValue) {
|
|
6706
|
-
if (
|
|
6707
|
-
|
|
6705
|
+
function toFloatValueFixed(inputValue, digitsValue, roundingMode) {
|
|
6706
|
+
if (!roundingMode || roundingMode === 'default') {
|
|
6707
|
+
// 默认截取忽略
|
|
6708
|
+
if (/^-/.test('' + inputValue)) {
|
|
6709
|
+
return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue);
|
|
6710
|
+
}
|
|
6711
|
+
return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue);
|
|
6712
|
+
}
|
|
6713
|
+
else {
|
|
6714
|
+
if (roundingMode === 'ceil') {
|
|
6715
|
+
return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue);
|
|
6716
|
+
}
|
|
6717
|
+
if (roundingMode === 'floor') {
|
|
6718
|
+
return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue);
|
|
6719
|
+
}
|
|
6720
|
+
return XEUtils.toFixed(XEUtils.round(inputValue, digitsValue), digitsValue);
|
|
6708
6721
|
}
|
|
6709
|
-
return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue);
|
|
6710
6722
|
}
|
|
6711
6723
|
|
|
6712
6724
|
var VxeInputComponent = defineVxeComponent({
|
|
@@ -7442,7 +7454,7 @@ var VxeInputComponent = defineVxeComponent({
|
|
|
7442
7454
|
const { type, exponential } = props;
|
|
7443
7455
|
const inpMaxLength = computeInpMaxLength.value;
|
|
7444
7456
|
const digitsValue = computeDigitsValue.value;
|
|
7445
|
-
const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val));
|
|
7457
|
+
const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue, '') : XEUtils.toValueString(val));
|
|
7446
7458
|
if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
|
|
7447
7459
|
return val;
|
|
7448
7460
|
}
|
|
@@ -7628,7 +7640,7 @@ var VxeInputComponent = defineVxeComponent({
|
|
|
7628
7640
|
}
|
|
7629
7641
|
else if (type === 'float') {
|
|
7630
7642
|
if (inputValue) {
|
|
7631
|
-
const validValue = toFloatValueFixed(inputValue, digitsValue);
|
|
7643
|
+
const validValue = toFloatValueFixed(inputValue, digitsValue, '');
|
|
7632
7644
|
if (inputValue !== validValue) {
|
|
7633
7645
|
handleChange(validValue, { type: 'init' });
|
|
7634
7646
|
}
|
|
@@ -11308,6 +11320,11 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11308
11320
|
},
|
|
11309
11321
|
controlConfig: Object,
|
|
11310
11322
|
// float
|
|
11323
|
+
roundingMode: {
|
|
11324
|
+
type: String,
|
|
11325
|
+
default: null
|
|
11326
|
+
},
|
|
11327
|
+
// float
|
|
11311
11328
|
digits: {
|
|
11312
11329
|
type: [String, Number],
|
|
11313
11330
|
default: null
|
|
@@ -11477,12 +11494,22 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11477
11494
|
return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
|
|
11478
11495
|
});
|
|
11479
11496
|
const computeNumLabel = computed(() => {
|
|
11480
|
-
const { type, showCurrency, currencySymbol, autoFill } = props;
|
|
11497
|
+
const { type, roundingMode, showCurrency, currencySymbol, autoFill } = props;
|
|
11481
11498
|
const { inputValue } = reactData;
|
|
11482
11499
|
const digitsValue = computeDigitsValue.value;
|
|
11483
11500
|
if (type === 'amount') {
|
|
11484
11501
|
const num = XEUtils.toNumber(inputValue);
|
|
11485
|
-
|
|
11502
|
+
const cfyOpts = { digits: digitsValue };
|
|
11503
|
+
if (roundingMode === 'floor') {
|
|
11504
|
+
cfyOpts.floor = true;
|
|
11505
|
+
}
|
|
11506
|
+
else if (roundingMode === 'ceil') {
|
|
11507
|
+
cfyOpts.ceil = true;
|
|
11508
|
+
}
|
|
11509
|
+
else {
|
|
11510
|
+
cfyOpts.round = true;
|
|
11511
|
+
}
|
|
11512
|
+
let amountLabel = XEUtils.commafy(num, cfyOpts);
|
|
11486
11513
|
if (!autoFill) {
|
|
11487
11514
|
const [iStr, dStr] = amountLabel.split('.');
|
|
11488
11515
|
if (dStr) {
|
|
@@ -11541,13 +11568,13 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11541
11568
|
return `${val}`;
|
|
11542
11569
|
};
|
|
11543
11570
|
const getNumberValue = (val) => {
|
|
11544
|
-
const { exponential, autoFill } = props;
|
|
11571
|
+
const { exponential, roundingMode, autoFill } = props;
|
|
11545
11572
|
const inpMaxLength = computeInpMaxLength.value;
|
|
11546
11573
|
const digitsValue = computeDigitsValue.value;
|
|
11547
11574
|
const decimalsType = computeDecimalsType.value;
|
|
11548
11575
|
let restVal = '';
|
|
11549
11576
|
if (decimalsType) {
|
|
11550
|
-
restVal = toFloatValueFixed(val, digitsValue);
|
|
11577
|
+
restVal = toFloatValueFixed(val, digitsValue, roundingMode);
|
|
11551
11578
|
if (!autoFill) {
|
|
11552
11579
|
restVal = handleNumberString(XEUtils.toNumber(restVal));
|
|
11553
11580
|
}
|
|
@@ -11639,7 +11666,7 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11639
11666
|
}
|
|
11640
11667
|
};
|
|
11641
11668
|
const updateModel = (val) => {
|
|
11642
|
-
const { autoFill } = props;
|
|
11669
|
+
const { roundingMode, autoFill } = props;
|
|
11643
11670
|
const { inputValue } = reactData;
|
|
11644
11671
|
const digitsValue = computeDigitsValue.value;
|
|
11645
11672
|
const decimalsType = computeDecimalsType.value;
|
|
@@ -11647,11 +11674,11 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11647
11674
|
reactData.inputValue = '';
|
|
11648
11675
|
}
|
|
11649
11676
|
else {
|
|
11650
|
-
let textValue =
|
|
11677
|
+
let textValue = '' + val;
|
|
11651
11678
|
if (decimalsType) {
|
|
11652
|
-
textValue = toFloatValueFixed(val, digitsValue);
|
|
11679
|
+
textValue = toFloatValueFixed(val, digitsValue, roundingMode);
|
|
11653
11680
|
if (!autoFill) {
|
|
11654
|
-
textValue =
|
|
11681
|
+
textValue = '' + XEUtils.toNumber(textValue);
|
|
11655
11682
|
}
|
|
11656
11683
|
}
|
|
11657
11684
|
if (textValue !== inputValue) {
|
|
@@ -11663,7 +11690,7 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11663
11690
|
* 检查初始值
|
|
11664
11691
|
*/
|
|
11665
11692
|
const initValue = () => {
|
|
11666
|
-
const { autoFill } = props;
|
|
11693
|
+
const { roundingMode, autoFill } = props;
|
|
11667
11694
|
const { inputValue } = reactData;
|
|
11668
11695
|
const digitsValue = computeDigitsValue.value;
|
|
11669
11696
|
const decimalsType = computeDecimalsType.value;
|
|
@@ -11672,7 +11699,7 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11672
11699
|
let textValue = '';
|
|
11673
11700
|
let validValue = null;
|
|
11674
11701
|
if (inputValue) {
|
|
11675
|
-
textValue = toFloatValueFixed(inputValue, digitsValue);
|
|
11702
|
+
textValue = toFloatValueFixed(inputValue, digitsValue, roundingMode);
|
|
11676
11703
|
validValue = XEUtils.toNumber(textValue);
|
|
11677
11704
|
if (!autoFill) {
|
|
11678
11705
|
textValue = `${validValue}`;
|
package/es/input/src/input.js
CHANGED
|
@@ -741,7 +741,7 @@ export default defineVxeComponent({
|
|
|
741
741
|
const { type, exponential } = props;
|
|
742
742
|
const inpMaxLength = computeInpMaxLength.value;
|
|
743
743
|
const digitsValue = computeDigitsValue.value;
|
|
744
|
-
const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val));
|
|
744
|
+
const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue, '') : XEUtils.toValueString(val));
|
|
745
745
|
if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
|
|
746
746
|
return val;
|
|
747
747
|
}
|
|
@@ -927,7 +927,7 @@ export default defineVxeComponent({
|
|
|
927
927
|
}
|
|
928
928
|
else if (type === 'float') {
|
|
929
929
|
if (inputValue) {
|
|
930
|
-
const validValue = toFloatValueFixed(inputValue, digitsValue);
|
|
930
|
+
const validValue = toFloatValueFixed(inputValue, digitsValue, '');
|
|
931
931
|
if (inputValue !== validValue) {
|
|
932
932
|
handleChange(validValue, { type: 'init' });
|
|
933
933
|
}
|
|
@@ -71,6 +71,11 @@ export default defineVxeComponent({
|
|
|
71
71
|
},
|
|
72
72
|
controlConfig: Object,
|
|
73
73
|
// float
|
|
74
|
+
roundingMode: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: null
|
|
77
|
+
},
|
|
78
|
+
// float
|
|
74
79
|
digits: {
|
|
75
80
|
type: [String, Number],
|
|
76
81
|
default: null
|
|
@@ -240,12 +245,22 @@ export default defineVxeComponent({
|
|
|
240
245
|
return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
|
|
241
246
|
});
|
|
242
247
|
const computeNumLabel = computed(() => {
|
|
243
|
-
const { type, showCurrency, currencySymbol, autoFill } = props;
|
|
248
|
+
const { type, roundingMode, showCurrency, currencySymbol, autoFill } = props;
|
|
244
249
|
const { inputValue } = reactData;
|
|
245
250
|
const digitsValue = computeDigitsValue.value;
|
|
246
251
|
if (type === 'amount') {
|
|
247
252
|
const num = XEUtils.toNumber(inputValue);
|
|
248
|
-
|
|
253
|
+
const cfyOpts = { digits: digitsValue };
|
|
254
|
+
if (roundingMode === 'floor') {
|
|
255
|
+
cfyOpts.floor = true;
|
|
256
|
+
}
|
|
257
|
+
else if (roundingMode === 'ceil') {
|
|
258
|
+
cfyOpts.ceil = true;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
cfyOpts.round = true;
|
|
262
|
+
}
|
|
263
|
+
let amountLabel = XEUtils.commafy(num, cfyOpts);
|
|
249
264
|
if (!autoFill) {
|
|
250
265
|
const [iStr, dStr] = amountLabel.split('.');
|
|
251
266
|
if (dStr) {
|
|
@@ -304,13 +319,13 @@ export default defineVxeComponent({
|
|
|
304
319
|
return `${val}`;
|
|
305
320
|
};
|
|
306
321
|
const getNumberValue = (val) => {
|
|
307
|
-
const { exponential, autoFill } = props;
|
|
322
|
+
const { exponential, roundingMode, autoFill } = props;
|
|
308
323
|
const inpMaxLength = computeInpMaxLength.value;
|
|
309
324
|
const digitsValue = computeDigitsValue.value;
|
|
310
325
|
const decimalsType = computeDecimalsType.value;
|
|
311
326
|
let restVal = '';
|
|
312
327
|
if (decimalsType) {
|
|
313
|
-
restVal = toFloatValueFixed(val, digitsValue);
|
|
328
|
+
restVal = toFloatValueFixed(val, digitsValue, roundingMode);
|
|
314
329
|
if (!autoFill) {
|
|
315
330
|
restVal = handleNumberString(XEUtils.toNumber(restVal));
|
|
316
331
|
}
|
|
@@ -402,7 +417,7 @@ export default defineVxeComponent({
|
|
|
402
417
|
}
|
|
403
418
|
};
|
|
404
419
|
const updateModel = (val) => {
|
|
405
|
-
const { autoFill } = props;
|
|
420
|
+
const { roundingMode, autoFill } = props;
|
|
406
421
|
const { inputValue } = reactData;
|
|
407
422
|
const digitsValue = computeDigitsValue.value;
|
|
408
423
|
const decimalsType = computeDecimalsType.value;
|
|
@@ -410,11 +425,11 @@ export default defineVxeComponent({
|
|
|
410
425
|
reactData.inputValue = '';
|
|
411
426
|
}
|
|
412
427
|
else {
|
|
413
|
-
let textValue =
|
|
428
|
+
let textValue = '' + val;
|
|
414
429
|
if (decimalsType) {
|
|
415
|
-
textValue = toFloatValueFixed(val, digitsValue);
|
|
430
|
+
textValue = toFloatValueFixed(val, digitsValue, roundingMode);
|
|
416
431
|
if (!autoFill) {
|
|
417
|
-
textValue =
|
|
432
|
+
textValue = '' + XEUtils.toNumber(textValue);
|
|
418
433
|
}
|
|
419
434
|
}
|
|
420
435
|
if (textValue !== inputValue) {
|
|
@@ -426,7 +441,7 @@ export default defineVxeComponent({
|
|
|
426
441
|
* 检查初始值
|
|
427
442
|
*/
|
|
428
443
|
const initValue = () => {
|
|
429
|
-
const { autoFill } = props;
|
|
444
|
+
const { roundingMode, autoFill } = props;
|
|
430
445
|
const { inputValue } = reactData;
|
|
431
446
|
const digitsValue = computeDigitsValue.value;
|
|
432
447
|
const decimalsType = computeDecimalsType.value;
|
|
@@ -435,7 +450,7 @@ export default defineVxeComponent({
|
|
|
435
450
|
let textValue = '';
|
|
436
451
|
let validValue = null;
|
|
437
452
|
if (inputValue) {
|
|
438
|
-
textValue = toFloatValueFixed(inputValue, digitsValue);
|
|
453
|
+
textValue = toFloatValueFixed(inputValue, digitsValue, roundingMode);
|
|
439
454
|
validValue = XEUtils.toNumber(textValue);
|
|
440
455
|
if (!autoFill) {
|
|
441
456
|
textValue = `${validValue}`;
|
|
@@ -2,9 +2,21 @@ import XEUtils from 'xe-utils';
|
|
|
2
2
|
export function handleNumber(val) {
|
|
3
3
|
return XEUtils.isString(val) ? val.replace(/[^0-9e.-]/g, '') : val;
|
|
4
4
|
}
|
|
5
|
-
export function toFloatValueFixed(inputValue, digitsValue) {
|
|
6
|
-
if (
|
|
7
|
-
|
|
5
|
+
export function toFloatValueFixed(inputValue, digitsValue, roundingMode) {
|
|
6
|
+
if (!roundingMode || roundingMode === 'default') {
|
|
7
|
+
// 默认截取忽略
|
|
8
|
+
if (/^-/.test('' + inputValue)) {
|
|
9
|
+
return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue);
|
|
10
|
+
}
|
|
11
|
+
return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
if (roundingMode === 'ceil') {
|
|
15
|
+
return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue);
|
|
16
|
+
}
|
|
17
|
+
if (roundingMode === 'floor') {
|
|
18
|
+
return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue);
|
|
19
|
+
}
|
|
20
|
+
return XEUtils.toFixed(XEUtils.round(inputValue, digitsValue), digitsValue);
|
|
8
21
|
}
|
|
9
|
-
return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue);
|
|
10
22
|
}
|
package/es/ui/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VxeUI, setConfig, setIcon } from '@vxe-ui/core';
|
|
2
2
|
import { dynamicApp } from '../dynamics';
|
|
3
3
|
import { warnLog } from './src/log';
|
|
4
|
-
export const version = "4.14.
|
|
4
|
+
export const version = "4.14.39";
|
|
5
5
|
VxeUI.uiVersion = version;
|
|
6
6
|
VxeUI.dynamicApp = dynamicApp;
|
|
7
7
|
export function config(options) {
|
package/es/ui/src/log.js
CHANGED
package/lib/index.umd.js
CHANGED
|
@@ -3338,7 +3338,7 @@ if (typeof window !== 'undefined') {
|
|
|
3338
3338
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
3339
3339
|
var es_array_push = __webpack_require__(4114);
|
|
3340
3340
|
;// ./node_modules/@vxe-ui/core/es/src/core.js
|
|
3341
|
-
const coreVersion = "4.4.
|
|
3341
|
+
const coreVersion = "4.4.14";
|
|
3342
3342
|
const VxeCore = {
|
|
3343
3343
|
coreVersion,
|
|
3344
3344
|
uiVersion: '',
|
|
@@ -3965,7 +3965,7 @@ function createLog(type, name) {
|
|
|
3965
3965
|
return msg;
|
|
3966
3966
|
};
|
|
3967
3967
|
}
|
|
3968
|
-
const version = "4.4.
|
|
3968
|
+
const version = "4.4.14";
|
|
3969
3969
|
const log = {
|
|
3970
3970
|
create: createLog,
|
|
3971
3971
|
warn: createLog('warn', `v${version}`),
|
|
@@ -4646,7 +4646,7 @@ function checkDynamic() {
|
|
|
4646
4646
|
}
|
|
4647
4647
|
;// ./packages/ui/src/log.ts
|
|
4648
4648
|
|
|
4649
|
-
const log_version = `ui v${"4.14.
|
|
4649
|
+
const log_version = `ui v${"4.14.39"}`;
|
|
4650
4650
|
const warnLog = log.create('warn', log_version);
|
|
4651
4651
|
const errLog = log.create('error', log_version);
|
|
4652
4652
|
;// ./packages/ui/index.ts
|
|
@@ -4654,7 +4654,7 @@ const errLog = log.create('error', log_version);
|
|
|
4654
4654
|
|
|
4655
4655
|
|
|
4656
4656
|
|
|
4657
|
-
const ui_version = "4.14.
|
|
4657
|
+
const ui_version = "4.14.39";
|
|
4658
4658
|
VxeUI.uiVersion = ui_version;
|
|
4659
4659
|
VxeUI.dynamicApp = dynamicApp;
|
|
4660
4660
|
function config(options) {
|
|
@@ -11895,11 +11895,22 @@ function calcTreeLine($xeTree, node, prevNode) {
|
|
|
11895
11895
|
function handleNumber(val) {
|
|
11896
11896
|
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(val) ? val.replace(/[^0-9e.-]/g, '') : val;
|
|
11897
11897
|
}
|
|
11898
|
-
function toFloatValueFixed(inputValue, digitsValue) {
|
|
11899
|
-
if (
|
|
11900
|
-
|
|
11898
|
+
function toFloatValueFixed(inputValue, digitsValue, roundingMode) {
|
|
11899
|
+
if (!roundingMode || roundingMode === 'default') {
|
|
11900
|
+
// 默认截取忽略
|
|
11901
|
+
if (/^-/.test('' + inputValue)) {
|
|
11902
|
+
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().ceil(inputValue, digitsValue), digitsValue);
|
|
11903
|
+
}
|
|
11904
|
+
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(inputValue, digitsValue), digitsValue);
|
|
11905
|
+
} else {
|
|
11906
|
+
if (roundingMode === 'ceil') {
|
|
11907
|
+
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().ceil(inputValue, digitsValue), digitsValue);
|
|
11908
|
+
}
|
|
11909
|
+
if (roundingMode === 'floor') {
|
|
11910
|
+
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(inputValue, digitsValue), digitsValue);
|
|
11911
|
+
}
|
|
11912
|
+
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().round(inputValue, digitsValue), digitsValue);
|
|
11901
11913
|
}
|
|
11902
|
-
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toFixed(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(inputValue, digitsValue), digitsValue);
|
|
11903
11914
|
}
|
|
11904
11915
|
;// ./packages/input/src/input.ts
|
|
11905
11916
|
|
|
@@ -12719,7 +12730,7 @@ function toFloatValueFixed(inputValue, digitsValue) {
|
|
|
12719
12730
|
} = props;
|
|
12720
12731
|
const inpMaxLength = computeInpMaxLength.value;
|
|
12721
12732
|
const digitsValue = computeDigitsValue.value;
|
|
12722
|
-
const restVal = type === 'float' ? toFloatValueFixed(val, digitsValue) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(val);
|
|
12733
|
+
const restVal = type === 'float' ? toFloatValueFixed(val, digitsValue, '') : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(val);
|
|
12723
12734
|
if (exponential && (val === restVal || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(val).toLowerCase() === external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(restVal).toExponential())) {
|
|
12724
12735
|
return val;
|
|
12725
12736
|
}
|
|
@@ -12944,7 +12955,7 @@ function toFloatValueFixed(inputValue, digitsValue) {
|
|
|
12944
12955
|
changeValue();
|
|
12945
12956
|
} else if (type === 'float') {
|
|
12946
12957
|
if (inputValue) {
|
|
12947
|
-
const validValue = toFloatValueFixed(inputValue, digitsValue);
|
|
12958
|
+
const validValue = toFloatValueFixed(inputValue, digitsValue, '');
|
|
12948
12959
|
if (inputValue !== validValue) {
|
|
12949
12960
|
handleChange(validValue, {
|
|
12950
12961
|
type: 'init'
|
|
@@ -16886,6 +16897,11 @@ function hexToRgb(str) {
|
|
|
16886
16897
|
},
|
|
16887
16898
|
controlConfig: Object,
|
|
16888
16899
|
// float
|
|
16900
|
+
roundingMode: {
|
|
16901
|
+
type: String,
|
|
16902
|
+
default: null
|
|
16903
|
+
},
|
|
16904
|
+
// float
|
|
16889
16905
|
digits: {
|
|
16890
16906
|
type: [String, Number],
|
|
16891
16907
|
default: null
|
|
@@ -17071,6 +17087,7 @@ function hexToRgb(str) {
|
|
|
17071
17087
|
const computeNumLabel = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
17072
17088
|
const {
|
|
17073
17089
|
type,
|
|
17090
|
+
roundingMode,
|
|
17074
17091
|
showCurrency,
|
|
17075
17092
|
currencySymbol,
|
|
17076
17093
|
autoFill
|
|
@@ -17081,9 +17098,17 @@ function hexToRgb(str) {
|
|
|
17081
17098
|
const digitsValue = computeDigitsValue.value;
|
|
17082
17099
|
if (type === 'amount') {
|
|
17083
17100
|
const num = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(inputValue);
|
|
17084
|
-
|
|
17101
|
+
const cfyOpts = {
|
|
17085
17102
|
digits: digitsValue
|
|
17086
|
-
}
|
|
17103
|
+
};
|
|
17104
|
+
if (roundingMode === 'floor') {
|
|
17105
|
+
cfyOpts.floor = true;
|
|
17106
|
+
} else if (roundingMode === 'ceil') {
|
|
17107
|
+
cfyOpts.ceil = true;
|
|
17108
|
+
} else {
|
|
17109
|
+
cfyOpts.round = true;
|
|
17110
|
+
}
|
|
17111
|
+
let amountLabel = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().commafy(num, cfyOpts);
|
|
17087
17112
|
if (!autoFill) {
|
|
17088
17113
|
const [iStr, dStr] = amountLabel.split('.');
|
|
17089
17114
|
if (dStr) {
|
|
@@ -17152,6 +17177,7 @@ function hexToRgb(str) {
|
|
|
17152
17177
|
const getNumberValue = val => {
|
|
17153
17178
|
const {
|
|
17154
17179
|
exponential,
|
|
17180
|
+
roundingMode,
|
|
17155
17181
|
autoFill
|
|
17156
17182
|
} = props;
|
|
17157
17183
|
const inpMaxLength = computeInpMaxLength.value;
|
|
@@ -17159,7 +17185,7 @@ function hexToRgb(str) {
|
|
|
17159
17185
|
const decimalsType = computeDecimalsType.value;
|
|
17160
17186
|
let restVal = '';
|
|
17161
17187
|
if (decimalsType) {
|
|
17162
|
-
restVal = toFloatValueFixed(val, digitsValue);
|
|
17188
|
+
restVal = toFloatValueFixed(val, digitsValue, roundingMode);
|
|
17163
17189
|
if (!autoFill) {
|
|
17164
17190
|
restVal = handleNumberString(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(restVal));
|
|
17165
17191
|
}
|
|
@@ -17276,6 +17302,7 @@ function hexToRgb(str) {
|
|
|
17276
17302
|
};
|
|
17277
17303
|
const updateModel = val => {
|
|
17278
17304
|
const {
|
|
17305
|
+
roundingMode,
|
|
17279
17306
|
autoFill
|
|
17280
17307
|
} = props;
|
|
17281
17308
|
const {
|
|
@@ -17286,11 +17313,11 @@ function hexToRgb(str) {
|
|
|
17286
17313
|
if (eqEmptyValue(val)) {
|
|
17287
17314
|
reactData.inputValue = '';
|
|
17288
17315
|
} else {
|
|
17289
|
-
let textValue =
|
|
17316
|
+
let textValue = '' + val;
|
|
17290
17317
|
if (decimalsType) {
|
|
17291
|
-
textValue = toFloatValueFixed(val, digitsValue);
|
|
17318
|
+
textValue = toFloatValueFixed(val, digitsValue, roundingMode);
|
|
17292
17319
|
if (!autoFill) {
|
|
17293
|
-
textValue =
|
|
17320
|
+
textValue = '' + external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(textValue);
|
|
17294
17321
|
}
|
|
17295
17322
|
}
|
|
17296
17323
|
if (textValue !== inputValue) {
|
|
@@ -17303,6 +17330,7 @@ function hexToRgb(str) {
|
|
|
17303
17330
|
*/
|
|
17304
17331
|
const initValue = () => {
|
|
17305
17332
|
const {
|
|
17333
|
+
roundingMode,
|
|
17306
17334
|
autoFill
|
|
17307
17335
|
} = props;
|
|
17308
17336
|
const {
|
|
@@ -17315,7 +17343,7 @@ function hexToRgb(str) {
|
|
|
17315
17343
|
let textValue = '';
|
|
17316
17344
|
let validValue = null;
|
|
17317
17345
|
if (inputValue) {
|
|
17318
|
-
textValue = toFloatValueFixed(inputValue, digitsValue);
|
|
17346
|
+
textValue = toFloatValueFixed(inputValue, digitsValue, roundingMode);
|
|
17319
17347
|
validValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(textValue);
|
|
17320
17348
|
if (!autoFill) {
|
|
17321
17349
|
textValue = `${validValue}`;
|