@cloudbase/weda-ui-mp 3.30.1 → 3.30.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.
@@ -4,7 +4,6 @@
4
4
  "usingComponents": {
5
5
  "mp-cells": "weui-miniprogram/cells/cells",
6
6
  "mp-cell": "weui-miniprogram/cell/cell",
7
- "mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet",
8
- "wd-button": "../../wd-button/index"
7
+ "mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet"
9
8
  }
10
9
  }
@@ -6,7 +6,8 @@
6
6
  {{label}}
7
7
  </view>
8
8
  <view class="weda-uploader-files__btn-contain">
9
- <wd-button size="sm" disabled="{{disabled}}" variant="outline" text="{{uploadButtonText}}" bindtap="onButtonTap"> </wd-button>
9
+ <button class="weui-btn weda-uploader-files__btn" bindtap="onButtonTap" disabled="{{disabled}}">{{uploadButtonText}}</button>
10
+
10
11
  <view wx:if="{{maxCount!=1}}" class="weda-uploader-files__tips">{{uploadTipText}}</view>
11
12
  <view wx:else>
12
13
  <slot name="tips"></slot>
@@ -105,10 +105,6 @@ Component({
105
105
  },
106
106
  min: {},
107
107
  max: {},
108
- inputValue: {
109
- type: Number,
110
- value: null,
111
- },
112
108
  },
113
109
  data: {
114
110
  isInit: true,
@@ -185,20 +181,21 @@ Component({
185
181
  const toReal = getRealValue({ value: toShow, format });
186
182
  const detail = { ...e.detail, value: toReal };
187
183
 
184
+ if (needSetData) {
185
+ this.changeForm(detail);
186
+ this.triggerEvent('change', detail);
187
+ } else {
188
+ this.triggerEvent('input', detail);
189
+ }
190
+
188
191
  const upDownState = this.getStepDisabled(null, toReal);
189
192
 
190
- // 先更新 realValue,避免 value 观察者触发时 realValue 还是旧值导致重复处理
191
- if (needSetData) {
193
+ needSetData &&
192
194
  this.setData({
193
195
  realValue: toReal,
194
196
  showValue: toShow,
195
197
  ...upDownState,
196
198
  });
197
- this.changeForm(detail);
198
- this.triggerEvent('change', detail);
199
- } else {
200
- this.triggerEvent('input', detail);
201
- }
202
199
 
203
200
  return toReal;
204
201
  },
@@ -291,7 +288,7 @@ Component({
291
288
  ...{ ...this.properties, ...props },
292
289
  type: format,
293
290
  });
294
- const toReal = getRealValue({ value: toShow, format });
291
+ const toReal = getRealValue({ value: toShow });
295
292
 
296
293
  const { stepPlusDisabled, stepMinusDisabled } = this.getStepDisabled(
297
294
  { readOnly, disabled, status, max, min, format },
@@ -450,17 +447,24 @@ Component({
450
447
  },
451
448
  // 监听非输入引起的value变化,比如调用 setValue, clearValue
452
449
  value: function (value) {
453
- if (equal(value, this.data.realValue)) return;
454
450
  const { format } = this.properties;
455
451
 
456
- // value 是真实值,不需要做百分比转换,只需要格式化显示
457
- const toReal = isNumber(value) ? value : null;
452
+ let toReal = this.data.realValue;
453
+ let toShow = this.data.showValue;
458
454
 
459
- const toShow = this.getShowValue({
460
- ...this.properties,
461
- value: `${isNumber(value) ? value : ''}`,
462
- type: format,
463
- });
455
+ if (!this.data.isInit) {
456
+ toReal = isNumber(value) ? value : null;
457
+ toShow = this.getShowValue({
458
+ ...this.properties,
459
+ value: `${isNumber(value) ? value : ''}`,
460
+ type: format,
461
+ });
462
+ }
463
+
464
+ // 初始化时同步真实值到表单
465
+ if (isNumber(toReal) && this.data.isInit) {
466
+ this.changeForm({ value: toReal });
467
+ }
464
468
 
465
469
  const readValue = `${toShow}${getPercentUnit(format)}`;
466
470
 
@@ -478,6 +482,22 @@ Component({
478
482
  });
479
483
  }, 0);
480
484
  },
485
+ inputValue: function (inputValue) {
486
+ if (equal(inputValue, this.data._oldInputValue)) return;
487
+ const { toReal, toShow, stepPlusDisabled, stepMinusDisabled, readValue } = this.getRealAndShowData({
488
+ value: inputValue,
489
+ });
490
+
491
+ this.setData({
492
+ readValue,
493
+ realValue: toReal,
494
+ showValue: this.data.readOnly ? readValue : toShow,
495
+ stepPlusDisabled,
496
+ stepMinusDisabled,
497
+ });
498
+ this.changeForm({ value: toReal });
499
+ this.data._oldInputValue = inputValue;
500
+ },
481
501
  },
482
502
  lifetimes: {
483
503
  attached: function () {
@@ -53,5 +53,4 @@
53
53
  readOnly="{{readOnly}}"
54
54
  value="{{value}}"
55
55
  cursorSpacing="{{cursorSpacing}}"
56
- type="number"
57
56
  ></inner-input>
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "miniprogram": "./",
4
4
  "packageManager": "yarn@3.0.2",
5
5
  "dependencies": {},
6
- "version": "3.30.1",
6
+ "version": "3.30.2",
7
7
  "main": "./",
8
8
  "publishConfig": {
9
9
  "access": "public"