@tplc/business 0.4.56 → 0.4.57
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/CHANGELOG.md +7 -0
- package/components/lcb-block/lcb-block.vue +1 -0
- package/components/lcb-button/lcb-button.vue +49 -16
- package/components/lcb-button/types.ts +23 -0
- package/package.json +1 -1
- package/types/components/lcb-button/types.d.ts +22 -0
- package/types/utils/transform.d.ts +1 -0
- package/utils/transform.ts +47 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.4.57](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.56...v0.4.57) (2025-04-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* 调整地址策略 ([9b9a258](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/9b9a2583864075e4daac9a192ec91f8b91e2ce9d))
|
|
11
|
+
|
|
5
12
|
### [0.4.56](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.55...v0.4.56) (2025-04-04)
|
|
6
13
|
|
|
7
14
|
### [0.4.55](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.53...v0.4.55) (2025-04-04)
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
<view
|
|
3
|
+
class="w-full h-full"
|
|
4
|
+
:style="{
|
|
5
|
+
...innerStyle,
|
|
6
|
+
}"
|
|
7
|
+
>
|
|
8
|
+
<lcb-block
|
|
9
|
+
v-bind="$props"
|
|
10
|
+
customClass="border-solid"
|
|
11
|
+
:customStyle="{
|
|
12
|
+
width: props.fillWidth ? '100%' : 'fit-content',
|
|
13
|
+
height: props.fillHeight ? '100%' : 'fit-content',
|
|
14
|
+
...innerItemStyle,
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<lcb-action-view v-bind="action" @avatar="onAvatar">
|
|
18
|
+
<template v-if="mode === 'image'">
|
|
19
|
+
<wd-img
|
|
20
|
+
:src="innerValue || props.url"
|
|
21
|
+
:width="imageWidth"
|
|
22
|
+
:height="imageHeight"
|
|
23
|
+
mode="aspectFit"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
<template v-else>{{ innerValue || props.text }}</template>
|
|
27
|
+
</lcb-action-view>
|
|
28
|
+
</lcb-block>
|
|
29
|
+
</view>
|
|
15
30
|
</template>
|
|
16
31
|
|
|
17
32
|
<script setup lang="ts">
|
|
18
33
|
import { computed, inject, Ref } from 'vue'
|
|
19
34
|
import { LcbButtonProps } from './types'
|
|
20
35
|
import { PAGE_PROVIDE_KEY } from '../../constants'
|
|
36
|
+
import { getFlexStyle } from '../../utils/transform'
|
|
21
37
|
defineOptions({
|
|
22
38
|
name: 'LcbButton',
|
|
23
39
|
options: {
|
|
@@ -33,17 +49,34 @@ const props = withDefaults(defineProps<LcbButtonProps>(), {
|
|
|
33
49
|
const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
|
|
34
50
|
const userStore = uni.$lcb.userStore?.()
|
|
35
51
|
const innerValue = computed(() => {
|
|
52
|
+
let value = ''
|
|
36
53
|
if (props.dynamicKey) {
|
|
37
54
|
if (props.keyFromUser) {
|
|
38
|
-
|
|
55
|
+
value = userStore?.userInfo?.[props.dynamicKey]
|
|
56
|
+
} else {
|
|
57
|
+
value = pageInfo.value?.[props.dynamicKey]
|
|
39
58
|
}
|
|
40
|
-
return pageInfo.value?.[props.dynamicKey]
|
|
41
59
|
}
|
|
42
|
-
|
|
60
|
+
if (props.text.includes('${')) {
|
|
61
|
+
value = props.text.replace(/\$\{([^}]+)\}/g, (_, p1) => {
|
|
62
|
+
if (props.keyFromUser) {
|
|
63
|
+
return userStore?.userInfo?.[p1] || ''
|
|
64
|
+
} else {
|
|
65
|
+
return pageInfo.value?.[p1] || ''
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
return value
|
|
43
70
|
})
|
|
44
71
|
const onAvatar = (headImgUrl) => {
|
|
45
72
|
userStore?.updateUser({
|
|
46
73
|
headImgUrl,
|
|
47
74
|
})
|
|
48
75
|
}
|
|
76
|
+
const innerStyle = computed(() => {
|
|
77
|
+
return getFlexStyle(props.align)
|
|
78
|
+
})
|
|
79
|
+
const innerItemStyle = computed(() => {
|
|
80
|
+
return getFlexStyle(props.itemAlign)
|
|
81
|
+
})
|
|
49
82
|
</script>
|
|
@@ -10,4 +10,27 @@ export interface LcbButtonProps extends LcbBlockProps {
|
|
|
10
10
|
imageHeight?: number
|
|
11
11
|
dynamicKey?: string
|
|
12
12
|
keyFromUser?: boolean
|
|
13
|
+
fillWidth?: boolean
|
|
14
|
+
fillHeight?: boolean
|
|
15
|
+
align?:
|
|
16
|
+
| 'top-left'
|
|
17
|
+
| 'top-center'
|
|
18
|
+
| 'top-right'
|
|
19
|
+
| 'center-left'
|
|
20
|
+
| 'center-center'
|
|
21
|
+
| 'center-right'
|
|
22
|
+
| 'bottom-left'
|
|
23
|
+
| 'bottom-center'
|
|
24
|
+
| 'bottom-right'
|
|
25
|
+
|
|
26
|
+
itemAlign?:
|
|
27
|
+
| 'top-left'
|
|
28
|
+
| 'top-center'
|
|
29
|
+
| 'top-right'
|
|
30
|
+
| 'center-left'
|
|
31
|
+
| 'center-center'
|
|
32
|
+
| 'center-right'
|
|
33
|
+
| 'bottom-left'
|
|
34
|
+
| 'bottom-center'
|
|
35
|
+
| 'bottom-right'
|
|
13
36
|
}
|
package/package.json
CHANGED
|
@@ -9,4 +9,26 @@ export interface LcbButtonProps extends LcbBlockProps {
|
|
|
9
9
|
imageHeight?: number
|
|
10
10
|
dynamicKey?: string
|
|
11
11
|
keyFromUser?: boolean
|
|
12
|
+
fillWidth?: boolean
|
|
13
|
+
fillHeight?: boolean
|
|
14
|
+
align?:
|
|
15
|
+
| 'top-left'
|
|
16
|
+
| 'top-center'
|
|
17
|
+
| 'top-right'
|
|
18
|
+
| 'center-left'
|
|
19
|
+
| 'center-center'
|
|
20
|
+
| 'center-right'
|
|
21
|
+
| 'bottom-left'
|
|
22
|
+
| 'bottom-center'
|
|
23
|
+
| 'bottom-right'
|
|
24
|
+
itemAlign?:
|
|
25
|
+
| 'top-left'
|
|
26
|
+
| 'top-center'
|
|
27
|
+
| 'top-right'
|
|
28
|
+
| 'center-left'
|
|
29
|
+
| 'center-center'
|
|
30
|
+
| 'center-right'
|
|
31
|
+
| 'bottom-left'
|
|
32
|
+
| 'bottom-center'
|
|
33
|
+
| 'bottom-right'
|
|
12
34
|
}
|
package/utils/transform.ts
CHANGED
|
@@ -48,3 +48,50 @@ export const getSliderTitle = (
|
|
|
48
48
|
return ''
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
export const getFlexStyle = (align?: string) => {
|
|
53
|
+
const style: Record<string, string> = {}
|
|
54
|
+
|
|
55
|
+
if (align) {
|
|
56
|
+
style.display = 'flex'
|
|
57
|
+
switch (align) {
|
|
58
|
+
case 'top-left':
|
|
59
|
+
style.justifyContent = 'flex-start'
|
|
60
|
+
style.alignItems = 'flex-start'
|
|
61
|
+
break
|
|
62
|
+
case 'top-center':
|
|
63
|
+
style.justifyContent = 'center'
|
|
64
|
+
style.alignItems = 'flex-start'
|
|
65
|
+
break
|
|
66
|
+
case 'top-right':
|
|
67
|
+
style.justifyContent = 'flex-end'
|
|
68
|
+
style.alignItems = 'flex-start'
|
|
69
|
+
break
|
|
70
|
+
case 'center-left':
|
|
71
|
+
style.justifyContent = 'flex-start'
|
|
72
|
+
style.alignItems = 'center'
|
|
73
|
+
break
|
|
74
|
+
case 'center-center':
|
|
75
|
+
style.justifyContent = 'center'
|
|
76
|
+
style.alignItems = 'center'
|
|
77
|
+
break
|
|
78
|
+
case 'center-right':
|
|
79
|
+
style.justifyContent = 'flex-end'
|
|
80
|
+
style.alignItems = 'center'
|
|
81
|
+
break
|
|
82
|
+
case 'bottom-left':
|
|
83
|
+
style.justifyContent = 'flex-start'
|
|
84
|
+
style.alignItems = 'flex-end'
|
|
85
|
+
break
|
|
86
|
+
case 'bottom-center':
|
|
87
|
+
style.justifyContent = 'center'
|
|
88
|
+
style.alignItems = 'flex-end'
|
|
89
|
+
break
|
|
90
|
+
case 'bottom-right':
|
|
91
|
+
style.justifyContent = 'flex-end'
|
|
92
|
+
style.alignItems = 'flex-end'
|
|
93
|
+
break
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return style
|
|
97
|
+
}
|