hy-app 0.2.12 → 0.2.13

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 (110) hide show
  1. package/component-helper.ts +177 -0
  2. package/components/hy-button/hy-button.vue +141 -36
  3. package/components/hy-button/props.ts +155 -29
  4. package/components/hy-button/typing.d.ts +16 -10
  5. package/components/index.ts +114 -122
  6. package/components.json +3287 -0
  7. package/dist/attributes.json +1 -0
  8. package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +41 -0
  9. package/dist/docs/components/hy-address-picker/hy-address-picker.md +25 -0
  10. package/dist/docs/components/hy-avatar/hy-avatar.md +19 -0
  11. package/dist/docs/components/hy-back-top/hy-back-top.md +19 -0
  12. package/dist/docs/components/hy-badge/hy-badge.md +13 -0
  13. package/dist/docs/components/hy-button/hy-button.md +61 -0
  14. package/dist/docs/components/hy-calendar/header.md +17 -0
  15. package/dist/docs/components/hy-calendar/hy-calendar.md +27 -0
  16. package/dist/docs/components/hy-calendar/month.md +38 -0
  17. package/dist/docs/components/hy-card/hy-card.md +24 -0
  18. package/dist/docs/components/hy-cell/hy-cell.md +26 -0
  19. package/dist/docs/components/hy-check-button/hy-check-button.md +14 -0
  20. package/dist/docs/components/hy-checkbox/hy-checkbox.md +21 -0
  21. package/dist/docs/components/hy-code-input/hy-code-input.md +15 -0
  22. package/dist/docs/components/hy-config-provider/hy-config-provider.md +13 -0
  23. package/dist/docs/components/hy-count-down/hy-count-down.md +34 -0
  24. package/dist/docs/components/hy-count-to/hy-count-to.md +31 -0
  25. package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +25 -0
  26. package/dist/docs/components/hy-divider/hy-divider.md +13 -0
  27. package/dist/docs/components/hy-dropdown/hy-dropdown.md +13 -0
  28. package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +20 -0
  29. package/dist/docs/components/hy-empty/hy-empty.md +20 -0
  30. package/dist/docs/components/hy-float-button/hy-float-button.md +20 -0
  31. package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +24 -0
  32. package/dist/docs/components/hy-form/hy-form.md +29 -0
  33. package/dist/docs/components/hy-grid/hy-grid.md +19 -0
  34. package/dist/docs/components/hy-icon/hy-icon.md +13 -0
  35. package/dist/docs/components/hy-image/hy-image.md +22 -0
  36. package/dist/docs/components/hy-input/hy-input.md +29 -0
  37. package/dist/docs/components/hy-line/hy-line.md +7 -0
  38. package/dist/docs/components/hy-line-progress/hy-line-progress.md +13 -0
  39. package/dist/docs/components/hy-list/hy-list.md +25 -0
  40. package/dist/docs/components/hy-loading/hy-loading.md +14 -0
  41. package/dist/docs/components/hy-login/ThePhoneLogin.md +20 -0
  42. package/dist/docs/components/hy-login/TheUserLogin.md +44 -0
  43. package/dist/docs/components/hy-login/hy-login.md +14 -0
  44. package/dist/docs/components/hy-menu/hy-menu.md +21 -0
  45. package/dist/docs/components/hy-modal/hy-modal.md +23 -0
  46. package/dist/docs/components/hy-navbar/hy-navbar.md +22 -0
  47. package/dist/docs/components/hy-notice-bar/hy-column-notice.md +20 -0
  48. package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +14 -0
  49. package/dist/docs/components/hy-notice-bar/hy-row-notice.md +20 -0
  50. package/dist/docs/components/hy-notify/hy-notify.md +23 -0
  51. package/dist/docs/components/hy-number-step/hy-number-step.md +27 -0
  52. package/dist/docs/components/hy-overlay/hy-overlay.md +19 -0
  53. package/dist/docs/components/hy-pagination/hy-pagination.md +14 -0
  54. package/dist/docs/components/hy-parse/hy-parse.md +46 -0
  55. package/dist/docs/components/hy-parse/node/node.md +7 -0
  56. package/dist/docs/components/hy-picker/hy-picker.md +32 -0
  57. package/dist/docs/components/hy-popover/hy-popover.md +34 -0
  58. package/dist/docs/components/hy-popup/hy-popup.md +22 -0
  59. package/dist/docs/components/hy-price/hy-price.md +13 -0
  60. package/dist/docs/components/hy-qrcode/hy-qrcode.md +15 -0
  61. package/dist/docs/components/hy-radio/hy-radio.md +21 -0
  62. package/dist/docs/components/hy-rate/hy-rate.md +14 -0
  63. package/dist/docs/components/hy-read-more/hy-read-more.md +21 -0
  64. package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +21 -0
  65. package/dist/docs/components/hy-search/hy-search.md +27 -0
  66. package/dist/docs/components/hy-signature/hy-signature.md +45 -0
  67. package/dist/docs/components/hy-slider/hy-slider.md +24 -0
  68. package/dist/docs/components/hy-status-bar/hy-status-bar.md +13 -0
  69. package/dist/docs/components/hy-steps/hy-steps.md +23 -0
  70. package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +21 -0
  71. package/dist/docs/components/hy-subsection/hy-subsection.md +14 -0
  72. package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +29 -0
  73. package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +23 -0
  74. package/dist/docs/components/hy-swiper/hy-swiper.md +22 -0
  75. package/dist/docs/components/hy-switch/hy-switch.md +20 -0
  76. package/dist/docs/components/hy-tabBar/hy-tabBar.md +13 -0
  77. package/dist/docs/components/hy-tabs/hy-tabs.md +27 -0
  78. package/dist/docs/components/hy-tag/hy-tag.md +21 -0
  79. package/dist/docs/components/hy-text/hy-text.md +13 -0
  80. package/dist/docs/components/hy-textarea/hy-textarea.md +19 -0
  81. package/dist/docs/components/hy-toast/hy-toast.md +17 -0
  82. package/dist/docs/components/hy-tooltip/hy-tooltip.md +13 -0
  83. package/dist/docs/components/hy-transition/hy-transition.md +25 -0
  84. package/dist/docs/components/hy-upload/hy-upload.md +25 -0
  85. package/dist/docs/components/hy-warn/hy-warn.md +14 -0
  86. package/dist/docs/components/hy-waterfall/hy-waterfall.md +30 -0
  87. package/dist/docs/components/hy-watermark/hy-watermark.md +7 -0
  88. package/dist/docs/components/message/TheMessage.md +17 -0
  89. package/dist/docs/components/yk-dialog/yk-dialog.md +7 -0
  90. package/dist/tags.json +1 -0
  91. package/dist/web-types.json +1 -0
  92. package/docgen.config.js +14 -0
  93. package/package.json +10 -3
  94. package/web-types.config.js +5 -6
  95. package/web-types.json +1 -3117
  96. package/components/hy-safe-bottom/hy-safe-bottom.vue +0 -60
  97. package/components/hy-safe-bottom/index.scss +0 -5
  98. package/components/message/TheMessage.vue +0 -169
  99. package/components/message/index.ts +0 -54
  100. package/components/u-form/form.js +0 -22
  101. package/components/u-form/hy-form.vue +0 -324
  102. package/components/u-form/props.js +0 -49
  103. package/components/u-form/schema.js +0 -1451
  104. package/components/u-form/u-form.vue +0 -267
  105. package/components/u-form/utils.js +0 -65
  106. package/components/u-form-item/formItem.js +0 -24
  107. package/components/u-form-item/hy-form-item.vue +0 -360
  108. package/components/u-form-item/props.js +0 -57
  109. package/components/u-form-item/u-form-item.vue +0 -294
  110. package/shims-vue.d.ts +0 -0
@@ -0,0 +1,177 @@
1
+ import fg from 'fast-glob'
2
+ import { read, parse, vetur, webTypes, write, isString } from 'components-helper'
3
+ import type {
4
+ Config,
5
+ InstallOptions,
6
+ NormalizeData,
7
+ Options,
8
+ ParseData,
9
+ ParseTable,
10
+ } from 'components-helper'
11
+
12
+ const config: Config = {
13
+ tags: 'tags.json',
14
+ attributes: 'attributes.json',
15
+ webTypes: 'web-types.json',
16
+ titleRegExp: /#+\s+(.*)\n+([^(#|\n)]*)/g,
17
+ tableRegExp: /#+\s+(.*)\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g,
18
+ fileNameRegExp: /\/((\w|-)+)\.\w+$/,
19
+ separator: ',', // values截取
20
+ props: 'Props',
21
+ propsName: 'Prop name',
22
+ propsType: 'Type',
23
+ propsDescription: 'Description',
24
+ propsOptions: 'Values',
25
+ propsDefault: 'Default',
26
+ events: 'events',
27
+ eventsName: 'Event name',
28
+ eventsDescription: 'Description',
29
+ slots: 'slots',
30
+ slotsName: 'Name',
31
+ slotsDescription: 'Description',
32
+ slotsType: 'Type',
33
+ slotsSubtags: 'Subtags',
34
+ directives: 'directives',
35
+ directivesName: 'Name',
36
+ directivesType: 'Type',
37
+ directivesDescription: 'Description',
38
+ }
39
+
40
+ function normalize(options: Options, data: ParseData, path: string): NormalizeData {
41
+ const { fileNameRegExp, props, events, slots, directives } = options
42
+ const _fileNameRegExp = isString(fileNameRegExp) ? new RegExp(fileNameRegExp) : fileNameRegExp
43
+ const _path = path.match(_fileNameRegExp)
44
+ const fileName = _path ? _path[1] : ''
45
+ const _data: NormalizeData = Object.assign(data, { path, fileName })
46
+ const _props = new RegExp(props, 'i')
47
+ const _events = new RegExp(events, 'i')
48
+ const _slots = new RegExp(slots, 'i')
49
+ const _directives = new RegExp(directives, 'i')
50
+
51
+ if (!_data.table || !_data.table.length) return _data
52
+
53
+ for (let i = 0; i < _data.table.length; i++) {
54
+ const item = _data.table[i]
55
+ const title = item.title
56
+ if (!title) continue
57
+
58
+ if (_props.test(title)) {
59
+ setData({
60
+ data: _data,
61
+ item,
62
+ path,
63
+ fileName,
64
+ title,
65
+ key: 'props',
66
+ regExp: _props,
67
+ })
68
+ } else if (_events.test(title)) {
69
+ setData({
70
+ data: _data,
71
+ item,
72
+ path,
73
+ fileName,
74
+ title,
75
+ key: 'events',
76
+ regExp: _events,
77
+ })
78
+ } else if (_slots.test(title)) {
79
+ setData({
80
+ data: _data,
81
+ item,
82
+ path,
83
+ fileName,
84
+ title,
85
+ key: 'slots',
86
+ regExp: _slots,
87
+ })
88
+ } else if (_directives.test(title)) {
89
+ setData({
90
+ data: _data,
91
+ item,
92
+ path,
93
+ fileName,
94
+ title,
95
+ key: 'directives',
96
+ regExp: _directives,
97
+ })
98
+ }
99
+ }
100
+ return _data
101
+ }
102
+
103
+ function setData({
104
+ data,
105
+ key,
106
+ item,
107
+ title,
108
+ path,
109
+ fileName,
110
+ regExp,
111
+ }: {
112
+ data: NormalizeData
113
+ key: 'props' | 'events' | 'slots' | 'directives'
114
+ item: ParseTable
115
+ title: string
116
+ path: string
117
+ fileName: string
118
+ regExp: RegExp
119
+ }) {
120
+ const childTitle = title.replace(regExp, '').trim()
121
+
122
+ if (childTitle) {
123
+ const childHeader = data.headers?.find((item) => item.title === childTitle)
124
+ const childItem = {
125
+ path,
126
+ fileName,
127
+ title: childTitle,
128
+ description: childHeader?.description || data.description,
129
+ [key]: item,
130
+ }
131
+
132
+ if (!data.children) {
133
+ data.children = [childItem]
134
+ } else {
135
+ const child = data.children.find((item) => item.title === childTitle)
136
+
137
+ if (child) {
138
+ child[key] = item
139
+ } else {
140
+ data.children.push(childItem)
141
+ }
142
+ }
143
+ } else {
144
+ data[key] = item
145
+ }
146
+ }
147
+
148
+ export function generateWebTypes(options = {} as InstallOptions) {
149
+ if (!options.entry) throw new Error('entry must be a string (non empty) or an array of strings')
150
+ if (!options.outDir) throw new Error('outDir must be a string (non empty)')
151
+ if (!options.name) console.warn('missing property "name"')
152
+ if (!options.version) console.warn('missing property "version"')
153
+
154
+ const _options: Options = Object.assign(config, options)
155
+ const files: string[] = fg.sync(_options.entry, _options.fastGlobConfig)
156
+ const data = files.map((path) => {
157
+ const fileContent = read(path)
158
+ const parseContent = parse(_options, fileContent)
159
+ const content = normalize(_options, parseContent, path)
160
+ if (content.title === 'hy-button') console.log(JSON.stringify(content))
161
+ return content
162
+ })
163
+ const { tags, attributes } = vetur(_options, data)
164
+ const webTypesData = webTypes(_options, data)
165
+ console.log(_options, data)
166
+
167
+ write(_options, 'tags', tags)
168
+ write(_options, 'attributes', attributes)
169
+ write(_options, 'webTypes', webTypesData)
170
+ }
171
+
172
+ generateWebTypes({
173
+ entry: './dist/docs/components/hy-button/hy-button.md', // 你的组件路径
174
+ outDir: 'dist', // 输出目录
175
+ name: 'hy-app', // 组件库名字
176
+ version: '0.2.10', // 版本号
177
+ })
@@ -1,3 +1,7 @@
1
+ <!--
2
+ @component hy-button 按钮组件
3
+ @description 用于页面中的操作按钮,支持多种状态和样式
4
+ -->
1
5
  <template>
2
6
  <!-- #ifndef APP-NVUE -->
3
7
  <button
@@ -47,6 +51,7 @@
47
51
  :round="icon?.round"
48
52
  :customStyle="icon?.customStyle || { marginRight: '2px' }"
49
53
  ></HyIcon>
54
+ <!-- @slot 插入默认的值 -->
50
55
  <slot>
51
56
  <text class="hy-button__text" :style="[{ fontSize: textSize + 'px' }]">{{ text }}</text>
52
57
  </slot>
@@ -63,8 +68,8 @@
63
68
  !disabled && !loading && !color && (plain || type === 'info')
64
69
  ? 'hy-button--active--plain'
65
70
  : !disabled && !loading && !plain
66
- ? 'hy-button--active'
67
- : ''
71
+ ? 'hy-button--active'
72
+ : ''
68
73
  "
69
74
  @click="clickHandler"
70
75
  :class="bemClass"
@@ -114,6 +119,12 @@
114
119
  </template>
115
120
 
116
121
  <script lang="ts">
122
+ /**
123
+ * 从底部弹出的动作菜单面板组件
124
+ *
125
+ * @displayName HyButton 动作面板
126
+ * @version 1.0.0
127
+ */
117
128
  export default {
118
129
  name: 'hy-button',
119
130
  options: {
@@ -125,12 +136,6 @@ export default {
125
136
  </script>
126
137
 
127
138
  <script setup lang="ts">
128
- /**
129
- * 自定义按钮组件
130
- * @description 用于表单提交、操作触发等场景,支持多种尺寸和状态
131
- * @component hy-button
132
- */
133
-
134
139
  import { computed, type CSSProperties, toRefs } from 'vue'
135
140
  import { bem, throttle } from '../../utils'
136
141
  import defaultProps from './props'
@@ -140,35 +145,135 @@ import type { HyButtonProps, IButtonEmits } from './typing.d.ts'
140
145
  // 组件
141
146
  import HyIcon from '../hy-icon/hy-icon.vue'
142
147
  import HyLoading from '../hy-loading/hy-loading.vue'
148
+ import { HyApp } from 'hy-app/typing/modules/common'
143
149
 
144
- const props = withDefaults(defineProps<HyButtonProps>(), {
145
- hairline: false,
146
- type: 'primary',
147
- size: 'medium',
148
- shape: 'square',
149
- plain: false,
150
- disabled: false,
151
- loading: false,
152
- loadingText: '',
153
- loadingMode: 'spinner',
154
- loadingSize: 13,
155
- openType: '',
156
- formType: '',
157
- appParameter: '',
158
- hoverStopPropagation: true,
159
- lang: 'en',
160
- sessionFrom: '',
161
- sendMessageTitle: '',
162
- sendMessagePath: '',
163
- sendMessageImg: '',
164
- showMessageCard: false,
165
- dataName: '',
166
- throttleTime: 0,
167
- hoverStartTime: 0,
168
- hoverStayTime: 200,
169
- text: '',
170
- color: '',
171
- stop: true,
150
+ type MessageType = 'info' | 'primary' | 'error' | 'warning' | 'success'
151
+ // const props = withDefaults(defineProps<{ type: MessageType }>(), { type: 'error' })
152
+ const props = defineProps({
153
+ hairline: {
154
+ type: Boolean,
155
+ default: false,
156
+ },
157
+ type: {
158
+ type: String,
159
+ default: 'primary',
160
+ validator: (v) => ['info', 'primary', 'error', 'warning', 'success'].includes(v),
161
+ },
162
+ size: {
163
+ type: String,
164
+ default: 'medium',
165
+ validator: (v) => ['large', 'medium', 'small', 'mini'].includes(v),
166
+ },
167
+ shape: {
168
+ type: String,
169
+ default: 'square',
170
+ validator: (v) => ['circle', 'square'].includes(v),
171
+ },
172
+ plain: {
173
+ type: Boolean,
174
+ default: false,
175
+ },
176
+ disabled: {
177
+ type: Boolean,
178
+ default: false,
179
+ },
180
+ loading: {
181
+ type: Boolean,
182
+ default: false,
183
+ },
184
+ loadingText: {
185
+ type: String,
186
+ default: '',
187
+ },
188
+ loadingMode: {
189
+ type: String,
190
+ default: 'spinner',
191
+ validator: (v) => ['spinner', 'circle', 'semicircle'].includes(v),
192
+ },
193
+ loadingSize: {
194
+ type: Number,
195
+ default: 13,
196
+ },
197
+ openType: {
198
+ type: String,
199
+ default: '',
200
+ },
201
+ formType: {
202
+ type: String,
203
+ default: '',
204
+ },
205
+ appParameter: {
206
+ type: String,
207
+ default: '',
208
+ },
209
+ hoverStopPropagation: {
210
+ type: Boolean,
211
+ default: true,
212
+ },
213
+ lang: {
214
+ type: String,
215
+ default: 'en',
216
+ },
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
+ },
233
+ showMessageCard: {
234
+ type: Boolean,
235
+ default: false,
236
+ },
237
+ dataName: {
238
+ type: String,
239
+ default: '',
240
+ },
241
+ throttleTime: {
242
+ type: Number,
243
+ default: 0,
244
+ },
245
+ hoverStartTime: {
246
+ type: Number,
247
+ default: 0,
248
+ },
249
+ hoverStayTime: {
250
+ type: Number,
251
+ default: 200,
252
+ },
253
+ text: {
254
+ type: String,
255
+ default: '',
256
+ },
257
+ icon: {
258
+ type: Object,
259
+ default: () => ({}),
260
+ },
261
+ color: {
262
+ type: String,
263
+ default: '',
264
+ },
265
+ stop: {
266
+ type: Boolean,
267
+ default: true,
268
+ },
269
+ /**阻止事件冒泡*/
270
+ customStyle: {
271
+ type: CSSProperties,
272
+ },
273
+ /**阻止事件冒泡*/
274
+ customClass: {
275
+ type: String,
276
+ },
172
277
  })
173
278
  const { disabled, loading, throttleTime, stop, size, type, plain, color, icon } = toRefs(props)
174
279
  const emit = defineEmits<IButtonEmits>()
@@ -1,34 +1,160 @@
1
1
  import type { HyButtonProps } from './typing'
2
+ import { HyApp } from 'hy-app/typing/modules/common'
3
+ import type { CSSProperties } from 'vue'
2
4
 
3
- const defaultProps: HyButtonProps = {
4
- hairline: false,
5
- type: 'primary',
6
- size: 'medium',
7
- shape: 'square',
8
- plain: false,
9
- disabled: false,
10
- loading: false,
11
- loadingText: '',
12
- loadingMode: 'spinner',
13
- loadingSize: 13,
14
- openType: '',
15
- formType: '',
16
- appParameter: '',
17
- hoverStopPropagation: true,
18
- lang: 'en',
19
- sessionFrom: '',
20
- sendMessageTitle: '',
21
- sendMessagePath: '',
22
- sendMessageImg: '',
23
- showMessageCard: false,
24
- dataName: '',
25
- throttleTime: 0,
26
- hoverStartTime: 0,
27
- hoverStayTime: 200,
28
- text: '',
29
- icon: {},
30
- color: '',
31
- stop: true,
5
+ const defaultProps = {
6
+ /**是否显示按钮的细边框*/
7
+ hairline: {
8
+ type: Boolean,
9
+ default: false,
10
+ },
11
+ /**按钮的预置样式*/
12
+ type: {
13
+ type: String,
14
+ default: 'primary',
15
+ validator: (v) => ['info', 'primary', 'error', 'warning', 'success'].includes(v),
16
+ },
17
+ /**按钮尺寸*/
18
+ size: {
19
+ type: String,
20
+ default: 'medium',
21
+ validator: (v) => ['large', 'medium', 'small', 'mini'].includes(v),
22
+ },
23
+ /**按钮形状*/
24
+ shape: {
25
+ type: String,
26
+ default: 'square',
27
+ validator: (v) => ['circle', 'square'].includes(v),
28
+ },
29
+ /**按钮是否镂空,背景色透明 */
30
+ plain: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ /**是否禁用*/
35
+ disabled: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+ /**按钮名称前是否带 loading 图标*/
40
+ loading: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+ /**加载中提示文字*/
45
+ loadingText: {
46
+ type: String,
47
+ default: '',
48
+ },
49
+ /**加载状态图标类型*/
50
+ loadingMode: {
51
+ type: String,
52
+ default: 'spinner',
53
+ validator: (v) => ['spinner', 'circle', 'semicircle'].includes(v),
54
+ },
55
+ /**加载图标大小*/
56
+ loadingSize: {
57
+ type: Number,
58
+ default: 13,
59
+ },
60
+ /**开放能力,具体请看uniapp稳定关于button组件部分说明*/
61
+ openType: {
62
+ type: String,
63
+ default: '',
64
+ },
65
+ /**用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件*/
66
+ formType: {
67
+ type: String,
68
+ default: '',
69
+ },
70
+ /**打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效)*/
71
+ appParameter: {
72
+ type: String,
73
+ default: '',
74
+ },
75
+ /**指定是否阻止本节点的祖先节点出现点击态,微信小程序有效*/
76
+ hoverStopPropagation: {
77
+ type: Boolean,
78
+ default: true,
79
+ },
80
+ /**指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en )*/
81
+ lang: {
82
+ type: String,
83
+ default: 'en',
84
+ },
85
+ /**会话来源,openType="contact"时有效*/
86
+ sessionFrom: {
87
+ type: String,
88
+ default: '',
89
+ },
90
+ /**会话内消息卡片标题,openType="contact"时有效*/
91
+ sendMessageTitle: {
92
+ type: String,
93
+ default: '',
94
+ },
95
+ /**会话内消息卡片点击跳转小程序路径,openType="contact"时有效*/
96
+ sendMessagePath: {
97
+ type: String,
98
+ default: '',
99
+ },
100
+ /**会话内消息卡片图片,openType="contact"时有效*/
101
+ sendMessageImg: {
102
+ type: String,
103
+ default: '',
104
+ },
105
+ /**是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效*/
106
+ showMessageCard: {
107
+ type: Boolean,
108
+ default: false,
109
+ },
110
+ /**额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取*/
111
+ dataName: {
112
+ type: String,
113
+ default: '',
114
+ },
115
+ /**节流时间,一定时间内只能触发一次*/
116
+ throttleTime: {
117
+ type: Number,
118
+ default: 0,
119
+ },
120
+ /**按住后多久出现点击态,单位毫秒*/
121
+ hoverStartTime: {
122
+ type: Number,
123
+ default: 0,
124
+ },
125
+ /**手指松开后点击态保留时间,单位毫秒*/
126
+ hoverStayTime: {
127
+ type: Number,
128
+ default: 200,
129
+ },
130
+ /**按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式)*/
131
+ text: {
132
+ type: String,
133
+ default: '',
134
+ },
135
+ /**按钮图标api集合*/
136
+ icon: {
137
+ type: Object,
138
+ default: () => ({}),
139
+ },
140
+ /**按钮颜色,支持传入linear-gradient渐变色*/
141
+ color: {
142
+ type: String,
143
+ default: '',
144
+ },
145
+ /**阻止事件冒泡*/
146
+ stop: {
147
+ type: Boolean,
148
+ default: true,
149
+ },
150
+ /**阻止事件冒泡*/
151
+ customStyle: {
152
+ type: CSSProperties,
153
+ },
154
+ /**阻止事件冒泡*/
155
+ customClass: {
156
+ type: String,
157
+ },
32
158
  }
33
159
 
34
160
  export default defaultProps
@@ -1,25 +1,27 @@
1
1
  import type { CSSProperties } from 'vue'
2
2
  import type HyIconProps from '../hy-icon/typing'
3
+ import HyApp from 'hy-app'
3
4
 
4
5
  export interface HyButtonProps {
5
6
  /**
6
- * 是否显示按钮的细边框 (默认 true )
7
+ * 是否显示按钮的细边框
8
+ * @default true
9
+ * @type {boolean}
7
10
  * */
8
11
  hairline?: boolean
9
12
  /**
10
13
  * 按钮的预置样式
11
- * @type ThemeType
14
+ * @type {ThemeType}
12
15
  * @default 'primary'
13
- * @enum {string} // 声明为枚举类型
14
16
  * @values info, primary, error, warning, success
15
17
  * */
16
- type?: 'info' | 'primary' | 'error' | 'warning' | 'success'
18
+ type?: HyApp.ThemeType
17
19
  /**
18
20
  * 按钮尺寸
19
21
  * @type {'large' | 'medium' | 'small' | 'mini'}
20
22
  * @default 'medium'
21
23
  * */
22
- size?: HyApp.SizeType | 'mini'
24
+ size?: 'large' | 'medium' | 'small' | 'mini'
23
25
  /**
24
26
  * 按钮形状,circle(两边为半圆),square(带圆角) (默认 'square' )
25
27
  * */
@@ -137,23 +139,27 @@ export interface IButtonEmits {
137
139
  * */
138
140
  (e: 'click', event: Event): void
139
141
  /**
140
- * 点击按钮事件
142
+ * 仅限微信小程序,当使用开放能力时,发生错误的回调
143
+ * */
144
+ (e: 'error', event: Event): void
145
+ /**
146
+ * 微信小程序获取手机号
141
147
  * */
142
148
  (e: 'getphonenumber', event: Event): void
143
149
  /**
144
- * 点击按钮事件
150
+ * 微信小程序用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
145
151
  * */
146
152
  (e: 'getuserinfo', event: Event): void
147
153
  /**
148
- * 点击按钮事件
154
+ * 仅限微信小程序,在打开授权设置页并关闭后回调
149
155
  * */
150
156
  (e: 'opensetting', event: Event): void
151
157
  /**
152
- * 点击按钮事件
158
+ * 仅限微信小程序,打开 APP 成功的回调
153
159
  * */
154
160
  (e: 'launchapp', event: Event): void
155
161
  /**
156
- * 点击按钮事件
162
+ * 仅限微信小程序,用户同意隐私协议事件回调,open-type="agreePrivacyAuthorization"时有效
157
163
  * */
158
164
  (e: 'agreeprivacyauthorization', event: Event): void
159
165
  }