@tuya-miniapp/smart-ui 2.7.3-beta-0 → 2.7.3-beta-1
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/stepper/index.js
CHANGED
|
@@ -69,6 +69,7 @@ SmartComponent({
|
|
|
69
69
|
currentValue: '',
|
|
70
70
|
Minus,
|
|
71
71
|
Plus,
|
|
72
|
+
focus: false,
|
|
72
73
|
isInit: false,
|
|
73
74
|
},
|
|
74
75
|
watch: {
|
|
@@ -88,10 +89,10 @@ SmartComponent({
|
|
|
88
89
|
},
|
|
89
90
|
methods: {
|
|
90
91
|
observeValue() {
|
|
91
|
-
const { value, isInit } = this.data;
|
|
92
|
-
if (!isInit)
|
|
92
|
+
const { value, isInit, focus } = this.data;
|
|
93
|
+
if (!isInit || `${value}` === `${this.data.currentValue}` || focus)
|
|
93
94
|
return;
|
|
94
|
-
const currentValue = this.format(value,
|
|
95
|
+
const currentValue = this.format(value, !this.data.focus);
|
|
95
96
|
if (currentValue !== value) {
|
|
96
97
|
this.$emit('change', currentValue);
|
|
97
98
|
}
|
|
@@ -112,6 +113,7 @@ SmartComponent({
|
|
|
112
113
|
},
|
|
113
114
|
onFocus(event) {
|
|
114
115
|
this.$emit('focus', event.detail);
|
|
116
|
+
this.setData({ focus: true });
|
|
115
117
|
},
|
|
116
118
|
onBlur(event) {
|
|
117
119
|
const value = this.format(event.detail.value, true);
|
|
@@ -120,7 +122,7 @@ SmartComponent({
|
|
|
120
122
|
const strStepValue = isDef(this.data.decimalLength)
|
|
121
123
|
? stepValue.toFixed(this.data.decimalLength)
|
|
122
124
|
: stepValue.toString();
|
|
123
|
-
this.setData({ currentValue: strStepValue });
|
|
125
|
+
this.setData({ currentValue: strStepValue, focus: false });
|
|
124
126
|
this.emitChange(strStepValue);
|
|
125
127
|
this.$emit('blur', Object.assign(Object.assign({}, event.detail), { value: strStepValue }));
|
|
126
128
|
},
|
package/dist/stepper/index.wxml
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
class="smart-manrope input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
|
|
22
22
|
style="{{ computed.inputStyle({ buttonSize, inputWidth }) }}"
|
|
23
23
|
value="{{ currentValue }}"
|
|
24
|
-
focus="{{ focus }}"
|
|
25
24
|
disabled="{{ disabled || disableInput }}"
|
|
26
25
|
always-embed="{{ alwaysEmbed }}"
|
|
27
26
|
bindinput="onInput"
|
package/lib/stepper/index.js
CHANGED
|
@@ -85,6 +85,7 @@ function equal(value1, value2) {
|
|
|
85
85
|
currentValue: '',
|
|
86
86
|
Minus: Minus_1.default,
|
|
87
87
|
Plus: Plus_1.default,
|
|
88
|
+
focus: false,
|
|
88
89
|
isInit: false,
|
|
89
90
|
},
|
|
90
91
|
watch: {
|
|
@@ -104,10 +105,10 @@ function equal(value1, value2) {
|
|
|
104
105
|
},
|
|
105
106
|
methods: {
|
|
106
107
|
observeValue: function () {
|
|
107
|
-
var _a = this.data, value = _a.value, isInit = _a.isInit;
|
|
108
|
-
if (!isInit)
|
|
108
|
+
var _a = this.data, value = _a.value, isInit = _a.isInit, focus = _a.focus;
|
|
109
|
+
if (!isInit || "".concat(value) === "".concat(this.data.currentValue) || focus)
|
|
109
110
|
return;
|
|
110
|
-
var currentValue = this.format(value,
|
|
111
|
+
var currentValue = this.format(value, !this.data.focus);
|
|
111
112
|
if (currentValue !== value) {
|
|
112
113
|
this.$emit('change', currentValue);
|
|
113
114
|
}
|
|
@@ -128,6 +129,7 @@ function equal(value1, value2) {
|
|
|
128
129
|
},
|
|
129
130
|
onFocus: function (event) {
|
|
130
131
|
this.$emit('focus', event.detail);
|
|
132
|
+
this.setData({ focus: true });
|
|
131
133
|
},
|
|
132
134
|
onBlur: function (event) {
|
|
133
135
|
var value = this.format(event.detail.value, true);
|
|
@@ -136,7 +138,7 @@ function equal(value1, value2) {
|
|
|
136
138
|
var strStepValue = (0, validator_1.isDef)(this.data.decimalLength)
|
|
137
139
|
? stepValue.toFixed(this.data.decimalLength)
|
|
138
140
|
: stepValue.toString();
|
|
139
|
-
this.setData({ currentValue: strStepValue });
|
|
141
|
+
this.setData({ currentValue: strStepValue, focus: false });
|
|
140
142
|
this.emitChange(strStepValue);
|
|
141
143
|
this.$emit('blur', __assign(__assign({}, event.detail), { value: strStepValue }));
|
|
142
144
|
},
|
package/lib/stepper/index.wxml
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
class="smart-manrope input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
|
|
22
22
|
style="{{ computed.inputStyle({ buttonSize, inputWidth }) }}"
|
|
23
23
|
value="{{ currentValue }}"
|
|
24
|
-
focus="{{ focus }}"
|
|
25
24
|
disabled="{{ disabled || disableInput }}"
|
|
26
25
|
always-embed="{{ alwaysEmbed }}"
|
|
27
26
|
bindinput="onInput"
|