@tuya-miniapp/smart-ui 2.1.7-beta-1 → 2.1.7

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.
@@ -3,10 +3,10 @@ import { SmartComponent } from '../common/component';
3
3
  SmartComponent({
4
4
  props: {
5
5
  className: String,
6
- style: String,
6
+ customStyle: String,
7
7
  size: {
8
- type: Number,
9
- value: 100,
8
+ type: String,
9
+ value: '100px',
10
10
  },
11
11
  trackWidth: {
12
12
  type: Number,
@@ -1,4 +1,4 @@
1
- <view class="smart-progress-circle" style="width:{{size}}px;height:{{size}}px;padding:{{trackWidth}}px;background:{{fillColor}};{{style}}">
1
+ <view class="smart-progress-circle" style="width:{{size}};height:{{size}};padding:{{trackWidth}}px;background:{{fillColor}};{{customStyle}}">
2
2
  <view class="smart-progress-circle-box smart-progress-circle-box-left">
3
3
  <view class="smart-progress-circle-bar smart-progress-circle-bar-left" style="transform:{{transformLeft}};background:{{trackColor}};">
4
4
  </view>
@@ -35,8 +35,14 @@ function getContext() {
35
35
  const Dialog = (options) => {
36
36
  options = Object.assign(Object.assign({}, currentOptions), options);
37
37
  return new Promise((resolve, reject) => {
38
+ var _a;
38
39
  const context = (typeof options.context === 'function' ? options.context() : options.context) || getContext();
40
+ const selector = options.selector;
39
41
  const dialog = context.selectComponent(options.selector);
42
+ if ((queue === null || queue === void 0 ? void 0 : queue.length) > 0 && ((_a = queue === null || queue === void 0 ? void 0 : queue[0]) === null || _a === void 0 ? void 0 : _a.id) === (dialog === null || dialog === void 0 ? void 0 : dialog.id)) {
43
+ console.warn(`相同选择器的 Dialog 调用过于频繁,${dialog.id} 已忽略重复调用`);
44
+ return;
45
+ }
40
46
  delete options.context;
41
47
  delete options.selector;
42
48
  if (dialog) {
@@ -45,6 +51,10 @@ const Dialog = (options) => {
45
51
  optionsWithInputValue.inputValue = options.value;
46
52
  }
47
53
  dialog.setData(Object.assign({ callback: (action, instance) => {
54
+ /**
55
+ * 在声明式调用的情况下,在 close 后需要手动清空队列
56
+ */
57
+ queue = [];
48
58
  action === 'confirm' ? resolve(instance) : reject(instance);
49
59
  } }, optionsWithInputValue));
50
60
  wx.nextTick(() => {
@@ -53,7 +63,7 @@ const Dialog = (options) => {
53
63
  queue.push(dialog);
54
64
  }
55
65
  else {
56
- console.warn('未找到 smart-dialog 节点,请确认 selector 及 context 是否正确');
66
+ console.warn(`未找到 ${(selector !== null && selector !== void 0 ? selector : '#smart-dialog').replace('#', '')} 节点,请确认 selector 及 context 是否正确`);
57
67
  }
58
68
  });
59
69
  };
@@ -91,7 +91,7 @@
91
91
  loading="{{ loading.cancel }}"
92
92
  class="smart-dialog__button smart-hairline--right"
93
93
  custom-class="smart-dialog__cancel cancle-button-class"
94
- custom-style="color: {{ cancelButtonColor || 'var(--app-B4-N3, rgba(0, 0, 0, 0.5))' }}"
94
+ custom-style="color: {{ cancelButtonColor || 'var(--dialog-cancel-color, var(--app-B4-N3, rgba(0, 0, 0, 0.5)))' }}"
95
95
  bind:click="onCancel"
96
96
  >
97
97
  {{ cancelButtonText }}
@@ -107,7 +107,7 @@
107
107
  class="smart-dialog__button"
108
108
  loading="{{ loading.confirm }}"
109
109
  custom-class="smart-dialog__confirm confirm-button-class"
110
- custom-style="color: {{ confirmButtonColor || 'var(--app-B4-N1, rgba(0, 0, 0, 1))' }}"
110
+ custom-style="color: {{ confirmButtonColor || 'var(--dialog-confirm-color, var(--app-B4-N1, rgba(0, 0, 0, 1)))' }}"
111
111
  button-id="{{ confirmButtonId }}"
112
112
  open-type="{{ confirmButtonOpenType }}"
113
113
  lang="{{ lang }}"
@@ -16,6 +16,10 @@ SmartComponent({
16
16
  this.updateData();
17
17
  }),
18
18
  props: {
19
+ scrollable: {
20
+ type: Boolean,
21
+ value: false,
22
+ },
19
23
  sticky: {
20
24
  type: Boolean,
21
25
  value: true,
@@ -209,6 +213,8 @@ SmartComponent({
209
213
  this.scrollToAnchor(event.target.dataset.index);
210
214
  },
211
215
  onTouchMove(event) {
216
+ if (!this.data.scrollable)
217
+ return;
212
218
  const sidebarLength = this.children.length;
213
219
  const touch = event.touches[0];
214
220
  const itemHeight = this.sidebar.height / sidebarLength;
@@ -222,6 +228,8 @@ SmartComponent({
222
228
  this.scrollToAnchor(index);
223
229
  },
224
230
  onTouchStop() {
231
+ if (!this.data.scrollable)
232
+ return;
225
233
  this.scrollToAnchorIndex = null;
226
234
  },
227
235
  scrollToAnchor(index) {
@@ -5,10 +5,10 @@ var component_1 = require("../common/component");
5
5
  (0, component_1.SmartComponent)({
6
6
  props: {
7
7
  className: String,
8
- style: String,
8
+ customStyle: String,
9
9
  size: {
10
- type: Number,
11
- value: 100,
10
+ type: String,
11
+ value: '100px',
12
12
  },
13
13
  trackWidth: {
14
14
  type: Number,
@@ -1,4 +1,4 @@
1
- <view class="smart-progress-circle" style="width:{{size}}px;height:{{size}}px;padding:{{trackWidth}}px;background:{{fillColor}};{{style}}">
1
+ <view class="smart-progress-circle" style="width:{{size}};height:{{size}};padding:{{trackWidth}}px;background:{{fillColor}};{{customStyle}}">
2
2
  <view class="smart-progress-circle-box smart-progress-circle-box-left">
3
3
  <view class="smart-progress-circle-bar smart-progress-circle-bar-left" style="transform:{{transformLeft}};background:{{trackColor}};">
4
4
  </view>
@@ -48,8 +48,14 @@ function getContext() {
48
48
  var Dialog = function (options) {
49
49
  options = __assign(__assign({}, currentOptions), options);
50
50
  return new Promise(function (resolve, reject) {
51
+ var _a;
51
52
  var context = (typeof options.context === 'function' ? options.context() : options.context) || getContext();
53
+ var selector = options.selector;
52
54
  var dialog = context.selectComponent(options.selector);
55
+ if ((queue === null || queue === void 0 ? void 0 : queue.length) > 0 && ((_a = queue === null || queue === void 0 ? void 0 : queue[0]) === null || _a === void 0 ? void 0 : _a.id) === (dialog === null || dialog === void 0 ? void 0 : dialog.id)) {
56
+ console.warn("\u76F8\u540C\u9009\u62E9\u5668\u7684 Dialog \u8C03\u7528\u8FC7\u4E8E\u9891\u7E41\uFF0C".concat(dialog.id, " \u5DF2\u5FFD\u7565\u91CD\u590D\u8C03\u7528"));
57
+ return;
58
+ }
53
59
  delete options.context;
54
60
  delete options.selector;
55
61
  if (dialog) {
@@ -58,6 +64,10 @@ var Dialog = function (options) {
58
64
  optionsWithInputValue.inputValue = options.value;
59
65
  }
60
66
  dialog.setData(__assign({ callback: function (action, instance) {
67
+ /**
68
+ * 在声明式调用的情况下,在 close 后需要手动清空队列
69
+ */
70
+ queue = [];
61
71
  action === 'confirm' ? resolve(instance) : reject(instance);
62
72
  } }, optionsWithInputValue));
63
73
  wx.nextTick(function () {
@@ -66,7 +76,7 @@ var Dialog = function (options) {
66
76
  queue.push(dialog);
67
77
  }
68
78
  else {
69
- console.warn('未找到 smart-dialog 节点,请确认 selector context 是否正确');
79
+ console.warn("\u672A\u627E\u5230 ".concat((selector !== null && selector !== void 0 ? selector : '#smart-dialog').replace('#', ''), " \u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4 selector \u53CA context \u662F\u5426\u6B63\u786E"));
70
80
  }
71
81
  });
72
82
  };
@@ -91,7 +91,7 @@
91
91
  loading="{{ loading.cancel }}"
92
92
  class="smart-dialog__button smart-hairline--right"
93
93
  custom-class="smart-dialog__cancel cancle-button-class"
94
- custom-style="color: {{ cancelButtonColor || 'var(--app-B4-N3, rgba(0, 0, 0, 0.5))' }}"
94
+ custom-style="color: {{ cancelButtonColor || 'var(--dialog-cancel-color, var(--app-B4-N3, rgba(0, 0, 0, 0.5)))' }}"
95
95
  bind:click="onCancel"
96
96
  >
97
97
  {{ cancelButtonText }}
@@ -107,7 +107,7 @@
107
107
  class="smart-dialog__button"
108
108
  loading="{{ loading.confirm }}"
109
109
  custom-class="smart-dialog__confirm confirm-button-class"
110
- custom-style="color: {{ confirmButtonColor || 'var(--app-B4-N1, rgba(0, 0, 0, 1))' }}"
110
+ custom-style="color: {{ confirmButtonColor || 'var(--dialog-confirm-color, var(--app-B4-N1, rgba(0, 0, 0, 1)))' }}"
111
111
  button-id="{{ confirmButtonId }}"
112
112
  open-type="{{ confirmButtonOpenType }}"
113
113
  lang="{{ lang }}"
@@ -18,6 +18,10 @@ var indexList = function () {
18
18
  this.updateData();
19
19
  }),
20
20
  props: {
21
+ scrollable: {
22
+ type: Boolean,
23
+ value: false,
24
+ },
21
25
  sticky: {
22
26
  type: Boolean,
23
27
  value: true,
@@ -205,6 +209,8 @@ var indexList = function () {
205
209
  this.scrollToAnchor(event.target.dataset.index);
206
210
  },
207
211
  onTouchMove: function (event) {
212
+ if (!this.data.scrollable)
213
+ return;
208
214
  var sidebarLength = this.children.length;
209
215
  var touch = event.touches[0];
210
216
  var itemHeight = this.sidebar.height / sidebarLength;
@@ -218,6 +224,8 @@ var indexList = function () {
218
224
  this.scrollToAnchor(index);
219
225
  },
220
226
  onTouchStop: function () {
227
+ if (!this.data.scrollable)
228
+ return;
221
229
  this.scrollToAnchorIndex = null;
222
230
  },
223
231
  scrollToAnchor: function (index) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.1.7-beta-1",
3
+ "version": "2.1.7",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",
@@ -78,7 +78,7 @@
78
78
  ],
79
79
  "dependencies": {
80
80
  "@ray-js/components-ty-slider": "^0.2.52",
81
- "@tuya-miniapp/icons": "2.1.7-beta-1"
81
+ "@tuya-miniapp/icons": "^2.1.7"
82
82
  },
83
83
  "maintainers": [
84
84
  {