@tplc/business 0.4.55 → 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 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.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
+
12
+ ### [0.4.56](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.55...v0.4.56) (2025-04-04)
13
+
5
14
  ### [0.4.55](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.53...v0.4.55) (2025-04-04)
6
15
 
7
16
 
@@ -18,6 +18,7 @@
18
18
  borderWidth: transformValueUnit(borderWidth),
19
19
  boxShadow:
20
20
  shadowColor && shadowSize ? `0px 0px ${blurSize}px ${shadowSize}px ${shadowColor}` : '',
21
+ textAlign,
21
22
  ...customStyle,
22
23
  }"
23
24
  class="box-border overflow-hidden relative"
@@ -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,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
  }
@@ -101,7 +101,12 @@ const onCancel = () => {
101
101
  }
102
102
 
103
103
  const onAddressClick = (item: LcbAddress) => {
104
- modelValue.value = item as ChildHotAddress
104
+ modelValue.value = {
105
+ addressName: item.addressName,
106
+ cityId: item.cityId,
107
+ areaId: item.areaId,
108
+ provinceId: item.provinceId,
109
+ } as ChildHotAddress
105
110
  onCancel()
106
111
  show.value = false
107
112
  }
@@ -110,7 +115,6 @@ watch(
110
115
  (val) => {
111
116
  if (val && !modelValue.value) {
112
117
  modelValue.value = {
113
- addressInfo: val.addressInfo,
114
118
  addressName: val.showName || val.cityName,
115
119
  cityId: val.cityId,
116
120
  areaId: val.areaId,
@@ -189,7 +193,12 @@ watch(
189
193
 
190
194
  const onSelectChange = (val: ChildHotAddress) => {
191
195
  if (JSON.stringify(val) !== JSON.stringify(modelValue.value)) {
192
- modelValue.value = val
196
+ modelValue.value = {
197
+ addressName: val.addressName,
198
+ cityId: val.cityId,
199
+ areaId: val.areaId,
200
+ provinceId: val.provinceId,
201
+ } as ChildHotAddress
193
202
  }
194
203
  }
195
204
  onMounted(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.55",
3
+ "version": "0.4.57",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -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
  }
@@ -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
+ }