hy-app 0.2.2 → 0.2.5
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-button/hy-button.vue +88 -120
- package/components/hy-button/index.scss +1 -3
- package/components/hy-calendar/index.scss +1 -1
- package/components/hy-cell/index.scss +2 -17
- package/components/hy-checkbox/index.scss +10 -10
- package/components/hy-code-input/hy-code-input.vue +85 -74
- package/components/hy-code-input/index.scss +31 -1
- package/components/hy-code-input/props.ts +8 -7
- package/components/hy-code-input/typing.d.ts +22 -18
- package/components/hy-config-provider/props.ts +1 -1
- package/components/hy-config-provider/typing.d.ts +7 -7
- package/components/hy-dropdown-item/hy-dropdown-item.vue +69 -75
- package/components/hy-dropdown-item/index.scss +1 -1
- package/components/hy-float-button/hy-float-button.vue +69 -86
- package/components/hy-form/index.scss +1 -1
- package/components/hy-grid/hy-grid.vue +2 -3
- package/components/hy-grid/props.ts +4 -0
- package/components/hy-grid/typing.d.ts +15 -0
- package/components/hy-icon/index.scss +2 -2
- package/components/hy-login/TheUserLogin.vue +0 -1
- package/components/hy-menu/hy-menu.vue +159 -0
- package/components/hy-menu/index.scss +58 -0
- package/components/hy-menu/props.ts +12 -0
- package/components/hy-menu/typing.d.ts +57 -0
- package/components/hy-navbar/index.scss +2 -2
- package/components/hy-notice-bar/index.scss +3 -3
- package/components/hy-notify/typing.d.ts +1 -1
- package/components/hy-pagination/typing.d.ts +1 -1
- package/components/hy-picker/hy-picker.vue +9 -8
- package/components/hy-picker/index.scss +6 -2
- package/components/hy-radio/index.scss +2 -2
- package/components/hy-scroll-list/index.scss +1 -1
- package/components/hy-signature/hy-signature.vue +50 -50
- package/components/hy-signature/index.scss +2 -4
- package/components/hy-signature/props.ts +2 -1
- package/components/hy-signature/typing.d.ts +5 -1
- package/components/hy-subsection/hy-subsection.vue +15 -13
- package/components/hy-subsection/props.ts +2 -2
- package/components/hy-subsection/typing.d.ts +1 -1
- package/components/hy-tabBar/hy-tabBar.vue +96 -0
- package/components/hy-tabBar/index.scss +169 -0
- package/components/hy-tabBar/props.ts +13 -0
- package/components/hy-tabBar/typing.d.ts +54 -0
- package/components/hy-text/hy-text.vue +76 -87
- package/components/hy-text/index.scss +8 -8
- package/components/hy-upload/index.scss +0 -1
- package/components/hy-watermark/hy-watermark.vue +583 -0
- package/components/hy-watermark/index.scss +17 -0
- package/components/hy-watermark/props.ts +23 -0
- package/components/hy-watermark/typing.d.ts +76 -0
- package/components/index.ts +2 -2
- package/index.scss +1 -1
- package/index.ts +1 -1
- package/libs/css/common.scss +9 -1
- package/libs/css/vars.css +5 -1
- package/package.json +2 -2
- package/theme.scss +8 -18
- package/typing/modules/common.d.ts +1 -1
- package/utils/inspect.ts +20 -0
- package/utils/utils.ts +52 -22
- package/components/yk-tabbar/props.ts +0 -49
- package/components/yk-tabbar/yk-tabbar.vue +0 -224
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
:class="['hy-text__price', type && `hy-text__value--${type}`]"
|
|
5
5
|
v-if="mode === 'price'"
|
|
6
6
|
:style="[valueStyle]"
|
|
7
|
-
>¥</text
|
|
8
7
|
>
|
|
8
|
+
¥
|
|
9
|
+
</text>
|
|
9
10
|
<view class="hy-text__prefix-icon" v-if="prefixIcon">
|
|
10
11
|
<HyIcon :name="prefixIcon" :customStyle="iconStyle"></HyIcon>
|
|
11
12
|
</view>
|
|
@@ -41,8 +42,9 @@
|
|
|
41
42
|
lines && `hy-text__value--lines`,
|
|
42
43
|
mode === 'link' && `hy-text__value--link`,
|
|
43
44
|
]"
|
|
44
|
-
>{{ value }}</text
|
|
45
45
|
>
|
|
46
|
+
{{ value }}
|
|
47
|
+
</text>
|
|
46
48
|
<view class="hy-text__suffix-icon" v-if="suffixIcon">
|
|
47
49
|
<HyIcon :name="suffixIcon" :customStyle="iconStyle"></HyIcon>
|
|
48
50
|
</view>
|
|
@@ -51,32 +53,25 @@
|
|
|
51
53
|
|
|
52
54
|
<script lang="ts">
|
|
53
55
|
export default {
|
|
54
|
-
name:
|
|
56
|
+
name: 'hy-text',
|
|
55
57
|
options: {
|
|
56
58
|
addGlobalClass: true,
|
|
57
59
|
virtualHost: true,
|
|
58
|
-
styleIsolation:
|
|
60
|
+
styleIsolation: 'shared',
|
|
59
61
|
},
|
|
60
|
-
}
|
|
62
|
+
}
|
|
61
63
|
</script>
|
|
62
64
|
|
|
63
65
|
<script setup lang="ts">
|
|
64
|
-
import { computed, type CSSProperties, nextTick, toRefs } from
|
|
65
|
-
import type IProps from
|
|
66
|
-
import defaultProps from
|
|
67
|
-
import {
|
|
68
|
-
addUnit,
|
|
69
|
-
error,
|
|
70
|
-
formatName,
|
|
71
|
-
formatTime,
|
|
72
|
-
isDate,
|
|
73
|
-
priceFormat,
|
|
74
|
-
} from "../../utils";
|
|
66
|
+
import { computed, type CSSProperties, nextTick, toRefs } from 'vue'
|
|
67
|
+
import type IProps from './typing'
|
|
68
|
+
import defaultProps from './props'
|
|
69
|
+
import { addUnit, error, formatName, formatTime, isDate, priceFormat } from '../../utils'
|
|
75
70
|
|
|
76
71
|
// 组件
|
|
77
|
-
import HyIcon from
|
|
72
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
78
73
|
|
|
79
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
74
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
80
75
|
const {
|
|
81
76
|
type,
|
|
82
77
|
show,
|
|
@@ -96,153 +91,147 @@ const {
|
|
|
96
91
|
href,
|
|
97
92
|
format,
|
|
98
93
|
customStyle,
|
|
99
|
-
} = toRefs(props)
|
|
100
|
-
const emit = defineEmits([
|
|
94
|
+
} = toRefs(props)
|
|
95
|
+
const emit = defineEmits(['click'])
|
|
101
96
|
|
|
102
97
|
const wrapStyle = computed(() => {
|
|
103
98
|
const style: CSSProperties = {
|
|
104
99
|
margin: margin.value,
|
|
105
100
|
justifyContent:
|
|
106
|
-
align.value ===
|
|
107
|
-
|
|
108
|
-
: align.value === "center"
|
|
109
|
-
? "center"
|
|
110
|
-
: "flex-end",
|
|
111
|
-
};
|
|
101
|
+
align.value === 'left' ? 'flex-start' : align.value === 'center' ? 'center' : 'flex-end',
|
|
102
|
+
}
|
|
112
103
|
// 占满剩余空间
|
|
113
104
|
if (flex.value) {
|
|
114
|
-
style.flex = 1
|
|
105
|
+
style.flex = 1
|
|
115
106
|
// #ifndef APP-NVUE
|
|
116
|
-
style.width =
|
|
107
|
+
style.width = '100%'
|
|
117
108
|
// #endif
|
|
118
109
|
}
|
|
119
|
-
return style
|
|
120
|
-
})
|
|
110
|
+
return style
|
|
111
|
+
})
|
|
121
112
|
const valueStyle = computed(() => {
|
|
122
113
|
const style: CSSProperties = {
|
|
123
114
|
textDecoration: decoration.value,
|
|
124
|
-
fontWeight: bold.value ?
|
|
115
|
+
fontWeight: bold.value ? 'bold' : 'normal',
|
|
125
116
|
fontSize: addUnit(size.value),
|
|
126
|
-
}
|
|
127
|
-
!type.value && (style.color = color.value)
|
|
128
|
-
lineHeight.value && (style.lineHeight = addUnit(lineHeight.value))
|
|
129
|
-
block.value && (style.display =
|
|
130
|
-
return Object.assign(style, customStyle.value)
|
|
131
|
-
})
|
|
117
|
+
}
|
|
118
|
+
!type.value && (style.color = color.value)
|
|
119
|
+
lineHeight.value && (style.lineHeight = addUnit(lineHeight.value))
|
|
120
|
+
block.value && (style.display = 'block')
|
|
121
|
+
return Object.assign(style, customStyle.value)
|
|
122
|
+
})
|
|
132
123
|
|
|
133
124
|
/**
|
|
134
125
|
* @description 格式化值
|
|
135
126
|
* */
|
|
136
127
|
const value = computed(() => {
|
|
137
128
|
switch (mode.value) {
|
|
138
|
-
case
|
|
129
|
+
case 'price':
|
|
139
130
|
// 如果text不为金额进行提示
|
|
140
131
|
if (!/^\d+(\.\d+)?$/.test(text.value.toString())) {
|
|
141
|
-
error(
|
|
132
|
+
error('金额模式下,text参数需要为金额格式')
|
|
142
133
|
}
|
|
143
134
|
// 进行格式化,判断用户传入的format参数为正则,或者函数,如果没有传入format,则使用默认的金额格式化处理
|
|
144
|
-
if (typeof format.value ===
|
|
135
|
+
if (typeof format.value === 'function') {
|
|
145
136
|
// 如果用户传入的是函数,使用函数格式化
|
|
146
|
-
return format.value(text.value)
|
|
137
|
+
return format.value(text.value)
|
|
147
138
|
}
|
|
148
139
|
// 如果format非正则,非函数,则使用默认的金额格式化方法进行操作
|
|
149
|
-
return priceFormat(text.value, 2)
|
|
150
|
-
case
|
|
140
|
+
return priceFormat(text.value, 2)
|
|
141
|
+
case 'date':
|
|
151
142
|
// 判断是否合法的日期或者时间戳
|
|
152
|
-
!isDate(text.value) &&
|
|
153
|
-
error("日期模式下,text参数需要为日期或时间戳格式");
|
|
143
|
+
!isDate(text.value) && error('日期模式下,text参数需要为日期或时间戳格式')
|
|
154
144
|
// 进行格式化,判断用户传入的format参数为正则,或者函数,如果没有传入format,则使用默认的格式化处理
|
|
155
|
-
if (typeof format.value ===
|
|
145
|
+
if (typeof format.value === 'function') {
|
|
156
146
|
// 如果用户传入的是函数,使用函数格式化
|
|
157
|
-
return format.value(text)
|
|
147
|
+
return format.value(text)
|
|
158
148
|
}
|
|
159
149
|
if (format.value) {
|
|
160
150
|
// 如果format非正则,非函数,则使用默认的时间格式化方法进行操作
|
|
161
|
-
return formatTime(text.value, format.value)
|
|
151
|
+
return formatTime(text.value, format.value)
|
|
162
152
|
}
|
|
163
|
-
console.log(formatTime(text.value, "yyyy-MM-dd"), text.value);
|
|
164
153
|
// 如果没有设置format,则设置为默认的时间格式化形式
|
|
165
|
-
return formatTime(text.value,
|
|
166
|
-
case
|
|
154
|
+
return formatTime(text.value, 'yyyy-MM-dd')
|
|
155
|
+
case 'phone':
|
|
167
156
|
// 判断是否合法的手机号
|
|
168
157
|
// !test.mobile(text) && error('手机号模式下,text参数需要为手机号码格式')
|
|
169
|
-
if (typeof format.value ===
|
|
158
|
+
if (typeof format.value === 'function') {
|
|
170
159
|
// 如果用户传入的是函数,使用函数格式化
|
|
171
|
-
return format.value(text)
|
|
160
|
+
return format.value(text)
|
|
172
161
|
}
|
|
173
|
-
if (format.value ===
|
|
162
|
+
if (format.value === 'encrypt') {
|
|
174
163
|
// 如果format为encrypt,则将手机号进行星号加密处理
|
|
175
|
-
return `${text.value.toString().substring(0, 3)}****${text.value.toString().substring(7)}
|
|
164
|
+
return `${text.value.toString().substring(0, 3)}****${text.value.toString().substring(7)}`
|
|
176
165
|
}
|
|
177
|
-
return text.value
|
|
178
|
-
case
|
|
166
|
+
return text.value
|
|
167
|
+
case 'name':
|
|
179
168
|
// 判断是否合法的字符粗
|
|
180
|
-
if (typeof text.value !==
|
|
181
|
-
error(
|
|
169
|
+
if (typeof text.value !== 'string') {
|
|
170
|
+
error('姓名模式下,text参数需要为字符串格式')
|
|
182
171
|
} else {
|
|
183
|
-
if (typeof format.value ===
|
|
172
|
+
if (typeof format.value === 'function') {
|
|
184
173
|
// 如果用户传入的是函数,使用函数格式化
|
|
185
|
-
return format.value(text)
|
|
174
|
+
return format.value(text)
|
|
186
175
|
}
|
|
187
|
-
if (format.value ===
|
|
176
|
+
if (format.value === 'encrypt') {
|
|
188
177
|
// 如果format为encrypt,则将姓名进行星号加密处理
|
|
189
|
-
return formatName(text.value)
|
|
178
|
+
return formatName(text.value)
|
|
190
179
|
}
|
|
191
180
|
}
|
|
192
|
-
return text.value
|
|
193
|
-
case
|
|
194
|
-
return text.value
|
|
181
|
+
return text.value
|
|
182
|
+
case 'link':
|
|
183
|
+
return text.value
|
|
195
184
|
default:
|
|
196
|
-
return text.value
|
|
185
|
+
return text.value
|
|
197
186
|
}
|
|
198
|
-
})
|
|
187
|
+
})
|
|
199
188
|
|
|
200
189
|
const isMp = computed(() => {
|
|
201
|
-
let mp = false
|
|
190
|
+
let mp = false
|
|
202
191
|
// #ifdef MP
|
|
203
|
-
mp = true
|
|
192
|
+
mp = true
|
|
204
193
|
// #endif
|
|
205
|
-
return mp
|
|
206
|
-
})
|
|
194
|
+
return mp
|
|
195
|
+
})
|
|
207
196
|
|
|
208
197
|
const clickHandler = (e) => {
|
|
209
198
|
// 如果为手机号模式,拨打电话
|
|
210
|
-
if (call.value && mode.value ===
|
|
199
|
+
if (call.value && mode.value === 'phone') {
|
|
211
200
|
uni.makePhoneCall({
|
|
212
201
|
phoneNumber: text.value,
|
|
213
|
-
})
|
|
202
|
+
})
|
|
214
203
|
}
|
|
215
204
|
// 如果是有链接跳转
|
|
216
|
-
if (href.value && mode.value ===
|
|
217
|
-
toLink()
|
|
205
|
+
if (href.value && mode.value === 'link') {
|
|
206
|
+
toLink()
|
|
218
207
|
}
|
|
219
|
-
emit(
|
|
220
|
-
}
|
|
208
|
+
emit('click', e)
|
|
209
|
+
}
|
|
221
210
|
|
|
222
211
|
const toLink = () => {
|
|
223
212
|
// #ifdef APP-PLUS
|
|
224
|
-
plus.runtime.openURL(href.value)
|
|
213
|
+
plus.runtime.openURL(href.value)
|
|
225
214
|
// #endif
|
|
226
215
|
// #ifdef H5
|
|
227
|
-
window.open(href.value)
|
|
216
|
+
window.open(href.value)
|
|
228
217
|
// #endif
|
|
229
218
|
// #ifdef MP
|
|
230
219
|
uni.setClipboardData({
|
|
231
220
|
data: href.value,
|
|
232
221
|
success: () => {
|
|
233
|
-
uni.hideToast()
|
|
222
|
+
uni.hideToast()
|
|
234
223
|
nextTick(() => {
|
|
235
|
-
uni.showToast({ title:
|
|
236
|
-
})
|
|
224
|
+
uni.showToast({ title: '链接已复制,请在浏览器打开' })
|
|
225
|
+
})
|
|
237
226
|
},
|
|
238
|
-
})
|
|
227
|
+
})
|
|
239
228
|
// #endif
|
|
240
|
-
}
|
|
229
|
+
}
|
|
241
230
|
</script>
|
|
242
231
|
|
|
243
232
|
<style scoped lang="scss">
|
|
244
|
-
@import
|
|
245
|
-
@import
|
|
233
|
+
@import './index.scss';
|
|
234
|
+
@import '../../libs/css/mixin.scss';
|
|
246
235
|
/*超出出现省略号*/
|
|
247
236
|
.hy-text__value--lines {
|
|
248
237
|
@include multiEllipsis(v-bind(lines));
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
color: $hy-primary;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
@include themeColor(primary, "",
|
|
31
|
-
@include themeColor(warning, "",
|
|
32
|
-
@include themeColor(success, "",
|
|
33
|
-
@include themeColor(info, "",
|
|
34
|
-
@include themeColor(error, "",
|
|
35
|
-
@include themeColor(main, "", "", $hy-
|
|
30
|
+
@include themeColor(primary, "", transparent, $hy-primary);
|
|
31
|
+
@include themeColor(warning, "", transparent, $hy-warning);
|
|
32
|
+
@include themeColor(success, "", transparent, $hy-success);
|
|
33
|
+
@include themeColor(info, "", transparent, $hy-info);
|
|
34
|
+
@include themeColor(error, "", transparent, $hy-error);
|
|
35
|
+
@include themeColor(main, "", "", $hy-text-color);
|
|
36
36
|
@include themeColor(content, "", "", $hy-text-color--grey);
|
|
37
|
-
@include themeColor(tips, "", "",$hy-
|
|
37
|
+
@include themeColor(tips, "", "",$hy-text-color--grey);
|
|
38
38
|
@include themeColor(light, "", "", $hy-border-color-light);
|
|
39
39
|
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|