@tuya-miniapp/smart-ui 2.13.1 → 2.13.2-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.
Files changed (111) hide show
  1. package/dist/action-sheet/README.md +631 -0
  2. package/dist/battery/README.md +102 -0
  3. package/dist/bottom-sheet/README.md +397 -0
  4. package/dist/button/README.md +205 -0
  5. package/dist/button/index.css +1 -1
  6. package/dist/button/index.wxss +1 -1
  7. package/dist/calendar/README.md +466 -0
  8. package/dist/cascader/README.md +235 -0
  9. package/dist/cell/README.md +240 -0
  10. package/dist/checkbox/README.md +359 -0
  11. package/dist/circle/README.md +116 -0
  12. package/dist/col/README.md +134 -0
  13. package/dist/collapse/README.md +223 -0
  14. package/dist/common/README.md +71 -0
  15. package/dist/config-provider/README.md +143 -0
  16. package/dist/count-down/README.md +194 -0
  17. package/dist/custom-keyboard/README.md +119 -0
  18. package/dist/datetime-picker/README.md +384 -0
  19. package/dist/dialog/README.md +412 -0
  20. package/dist/divider/README.md +100 -0
  21. package/dist/dropdown-menu/README.md +278 -0
  22. package/dist/empty/README.md +101 -0
  23. package/dist/field/README.md +439 -0
  24. package/dist/grid/README.md +197 -0
  25. package/dist/icon/README.md +143 -0
  26. package/dist/image/README.md +171 -0
  27. package/dist/index-bar/README.md +189 -0
  28. package/dist/loading/README.md +86 -0
  29. package/dist/nav-bar/README.md +378 -0
  30. package/dist/normal-slider/README.md +325 -0
  31. package/dist/notice-bar/README.md +216 -0
  32. package/dist/notify/README.md +120 -0
  33. package/dist/overlay/README.md +132 -0
  34. package/dist/picker/README.md +396 -0
  35. package/dist/popover/README.md +249 -0
  36. package/dist/popup/README.md +162 -0
  37. package/dist/progress/README.md +99 -0
  38. package/dist/radio/README.md +303 -0
  39. package/dist/rate/README.md +176 -0
  40. package/dist/search/README.md +235 -0
  41. package/dist/sidebar/README.md +160 -0
  42. package/dist/skeleton/README.md +98 -0
  43. package/dist/slider/README.md +366 -0
  44. package/dist/stepper/README.md +208 -0
  45. package/dist/stepper/index.js +16 -1
  46. package/dist/stepper/index.wxml +1 -1
  47. package/dist/sticky/README.md +124 -0
  48. package/dist/swipe-cell/README.md +172 -0
  49. package/dist/switch/README.md +204 -0
  50. package/dist/tab/README.md +414 -0
  51. package/dist/tabbar/README.md +333 -0
  52. package/dist/tag/README.md +184 -0
  53. package/dist/toast/README.md +220 -0
  54. package/dist/transition/README.md +114 -0
  55. package/dist/tree-select/README.md +199 -0
  56. package/lib/action-sheet/README.md +631 -0
  57. package/lib/battery/README.md +102 -0
  58. package/lib/bottom-sheet/README.md +397 -0
  59. package/lib/button/README.md +205 -0
  60. package/lib/button/index.css +1 -1
  61. package/lib/button/index.wxss +1 -1
  62. package/lib/calendar/README.md +466 -0
  63. package/lib/cascader/README.md +235 -0
  64. package/lib/cell/README.md +240 -0
  65. package/lib/checkbox/README.md +359 -0
  66. package/lib/circle/README.md +116 -0
  67. package/lib/col/README.md +134 -0
  68. package/lib/collapse/README.md +223 -0
  69. package/lib/common/README.md +71 -0
  70. package/lib/config-provider/README.md +143 -0
  71. package/lib/count-down/README.md +194 -0
  72. package/lib/custom-keyboard/README.md +119 -0
  73. package/lib/datetime-picker/README.md +384 -0
  74. package/lib/dialog/README.md +412 -0
  75. package/lib/divider/README.md +100 -0
  76. package/lib/dropdown-menu/README.md +278 -0
  77. package/lib/empty/README.md +101 -0
  78. package/lib/field/README.md +439 -0
  79. package/lib/grid/README.md +197 -0
  80. package/lib/icon/README.md +143 -0
  81. package/lib/image/README.md +171 -0
  82. package/lib/index-bar/README.md +189 -0
  83. package/lib/loading/README.md +86 -0
  84. package/lib/nav-bar/README.md +378 -0
  85. package/lib/normal-slider/README.md +325 -0
  86. package/lib/notice-bar/README.md +216 -0
  87. package/lib/notify/README.md +120 -0
  88. package/lib/overlay/README.md +132 -0
  89. package/lib/picker/README.md +396 -0
  90. package/lib/popover/README.md +249 -0
  91. package/lib/popup/README.md +162 -0
  92. package/lib/progress/README.md +99 -0
  93. package/lib/radio/README.md +303 -0
  94. package/lib/rate/README.md +176 -0
  95. package/lib/search/README.md +235 -0
  96. package/lib/sidebar/README.md +160 -0
  97. package/lib/skeleton/README.md +98 -0
  98. package/lib/slider/README.md +366 -0
  99. package/lib/stepper/README.md +208 -0
  100. package/lib/stepper/index.js +16 -1
  101. package/lib/stepper/index.wxml +1 -1
  102. package/lib/sticky/README.md +124 -0
  103. package/lib/swipe-cell/README.md +172 -0
  104. package/lib/switch/README.md +204 -0
  105. package/lib/tab/README.md +414 -0
  106. package/lib/tabbar/README.md +333 -0
  107. package/lib/tag/README.md +184 -0
  108. package/lib/toast/README.md +220 -0
  109. package/lib/transition/README.md +114 -0
  110. package/lib/tree-select/README.md +199 -0
  111. package/package.json +5 -4
@@ -0,0 +1,124 @@
1
+ ---
2
+ category: 布局
3
+ ---
4
+
5
+ # Sticky 粘性布局
6
+
7
+ ### 介绍
8
+
9
+ Sticky 组件与 CSS 中`position: sticky`属性实现的效果一致,当组件在屏幕范围内时,会按照正常的布局排列,当组件滚出屏幕范围时,始终会固定在屏幕顶部。
10
+
11
+ ### 引入
12
+
13
+ 在`app.json`或`index.json`中引入组件,详细介绍见[快速上手](/material/smartui?comId=help-getting-started&appType=miniapp)。
14
+
15
+ ```json
16
+ "usingComponents": {
17
+ "smart-sticky": "@tuya-miniapp/smart-ui/lib/sticky/index"
18
+ }
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础用法
24
+
25
+ 将内容包裹在`Sticky`组件内即可。
26
+
27
+ ```html
28
+ <smart-sticky>
29
+ <smart-button type="primary">基础用法</smart-button>
30
+ </smart-sticky>
31
+ ```
32
+
33
+ ### 吸顶距离
34
+
35
+ 通过`offset-top`属性可以设置组件在吸顶时与顶部的距离。
36
+
37
+ ```html
38
+ <smart-sticky offset-top="{{ 50 }}">
39
+ <smart-button type="info">吸顶距离</smart-button>
40
+ </smart-sticky>
41
+ ```
42
+
43
+ ### 指定容器
44
+
45
+ 通过`container`属性可以指定组件的容器,页面滚动时,组件会始终保持在容器范围内,当组件即将超出容器底部时,会返回原位置。
46
+
47
+ ```html
48
+ <view id="container" style="height: 150px;">
49
+ <smart-sticky container="{{ container }}">
50
+ <smart-button type="warning">指定容器</smart-button>
51
+ </smart-sticky>
52
+ </view>
53
+ ```
54
+
55
+ ```js
56
+ Page({
57
+ data: {
58
+ container: null,
59
+ },
60
+
61
+ onReady() {
62
+ this.setData({
63
+ container: () => ty.createSelectorQuery().select('#container'),
64
+ });
65
+ },
66
+ });
67
+ ```
68
+
69
+ ### 嵌套在 scroll-view 内使用
70
+
71
+ 通过 `scroll-top` 与 `offset-top` 属性可以实现在 scroll-view 内嵌套使用。
72
+
73
+ ```html
74
+ <scroll-view
75
+ bind:scroll="onScroll"
76
+ scroll-y
77
+ id="scroller"
78
+ style="height: 200px;"
79
+ >
80
+ <view style="height: 400px; padding-top: 50px;">
81
+ <smart-sticky scroll-top="{{ scrollTop }}" offset-top="{{ offsetTop }}">
82
+ <smart-button type="warning">嵌套在 scroll-view 内</smart-button>
83
+ </smart-sticky>
84
+ </view>
85
+ </scroll-view>
86
+ ```
87
+
88
+ ```js
89
+ Page({
90
+ data: {
91
+ scrollTop: 0,
92
+ offsetTop: 0,
93
+ },
94
+
95
+ onScroll(event) {
96
+ ty.createSelectorQuery()
97
+ .select('#scroller')
98
+ .boundingClientRect((res) => {
99
+ this.setData({
100
+ scrollTop: event.detail.scrollTop,
101
+ offsetTop: res.top,
102
+ });
103
+ })
104
+ .exec();
105
+ },
106
+ });
107
+ ```
108
+
109
+ ## API
110
+
111
+ ### Props
112
+
113
+ | 参数 | 说明 | 类型 | 默认值 |
114
+ | ---------- | ------------------------------------------------------------ | ---------- | ------ |
115
+ | container | 一个函数,返回容器对应的 NodesRef 节点 | _function_ | - |
116
+ | offset-top | 吸顶时与顶部的距离,单位`px` | _number_ | `0` |
117
+ | scroll-top | 当前滚动区域的滚动位置,非 `null` 时会禁用页面滚动事件的监听 | _number_ | - |
118
+ | z-index | 吸顶时的 z-index | _number_ | `99` |
119
+
120
+ ### Events
121
+
122
+ | 事件名 | 说明 | 回调参数 |
123
+ | ----------- | ---------- | ---------------------------------------------- |
124
+ | bind:scroll | 滚动时触发 | { scrollTop: 距离顶部位置, isFixed: 是否吸顶 } |
@@ -0,0 +1,172 @@
1
+ ---
2
+ category: 反馈
3
+ ---
4
+
5
+ # SwipeCell 滑动单元格
6
+
7
+ ### 介绍
8
+
9
+ 可以左右滑动来展示操作按钮的单元格组件。
10
+
11
+ ### 引入
12
+
13
+ 在`app.json`或`index.json`中引入组件,详细介绍见[快速上手](/material/smartui?comId=help-getting-started&appType=miniapp)。
14
+
15
+ ```json
16
+ "usingComponents": {
17
+ "smart-swipe-cell": "@tuya-miniapp/smart-ui/lib/swipe-cell/index"
18
+ }
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础用法
24
+
25
+ ```html
26
+ <smart-swipe-cell right-width="{{ 65 }}" left-width="{{ 65 }}" bind:tabClose="onTabClose">
27
+ <view slot="left" class="smart-swipe-cell__left">选择</view>
28
+ <smart-cell-group>
29
+ <smart-cell title="单元格" value="内容" />
30
+ </smart-cell-group>
31
+ <view slot="right" class="smart-swipe-cell__right">删除</view>
32
+ </smart-swipe-cell>
33
+ ```
34
+
35
+ ```js
36
+ Page({
37
+ onTabClose(event) {
38
+ console.log('onTabClose: ', event.detail);
39
+ },
40
+ });
41
+ ```
42
+
43
+ ### 异步关闭
44
+
45
+ 当开启`async-close`时, 通过绑定`close`事件,可以自定义两侧滑动内容点击时的关闭行为。
46
+
47
+ ```html
48
+ <smart-swipe-cell
49
+ id="swipe-cell"
50
+ right-width="{{ 65 }}"
51
+ left-width="{{ 65 }}"
52
+ async-close
53
+ bind:close="onAsyncClose"
54
+ >
55
+ <view slot="left">选择</view>
56
+ <smart-cell-group>
57
+ <smart-cell title="单元格" value="内容" />
58
+ </smart-cell-group>
59
+ <view slot="right">删除</view>
60
+ </smart-swipe-cell>
61
+ ```
62
+
63
+ ```js
64
+ Page({
65
+ onAsyncClose(event) {
66
+ const { position, instance } = event.detail;
67
+ switch (position) {
68
+ case 'left':
69
+ case 'cell':
70
+ instance.close();
71
+ break;
72
+ case 'right':
73
+ Dialog.confirm({
74
+ message: '确定删除吗?',
75
+ }).then(() => {
76
+ instance.close();
77
+ });
78
+ break;
79
+ }
80
+ },
81
+ });
82
+ ```
83
+
84
+ ### 主动打开
85
+
86
+ ```html
87
+ <smart-swipe-cell
88
+ id="swipe-cell2"
89
+ right-width="{{ 65 }}"
90
+ left-width="{{ 65 }}"
91
+ name="示例"
92
+ bind:open="onOpen"
93
+ >
94
+ <view slot="left" class="smart-swipe-cell__left">选择</view>
95
+ <smart-cell-group>
96
+ <smart-cell title="单元格" value="内容" />
97
+ </smart-cell-group>
98
+ <view slot="right" class="smart-swipe-cell__right">删除</view>
99
+ </smart-swipe-cell>
100
+ ```
101
+
102
+ ```js
103
+ import ToastInstance from '@tuya-miniapp/smart-ui/dist/toast/toast';
104
+
105
+ Page({
106
+ onOpen(event) {
107
+ const { position, name } = event.detail;
108
+ switch (position) {
109
+ case 'left':
110
+ ToastInstance({
111
+ context: this,
112
+ type: 'primary',
113
+ message: `${name}${position}部分展示open事件被触发`,
114
+ });
115
+ break;
116
+ case 'right':
117
+ ToastInstance({
118
+ context: this,
119
+ type: 'primary',
120
+ message: `${name}${position}部分展示open事件被触发`,
121
+ });
122
+ break;
123
+ }
124
+ },
125
+ });
126
+ ```
127
+
128
+ ## API
129
+
130
+ ### Props
131
+
132
+ | 参数 | 说明 | 类型 | 默认值 |
133
+ | ----------- | --------------------------------------- | ------------------ | ------- |
134
+ | async-close | 是否异步关闭 | _boolean_ | `false` |
135
+ | disabled | 是否禁用滑动 | _boolean_ | `false` |
136
+ | left-width | 左侧滑动区域宽度 | _number_ | `0` |
137
+ | name | 标识符,可以在 close 事件的参数中获取到 | _string \| number_ | - |
138
+ | right-width | 右侧滑动区域宽度 | _number_ | `0` |
139
+
140
+ ### Slot
141
+
142
+ | 名称 | 说明 |
143
+ | ----- | -------------- |
144
+ | - | 自定义显示内容 |
145
+ | left | 左侧滑动内容 |
146
+ | right | 右侧滑动内容 |
147
+
148
+ ### Events
149
+
150
+ | 事件名 | 说明 | 参数 |
151
+ | ---------- | ---------- | --------------------------------------------------------- |
152
+ | bind:click | 点击时触发 | 关闭时的点击位置 (`left` `right` `cell` `outside`) |
153
+ | bind:tabClose `v2.7.0` | 关闭时触发 | 关闭的位置 (`left` `right`) |
154
+ | bind:close | 点击异步关闭时触发 | { position: 'left' \| 'right' , instance , name: string } |
155
+ | bind:open | 打开时触发 | { position: 'left' \| 'right' , name: string } |
156
+
157
+ ### close 参数
158
+
159
+ | 参数 | 类型 | 说明 |
160
+ | -------- | -------- | -------------------------------------------------- |
161
+ | instance | _object_ | SwipeCell 实例 |
162
+ | name | 标识符 | _string_ |
163
+ | position | _string_ | 关闭时的点击位置 (`left` `right` `cell` `outside`) |
164
+
165
+ ### 方法
166
+
167
+ 通过 [selectComponent](/material/smartui?comId=faq&appType=miniapp) 可以获取到 SwipeCell 实例并调用实例方法
168
+
169
+ | 方法名 | 参数 | 返回值 | 介绍 |
170
+ | ------ | ------------------------- | ------ | ---------------- |
171
+ | close | - | - | 收起单元格侧边栏 |
172
+ | open | position: `left \| right` | - | 打开单元格侧边栏 |
@@ -0,0 +1,204 @@
1
+ ---
2
+ category: 反馈
3
+ ---
4
+
5
+ # Switch 开关
6
+
7
+ ### 介绍
8
+
9
+ 用于在打开和关闭状态之间进行切换。
10
+
11
+ ### 引入
12
+
13
+ 在`app.json`或`index.json`中引入组件,详细介绍见[快速上手](/material/smartui?comId=help-getting-started&appType=miniapp)。
14
+
15
+ ```json
16
+ "usingComponents": {
17
+ "smart-switch": "@tuya-miniapp/smart-ui/lib/switch/index"
18
+ }
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础用法
24
+
25
+ ```html
26
+ <smart-switch checked="{{ checked }}" bind:change="onChange" />
27
+ <smart-switch checked="{{ !checked }}" bind:change="onChange" />
28
+ ```
29
+
30
+ ```javascript
31
+ Page({
32
+ data: {
33
+ checked: true,
34
+ },
35
+
36
+ onChange({ detail }) {
37
+ // 需要手动对 checked 状态进行更新
38
+ this.setData({ checked: detail });
39
+ },
40
+ });
41
+ ```
42
+
43
+
44
+ ### 开关文案 `v2.7.0`
45
+
46
+ ```html
47
+ <smart-switch
48
+ active-text="开"
49
+ inactive-text="关"
50
+ />
51
+ <view style="--switch-label-font-size: 10px;">
52
+ <smart-switch
53
+ active-text="显示"
54
+ inactive-text="隐藏"
55
+ />
56
+ </view>
57
+ ```
58
+
59
+ ### 禁用状态
60
+
61
+ ```html
62
+ <smart-switch checked="{{ checked }}" disabled />
63
+ ```
64
+
65
+ ### 加载中
66
+
67
+ ```html
68
+ <smart-switch checked="{{ checked }}" loading />
69
+ ```
70
+
71
+ ### 自定义大小
72
+
73
+ `size` 属性可以设置组件的大小。
74
+
75
+ ```html
76
+ <smart-switch checked="{{ checked }}" size="24px" />
77
+ ```
78
+
79
+ ### 自定义颜色
80
+
81
+ 设置 `active-color` 可以设置选择后的颜色,`inactive-color` 可以设置非选择后的颜色
82
+
83
+ ```html
84
+ <smart-switch
85
+ checked="{{ checked }}"
86
+ active-color="#07c160"
87
+ inactive-color="#ee0a24"
88
+ />
89
+ ```
90
+
91
+ ### 渐变色 `v2.5.0`
92
+
93
+ 所有 CSS background 可以实现的属性, `active-color` 和 `inactive-color` 都可以实现
94
+
95
+ ```html
96
+ <smart-switch
97
+ checked="{{ checked }}"
98
+ active-color="linear-gradient(to right, #ff7e5f, #987AFF)"
99
+ inactive-color="linear-gradient(to right, #407e5f, #841AFF)"
100
+ />
101
+ ```
102
+
103
+ ### 异步控制
104
+
105
+ ```html
106
+ <smart-switch checked="{{ checked }}" bind:change="onChange" />
107
+ ```
108
+
109
+ ```js
110
+ Page({
111
+ data: {
112
+ checked: true,
113
+ },
114
+
115
+ onChange({ detail }) {
116
+ ty.showModal({
117
+ title: '提示',
118
+ content: '是否切换开关?',
119
+ success: (res) => {
120
+ if (res.confirm) {
121
+ this.setData({ checked2: detail });
122
+ }
123
+ },
124
+ });
125
+ },
126
+ });
127
+ ```
128
+
129
+ ### 阻止冒泡
130
+
131
+ `stop-click-propagation` 属性可以阻止冒泡。
132
+
133
+ ```html
134
+ <smart-switch checked="{{ checked }}" stop-click-propagation bind:change="onChange" />
135
+ ```
136
+
137
+ ### 列表使用
138
+
139
+ ```html
140
+ <smart-cell-group>
141
+ <smart-cell title="标题">
142
+ <smart-switch
143
+ checked="{{ checked }}"
144
+ bind:change="onChange"
145
+ />
146
+ </smart-cell>
147
+ </smart-cell-group>
148
+ ```
149
+
150
+ ## API
151
+
152
+ ### Props
153
+
154
+ | 参数 | 说明 | 类型 | 默认值 |
155
+ | ------------------------------- | ---------------------- | --------- | --------- |
156
+ | active-color | 打开时的背景色 | _string_ | `#1989fa` |
157
+ | active-value | 打开时的值 | _any_ | `true` |
158
+ | checked | 开关选中状态 | _any_ | `false` |
159
+ | disabled | 是否为禁用状态 | _boolean_ | `false` |
160
+ | inactive-color | 关闭时的背景色 | _string_ | `#fff` |
161
+ | inactive-value | 关闭时的值 | _any_ | `false` |
162
+ | loading | 是否为加载状态 | _boolean_ | `false` |
163
+ | name | 在表单内提交时的标识符 | _string_ | - |
164
+ | size | 开关尺寸 | _string_ | `30px` |
165
+ | stop-click-propagation `v1.0.2` | 是否阻止冒泡 | _boolean_ | `false` |
166
+ | active-text `v2.7.0` | 打开时的文案 | _string_ | - |
167
+ | inactive-text `v2.7.0` | 关闭时的文案 | _string_ | - |
168
+
169
+ ### Events
170
+
171
+ | 事件名 | 说明 | 参数 |
172
+ | ----------- | ---------------- | -------------------------- |
173
+ | bind:change | 开关状态切换回调 | event.detail: 是否选中开关 |
174
+
175
+ ### 外部样式类
176
+
177
+ | 类名 | 说明 |
178
+ | ------------ | ------------ |
179
+ | custom-class | 根节点样式类 |
180
+ | node-class | 圆点样式类 |
181
+
182
+ ### 样式变量
183
+
184
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider&appType=miniapp)。
185
+
186
+ | 名称 | 默认值 | 描述 |
187
+ | ----------------------------- | -------------------------------------- | ---- |
188
+ | --switch-width | _1.5338em_ | 开关宽度 |
189
+ | --switch-height | _0.867em_ | 开关高度 |
190
+ | --switch-node-size | _0.867em_ | 开关节点大小 |
191
+ | --switch-node-z-index | _1_ | 开关节点层级 |
192
+ | --switch-node-background-color | _#fff_ | - |
193
+ | --switch-node-box-shadow | _0 3px 1px 0 rgba(0, 0, 0, 0.05),_ | 开关节点阴影 |
194
+ | --switch-background-color | _var(--app-B4-N6, rgba(0, 0, 0, 0.2))_ | 开关背景颜色 |
195
+ | --switch-on-background-color | _#1989fa_ | 开关开启时背景颜色 |
196
+ | --switch-transition-duration | _0.3s_ | 开关过渡持续时间 |
197
+ | --switch-disabled-opacity | _0.4_ | 开关禁用时不透明度 |
198
+ | --switch-border `@deprecated v2.5.0` | _0.08em solid rgba(0, 0, 0, 0.1)_ | 开关边框 |
199
+ | --switch-node-on-background-color `v2.4.0` | _var(--switch-node-background-color, #fff)_ | 开启时圆球的背景色 |
200
+ | --switch-padding `v2.5.0` | _0.08em_ | 内部边距 |
201
+ | --switch-label-width `v2.7.0` | _2em_ | 文本开关时的默认宽度 |
202
+ | --switch-label-font-size `v2.7.0` | _12px_ | 文字大小 |
203
+ | --switch-label-active-color `v2.7.0` | _var(--app-B3, #ffffff)_ `v2.7.0` _#FFFFFF_ `v2.8.0` | 开时文字颜色 |
204
+ | --switch-label-inactive-color `v2.7.0` | _var(--app-B3, #ffffff)_ `v2.7.0` _#FFFFFF_ `v2.8.0` | 关时文字颜色 |