hy-app 0.2.13 → 0.2.15

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 (223) hide show
  1. package/components/hy-action-sheet/hy-action-sheet.vue +81 -13
  2. package/components/hy-action-sheet/typing.d.ts +1 -3
  3. package/components/hy-address-picker/hy-address-picker.vue +109 -8
  4. package/components/hy-address-picker/index.scss +2 -2
  5. package/components/hy-address-picker/typing.d.ts +39 -30
  6. package/components/hy-avatar/hy-avatar.vue +78 -4
  7. package/components/hy-avatar/typing.d.ts +21 -16
  8. package/components/hy-back-top/hy-back-top.vue +86 -28
  9. package/components/hy-back-top/typing.d.ts +17 -12
  10. package/components/hy-badge/hy-badge.vue +114 -43
  11. package/components/hy-badge/typing.d.ts +20 -15
  12. package/components/hy-button/HyButton.docgen.js +6 -0
  13. package/components/hy-button/hy-button.vue +70 -77
  14. package/components/hy-button/props.ts +40 -41
  15. package/components/hy-calendar/hy-calendar.vue +290 -143
  16. package/components/hy-calendar/typing.d.ts +38 -31
  17. package/components/hy-card/hy-card.vue +139 -36
  18. package/components/hy-card/typing.d.ts +39 -28
  19. package/components/hy-cell/hy-cell.vue +131 -67
  20. package/components/hy-cell/typing.d.ts +6 -1
  21. package/components/hy-check-button/hy-check-button.vue +101 -32
  22. package/components/hy-check-button/typing.d.ts +26 -19
  23. package/components/hy-checkbox/hy-checkbox.vue +167 -78
  24. package/components/hy-checkbox/typing.d.ts +26 -19
  25. package/components/hy-code-input/hy-code-input.vue +101 -5
  26. package/components/hy-code-input/typing.d.ts +9 -0
  27. package/components/hy-config-provider/hy-config-provider.vue +44 -24
  28. package/components/hy-config-provider/typing.d.ts +0 -4
  29. package/components/hy-count-down/hy-count-down.vue +99 -62
  30. package/components/hy-count-down/typing.d.ts +18 -5
  31. package/components/hy-count-to/hy-count-to.vue +165 -113
  32. package/components/hy-count-to/typing.d.ts +15 -11
  33. package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
  34. package/components/hy-datetime-picker/typing.d.ts +49 -39
  35. package/components/hy-divider/hy-divider.vue +128 -64
  36. package/components/hy-divider/typing.d.ts +16 -16
  37. package/components/hy-dropdown/hy-dropdown.vue +57 -19
  38. package/components/hy-dropdown/typing.d.ts +14 -14
  39. package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
  40. package/components/hy-dropdown-item/typing.d.ts +13 -6
  41. package/components/hy-empty/hy-empty.vue +64 -6
  42. package/components/hy-empty/typing.d.ts +5 -0
  43. package/components/hy-float-button/hy-float-button.vue +117 -5
  44. package/components/hy-float-button/typing.d.ts +7 -0
  45. package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
  46. package/components/hy-folding-panel/typing.d.ts +24 -15
  47. package/components/hy-grid/hy-grid.vue +95 -35
  48. package/components/hy-grid/typing.d.ts +24 -19
  49. package/components/hy-icon/hy-icon.vue +84 -6
  50. package/components/hy-icon/typing.d.ts +5 -0
  51. package/components/hy-image/hy-image.vue +105 -6
  52. package/components/hy-image/typing.d.ts +9 -0
  53. package/components/hy-input/hy-input.vue +277 -130
  54. package/components/hy-input/props.ts +13 -14
  55. package/components/hy-input/typing.d.ts +59 -38
  56. package/components/hy-line/hy-line.vue +65 -25
  57. package/components/hy-line-progress/hy-line-progress.vue +68 -35
  58. package/components/hy-list/hy-list.vue +127 -61
  59. package/components/hy-list/typing.d.ts +19 -12
  60. package/components/hy-loading/hy-loading.vue +79 -25
  61. package/components/hy-menu/hy-menu.vue +69 -45
  62. package/components/hy-menu/typing.d.ts +22 -15
  63. package/components/hy-modal/hy-modal.vue +91 -4
  64. package/components/hy-modal/typing.d.ts +11 -0
  65. package/components/hy-navbar/hy-navbar.vue +105 -25
  66. package/components/hy-navbar/typing.d.ts +25 -20
  67. package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
  68. package/components/hy-notice-bar/typing.d.ts +22 -17
  69. package/components/hy-notify/hy-notify.vue +106 -54
  70. package/components/hy-number-step/hy-number-step.vue +211 -120
  71. package/components/hy-number-step/typing.d.ts +45 -28
  72. package/components/hy-overlay/hy-overlay.vue +60 -16
  73. package/components/hy-overlay/typing.d.ts +11 -6
  74. package/components/hy-pagination/hy-pagination.vue +94 -37
  75. package/components/hy-pagination/typing.d.ts +20 -11
  76. package/components/hy-picker/hy-picker.vue +225 -160
  77. package/components/hy-picker/typing.d.ts +51 -28
  78. package/components/hy-popover/hy-popover.vue +55 -7
  79. package/components/hy-popover/typing.d.ts +21 -1
  80. package/components/hy-popup/hy-popup.vue +164 -99
  81. package/components/hy-popup/typing.d.ts +11 -0
  82. package/components/hy-price/hy-price.vue +77 -30
  83. package/components/hy-price/typing.d.ts +10 -10
  84. package/components/hy-qrcode/hy-qrcode.vue +75 -5
  85. package/components/hy-qrcode/typing.d.ts +25 -16
  86. package/components/hy-radio/hy-radio.vue +169 -88
  87. package/components/hy-radio/typing.d.ts +29 -22
  88. package/components/hy-rate/hy-rate.vue +155 -104
  89. package/components/hy-rate/typing.d.ts +23 -16
  90. package/components/hy-read-more/hy-read-more.vue +83 -56
  91. package/components/hy-read-more/typing.d.ts +18 -11
  92. package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
  93. package/components/hy-scroll-list/typing.d.ts +14 -7
  94. package/components/hy-search/hy-search.vue +168 -62
  95. package/components/hy-search/typing.d.ts +47 -26
  96. package/components/hy-signature/hy-signature.vue +354 -272
  97. package/components/hy-signature/typing.d.ts +65 -52
  98. package/components/hy-slider/hy-slider.vue +208 -160
  99. package/components/hy-slider/typing.d.ts +28 -17
  100. package/components/hy-steps/hy-steps.vue +125 -99
  101. package/components/hy-steps/typing.d.ts +21 -14
  102. package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
  103. package/components/hy-submit-bar/typing.d.ts +30 -23
  104. package/components/hy-subsection/hy-subsection.vue +139 -96
  105. package/components/hy-subsection/typing.d.ts +23 -16
  106. package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
  107. package/components/hy-swipe-action/typing.d.ts +26 -17
  108. package/components/hy-swiper/hy-swiper.vue +178 -73
  109. package/components/hy-swiper/typing.d.ts +37 -28
  110. package/components/hy-switch/hy-switch.vue +107 -60
  111. package/components/hy-switch/typing.d.ts +25 -18
  112. package/components/hy-tabs/hy-tabs.vue +170 -160
  113. package/components/hy-tabs/typing.d.ts +36 -22
  114. package/components/hy-tag/hy-tag.vue +133 -58
  115. package/components/hy-tag/typing.d.ts +26 -18
  116. package/components/hy-text/hy-text.vue +106 -6
  117. package/components/hy-text/typing.d.ts +31 -26
  118. package/components/hy-textarea/hy-textarea.vue +183 -89
  119. package/components/hy-textarea/typing.d.ts +41 -24
  120. package/components/hy-tooltip/hy-tooltip.vue +145 -101
  121. package/components/hy-tooltip/typing.d.ts +18 -13
  122. package/components/hy-transition/hy-transition.vue +48 -13
  123. package/components/hy-transition/typing.d.ts +17 -0
  124. package/components/hy-upload/hy-upload.vue +113 -148
  125. package/components/hy-upload/typing.d.ts +71 -71
  126. package/components/hy-warn/hy-warn.vue +79 -36
  127. package/components/hy-warn/typing.d.ts +18 -11
  128. package/components/hy-waterfall/hy-waterfall.vue +90 -77
  129. package/components/hy-watermark/hy-watermark.vue +82 -5
  130. package/components/hy-watermark/typing.d.ts +20 -20
  131. package/global.d.ts +39 -59
  132. package/package.json +5 -13
  133. package/utils/inspect.ts +3 -1
  134. package/web-types.json +1 -1
  135. package/component-helper.ts +0 -177
  136. package/components.json +0 -3287
  137. package/dist/attributes.json +0 -1
  138. package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
  139. package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
  140. package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
  141. package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
  142. package/dist/docs/components/hy-badge/hy-badge.md +0 -13
  143. package/dist/docs/components/hy-button/hy-button.md +0 -61
  144. package/dist/docs/components/hy-calendar/header.md +0 -17
  145. package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
  146. package/dist/docs/components/hy-calendar/month.md +0 -38
  147. package/dist/docs/components/hy-card/hy-card.md +0 -24
  148. package/dist/docs/components/hy-cell/hy-cell.md +0 -26
  149. package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
  150. package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
  151. package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
  152. package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
  153. package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
  154. package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
  155. package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
  156. package/dist/docs/components/hy-divider/hy-divider.md +0 -13
  157. package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
  158. package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
  159. package/dist/docs/components/hy-empty/hy-empty.md +0 -20
  160. package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
  161. package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
  162. package/dist/docs/components/hy-form/hy-form.md +0 -29
  163. package/dist/docs/components/hy-grid/hy-grid.md +0 -19
  164. package/dist/docs/components/hy-icon/hy-icon.md +0 -13
  165. package/dist/docs/components/hy-image/hy-image.md +0 -22
  166. package/dist/docs/components/hy-input/hy-input.md +0 -29
  167. package/dist/docs/components/hy-line/hy-line.md +0 -7
  168. package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
  169. package/dist/docs/components/hy-list/hy-list.md +0 -25
  170. package/dist/docs/components/hy-loading/hy-loading.md +0 -14
  171. package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
  172. package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
  173. package/dist/docs/components/hy-login/hy-login.md +0 -14
  174. package/dist/docs/components/hy-menu/hy-menu.md +0 -21
  175. package/dist/docs/components/hy-modal/hy-modal.md +0 -23
  176. package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
  177. package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
  178. package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
  179. package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
  180. package/dist/docs/components/hy-notify/hy-notify.md +0 -23
  181. package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
  182. package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
  183. package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
  184. package/dist/docs/components/hy-parse/hy-parse.md +0 -46
  185. package/dist/docs/components/hy-parse/node/node.md +0 -7
  186. package/dist/docs/components/hy-picker/hy-picker.md +0 -32
  187. package/dist/docs/components/hy-popover/hy-popover.md +0 -34
  188. package/dist/docs/components/hy-popup/hy-popup.md +0 -22
  189. package/dist/docs/components/hy-price/hy-price.md +0 -13
  190. package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
  191. package/dist/docs/components/hy-radio/hy-radio.md +0 -21
  192. package/dist/docs/components/hy-rate/hy-rate.md +0 -14
  193. package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
  194. package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
  195. package/dist/docs/components/hy-search/hy-search.md +0 -27
  196. package/dist/docs/components/hy-signature/hy-signature.md +0 -45
  197. package/dist/docs/components/hy-slider/hy-slider.md +0 -24
  198. package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
  199. package/dist/docs/components/hy-steps/hy-steps.md +0 -23
  200. package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
  201. package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
  202. package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
  203. package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
  204. package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
  205. package/dist/docs/components/hy-switch/hy-switch.md +0 -20
  206. package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
  207. package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
  208. package/dist/docs/components/hy-tag/hy-tag.md +0 -21
  209. package/dist/docs/components/hy-text/hy-text.md +0 -13
  210. package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
  211. package/dist/docs/components/hy-toast/hy-toast.md +0 -17
  212. package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
  213. package/dist/docs/components/hy-transition/hy-transition.md +0 -25
  214. package/dist/docs/components/hy-upload/hy-upload.md +0 -25
  215. package/dist/docs/components/hy-warn/hy-warn.md +0 -14
  216. package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
  217. package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
  218. package/dist/docs/components/message/TheMessage.md +0 -17
  219. package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
  220. package/dist/tags.json +0 -1
  221. package/dist/web-types.json +0 -1
  222. package/docgen.config.js +0 -14
  223. package/web-types.config.js +0 -7
@@ -1,7 +1,3 @@
1
- <!--
2
- @component hy-button 按钮组件
3
- @description 用于页面中的操作按钮,支持多种状态和样式
4
- -->
5
1
  <template>
6
2
  <!-- #ifndef APP-NVUE -->
7
3
  <button
@@ -68,8 +64,8 @@
68
64
  !disabled && !loading && !color && (plain || type === 'info')
69
65
  ? 'hy-button--active--plain'
70
66
  : !disabled && !loading && !plain
71
- ? 'hy-button--active'
72
- : ''
67
+ ? 'hy-button--active'
68
+ : ''
73
69
  "
74
70
  @click="clickHandler"
75
71
  :class="bemClass"
@@ -120,11 +116,10 @@
120
116
 
121
117
  <script lang="ts">
122
118
  /**
123
- * 从底部弹出的动作菜单面板组件
124
- *
125
- * @displayName HyButton 动作面板
126
- * @version 1.0.0
119
+ * 该组件内部实现以uni-app的基础button组件为基础,进行二次封装
120
+ * @displayName hy-button
127
121
  */
122
+ defineOptions({})
128
123
  export default {
129
124
  name: 'hy-button',
130
125
  options: {
@@ -136,144 +131,142 @@ export default {
136
131
  </script>
137
132
 
138
133
  <script setup lang="ts">
139
- import { computed, type CSSProperties, toRefs } from 'vue'
134
+ import { computed, toRefs } from 'vue'
135
+ import type { CSSProperties, PropType } from 'vue'
140
136
  import { bem, throttle } from '../../utils'
141
- import defaultProps from './props'
142
137
  import { ColorConfig } from '../../config'
143
- import type { HyButtonProps, IButtonEmits } from './typing.d.ts'
138
+ import type { IButtonEmits } from './typing.d.ts'
139
+ import type HyIconProps from '../hy-icon/typing'
144
140
 
145
141
  // 组件
146
142
  import HyIcon from '../hy-icon/hy-icon.vue'
147
143
  import HyLoading from '../hy-loading/hy-loading.vue'
148
- import { HyApp } from 'hy-app/typing/modules/common'
149
144
 
150
- type MessageType = 'info' | 'primary' | 'error' | 'warning' | 'success'
151
- // const props = withDefaults(defineProps<{ type: MessageType }>(), { type: 'error' })
145
+ // const props = withDefaults(defineProps<HyButtonProps>(), param)
152
146
  const props = defineProps({
147
+ /** 是否显示按钮的细边框 */
153
148
  hairline: {
154
149
  type: Boolean,
155
150
  default: false,
156
151
  },
152
+ /**
153
+ * 按钮的预置样式
154
+ * @values info,primary,error,warning,success
155
+ * */
157
156
  type: {
158
157
  type: String,
159
158
  default: 'primary',
160
- validator: (v) => ['info', 'primary', 'error', 'warning', 'success'].includes(v),
161
159
  },
160
+ /**
161
+ * 按钮尺寸
162
+ * @values large,medium,small,mini
163
+ * */
162
164
  size: {
163
165
  type: String,
164
166
  default: 'medium',
165
- validator: (v) => ['large', 'medium', 'small', 'mini'].includes(v),
166
167
  },
168
+ /**
169
+ * 按钮形状
170
+ * @values circle,square
171
+ * */
167
172
  shape: {
168
173
  type: String,
169
174
  default: 'square',
170
- validator: (v) => ['circle', 'square'].includes(v),
171
175
  },
176
+ /** 按钮是否镂空,背景色透明 */
172
177
  plain: {
173
178
  type: Boolean,
174
179
  default: false,
175
180
  },
181
+ /** 是否禁用 */
176
182
  disabled: {
177
183
  type: Boolean,
178
184
  default: false,
179
185
  },
186
+ /** 按钮名称前是否带 loading 图标 */
180
187
  loading: {
181
188
  type: Boolean,
182
189
  default: false,
183
190
  },
184
- loadingText: {
185
- type: String,
186
- default: '',
187
- },
191
+ /** 加载中提示文字 */
192
+ loadingText: String,
193
+ /**
194
+ * 加载状态图标类型
195
+ * @values spinner,circle,semicircle
196
+ * */
188
197
  loadingMode: {
189
198
  type: String,
190
199
  default: 'spinner',
191
- validator: (v) => ['spinner', 'circle', 'semicircle'].includes(v),
192
200
  },
201
+ /** 加载图标大小 */
193
202
  loadingSize: {
194
- type: Number,
203
+ type: [Number, String],
195
204
  default: 13,
196
205
  },
197
- openType: {
198
- type: String,
199
- default: '',
200
- },
201
- formType: {
202
- type: String,
203
- default: '',
204
- },
205
- appParameter: {
206
- type: String,
207
- default: '',
208
- },
206
+ /** 开放能力,具体请看uniapp稳定关于button组件部分说明 */
207
+ openType: String,
208
+ /** 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 */
209
+ formType: String,
210
+ /** 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效) */
211
+ appParameter: String,
212
+ /** 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效 */
209
213
  hoverStopPropagation: {
210
214
  type: Boolean,
211
215
  default: true,
212
216
  },
217
+ /**
218
+ * 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en )
219
+ * @values zh_CN,zh_TW,en
220
+ * */
213
221
  lang: {
214
222
  type: String,
215
223
  default: 'en',
216
224
  },
217
- sessionFrom: {
218
- type: String,
219
- default: '',
220
- },
221
- sendMessageTitle: {
222
- type: String,
223
- default: '',
224
- },
225
- sendMessagePath: {
226
- type: String,
227
- default: '',
228
- },
229
- sendMessageImg: {
230
- type: String,
231
- default: '',
232
- },
225
+ /** 会话来源,openType="contact"时有效 */
226
+ sessionFrom: String,
227
+ /** 会话内消息卡片标题,openType="contact"时有效 */
228
+ sendMessageTitle: String,
229
+ /** 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 */
230
+ sendMessagePath: String,
231
+ /** 会话内消息卡片图片,openType="contact"时有效 */
232
+ sendMessageImg: String,
233
+ /** 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效 */
233
234
  showMessageCard: {
234
235
  type: Boolean,
235
236
  default: false,
236
237
  },
237
- dataName: {
238
- type: String,
239
- default: '',
240
- },
238
+ /** 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 */
239
+ dataName: String,
240
+ /** 节流时间,一定时间内只能触发一次 */
241
241
  throttleTime: {
242
242
  type: Number,
243
243
  default: 0,
244
244
  },
245
+ /** 按住后多久出现点击态,单位毫秒 */
245
246
  hoverStartTime: {
246
247
  type: Number,
247
248
  default: 0,
248
249
  },
250
+ /** 手指松开后点击态保留时间,单位毫秒 */
249
251
  hoverStayTime: {
250
252
  type: Number,
251
253
  default: 200,
252
254
  },
253
- text: {
254
- type: String,
255
- default: '',
256
- },
257
- icon: {
258
- type: Object,
259
- default: () => ({}),
260
- },
261
- color: {
262
- type: String,
263
- default: '',
264
- },
255
+ /** 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式) */
256
+ text: String,
257
+ /** 按钮图标api集合 */
258
+ icon: Object as PropType<HyIconProps>,
259
+ /** 按钮颜色,支持传入linear-gradient渐变色 */
260
+ color: String,
261
+ /** 阻止事件冒泡 */
265
262
  stop: {
266
263
  type: Boolean,
267
264
  default: true,
268
265
  },
269
- /**阻止事件冒泡*/
270
- customStyle: {
271
- type: CSSProperties,
272
- },
273
- /**阻止事件冒泡*/
274
- customClass: {
275
- type: String,
276
- },
266
+ /** 定义需要用到的外部样式 */
267
+ customStyle: Object as unknown as PropType<CSSProperties>,
268
+ /** 自定义外部类名 */
269
+ customClass: String,
277
270
  })
278
271
  const { disabled, loading, throttleTime, stop, size, type, plain, color, icon } = toRefs(props)
279
272
  const emit = defineEmits<IButtonEmits>()
@@ -1,160 +1,159 @@
1
1
  import type { HyButtonProps } from './typing'
2
2
  import { HyApp } from 'hy-app/typing/modules/common'
3
- import type { CSSProperties } from 'vue'
3
+ import type { CSSProperties, PropType } from 'vue'
4
+ import HyIconProps from '@/package/components/hy-icon/typing'
4
5
 
5
- const defaultProps = {
6
- /**是否显示按钮的细边框*/
6
+ export const defaultProps = {
7
+ /** 是否显示按钮的细边框 */
7
8
  hairline: {
8
9
  type: Boolean,
9
10
  default: false,
10
11
  },
11
- /**按钮的预置样式*/
12
+ /** 按钮的预置样式 */
12
13
  type: {
13
- type: String,
14
+ type: String as PropType<HyApp.ThemeType>,
14
15
  default: 'primary',
15
16
  validator: (v) => ['info', 'primary', 'error', 'warning', 'success'].includes(v),
16
17
  },
17
- /**按钮尺寸*/
18
+ /** 按钮尺寸 */
18
19
  size: {
19
- type: String,
20
+ type: String as PropType<HyApp.SizeType | 'mini'>,
20
21
  default: 'medium',
21
22
  validator: (v) => ['large', 'medium', 'small', 'mini'].includes(v),
22
23
  },
23
- /**按钮形状*/
24
+ /** 按钮形状 */
24
25
  shape: {
25
- type: String,
26
+ type: String as PropType<HyApp.ShapeType>,
26
27
  default: 'square',
27
28
  validator: (v) => ['circle', 'square'].includes(v),
28
29
  },
29
- /**按钮是否镂空,背景色透明 */
30
+ /** 按钮是否镂空,背景色透明 */
30
31
  plain: {
31
32
  type: Boolean,
32
33
  default: false,
33
34
  },
34
- /**是否禁用*/
35
+ /** 是否禁用 */
35
36
  disabled: {
36
37
  type: Boolean,
37
38
  default: false,
38
39
  },
39
- /**按钮名称前是否带 loading 图标*/
40
+ /** 按钮名称前是否带 loading 图标 */
40
41
  loading: {
41
42
  type: Boolean,
42
43
  default: false,
43
44
  },
44
- /**加载中提示文字*/
45
+ /** 加载中提示文字 */
45
46
  loadingText: {
46
47
  type: String,
47
48
  default: '',
48
49
  },
49
- /**加载状态图标类型*/
50
+ /** 加载状态图标类型 */
50
51
  loadingMode: {
51
- type: String,
52
+ type: String as PropType<HyApp.LoadingMode>,
52
53
  default: 'spinner',
53
54
  validator: (v) => ['spinner', 'circle', 'semicircle'].includes(v),
54
55
  },
55
- /**加载图标大小*/
56
+ /** 加载图标大小 */
56
57
  loadingSize: {
57
58
  type: Number,
58
59
  default: 13,
59
60
  },
60
- /**开放能力,具体请看uniapp稳定关于button组件部分说明*/
61
+ /** 开放能力,具体请看uniapp稳定关于button组件部分说明 */
61
62
  openType: {
62
63
  type: String,
63
64
  default: '',
64
65
  },
65
- /**用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件*/
66
+ /** 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 */
66
67
  formType: {
67
68
  type: String,
68
69
  default: '',
69
70
  },
70
- /**打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效)*/
71
+ /** 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效) */
71
72
  appParameter: {
72
73
  type: String,
73
74
  default: '',
74
75
  },
75
- /**指定是否阻止本节点的祖先节点出现点击态,微信小程序有效*/
76
+ /** 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效 */
76
77
  hoverStopPropagation: {
77
78
  type: Boolean,
78
79
  default: true,
79
80
  },
80
- /**指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en )*/
81
+ /** 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en ) */
81
82
  lang: {
82
83
  type: String,
83
84
  default: 'en',
84
85
  },
85
- /**会话来源,openType="contact"时有效*/
86
+ /** 会话来源,openType="contact"时有效 */
86
87
  sessionFrom: {
87
88
  type: String,
88
89
  default: '',
89
90
  },
90
- /**会话内消息卡片标题,openType="contact"时有效*/
91
+ /** 会话内消息卡片标题,openType="contact"时有效 */
91
92
  sendMessageTitle: {
92
93
  type: String,
93
94
  default: '',
94
95
  },
95
- /**会话内消息卡片点击跳转小程序路径,openType="contact"时有效*/
96
+ /** 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 */
96
97
  sendMessagePath: {
97
98
  type: String,
98
99
  default: '',
99
100
  },
100
- /**会话内消息卡片图片,openType="contact"时有效*/
101
+ /** 会话内消息卡片图片,openType="contact"时有效 */
101
102
  sendMessageImg: {
102
103
  type: String,
103
104
  default: '',
104
105
  },
105
- /**是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效*/
106
+ /** 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效 */
106
107
  showMessageCard: {
107
108
  type: Boolean,
108
109
  default: false,
109
110
  },
110
- /**额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取*/
111
+ /** 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 */
111
112
  dataName: {
112
113
  type: String,
113
114
  default: '',
114
115
  },
115
- /**节流时间,一定时间内只能触发一次*/
116
+ /** 节流时间,一定时间内只能触发一次 */
116
117
  throttleTime: {
117
118
  type: Number,
118
119
  default: 0,
119
120
  },
120
- /**按住后多久出现点击态,单位毫秒*/
121
+ /** 按住后多久出现点击态,单位毫秒 */
121
122
  hoverStartTime: {
122
123
  type: Number,
123
124
  default: 0,
124
125
  },
125
- /**手指松开后点击态保留时间,单位毫秒*/
126
+ /** 手指松开后点击态保留时间,单位毫秒 */
126
127
  hoverStayTime: {
127
128
  type: Number,
128
129
  default: 200,
129
130
  },
130
- /**按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式)*/
131
+ /** 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式) */
131
132
  text: {
132
133
  type: String,
133
134
  default: '',
134
135
  },
135
- /**按钮图标api集合*/
136
+ /** 按钮图标api集合 */
136
137
  icon: {
137
- type: Object,
138
+ type: Object as PropType<HyIconProps>,
138
139
  default: () => ({}),
139
140
  },
140
- /**按钮颜色,支持传入linear-gradient渐变色*/
141
+ /** 按钮颜色,支持传入linear-gradient渐变色 */
141
142
  color: {
142
143
  type: String,
143
144
  default: '',
144
145
  },
145
- /**阻止事件冒泡*/
146
+ /** 阻止事件冒泡 */
146
147
  stop: {
147
148
  type: Boolean,
148
149
  default: true,
149
150
  },
150
- /**阻止事件冒泡*/
151
+ /** 阻止事件冒泡 */
151
152
  customStyle: {
152
- type: CSSProperties,
153
+ type: Object as PropType<CSSProperties>,
153
154
  },
154
- /**阻止事件冒泡*/
155
+ /** 阻止事件冒泡 */
155
156
  customClass: {
156
157
  type: String,
157
158
  },
158
- }
159
-
160
- export default defaultProps
159
+ } as const