hy-app 0.5.13 → 0.5.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 (34) hide show
  1. package/components/hy-address-picker/hy-address-picker.vue +0 -1
  2. package/components/hy-button/hy-button.vue +7 -1
  3. package/components/hy-button/index.scss +25 -21
  4. package/components/hy-cell-item/hy-cell-item.vue +161 -161
  5. package/components/hy-cell-item/props.ts +59 -66
  6. package/components/hy-code-input/hy-code-input.vue +231 -231
  7. package/components/hy-code-input/props.ts +90 -88
  8. package/components/hy-config-provider/index.scss +4 -7
  9. package/components/hy-datetime-picker/hy-datetime-picker.vue +519 -521
  10. package/components/hy-folding-panel/hy-folding-panel-group.vue +163 -0
  11. package/components/hy-icon/index.scss +1 -2
  12. package/components/hy-index-bar/hy-index-bar.vue +185 -0
  13. package/components/hy-index-bar/index.scss +65 -0
  14. package/components/hy-index-bar/props.ts +94 -0
  15. package/components/hy-index-bar/typing.d.ts +36 -0
  16. package/components/hy-notify/hy-notify.vue +174 -174
  17. package/components/hy-number-step/hy-number-step.vue +367 -367
  18. package/components/hy-number-step/index.scss +14 -5
  19. package/components/hy-picker/hy-picker.vue +0 -1
  20. package/components/hy-picker/index.scss +1 -1
  21. package/components/hy-qrcode/qrcode.js.bak +1434 -0
  22. package/components/hy-table/hy-table.vue +30 -13
  23. package/components/hy-table/index.scss +6 -1
  24. package/components/hy-table/props.ts +1 -1
  25. package/components/hy-tabs/index.scss +1 -0
  26. package/components/hy-tag/index.scss +4 -13
  27. package/components/hy-text/hy-text.vue +1 -1
  28. package/components/hy-textarea/hy-textarea.vue +1 -1
  29. package/components/hy-textarea/index.scss +1 -4
  30. package/global.d.ts +92 -91
  31. package/libs/css/iconfont.css +117 -119
  32. package/libs/utils/utils.ts +502 -521
  33. package/package.json +2 -2
  34. package/web-types.json +1 -1
@@ -1,174 +1,174 @@
1
- <template>
2
- <hy-transition mode="slide-down" :customStyle="containerStyle" :show="open">
3
- <view
4
- :class="['hy-notify', `hy-notify--${tmpConfig?.type}`, customClass]"
5
- :style="[backgroundColor, customStyle]"
6
- >
7
- <hy-status-bar v-if="tmpConfig?.safeAreaInsetTop"></hy-status-bar>
8
- <view class="hy-notify__wrapper">
9
- <template v-if="['success', 'warning', 'error'].includes(tmpConfig.type)">
10
- <slot v-if="$slots.icon" name="icon"></slot>
11
- <hy-icon
12
- v-else
13
- :name="tmpConfig?.icon || icon"
14
- :color="tmpConfig?.color"
15
- :size="tmpConfig.fontSize"
16
- :customStyle="{ marginRight: '4px' }"
17
- ></hy-icon>
18
- </template>
19
- <text
20
- class="hy-notify__wrapper--text"
21
- :style="{
22
- fontSize: addUnit(tmpConfig?.fontSize),
23
- color: tmpConfig?.color
24
- }"
25
- >
26
- {{ tmpConfig?.message }}
27
- </text>
28
- </view>
29
- </view>
30
- </hy-transition>
31
- </template>
32
-
33
- <script lang="ts">
34
- export default {
35
- name: 'hy-notify',
36
- options: {
37
- addGlobalClass: true,
38
- virtualHost: true,
39
- styleIsolation: 'shared'
40
- }
41
- }
42
- </script>
43
-
44
- <script setup lang="ts">
45
- import type HyNotifyProps from './typing'
46
- import { computed, ref } from 'vue'
47
- import type { CSSProperties } from 'vue'
48
- import { addUnit, IconConfig } from '../../libs'
49
- import notifyProps from './props'
50
- // 组件
51
- import HyTransition from '../hy-transition/hy-transition.vue'
52
- import HyStatusBar from '../hy-status-bar/hy-status-bar.vue'
53
- import HyIcon from '../hy-icon/hy-icon.vue'
54
-
55
- /**
56
- * 一般用于页面顶部向下滑出一个提示,尔后自动收起的场景。
57
- * @displayName hy-notify
58
- */
59
- defineOptions({})
60
-
61
- const props = defineProps(notifyProps)
62
-
63
- const config = ref<HyNotifyProps>({
64
- // 到顶部的距离
65
- top: props.top,
66
- // type主题,primary,success,warning,error
67
- type: props.type,
68
- // 字体颜色
69
- color: props.color,
70
- // 背景颜色
71
- bgColor: props.bgColor,
72
- // 展示的文字内容
73
- message: props.message,
74
- // 展示时长,为0时不消失,单位ms
75
- duration: props.duration,
76
- // 字体大小
77
- fontSize: props.fontSize,
78
- // 是否留出顶部安全距离(状态栏高度)
79
- safeAreaInsetTop: props.safeAreaInsetTop
80
- })
81
- const tmpConfig = ref<HyNotifyProps>({})
82
- const open = ref(false)
83
- let timer: ReturnType<typeof setTimeout>
84
-
85
- /**
86
- * @description 容器样式
87
- * */
88
- const containerStyle = computed(() => {
89
- let top = 0
90
- if (tmpConfig.value.top === 0) {
91
- // #ifdef H5
92
- // H5端,导航栏为普通元素,需要将组件移动到导航栏的下边沿
93
- // H5的导航栏高度为44px
94
- top = 44
95
- // #endif
96
- }
97
- const style: CSSProperties = {
98
- top: addUnit(tmpConfig.value.top === 0 ? top : tmpConfig.value.top),
99
- // 因为组件底层为hy-transition组件,必须将其设置为fixed定位
100
- // 让其出现在导航栏底部
101
- position: 'fixed',
102
- left: 0,
103
- right: 0,
104
- zIndex: 10076
105
- }
106
- return style
107
- })
108
- /**
109
- * @description 组件背景颜色
110
- */
111
- const backgroundColor = computed(() => {
112
- const style: CSSProperties = {}
113
- if (tmpConfig.value.bgColor) {
114
- style.backgroundColor = tmpConfig.value.bgColor
115
- }
116
- return style
117
- })
118
-
119
- /**
120
- * @description 默认主题下的图标
121
- * */
122
- const icon = computed(() => {
123
- switch (tmpConfig.value.type) {
124
- case 'success':
125
- return IconConfig.SUCCESS
126
- case 'error':
127
- return IconConfig.CLOSE_CIRCLE
128
- case 'warning':
129
- return IconConfig.NOTICE
130
- default:
131
- return ''
132
- }
133
- })
134
-
135
- const show = (options: HyNotifyProps) => {
136
- // 不将结果合并到this.config变量,避免多次调用hy-toast,前后的配置造成混乱
137
- tmpConfig.value = Object.assign(config.value, options)
138
- // 任何定时器初始化之前,都要执行清除操作,否则可能会造成混乱
139
- clearTimer()
140
- open.value = true
141
- if (tmpConfig.value.duration && tmpConfig.value.duration! > 0) {
142
- timer = setTimeout(() => {
143
- open.value = false
144
- // 倒计时结束,清除定时器,隐藏toast组件
145
- clearTimer()
146
- // 判断是否存在callback方法,如果存在就执行
147
- typeof tmpConfig.value.complete === 'function' && tmpConfig.value.complete()
148
- }, tmpConfig.value.duration)
149
- }
150
- }
151
- /**
152
- * @description 关闭notify
153
- * */
154
- const close = () => {
155
- clearTimer()
156
- }
157
- /**
158
- * @description 清除定时任务
159
- * */
160
- const clearTimer = () => {
161
- open.value = false
162
- // 清除定时器
163
- clearTimeout(timer)
164
- }
165
-
166
- defineExpose({
167
- show,
168
- close
169
- })
170
- </script>
171
-
172
- <style scoped lang="scss">
173
- @import './index.scss';
174
- </style>
1
+ <template>
2
+ <hy-transition mode="slide-down" :customStyle="containerStyle" :show="open">
3
+ <view
4
+ :class="['hy-notify', `hy-notify--${tmpConfig?.type}`, customClass]"
5
+ :style="[backgroundColor, customStyle]"
6
+ >
7
+ <hy-status-bar v-if="tmpConfig?.safeAreaInsetTop"></hy-status-bar>
8
+ <view class="hy-notify__wrapper">
9
+ <template v-if="['success', 'warning', 'error'].includes(tmpConfig.type)">
10
+ <slot v-if="$slots.icon" name="icon"></slot>
11
+ <hy-icon
12
+ v-else
13
+ :name="tmpConfig?.icon || icon"
14
+ :color="tmpConfig?.color"
15
+ :size="tmpConfig.fontSize"
16
+ :customStyle="{ marginRight: '4px' }"
17
+ ></hy-icon>
18
+ </template>
19
+ <text
20
+ class="hy-notify__wrapper--text"
21
+ :style="{
22
+ fontSize: addUnit(tmpConfig?.fontSize),
23
+ color: tmpConfig?.color
24
+ }"
25
+ >
26
+ {{ tmpConfig?.message }}
27
+ </text>
28
+ </view>
29
+ </view>
30
+ </hy-transition>
31
+ </template>
32
+
33
+ <script lang="ts">
34
+ export default {
35
+ name: 'hy-notify',
36
+ options: {
37
+ addGlobalClass: true,
38
+ virtualHost: true,
39
+ styleIsolation: 'shared'
40
+ }
41
+ }
42
+ </script>
43
+
44
+ <script setup lang="ts">
45
+ import type HyNotifyProps from './typing'
46
+ import { computed, ref } from 'vue'
47
+ import type { CSSProperties } from 'vue'
48
+ import { addUnit, IconConfig } from '../../libs'
49
+ import notifyProps from './props'
50
+ // 组件
51
+ import HyTransition from '../hy-transition/hy-transition.vue'
52
+ import HyStatusBar from '../hy-status-bar/hy-status-bar.vue'
53
+ import HyIcon from '../hy-icon/hy-icon.vue'
54
+
55
+ /**
56
+ * 一般用于页面顶部向下滑出一个提示,尔后自动收起的场景。
57
+ * @displayName hy-notify
58
+ */
59
+ defineOptions({})
60
+
61
+ const props = defineProps(notifyProps)
62
+
63
+ const config = ref<HyNotifyProps>({
64
+ // 到顶部的距离
65
+ top: props.top,
66
+ // type主题,primary,success,warning,error
67
+ type: props.type,
68
+ // 字体颜色
69
+ color: props.color,
70
+ // 背景颜色
71
+ bgColor: props.bgColor,
72
+ // 展示的文字内容
73
+ message: props.message,
74
+ // 展示时长,为0时不消失,单位ms
75
+ duration: props.duration,
76
+ // 字体大小
77
+ fontSize: props.fontSize,
78
+ // 是否留出顶部安全距离(状态栏高度)
79
+ safeAreaInsetTop: props.safeAreaInsetTop
80
+ })
81
+ const tmpConfig = ref<HyNotifyProps>({})
82
+ const open = ref(false)
83
+ let timer: ReturnType<typeof setTimeout>
84
+
85
+ /**
86
+ * @description 容器样式
87
+ * */
88
+ const containerStyle = computed(() => {
89
+ let top = 0
90
+ if (tmpConfig.value.top === 0) {
91
+ // #ifdef H5
92
+ // H5端,导航栏为普通元素,需要将组件移动到导航栏的下边沿
93
+ // H5的导航栏高度为44px
94
+ top = 44
95
+ // #endif
96
+ }
97
+ const style: CSSProperties = {
98
+ top: addUnit(tmpConfig.value.top === 0 ? top : tmpConfig.value.top),
99
+ // 因为组件底层为hy-transition组件,必须将其设置为fixed定位
100
+ // 让其出现在导航栏底部
101
+ position: 'fixed',
102
+ left: 0,
103
+ right: 0,
104
+ zIndex: 10076
105
+ }
106
+ return style
107
+ })
108
+ /**
109
+ * @description 组件背景颜色
110
+ */
111
+ const backgroundColor = computed(() => {
112
+ const style: CSSProperties = {}
113
+ if (tmpConfig.value.bgColor) {
114
+ style.backgroundColor = tmpConfig.value.bgColor
115
+ }
116
+ return style
117
+ })
118
+
119
+ /**
120
+ * @description 默认主题下的图标
121
+ * */
122
+ const icon = computed(() => {
123
+ switch (tmpConfig.value.type) {
124
+ case 'success':
125
+ return IconConfig.SUCCESS
126
+ case 'error':
127
+ return IconConfig.CLOSE_CIRCLE
128
+ case 'warning':
129
+ return IconConfig.NOTICE_CIRCLE
130
+ default:
131
+ return ''
132
+ }
133
+ })
134
+
135
+ const show = (options: HyNotifyProps) => {
136
+ // 不将结果合并到this.config变量,避免多次调用hy-toast,前后的配置造成混乱
137
+ tmpConfig.value = Object.assign(config.value, options)
138
+ // 任何定时器初始化之前,都要执行清除操作,否则可能会造成混乱
139
+ clearTimer()
140
+ open.value = true
141
+ if (tmpConfig.value.duration && tmpConfig.value.duration! > 0) {
142
+ timer = setTimeout(() => {
143
+ open.value = false
144
+ // 倒计时结束,清除定时器,隐藏toast组件
145
+ clearTimer()
146
+ // 判断是否存在callback方法,如果存在就执行
147
+ typeof tmpConfig.value.complete === 'function' && tmpConfig.value.complete()
148
+ }, tmpConfig.value.duration)
149
+ }
150
+ }
151
+ /**
152
+ * @description 关闭notify
153
+ * */
154
+ const close = () => {
155
+ clearTimer()
156
+ }
157
+ /**
158
+ * @description 清除定时任务
159
+ * */
160
+ const clearTimer = () => {
161
+ open.value = false
162
+ // 清除定时器
163
+ clearTimeout(timer)
164
+ }
165
+
166
+ defineExpose({
167
+ show,
168
+ close
169
+ })
170
+ </script>
171
+
172
+ <style scoped lang="scss">
173
+ @import './index.scss';
174
+ </style>