hy-app 0.3.0 → 0.3.2

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