hy-app 0.6.2 → 0.6.4
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/attributes.json +1 -1
- package/components/hy-button/hy-button.vue +1 -7
- package/components/hy-button/index.scss +1 -1
- package/components/hy-check-button/hy-check-button.vue +3 -3
- package/components/hy-datetime-picker/hy-datetime-picker.vue +32 -16
- package/components/hy-icon/hy-icon.vue +5 -6
- package/components/hy-overlay/hy-overlay.vue +61 -60
- package/components/hy-overlay/props.ts +38 -33
- package/components/hy-table/hy-table.vue +110 -76
- package/components/hy-table/index.scss +15 -3
- package/components/hy-tabs/index.scss +3 -0
- package/components/hy-tag/hy-tag.vue +4 -5
- package/components/hy-toast/hy-toast.vue +22 -12
- package/components/hy-transition/hy-transition.vue +157 -157
- package/components/hy-transition/props.ts +32 -32
- package/components/hy-watermark/hy-watermark.vue +1058 -978
- package/components/hy-watermark/index.scss +0 -9
- package/components/hy-watermark/props.ts +109 -104
- package/global.d.ts +1 -1
- package/libs/composables/useToast.ts +45 -45
- package/libs/css/iconfont.css +2 -2
- package/libs/typing/modules/form.ts +20 -20
- package/package.json +81 -81
- package/tags.json +1 -1
- package/web-types.json +1 -1
|
@@ -25,13 +25,7 @@
|
|
|
25
25
|
:hover-class="!disabled && !loading ? 'hy-button--active' : ''"
|
|
26
26
|
:style="[baseColor, customStyle]"
|
|
27
27
|
@click="clickHandler"
|
|
28
|
-
:class="[
|
|
29
|
-
'hy-button',
|
|
30
|
-
!border && 'hy-button__no-border',
|
|
31
|
-
!disabled && 'hy-button__no-disabled',
|
|
32
|
-
bemClass,
|
|
33
|
-
customClass
|
|
34
|
-
]"
|
|
28
|
+
:class="['hy-button', !border && 'hy-button__no-border', bemClass, customClass]"
|
|
35
29
|
>
|
|
36
30
|
<template v-if="loading">
|
|
37
31
|
<HyLoading :mode="loadingMode" :size="loadingSize" :color="loadingColor"></HyLoading>
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
@click="onCheckbox"
|
|
13
13
|
>
|
|
14
14
|
<template #default>
|
|
15
|
-
<slot :record="item"></slot>
|
|
15
|
+
<slot v-if="$slots.default" :record="item"></slot>
|
|
16
|
+
<text v-else>{{ item?.[fieldNames.label] }}</text>
|
|
16
17
|
</template>
|
|
17
18
|
</hy-tag>
|
|
18
19
|
</template>
|
|
@@ -33,9 +34,8 @@ export default {
|
|
|
33
34
|
<script setup lang="ts">
|
|
34
35
|
import { watch, ref, computed } from 'vue'
|
|
35
36
|
import type { ICheckButtonEmits } from './typing'
|
|
36
|
-
import type { CheckboxColumnsVo } from './typing'
|
|
37
37
|
import HyTag from '../hy-tag/hy-tag.vue'
|
|
38
|
-
import { isArray
|
|
38
|
+
import { isArray } from '../../libs'
|
|
39
39
|
import type { TagParamsVo } from '../hy-tag/typing'
|
|
40
40
|
import checkButtonProps from './props'
|
|
41
41
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<view :class="['hy-datetime-picker', customClass]" :style="customStyle">
|
|
3
3
|
<view v-if="hasInput" class="hy-datetime-picker__has-input" @click="onShowByClickInput">
|
|
4
4
|
<slot name="trigger" :value="inputValue">
|
|
5
|
-
<
|
|
5
|
+
<hy-input
|
|
6
6
|
v-model="inputValue"
|
|
7
7
|
:disabled="input?.disabled"
|
|
8
8
|
:disabledColor="input?.disabledColor"
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
:placeholderStyle="input?.placeholderStyle"
|
|
18
18
|
:placeholderClass="input?.placeholderClass"
|
|
19
19
|
:customStyle="Object.assign({ 'pointer-events': 'none' }, input?.customStyle)"
|
|
20
|
-
></
|
|
20
|
+
></hy-input>
|
|
21
21
|
<view class="input-cover"></view>
|
|
22
22
|
</slot>
|
|
23
23
|
</view>
|
|
24
|
-
<
|
|
24
|
+
<hy-picker
|
|
25
25
|
:show="show || (hasInput && showByClickInput)"
|
|
26
26
|
:popupMode="popupMode"
|
|
27
27
|
:closeOnClickOverlay="closeOnClickOverlay"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<template #toolbar-bottom>
|
|
50
50
|
<slot name="toolbar-bottom"></slot>
|
|
51
51
|
</template>
|
|
52
|
-
</
|
|
52
|
+
</hy-picker>
|
|
53
53
|
</view>
|
|
54
54
|
</template>
|
|
55
55
|
|
|
@@ -99,7 +99,7 @@ const validModes = new Set([
|
|
|
99
99
|
])
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* 更新各列的值
|
|
103
103
|
* */
|
|
104
104
|
const updateColumns = () => {
|
|
105
105
|
const formatterFn = props.formatter || innerFormatter
|
|
@@ -110,7 +110,7 @@ const updateColumns = () => {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
113
|
+
* 更新各列的值,进行补0、格式化等操作
|
|
114
114
|
* */
|
|
115
115
|
const updateColumnValue = (value: string | number) => {
|
|
116
116
|
innerValue.value = value
|
|
@@ -215,7 +215,7 @@ const times = (n: number, iteratee: Function) => {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
|
-
*
|
|
218
|
+
* 关闭选择器
|
|
219
219
|
* */
|
|
220
220
|
const close = () => {
|
|
221
221
|
if (props.closeOnClickOverlay) {
|
|
@@ -227,7 +227,7 @@ const close = () => {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
|
-
*
|
|
230
|
+
* 点击工具栏的取消按钮
|
|
231
231
|
* */
|
|
232
232
|
const cancel = () => {
|
|
233
233
|
if (props.hasInput) {
|
|
@@ -237,9 +237,25 @@ const cancel = () => {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
/**
|
|
240
|
-
*
|
|
240
|
+
* 点击工具栏的确定按钮
|
|
241
241
|
* */
|
|
242
242
|
const confirm = () => {
|
|
243
|
+
//如果用户还没有触发过change
|
|
244
|
+
if (!innerValue.value) {
|
|
245
|
+
let arr = [0]
|
|
246
|
+
//如果有默认值&&默认值的数组长度是正确的,就用默认值
|
|
247
|
+
if (
|
|
248
|
+
Array.isArray(props.defaultIndex) &&
|
|
249
|
+
props.defaultIndex.length === columns.value.length
|
|
250
|
+
) {
|
|
251
|
+
arr = [...props.defaultIndex]
|
|
252
|
+
} else {
|
|
253
|
+
//否则默认都选中第一个
|
|
254
|
+
arr = Array(columns.value.length).fill(0)
|
|
255
|
+
}
|
|
256
|
+
console.log(arr)
|
|
257
|
+
getInputValue(arr)
|
|
258
|
+
}
|
|
243
259
|
emit('update:modelValue', innerValue.value)
|
|
244
260
|
if (props.hasInput) {
|
|
245
261
|
getInputValue(innerValue.value)
|
|
@@ -252,7 +268,7 @@ const confirm = () => {
|
|
|
252
268
|
}
|
|
253
269
|
|
|
254
270
|
/**
|
|
255
|
-
*
|
|
271
|
+
* 用正则截取输出值,当出现多组数字时,抛出错误
|
|
256
272
|
* */
|
|
257
273
|
const intercept = (e: any, type?: string) => {
|
|
258
274
|
let judge = e.match(/\d+/g)
|
|
@@ -272,7 +288,7 @@ const intercept = (e: any, type?: string) => {
|
|
|
272
288
|
}
|
|
273
289
|
|
|
274
290
|
/**
|
|
275
|
-
*
|
|
291
|
+
* 列发生变化时触发
|
|
276
292
|
* */
|
|
277
293
|
const change = (e: any) => {
|
|
278
294
|
const { indexs, values } = e
|
|
@@ -315,7 +331,7 @@ const change = (e: any) => {
|
|
|
315
331
|
}
|
|
316
332
|
|
|
317
333
|
/**
|
|
318
|
-
*
|
|
334
|
+
* 更新索引
|
|
319
335
|
* */
|
|
320
336
|
const updateIndexes = (value: number | string) => {
|
|
321
337
|
let values: string[] = []
|
|
@@ -375,7 +391,7 @@ const updateIndexes = (value: number | string) => {
|
|
|
375
391
|
}
|
|
376
392
|
|
|
377
393
|
/**
|
|
378
|
-
*
|
|
394
|
+
* 获取每列数据
|
|
379
395
|
* */
|
|
380
396
|
const getOriginColumns = () => {
|
|
381
397
|
// 生成各列的值
|
|
@@ -397,7 +413,7 @@ const getOriginColumns = () => {
|
|
|
397
413
|
}
|
|
398
414
|
|
|
399
415
|
/**
|
|
400
|
-
*
|
|
416
|
+
* 得出合法的时间
|
|
401
417
|
* */
|
|
402
418
|
const correctValue = (value: number | string | Date): string | number => {
|
|
403
419
|
const isDateMode = props.mode !== DateModeEnum.TIME
|
|
@@ -417,7 +433,7 @@ const correctValue = (value: number | string | Date): string | number => {
|
|
|
417
433
|
}
|
|
418
434
|
}
|
|
419
435
|
/**
|
|
420
|
-
*
|
|
436
|
+
* 获取每列的最大和最小值
|
|
421
437
|
* */
|
|
422
438
|
const getRanges = () => {
|
|
423
439
|
if (props.mode === DateModeEnum.TIME) {
|
|
@@ -470,7 +486,7 @@ const getRanges = () => {
|
|
|
470
486
|
return arr
|
|
471
487
|
}
|
|
472
488
|
/**
|
|
473
|
-
*
|
|
489
|
+
* 根据minDate、maxDate、minHour、maxHour等边界值,判断各列的开始和结束边界值
|
|
474
490
|
* */
|
|
475
491
|
const getBoundary = (type: string, innerVal: string | number) => {
|
|
476
492
|
const value = new Date(innerVal)
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:mode="imgMode"
|
|
8
8
|
:style="[imgStyle, customStyle]"
|
|
9
9
|
></image>
|
|
10
|
-
<text v-else :class="
|
|
10
|
+
<text v-else :class="iconClass" :style="[iconStyle, customStyle]"></text>
|
|
11
11
|
<!-- 这里进行空字符串判断,如果仅仅是v-if="label",可能会出现传递0的时候,结果也无法显示 -->
|
|
12
12
|
<text
|
|
13
13
|
v-if="label"
|
|
@@ -41,7 +41,6 @@ import type { CSSProperties } from 'vue'
|
|
|
41
41
|
import { addUnit } from '../../libs'
|
|
42
42
|
import type { IIconEmits } from './typing'
|
|
43
43
|
import iconProps from './props'
|
|
44
|
-
import { onPageScroll } from '@dcloudio/uni-app'
|
|
45
44
|
|
|
46
45
|
/**
|
|
47
46
|
* 基于字体的图标集,包含了大多数常见场景的图标,使用简单,开箱即用,无需自己再写每个图标的样式,直接简单配置即可。支持自定义图标。
|
|
@@ -52,10 +51,10 @@ defineOptions({})
|
|
|
52
51
|
const props = defineProps(iconProps)
|
|
53
52
|
const emit = defineEmits<IIconEmits>()
|
|
54
53
|
|
|
55
|
-
const
|
|
54
|
+
const iconClass = computed(() => {
|
|
56
55
|
let classes: string | string[] = [
|
|
57
56
|
'hy-icon__icon',
|
|
58
|
-
|
|
57
|
+
props.customPrefix,
|
|
59
58
|
`${props.customPrefix}-${props.name}`
|
|
60
59
|
]
|
|
61
60
|
if (props.isRotate) classes.push('hy-rotate')
|
|
@@ -84,7 +83,7 @@ const iconStyle = computed<CSSProperties>(() => {
|
|
|
84
83
|
})
|
|
85
84
|
|
|
86
85
|
/**
|
|
87
|
-
*
|
|
86
|
+
* 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式
|
|
88
87
|
* */
|
|
89
88
|
const isImg = computed(() => {
|
|
90
89
|
return props.name?.indexOf('/') !== -1
|
|
@@ -99,7 +98,7 @@ const imgStyle = computed((): CSSProperties => {
|
|
|
99
98
|
})
|
|
100
99
|
|
|
101
100
|
/**
|
|
102
|
-
*
|
|
101
|
+
* 点击icon图标执行
|
|
103
102
|
* */
|
|
104
103
|
const clickHandler = (e: Event) => {
|
|
105
104
|
emit('click', props.index, e)
|
|
@@ -1,60 +1,61 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<hy-transition
|
|
3
|
-
:show="show"
|
|
4
|
-
:custom-class="`hy-overlay ${customClass}`"
|
|
5
|
-
:duration="duration"
|
|
6
|
-
:custom-style="overlayStyle"
|
|
7
|
-
@click="clickHandler"
|
|
8
|
-
>
|
|
9
|
-
<slot />
|
|
10
|
-
</hy-transition>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script lang="ts">
|
|
14
|
-
export default {
|
|
15
|
-
name: 'hy-overlay',
|
|
16
|
-
options: {
|
|
17
|
-
addGlobalClass: true,
|
|
18
|
-
virtualHost: true,
|
|
19
|
-
styleIsolation: 'shared'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<script setup lang="ts">
|
|
25
|
-
import { computed } from 'vue'
|
|
26
|
-
import type { CSSProperties } from 'vue'
|
|
27
|
-
import type { IOverlayEmits } from './typing'
|
|
28
|
-
import overlayProps from './props'
|
|
29
|
-
// 组件
|
|
30
|
-
import HyTransition from '../hy-transition/hy-transition.vue'
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
|
|
34
|
-
* @displayName hy-overlay
|
|
35
|
-
*/
|
|
36
|
-
defineOptions({})
|
|
37
|
-
|
|
38
|
-
const props = defineProps(overlayProps)
|
|
39
|
-
const emit = defineEmits<IOverlayEmits>()
|
|
40
|
-
|
|
41
|
-
const overlayStyle = computed<CSSProperties>(() => {
|
|
42
|
-
const style: CSSProperties = {
|
|
43
|
-
position: 'fixed',
|
|
44
|
-
top: 0,
|
|
45
|
-
left: 0,
|
|
46
|
-
right: 0,
|
|
47
|
-
zIndex: props.zIndex,
|
|
48
|
-
bottom: 0,
|
|
49
|
-
'
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<hy-transition
|
|
3
|
+
:show="show"
|
|
4
|
+
:custom-class="`hy-overlay ${customClass}`"
|
|
5
|
+
:duration="duration"
|
|
6
|
+
:custom-style="overlayStyle"
|
|
7
|
+
@click="clickHandler"
|
|
8
|
+
>
|
|
9
|
+
<slot />
|
|
10
|
+
</hy-transition>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
export default {
|
|
15
|
+
name: 'hy-overlay',
|
|
16
|
+
options: {
|
|
17
|
+
addGlobalClass: true,
|
|
18
|
+
virtualHost: true,
|
|
19
|
+
styleIsolation: 'shared'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import { computed } from 'vue'
|
|
26
|
+
import type { CSSProperties } from 'vue'
|
|
27
|
+
import type { IOverlayEmits } from './typing'
|
|
28
|
+
import overlayProps from './props'
|
|
29
|
+
// 组件
|
|
30
|
+
import HyTransition from '../hy-transition/hy-transition.vue'
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
|
|
34
|
+
* @displayName hy-overlay
|
|
35
|
+
*/
|
|
36
|
+
defineOptions({})
|
|
37
|
+
|
|
38
|
+
const props = defineProps(overlayProps)
|
|
39
|
+
const emit = defineEmits<IOverlayEmits>()
|
|
40
|
+
|
|
41
|
+
const overlayStyle = computed<CSSProperties>(() => {
|
|
42
|
+
const style: CSSProperties = {
|
|
43
|
+
position: 'fixed',
|
|
44
|
+
top: 0,
|
|
45
|
+
left: 0,
|
|
46
|
+
right: 0,
|
|
47
|
+
zIndex: props.zIndex,
|
|
48
|
+
bottom: 0,
|
|
49
|
+
pointerEvents: !props.LockScroll ? 'none' : 'auto',
|
|
50
|
+
'background-color': `rgba(0, 0, 0, ${props.opacity})`
|
|
51
|
+
}
|
|
52
|
+
return Object.assign(style, props.customStyle)
|
|
53
|
+
})
|
|
54
|
+
const clickHandler = () => {
|
|
55
|
+
emit('click')
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style lang="scss" scoped>
|
|
60
|
+
@import './index.scss';
|
|
61
|
+
</style>
|
|
@@ -1,33 +1,38 @@
|
|
|
1
|
-
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
-
|
|
3
|
-
const overlayProps = {
|
|
4
|
-
/** 是否显示遮罩 */
|
|
5
|
-
show: {
|
|
6
|
-
type: Boolean,
|
|
7
|
-
default: false
|
|
8
|
-
},
|
|
9
|
-
/** zIndex 层级 */
|
|
10
|
-
zIndex: {
|
|
11
|
-
type: Number,
|
|
12
|
-
default: 10070
|
|
13
|
-
},
|
|
14
|
-
/** 动画时长,单位毫秒 */
|
|
15
|
-
duration: {
|
|
16
|
-
type: Number,
|
|
17
|
-
default: 300
|
|
18
|
-
},
|
|
19
|
-
/** 不透明度值,当做rgba的第四个参数 */
|
|
20
|
-
opacity: {
|
|
21
|
-
type: Number,
|
|
22
|
-
default: 0.5
|
|
23
|
-
},
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
type:
|
|
27
|
-
default:
|
|
28
|
-
},
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
import type { CSSProperties, PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
const overlayProps = {
|
|
4
|
+
/** 是否显示遮罩 */
|
|
5
|
+
show: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: false
|
|
8
|
+
},
|
|
9
|
+
/** zIndex 层级 */
|
|
10
|
+
zIndex: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 10070
|
|
13
|
+
},
|
|
14
|
+
/** 动画时长,单位毫秒 */
|
|
15
|
+
duration: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 300
|
|
18
|
+
},
|
|
19
|
+
/** 不透明度值,当做rgba的第四个参数 */
|
|
20
|
+
opacity: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 0.5
|
|
23
|
+
},
|
|
24
|
+
/** 是否锁住底部滚动 */
|
|
25
|
+
LockScroll: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
/** 定义需要用到的外部样式 */
|
|
30
|
+
customStyle: {
|
|
31
|
+
type: Object as PropType<CSSProperties>,
|
|
32
|
+
default: () => {}
|
|
33
|
+
},
|
|
34
|
+
/** 自定义外部类名 */
|
|
35
|
+
customClass: String
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default overlayProps
|