@tuya-miniapp/smart-ui 2.6.3 → 2.6.4-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.
@@ -115,9 +115,11 @@ SmartComponent({
115
115
  },
116
116
  onBlur(event) {
117
117
  const value = this.format(event.detail.value, true);
118
- this.setData({ currentValue: value });
119
- this.emitChange(value);
120
- this.$emit('blur', Object.assign(Object.assign({}, event.detail), { value }));
118
+ const stepValue = Math.round(value / this.data.step) * this.data.step;
119
+ const strStepValue = stepValue.toString();
120
+ this.setData({ currentValue: strStepValue });
121
+ this.emitChange(strStepValue);
122
+ this.$emit('blur', Object.assign(Object.assign({}, event.detail), { value: strStepValue }));
121
123
  },
122
124
  // filter illegal characters
123
125
  filter(value) {
@@ -34,6 +34,7 @@ SmartComponent({
34
34
  data: {
35
35
  catchMove: false,
36
36
  wrapperStyle: '',
37
+ position: 'close',
37
38
  },
38
39
  created() {
39
40
  this.offset = 0;
@@ -47,6 +48,10 @@ SmartComponent({
47
48
  const { leftWidth, rightWidth } = this.data;
48
49
  const offset = position === 'left' ? leftWidth : -rightWidth;
49
50
  this.swipeMove(offset);
51
+ if (position !== this.data.position && this.data.position !== 'close') {
52
+ this.$emit('tabClose', this.data.position);
53
+ }
54
+ this.setData({ position });
50
55
  this.$emit('open', {
51
56
  position,
52
57
  name: this.data.name,
@@ -78,7 +83,11 @@ SmartComponent({
78
83
  this.open('left');
79
84
  }
80
85
  else {
86
+ if (this.data.position !== 'close') {
87
+ this.$emit('tabClose', this.data.position);
88
+ }
81
89
  this.swipeMove(0);
90
+ this.setData({ position: 'close' });
82
91
  }
83
92
  this.setData({ catchMove: false });
84
93
  },
@@ -124,7 +133,11 @@ SmartComponent({
124
133
  });
125
134
  }
126
135
  else {
136
+ if (this.data.position !== 'close') {
137
+ this.$emit('tabClose', this.data.position);
138
+ }
127
139
  this.swipeMove(0);
140
+ this.setData({ position: 'close' });
128
141
  }
129
142
  },
130
143
  },
@@ -131,9 +131,11 @@ function equal(value1, value2) {
131
131
  },
132
132
  onBlur: function (event) {
133
133
  var value = this.format(event.detail.value, true);
134
- this.setData({ currentValue: value });
135
- this.emitChange(value);
136
- this.$emit('blur', __assign(__assign({}, event.detail), { value: value }));
134
+ var stepValue = Math.round(value / this.data.step) * this.data.step;
135
+ var strStepValue = stepValue.toString();
136
+ this.setData({ currentValue: strStepValue });
137
+ this.emitChange(strStepValue);
138
+ this.$emit('blur', __assign(__assign({}, event.detail), { value: strStepValue }));
137
139
  },
138
140
  // filter illegal characters
139
141
  filter: function (value) {
@@ -38,6 +38,7 @@ var ARRAY = [];
38
38
  data: {
39
39
  catchMove: false,
40
40
  wrapperStyle: '',
41
+ position: 'close',
41
42
  },
42
43
  created: function () {
43
44
  this.offset = 0;
@@ -52,6 +53,10 @@ var ARRAY = [];
52
53
  var _a = this.data, leftWidth = _a.leftWidth, rightWidth = _a.rightWidth;
53
54
  var offset = position === 'left' ? leftWidth : -rightWidth;
54
55
  this.swipeMove(offset);
56
+ if (position !== this.data.position && this.data.position !== 'close') {
57
+ this.$emit('tabClose', this.data.position);
58
+ }
59
+ this.setData({ position: position });
55
60
  this.$emit('open', {
56
61
  position: position,
57
62
  name: this.data.name,
@@ -79,7 +84,11 @@ var ARRAY = [];
79
84
  this.open('left');
80
85
  }
81
86
  else {
87
+ if (this.data.position !== 'close') {
88
+ this.$emit('tabClose', this.data.position);
89
+ }
82
90
  this.swipeMove(0);
91
+ this.setData({ position: 'close' });
83
92
  }
84
93
  this.setData({ catchMove: false });
85
94
  },
@@ -126,7 +135,11 @@ var ARRAY = [];
126
135
  });
127
136
  }
128
137
  else {
138
+ if (this.data.position !== 'close') {
139
+ this.$emit('tabClose', this.data.position);
140
+ }
129
141
  this.swipeMove(0);
142
+ this.setData({ position: 'close' });
130
143
  }
131
144
  },
132
145
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.6.3",
3
+ "version": "2.6.4-beta-1",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",