hy-app 0.5.5 → 0.5.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.
- package/components/hy-back-top/props.ts +2 -3
- package/components/hy-badge/props.ts +1 -1
- package/components/hy-badge/typing.d.ts +5 -0
- package/components/hy-button/props.ts +1 -1
- package/components/hy-card/hy-card.vue +2 -1
- package/components/hy-card/props.ts +3 -4
- package/components/hy-cell/hy-cell.vue +9 -190
- package/components/hy-cell/props.ts +7 -26
- package/components/hy-cell/typing.d.ts +2 -41
- package/components/hy-cell-item/hy-cell-item.vue +160 -0
- package/components/hy-cell-item/index.scss +100 -0
- package/components/hy-cell-item/props.ts +66 -0
- package/components/hy-cell-item/typing.d.ts +7 -0
- package/components/hy-checkbox-group/props.ts +1 -1
- package/components/hy-checkbox-item/typing.d.ts +3 -3
- package/components/hy-grid/props.ts +1 -1
- package/components/hy-grid/typing.d.ts +1 -2
- package/components/hy-icon/props.ts +1 -1
- package/components/hy-icon/typing.d.ts +5 -0
- package/components/hy-input/hy-input.vue +19 -22
- package/components/hy-input/props.ts +1 -1
- package/components/hy-menu/props.ts +2 -2
- package/components/hy-number-step/props.ts +1 -1
- package/components/hy-price/hy-price.vue +9 -2
- package/components/hy-search/props.ts +1 -2
- package/components/hy-switch/props.ts +1 -1
- package/components/hy-tabbar/props.ts +1 -1
- package/components/hy-tabbar-group/props.ts +1 -1
- package/components/hy-tabs/props.ts +1 -1
- package/components/hy-tag/props.ts +1 -1
- package/global.d.ts +1 -0
- package/libs/css/theme.scss +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
- package/components/hy-card/index.scss +0 -69
- package/components/hy-cell/index.scss +0 -136
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
+
import type { HyIconProps } from '../hy-icon/typing'
|
|
3
|
+
|
|
4
|
+
const cellItemProps = {
|
|
5
|
+
/** 头部标题 */
|
|
6
|
+
title: String,
|
|
7
|
+
/** 标题下面小提示 */
|
|
8
|
+
sub: String,
|
|
9
|
+
/** 是否禁用cell */
|
|
10
|
+
disabled: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false
|
|
13
|
+
},
|
|
14
|
+
/** 右侧的内容 */
|
|
15
|
+
value: String,
|
|
16
|
+
/** 图标,接收icon对象 */
|
|
17
|
+
icon: {
|
|
18
|
+
type: Object as PropType<HyIconProps>
|
|
19
|
+
},
|
|
20
|
+
/** 右边图标,默认是向左图标 */
|
|
21
|
+
rightIcon: {
|
|
22
|
+
type: Object as PropType<HyIconProps>
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* 右侧箭头的方向
|
|
26
|
+
* @values left,up,down
|
|
27
|
+
* */
|
|
28
|
+
arrowDirection: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: 'right'
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* 点击后跳转的URL地址
|
|
34
|
+
* */
|
|
35
|
+
url: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: ''
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* 链接跳转的方式,内部使用的是uview-plus封装的route方法,可能会进行拦截操作
|
|
41
|
+
* */
|
|
42
|
+
linkType: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'navigateTo'
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* 点击cell是否阻止事件传播
|
|
48
|
+
* */
|
|
49
|
+
stop: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* 标识符,用于在click事件中进行返回
|
|
55
|
+
* */
|
|
56
|
+
name: {
|
|
57
|
+
type: [String, Number],
|
|
58
|
+
default: ''
|
|
59
|
+
},
|
|
60
|
+
/** 定义需要用到的外部样式 */
|
|
61
|
+
customStyle: Object as PropType<CSSProperties>,
|
|
62
|
+
/** 自定义外部类名 */
|
|
63
|
+
customClass: String
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default cellItemProps
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { ToRefs } from 'vue'
|
|
1
|
+
import type checkboxGroupProps from '../hy-checkbox-group/props'
|
|
2
|
+
import type { ExtractPropTypes, ToRefs } from 'vue'
|
|
3
3
|
|
|
4
|
-
export interface ICheckboxGroupContext extends ToRefs<
|
|
4
|
+
export interface ICheckboxGroupContext extends ToRefs<ExtractPropTypes<typeof checkboxGroupProps>> {
|
|
5
5
|
/** 设置check的状态 */
|
|
6
6
|
setCheckedStatus: (name: string | number) => void
|
|
7
7
|
}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
:type="type"
|
|
41
41
|
:focus="focus"
|
|
42
42
|
:cursor="cursor"
|
|
43
|
-
:value="
|
|
43
|
+
:value="innerValue"
|
|
44
44
|
:auto-blur="autoBlur"
|
|
45
45
|
:disabled="disabled || readonly"
|
|
46
46
|
:maxlength="maxlength"
|
|
@@ -148,13 +148,14 @@ const innerFormatter = (value: string) => value
|
|
|
148
148
|
watch(
|
|
149
149
|
() => props.modelValue,
|
|
150
150
|
(newVal) => {
|
|
151
|
-
if (changeFromInner.value || innerValue.value === newVal) {
|
|
152
|
-
changeFromInner.value = false
|
|
151
|
+
if (changeFromInner.value || innerValue.value === newVal || newVal === undefined) {
|
|
152
|
+
changeFromInner.value = false
|
|
153
153
|
return
|
|
154
154
|
}
|
|
155
|
+
console.log(newVal, 'newVal')
|
|
155
156
|
innerValue.value = newVal
|
|
156
157
|
// 在H5中,外部value变化后,修改input中的值,不会触发@input事件,此时手动调用值变化方法
|
|
157
|
-
if (firstChange.value
|
|
158
|
+
if (!firstChange.value && !changeFromInner.value) {
|
|
158
159
|
valueChange(innerValue.value, true)
|
|
159
160
|
}
|
|
160
161
|
firstChange.value = false
|
|
@@ -165,14 +166,14 @@ watch(
|
|
|
165
166
|
)
|
|
166
167
|
|
|
167
168
|
/**
|
|
168
|
-
*
|
|
169
|
+
* 是否显示清除控件
|
|
169
170
|
* */
|
|
170
171
|
const isShowClear = computed(() => {
|
|
171
172
|
const { clearable, readonly, disabled } = props
|
|
172
173
|
return clearable && !readonly && !disabled && innerValue.value !== ''
|
|
173
174
|
})
|
|
174
175
|
/**
|
|
175
|
-
*
|
|
176
|
+
* 组件的类名
|
|
176
177
|
* */
|
|
177
178
|
const inputClass = computed((): string => {
|
|
178
179
|
let classes: string[] = [],
|
|
@@ -185,7 +186,7 @@ const inputClass = computed((): string => {
|
|
|
185
186
|
})
|
|
186
187
|
|
|
187
188
|
/**
|
|
188
|
-
*
|
|
189
|
+
* 组件的样式
|
|
189
190
|
* */
|
|
190
191
|
const wrapperStyle = computed((): CSSProperties => {
|
|
191
192
|
const style: CSSProperties = {}
|
|
@@ -200,9 +201,9 @@ const wrapperStyle = computed((): CSSProperties => {
|
|
|
200
201
|
return Object.assign(style, props.customStyle)
|
|
201
202
|
})
|
|
202
203
|
/**
|
|
203
|
-
*
|
|
204
|
+
* 输入框的样式
|
|
204
205
|
* */
|
|
205
|
-
const inputStyle = computed(()
|
|
206
|
+
const inputStyle = computed(() => {
|
|
206
207
|
return {
|
|
207
208
|
color: props.color,
|
|
208
209
|
fontSize: addUnit(props.fontSize),
|
|
@@ -211,7 +212,7 @@ const inputStyle = computed((): CSSProperties => {
|
|
|
211
212
|
})
|
|
212
213
|
|
|
213
214
|
/**
|
|
214
|
-
*
|
|
215
|
+
* 边框颜色
|
|
215
216
|
* */
|
|
216
217
|
const borderStyle = computed(() => {
|
|
217
218
|
return (isFocus: boolean) => {
|
|
@@ -233,13 +234,10 @@ const borderStyle = computed(() => {
|
|
|
233
234
|
})
|
|
234
235
|
|
|
235
236
|
/**
|
|
236
|
-
*
|
|
237
|
+
* 当键盘输入时,触发input事件
|
|
237
238
|
*/
|
|
238
239
|
const onInput = (e: any) => {
|
|
239
240
|
let { value = '' } = e.detail || {}
|
|
240
|
-
// 为了避免props的单向数据流特性,需要先将innerValue值设置为当前值,再在$nextTick中重新赋予设置后的值才有效
|
|
241
|
-
// console.log('onInput', value, this.innerValue)
|
|
242
|
-
innerValue.value = value
|
|
243
241
|
nextTick(() => {
|
|
244
242
|
let formatValue = innerFormatter(value)
|
|
245
243
|
innerValue.value = formatValue
|
|
@@ -247,7 +245,7 @@ const onInput = (e: any) => {
|
|
|
247
245
|
})
|
|
248
246
|
}
|
|
249
247
|
/**
|
|
250
|
-
*
|
|
248
|
+
* 输入框失去焦点时触发
|
|
251
249
|
* */
|
|
252
250
|
const onBlur = async (event: InputOnBlurEvent) => {
|
|
253
251
|
emit('blur', event, event.detail.value)
|
|
@@ -256,7 +254,7 @@ const onBlur = async (event: InputOnBlurEvent) => {
|
|
|
256
254
|
focused.value = false
|
|
257
255
|
}
|
|
258
256
|
/**
|
|
259
|
-
*
|
|
257
|
+
* 输入框聚焦时触发
|
|
260
258
|
* */
|
|
261
259
|
const onFocus = (e: InputOnFocusEvent) => {
|
|
262
260
|
focused.value = true
|
|
@@ -264,7 +262,7 @@ const onFocus = (e: InputOnFocusEvent) => {
|
|
|
264
262
|
}
|
|
265
263
|
|
|
266
264
|
/**
|
|
267
|
-
*
|
|
265
|
+
* 点击完成按钮时触发
|
|
268
266
|
* */
|
|
269
267
|
const onConfirm = (e: InputOnConfirmEvent) => {
|
|
270
268
|
emit('confirm', e, innerValue.value)
|
|
@@ -288,15 +286,14 @@ const valueChange = (value: string | number, isOut = false) => {
|
|
|
288
286
|
if (!isOut || clearInput.value) {
|
|
289
287
|
// 标识value值的变化是由内部引起的
|
|
290
288
|
changeFromInner.value = true
|
|
289
|
+
emit('update:modelValue', value)
|
|
291
290
|
emit('change', value)
|
|
292
291
|
if (formItem) formItem.handleChange(value)
|
|
293
|
-
|
|
294
|
-
emit('update:modelValue', value)
|
|
295
292
|
}
|
|
296
293
|
})
|
|
297
294
|
}
|
|
298
295
|
/**
|
|
299
|
-
*
|
|
296
|
+
* 点击清除控件
|
|
300
297
|
*/
|
|
301
298
|
const onClear = () => {
|
|
302
299
|
clearInput.value = true
|
|
@@ -319,13 +316,13 @@ const clickHandler = () => {
|
|
|
319
316
|
}
|
|
320
317
|
|
|
321
318
|
/**
|
|
322
|
-
*
|
|
319
|
+
* 点击前缀
|
|
323
320
|
* */
|
|
324
321
|
const onPrefix = () => {
|
|
325
322
|
emit('onPrefix')
|
|
326
323
|
}
|
|
327
324
|
/**
|
|
328
|
-
*
|
|
325
|
+
* 点击后缀
|
|
329
326
|
* */
|
|
330
327
|
const onSuffix = () => {
|
|
331
328
|
emit('onSuffix')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MenusType, ModelValueVo } from './typing'
|
|
2
2
|
import type { CSSProperties, PropType } from 'vue'
|
|
3
|
-
import type HyIconProps from '../hy-icon/typing'
|
|
4
|
-
import type HyBadgeProps from '../hy-badge/typing'
|
|
3
|
+
import type { HyIconProps } from '../hy-icon/typing'
|
|
4
|
+
import type { HyBadgeProps } from '../hy-badge/typing'
|
|
5
5
|
|
|
6
6
|
const menuProps = {
|
|
7
7
|
/** 当前值 */
|
|
@@ -54,10 +54,17 @@ const priceOne = computed(() => {
|
|
|
54
54
|
if (props.text === undefined || props.text === null) return error('text值不能为空')
|
|
55
55
|
|
|
56
56
|
let value = typeof props.text === 'string' ? props.text : props.text.toString()
|
|
57
|
+
|
|
58
|
+
// 格式化整数部分为千分位
|
|
59
|
+
const formatValue = (val: string) => {
|
|
60
|
+
return val.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
if (/\./g.test(value)) {
|
|
58
|
-
|
|
64
|
+
const [integer, decimal] = value.split('.')
|
|
65
|
+
return [formatValue(integer), decimal]
|
|
59
66
|
} else {
|
|
60
|
-
return [value, '000000']
|
|
67
|
+
return [formatValue(value), '000000']
|
|
61
68
|
}
|
|
62
69
|
})
|
|
63
70
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
-
import type { InputConfirmType } from '@uni-helper/uni-types'
|
|
3
2
|
import { IconConfig } from '../../libs'
|
|
4
|
-
import type HyIconProps from '../hy-icon/typing'
|
|
3
|
+
import type { HyIconProps } from '../hy-icon/typing'
|
|
5
4
|
|
|
6
5
|
const searchProps = {
|
|
7
6
|
/** 输入框初始值 */
|
package/global.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ declare module 'vue' {
|
|
|
10
10
|
HyCalendar: (typeof import('./components/hy-calendar/hy-calendar.vue'))['default']
|
|
11
11
|
HyCard: (typeof import('./components/hy-card/hy-card.vue'))['default']
|
|
12
12
|
HyCell: (typeof import('./components/hy-cell/hy-cell.vue'))['default']
|
|
13
|
+
HyCellItem: (typeof import('./components/hy-cell-item/hy-cell-item.vue'))['default']
|
|
13
14
|
HyCheckButton: (typeof import('./components/hy-check-button/hy-check-button.vue'))['default']
|
|
14
15
|
HyCheckbox: (typeof import('./components/hy-checkbox/hy-checkbox.vue'))['default']
|
|
15
16
|
HyCheckboxGroup: (typeof import('./components/hy-checkbox-group/hy-checkbox-group.vue'))['default']
|
package/libs/css/theme.scss
CHANGED
|
@@ -33,7 +33,7 @@ $hy-text-color--4: var(--hy-text-color--4, rgba(0, 0, 0, 0.1)) !default; // 一
|
|
|
33
33
|
$hy-icon-color: var(--hy-icon-color, #606266) !default; // 一般用于icon
|
|
34
34
|
$hy-text-color--grey: var(--hy-text-color--grey, #999) !default; // 辅助灰色,如加载更多的提示信息
|
|
35
35
|
$hy-text-color--placeholder: var(--hy-text-color--placeholder, #909399) !default; // 输入框提示颜色
|
|
36
|
-
$hy-text-color--disabled: var(--hy-text-color--disabled, #
|
|
36
|
+
$hy-text-color--disabled: var(--hy-text-color--disabled, #FFFFFF3F) !default; // 禁用文字颜色
|
|
37
37
|
$hy-border-color: var(--hy-border-color, #c0c0c0) !default; // 边框颜色
|
|
38
38
|
$hy-text-color--hover: var(--hy-text-color--hover, #58595b)!default; // 点击状态文字颜色
|
|
39
39
|
|