ai.touchui-vue 1.33.0 → 1.33.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai.touchui-vue",
3
- "version": "1.33.0",
3
+ "version": "1.33.2",
4
4
  "description": "TouchUI Component Library for Vue.js.",
5
5
  "main": "lib/ai.touchui-vue.common.js",
6
6
  "files": [
@@ -60,7 +60,7 @@
60
60
  "@typescript-eslint/eslint-plugin": "5.8.0",
61
61
  "@vue/component-compiler-utils": "2.6.0",
62
62
  "ai.touchui-chat": "^1.9.0",
63
- "ai.touchui-plugin": "^1.0.58",
63
+ "ai.touchui-plugin": "^1.0.60",
64
64
  "algoliasearch": "3.35.1",
65
65
  "archiver": "5.3.1",
66
66
  "babel-cli": "6.26.0",
@@ -421,7 +421,7 @@ export default {
421
421
  if (
422
422
  this.type === 'number' &&
423
423
  Number(this.dot) === 0 &&
424
- !this.conversionType &&
424
+ !Number(this.conversionType) &&
425
425
  String(this.data).indexOf('.') > -1
426
426
  ) {
427
427
  this.data = this.data.replace('.', '')
@@ -497,7 +497,7 @@ export default {
497
497
  }
498
498
  },
499
499
  inputKeyPress(event) {
500
- if (this.type === 'number' && !this.conversionType) {
500
+ if (this.type === 'number' && !Number(this.conversionType)) {
501
501
  if (
502
502
  (event.keyCode !== 46 || Number(this.dot) === 0) &&
503
503
  (event.keyCode !== 45 || Number(this.min) >= 0) &&
@@ -568,8 +568,8 @@ export default {
568
568
  this.data = 'NaN';
569
569
  }
570
570
 
571
- if (this.conversionType) {
572
- this.data = this.formatNumber(this.data, this.dot, this.conversionType)
571
+ if (Number(this.conversionType)) {
572
+ this.data = this.formatNumber(this.data, this.dot, Number(this.conversionType))
573
573
  }
574
574
  }
575
575
  this.focused = false;
@@ -611,7 +611,7 @@ export default {
611
611
  let pre = this.data.substring(0, this.data.indexOf('.'));
612
612
  let suf = this.data.substring(this.data.indexOf('.') + 1);
613
613
 
614
- if (!this.conversionType) {
614
+ if (!Number(this.conversionType)) {
615
615
  // 去掉小数点之后的所有小圆点并截取所需数量
616
616
  suf = suf.replace(/[/.]/g, '').substring(0, Number(this.dot));
617
617
  }
@@ -671,25 +671,6 @@ export default {
671
671
  // type 0:保持原状 1:向上取值 2:向下取值 3:四舍五入 4:保持原值无限输入小数
672
672
  if (type < 0 || type > 3) throw new Error('Invalid type');
673
673
 
674
- // if (type === 0) {
675
- // // 处理科学计数法并转换为字符串
676
- // let strValue = value.toLocaleString('fullwide', { useGrouping: false });
677
- // // 处理特殊情况,例如数值本身是整数
678
- // if (strValue.indexOf('.') === -1) strValue += '.';
679
-
680
- // const [intPart, decimalPart = ''] = strValue.split('.');
681
- // let formattedDecimal = decimalPart;
682
-
683
- // // 补零到指定的小数位数
684
- // if (decimalPart.length < decimalPlaces) {
685
- // formattedDecimal = decimalPart.padEnd(decimalPlaces, '0');
686
- // }
687
-
688
- // return decimalPlaces === 0
689
- // ? intPart
690
- // : `${intPart}.${formattedDecimal}`;
691
- // }
692
-
693
674
  const factor = Math.pow(10, decimalPlaces);
694
675
  let processedValue = value;
695
676
 
@@ -701,9 +682,15 @@ export default {
701
682
  processedValue = Math.floor(value * factor) / factor;
702
683
  break;
703
684
  case 3: // 四舍五入
704
- processedValue = Math.round(value * factor) / factor;
685
+ processedValue = Math.round(Number((value * factor).toFixed(1))) / factor;
686
+ // processedValue = this.preciseMultiply(value, factor);
705
687
  break;
706
688
  }
689
+ // console.log(value, 'value')
690
+ // console.log(factor, 'factor')
691
+ // console.log('processedValue', processedValue)
692
+ // console.log('value * factor * 10', value * factor * 10)
693
+ // console.log('Math.round(value * factor * 10)', Math.round(value * factor * 10))
707
694
  return processedValue.toFixed(decimalPlaces);
708
695
  }
709
696
  }