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.
- package/components/hy-action-sheet/hy-action-sheet.vue +81 -13
- package/components/hy-action-sheet/typing.d.ts +1 -3
- package/components/hy-address-picker/hy-address-picker.vue +109 -8
- package/components/hy-address-picker/index.scss +2 -2
- package/components/hy-address-picker/typing.d.ts +39 -30
- package/components/hy-avatar/hy-avatar.vue +78 -4
- package/components/hy-avatar/typing.d.ts +21 -16
- package/components/hy-back-top/hy-back-top.vue +86 -28
- package/components/hy-back-top/typing.d.ts +17 -12
- package/components/hy-badge/hy-badge.vue +114 -43
- package/components/hy-badge/typing.d.ts +20 -15
- package/components/hy-button/HyButton.docgen.js +6 -0
- package/components/hy-button/hy-button.vue +70 -77
- package/components/hy-button/props.ts +40 -41
- package/components/hy-calendar/hy-calendar.vue +290 -143
- package/components/hy-calendar/typing.d.ts +38 -31
- package/components/hy-card/hy-card.vue +139 -36
- package/components/hy-card/typing.d.ts +39 -28
- package/components/hy-cell/hy-cell.vue +131 -67
- package/components/hy-cell/typing.d.ts +6 -1
- package/components/hy-check-button/hy-check-button.vue +101 -32
- package/components/hy-check-button/typing.d.ts +26 -19
- package/components/hy-checkbox/hy-checkbox.vue +167 -78
- package/components/hy-checkbox/typing.d.ts +26 -19
- package/components/hy-code-input/hy-code-input.vue +101 -5
- package/components/hy-code-input/typing.d.ts +9 -0
- package/components/hy-config-provider/hy-config-provider.vue +44 -24
- package/components/hy-config-provider/typing.d.ts +0 -4
- package/components/hy-count-down/hy-count-down.vue +99 -62
- package/components/hy-count-down/typing.d.ts +18 -5
- package/components/hy-count-to/hy-count-to.vue +165 -113
- package/components/hy-count-to/typing.d.ts +15 -11
- package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
- package/components/hy-datetime-picker/typing.d.ts +49 -39
- package/components/hy-divider/hy-divider.vue +128 -64
- package/components/hy-divider/typing.d.ts +16 -16
- package/components/hy-dropdown/hy-dropdown.vue +57 -19
- package/components/hy-dropdown/typing.d.ts +14 -14
- package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
- package/components/hy-dropdown-item/typing.d.ts +13 -6
- package/components/hy-empty/hy-empty.vue +64 -6
- package/components/hy-empty/typing.d.ts +5 -0
- package/components/hy-float-button/hy-float-button.vue +117 -5
- package/components/hy-float-button/typing.d.ts +7 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
- package/components/hy-folding-panel/typing.d.ts +24 -15
- package/components/hy-grid/hy-grid.vue +95 -35
- package/components/hy-grid/typing.d.ts +24 -19
- package/components/hy-icon/hy-icon.vue +84 -6
- package/components/hy-icon/typing.d.ts +5 -0
- package/components/hy-image/hy-image.vue +105 -6
- package/components/hy-image/typing.d.ts +9 -0
- package/components/hy-input/hy-input.vue +277 -130
- package/components/hy-input/props.ts +13 -14
- package/components/hy-input/typing.d.ts +59 -38
- package/components/hy-line/hy-line.vue +65 -25
- package/components/hy-line-progress/hy-line-progress.vue +68 -35
- package/components/hy-list/hy-list.vue +127 -61
- package/components/hy-list/typing.d.ts +19 -12
- package/components/hy-loading/hy-loading.vue +79 -25
- package/components/hy-menu/hy-menu.vue +69 -45
- package/components/hy-menu/typing.d.ts +22 -15
- package/components/hy-modal/hy-modal.vue +91 -4
- package/components/hy-modal/typing.d.ts +11 -0
- package/components/hy-navbar/hy-navbar.vue +105 -25
- package/components/hy-navbar/typing.d.ts +25 -20
- package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
- package/components/hy-notice-bar/typing.d.ts +22 -17
- package/components/hy-notify/hy-notify.vue +106 -54
- package/components/hy-number-step/hy-number-step.vue +211 -120
- package/components/hy-number-step/typing.d.ts +45 -28
- package/components/hy-overlay/hy-overlay.vue +60 -16
- package/components/hy-overlay/typing.d.ts +11 -6
- package/components/hy-pagination/hy-pagination.vue +94 -37
- package/components/hy-pagination/typing.d.ts +20 -11
- package/components/hy-picker/hy-picker.vue +225 -160
- package/components/hy-picker/typing.d.ts +51 -28
- package/components/hy-popover/hy-popover.vue +55 -7
- package/components/hy-popover/typing.d.ts +21 -1
- package/components/hy-popup/hy-popup.vue +164 -99
- package/components/hy-popup/typing.d.ts +11 -0
- package/components/hy-price/hy-price.vue +77 -30
- package/components/hy-price/typing.d.ts +10 -10
- package/components/hy-qrcode/hy-qrcode.vue +75 -5
- package/components/hy-qrcode/typing.d.ts +25 -16
- package/components/hy-radio/hy-radio.vue +169 -88
- package/components/hy-radio/typing.d.ts +29 -22
- package/components/hy-rate/hy-rate.vue +155 -104
- package/components/hy-rate/typing.d.ts +23 -16
- package/components/hy-read-more/hy-read-more.vue +83 -56
- package/components/hy-read-more/typing.d.ts +18 -11
- package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
- package/components/hy-scroll-list/typing.d.ts +14 -7
- package/components/hy-search/hy-search.vue +168 -62
- package/components/hy-search/typing.d.ts +47 -26
- package/components/hy-signature/hy-signature.vue +354 -272
- package/components/hy-signature/typing.d.ts +65 -52
- package/components/hy-slider/hy-slider.vue +208 -160
- package/components/hy-slider/typing.d.ts +28 -17
- package/components/hy-steps/hy-steps.vue +125 -99
- package/components/hy-steps/typing.d.ts +21 -14
- package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
- package/components/hy-submit-bar/typing.d.ts +30 -23
- package/components/hy-subsection/hy-subsection.vue +139 -96
- package/components/hy-subsection/typing.d.ts +23 -16
- package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
- package/components/hy-swipe-action/typing.d.ts +26 -17
- package/components/hy-swiper/hy-swiper.vue +178 -73
- package/components/hy-swiper/typing.d.ts +37 -28
- package/components/hy-switch/hy-switch.vue +107 -60
- package/components/hy-switch/typing.d.ts +25 -18
- package/components/hy-tabs/hy-tabs.vue +170 -160
- package/components/hy-tabs/typing.d.ts +36 -22
- package/components/hy-tag/hy-tag.vue +133 -58
- package/components/hy-tag/typing.d.ts +26 -18
- package/components/hy-text/hy-text.vue +106 -6
- package/components/hy-text/typing.d.ts +31 -26
- package/components/hy-textarea/hy-textarea.vue +183 -89
- package/components/hy-textarea/typing.d.ts +41 -24
- package/components/hy-tooltip/hy-tooltip.vue +145 -101
- package/components/hy-tooltip/typing.d.ts +18 -13
- package/components/hy-transition/hy-transition.vue +48 -13
- package/components/hy-transition/typing.d.ts +17 -0
- package/components/hy-upload/hy-upload.vue +113 -148
- package/components/hy-upload/typing.d.ts +71 -71
- package/components/hy-warn/hy-warn.vue +79 -36
- package/components/hy-warn/typing.d.ts +18 -11
- package/components/hy-waterfall/hy-waterfall.vue +90 -77
- package/components/hy-watermark/hy-watermark.vue +82 -5
- package/components/hy-watermark/typing.d.ts +20 -20
- package/global.d.ts +39 -59
- package/package.json +5 -13
- package/utils/inspect.ts +3 -1
- package/web-types.json +1 -1
- package/component-helper.ts +0 -177
- package/components.json +0 -3287
- package/dist/attributes.json +0 -1
- package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
- package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
- package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
- package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
- package/dist/docs/components/hy-badge/hy-badge.md +0 -13
- package/dist/docs/components/hy-button/hy-button.md +0 -61
- package/dist/docs/components/hy-calendar/header.md +0 -17
- package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
- package/dist/docs/components/hy-calendar/month.md +0 -38
- package/dist/docs/components/hy-card/hy-card.md +0 -24
- package/dist/docs/components/hy-cell/hy-cell.md +0 -26
- package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
- package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
- package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
- package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
- package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
- package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
- package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
- package/dist/docs/components/hy-divider/hy-divider.md +0 -13
- package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
- package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
- package/dist/docs/components/hy-empty/hy-empty.md +0 -20
- package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
- package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
- package/dist/docs/components/hy-form/hy-form.md +0 -29
- package/dist/docs/components/hy-grid/hy-grid.md +0 -19
- package/dist/docs/components/hy-icon/hy-icon.md +0 -13
- package/dist/docs/components/hy-image/hy-image.md +0 -22
- package/dist/docs/components/hy-input/hy-input.md +0 -29
- package/dist/docs/components/hy-line/hy-line.md +0 -7
- package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
- package/dist/docs/components/hy-list/hy-list.md +0 -25
- package/dist/docs/components/hy-loading/hy-loading.md +0 -14
- package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
- package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
- package/dist/docs/components/hy-login/hy-login.md +0 -14
- package/dist/docs/components/hy-menu/hy-menu.md +0 -21
- package/dist/docs/components/hy-modal/hy-modal.md +0 -23
- package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
- package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
- package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
- package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
- package/dist/docs/components/hy-notify/hy-notify.md +0 -23
- package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
- package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
- package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
- package/dist/docs/components/hy-parse/hy-parse.md +0 -46
- package/dist/docs/components/hy-parse/node/node.md +0 -7
- package/dist/docs/components/hy-picker/hy-picker.md +0 -32
- package/dist/docs/components/hy-popover/hy-popover.md +0 -34
- package/dist/docs/components/hy-popup/hy-popup.md +0 -22
- package/dist/docs/components/hy-price/hy-price.md +0 -13
- package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
- package/dist/docs/components/hy-radio/hy-radio.md +0 -21
- package/dist/docs/components/hy-rate/hy-rate.md +0 -14
- package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
- package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
- package/dist/docs/components/hy-search/hy-search.md +0 -27
- package/dist/docs/components/hy-signature/hy-signature.md +0 -45
- package/dist/docs/components/hy-slider/hy-slider.md +0 -24
- package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
- package/dist/docs/components/hy-steps/hy-steps.md +0 -23
- package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
- package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
- package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
- package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
- package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
- package/dist/docs/components/hy-switch/hy-switch.md +0 -20
- package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
- package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
- package/dist/docs/components/hy-tag/hy-tag.md +0 -21
- package/dist/docs/components/hy-text/hy-text.md +0 -13
- package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
- package/dist/docs/components/hy-toast/hy-toast.md +0 -17
- package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
- package/dist/docs/components/hy-transition/hy-transition.md +0 -25
- package/dist/docs/components/hy-upload/hy-upload.md +0 -25
- package/dist/docs/components/hy-warn/hy-warn.md +0 -14
- package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
- package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
- package/dist/docs/components/message/TheMessage.md +0 -17
- package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
- package/dist/tags.json +0 -1
- package/dist/web-types.json +0 -1
- package/docgen.config.js +0 -14
- package/web-types.config.js +0 -7
|
@@ -1,108 +1,131 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
2
|
-
import type HyInputProps from
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
|
+
import type HyInputProps from '../hy-input/typing'
|
|
3
3
|
|
|
4
|
-
interface PickerColumnVo extends AnyObject {
|
|
4
|
+
export interface PickerColumnVo extends AnyObject {
|
|
5
5
|
/**
|
|
6
6
|
* @description id必填
|
|
7
7
|
* */
|
|
8
|
-
id: string
|
|
8
|
+
id: string
|
|
9
9
|
/**
|
|
10
10
|
* @description 显示文本
|
|
11
11
|
* */
|
|
12
|
-
text?: string
|
|
12
|
+
text?: string
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export default interface HyPickerProps {
|
|
16
16
|
/**
|
|
17
17
|
* @description 显示到输入框值
|
|
18
18
|
* */
|
|
19
|
-
modelValue?: string | string[]
|
|
19
|
+
modelValue?: string | string[]
|
|
20
20
|
/**
|
|
21
21
|
* @description 对象数组,设置每一列的数据
|
|
22
22
|
* */
|
|
23
|
-
columns: (string | PickerColumnVo)[][]
|
|
23
|
+
columns: (string | PickerColumnVo)[][]
|
|
24
24
|
/**
|
|
25
25
|
* @description 是否显示弹窗(默认 false )
|
|
26
26
|
* */
|
|
27
|
-
show?: boolean
|
|
27
|
+
show?: boolean
|
|
28
28
|
/**
|
|
29
29
|
* @description 弹窗弹出模式
|
|
30
30
|
* */
|
|
31
|
-
popupMode?: HyApp.LayoutType
|
|
31
|
+
popupMode?: HyApp.LayoutType
|
|
32
32
|
/**
|
|
33
33
|
* @description 分割数组条件
|
|
34
34
|
* */
|
|
35
|
-
separator?: string
|
|
35
|
+
separator?: string
|
|
36
36
|
/**
|
|
37
37
|
* @description 是否显示顶部的操作栏(默认 true )
|
|
38
38
|
* */
|
|
39
|
-
showToolbar?: boolean
|
|
39
|
+
showToolbar?: boolean
|
|
40
40
|
/**
|
|
41
41
|
* @description 顶部标题
|
|
42
42
|
* */
|
|
43
|
-
title?: string
|
|
43
|
+
title?: string
|
|
44
44
|
/**
|
|
45
45
|
* @description 是否显示加载中状态(默认 false )
|
|
46
46
|
* */
|
|
47
|
-
loading?: boolean
|
|
47
|
+
loading?: boolean
|
|
48
48
|
/**
|
|
49
49
|
* @description 各列中,单个选项的高度(默认 44 )
|
|
50
50
|
* */
|
|
51
|
-
itemHeight?: number
|
|
51
|
+
itemHeight?: number
|
|
52
52
|
/**
|
|
53
53
|
* @description 取消按钮的文字(默认 '取消' )
|
|
54
54
|
* */
|
|
55
|
-
cancelText?: string
|
|
55
|
+
cancelText?: string
|
|
56
56
|
/**
|
|
57
57
|
* @description 确认按钮的文字(默认 '确定' )
|
|
58
58
|
* */
|
|
59
|
-
confirmText?: string
|
|
59
|
+
confirmText?: string
|
|
60
60
|
/**
|
|
61
61
|
* @description 取消按钮的颜色(默认 '#909193' )
|
|
62
62
|
* */
|
|
63
|
-
cancelColor?: string
|
|
63
|
+
cancelColor?: string
|
|
64
64
|
/**
|
|
65
65
|
* @description 确认按钮的颜色(默认 '#3c9cff' )
|
|
66
66
|
* */
|
|
67
|
-
confirmColor?: string
|
|
67
|
+
confirmColor?: string
|
|
68
68
|
/**
|
|
69
69
|
* @description 每列中可见选项的数量(默认 5 )
|
|
70
70
|
* */
|
|
71
|
-
visibleItemCount?: number
|
|
71
|
+
visibleItemCount?: number
|
|
72
72
|
/**
|
|
73
73
|
* @description 选项对象中,需要展示的属性键名(默认 'text' )
|
|
74
74
|
* */
|
|
75
|
-
keyName?: string
|
|
75
|
+
keyName?: string
|
|
76
76
|
/**
|
|
77
77
|
* @description 是否允许点击遮罩关闭选择器(默认 false )
|
|
78
78
|
* */
|
|
79
|
-
closeOnClickOverlay?: boolean
|
|
79
|
+
closeOnClickOverlay?: boolean
|
|
80
80
|
/**
|
|
81
81
|
* @description 各列的默认索引
|
|
82
82
|
* */
|
|
83
|
-
defaultIndex?: number[]
|
|
83
|
+
defaultIndex?: number[]
|
|
84
84
|
/**
|
|
85
85
|
* @description 是否在手指松开时立即触发change事件(默认 true )
|
|
86
86
|
* */
|
|
87
|
-
immediateChange?: boolean
|
|
87
|
+
immediateChange?: boolean
|
|
88
88
|
/**
|
|
89
89
|
* @description 最高层级
|
|
90
90
|
* */
|
|
91
|
-
zIndex?: number
|
|
91
|
+
zIndex?: number
|
|
92
92
|
/**
|
|
93
93
|
* @description 是否显示输入框(默认 false )
|
|
94
94
|
* */
|
|
95
|
-
hasInput?: boolean
|
|
95
|
+
hasInput?: boolean
|
|
96
96
|
/**
|
|
97
97
|
* @description 输入框集合属性
|
|
98
98
|
* */
|
|
99
|
-
input?: Partial<HyInputProps
|
|
99
|
+
input?: Partial<HyInputProps>
|
|
100
100
|
/**
|
|
101
101
|
* @description 是否自定义选择器nav左边内容
|
|
102
102
|
* */
|
|
103
|
-
toolbarRightSlot?: boolean
|
|
103
|
+
toolbarRightSlot?: boolean
|
|
104
104
|
/**
|
|
105
105
|
* @description 自定义输入框外部样式
|
|
106
106
|
* */
|
|
107
|
-
customStyle?: CSSProperties
|
|
107
|
+
customStyle?: CSSProperties
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type SelectValueVo = {
|
|
111
|
+
value: string[]
|
|
112
|
+
index?: number
|
|
113
|
+
indexs?: number[]
|
|
114
|
+
// values为当前变化列的数组内容
|
|
115
|
+
values?: Array<any>
|
|
116
|
+
columnIndex?: Array<number>
|
|
117
|
+
}
|
|
118
|
+
export interface IPickerEmits {
|
|
119
|
+
/** 关闭选择器时触发 */
|
|
120
|
+
(e: 'close'): void
|
|
121
|
+
/** 点击取消按钮 */
|
|
122
|
+
(e: 'cancel'): void
|
|
123
|
+
/** 点击确定按钮,返回当前选择的值 */
|
|
124
|
+
(e: 'confirm', params: SelectValueVo): void
|
|
125
|
+
/** 当选择值变化时触发 */
|
|
126
|
+
(e: 'change', params: SelectValueVo): void
|
|
127
|
+
/** 显示隐藏触发 */
|
|
128
|
+
(e: 'update:show', show: boolean): void
|
|
129
|
+
/** 选中值触发 */
|
|
130
|
+
(e: 'update:modelValue', value: any): void
|
|
108
131
|
}
|
|
@@ -52,7 +52,10 @@
|
|
|
52
52
|
<!-- 普通模式 -->
|
|
53
53
|
|
|
54
54
|
<!-- 列表模式 -->
|
|
55
|
-
<view
|
|
55
|
+
<view
|
|
56
|
+
v-if="!slots.content && mode === 'menu' && Array.isArray(content)"
|
|
57
|
+
class="hy-popover__menu"
|
|
58
|
+
>
|
|
56
59
|
<view
|
|
57
60
|
v-for="(item, index) in content"
|
|
58
61
|
:key="index"
|
|
@@ -61,8 +64,8 @@
|
|
|
61
64
|
:style="index === 0 ? 'border-top: none' : ''"
|
|
62
65
|
>
|
|
63
66
|
<hy-icon
|
|
64
|
-
v-if="typeof item === 'object' && item.
|
|
65
|
-
:name="item.
|
|
67
|
+
v-if="typeof item === 'object' && item.icon"
|
|
68
|
+
:name="item.icon"
|
|
66
69
|
custom-class="hy-popover__icon"
|
|
67
70
|
/>
|
|
68
71
|
<view style="display: inline-block">
|
|
@@ -90,6 +93,11 @@
|
|
|
90
93
|
</template>
|
|
91
94
|
|
|
92
95
|
<script lang="ts">
|
|
96
|
+
/**
|
|
97
|
+
* 常用于展示提示信息。
|
|
98
|
+
* @displayName hy-popover
|
|
99
|
+
*/
|
|
100
|
+
defineOptions({})
|
|
93
101
|
export default {
|
|
94
102
|
name: 'hy-popover',
|
|
95
103
|
options: {
|
|
@@ -111,9 +119,9 @@ import {
|
|
|
111
119
|
useSlots,
|
|
112
120
|
watch,
|
|
113
121
|
inject,
|
|
122
|
+
PropType,
|
|
114
123
|
} from 'vue'
|
|
115
|
-
import
|
|
116
|
-
import IProps, { type PopoverExpose } from './typing'
|
|
124
|
+
import type { IOffset, IPopoverEmits, PopoverContentVo, PopoverExpose } from './typing'
|
|
117
125
|
import { isArray } from '../../utils'
|
|
118
126
|
import { type Queue, queueKey, usePopover } from '../../composables'
|
|
119
127
|
import { closeOther, pushToQueue, removeFromQueue } from '../../common'
|
|
@@ -122,9 +130,49 @@ import { closeOther, pushToQueue, removeFromQueue } from '../../common'
|
|
|
122
130
|
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
123
131
|
import HyTransition from '../hy-transition/hy-transition.vue'
|
|
124
132
|
|
|
125
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
133
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
134
|
+
const props = defineProps({
|
|
135
|
+
/** 控制 popover 的显示状态 */
|
|
136
|
+
modelValue: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: false,
|
|
139
|
+
},
|
|
140
|
+
/** 显示的内容,也可以通过 slot#content 传入 */
|
|
141
|
+
content: [String, Array],
|
|
142
|
+
/**
|
|
143
|
+
* 指定 popover 的放置位置
|
|
144
|
+
* @values top,top-start,top-end,bottom,bottom-start,bottom-end,left,left-start,left-end,right,right-start,right-end
|
|
145
|
+
* */
|
|
146
|
+
placement: {
|
|
147
|
+
type: String,
|
|
148
|
+
default: 'bottom',
|
|
149
|
+
},
|
|
150
|
+
/** 控制 popover 的显示状态 */
|
|
151
|
+
offset: {
|
|
152
|
+
type: [Number, Array, Object] as PropType<IOffset>,
|
|
153
|
+
default: 0,
|
|
154
|
+
},
|
|
155
|
+
/** 是否显示关闭按钮 */
|
|
156
|
+
showClose: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: false,
|
|
159
|
+
},
|
|
160
|
+
/** 是否禁用 popover */
|
|
161
|
+
disabled: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false,
|
|
164
|
+
},
|
|
165
|
+
/**
|
|
166
|
+
* 当前显示的模式,决定内容的展现形式
|
|
167
|
+
* @values normal,menu
|
|
168
|
+
* */
|
|
169
|
+
mode: {
|
|
170
|
+
type: String,
|
|
171
|
+
default: 'normal',
|
|
172
|
+
},
|
|
173
|
+
})
|
|
126
174
|
const { modelValue, content, mode, placement } = toRefs(props)
|
|
127
|
-
const emit = defineEmits(
|
|
175
|
+
const emit = defineEmits<IPopoverEmits>()
|
|
128
176
|
|
|
129
177
|
const slots = useSlots()
|
|
130
178
|
const queue = inject<Queue | null>(queueKey, null)
|
|
@@ -19,6 +19,11 @@ export type PopoverExpose = {
|
|
|
19
19
|
open: () => void
|
|
20
20
|
close: () => void
|
|
21
21
|
}
|
|
22
|
+
export interface PopoverContentVo {
|
|
23
|
+
iconClass: string
|
|
24
|
+
content: string
|
|
25
|
+
icon: string
|
|
26
|
+
}
|
|
22
27
|
|
|
23
28
|
export default interface HyOverlayProps {
|
|
24
29
|
/**
|
|
@@ -28,7 +33,7 @@ export default interface HyOverlayProps {
|
|
|
28
33
|
/**
|
|
29
34
|
* @description 显示的内容,也可以通过 slot#content 传入
|
|
30
35
|
*/
|
|
31
|
-
content?: string |
|
|
36
|
+
content?: string | (string | PopoverContentVo)[]
|
|
32
37
|
/**
|
|
33
38
|
* @description 指定 popover 的放置位置:top / top-start / top-end / bottom / bottom-start / bottom-end / left / left-start / left-end / right / right-start / right-end
|
|
34
39
|
*/
|
|
@@ -58,3 +63,18 @@ export default interface HyOverlayProps {
|
|
|
58
63
|
* */
|
|
59
64
|
customClass?: string
|
|
60
65
|
}
|
|
66
|
+
|
|
67
|
+
export type PopoverParamsVo = {
|
|
68
|
+
show: boolean
|
|
69
|
+
}
|
|
70
|
+
export type PopoverItemParamsVo = {
|
|
71
|
+
item: Record<string, any>
|
|
72
|
+
index: number
|
|
73
|
+
}
|
|
74
|
+
export interface IPopoverEmits {
|
|
75
|
+
(e: 'menuClick', params: PopoverItemParamsVo): void
|
|
76
|
+
(e: 'change', params: PopoverParamsVo): void
|
|
77
|
+
(e: 'open'): void
|
|
78
|
+
(e: 'close'): void
|
|
79
|
+
(e: 'update:modelValue', value: boolean): void
|
|
80
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="hy-popup">
|
|
2
|
+
<view :class="['hy-popup', customClass]">
|
|
3
3
|
<HyOverlay
|
|
4
4
|
:show="show"
|
|
5
5
|
@click="overlayClick"
|
|
@@ -29,12 +29,7 @@
|
|
|
29
29
|
hover-class="hy-popup__content__close--hover"
|
|
30
30
|
hover-stay-time="150"
|
|
31
31
|
>
|
|
32
|
-
<HyIcon
|
|
33
|
-
:name="IconConfig.CLOSE"
|
|
34
|
-
color="#909399"
|
|
35
|
-
size="18"
|
|
36
|
-
bold
|
|
37
|
-
></HyIcon>
|
|
32
|
+
<HyIcon :name="IconConfig.CLOSE" color="#909399" size="18" bold></HyIcon>
|
|
38
33
|
</view>
|
|
39
34
|
<!-- <hy-safe-bottom v-if="safeAreaInsetBottom"></hy-safe-bottom>-->
|
|
40
35
|
</view>
|
|
@@ -43,43 +38,113 @@
|
|
|
43
38
|
</template>
|
|
44
39
|
|
|
45
40
|
<script lang="ts">
|
|
41
|
+
/**
|
|
42
|
+
* 弹出层容器,用于展示弹窗、信息提示等内容,支持上、下、左、右和中部弹出。组件只提供容器,内部内容由用户自定义。
|
|
43
|
+
* @displayName hy-popup
|
|
44
|
+
*/
|
|
45
|
+
defineOptions({})
|
|
46
46
|
export default {
|
|
47
47
|
name: 'hy-popup',
|
|
48
48
|
options: {
|
|
49
49
|
addGlobalClass: true,
|
|
50
50
|
virtualHost: true,
|
|
51
|
-
styleIsolation: 'shared'
|
|
52
|
-
}
|
|
51
|
+
styleIsolation: 'shared',
|
|
52
|
+
},
|
|
53
53
|
}
|
|
54
54
|
</script>
|
|
55
55
|
|
|
56
56
|
<script setup lang="ts">
|
|
57
|
-
import { computed, type CSSProperties, ref, toRefs, watch } from
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import {
|
|
61
|
-
import { IconConfig } from "../../config";
|
|
57
|
+
import { computed, type CSSProperties, PropType, ref, toRefs, watch } from 'vue'
|
|
58
|
+
import type { IPopupEmits } from './typing'
|
|
59
|
+
import { addUnit, getWindowInfo } from '../../utils'
|
|
60
|
+
import { IconConfig } from '../../config'
|
|
62
61
|
|
|
63
62
|
// 组件
|
|
64
|
-
import HyTransition from
|
|
65
|
-
import HyOverlay from
|
|
66
|
-
import HyIcon from
|
|
63
|
+
import HyTransition from '../hy-transition/hy-transition.vue'
|
|
64
|
+
import HyOverlay from '../hy-overlay/hy-overlay.vue'
|
|
65
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
67
66
|
|
|
68
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
69
|
-
const {
|
|
70
|
-
|
|
71
|
-
show
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
67
|
+
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
68
|
+
const props = defineProps({
|
|
69
|
+
/** 是否展示弹窗 */
|
|
70
|
+
show: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false,
|
|
73
|
+
},
|
|
74
|
+
/** 是否显示遮罩 */
|
|
75
|
+
overlay: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true,
|
|
78
|
+
},
|
|
79
|
+
/** 弹出方向 */
|
|
80
|
+
mode: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: 'bottom',
|
|
83
|
+
},
|
|
84
|
+
/** 动画时长,单位ms */
|
|
85
|
+
duration: {
|
|
86
|
+
type: Number,
|
|
87
|
+
default: 300,
|
|
88
|
+
},
|
|
89
|
+
/** 是否显示关闭图标 */
|
|
90
|
+
closeable: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: false,
|
|
93
|
+
},
|
|
94
|
+
/** 自定义遮罩的样式 */
|
|
95
|
+
overlayStyle: Object as PropType<CSSProperties>,
|
|
96
|
+
/** 遮罩透明度,0-1之间 */
|
|
97
|
+
overlayOpacity: {
|
|
98
|
+
type: Number,
|
|
99
|
+
default: 0.5,
|
|
100
|
+
},
|
|
101
|
+
/** 点击遮罩是否关闭弹窗 */
|
|
102
|
+
closeOnClickOverlay: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: true,
|
|
105
|
+
},
|
|
106
|
+
/** 弹窗层级 */
|
|
107
|
+
zIndex: {
|
|
108
|
+
type: Number,
|
|
109
|
+
default: 10086,
|
|
110
|
+
},
|
|
111
|
+
/** 是否为iPhoneX留出底部安全距离 */
|
|
112
|
+
safeAreaInsetBottom: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: true,
|
|
115
|
+
},
|
|
116
|
+
/** 是否留出顶部安全距离 */
|
|
117
|
+
safeAreaInsetTop: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: false,
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* 自定义关闭图标位置
|
|
123
|
+
* @values top-left,top-right
|
|
124
|
+
* */
|
|
125
|
+
closeIconPos: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: 'top-right',
|
|
128
|
+
},
|
|
129
|
+
/** 圆角值 */
|
|
130
|
+
round: String,
|
|
131
|
+
/** 当mode=center时 是否开启缩放 */
|
|
132
|
+
zoom: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: true,
|
|
135
|
+
},
|
|
136
|
+
/** 背景颜色 */
|
|
137
|
+
bgColor: String,
|
|
138
|
+
/** 定义需要用到的外部样式 */
|
|
139
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
140
|
+
/** 自定义外部类名 */
|
|
141
|
+
customClass: String,
|
|
142
|
+
})
|
|
143
|
+
const { duration, show, closeOnClickOverlay, mode, zIndex, bgColor, round, customStyle, zoom } =
|
|
144
|
+
toRefs(props)
|
|
145
|
+
const emit = defineEmits<IPopupEmits>()
|
|
81
146
|
|
|
82
|
-
const overlayDuration = ref(duration.value + 50)
|
|
147
|
+
const overlayDuration = ref(duration.value + 50)
|
|
83
148
|
|
|
84
149
|
watch(
|
|
85
150
|
() => show.value,
|
|
@@ -91,117 +156,117 @@ watch(
|
|
|
91
156
|
// #endif
|
|
92
157
|
}
|
|
93
158
|
},
|
|
94
|
-
)
|
|
159
|
+
)
|
|
95
160
|
|
|
96
161
|
const transitionStyle = computed(() => {
|
|
97
162
|
const style: CSSProperties = {
|
|
98
163
|
zIndex: zIndex.value,
|
|
99
|
-
position:
|
|
100
|
-
display:
|
|
101
|
-
}
|
|
102
|
-
if (mode.value !==
|
|
103
|
-
style[mode.value] = 0
|
|
164
|
+
position: 'fixed',
|
|
165
|
+
display: 'flex',
|
|
166
|
+
}
|
|
167
|
+
if (mode.value !== 'center') {
|
|
168
|
+
style[mode.value] = 0
|
|
104
169
|
}
|
|
105
170
|
switch (mode.value) {
|
|
106
|
-
case
|
|
107
|
-
case
|
|
108
|
-
style.bottom = 0
|
|
109
|
-
style.top = 0
|
|
110
|
-
break
|
|
111
|
-
case
|
|
112
|
-
case
|
|
113
|
-
style.left = 0
|
|
114
|
-
style.right = 0
|
|
115
|
-
break
|
|
116
|
-
case
|
|
171
|
+
case 'left':
|
|
172
|
+
case 'right':
|
|
173
|
+
style.bottom = 0
|
|
174
|
+
style.top = 0
|
|
175
|
+
break
|
|
176
|
+
case 'top':
|
|
177
|
+
case 'bottom':
|
|
178
|
+
style.left = 0
|
|
179
|
+
style.right = 0
|
|
180
|
+
break
|
|
181
|
+
case 'center':
|
|
117
182
|
Object.assign(style, {
|
|
118
|
-
alignItems:
|
|
119
|
-
|
|
183
|
+
alignItems: 'center',
|
|
184
|
+
'justify-content': 'center',
|
|
120
185
|
top: 0,
|
|
121
186
|
left: 0,
|
|
122
187
|
right: 0,
|
|
123
188
|
bottom: 0,
|
|
124
|
-
})
|
|
125
|
-
break
|
|
189
|
+
})
|
|
190
|
+
break
|
|
126
191
|
default:
|
|
127
|
-
break
|
|
192
|
+
break
|
|
128
193
|
}
|
|
129
194
|
|
|
130
|
-
return style
|
|
131
|
-
})
|
|
195
|
+
return style
|
|
196
|
+
})
|
|
132
197
|
const contentStyle = computed(() => {
|
|
133
|
-
const style: CSSProperties = {}
|
|
198
|
+
const style: CSSProperties = {}
|
|
134
199
|
// 通过设备信息的safeAreaInsets值来判断是否需要预留顶部状态栏和底部安全局的位置
|
|
135
200
|
// 不使用css方案,是因为nvue不支持css的iPhoneX安全区查询属性
|
|
136
|
-
const { safeAreaInsets } = getWindowInfo()
|
|
137
|
-
if (mode.value !==
|
|
138
|
-
style.flex = 1
|
|
201
|
+
const { safeAreaInsets } = getWindowInfo()
|
|
202
|
+
if (mode.value !== 'center') {
|
|
203
|
+
style.flex = 1
|
|
139
204
|
}
|
|
140
205
|
// 背景色,一般用于设置为transparent,去除默认的白色背景
|
|
141
206
|
if (bgColor.value) {
|
|
142
|
-
style.backgroundColor = bgColor.value
|
|
207
|
+
style.backgroundColor = bgColor.value
|
|
143
208
|
}
|
|
144
209
|
if (round.value) {
|
|
145
|
-
const value = addUnit(round.value)
|
|
210
|
+
const value = addUnit(round.value)
|
|
146
211
|
switch (mode.value) {
|
|
147
|
-
case
|
|
148
|
-
style.borderBottomLeftRadius = value
|
|
149
|
-
style.borderBottomRightRadius = value
|
|
150
|
-
break
|
|
151
|
-
case
|
|
152
|
-
style.borderTopLeftRadius = value
|
|
153
|
-
style.borderTopRightRadius = value
|
|
154
|
-
break
|
|
155
|
-
case
|
|
156
|
-
style.borderRadius = value
|
|
157
|
-
break
|
|
212
|
+
case 'top':
|
|
213
|
+
style.borderBottomLeftRadius = value
|
|
214
|
+
style.borderBottomRightRadius = value
|
|
215
|
+
break
|
|
216
|
+
case 'bottom':
|
|
217
|
+
style.borderTopLeftRadius = value
|
|
218
|
+
style.borderTopRightRadius = value
|
|
219
|
+
break
|
|
220
|
+
case 'center':
|
|
221
|
+
style.borderRadius = value
|
|
222
|
+
break
|
|
158
223
|
default:
|
|
159
|
-
break
|
|
224
|
+
break
|
|
160
225
|
}
|
|
161
226
|
}
|
|
162
|
-
return Object.assign(style, customStyle.value || {})
|
|
163
|
-
})
|
|
227
|
+
return Object.assign(style, customStyle.value || {})
|
|
228
|
+
})
|
|
164
229
|
const positionMode = computed(() => {
|
|
165
|
-
if (mode.value ===
|
|
166
|
-
return zoom.value ?
|
|
230
|
+
if (mode.value === 'center') {
|
|
231
|
+
return zoom.value ? 'fade-zoom' : 'fade'
|
|
167
232
|
}
|
|
168
|
-
if (mode.value ===
|
|
169
|
-
return
|
|
233
|
+
if (mode.value === 'left') {
|
|
234
|
+
return 'slide-left'
|
|
170
235
|
}
|
|
171
|
-
if (mode.value ===
|
|
172
|
-
return
|
|
236
|
+
if (mode.value === 'right') {
|
|
237
|
+
return 'slide-right'
|
|
173
238
|
}
|
|
174
|
-
if (mode.value ===
|
|
175
|
-
return
|
|
239
|
+
if (mode.value === 'bottom') {
|
|
240
|
+
return 'slide-up'
|
|
176
241
|
}
|
|
177
|
-
if (mode.value ===
|
|
178
|
-
return
|
|
242
|
+
if (mode.value === 'top') {
|
|
243
|
+
return 'slide-down'
|
|
179
244
|
}
|
|
180
|
-
})
|
|
245
|
+
})
|
|
181
246
|
|
|
182
247
|
// 点击遮罩
|
|
183
248
|
const overlayClick = () => {
|
|
184
249
|
if (closeOnClickOverlay.value) {
|
|
185
|
-
emit(
|
|
186
|
-
emit(
|
|
250
|
+
emit('update:show', false)
|
|
251
|
+
emit('close')
|
|
187
252
|
}
|
|
188
|
-
}
|
|
253
|
+
}
|
|
189
254
|
const close = () => {
|
|
190
|
-
emit(
|
|
191
|
-
emit(
|
|
192
|
-
}
|
|
255
|
+
emit('update:show', false)
|
|
256
|
+
emit('close')
|
|
257
|
+
}
|
|
193
258
|
const afterEnter = () => {
|
|
194
|
-
emit(
|
|
195
|
-
}
|
|
259
|
+
emit('open')
|
|
260
|
+
}
|
|
196
261
|
const clickHandler = () => {
|
|
197
262
|
// 由于中部弹出时,其u-transition占据了整个页面相当于遮罩,此时需要发出遮罩点击事件,是否无法通过点击遮罩关闭弹窗
|
|
198
|
-
if (mode.value ===
|
|
199
|
-
overlayClick()
|
|
263
|
+
if (mode.value === 'center') {
|
|
264
|
+
overlayClick()
|
|
200
265
|
}
|
|
201
|
-
emit(
|
|
202
|
-
}
|
|
266
|
+
emit('click')
|
|
267
|
+
}
|
|
203
268
|
</script>
|
|
204
269
|
|
|
205
270
|
<style lang="scss" scoped>
|
|
206
|
-
@import
|
|
271
|
+
@import './index.scss';
|
|
207
272
|
</style>
|
|
@@ -66,3 +66,14 @@ export default interface HyPopupProps {
|
|
|
66
66
|
* */
|
|
67
67
|
customStyle?: CSSProperties
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
export interface IPopupEmits {
|
|
71
|
+
/** 弹出层打开触发 */
|
|
72
|
+
(e: 'open'): void
|
|
73
|
+
/** 弹出层关闭触发 */
|
|
74
|
+
(e: 'close'): void
|
|
75
|
+
/** 弹出层点击触发 */
|
|
76
|
+
(e: 'click'): void
|
|
77
|
+
/** 显示隐藏触发 */
|
|
78
|
+
(e: 'update:show', visible: boolean): void
|
|
79
|
+
}
|