@tplc/business 0.4.56 → 0.4.58

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 CHANGED
@@ -2,6 +2,15 @@
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.58](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.57...v0.4.58) (2025-04-05)
6
+
7
+ ### [0.4.57](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.56...v0.4.57) (2025-04-05)
8
+
9
+
10
+ ### ✨ Features | 新功能
11
+
12
+ * 调整地址策略 ([9b9a258](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/9b9a2583864075e4daac9a192ec91f8b91e2ce9d))
13
+
5
14
  ### [0.4.56](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.55...v0.4.56) (2025-04-04)
6
15
 
7
16
  ### [0.4.55](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.53...v0.4.55) (2025-04-04)
@@ -18,7 +18,9 @@
18
18
  borderWidth: transformValueUnit(borderWidth),
19
19
  boxShadow:
20
20
  shadowColor && shadowSize ? `0px 0px ${blurSize}px ${shadowSize}px ${shadowColor}` : '',
21
+ textAlign,
21
22
  ...customStyle,
23
+ ...getFlexStyle(align),
22
24
  }"
23
25
  class="box-border overflow-hidden relative"
24
26
  :class="customClass"
@@ -29,7 +31,7 @@
29
31
 
30
32
  <script setup lang="ts">
31
33
  import { LcbBlockInnerProps } from './types'
32
- import { transformValueUnit } from '../../utils/transform'
34
+ import { transformValueUnit, getFlexStyle } from '../../utils/transform'
33
35
  import { computed } from 'vue'
34
36
  defineOptions({
35
37
  name: 'LcbBlock',
@@ -40,6 +40,16 @@ export interface LcbBlockProps {
40
40
  borderWidth?: number
41
41
  textAlign?: 'left' | 'center' | 'right'
42
42
  customStyle?: StyleValue
43
+ align?:
44
+ | 'top-left'
45
+ | 'top-center'
46
+ | 'top-right'
47
+ | 'center-left'
48
+ | 'center-center'
49
+ | 'center-right'
50
+ | 'bottom-left'
51
+ | 'bottom-center'
52
+ | 'bottom-right'
43
53
  }
44
54
  export interface LcbBlockInnerProps extends LcbBlockProps {
45
55
  [key: string]: any
@@ -1,23 +1,39 @@
1
1
  <template>
2
- <lcb-block v-bind="$props" customClass="border-solid !w-fit">
3
- <lcb-action-view v-bind="action" @avatar="onAvatar">
4
- <template v-if="mode === 'image'">
5
- <wd-img
6
- :src="innerValue || props.url"
7
- :width="imageWidth"
8
- :height="imageHeight"
9
- mode="aspectFit"
10
- />
11
- </template>
12
- <template v-else>{{ innerValue || props.text }}</template>
13
- </lcb-action-view>
14
- </lcb-block>
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
- return userStore?.userInfo?.[props.dynamicKey]
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
- return ''
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,16 @@ export interface LcbButtonProps extends LcbBlockProps {
10
10
  imageHeight?: number
11
11
  dynamicKey?: string
12
12
  keyFromUser?: boolean
13
+ fillWidth?: boolean
14
+ fillHeight?: boolean
15
+ itemAlign?:
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'
13
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.56",
3
+ "version": "0.4.58",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -38,6 +38,16 @@ export interface LcbBlockProps {
38
38
  borderWidth?: number
39
39
  textAlign?: 'left' | 'center' | 'right'
40
40
  customStyle?: StyleValue
41
+ align?:
42
+ | 'top-left'
43
+ | 'top-center'
44
+ | 'top-right'
45
+ | 'center-left'
46
+ | 'center-center'
47
+ | 'center-right'
48
+ | 'bottom-left'
49
+ | 'bottom-center'
50
+ | 'bottom-right'
41
51
  }
42
52
  export interface LcbBlockInnerProps extends LcbBlockProps {
43
53
  [key: string]: any
@@ -9,4 +9,16 @@ export interface LcbButtonProps extends LcbBlockProps {
9
9
  imageHeight?: number
10
10
  dynamicKey?: string
11
11
  keyFromUser?: boolean
12
+ fillWidth?: boolean
13
+ fillHeight?: boolean
14
+ itemAlign?:
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'
12
24
  }
@@ -49,6 +49,16 @@ declare const __VLS_component: import('vue').DefineComponent<
49
49
  borderColor: string
50
50
  borderWidth: number
51
51
  textAlign: 'left' | 'center' | 'right'
52
+ align:
53
+ | 'top-left'
54
+ | 'top-center'
55
+ | 'top-right'
56
+ | 'center-left'
57
+ | 'center-center'
58
+ | 'center-right'
59
+ | 'bottom-left'
60
+ | 'bottom-center'
61
+ | 'bottom-right'
52
62
  imageWidth: number
53
63
  borderRadius: number
54
64
  imageHeight: number
@@ -11,3 +11,4 @@ export declare const getSliderTitle: (
11
11
  max?: number,
12
12
  min?: number,
13
13
  ) => string
14
+ export declare const getFlexStyle: (align?: string) => Record<string, string>
@@ -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
+ }