hy-app 0.6.4 → 0.6.6

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 (106) hide show
  1. package/attributes.json +1 -1
  2. package/components/hy-address-picker/hy-address-picker.vue +249 -249
  3. package/components/hy-address-picker/props.ts +103 -103
  4. package/components/hy-button/hy-button.vue +320 -289
  5. package/components/hy-button/props.ts +143 -143
  6. package/components/hy-button/typing.d.ts +43 -35
  7. package/components/hy-calendar/header.vue +58 -58
  8. package/components/hy-calendar/hy-calendar.vue +8 -6
  9. package/components/hy-calendar/month.vue +402 -402
  10. package/components/hy-calendar/props.ts +169 -169
  11. package/components/hy-calendar/typing.d.ts +47 -45
  12. package/components/hy-cell-item/hy-cell-item.vue +161 -161
  13. package/components/hy-cell-item/props.ts +59 -59
  14. package/components/hy-check-button/hy-check-button.vue +135 -135
  15. package/components/hy-code-input/hy-code-input.vue +231 -231
  16. package/components/hy-code-input/props.ts +90 -90
  17. package/components/hy-config-provider/hy-config-provider.vue +53 -53
  18. package/components/hy-config-provider/props.ts +30 -30
  19. package/components/hy-coupon/hy-coupon.vue +183 -183
  20. package/components/hy-coupon/props.ts +108 -108
  21. package/components/hy-datetime-picker/hy-datetime-picker.vue +41 -55
  22. package/components/hy-datetime-picker/props.ts +144 -144
  23. package/components/hy-datetime-picker/typing.d.ts +2 -0
  24. package/components/hy-divider/props.ts +83 -83
  25. package/components/hy-empty/icon.ts +72 -72
  26. package/components/hy-folding-panel/hy-folding-panel-group.vue +162 -162
  27. package/components/hy-form/hy-form.vue +220 -220
  28. package/components/hy-icon/hy-icon.vue +112 -112
  29. package/components/hy-index-bar/hy-index-bar.vue +185 -185
  30. package/components/hy-index-bar/index.scss +64 -64
  31. package/components/hy-index-bar/props.ts +94 -94
  32. package/components/hy-index-bar/typing.d.ts +36 -36
  33. package/components/hy-input/hy-input.vue +333 -333
  34. package/components/hy-input/props.ts +186 -186
  35. package/components/hy-modal/hy-modal.vue +211 -211
  36. package/components/hy-modal/props.ts +94 -94
  37. package/components/hy-modal/typing.d.ts +16 -16
  38. package/components/hy-notice-bar/hy-row-notice.vue +121 -121
  39. package/components/hy-notify/hy-notify.vue +174 -174
  40. package/components/hy-number-step/hy-number-step.vue +367 -367
  41. package/components/hy-overlay/hy-overlay.vue +61 -61
  42. package/components/hy-overlay/props.ts +38 -38
  43. package/components/hy-pagination/hy-pagination.vue +136 -136
  44. package/components/hy-pagination/props.ts +58 -58
  45. package/components/hy-parse/hy-parse.vue +550 -550
  46. package/components/hy-parse/node/node.vue +781 -781
  47. package/components/hy-parse/parser.js +1455 -1455
  48. package/components/hy-parse/props.ts +19 -19
  49. package/components/hy-parse/typing.d.ts +68 -68
  50. package/components/hy-picker/hy-picker.vue +435 -435
  51. package/components/hy-picker/props.ts +122 -122
  52. package/components/hy-picker/typing.d.ts +38 -38
  53. package/components/hy-qrcode/props.ts +72 -72
  54. package/components/hy-qrcode/qrcode.js.bak +1433 -1433
  55. package/components/hy-radio/props.ts +97 -97
  56. package/components/hy-read-more/props.ts +48 -48
  57. package/components/hy-search/props.ts +133 -133
  58. package/components/hy-signature/canvasHelper.ts +51 -51
  59. package/components/hy-signature/props.ts +121 -121
  60. package/components/hy-skeleton/hy-skeleton.vue +142 -142
  61. package/components/hy-skeleton/props.ts +46 -46
  62. package/components/hy-skeleton/typing.d.ts +31 -31
  63. package/components/hy-steps/hy-steps.vue +275 -275
  64. package/components/hy-steps/typing.d.ts +25 -25
  65. package/components/hy-swiper/hy-swiper.vue +3 -3
  66. package/components/hy-swiper/index.scss +5 -5
  67. package/components/hy-swiper/props.ts +0 -1
  68. package/components/hy-table/hy-table.vue +630 -630
  69. package/components/hy-table/props.ts +62 -62
  70. package/components/hy-table/typing.d.ts +29 -29
  71. package/components/hy-tabs/hy-tabs.vue +336 -335
  72. package/components/hy-tabs/props.ts +84 -77
  73. package/components/hy-tag/hy-tag.vue +173 -173
  74. package/components/hy-tag/props.ts +89 -89
  75. package/components/hy-text/hy-text.vue +237 -237
  76. package/components/hy-text/props.ts +115 -115
  77. package/components/hy-textarea/hy-textarea.vue +198 -198
  78. package/components/hy-toast/hy-toast.vue +200 -200
  79. package/components/hy-toast/props.ts +3 -3
  80. package/components/hy-transition/hy-transition.vue +157 -157
  81. package/components/hy-transition/props.ts +32 -32
  82. package/components/hy-upload/hy-upload.vue +384 -384
  83. package/components/hy-watermark/hy-watermark.vue +1058 -1058
  84. package/components/hy-watermark/props.ts +109 -109
  85. package/global.d.ts +94 -94
  86. package/libs/api/http.ts +119 -119
  87. package/libs/composables/index.ts +8 -8
  88. package/libs/composables/useMessage.ts +149 -149
  89. package/libs/composables/useToast.ts +45 -45
  90. package/libs/composables/useTranslate.ts +10 -10
  91. package/libs/css/_config.scss +5 -5
  92. package/libs/index.ts +8 -8
  93. package/libs/locale/index.ts +32 -32
  94. package/libs/locale/lang/en-US.ts +84 -84
  95. package/libs/locale/lang/zh-CN.ts +87 -87
  96. package/libs/typing/index.ts +2 -2
  97. package/libs/typing/modules/common.d.ts +139 -139
  98. package/libs/typing/modules/form.ts +176 -176
  99. package/libs/typing/modules/http.d.ts +19 -19
  100. package/libs/typing/modules/index.d.ts +12 -12
  101. package/libs/utils/inside.ts +340 -340
  102. package/libs/utils/inspect.ts +140 -140
  103. package/libs/utils/utils.ts +525 -525
  104. package/package.json +81 -81
  105. package/tags.json +1 -1
  106. package/web-types.json +1 -1
@@ -1,200 +1,200 @@
1
- <template>
2
- <hy-overlay
3
- :show="isShow"
4
- :zIndex="tmpConfig.overlay ? 10070 : -1"
5
- :LockScroll="false"
6
- :custom-style="overlayStyle"
7
- >
8
- <view :style="[contentStyle]" :class="contentClass">
9
- <hy-loading
10
- v-if="tmpConfig.loading"
11
- :mode="tmpConfig.loadMode || 'circle'"
12
- :color="loadingIconColor"
13
- inactiveColor="#F0E6EF"
14
- size="25"
15
- :customStyle="{ marginBottom: '20px' }"
16
- ></hy-loading>
17
- <view
18
- v-else-if="iconNameCom"
19
- :class="['hy-toast__content--icon', `hy-toast__content--icon__${tmpConfig.type}`]"
20
- >
21
- <hy-icon :name="iconNameCom" size="17" color="#FFFFFF"></hy-icon>
22
- </view>
23
- <text
24
- :class="[
25
- 'hy-toast__content--test',
26
- !tmpConfig.icon && !tmpConfig.loading
27
- ? `hy-toast__content--text__${tmpConfig.type}`
28
- : ''
29
- ]"
30
- >
31
- {{ tmpConfig.message }}
32
- </text>
33
- </view>
34
- </hy-overlay>
35
- </template>
36
-
37
- <script lang="ts">
38
- export default {
39
- name: 'hy-toast',
40
- options: {
41
- addGlobalClass: true,
42
- virtualHost: true,
43
- styleIsolation: 'shared'
44
- }
45
- }
46
- </script>
47
-
48
- <script setup lang="ts">
49
- import { computed, onMounted, onUnmounted, reactive, ref } from 'vue'
50
- import type { CSSProperties } from 'vue'
51
- import type ToastOptions from './typing'
52
- import { ColorConfig, iconName, getWindowInfo, hexToRgb, deepMerge } from '../../libs'
53
- // 组件
54
- import HyOverlay from '../hy-overlay/hy-overlay.vue'
55
- import HyIcon from '../hy-icon/hy-icon.vue'
56
- import HyLoading from '../hy-loading/hy-loading.vue'
57
-
58
- /**
59
- * Toast 组件主要用于消息通知、加载提示、操作结果提示等醒目提示效果,我们为其提供了多种丰富的API。
60
- * @displayName hy-toast
61
- */
62
- defineOptions({})
63
-
64
- const isShow = ref(false)
65
- const tmpConfig = ref<ToastOptions>({})
66
- const config: ToastOptions = reactive({
67
- message: '',
68
- type: '',
69
- duration: 2000,
70
- icon: false,
71
- position: 'center',
72
- complete: null,
73
- overlay: true,
74
- loading: false
75
- })
76
- let timer: any = null
77
-
78
- const isThemeType = (type: string): boolean =>
79
- ['error', 'warning', 'success', 'primary', 'info'].includes(type)
80
-
81
- const overlayStyle = computed(() => {
82
- const style: CSSProperties = {
83
- justifyContent: 'center',
84
- alignItems: 'center',
85
- display: 'flex',
86
- flexDirection: 'column'
87
- }
88
- // 将遮罩设置为100%透明度,避免出现灰色背景
89
- style.backgroundColor = 'rgba(0, 0, 0, 0)'
90
- return style
91
- })
92
-
93
- const iconNameCom = computed(() => {
94
- // 只有不为none,并且type为error|warning|succes|info时候,才显示图标
95
- if (!tmpConfig.value.icon || !tmpConfig.value.type) {
96
- return ''
97
- }
98
- if (tmpConfig.value.icon === true) {
99
- if (isThemeType(tmpConfig.value.type)) {
100
- return iconName(tmpConfig.value.type)
101
- } else {
102
- return ''
103
- }
104
- } else {
105
- return tmpConfig.value.icon
106
- }
107
- })
108
-
109
- /**
110
- * 内容盒子的样式
111
- * */
112
- const contentStyle = computed(() => {
113
- const windowHeight = getWindowInfo().windowHeight,
114
- style: CSSProperties = {}
115
- let value = 0
116
- // 根据top和bottom,对Y轴进行窗体高度的百分比偏移
117
- if (tmpConfig.value.position === 'top') {
118
- value = -windowHeight * 0.25
119
- } else if (tmpConfig.value.position === 'bottom') {
120
- value = windowHeight * 0.25
121
- }
122
- style.transform = `translateY(${value}px)`
123
- return style
124
- })
125
-
126
- const contentClass = computed(() => {
127
- return [
128
- 'hy-toast__content',
129
- 'hy-toast__' + tmpConfig.value.type,
130
- tmpConfig.value.loading && 'hy-toast__content--loading'
131
- ]
132
- })
133
-
134
- const loadingIconColor = computed(() => {
135
- let colorTmp = 'rgb(255, 255, 255)'
136
- if (isThemeType(tmpConfig.value.type!)) {
137
- // loading-icon组件内部会对color参数进行一个透明度处理,该方法要求传入的颜色值
138
- // 必须为rgb格式的,所以这里做一个处理
139
- colorTmp = hexToRgb(ColorConfig[tmpConfig.value.type!]) as string
140
- }
141
- return colorTmp
142
- })
143
-
144
- onMounted(() => {
145
- // 监听全局事件
146
- uni.$on('__hy_toast_open__', show)
147
- uni.$on('__hy_toast_close__', hide)
148
- })
149
-
150
- onUnmounted(() => {
151
- uni.$off('__hy_toast_open__', show)
152
- uni.$off('__hy_toast_close__', hide)
153
- })
154
-
155
- /**
156
- * 显示toast组件,由父组件通过xxx.show(options)形式调用
157
- * */
158
- const show = (options: ToastOptions) => {
159
- // 清除定时器
160
- clearTimer()
161
- tmpConfig.value = { ...config, ...options }
162
- isShow.value = true
163
- // -1时不自动关闭
164
- if (tmpConfig.value.duration !== -1 && !tmpConfig.value.loading) {
165
- timer = setTimeout(() => {
166
- // 倒计时结束,清除定时器,隐藏toast组件
167
- clearTimer()
168
- // 判断是否存在callback方法,如果存在就执行
169
- typeof tmpConfig.value.complete === 'function' && tmpConfig.value.complete()
170
- }, tmpConfig.value.duration)
171
- }
172
- }
173
-
174
- /**
175
- * 隐藏toast组件,由父组件通过ref形式调用
176
- * */
177
- const hide = () => {
178
- clearTimer()
179
- }
180
- /**
181
- * 清除定时任务
182
- * */
183
- const clearTimer = () => {
184
- isShow.value = false
185
- // 清除定时器
186
- clearTimeout(timer)
187
- timer = null
188
- // 防止后面请求还是loading状态
189
- // config.loading = false
190
- }
191
-
192
- defineExpose({
193
- show,
194
- hide
195
- })
196
- </script>
197
-
198
- <style scoped lang="scss">
199
- @import './index.scss';
200
- </style>
1
+ <template>
2
+ <hy-overlay
3
+ :show="isShow"
4
+ :zIndex="tmpConfig.overlay ? 10070 : -1"
5
+ :LockScroll="false"
6
+ :custom-style="overlayStyle"
7
+ >
8
+ <view :style="[contentStyle]" :class="contentClass">
9
+ <hy-loading
10
+ v-if="tmpConfig.loading"
11
+ :mode="tmpConfig.loadMode || 'circle'"
12
+ :color="loadingIconColor"
13
+ inactiveColor="#F0E6EF"
14
+ size="25"
15
+ :customStyle="{ marginBottom: '20px' }"
16
+ ></hy-loading>
17
+ <view
18
+ v-else-if="iconNameCom"
19
+ :class="['hy-toast__content--icon', `hy-toast__content--icon__${tmpConfig.type}`]"
20
+ >
21
+ <hy-icon :name="iconNameCom" size="17" color="#FFFFFF"></hy-icon>
22
+ </view>
23
+ <text
24
+ :class="[
25
+ 'hy-toast__content--test',
26
+ !tmpConfig.icon && !tmpConfig.loading
27
+ ? `hy-toast__content--text__${tmpConfig.type}`
28
+ : ''
29
+ ]"
30
+ >
31
+ {{ tmpConfig.message }}
32
+ </text>
33
+ </view>
34
+ </hy-overlay>
35
+ </template>
36
+
37
+ <script lang="ts">
38
+ export default {
39
+ name: 'hy-toast',
40
+ options: {
41
+ addGlobalClass: true,
42
+ virtualHost: true,
43
+ styleIsolation: 'shared'
44
+ }
45
+ }
46
+ </script>
47
+
48
+ <script setup lang="ts">
49
+ import { computed, onMounted, onUnmounted, reactive, ref } from 'vue'
50
+ import type { CSSProperties } from 'vue'
51
+ import type ToastOptions from './typing'
52
+ import { ColorConfig, iconName, getWindowInfo, hexToRgb, deepMerge } from '../../libs'
53
+ // 组件
54
+ import HyOverlay from '../hy-overlay/hy-overlay.vue'
55
+ import HyIcon from '../hy-icon/hy-icon.vue'
56
+ import HyLoading from '../hy-loading/hy-loading.vue'
57
+
58
+ /**
59
+ * Toast 组件主要用于消息通知、加载提示、操作结果提示等醒目提示效果,我们为其提供了多种丰富的API。
60
+ * @displayName hy-toast
61
+ */
62
+ defineOptions({})
63
+
64
+ const isShow = ref(false)
65
+ const tmpConfig = ref<ToastOptions>({})
66
+ const config: ToastOptions = reactive({
67
+ message: '',
68
+ type: '',
69
+ duration: 2000,
70
+ icon: false,
71
+ position: 'center',
72
+ complete: null,
73
+ overlay: true,
74
+ loading: false
75
+ })
76
+ let timer: any = null
77
+
78
+ const isThemeType = (type: string): boolean =>
79
+ ['error', 'warning', 'success', 'primary', 'info'].includes(type)
80
+
81
+ const overlayStyle = computed(() => {
82
+ const style: CSSProperties = {
83
+ justifyContent: 'center',
84
+ alignItems: 'center',
85
+ display: 'flex',
86
+ flexDirection: 'column'
87
+ }
88
+ // 将遮罩设置为100%透明度,避免出现灰色背景
89
+ style.backgroundColor = 'rgba(0, 0, 0, 0)'
90
+ return style
91
+ })
92
+
93
+ const iconNameCom = computed(() => {
94
+ // 只有不为none,并且type为error|warning|succes|info时候,才显示图标
95
+ if (!tmpConfig.value.icon || !tmpConfig.value.type) {
96
+ return ''
97
+ }
98
+ if (tmpConfig.value.icon === true) {
99
+ if (isThemeType(tmpConfig.value.type)) {
100
+ return iconName(tmpConfig.value.type)
101
+ } else {
102
+ return ''
103
+ }
104
+ } else {
105
+ return tmpConfig.value.icon
106
+ }
107
+ })
108
+
109
+ /**
110
+ * 内容盒子的样式
111
+ * */
112
+ const contentStyle = computed(() => {
113
+ const windowHeight = getWindowInfo().windowHeight,
114
+ style: CSSProperties = {}
115
+ let value = 0
116
+ // 根据top和bottom,对Y轴进行窗体高度的百分比偏移
117
+ if (tmpConfig.value.position === 'top') {
118
+ value = -windowHeight * 0.25
119
+ } else if (tmpConfig.value.position === 'bottom') {
120
+ value = windowHeight * 0.25
121
+ }
122
+ style.transform = `translateY(${value}px)`
123
+ return style
124
+ })
125
+
126
+ const contentClass = computed(() => {
127
+ return [
128
+ 'hy-toast__content',
129
+ 'hy-toast__' + tmpConfig.value.type,
130
+ tmpConfig.value.loading && 'hy-toast__content--loading'
131
+ ]
132
+ })
133
+
134
+ const loadingIconColor = computed(() => {
135
+ let colorTmp = 'rgb(255, 255, 255)'
136
+ if (isThemeType(tmpConfig.value.type!)) {
137
+ // loading-icon组件内部会对color参数进行一个透明度处理,该方法要求传入的颜色值
138
+ // 必须为rgb格式的,所以这里做一个处理
139
+ colorTmp = hexToRgb(ColorConfig[tmpConfig.value.type!]) as string
140
+ }
141
+ return colorTmp
142
+ })
143
+
144
+ onMounted(() => {
145
+ // 监听全局事件
146
+ uni.$on('__hy_toast_open__', show)
147
+ uni.$on('__hy_toast_close__', hide)
148
+ })
149
+
150
+ onUnmounted(() => {
151
+ uni.$off('__hy_toast_open__', show)
152
+ uni.$off('__hy_toast_close__', hide)
153
+ })
154
+
155
+ /**
156
+ * 显示toast组件,由父组件通过xxx.show(options)形式调用
157
+ * */
158
+ const show = (options: ToastOptions) => {
159
+ // 清除定时器
160
+ clearTimer()
161
+ tmpConfig.value = { ...config, ...options }
162
+ isShow.value = true
163
+ // -1时不自动关闭
164
+ if (tmpConfig.value.duration !== -1 && !tmpConfig.value.loading) {
165
+ timer = setTimeout(() => {
166
+ // 倒计时结束,清除定时器,隐藏toast组件
167
+ clearTimer()
168
+ // 判断是否存在callback方法,如果存在就执行
169
+ typeof tmpConfig.value.complete === 'function' && tmpConfig.value.complete()
170
+ }, tmpConfig.value.duration)
171
+ }
172
+ }
173
+
174
+ /**
175
+ * 隐藏toast组件,由父组件通过ref形式调用
176
+ * */
177
+ const hide = () => {
178
+ clearTimer()
179
+ }
180
+ /**
181
+ * 清除定时任务
182
+ * */
183
+ const clearTimer = () => {
184
+ isShow.value = false
185
+ // 清除定时器
186
+ clearTimeout(timer)
187
+ timer = null
188
+ // 防止后面请求还是loading状态
189
+ // config.loading = false
190
+ }
191
+
192
+ defineExpose({
193
+ show,
194
+ hide
195
+ })
196
+ </script>
197
+
198
+ <style scoped lang="scss">
199
+ @import './index.scss';
200
+ </style>
@@ -1,3 +1,3 @@
1
- const defaultProps = {};
2
-
3
- export default defaultProps;
1
+ const defaultProps = {};
2
+
3
+ export default defaultProps;