hy-app 0.2.13 → 0.2.14

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 (93) hide show
  1. package/compiler.ts +108 -0
  2. package/component-helper.ts +5 -3
  3. package/components/hy-button/HyButton.docgen.js +6 -0
  4. package/components/hy-button/hy-button.vue +86 -75
  5. package/components/hy-button/props.ts +40 -41
  6. package/docgen.config.js +1 -2
  7. package/package.json +6 -4
  8. package/web-types.json +1 -1
  9. package/dist/attributes.json +0 -1
  10. package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
  11. package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
  12. package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
  13. package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
  14. package/dist/docs/components/hy-badge/hy-badge.md +0 -13
  15. package/dist/docs/components/hy-button/hy-button.md +0 -61
  16. package/dist/docs/components/hy-calendar/header.md +0 -17
  17. package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
  18. package/dist/docs/components/hy-calendar/month.md +0 -38
  19. package/dist/docs/components/hy-card/hy-card.md +0 -24
  20. package/dist/docs/components/hy-cell/hy-cell.md +0 -26
  21. package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
  22. package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
  23. package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
  24. package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
  25. package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
  26. package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
  27. package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
  28. package/dist/docs/components/hy-divider/hy-divider.md +0 -13
  29. package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
  30. package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
  31. package/dist/docs/components/hy-empty/hy-empty.md +0 -20
  32. package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
  33. package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
  34. package/dist/docs/components/hy-form/hy-form.md +0 -29
  35. package/dist/docs/components/hy-grid/hy-grid.md +0 -19
  36. package/dist/docs/components/hy-icon/hy-icon.md +0 -13
  37. package/dist/docs/components/hy-image/hy-image.md +0 -22
  38. package/dist/docs/components/hy-input/hy-input.md +0 -29
  39. package/dist/docs/components/hy-line/hy-line.md +0 -7
  40. package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
  41. package/dist/docs/components/hy-list/hy-list.md +0 -25
  42. package/dist/docs/components/hy-loading/hy-loading.md +0 -14
  43. package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
  44. package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
  45. package/dist/docs/components/hy-login/hy-login.md +0 -14
  46. package/dist/docs/components/hy-menu/hy-menu.md +0 -21
  47. package/dist/docs/components/hy-modal/hy-modal.md +0 -23
  48. package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
  49. package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
  50. package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
  51. package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
  52. package/dist/docs/components/hy-notify/hy-notify.md +0 -23
  53. package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
  54. package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
  55. package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
  56. package/dist/docs/components/hy-parse/hy-parse.md +0 -46
  57. package/dist/docs/components/hy-parse/node/node.md +0 -7
  58. package/dist/docs/components/hy-picker/hy-picker.md +0 -32
  59. package/dist/docs/components/hy-popover/hy-popover.md +0 -34
  60. package/dist/docs/components/hy-popup/hy-popup.md +0 -22
  61. package/dist/docs/components/hy-price/hy-price.md +0 -13
  62. package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
  63. package/dist/docs/components/hy-radio/hy-radio.md +0 -21
  64. package/dist/docs/components/hy-rate/hy-rate.md +0 -14
  65. package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
  66. package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
  67. package/dist/docs/components/hy-search/hy-search.md +0 -27
  68. package/dist/docs/components/hy-signature/hy-signature.md +0 -45
  69. package/dist/docs/components/hy-slider/hy-slider.md +0 -24
  70. package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
  71. package/dist/docs/components/hy-steps/hy-steps.md +0 -23
  72. package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
  73. package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
  74. package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
  75. package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
  76. package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
  77. package/dist/docs/components/hy-switch/hy-switch.md +0 -20
  78. package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
  79. package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
  80. package/dist/docs/components/hy-tag/hy-tag.md +0 -21
  81. package/dist/docs/components/hy-text/hy-text.md +0 -13
  82. package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
  83. package/dist/docs/components/hy-toast/hy-toast.md +0 -17
  84. package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
  85. package/dist/docs/components/hy-transition/hy-transition.md +0 -25
  86. package/dist/docs/components/hy-upload/hy-upload.md +0 -25
  87. package/dist/docs/components/hy-warn/hy-warn.md +0 -14
  88. package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
  89. package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
  90. package/dist/docs/components/message/TheMessage.md +0 -17
  91. package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
  92. package/dist/tags.json +0 -1
  93. package/dist/web-types.json +0 -1
package/compiler.ts ADDED
@@ -0,0 +1,108 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+ import { parse } from '@vue/compiler-sfc'
4
+ import ts from 'typescript'
5
+
6
+ // 读取组件文件
7
+ const componentPath = path.resolve(__dirname, './components/hy-button/hy-button.vue')
8
+ const content = fs.readFileSync(componentPath, 'utf-8')
9
+ const { descriptor } = parse(content)
10
+
11
+ if (!descriptor.scriptSetup) {
12
+ console.error('未找到script setup部分')
13
+ process.exit(1)
14
+ }
15
+
16
+ // 解析TypeScript类型
17
+ const sourceCode = descriptor.scriptSetup.content
18
+ const sourceFile = ts.createSourceFile('temp.ts', sourceCode, ts.ScriptTarget.Latest, true)
19
+
20
+ // 存储解析结果
21
+ const propsInfo: Record<
22
+ string,
23
+ {
24
+ type: string
25
+ default?: string
26
+ values?: string[]
27
+ description?: string
28
+ }
29
+ > = {}
30
+
31
+ // 遍历AST查找interface定义
32
+ function traverseNode(node: ts.Node) {
33
+ if (ts.isInterfaceDeclaration(node) && node.name.text === 'buttonProps') {
34
+ node.members.forEach((member) => {
35
+ if (ts.isPropertySignature(member) && member.name) {
36
+ const propName = member.name.getText()
37
+ const type = member.type?.getText() || 'any'
38
+
39
+ // 提取JSDoc注释中的信息
40
+ const jsDoc = ts.getJSDocCommentsAndTags(member)
41
+ const description = jsDoc
42
+ .filter((tag) => ts.isJSDocText(tag))
43
+ .map((tag) => (tag as ts.JSDocText).comment)
44
+ .join('\n')
45
+ .trim()
46
+
47
+ const valuesTag = jsDoc.find(
48
+ (tag) => ts.isJSDocTag(tag) && tag.tagName.text === 'values',
49
+ ) as ts.JSDocTag | undefined
50
+ const values = valuesTag?.comment ? valuesTag.comment.split('|').map((v) => v.trim()) : []
51
+
52
+ propsInfo[propName] = {
53
+ type,
54
+ description: description || undefined,
55
+ values: values.length ? values : undefined,
56
+ }
57
+ }
58
+ })
59
+ }
60
+
61
+ ts.forEachChild(node, traverseNode)
62
+ }
63
+
64
+ traverseNode(sourceFile)
65
+
66
+ // 解析默认值
67
+ const defaultsMatch = sourceCode.match(/withDefaults\(.*?,\s*({[\s\S]*?})\s*\)/)
68
+ if (defaultsMatch) {
69
+ const defaultsCode = defaultsMatch[1]
70
+ const defaultsSource = ts.createSourceFile(
71
+ 'defaults.ts',
72
+ `const defaults = ${defaultsCode};`,
73
+ ts.ScriptTarget.Latest,
74
+ true,
75
+ )
76
+
77
+ ts.forEachChild(defaultsSource, (node) => {
78
+ if (ts.isVariableDeclaration(node) && node.name.getText() === 'defaults') {
79
+ const initializer = node.initializer
80
+ if (ts.isObjectLiteralExpression(initializer)) {
81
+ initializer.properties.forEach((prop) => {
82
+ if (ts.isPropertyAssignment(prop)) {
83
+ const propName = prop.name.getText()
84
+ const defaultValue = prop.initializer.getText()
85
+ if (propsInfo[propName]) {
86
+ propsInfo[propName].default = defaultValue
87
+ }
88
+ }
89
+ })
90
+ }
91
+ }
92
+ })
93
+ }
94
+
95
+ // 生成Markdown文档
96
+ let md = '## Props\n\n'
97
+ md += '| 属性名 | 类型 | 默认值 | 可选值 | 说明 |\n'
98
+ md += '|--------|------|--------|--------|------|\n'
99
+
100
+ Object.entries(propsInfo).forEach(([name, info]) => {
101
+ md += `| ${name} | ${info.type} | ${info.default || '-'} | ${
102
+ info.values ? info.values.join('、') : '-'
103
+ } | ${info.description || '-'} |\n`
104
+ })
105
+
106
+ // 写入文档文件
107
+ fs.writeFileSync(path.join(__dirname, 'docs/button-props.md'), md)
108
+ console.log('Props文档生成成功,包含可选值信息!')
@@ -157,12 +157,14 @@ export function generateWebTypes(options = {} as InstallOptions) {
157
157
  const fileContent = read(path)
158
158
  const parseContent = parse(_options, fileContent)
159
159
  const content = normalize(_options, parseContent, path)
160
- if (content.title === 'hy-button') console.log(JSON.stringify(content))
160
+ content.props.content = content.props.content.map((item) => {
161
+ item.Values = item.Values.replace(/`|-/g, '')
162
+ return item
163
+ })
161
164
  return content
162
165
  })
163
166
  const { tags, attributes } = vetur(_options, data)
164
167
  const webTypesData = webTypes(_options, data)
165
- console.log(_options, data)
166
168
 
167
169
  write(_options, 'tags', tags)
168
170
  write(_options, 'attributes', attributes)
@@ -173,5 +175,5 @@ generateWebTypes({
173
175
  entry: './dist/docs/components/hy-button/hy-button.md', // 你的组件路径
174
176
  outDir: 'dist', // 输出目录
175
177
  name: 'hy-app', // 组件库名字
176
- version: '0.2.10', // 版本号
178
+ version: '0.2.14', // 版本号
177
179
  })
@@ -0,0 +1,6 @@
1
+ // HyButton.docgen.js
2
+ const { buttonProps } = require('./props.ts')
3
+
4
+ module.exports = {
5
+ props: buttonProps,
6
+ }
@@ -1,7 +1,3 @@
1
- <!--
2
- @component hy-button 按钮组件
3
- @description 用于页面中的操作按钮,支持多种状态和样式
4
- -->
5
1
  <template>
6
2
  <!-- #ifndef APP-NVUE -->
7
3
  <button
@@ -119,12 +115,6 @@
119
115
  </template>
120
116
 
121
117
  <script lang="ts">
122
- /**
123
- * 从底部弹出的动作菜单面板组件
124
- *
125
- * @displayName HyButton 动作面板
126
- * @version 1.0.0
127
- */
128
118
  export default {
129
119
  name: 'hy-button',
130
120
  options: {
@@ -136,144 +126,165 @@ export default {
136
126
  </script>
137
127
 
138
128
  <script setup lang="ts">
139
- import { computed, type CSSProperties, toRefs } from 'vue'
129
+ /**
130
+ * 提供试剂耗材的入库、申领、出库和明细查询等操作按钮
131
+ * @displayName hy-button
132
+ */
133
+ // 支持 VueDocGen 生成文档时显示 JsDoc 的内容,也可以简单编写为:defineOptions({});
134
+ defineOptions({})
135
+ type MessageType = 'info' | 'primary' | 'error' | 'warning' | 'success'
136
+ /**
137
+ * 334
138
+ * */
139
+ export interface buttonProps {
140
+ /**
141
+ * 按钮类型
142
+ *
143
+ * @values primary,default,danger
144
+ * */
145
+ type: MessageType
146
+ }
147
+ // 支持 VueDocGen 生成文档时显示 JsDoc 的内容,也可以简单编写为:defineOptions({});
148
+ defineOptions({})
149
+ import { computed, type CSSProperties, toRefs, type PropType } from 'vue'
140
150
  import { bem, throttle } from '../../utils'
141
- import defaultProps from './props'
151
+ import { defaultProps } from './props'
142
152
  import { ColorConfig } from '../../config'
143
153
  import type { HyButtonProps, IButtonEmits } from './typing.d.ts'
154
+ import type HyIconProps from '../hy-icon/typing'
144
155
 
145
156
  // 组件
146
157
  import HyIcon from '../hy-icon/hy-icon.vue'
147
158
  import HyLoading from '../hy-loading/hy-loading.vue'
148
159
  import { HyApp } from 'hy-app/typing/modules/common'
149
160
 
150
- type MessageType = 'info' | 'primary' | 'error' | 'warning' | 'success'
151
- // const props = withDefaults(defineProps<{ type: MessageType }>(), { type: 'error' })
161
+ // 可选:定义 props 类型
162
+ // const props = withDefaults(defineProps<HyButtonProps>(), param)
152
163
  const props = defineProps({
164
+ /** 是否显示按钮的细边框 */
153
165
  hairline: {
154
166
  type: Boolean,
155
167
  default: false,
156
168
  },
169
+ /**
170
+ * 按钮的预置样式
171
+ * @values info,primary,error,warning,success
172
+ * */
157
173
  type: {
158
- type: String,
174
+ type: String as PropType<HyApp.ThemeType>,
159
175
  default: 'primary',
160
- validator: (v) => ['info', 'primary', 'error', 'warning', 'success'].includes(v),
161
176
  },
177
+ /**
178
+ * 按钮尺寸
179
+ * @values large,medium,small,mini
180
+ * */
162
181
  size: {
163
- type: String,
182
+ type: String as PropType<HyApp.SizeType | 'mini'>,
164
183
  default: 'medium',
165
- validator: (v) => ['large', 'medium', 'small', 'mini'].includes(v),
166
184
  },
185
+ /**
186
+ * 按钮形状
187
+ * @values circle,square
188
+ * */
167
189
  shape: {
168
- type: String,
190
+ type: String as PropType<HyApp.ShapeType>,
169
191
  default: 'square',
170
- validator: (v) => ['circle', 'square'].includes(v),
171
192
  },
193
+ /** 按钮是否镂空,背景色透明 */
172
194
  plain: {
173
195
  type: Boolean,
174
196
  default: false,
175
197
  },
198
+ /** 是否禁用 */
176
199
  disabled: {
177
200
  type: Boolean,
178
201
  default: false,
179
202
  },
203
+ /** 按钮名称前是否带 loading 图标 */
180
204
  loading: {
181
205
  type: Boolean,
182
206
  default: false,
183
207
  },
184
- loadingText: {
185
- type: String,
186
- default: '',
187
- },
208
+ /** 加载中提示文字 */
209
+ loadingText: String,
210
+ /**
211
+ * 加载状态图标类型
212
+ * @values spinner,circle,semicircle
213
+ * */
188
214
  loadingMode: {
189
- type: String,
215
+ type: String as PropType<HyApp.LoadingMode>,
190
216
  default: 'spinner',
191
- validator: (v) => ['spinner', 'circle', 'semicircle'].includes(v),
192
217
  },
218
+ /** 加载图标大小 */
193
219
  loadingSize: {
194
- type: Number,
220
+ type: [Number, String],
195
221
  default: 13,
196
222
  },
197
- openType: {
198
- type: String,
199
- default: '',
200
- },
201
- formType: {
202
- type: String,
203
- default: '',
204
- },
205
- appParameter: {
206
- type: String,
207
- default: '',
208
- },
223
+ /** 开放能力,具体请看uniapp稳定关于button组件部分说明 */
224
+ openType: String,
225
+ /** 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 */
226
+ formType: String,
227
+ /** 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效) */
228
+ appParameter: String,
229
+ /** 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效 */
209
230
  hoverStopPropagation: {
210
231
  type: Boolean,
211
232
  default: true,
212
233
  },
234
+ /** 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en ) */
213
235
  lang: {
214
236
  type: String,
215
237
  default: 'en',
216
238
  },
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
- },
239
+ /** 会话来源,openType="contact"时有效 */
240
+ sessionFrom: String,
241
+ /** 会话内消息卡片标题,openType="contact"时有效 */
242
+ sendMessageTitle: String,
243
+ /** 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 */
244
+ sendMessagePath: String,
245
+ /** 会话内消息卡片图片,openType="contact"时有效 */
246
+ sendMessageImg: String,
247
+ /** 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效 */
233
248
  showMessageCard: {
234
249
  type: Boolean,
235
250
  default: false,
236
251
  },
237
- dataName: {
238
- type: String,
239
- default: '',
240
- },
252
+ /** 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 */
253
+ dataName: String,
254
+ /** 节流时间,一定时间内只能触发一次 */
241
255
  throttleTime: {
242
256
  type: Number,
243
257
  default: 0,
244
258
  },
259
+ /** 按住后多久出现点击态,单位毫秒 */
245
260
  hoverStartTime: {
246
261
  type: Number,
247
262
  default: 0,
248
263
  },
264
+ /** 手指松开后点击态保留时间,单位毫秒 */
249
265
  hoverStayTime: {
250
266
  type: Number,
251
267
  default: 200,
252
268
  },
253
- text: {
254
- type: String,
255
- default: '',
256
- },
269
+ /** 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式) */
270
+ text: String,
271
+ /** 按钮图标api集合 */
257
272
  icon: {
258
- type: Object,
259
- default: () => ({}),
260
- },
261
- color: {
262
- type: String,
263
- default: '',
273
+ type: Object as PropType<HyIconProps>,
264
274
  },
275
+ /** 按钮颜色,支持传入linear-gradient渐变色 */
276
+ color: String,
277
+ /** 阻止事件冒泡 */
265
278
  stop: {
266
279
  type: Boolean,
267
280
  default: true,
268
281
  },
269
- /**阻止事件冒泡*/
282
+ /** 阻止事件冒泡 */
270
283
  customStyle: {
271
- type: CSSProperties,
272
- },
273
- /**阻止事件冒泡*/
274
- customClass: {
275
- type: String,
284
+ type: Object as PropType<CSSProperties>,
276
285
  },
286
+ /** 阻止事件冒泡 */
287
+ customClass: String,
277
288
  })
278
289
  const { disabled, loading, throttleTime, stop, size, type, plain, color, icon } = toRefs(props)
279
290
  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
package/docgen.config.js CHANGED
@@ -1,9 +1,8 @@
1
1
  const path = require('path')
2
2
 
3
3
  module.exports = {
4
- components: ['./components/**/*.vue'],
4
+ components: ['./components/hy-button/hy-button.vue'],
5
5
  outDir: 'dist/docs',
6
- defaultExamples: true,
7
6
  apiOptions: {
8
7
  jsx: false,
9
8
  alias: {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "hy-app",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "测试组件提示",
5
5
  "main": "./index.ts",
6
6
  "private": false,
7
7
  "scripts": {
8
8
  "web-types": "vue-docgen-web-types --configFile web-types.config.js",
9
- "web": "npx web-types-generator --name hy-app --src ./components --out ./web-types.json",
10
9
  "doc": "npx vue-docgen -c docgen.config.js",
11
- "gen:web-types": "tsx ./component-helper.ts"
10
+ "gen:web-types": "tsx ./component-helper.ts",
11
+ "docs": "npx ts-node compiler.ts"
12
12
  },
13
13
  "keywords": [
14
14
  "华玥组件库",
@@ -19,9 +19,11 @@
19
19
  "author": "gaoxianhua",
20
20
  "license": "MIT",
21
21
  "devDependencies": {
22
- "component-helper": "1.3.1-rc.1",
22
+ "@types/node": "^24.0.15",
23
23
  "components-helper": "^2.2.0",
24
+ "ts-node": "^10.9.2",
24
25
  "tsx": "^4.20.3",
26
+ "typescript": "^5.8.3",
25
27
  "vue-docgen-api": "^4.79.2",
26
28
  "vue-docgen-cli": "^4.79.0",
27
29
  "vue-docgen-web-types": "^0.1.8"