hy-app 0.2.13 → 0.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/components/hy-action-sheet/hy-action-sheet.vue +81 -13
  2. package/components/hy-action-sheet/typing.d.ts +1 -3
  3. package/components/hy-address-picker/hy-address-picker.vue +109 -8
  4. package/components/hy-address-picker/index.scss +2 -2
  5. package/components/hy-address-picker/typing.d.ts +39 -30
  6. package/components/hy-avatar/hy-avatar.vue +78 -4
  7. package/components/hy-avatar/typing.d.ts +21 -16
  8. package/components/hy-back-top/hy-back-top.vue +86 -28
  9. package/components/hy-back-top/typing.d.ts +17 -12
  10. package/components/hy-badge/hy-badge.vue +114 -43
  11. package/components/hy-badge/typing.d.ts +20 -15
  12. package/components/hy-button/HyButton.docgen.js +6 -0
  13. package/components/hy-button/hy-button.vue +70 -77
  14. package/components/hy-button/props.ts +40 -41
  15. package/components/hy-calendar/hy-calendar.vue +290 -143
  16. package/components/hy-calendar/typing.d.ts +38 -31
  17. package/components/hy-card/hy-card.vue +139 -36
  18. package/components/hy-card/typing.d.ts +39 -28
  19. package/components/hy-cell/hy-cell.vue +131 -67
  20. package/components/hy-cell/typing.d.ts +6 -1
  21. package/components/hy-check-button/hy-check-button.vue +101 -32
  22. package/components/hy-check-button/typing.d.ts +26 -19
  23. package/components/hy-checkbox/hy-checkbox.vue +167 -78
  24. package/components/hy-checkbox/typing.d.ts +26 -19
  25. package/components/hy-code-input/hy-code-input.vue +101 -5
  26. package/components/hy-code-input/typing.d.ts +9 -0
  27. package/components/hy-config-provider/hy-config-provider.vue +44 -24
  28. package/components/hy-config-provider/typing.d.ts +0 -4
  29. package/components/hy-count-down/hy-count-down.vue +99 -62
  30. package/components/hy-count-down/typing.d.ts +18 -5
  31. package/components/hy-count-to/hy-count-to.vue +165 -113
  32. package/components/hy-count-to/typing.d.ts +15 -11
  33. package/components/hy-datetime-picker/hy-datetime-picker.vue +338 -232
  34. package/components/hy-datetime-picker/typing.d.ts +49 -39
  35. package/components/hy-divider/hy-divider.vue +128 -64
  36. package/components/hy-divider/typing.d.ts +16 -16
  37. package/components/hy-dropdown/hy-dropdown.vue +57 -19
  38. package/components/hy-dropdown/typing.d.ts +14 -14
  39. package/components/hy-dropdown-item/hy-dropdown-item.vue +34 -5
  40. package/components/hy-dropdown-item/typing.d.ts +13 -6
  41. package/components/hy-empty/hy-empty.vue +64 -6
  42. package/components/hy-empty/typing.d.ts +5 -0
  43. package/components/hy-float-button/hy-float-button.vue +117 -5
  44. package/components/hy-float-button/typing.d.ts +7 -0
  45. package/components/hy-folding-panel/hy-folding-panel.vue +87 -25
  46. package/components/hy-folding-panel/typing.d.ts +24 -15
  47. package/components/hy-grid/hy-grid.vue +95 -35
  48. package/components/hy-grid/typing.d.ts +24 -19
  49. package/components/hy-icon/hy-icon.vue +84 -6
  50. package/components/hy-icon/typing.d.ts +5 -0
  51. package/components/hy-image/hy-image.vue +105 -6
  52. package/components/hy-image/typing.d.ts +9 -0
  53. package/components/hy-input/hy-input.vue +277 -130
  54. package/components/hy-input/props.ts +13 -14
  55. package/components/hy-input/typing.d.ts +59 -38
  56. package/components/hy-line/hy-line.vue +65 -25
  57. package/components/hy-line-progress/hy-line-progress.vue +68 -35
  58. package/components/hy-list/hy-list.vue +127 -61
  59. package/components/hy-list/typing.d.ts +19 -12
  60. package/components/hy-loading/hy-loading.vue +79 -25
  61. package/components/hy-menu/hy-menu.vue +69 -45
  62. package/components/hy-menu/typing.d.ts +22 -15
  63. package/components/hy-modal/hy-modal.vue +91 -4
  64. package/components/hy-modal/typing.d.ts +11 -0
  65. package/components/hy-navbar/hy-navbar.vue +105 -25
  66. package/components/hy-navbar/typing.d.ts +25 -20
  67. package/components/hy-notice-bar/hy-notice-bar.vue +97 -19
  68. package/components/hy-notice-bar/typing.d.ts +22 -17
  69. package/components/hy-notify/hy-notify.vue +106 -54
  70. package/components/hy-number-step/hy-number-step.vue +211 -120
  71. package/components/hy-number-step/typing.d.ts +45 -28
  72. package/components/hy-overlay/hy-overlay.vue +60 -16
  73. package/components/hy-overlay/typing.d.ts +11 -6
  74. package/components/hy-pagination/hy-pagination.vue +94 -37
  75. package/components/hy-pagination/typing.d.ts +20 -11
  76. package/components/hy-picker/hy-picker.vue +225 -160
  77. package/components/hy-picker/typing.d.ts +51 -28
  78. package/components/hy-popover/hy-popover.vue +55 -7
  79. package/components/hy-popover/typing.d.ts +21 -1
  80. package/components/hy-popup/hy-popup.vue +164 -99
  81. package/components/hy-popup/typing.d.ts +11 -0
  82. package/components/hy-price/hy-price.vue +77 -30
  83. package/components/hy-price/typing.d.ts +10 -10
  84. package/components/hy-qrcode/hy-qrcode.vue +75 -5
  85. package/components/hy-qrcode/typing.d.ts +25 -16
  86. package/components/hy-radio/hy-radio.vue +169 -88
  87. package/components/hy-radio/typing.d.ts +29 -22
  88. package/components/hy-rate/hy-rate.vue +155 -104
  89. package/components/hy-rate/typing.d.ts +23 -16
  90. package/components/hy-read-more/hy-read-more.vue +83 -56
  91. package/components/hy-read-more/typing.d.ts +18 -11
  92. package/components/hy-scroll-list/hy-scroll-list.vue +69 -58
  93. package/components/hy-scroll-list/typing.d.ts +14 -7
  94. package/components/hy-search/hy-search.vue +168 -62
  95. package/components/hy-search/typing.d.ts +47 -26
  96. package/components/hy-signature/hy-signature.vue +354 -272
  97. package/components/hy-signature/typing.d.ts +65 -52
  98. package/components/hy-slider/hy-slider.vue +208 -160
  99. package/components/hy-slider/typing.d.ts +28 -17
  100. package/components/hy-steps/hy-steps.vue +125 -99
  101. package/components/hy-steps/typing.d.ts +21 -14
  102. package/components/hy-submit-bar/hy-submit-bar.vue +129 -48
  103. package/components/hy-submit-bar/typing.d.ts +30 -23
  104. package/components/hy-subsection/hy-subsection.vue +139 -96
  105. package/components/hy-subsection/typing.d.ts +23 -16
  106. package/components/hy-swipe-action/hy-swipe-action.vue +161 -135
  107. package/components/hy-swipe-action/typing.d.ts +26 -17
  108. package/components/hy-swiper/hy-swiper.vue +178 -73
  109. package/components/hy-swiper/typing.d.ts +37 -28
  110. package/components/hy-switch/hy-switch.vue +107 -60
  111. package/components/hy-switch/typing.d.ts +25 -18
  112. package/components/hy-tabs/hy-tabs.vue +170 -160
  113. package/components/hy-tabs/typing.d.ts +36 -22
  114. package/components/hy-tag/hy-tag.vue +133 -58
  115. package/components/hy-tag/typing.d.ts +26 -18
  116. package/components/hy-text/hy-text.vue +106 -6
  117. package/components/hy-text/typing.d.ts +31 -26
  118. package/components/hy-textarea/hy-textarea.vue +183 -89
  119. package/components/hy-textarea/typing.d.ts +41 -24
  120. package/components/hy-tooltip/hy-tooltip.vue +145 -101
  121. package/components/hy-tooltip/typing.d.ts +18 -13
  122. package/components/hy-transition/hy-transition.vue +48 -13
  123. package/components/hy-transition/typing.d.ts +17 -0
  124. package/components/hy-upload/hy-upload.vue +113 -148
  125. package/components/hy-upload/typing.d.ts +71 -71
  126. package/components/hy-warn/hy-warn.vue +79 -36
  127. package/components/hy-warn/typing.d.ts +18 -11
  128. package/components/hy-waterfall/hy-waterfall.vue +90 -77
  129. package/components/hy-watermark/hy-watermark.vue +82 -5
  130. package/components/hy-watermark/typing.d.ts +20 -20
  131. package/global.d.ts +39 -59
  132. package/package.json +5 -13
  133. package/utils/inspect.ts +3 -1
  134. package/web-types.json +1 -1
  135. package/component-helper.ts +0 -177
  136. package/components.json +0 -3287
  137. package/dist/attributes.json +0 -1
  138. package/dist/docs/components/hy-action-sheet/hy-action-sheet.md +0 -41
  139. package/dist/docs/components/hy-address-picker/hy-address-picker.md +0 -25
  140. package/dist/docs/components/hy-avatar/hy-avatar.md +0 -19
  141. package/dist/docs/components/hy-back-top/hy-back-top.md +0 -19
  142. package/dist/docs/components/hy-badge/hy-badge.md +0 -13
  143. package/dist/docs/components/hy-button/hy-button.md +0 -61
  144. package/dist/docs/components/hy-calendar/header.md +0 -17
  145. package/dist/docs/components/hy-calendar/hy-calendar.md +0 -27
  146. package/dist/docs/components/hy-calendar/month.md +0 -38
  147. package/dist/docs/components/hy-card/hy-card.md +0 -24
  148. package/dist/docs/components/hy-cell/hy-cell.md +0 -26
  149. package/dist/docs/components/hy-check-button/hy-check-button.md +0 -14
  150. package/dist/docs/components/hy-checkbox/hy-checkbox.md +0 -21
  151. package/dist/docs/components/hy-code-input/hy-code-input.md +0 -15
  152. package/dist/docs/components/hy-config-provider/hy-config-provider.md +0 -13
  153. package/dist/docs/components/hy-count-down/hy-count-down.md +0 -34
  154. package/dist/docs/components/hy-count-to/hy-count-to.md +0 -31
  155. package/dist/docs/components/hy-datetime-picker/hy-datetime-picker.md +0 -25
  156. package/dist/docs/components/hy-divider/hy-divider.md +0 -13
  157. package/dist/docs/components/hy-dropdown/hy-dropdown.md +0 -13
  158. package/dist/docs/components/hy-dropdown-item/hy-dropdown-item.md +0 -20
  159. package/dist/docs/components/hy-empty/hy-empty.md +0 -20
  160. package/dist/docs/components/hy-float-button/hy-float-button.md +0 -20
  161. package/dist/docs/components/hy-folding-panel/hy-folding-panel.md +0 -24
  162. package/dist/docs/components/hy-form/hy-form.md +0 -29
  163. package/dist/docs/components/hy-grid/hy-grid.md +0 -19
  164. package/dist/docs/components/hy-icon/hy-icon.md +0 -13
  165. package/dist/docs/components/hy-image/hy-image.md +0 -22
  166. package/dist/docs/components/hy-input/hy-input.md +0 -29
  167. package/dist/docs/components/hy-line/hy-line.md +0 -7
  168. package/dist/docs/components/hy-line-progress/hy-line-progress.md +0 -13
  169. package/dist/docs/components/hy-list/hy-list.md +0 -25
  170. package/dist/docs/components/hy-loading/hy-loading.md +0 -14
  171. package/dist/docs/components/hy-login/ThePhoneLogin.md +0 -20
  172. package/dist/docs/components/hy-login/TheUserLogin.md +0 -44
  173. package/dist/docs/components/hy-login/hy-login.md +0 -14
  174. package/dist/docs/components/hy-menu/hy-menu.md +0 -21
  175. package/dist/docs/components/hy-modal/hy-modal.md +0 -23
  176. package/dist/docs/components/hy-navbar/hy-navbar.md +0 -22
  177. package/dist/docs/components/hy-notice-bar/hy-column-notice.md +0 -20
  178. package/dist/docs/components/hy-notice-bar/hy-notice-bar.md +0 -14
  179. package/dist/docs/components/hy-notice-bar/hy-row-notice.md +0 -20
  180. package/dist/docs/components/hy-notify/hy-notify.md +0 -23
  181. package/dist/docs/components/hy-number-step/hy-number-step.md +0 -27
  182. package/dist/docs/components/hy-overlay/hy-overlay.md +0 -19
  183. package/dist/docs/components/hy-pagination/hy-pagination.md +0 -14
  184. package/dist/docs/components/hy-parse/hy-parse.md +0 -46
  185. package/dist/docs/components/hy-parse/node/node.md +0 -7
  186. package/dist/docs/components/hy-picker/hy-picker.md +0 -32
  187. package/dist/docs/components/hy-popover/hy-popover.md +0 -34
  188. package/dist/docs/components/hy-popup/hy-popup.md +0 -22
  189. package/dist/docs/components/hy-price/hy-price.md +0 -13
  190. package/dist/docs/components/hy-qrcode/hy-qrcode.md +0 -15
  191. package/dist/docs/components/hy-radio/hy-radio.md +0 -21
  192. package/dist/docs/components/hy-rate/hy-rate.md +0 -14
  193. package/dist/docs/components/hy-read-more/hy-read-more.md +0 -21
  194. package/dist/docs/components/hy-scroll-list/hy-scroll-list.md +0 -21
  195. package/dist/docs/components/hy-search/hy-search.md +0 -27
  196. package/dist/docs/components/hy-signature/hy-signature.md +0 -45
  197. package/dist/docs/components/hy-slider/hy-slider.md +0 -24
  198. package/dist/docs/components/hy-status-bar/hy-status-bar.md +0 -13
  199. package/dist/docs/components/hy-steps/hy-steps.md +0 -23
  200. package/dist/docs/components/hy-submit-bar/hy-submit-bar.md +0 -21
  201. package/dist/docs/components/hy-subsection/hy-subsection.md +0 -14
  202. package/dist/docs/components/hy-swipe-action/hy-swipe-action.md +0 -29
  203. package/dist/docs/components/hy-swiper/hy-swiper-indicator.md +0 -23
  204. package/dist/docs/components/hy-swiper/hy-swiper.md +0 -22
  205. package/dist/docs/components/hy-switch/hy-switch.md +0 -20
  206. package/dist/docs/components/hy-tabBar/hy-tabBar.md +0 -13
  207. package/dist/docs/components/hy-tabs/hy-tabs.md +0 -27
  208. package/dist/docs/components/hy-tag/hy-tag.md +0 -21
  209. package/dist/docs/components/hy-text/hy-text.md +0 -13
  210. package/dist/docs/components/hy-textarea/hy-textarea.md +0 -19
  211. package/dist/docs/components/hy-toast/hy-toast.md +0 -17
  212. package/dist/docs/components/hy-tooltip/hy-tooltip.md +0 -13
  213. package/dist/docs/components/hy-transition/hy-transition.md +0 -25
  214. package/dist/docs/components/hy-upload/hy-upload.md +0 -25
  215. package/dist/docs/components/hy-warn/hy-warn.md +0 -14
  216. package/dist/docs/components/hy-waterfall/hy-waterfall.md +0 -30
  217. package/dist/docs/components/hy-watermark/hy-watermark.md +0 -7
  218. package/dist/docs/components/message/TheMessage.md +0 -17
  219. package/dist/docs/components/yk-dialog/yk-dialog.md +0 -7
  220. package/dist/tags.json +0 -1
  221. package/dist/web-types.json +0 -1
  222. package/docgen.config.js +0 -14
  223. package/web-types.config.js +0 -7
@@ -1,128 +1,138 @@
1
- import { DateModeEnum } from "../../typing";
2
- import type { CSSProperties } from "vue";
3
- import type HyInputProps from "../hy-input/typing";
1
+ import { DateModeEnum } from '../../typing'
2
+ import type { CSSProperties } from 'vue'
3
+ import type HyInputProps from '../hy-input/typing'
4
+ import HyApp from 'hy-app'
4
5
 
5
6
  export default interface HyDatetimeProps {
6
7
  /**
7
8
  * @description 用于控制选择器的弹出和收起 ( 默认 false )
8
9
  * */
9
- show?: boolean;
10
+ show?: boolean
10
11
  /**
11
12
  * @description 弹出层弹出方向
12
13
  * */
13
- popupMode?: HyApp.LayoutType;
14
+ popupMode?: HyApp.LayoutType
14
15
  /**
15
16
  * @description 是否显示顶部的操作栏 ( 默认 true )
16
17
  * */
17
- showToolbar?: boolean;
18
+ showToolbar?: boolean
18
19
  /**
19
20
  * @description 绑定值
20
21
  * @note 类型有问题,需要调整(加了Date类型)
21
22
  * */
22
- modelValue: string | number | Date;
23
+ modelValue: string | number | Date
23
24
  /**
24
25
  * @description 顶部标题
25
26
  * */
26
- title?: string;
27
+ title?: string
27
28
  /**
28
29
  * @description 展示格式 mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择 ( 默认 ‘datetime )
29
30
  * */
30
- mode?: DateModeEnum;
31
+ mode?: DateModeEnum
31
32
  /**
32
33
  * @description 可选的最大时间 默认值为后10年
33
34
  * */
34
- maxDate?: number;
35
+ maxDate?: number
35
36
  /**
36
37
  * @description 可选的最小时间 默认值为前10年
37
38
  * */
38
- minDate?: number;
39
+ minDate?: number
39
40
  /**
40
41
  * @description 可选的最小小时,仅mode=time有效
41
42
  * */
42
- minHour?: number;
43
+ minHour?: number
43
44
  /**
44
45
  * @description 可选的最大小时,仅mode=time有效
45
46
  * */
46
- maxHour?: number;
47
+ maxHour?: number
47
48
  /**
48
49
  * @description 可选的最小分钟,仅mode=time有效
49
50
  * */
50
- minMinute?: number;
51
+ minMinute?: number
51
52
  /**
52
53
  * @description 可选的最大分钟,仅mode=time有效
53
54
  * */
54
- maxMinute?: number;
55
+ maxMinute?: number
55
56
  /**
56
57
  * @description 选项过滤函数
57
58
  * */
58
- filter?: null | ((type: string, values: string[]) => string[]);
59
+ filter?: null | ((type: string, values: string[]) => string[])
59
60
  /**
60
61
  * @description 选项格式化函数
61
62
  * */
62
- formatter?: null | ((type: string, value: string) => string);
63
+ formatter?: null | ((type: string, value: string) => string)
63
64
  /**
64
65
  * @description 是否显示加载中状态 ( 默认 false )
65
66
  * */
66
- loading?: boolean;
67
+ loading?: boolean
67
68
  /**
68
69
  * @description 各列中,单个选项的高度 ( 默认 44 )
69
70
  * */
70
- itemHeight?: number;
71
+ itemHeight?: number
71
72
  /**
72
73
  * @description 取消按钮的文字 ( 默认 '取消' )
73
74
  * */
74
- cancelText?: string;
75
+ cancelText?: string
75
76
  /**
76
77
  * @description 确认按钮的文字 ( 默认 '确认' )
77
78
  * */
78
- confirmText?: string;
79
+ confirmText?: string
79
80
  /**
80
81
  * @description 取消按钮的颜色 ( 默认 '#909193' )
81
82
  * */
82
- cancelColor?: string;
83
+ cancelColor?: string
83
84
  /**
84
85
  * @description 确认按钮的颜色 ( 默认 '#3c9cff' )
85
86
  * */
86
- confirmColor?: string;
87
+ confirmColor?: string
87
88
  /**
88
89
  * @description 每列中可见选项的数量 ( 默认 5 )
89
90
  * */
90
- visibleItemCount?: number;
91
+ visibleItemCount?: number
91
92
  /**
92
93
  * @description 是否允许点击遮罩关闭选择器 ( 默认 false )
93
94
  * */
94
- closeOnClickOverlay?: boolean;
95
+ closeOnClickOverlay?: boolean
95
96
  /**
96
97
  * @description 各列的默认索引
97
98
  * @note 类型有问题,需要调整
98
99
  * */
99
- defaultIndex?: Array<any>;
100
+ defaultIndex?: Array<any>
100
101
  /**
101
102
  * @description 输入框是否显示边框 ( 默认 false )
102
103
  * */
103
- hasInput?: boolean;
104
+ hasInput?: boolean
104
105
  /**
105
106
  * @description 输入框集合属性
106
107
  * */
107
- input?: Partial<HyInputProps>;
108
+ input?: Partial<HyInputProps>
108
109
  /**
109
110
  * @description 自定义时间格式
110
111
  * */
111
- format?: string;
112
+ format?: string
112
113
  /**
113
114
  * @description 右边插槽
114
115
  * */
115
- toolbarRightSlot?: boolean;
116
- /**
117
- * @description 输入框形状
118
- * */
119
- shape?: HyApp.ShapeType;
120
- /**
121
- * @description 输入框边框
122
- * */
123
- border?: HyApp.BorderType;
116
+ toolbarRightSlot?: boolean
124
117
  /**
125
118
  * @description 自定义输入框外部样式
126
119
  * */
127
- customStyle?: CSSProperties;
120
+ customStyle?: CSSProperties
121
+ }
122
+
123
+ type IParam = {
124
+ value: string | number
125
+ mode: DateModeEnum
126
+ }
127
+ export interface IDatetimePickerEmits {
128
+ /** 关闭选择器时触发 */
129
+ (e: 'close'): void
130
+ /** 点击取消按钮 */
131
+ (e: 'cancel'): void
132
+ /** 点击确定按钮,返回当前选择的值 */
133
+ (e: 'confirm', param: IParam): void
134
+ /** 当选择值变化时触发 */
135
+ (e: 'change'): void
136
+ /** 更新值触发 */
137
+ (e: 'update:modelValue', value: IParam['value']): void
128
138
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="hy-divider" :style="dividerStyle" @tap="clickHandler">
2
+ <view :class="['hy-divider', customClass]" :style="dividerStyle">
3
3
  <HyLine
4
4
  :color="lineColor"
5
5
  :customStyle="leftLineStyle"
@@ -9,9 +9,7 @@
9
9
  ></HyLine>
10
10
  <HyLoading :show="text === 'loading'" size="18" mode="spinner"></HyLoading>
11
11
  <text v-if="dot" class="hy-divider__dot">●</text>
12
- <text v-else-if="text" class="hy-divider__text" :style="textStyle">{{
13
- content
14
- }}</text>
12
+ <text v-else-if="text" class="hy-divider__text" :style="textStyle">{{ content }}</text>
15
13
  <HyLine
16
14
  :color="lineColor"
17
15
  :customStyle="rightLineStyle"
@@ -23,27 +21,101 @@
23
21
  </template>
24
22
 
25
23
  <script lang="ts">
24
+ /**
25
+ * 区隔内容的分割线,一般用于页面底部"没有更多"的提示
26
+ * @displayName hy-divider
27
+ */
28
+ defineOptions({})
26
29
  export default {
27
30
  name: 'hy-divider',
28
31
  options: {
29
32
  addGlobalClass: true,
30
33
  virtualHost: true,
31
- styleIsolation: 'shared'
32
- }
34
+ styleIsolation: 'shared',
35
+ },
33
36
  }
34
37
  </script>
35
38
 
36
39
  <script setup lang="ts">
37
- import { computed, type CSSProperties, toRefs } from "vue";
38
- import defaultProps from "./props";
39
- import type IProps from "./typing";
40
- import { addUnit } from "../../utils";
40
+ import { computed, toRefs } from 'vue'
41
+ import type { CSSProperties, PropType } from 'vue'
42
+ import { addUnit } from '../../utils'
41
43
 
42
44
  // 组件
43
- import HyLine from "../hy-line/hy-line.vue";
44
- import HyLoading from "../hy-loading/hy-loading.vue";
45
+ import HyLine from '../hy-line/hy-line.vue'
46
+ import HyLoading from '../hy-loading/hy-loading.vue'
47
+ import { IconConfig } from '../../config'
45
48
 
46
- const props = withDefaults(defineProps<IProps>(), defaultProps);
49
+ // const props = withDefaults(defineProps<IProps>(), defaultProps);
50
+ const props = defineProps({
51
+ /** 是否虚线 */
52
+ dashed: {
53
+ type: Boolean,
54
+ default: false,
55
+ },
56
+ /** 是否细线 */
57
+ hairline: {
58
+ type: Boolean,
59
+ default: true,
60
+ },
61
+ /** 是否以点替代文字,优先于text字段起作用 */
62
+ dot: {
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ /**
67
+ * 内容文本的位置
68
+ * @values left,center,right
69
+ * */
70
+ textPosition: {
71
+ type: String,
72
+ default: 'center',
73
+ },
74
+ /** 文本内容,如果为loadMore就是加载前,如果为loading就是加载中,如果为noMore就是没有更多 */
75
+ text: String,
76
+ /** 文本大小 */
77
+ textSize: {
78
+ type: [String, Number],
79
+ default: 14,
80
+ },
81
+ /** 文本颜色 */
82
+ textColor: String,
83
+ /** 线条颜色 */
84
+ lineColor: String,
85
+ /** 加载图标 */
86
+ loadingIcon: IconConfig.LOADING,
87
+ /** 加载前的提示语 */
88
+ loadMoreText: {
89
+ type: String,
90
+ default: '加载更多',
91
+ },
92
+ /** 加载中提示语 */
93
+ loadingText: {
94
+ type: String,
95
+ default: '正在加载...',
96
+ },
97
+ /** 没有更多的提示语 */
98
+ noMoreText: {
99
+ type: String,
100
+ default: '没有更多了',
101
+ },
102
+ /** 上边距 */
103
+ marginTop: {
104
+ type: [String, Number],
105
+ default: 0,
106
+ },
107
+ /** 下边距 */
108
+ marginBottom: {
109
+ type: [String, Number],
110
+ default: 0,
111
+ },
112
+ /** 定义需要用到的外部样式 */
113
+ customStyle: {
114
+ type: Object as PropType<CSSProperties>,
115
+ },
116
+ /** 自定义外部类名 */
117
+ customClass: String,
118
+ })
47
119
  const {
48
120
  text,
49
121
  textSize,
@@ -57,94 +129,86 @@ const {
57
129
  marginTop,
58
130
  marginBottom,
59
131
  customStyle,
60
- } = toRefs(props);
61
- const emit = defineEmits(["click"]);
132
+ } = toRefs(props)
62
133
 
63
- const isLoad = ["loadMore", "loading", "noMore"].includes(text.value);
134
+ const isLoad = ['loadMore', 'loading', 'noMore'].includes(text.value)
64
135
 
65
136
  /**
66
137
  * @description 分割线样式
67
138
  * */
68
139
  const dividerStyle = computed<CSSProperties>(() => {
69
- const style: CSSProperties = {};
70
- style.marginTop =
71
- addUnit(marginTop.value) || isLoad ? "20px" : addUnit(marginTop.value);
72
- style.marginBottom =
73
- addUnit(marginBottom.value) || isLoad
74
- ? "20px"
75
- : addUnit(marginBottom.value);
76
- return Object.assign(style, customStyle.value);
77
- });
140
+ const style: CSSProperties = {}
141
+ style.marginTop = addUnit(marginTop.value) || isLoad ? '20px' : addUnit(marginTop.value)
142
+ style.marginBottom = addUnit(marginBottom.value) || isLoad ? '20px' : addUnit(marginBottom.value)
143
+ return Object.assign(style, customStyle.value)
144
+ })
78
145
  /**
79
146
  * @description 文本内容
80
147
  * */
81
148
  const content = computed(() => {
82
- let text = "";
149
+ let text = ''
83
150
  switch (props.text) {
84
- case "loadMore":
85
- text = loadMoreText.value;
86
- break;
87
- case "loading":
88
- text = loadingText.value;
89
- break;
90
- case "noMore":
91
- text = noMoreText.value;
92
- break;
151
+ case 'loadMore':
152
+ text = loadMoreText.value
153
+ break
154
+ case 'loading':
155
+ text = loadingText.value
156
+ break
157
+ case 'noMore':
158
+ text = noMoreText.value
159
+ break
93
160
  default:
94
- text = props.text;
95
- break;
161
+ text = props.text
162
+ break
96
163
  }
97
- return text;
98
- });
164
+ return text
165
+ })
99
166
  /**
100
167
  * @description 文本内容样式
101
168
  * */
102
169
  const textStyle = computed<CSSProperties>(() => {
103
- const style: CSSProperties = {};
104
- style.fontSize = addUnit(textSize.value);
105
- style.color = textColor.value;
106
- return style;
107
- });
170
+ const style: CSSProperties = {}
171
+ style.fontSize = addUnit(textSize.value)
172
+ style.color = textColor.value
173
+ return style
174
+ })
108
175
 
109
176
  /**
110
177
  * @description 左边线条的的样式
111
178
  * */
112
179
  const leftLineStyle = computed<CSSProperties>(() => {
113
180
  const style: CSSProperties = {
114
- marginRight: "20rpx",
115
- };
181
+ marginRight: '20rpx',
182
+ }
116
183
  // 如果是在左边,设置左边的宽度为固定值
117
184
  if (isLoad) {
118
- style.width = "80px";
119
- } else if (textPosition.value === "left") {
120
- style.width = "80rpx";
185
+ style.width = '80px'
186
+ } else if (textPosition.value === 'left') {
187
+ style.width = '80rpx'
121
188
  } else {
122
- style.flex = 1;
189
+ style.flex = 1
123
190
  }
124
- return style;
125
- });
191
+ return style
192
+ })
126
193
  /**
127
194
  * @description 右边线条的的样式
128
195
  * */
129
196
  const rightLineStyle = computed<CSSProperties>(() => {
130
197
  const style: CSSProperties = {
131
- marginLeft: "20rpx",
132
- };
198
+ marginLeft: '20rpx',
199
+ }
133
200
  // 如果是在右边,设置右边的宽度为固定值
134
201
  if (isLoad) {
135
- style.width = "80px";
136
- } else if (textPosition.value === "right") {
137
- style.width = "80rpx";
202
+ style.width = '80px'
203
+ } else if (textPosition.value === 'right') {
204
+ style.width = '80rpx'
138
205
  } else {
139
- style.flex = 1;
206
+ style.flex = 1
140
207
  }
141
- return style;
142
- });
143
- const clickHandler = () => {
144
- emit("click");
145
- };
208
+ return style
209
+ })
146
210
  </script>
147
211
 
148
212
  <style lang="scss" scoped>
149
- @import "./index.scss";
213
+ @import './index.scss';
150
214
  </style>
@@ -1,64 +1,64 @@
1
- import type { CSSProperties } from "vue";
1
+ import type { CSSProperties } from 'vue'
2
2
 
3
3
  export default interface HyDividerProps {
4
4
  /**
5
5
  * @description 是否虚线 (默认 false )
6
6
  * */
7
- dashed?: boolean;
7
+ dashed?: boolean
8
8
  /**
9
9
  * @description 是否细线 (默认 true )
10
10
  * */
11
- hairline?: boolean;
11
+ hairline?: boolean
12
12
  /**
13
13
  * @description 是否以点替代文字,优先于text字段起作用 (默认 false )
14
14
  * */
15
- dot?: boolean;
15
+ dot?: boolean
16
16
  /**
17
17
  * @description 内容文本的位置,left-左边,center-中间,right-右边 (默认 'center' )
18
18
  * */
19
- textPosition?: "center" | HyApp.LeftRightType;
19
+ textPosition?: HyApp.RowCenterType
20
20
  /**
21
21
  * @description 文本内容
22
22
  * */
23
- text?: string | "loadMore" | "loading" | "noMore";
23
+ text?: string | 'loadMore' | 'loading' | 'noMore'
24
24
  /**
25
25
  * @description 文本大小 (默认 14)
26
26
  * */
27
- textSize?: string | number;
27
+ textSize?: string | number
28
28
  /**
29
29
  * @description 文本颜色 (默认 '#909399' )
30
30
  * */
31
- textColor?: string;
31
+ textColor?: string
32
32
  /**
33
33
  * @description 线条颜色 (默认 '#dcdfe6' )
34
34
  * */
35
- lineColor?: string;
35
+ lineColor?: string
36
36
  /**
37
37
  * @description 加载图标(默认 'loading' )
38
38
  * */
39
- loadingIcon?: string;
39
+ loadingIcon?: string
40
40
  /**
41
41
  * @description 加载前的提示语(默认 '加载更多' )
42
42
  * */
43
- loadMoreText?: string;
43
+ loadMoreText?: string
44
44
  /**
45
45
  * @description 加载中提示语(默认 '正在加载...' )
46
46
  * */
47
- loadingText?: string;
47
+ loadingText?: string
48
48
  /**
49
49
  * @description 没有更多的提示语(默认 '没有更多了' )
50
50
  * */
51
- noMoreText?: string;
51
+ noMoreText?: string
52
52
  /**
53
53
  * @description 上边距 (默认 0 )
54
54
  * */
55
- marginTop?: string | number;
55
+ marginTop?: string | number
56
56
  /**
57
57
  * @description 下边距 (默认 0 )
58
58
  * */
59
- marginBottom?: string | number;
59
+ marginBottom?: string | number
60
60
  /**
61
61
  * @description 定义需要用到的外部样式
62
62
  * */
63
- customStyle?: CSSProperties;
63
+ customStyle?: CSSProperties
64
64
  }
@@ -5,51 +5,89 @@
5
5
  </template>
6
6
 
7
7
  <script lang="ts">
8
+ /**
9
+ * 主要提供筛选下拉筛选框,内置基础筛选功能,可以根据自己的需求自定义筛选项。
10
+ * @displayName hy-dropdown
11
+ */
12
+ defineOptions({})
8
13
  export default {
9
14
  name: 'hy-dropdown',
10
15
  options: {
11
16
  addGlobalClass: true,
12
17
  virtualHost: true,
13
- styleIsolation: 'shared'
14
- }
18
+ styleIsolation: 'shared',
19
+ },
15
20
  }
16
21
  </script>
17
22
 
18
23
  <script setup lang="ts">
19
- import { provide, ref, computed, type CSSProperties, toRefs } from "vue";
20
- import type IProps from "./typing";
21
- import defaultProps from "./props";
22
- import { addUnit } from "@/package";
24
+ import { provide, ref, computed, type CSSProperties, toRefs, PropType } from 'vue'
25
+ import { addUnit, IconConfig } from '@/package'
23
26
 
24
- const props = withDefaults(defineProps<IProps>(), defaultProps);
25
- const { height, borderBottom } = toRefs(props);
27
+ // const props = withDefaults(defineProps<IProps>(), defaultProps)
28
+ const props = defineProps({
29
+ /** 标题菜单的高度,单位px */
30
+ height: {
31
+ type: [String, Number],
32
+ default: 40,
33
+ },
34
+ /** 标题菜单是否显示下边框 */
35
+ borderBottom: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+ /** 是否固定定位 */
40
+ sticky: {
41
+ type: Boolean,
42
+ default: true,
43
+ },
44
+ /** 标题和选项卡选中的颜色 */
45
+ activeColor: String,
46
+ /** 标题和选项卡未选中的颜色 */
47
+ inactiveColor: String,
48
+ /** 图标名称 */
49
+ menuIcon: {
50
+ type: String,
51
+ default: IconConfig.ARROW_DOWN_FILL,
52
+ },
53
+ /** 图标大小 */
54
+ menuIconSize: {
55
+ type: [String, Number],
56
+ default: 14,
57
+ },
58
+ /** 定义需要用到的外部样式 */
59
+ customStyle: {
60
+ type: Object as PropType<CSSProperties>,
61
+ },
62
+ })
63
+ const { height, borderBottom, customStyle } = toRefs(props)
26
64
 
27
65
  //样式设置
28
66
  const dropdownStyle = computed(() => {
29
67
  const style: CSSProperties = props.sticky
30
68
  ? {
31
- position: "fixed",
69
+ position: 'fixed',
32
70
  left: 0,
33
71
  // #ifdef H5
34
- top: "44px",
72
+ top: '44px',
35
73
  // #endif
36
74
  // #ifndef H5
37
75
  top: 0,
38
76
  // #endif
39
77
  }
40
- : {};
41
- style.height = addUnit(height.value);
42
- if (borderBottom.value) style.borderBottom = "1px solid #dadbde";
78
+ : {}
79
+ style.height = addUnit(height.value)
80
+ if (borderBottom.value) style.borderBottom = '1px solid #dadbde'
43
81
 
44
- return style;
45
- });
82
+ return Object.assign(style, customStyle.value)
83
+ })
46
84
 
47
85
  //当前打开的项(以标题标识)
48
- const currentDropItem = ref("");
49
- provide("dropdownProps", props);
50
- provide("currentDropItem", currentDropItem);
86
+ const currentDropItem = ref('')
87
+ provide('dropdownProps', props)
88
+ provide('currentDropItem', currentDropItem)
51
89
  </script>
52
90
 
53
91
  <style lang="scss" scoped>
54
- @import "./index.scss";
92
+ @import './index.scss';
55
93
  </style>