@tuya-miniapp/smart-ui 2.3.0-beta-3 → 2.3.0-beta-5

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.
Files changed (124) hide show
  1. package/README-zh_CN.md +66 -0
  2. package/dist/calendar/index.js +1 -0
  3. package/dist/calendar/index.json +1 -2
  4. package/dist/calendar/index.wxml +0 -2
  5. package/dist/picker/index.js +2 -2
  6. package/dist/picker/index.wxml +2 -2
  7. package/dist/picker-column/index.js +8 -8
  8. package/dist/popover/index.js +2 -2
  9. package/dist/toast/toast.js +1 -1
  10. package/lib/calendar/index.js +1 -0
  11. package/lib/calendar/index.json +1 -2
  12. package/lib/calendar/index.wxml +0 -2
  13. package/lib/picker/index.js +2 -2
  14. package/lib/picker/index.wxml +2 -2
  15. package/lib/picker-column/index.js +8 -8
  16. package/lib/popover/index.js +2 -2
  17. package/lib/toast/toast.js +1 -1
  18. package/package.json +6 -2
  19. package/lib/action-sheet/demo/index.d.ts +0 -1
  20. package/lib/action-sheet/demo/index.js +0 -124
  21. package/lib/area/demo/index.d.ts +0 -1
  22. package/lib/area/demo/index.js +0 -47
  23. package/lib/battery/demo/index.d.ts +0 -1
  24. package/lib/battery/demo/index.js +0 -4
  25. package/lib/bottom-sheet/demo/index.d.ts +0 -1
  26. package/lib/bottom-sheet/demo/index.js +0 -27
  27. package/lib/button/demo/index.d.ts +0 -1
  28. package/lib/button/demo/index.js +0 -14
  29. package/lib/calendar/demo/index.d.ts +0 -1
  30. package/lib/calendar/demo/index.js +0 -110
  31. package/lib/cascader/demo/index.d.ts +0 -1
  32. package/lib/cascader/demo/index.js +0 -197
  33. package/lib/cell/demo/index.d.ts +0 -1
  34. package/lib/cell/demo/index.js +0 -20
  35. package/lib/checkbox/demo/index.d.ts +0 -1
  36. package/lib/checkbox/demo/index.js +0 -38
  37. package/lib/circle/demo/index.d.ts +0 -1
  38. package/lib/circle/demo/index.js +0 -21
  39. package/lib/col/demo/index.d.ts +0 -1
  40. package/lib/col/demo/index.js +0 -6
  41. package/lib/collapse/demo/index.d.ts +0 -1
  42. package/lib/collapse/demo/index.js +0 -42
  43. package/lib/config-provider/demo/index.d.ts +0 -1
  44. package/lib/config-provider/demo/index.js +0 -24
  45. package/lib/count-down/demo/index.d.ts +0 -1
  46. package/lib/count-down/demo/index.js +0 -38
  47. package/lib/custom-keyboard/demo/index.d.ts +0 -1
  48. package/lib/custom-keyboard/demo/index.js +0 -19
  49. package/lib/datetime-picker/demo/index.d.ts +0 -1
  50. package/lib/datetime-picker/demo/index.js +0 -99
  51. package/lib/dialog/demo/index.d.ts +0 -1
  52. package/lib/dialog/demo/index.js +0 -144
  53. package/lib/divider/demo/index.d.ts +0 -1
  54. package/lib/divider/demo/index.js +0 -6
  55. package/lib/dropdown-menu/demo/index.d.ts +0 -1
  56. package/lib/dropdown-menu/demo/index.js +0 -52
  57. package/lib/empty/demo/index.d.ts +0 -1
  58. package/lib/empty/demo/index.js +0 -15
  59. package/lib/field/demo/index.d.ts +0 -1
  60. package/lib/field/demo/index.js +0 -25
  61. package/lib/goods-action/demo/index.d.ts +0 -1
  62. package/lib/goods-action/demo/index.js +0 -17
  63. package/lib/grid/demo/index.d.ts +0 -1
  64. package/lib/grid/demo/index.js +0 -11
  65. package/lib/icon/demo/index.d.ts +0 -1
  66. package/lib/icon/demo/index.js +0 -54
  67. package/lib/image/demo/index.d.ts +0 -1
  68. package/lib/image/demo/index.js +0 -17
  69. package/lib/index-bar/demo/index.d.ts +0 -1
  70. package/lib/index-bar/demo/index.js +0 -23
  71. package/lib/loading/demo/index.d.ts +0 -1
  72. package/lib/loading/demo/index.js +0 -6
  73. package/lib/nav-bar/demo/index.d.ts +0 -1
  74. package/lib/nav-bar/demo/index.js +0 -31
  75. package/lib/normal-slider/demo/index.d.ts +0 -1
  76. package/lib/normal-slider/demo/index.js +0 -21
  77. package/lib/notice-bar/demo/index.d.ts +0 -1
  78. package/lib/notice-bar/demo/index.js +0 -16
  79. package/lib/notify/demo/index.d.ts +0 -1
  80. package/lib/notify/demo/index.js +0 -50
  81. package/lib/overlay/demo/index.d.ts +0 -1
  82. package/lib/overlay/demo/index.js +0 -24
  83. package/lib/picker/demo/index.d.ts +0 -1
  84. package/lib/picker/demo/index.js +0 -99
  85. package/lib/popover/demo/index.d.ts +0 -1
  86. package/lib/popover/demo/index.js +0 -27
  87. package/lib/popup/demo/index.d.ts +0 -1
  88. package/lib/popup/demo/index.js +0 -85
  89. package/lib/progress/demo/index.d.ts +0 -1
  90. package/lib/progress/demo/index.js +0 -6
  91. package/lib/radio/demo/index.d.ts +0 -1
  92. package/lib/radio/demo/index.js +0 -34
  93. package/lib/rate/demo/index.d.ts +0 -1
  94. package/lib/rate/demo/index.js +0 -30
  95. package/lib/search/demo/index.d.ts +0 -1
  96. package/lib/search/demo/index.js +0 -48
  97. package/lib/sidebar/demo/index.d.ts +0 -1
  98. package/lib/sidebar/demo/index.js +0 -14
  99. package/lib/skeleton/demo/index.d.ts +0 -1
  100. package/lib/skeleton/demo/index.js +0 -14
  101. package/lib/slider/demo/index.d.ts +0 -1
  102. package/lib/slider/demo/index.js +0 -21
  103. package/lib/stepper/demo/index.d.ts +0 -1
  104. package/lib/stepper/demo/index.js +0 -25
  105. package/lib/steps/demo/index.d.ts +0 -1
  106. package/lib/steps/demo/index.js +0 -48
  107. package/lib/sticky/demo/index.d.ts +0 -1
  108. package/lib/sticky/demo/index.js +0 -30
  109. package/lib/swipe-cell/demo/index.d.ts +0 -1
  110. package/lib/swipe-cell/demo/index.js +0 -50
  111. package/lib/switch/demo/index.d.ts +0 -1
  112. package/lib/switch/demo/index.js +0 -37
  113. package/lib/tab/demo/index.d.ts +0 -1
  114. package/lib/tab/demo/index.js +0 -57
  115. package/lib/tabbar/demo/index.d.ts +0 -1
  116. package/lib/tabbar/demo/index.js +0 -41
  117. package/lib/tag/demo/index.d.ts +0 -1
  118. package/lib/tag/demo/index.js +0 -19
  119. package/lib/toast/demo/index.d.ts +0 -1
  120. package/lib/toast/demo/index.js +0 -74
  121. package/lib/transition/demo/index.d.ts +0 -1
  122. package/lib/transition/demo/index.js +0 -71
  123. package/lib/tree-select/demo/index.d.ts +0 -1
  124. package/lib/tree-select/demo/index.js +0 -130
@@ -0,0 +1,66 @@
1
+ [English](./README.md) | 简体中文
2
+
3
+ # @tuya-miniapp/smart-ui
4
+
5
+ ## 介绍
6
+
7
+ `@tuya-miniapp/smart-ui` 是一个**轻量、可靠的智能小程序组件库**,其基于 `vant-weapp` 实现,提供了一整套符合智能小程序移动端设计规范的 UI 组件。
8
+
9
+ ## 预览
10
+
11
+ 扫描下方智能小程序二维码,体验组件库示例。
12
+
13
+ <img src="https://images.tuyacn.com/rms-static/8bcfe810-a187-11ef-9773-6b86083026a3-1731478901009.png?tyName=v2.0.0miniapp-SmartUI.png" width="200" height="200">
14
+
15
+ ## 使用之前
16
+
17
+ 使用 Smart UI 前,请确保你已经学习过智能小程序官方的 [智能小程序快速开始](https://developer.tuya.com/cn/miniapp/develop/miniapp/guide/start/smart) 和 [小程序组件介绍](https://developer.tuya.com/cn/miniapp/develop/miniapp/framework/component/intro)。
18
+
19
+ ## 安装
20
+
21
+ ```bash
22
+ # 通过 yarn 安装(推荐)
23
+ yarn add @tuya-miniapp/smart-ui
24
+
25
+ # 通过 npm 安装
26
+ npm i @tuya-miniapp/smart-ui
27
+ ```
28
+
29
+ ## 使用组件
30
+
31
+ 以按钮组件为例,只需要在 json 文件中引入按钮对应的自定义组件即可
32
+
33
+ ```json
34
+ {
35
+ "usingComponents": {
36
+ "smart-button": "@tuya-miniapp/smart-ui/lib/button/index"
37
+ }
38
+ }
39
+ ```
40
+
41
+ 接着就可以在 tyml 中直接使用组件
42
+
43
+ ```html
44
+ <smart-button type="primary">按钮</smart-button>
45
+ ```
46
+
47
+ ## 在开发者工具中预览
48
+
49
+ ```bash
50
+ # 安装项目依赖
51
+ yarn
52
+
53
+ # 执行组件编译
54
+ yarn dev
55
+ ```
56
+
57
+ 打开 [Tuya MiniApp Tools](https://developer.tuya.com/cn/miniapp/devtools/tools),把`smart-ui/example`目录添加进去就可以预览示例了。
58
+
59
+ ## 基础库版本
60
+
61
+ `@tuya-miniapp/smart-ui` 从智能小程序基础库 `2.19.0` 版本开始提供稳定的支持。
62
+
63
+ ## 开源协议
64
+
65
+ 本项目基于 [MIT](https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89) 协议,请自由地享受和参与开源。
66
+
@@ -416,6 +416,7 @@ SmartComponent({
416
416
  if (maxRange && calcDateNum(date) > maxRange) {
417
417
  if (showRangePrompt) {
418
418
  Toast({
419
+ selector: '#smart-toast-calendar',
419
420
  context: this,
420
421
  message: rangePrompt || `选择天数不能超过 ${maxRange} 天`,
421
422
  });
@@ -6,7 +6,6 @@
6
6
  "month-list": "../calendar-month-list/index",
7
7
  "year-list": "../calendar-year-list/index",
8
8
  "smart-button": "../button/index",
9
- "smart-popup": "../popup/index",
10
- "smart-toast": "../toast/index"
9
+ "smart-popup": "../popup/index"
11
10
  }
12
11
  }
@@ -23,5 +23,3 @@
23
23
  </smart-popup>
24
24
 
25
25
  <include wx:else src="./calendar.wxml" />
26
-
27
- <smart-toast id="smart-toast" />
@@ -150,7 +150,7 @@ SmartComponent({
150
150
  this.setData({
151
151
  animating: true,
152
152
  });
153
- this.$emit('animationStart');
153
+ this.$emit('animation-start');
154
154
  },
155
155
  animationEnd() {
156
156
  if (!this.data.animating)
@@ -158,7 +158,7 @@ SmartComponent({
158
158
  this.setData({
159
159
  animating: false,
160
160
  });
161
- this.$emit('animationEnd');
161
+ this.$emit('animation-end');
162
162
  },
163
163
  },
164
164
  });
@@ -30,8 +30,8 @@
30
30
  visible-item-count="{{ visibleItemCount }}"
31
31
  active-class="active-class"
32
32
  bind:change="onChange"
33
- bind:animationStart="animationStart"
34
- bind:animationEnd="animationEnd"
33
+ bind:animation-start="animationStart"
34
+ bind:animation-end="animationEnd"
35
35
  />
36
36
 
37
37
  <view
@@ -82,7 +82,7 @@ SmartComponent({
82
82
  });
83
83
  }
84
84
  if (!this.data.playing) {
85
- this.$emit('animationStart');
85
+ this.$emit('animation-start');
86
86
  }
87
87
  this.setData({
88
88
  startY: event.touches[0].clientY,
@@ -184,7 +184,7 @@ SmartComponent({
184
184
  this.setData({
185
185
  playing: false,
186
186
  });
187
- this.$emit('animationEnd');
187
+ this.$emit('animation-end');
188
188
  });
189
189
  },
190
190
  checkIsDown(curr) {
@@ -285,7 +285,7 @@ SmartComponent({
285
285
  index = this.adjustIndex(index) || 0;
286
286
  const offset = -index * data.itemHeight;
287
287
  if (!data.playing) {
288
- this.$emit('animationStart');
288
+ this.$emit('animation-start');
289
289
  this.setData({
290
290
  playing: true,
291
291
  });
@@ -305,14 +305,14 @@ SmartComponent({
305
305
  this.setData({
306
306
  playing: false,
307
307
  });
308
- this.$emit('animationEnd');
308
+ this.$emit('animation-end');
309
309
  return;
310
310
  }
311
311
  this.$emit('change', index);
312
312
  this.setData({
313
313
  playing: false,
314
314
  });
315
- this.$emit('animationEnd');
315
+ this.$emit('animation-end');
316
316
  });
317
317
  }
318
318
  return this.set({
@@ -327,20 +327,20 @@ SmartComponent({
327
327
  this.setData({
328
328
  playing: false,
329
329
  });
330
- this.$emit('animationEnd');
330
+ this.$emit('animation-end');
331
331
  return;
332
332
  }
333
333
  this.$emit('change', index);
334
334
  this.setData({
335
335
  playing: false,
336
336
  });
337
- this.$emit('animationEnd');
337
+ this.$emit('animation-end');
338
338
  });
339
339
  }
340
340
  this.setData({
341
341
  playing: false,
342
342
  });
343
- this.$emit('animationEnd');
343
+ this.$emit('animation-end');
344
344
  return this.set({ offset });
345
345
  },
346
346
  setValue(value) {
@@ -161,7 +161,7 @@ SmartComponent({
161
161
  this.setData({
162
162
  currentShow: true,
163
163
  });
164
- this.$emit('showchange', true);
164
+ this.$emit('show-change', true);
165
165
  if (this.data.duration) {
166
166
  setTimeout(() => {
167
167
  this.onClose();
@@ -172,7 +172,7 @@ SmartComponent({
172
172
  this.setData({
173
173
  currentShow: false,
174
174
  });
175
- this.$emit('showchange', false);
175
+ this.$emit('show-change', false);
176
176
  this.$emit('close', false);
177
177
  },
178
178
  },
@@ -32,7 +32,7 @@ function Toast(toastOptions) {
32
32
  getCurrentPage();
33
33
  const toast = context.selectComponent(options.selector);
34
34
  if (!toast) {
35
- console.warn('未找到 smart-toast 节点,请确认 selector 及 context 是否正确');
35
+ console.warn(`未找到 ${options.selector || '#smart-toast'} 节点,请确认 selector 及 context 是否正确`);
36
36
  return;
37
37
  }
38
38
  delete options.context;
@@ -434,6 +434,7 @@ var getTime = function (date) { return (date instanceof Date ? date.getTime() :
434
434
  if (maxRange && (0, utils_1.calcDateNum)(date) > maxRange) {
435
435
  if (showRangePrompt) {
436
436
  (0, toast_1.default)({
437
+ selector: '#smart-toast-calendar',
437
438
  context: this,
438
439
  message: rangePrompt || "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 ".concat(maxRange, " \u5929"),
439
440
  });
@@ -6,7 +6,6 @@
6
6
  "month-list": "../calendar-month-list/index",
7
7
  "year-list": "../calendar-year-list/index",
8
8
  "smart-button": "../button/index",
9
- "smart-popup": "../popup/index",
10
- "smart-toast": "../toast/index"
9
+ "smart-popup": "../popup/index"
11
10
  }
12
11
  }
@@ -23,5 +23,3 @@
23
23
  </smart-popup>
24
24
 
25
25
  <include wx:else src="./calendar.wxml" />
26
-
27
- <smart-toast id="smart-toast" />
@@ -173,7 +173,7 @@ var shared_1 = require("./shared");
173
173
  this.setData({
174
174
  animating: true,
175
175
  });
176
- this.$emit('animationStart');
176
+ this.$emit('animation-start');
177
177
  },
178
178
  animationEnd: function () {
179
179
  if (!this.data.animating)
@@ -181,7 +181,7 @@ var shared_1 = require("./shared");
181
181
  this.setData({
182
182
  animating: false,
183
183
  });
184
- this.$emit('animationEnd');
184
+ this.$emit('animation-end');
185
185
  },
186
186
  },
187
187
  });
@@ -30,8 +30,8 @@
30
30
  visible-item-count="{{ visibleItemCount }}"
31
31
  active-class="active-class"
32
32
  bind:change="onChange"
33
- bind:animationStart="animationStart"
34
- bind:animationEnd="animationEnd"
33
+ bind:animation-start="animationStart"
34
+ bind:animation-end="animationEnd"
35
35
  />
36
36
 
37
37
  <view
@@ -120,7 +120,7 @@ var DEFAULT_DURATION = 400;
120
120
  });
121
121
  }
122
122
  if (!this.data.playing) {
123
- this.$emit('animationStart');
123
+ this.$emit('animation-start');
124
124
  }
125
125
  this.setData({
126
126
  startY: event.touches[0].clientY,
@@ -218,7 +218,7 @@ var DEFAULT_DURATION = 400;
218
218
  this.setData({
219
219
  playing: false,
220
220
  });
221
- this.$emit('animationEnd');
221
+ this.$emit('animation-end');
222
222
  return [2 /*return*/];
223
223
  }
224
224
  });
@@ -326,7 +326,7 @@ var DEFAULT_DURATION = 400;
326
326
  index = this.adjustIndex(index) || 0;
327
327
  var offset = -index * data.itemHeight;
328
328
  if (!data.playing) {
329
- this.$emit('animationStart');
329
+ this.$emit('animation-start');
330
330
  this.setData({
331
331
  playing: true,
332
332
  });
@@ -346,14 +346,14 @@ var DEFAULT_DURATION = 400;
346
346
  _this.setData({
347
347
  playing: false,
348
348
  });
349
- _this.$emit('animationEnd');
349
+ _this.$emit('animation-end');
350
350
  return;
351
351
  }
352
352
  _this.$emit('change', index);
353
353
  _this.setData({
354
354
  playing: false,
355
355
  });
356
- _this.$emit('animationEnd');
356
+ _this.$emit('animation-end');
357
357
  });
358
358
  }
359
359
  return this.set({
@@ -368,20 +368,20 @@ var DEFAULT_DURATION = 400;
368
368
  _this.setData({
369
369
  playing: false,
370
370
  });
371
- _this.$emit('animationEnd');
371
+ _this.$emit('animation-end');
372
372
  return;
373
373
  }
374
374
  _this.$emit('change', index);
375
375
  _this.setData({
376
376
  playing: false,
377
377
  });
378
- _this.$emit('animationEnd');
378
+ _this.$emit('animation-end');
379
379
  });
380
380
  }
381
381
  this.setData({
382
382
  playing: false,
383
383
  });
384
- this.$emit('animationEnd');
384
+ this.$emit('animation-end');
385
385
  return this.set({ offset: offset });
386
386
  },
387
387
  setValue: function (value) {
@@ -177,7 +177,7 @@ function createSvgIcon(svg) {
177
177
  this.setData({
178
178
  currentShow: true,
179
179
  });
180
- this.$emit('showchange', true);
180
+ this.$emit('show-change', true);
181
181
  if (this.data.duration) {
182
182
  setTimeout(function () {
183
183
  _this.onClose();
@@ -188,7 +188,7 @@ function createSvgIcon(svg) {
188
188
  this.setData({
189
189
  currentShow: false,
190
190
  });
191
- this.$emit('showchange', false);
191
+ this.$emit('show-change', false);
192
192
  this.$emit('close', false);
193
193
  },
194
194
  },
@@ -46,7 +46,7 @@ function Toast(toastOptions) {
46
46
  (0, utils_1.getCurrentPage)();
47
47
  var toast = context.selectComponent(options.selector);
48
48
  if (!toast) {
49
- console.warn('未找到 smart-toast 节点,请确认 selector context 是否正确');
49
+ console.warn("\u672A\u627E\u5230 ".concat(options.selector || '#smart-toast', " \u8282\u70B9\uFF0C\u8BF7\u786E\u8BA4 selector \u53CA context \u662F\u5426\u6B63\u786E"));
50
50
  return;
51
51
  }
52
52
  delete options.context;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.3.0-beta-3",
3
+ "version": "2.3.0-beta-5",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",
@@ -22,8 +22,10 @@
22
22
  "files": [
23
23
  "dist",
24
24
  "!dist/**/demo/",
25
+ "lib",
25
26
  "!lib/**/demo/",
26
- "lib"
27
+ "README-zh_CN.md",
28
+ "README.md"
27
29
  ],
28
30
  "husky": {
29
31
  "hooks": {
@@ -49,6 +51,7 @@
49
51
  "@types/fs-extra": "^11.0.4",
50
52
  "@types/jest": "^27.0.2",
51
53
  "@vant/stylelint-config": "^1.4.2",
54
+ "canvas": "^3.1.0",
52
55
  "conventional-changelog-cli": "^5.0.0",
53
56
  "eslint-config-tuya-panel": "^0.4.2",
54
57
  "eslint-plugin-literal-check": "^0.1.2",
@@ -62,6 +65,7 @@
62
65
  "gulp-typescript": "^6.0.0-alpha.1",
63
66
  "husky": "^8.0.3",
64
67
  "jest": "^27.3.1",
68
+ "jest-canvas-mock": "^2.5.2",
65
69
  "lint-staged": "^13.0.3",
66
70
  "merge2": "^1.4.1",
67
71
  "miniprogram-api-typings": "^3.1.6",
@@ -1 +0,0 @@
1
- export {};
@@ -1,124 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- var component_1 = require("../../common/component");
15
- (0, component_1.SmartComponent)({
16
- data: {
17
- show1: false,
18
- show2: false,
19
- show3: false,
20
- show4: false,
21
- show5: false,
22
- showSelect: false,
23
- showSelect2: false,
24
- showNumber: false,
25
- showPicker: false,
26
- isReady: false,
27
- action1: [{ name: 'Action' }, { name: 'Action' }, { name: 'Action' }],
28
- action2: [
29
- { name: I18n.t('coloringOptions'), color: '#ee0a24' },
30
- { loading: true },
31
- { name: I18n.t('disableOption'), disabled: true },
32
- ],
33
- actionSelect: [
34
- { id: 0, name: 'Action', checked: true },
35
- { id: 1, name: 'Action', checked: false },
36
- { id: 2, name: 'Action', checked: false },
37
- { id: 3, name: 'Action', checked: false },
38
- { id: 4, name: 'Action', checked: false },
39
- { id: 5, name: 'Action', checked: false },
40
- { id: 6, name: 'Action', checked: false },
41
- { id: 7, name: 'Action', checked: false },
42
- ],
43
- currentNumber: 0,
44
- currentDate: new Date(2018, 0, 1),
45
- currentDateStr: new Date(2018, 0, 1).toLocaleDateString(),
46
- minDate: new Date(2018, 0, 1).getTime(),
47
- formatter: function (type, value) {
48
- if (type === 'year') {
49
- return "".concat(value).concat(I18n.t('year'));
50
- }
51
- if (type === 'month') {
52
- return "".concat(value).concat(I18n.t('month'));
53
- }
54
- return value;
55
- },
56
- },
57
- methods: {
58
- toggle: function (type) {
59
- var _a;
60
- this.setData((_a = {},
61
- _a[type] = !this.data[type],
62
- _a));
63
- },
64
- toggleActionSheet1: function () {
65
- this.toggle('show1');
66
- },
67
- toggleActionSheet2: function () {
68
- this.toggle('show2');
69
- },
70
- toggleActionSheet3: function () {
71
- this.toggle('show3');
72
- },
73
- toggleActionSheet4: function () {
74
- this.toggle('show4');
75
- },
76
- toggleActionSheet5: function () {
77
- this.toggle('show5');
78
- },
79
- toggleActionSheet6: function () {
80
- this.toggle('show6');
81
- },
82
- toggleActionSheetSelect: function () {
83
- this.toggle('showSelect');
84
- },
85
- toggleActionSheetSelect2: function () {
86
- this.toggle('showSelect2');
87
- },
88
- toggleActionSheetNumber: function () {
89
- this.toggle('showNumber');
90
- },
91
- toggleActionSheetPicker: function () {
92
- this.toggle('showPicker');
93
- },
94
- onAfterEnter: function () {
95
- this.setData({ isReady: true });
96
- },
97
- onChange: function (event) {
98
- this.setData({ currentNumber: event.detail.value });
99
- },
100
- onSelect: function (evt) {
101
- var id = evt.detail.id;
102
- var newActionSelect = this.data.actionSelect.map(function (item) {
103
- if (item.id === id)
104
- return __assign(__assign({}, item), { checked: true });
105
- return __assign(__assign({}, item), { checked: false });
106
- });
107
- this.setData({
108
- actionSelect: newActionSelect,
109
- });
110
- },
111
- onInput: function (event) {
112
- var detail = event.detail;
113
- var date = new Date(detail);
114
- this.setData({ currentDate: date });
115
- },
116
- onPickerConfirm: function () {
117
- var _a, _b;
118
- this.setData({
119
- showPicker: false,
120
- currentDateStr: (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.currentDate) === null || _b === void 0 ? void 0 : _b.toLocaleDateString(),
121
- });
122
- },
123
- },
124
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- var _a;
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var component_1 = require("../../common/component");
8
- var toast_1 = __importDefault(require("../../toast/toast"));
9
- var db = (_a = wx.cloud) === null || _a === void 0 ? void 0 : _a.database();
10
- (0, component_1.SmartComponent)({
11
- data: {
12
- areaList: {},
13
- loading: true,
14
- value: 330302,
15
- },
16
- mounted: function () {
17
- var _this = this;
18
- db === null || db === void 0 ? void 0 : db.collection('region').limit(1).get().then(function (res) {
19
- if (res.data && res.data.length > 0) {
20
- _this.setData({
21
- loading: false,
22
- areaList: res.data[0],
23
- });
24
- }
25
- }).catch(function (err) {
26
- console.log(err);
27
- _this.setData({
28
- loading: false,
29
- });
30
- });
31
- },
32
- methods: {
33
- onChange: function (event) {
34
- var values = event.detail.values;
35
- (0, toast_1.default)({
36
- context: this,
37
- message: values.map(function (item) { return item.name; }).join('-'),
38
- });
39
- },
40
- onConfirm: function (event) {
41
- console.log(event);
42
- },
43
- onCancel: function (event) {
44
- console.log(event);
45
- },
46
- },
47
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var component_1 = require("../../common/component");
4
- (0, component_1.SmartComponent)({});
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var component_1 = require("../../common/component");
4
- (0, component_1.SmartComponent)({
5
- data: {
6
- show1: false,
7
- show2: false,
8
- show3: false,
9
- },
10
- methods: {
11
- toggle: function (type) {
12
- var _a;
13
- this.setData((_a = {},
14
- _a[type] = !this.data[type],
15
- _a));
16
- },
17
- toggleActionSheet1: function () {
18
- this.toggle('show1');
19
- },
20
- toggleActionSheet2: function () {
21
- this.toggle('show2');
22
- },
23
- toggleActionSheet3: function () {
24
- this.toggle('show3');
25
- },
26
- },
27
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var PlusCircle_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/PlusCircle"));
7
- var Right_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Right"));
8
- var component_1 = require("../../common/component");
9
- (0, component_1.SmartComponent)({
10
- data: {
11
- iconAdd: PlusCircle_1.default,
12
- iconRight: Right_1.default,
13
- },
14
- });
@@ -1 +0,0 @@
1
- export {};