hy-app 0.2.11 → 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.
- package/component-helper.ts +177 -0
- package/components/hy-action-sheet/hy-action-sheet.vue +9 -3
- package/components/hy-action-sheet/props.ts +2 -2
- package/components/hy-action-sheet/typing.d.ts +49 -16
- package/components/hy-button/hy-button.vue +144 -13
- package/components/hy-button/props.ts +158 -32
- package/components/hy-button/typing.d.ts +71 -32
- package/components/index.ts +114 -122
- package/components.json +3287 -0
- package/dist/attributes.json +1 -0
- package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +41 -0
- package/dist/docs/components/hy-address-picker/hy-address-picker.md +25 -0
- package/dist/docs/components/hy-avatar/hy-avatar.md +19 -0
- package/dist/docs/components/hy-back-top/hy-back-top.md +19 -0
- package/dist/docs/components/hy-badge/hy-badge.md +13 -0
- package/dist/docs/components/hy-button/hy-button.md +61 -0
- package/dist/docs/components/hy-calendar/header.md +17 -0
- package/dist/docs/components/hy-calendar/hy-calendar.md +27 -0
- package/dist/docs/components/hy-calendar/month.md +38 -0
- package/dist/docs/components/hy-card/hy-card.md +24 -0
- package/dist/docs/components/hy-cell/hy-cell.md +26 -0
- package/dist/docs/components/hy-check-button/hy-check-button.md +14 -0
- package/dist/docs/components/hy-checkbox/hy-checkbox.md +21 -0
- package/dist/docs/components/hy-code-input/hy-code-input.md +15 -0
- package/dist/docs/components/hy-config-provider/hy-config-provider.md +13 -0
- package/dist/docs/components/hy-count-down/hy-count-down.md +34 -0
- package/dist/docs/components/hy-count-to/hy-count-to.md +31 -0
- package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +25 -0
- package/dist/docs/components/hy-divider/hy-divider.md +13 -0
- package/dist/docs/components/hy-dropdown/hy-dropdown.md +13 -0
- package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +20 -0
- package/dist/docs/components/hy-empty/hy-empty.md +20 -0
- package/dist/docs/components/hy-float-button/hy-float-button.md +20 -0
- package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +24 -0
- package/dist/docs/components/hy-form/hy-form.md +29 -0
- package/dist/docs/components/hy-grid/hy-grid.md +19 -0
- package/dist/docs/components/hy-icon/hy-icon.md +13 -0
- package/dist/docs/components/hy-image/hy-image.md +22 -0
- package/dist/docs/components/hy-input/hy-input.md +29 -0
- package/dist/docs/components/hy-line/hy-line.md +7 -0
- package/dist/docs/components/hy-line-progress/hy-line-progress.md +13 -0
- package/dist/docs/components/hy-list/hy-list.md +25 -0
- package/dist/docs/components/hy-loading/hy-loading.md +14 -0
- package/dist/docs/components/hy-login/ThePhoneLogin.md +20 -0
- package/dist/docs/components/hy-login/TheUserLogin.md +44 -0
- package/dist/docs/components/hy-login/hy-login.md +14 -0
- package/dist/docs/components/hy-menu/hy-menu.md +21 -0
- package/dist/docs/components/hy-modal/hy-modal.md +23 -0
- package/dist/docs/components/hy-navbar/hy-navbar.md +22 -0
- package/dist/docs/components/hy-notice-bar/hy-column-notice.md +20 -0
- package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +14 -0
- package/dist/docs/components/hy-notice-bar/hy-row-notice.md +20 -0
- package/dist/docs/components/hy-notify/hy-notify.md +23 -0
- package/dist/docs/components/hy-number-step/hy-number-step.md +27 -0
- package/dist/docs/components/hy-overlay/hy-overlay.md +19 -0
- package/dist/docs/components/hy-pagination/hy-pagination.md +14 -0
- package/dist/docs/components/hy-parse/hy-parse.md +46 -0
- package/dist/docs/components/hy-parse/node/node.md +7 -0
- package/dist/docs/components/hy-picker/hy-picker.md +32 -0
- package/dist/docs/components/hy-popover/hy-popover.md +34 -0
- package/dist/docs/components/hy-popup/hy-popup.md +22 -0
- package/dist/docs/components/hy-price/hy-price.md +13 -0
- package/dist/docs/components/hy-qrcode/hy-qrcode.md +15 -0
- package/dist/docs/components/hy-radio/hy-radio.md +21 -0
- package/dist/docs/components/hy-rate/hy-rate.md +14 -0
- package/dist/docs/components/hy-read-more/hy-read-more.md +21 -0
- package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +21 -0
- package/dist/docs/components/hy-search/hy-search.md +27 -0
- package/dist/docs/components/hy-signature/hy-signature.md +45 -0
- package/dist/docs/components/hy-slider/hy-slider.md +24 -0
- package/dist/docs/components/hy-status-bar/hy-status-bar.md +13 -0
- package/dist/docs/components/hy-steps/hy-steps.md +23 -0
- package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +21 -0
- package/dist/docs/components/hy-subsection/hy-subsection.md +14 -0
- package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +29 -0
- package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +23 -0
- package/dist/docs/components/hy-swiper/hy-swiper.md +22 -0
- package/dist/docs/components/hy-switch/hy-switch.md +20 -0
- package/dist/docs/components/hy-tabBar/hy-tabBar.md +13 -0
- package/dist/docs/components/hy-tabs/hy-tabs.md +27 -0
- package/dist/docs/components/hy-tag/hy-tag.md +21 -0
- package/dist/docs/components/hy-text/hy-text.md +13 -0
- package/dist/docs/components/hy-textarea/hy-textarea.md +19 -0
- package/dist/docs/components/hy-toast/hy-toast.md +17 -0
- package/dist/docs/components/hy-tooltip/hy-tooltip.md +13 -0
- package/dist/docs/components/hy-transition/hy-transition.md +25 -0
- package/dist/docs/components/hy-upload/hy-upload.md +25 -0
- package/dist/docs/components/hy-warn/hy-warn.md +14 -0
- package/dist/docs/components/hy-waterfall/hy-waterfall.md +30 -0
- package/dist/docs/components/hy-watermark/hy-watermark.md +7 -0
- package/dist/docs/components/message/TheMessage.md +17 -0
- package/dist/docs/components/yk-dialog/yk-dialog.md +7 -0
- package/dist/tags.json +1 -0
- package/dist/web-types.json +1 -0
- package/docgen.config.js +14 -0
- package/global.d.ts +101 -0
- package/package.json +29 -33
- package/web-types.config.js +7 -0
- package/web-types.json +1 -0
- package/components/dialog/TheDialog.vue +0 -128
- package/components/dialog/index.ts +0 -38
- package/components/hy-safe-bottom/hy-safe-bottom.vue +0 -60
- package/components/hy-safe-bottom/index.scss +0 -5
- package/components/message/TheMessage.vue +0 -169
- package/components/message/index.ts +0 -54
- package/components/u-form/form.js +0 -22
- package/components/u-form/hy-form.vue +0 -324
- package/components/u-form/props.js +0 -49
- package/components/u-form/schema.js +0 -1451
- package/components/u-form/u-form.vue +0 -267
- package/components/u-form/utils.js +0 -65
- package/components/u-form-item/formItem.js +0 -24
- package/components/u-form-item/hy-form-item.vue +0 -360
- package/components/u-form-item/props.js +0 -57
- package/components/u-form-item/u-form-item.vue +0 -294
|
@@ -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,6 @@
|
|
|
1
|
+
<docs>
|
|
2
|
+
从底部弹出的动作菜单面板。
|
|
3
|
+
</docs>
|
|
1
4
|
<template>
|
|
2
5
|
<view>
|
|
3
6
|
<HyPopup
|
|
@@ -102,10 +105,13 @@ export default {
|
|
|
102
105
|
</script>
|
|
103
106
|
|
|
104
107
|
<script lang="ts" setup>
|
|
108
|
+
/**
|
|
109
|
+
* 按钮组件,用于触发操作,如提交表单或打开链接
|
|
110
|
+
*/
|
|
105
111
|
import { watch, ref } from 'vue'
|
|
106
112
|
import { isArray } from '../../utils'
|
|
107
113
|
import defaultProps from './props'
|
|
108
|
-
import
|
|
114
|
+
import type { IActionSheetPanel, IActionSheetEmits, HyActionSheetProps } from './typing.d.ts'
|
|
109
115
|
|
|
110
116
|
// 组件
|
|
111
117
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
@@ -113,8 +119,8 @@ import HyPopup from '../hy-popup/hy-popup.vue'
|
|
|
113
119
|
import HyLoading from '../hy-loading/hy-loading.vue'
|
|
114
120
|
import HyButton from '../hy-button/hy-button.vue'
|
|
115
121
|
|
|
116
|
-
const props = withDefaults(defineProps<
|
|
117
|
-
const emit = defineEmits(
|
|
122
|
+
const props = withDefaults(defineProps<HyActionSheetProps>(), defaultProps)
|
|
123
|
+
const emit = defineEmits<IActionSheetEmits>()
|
|
118
124
|
|
|
119
125
|
const formatPanels = ref<Array<IActionSheetPanel> | Array<IActionSheetPanel[]>>([])
|
|
120
126
|
const showPopup = ref<boolean>(false)
|
|
@@ -32,65 +32,98 @@ export interface IActionSheetPanel {
|
|
|
32
32
|
*/
|
|
33
33
|
name: string
|
|
34
34
|
}
|
|
35
|
-
export
|
|
35
|
+
export interface HyActionSheetProps {
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 操作菜单是否展示 ( 默认 false )
|
|
38
38
|
* */
|
|
39
39
|
modelValue?: boolean
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* 菜单选项
|
|
42
42
|
* */
|
|
43
43
|
actions?: IActionSheetAction[]
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* 自定义面板项,可以为字符串数组,也可以为对象数组,如果为二维数组,则为多行展示
|
|
46
46
|
* */
|
|
47
47
|
panels?: Array<IActionSheetPanel | IActionSheetPanel[]>
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* 圆角值 (默认 20 )
|
|
50
50
|
* */
|
|
51
51
|
round?: string | number
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* 标题
|
|
54
54
|
* */
|
|
55
55
|
title?: string
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* 标题文字位置
|
|
58
58
|
* */
|
|
59
59
|
titleAlign?: HyApp.RowCenterType
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* 取消按钮的提示文字,不为空时显示按钮
|
|
62
62
|
* */
|
|
63
63
|
cancelText?: string
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* 点击某个菜单项时是否关闭弹窗 (默认 true )
|
|
66
66
|
* */
|
|
67
67
|
closeOnClickAction?: boolean
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* 点击遮罩是否允许关闭 (默认 true )
|
|
70
70
|
* */
|
|
71
71
|
closeOnClickOverlay?: boolean
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* 弹框动画持续时间 ( 默认 200 )
|
|
74
74
|
* */
|
|
75
75
|
duration?: number
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* 菜单层级 ( 默认 100 )
|
|
78
78
|
* */
|
|
79
79
|
zIndex?: number
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* 处理底部安全区 (默认 true )
|
|
82
82
|
* */
|
|
83
83
|
safeAreaInsetBottom?: boolean
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* 自定义外部样式
|
|
86
86
|
* */
|
|
87
87
|
customStyle?: CSSProperties
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* 自定义外部类名
|
|
90
90
|
* */
|
|
91
91
|
customClass?: string
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
93
|
+
* 自定义标题类名
|
|
94
94
|
* */
|
|
95
95
|
customHeaderClass?: string
|
|
96
96
|
}
|
|
97
|
+
|
|
98
|
+
interface SelectEventParams {
|
|
99
|
+
/**
|
|
100
|
+
* 选中的内容
|
|
101
|
+
* */
|
|
102
|
+
item: any
|
|
103
|
+
/**
|
|
104
|
+
* 选中的横向索引
|
|
105
|
+
* */
|
|
106
|
+
rowIndex?: number
|
|
107
|
+
/**
|
|
108
|
+
* 选中的竖列索引
|
|
109
|
+
* */
|
|
110
|
+
colIndex?: number
|
|
111
|
+
/**
|
|
112
|
+
* 选中的索引
|
|
113
|
+
* */
|
|
114
|
+
index?: number
|
|
115
|
+
}
|
|
116
|
+
export interface IActionSheetEmits {
|
|
117
|
+
/** 选中了某个动作时触发 */
|
|
118
|
+
(e: 'select', params: SelectEventParams): void
|
|
119
|
+
/** 点击取消按钮时触发 */
|
|
120
|
+
(e: 'cancel'): void
|
|
121
|
+
/** 点击遮罩或关闭按钮时触发 */
|
|
122
|
+
(e: 'close'): void
|
|
123
|
+
/** 打开面板时触发 */
|
|
124
|
+
(e: 'open'): void
|
|
125
|
+
/**
|
|
126
|
+
* 手动更新弹窗显示隐藏
|
|
127
|
+
* */
|
|
128
|
+
(e: 'update:modelValue', visible: boolean): void
|
|
129
|
+
}
|
|
@@ -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
|
-
|
|
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: {
|
|
@@ -129,23 +140,143 @@ import { computed, type CSSProperties, toRefs } from 'vue'
|
|
|
129
140
|
import { bem, throttle } from '../../utils'
|
|
130
141
|
import defaultProps from './props'
|
|
131
142
|
import { ColorConfig } from '../../config'
|
|
132
|
-
import type
|
|
143
|
+
import type { HyButtonProps, IButtonEmits } from './typing.d.ts'
|
|
133
144
|
|
|
134
145
|
// 组件
|
|
135
146
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
136
147
|
import HyLoading from '../hy-loading/hy-loading.vue'
|
|
148
|
+
import { HyApp } from 'hy-app/typing/modules/common'
|
|
137
149
|
|
|
138
|
-
|
|
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
|
+
},
|
|
277
|
+
})
|
|
139
278
|
const { disabled, loading, throttleTime, stop, size, type, plain, color, icon } = toRefs(props)
|
|
140
|
-
const emit = defineEmits(
|
|
141
|
-
'click',
|
|
142
|
-
'getphonenumber',
|
|
143
|
-
'getuserinfo',
|
|
144
|
-
'error',
|
|
145
|
-
'opensetting',
|
|
146
|
-
'launchapp',
|
|
147
|
-
'agreeprivacyauthorization',
|
|
148
|
-
])
|
|
279
|
+
const emit = defineEmits<IButtonEmits>()
|
|
149
280
|
|
|
150
281
|
const textColor = (ColorConfig as any)[type.value]
|
|
151
282
|
|