resolver-egretimp-plus 0.1.10 → 0.1.12

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": "resolver-egretimp-plus",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -190,7 +190,7 @@ export default class UdcSdkForIfame {
190
190
  };
191
191
  /** 获取客户定制API */
192
192
  getCustomApi = () => {
193
- const _tenant = currentSDK.baseInfo.tenant;
193
+ const _tenant = currentSDK.baseInfo.tenant || 'CMI';
194
194
  const _tenantApi = this._customization[_tenant];
195
195
  if (!_tenantApi) {
196
196
  console.error(!_tenant ? "缺少tenant信息" : "该tenant未定制过API");
@@ -99,6 +99,7 @@ export function useToolTip({
99
99
  })
100
100
  function generateTooltipWrap(node, opt) {
101
101
  const {
102
+ wrapAttrs = {},
102
103
  maintain = false,
103
104
  } = opt || {}
104
105
  const nodeComp = defineComponent(node)
@@ -106,7 +107,7 @@ export function useToolTip({
106
107
  return <nodeComp></nodeComp>
107
108
  }
108
109
  return (
109
- <div class="resolver-calc-contrainer custom-error-tip-block">
110
+ <div class="resolver-calc-contrainer" {...wrapAttrs}>
110
111
  <span ref={(e) => calcSpanRef.value = e} class="resolver-calc-span">{ displayValue.value }</span>
111
112
  {
112
113
  isOverflow.value ?
@@ -1,6 +1,6 @@
1
1
  import { ElInput } from 'element-plus'
2
2
  import { computed, defineProps, useAttrs } from 'vue'
3
- import { commonPropsType, hasOwn, isElement } from '../../utils/index.js'
3
+ import { commonPropsType, hasOwn, isElement, parseFloatToString } from '../../utils/index.js'
4
4
  import { ref } from 'vue';
5
5
  import { onMounted } from 'vue';
6
6
  import { getDomWidth } from '../../utils/dom.js';
@@ -50,7 +50,7 @@ export default {
50
50
  default: 2
51
51
  },
52
52
  // 金额显示时保留小数点0后缀
53
- decimalSuffix: {
53
+ keepLastZero: {
54
54
  type: [Number, String],
55
55
  default: '0'
56
56
  },
@@ -173,12 +173,18 @@ export default {
173
173
  }
174
174
  return ret
175
175
  })
176
-
176
+ const inputWrapAttrs = computed(() => {
177
+ return {
178
+ class: attrs?.class,
179
+ style: attrs?.style
180
+ }
181
+ })
177
182
  const normalAttrs = computed(() => {
178
183
  const ret = {
179
184
  ...attrs
180
185
  }
181
186
  delete ret.class
187
+ delete ret.style
182
188
 
183
189
  if (isPagePopupAndSearch.value && isOnlyIconClickFlag.value) {
184
190
  delete ret.onClick
@@ -240,13 +246,12 @@ export default {
240
246
 
241
247
  // 转换数字并限制范围
242
248
  val = Math.max(props.min, Math.min(props.max, val))
243
-
244
249
  // 处理千分位
245
250
  if (props.decimal != '-1') {
246
251
  val = val.toFixed(props.decimal)
247
252
  }
248
- if (props.decimalSuffix != '1') {
249
- val = parseFloat(val)
253
+ if (props.keepLastZero != '1') {
254
+ val = parseFloatToString(val)
250
255
  }
251
256
  const parts = `${val}`.split('.')
252
257
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, props.moneySeg)
@@ -279,7 +284,7 @@ export default {
279
284
  return ''
280
285
  })
281
286
  const parsed = Number(repVal)
282
- return isNaN(parsed) ? '' : parsed
287
+ return isNaN(parsed) ? '' : parseFloatToString(parsed)
283
288
  }
284
289
 
285
290
  expose({
@@ -293,7 +298,10 @@ export default {
293
298
  {
294
299
  getInputSolts()
295
300
  }
296
- </ElInput>
301
+ </ElInput>,
302
+ {
303
+ wrapAttrs: inputWrapAttrs.value
304
+ }
297
305
  )
298
306
  }
299
307
  }
@@ -1,4 +1,4 @@
1
- .error-tip-block,.custom-error-tip-block {
1
+ .error-tip-block {
2
2
  & + .el-form-item__error {
3
3
  position: relative;
4
4
  }
@@ -484,4 +484,85 @@ export function createEmptyCopy(source, cache = new WeakMap()) {
484
484
  }
485
485
 
486
486
  return copy;
487
+ }
488
+
489
+ export function parseFloatToString(input) {
490
+ // 1. 处理输入类型
491
+ if (input === null || input === undefined) return "NaN";
492
+ const str = String(input).trim();
493
+
494
+ // 2. 匹配浮点数(包括科学计数法)
495
+ const floatRegex = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/;
496
+ const match = str.match(floatRegex);
497
+ if (!match) return "NaN";
498
+
499
+ // 3. 处理科学计数法
500
+ let numberStr = match[0];
501
+ if (/e/i.test(numberStr)) {
502
+ numberStr = convertScientificNotation(numberStr);
503
+ }
504
+
505
+ // 4. 规范化结果(去除多余的前导/后缀零)
506
+ return normalizeNumberString(numberStr);
507
+ }
508
+
509
+ // 科学计数法转普通数字字符串
510
+ function convertScientificNotation(sciStr) {
511
+ const [base, expPart] = sciStr.split(/e/gi);
512
+ const exponent = expPart ? parseInt(expPart, 10) : 0;
513
+
514
+ let [integer, decimal = ""] = base.split(".");
515
+ const isNegative = integer.startsWith("-");
516
+ if (isNegative) integer = integer.slice(1);
517
+
518
+ // 合并整数和小数部分
519
+ let numStr = integer + decimal;
520
+ const decimalPos = integer.length;
521
+
522
+ // 计算新小数点位置
523
+ const newPos = decimalPos + exponent;
524
+
525
+ // 处理不同情况
526
+ if (newPos >= numStr.length) {
527
+ // 右移超出:补零
528
+ return (isNegative ? "-" : "") + numStr + "0".repeat(newPos - numStr.length);
529
+ } else if (newPos <= 0) {
530
+ // 左移超出:补零
531
+ const zeros = "0".repeat(-newPos);
532
+ return (isNegative ? "-" : "") + "0." + zeros + numStr;
533
+ } else {
534
+ // 插入小数点
535
+ return (isNegative ? "-" : "") +
536
+ numStr.slice(0, newPos) +
537
+ (numStr.slice(newPos) ? "." + numStr.slice(newPos) : "");
538
+ }
539
+ }
540
+
541
+ // 规范化数字字符串
542
+ function normalizeNumberString(numStr) {
543
+ // 处理空字符串
544
+ if (numStr === "") return "0";
545
+
546
+ // 分解符号、整数和小数部分
547
+ const isNegative = numStr.startsWith("-");
548
+ const cleanStr = isNegative ? numStr.slice(1) : numStr;
549
+ let [integer, decimal] = cleanStr.split(".");
550
+
551
+ // 处理整数部分前导零
552
+ integer = integer.replace(/^0+/, "") || "0";
553
+
554
+ // 处理小数部分后缀零
555
+ decimal = (decimal || "").replace(/0+$/, "");
556
+
557
+ // 组合结果
558
+ let result = "";
559
+ result += isNegative ? "-" : "";
560
+ result += integer;
561
+ result += decimal ? "." + decimal : "";
562
+
563
+ // 特殊处理 ".5" -> "0.5"
564
+ if (result.startsWith(".")) result = "0" + result;
565
+ if (result.startsWith("-.")) result = "-0" + result.slice(1);
566
+
567
+ return result;
487
568
  }
@@ -1053,9 +1053,6 @@ export function getComponentSolt({
1053
1053
  slotKey = 'slots'
1054
1054
  }) {
1055
1055
  const slots = config?.[slotKey]
1056
- if (config.metaType === 'ElButton') {
1057
- // debugger
1058
- }
1059
1056
  if (slots) {
1060
1057
  let retSlots = null
1061
1058
  try {