@tplc/business 0.5.65 → 0.5.67

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,28 @@
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.5.67](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.64...v0.5.67) (2025-12-03)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.5.65 ([8752c6d](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/8752c6dca30392c83235e19e5c8a4d4bf8751ec7))
11
+ * **release:** 0.5.66 ([776fb88](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/776fb889e9a92612f9fe58606c283b4970e9a6eb))
12
+
13
+
14
+ ### 🐛 Bug Fixes | Bug 修复
15
+
16
+ * image 横向 ([ef2fe2a](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/ef2fe2a4f62fc8e5a28d911ef2c9bf816806e32b))
17
+ * 修改外面包裹view ([9d7906e](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/9d7906e6f0f754ee35bb0a5eb69e42cba42330e2))
18
+
19
+
20
+ ### ✨ Features | 新功能
21
+
22
+ * 修改字段数据 ([45a6a74](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/45a6a74d6cb4090314a2113cfcb6c4eb9df9ffa8))
23
+ * 兼容nav ([bcb45b6](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/bcb45b679894e6e72d3a9c75b1de326e3424c395))
24
+
25
+ ### [0.5.66](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.65...v0.5.66) (2025-12-03)
26
+
5
27
  ### [0.5.65](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.54...v0.5.65) (2025-12-03)
6
28
 
7
29
 
@@ -1,13 +1,14 @@
1
1
  <template>
2
2
  <lcb-block v-bind="$props" v-if="showArea">
3
- <view
4
- class="h-full"
5
- :style="{
3
+ <lcb-action-view
4
+ :customStyle="{
6
5
  display: display,
7
6
  gap: transformValueUnit(gap),
8
7
  overflowX: scrollX ? 'auto' : 'initial',
9
8
  ...innerStyle,
10
9
  }"
10
+ customClass="h-full"
11
+ v-bind="action"
11
12
  >
12
13
  <view
13
14
  v-for="(item, index) in list"
@@ -20,14 +21,14 @@
20
21
  >
21
22
  <slot :item="item" />
22
23
  </view>
23
- </view>
24
+ </lcb-action-view>
24
25
  </lcb-block>
25
26
  </template>
26
27
 
27
28
  <script setup lang="ts">
28
- import { computed, inject, Ref } from 'vue'
29
+ import { computed, inject, Ref, watch } from 'vue'
29
30
  import { LcbAreaProps } from './types'
30
- import { transformValueUnit } from '@tplc/business/utils/transform'
31
+ import { getFlexStyle, transformValueUnit } from '@tplc/business/utils/transform'
31
32
  import { get } from 'lodash-es'
32
33
  import { PAGE_PROVIDE_KEY } from '@tplc/business/constants'
33
34
  defineOptions({
@@ -59,6 +60,7 @@ const innerStyle = computed(() => {
59
60
  const getStyle = (index: number) => {
60
61
  const flex = props.areaFlexs?.[index]?.flex ?? 1
61
62
  return {
63
+ ...getFlexStyle(props.itemAlign),
62
64
  gridColumn:
63
65
  props.areaItems?.[index]?.colSpan && props.display === 'grid'
64
66
  ? `span ${props.areaItems?.[index]?.colSpan} / span ${props.areaItems?.[index]?.colSpan}`
@@ -69,6 +71,25 @@ const getStyle = (index: number) => {
69
71
  }
70
72
  }
71
73
 
74
+ const getData = async () => {
75
+ if (props.requestUrl) {
76
+ const { data } = await uni.$lcb.http.post(props.requestUrl, {})
77
+ pageInfo.value = {
78
+ ...pageInfo.value,
79
+ ...(data as Record<string, any>),
80
+ }
81
+ }
82
+ }
83
+
84
+ watch(
85
+ () => props.requestUrl,
86
+ () => {
87
+ getData()
88
+ },
89
+ {
90
+ immediate: true,
91
+ },
92
+ )
72
93
  const showArea = computed(() => {
73
94
  if (props.dependKey) {
74
95
  const userStore = uni.$lcb.userStore?.()
@@ -1,3 +1,4 @@
1
+ import { LcbActionViewProps } from 'components/lcb-action-view/types'
1
2
  import { LcbBlockProps } from '../lcb-block/types'
2
3
  export interface LcbAreaProps extends LcbBlockProps {
3
4
  id?: number
@@ -23,4 +24,16 @@ export interface LcbAreaProps extends LcbBlockProps {
23
24
  dependKeyCompareValue?: string
24
25
  position?: 'relative' | 'absolute'
25
26
  compareType?: '=' | '>=' | '<=' | '>' | '<' | '!=' | 'includes'
27
+ requestUrl?: string
28
+ action?: LcbActionViewProps
29
+ itemAlign?:
30
+ | 'top-left'
31
+ | 'top-center'
32
+ | 'top-right'
33
+ | 'center-left'
34
+ | 'center-center'
35
+ | 'center-right'
36
+ | 'bottom-left'
37
+ | 'bottom-center'
38
+ | 'bottom-right'
26
39
  }
@@ -82,12 +82,11 @@ const props = withDefaults(defineProps<LcbButtonProps>(), {
82
82
  const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
83
83
  const wrapperItemData = inject(WRAPPER_ITEM_KEY, undefined) as unknown as Ref<Record<string, any>>
84
84
  const userStore = uni.$lcb.userStore?.()
85
+ const innerStore = computed(() => {
86
+ return wrapperItemData ? wrapperItemData.value : pageInfo.value
87
+ })
85
88
  const store = computed(() => {
86
- return props.keyFromUser
87
- ? userStore?.userInfo
88
- : wrapperItemData
89
- ? wrapperItemData.value
90
- : pageInfo.value
89
+ return props.keyFromUser ? userStore?.userInfo : innerStore.value
91
90
  })
92
91
 
93
92
  const dynamicValue = computed(() => {
@@ -118,6 +117,9 @@ const innerValue = computed(() => {
118
117
 
119
118
  /** 处理跳转链接中的动态参数 */
120
119
  const actionProps = computed(() => {
120
+ if (props.dynamicActionKey) {
121
+ return get(innerStore.value, props.dynamicActionKey)
122
+ }
121
123
  return {
122
124
  ...props.action,
123
125
  jumpUrl: getDynamicData(props.action?.jumpUrl, {
@@ -33,4 +33,6 @@ export interface LcbButtonProps extends LcbBlockProps {
33
33
  | 'bottom-left'
34
34
  | 'bottom-center'
35
35
  | 'bottom-right'
36
+ // 动态action key
37
+ dynamicActionKey?: string
36
38
  }
@@ -66,6 +66,14 @@ import { LcbImageProps } from '../types'
66
66
  import { transformValueUnit } from '../../../utils/transform'
67
67
  import { calcAutoHeight, getOssImageSize } from '../../../utils/utils'
68
68
  import { getCurrentInstance, onMounted, ref } from 'vue'
69
+ defineOptions({
70
+ name: 'LcbImageImage',
71
+ options: {
72
+ addGlobalClass: true,
73
+ virtualHost: true,
74
+ styleIsolation: 'shared',
75
+ },
76
+ })
69
77
  const props = withDefaults(defineProps<LcbImageProps>(), {
70
78
  imageMargin: 0,
71
79
  })
@@ -240,7 +240,12 @@ const itemStyle = computed(() => {
240
240
  </ItemValue>
241
241
  </view>
242
242
  <view class="flex-1"></view>
243
- <view class="flex flex-col gap-1 items-end leading-none">
243
+ <view
244
+ class="flex flex-col gap-1 items-end leading-none"
245
+ :style="{
246
+ marginTop: transformValueUnit(itemGap),
247
+ }"
248
+ >
244
249
  <view class="flex gap-1 justify-end">
245
250
  <view
246
251
  class="flex gap-[2rpx] items-end line-through"
@@ -400,7 +405,12 @@ const itemStyle = computed(() => {
400
405
  <ItemValue prop="distanceTips" v-if="distanceTipsVisible"></ItemValue>
401
406
  </view>
402
407
  <view class="flex-1"></view>
403
- <view class="flex flex-col gap-1 items-end leading-none">
408
+ <view
409
+ class="flex flex-col gap-1 items-end leading-none"
410
+ :style="{
411
+ marginTop: transformValueUnit(itemGap),
412
+ }"
413
+ >
404
414
  <view
405
415
  class="flex gap-1 justify-end"
406
416
  :style="{
@@ -33,31 +33,37 @@ const props = withDefaults(defineProps<LcbWrapperListProps>(), {
33
33
  })
34
34
  const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
35
35
  const userStore = uni.$lcb.userStore?.()
36
- const renderList = ref<unknown[]>([
37
- { walletAmount: 1 },
38
- { walletAmount: 2 },
39
- { walletAmount: 3 },
40
- { walletAmount: 4 },
41
- ])
36
+ const renderList = ref<unknown[]>([{ walletAmount: 1 }])
37
+
38
+ const transformStringArrayToObjectArray = (data: unknown[]): unknown[] => {
39
+ return data.map((item) => {
40
+ if (typeof item === 'string') {
41
+ return { label: item }
42
+ }
43
+ return item
44
+ })
45
+ }
42
46
 
43
47
  watchEffect(async () => {
48
+ let data: unknown[] = []
44
49
  if (props.dataSource?.source === 'remote') {
45
50
  if (props.dataSource.requestInfo?.requestUrl) {
46
- const { data } = await uni.$lcb.http.post(
51
+ const response = await uni.$lcb.http.post(
47
52
  props.dataSource.requestInfo.requestUrl,
48
53
  JSON.parse(props.dataSource.requestInfo.requestParams || '{}'),
49
54
  )
50
- renderList.value = data as unknown[]
55
+ /** 如果依赖key存在,则取依赖key的值 */
56
+ data = response[props.dataSource?.dependKey || 'data'] as unknown[]
51
57
  }
52
58
  } else if (props.dataSource?.dependKey) {
53
- renderList.value = get(
59
+ data = get(
54
60
  props.dataSource?.source === 'context' ? pageInfo.value : userStore?.userInfo,
55
61
  props.dataSource?.dependKey,
56
62
  [],
57
63
  )
58
- } else {
59
- renderList.value = []
60
64
  }
65
+ // 转换字符串数组为对象数组的辅助函数
66
+ renderList.value = Array.isArray(data) ? transformStringArrayToObjectArray(data) : []
61
67
  })
62
68
  const listStyle = computed(() => {
63
69
  const style = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.65",
3
+ "version": "0.5.67",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -1,3 +1,4 @@
1
+ import { LcbActionViewProps } from 'components/lcb-action-view/types'
1
2
  import { LcbBlockProps } from '../lcb-block/types'
2
3
  export interface LcbAreaProps extends LcbBlockProps {
3
4
  id?: number
@@ -23,4 +24,16 @@ export interface LcbAreaProps extends LcbBlockProps {
23
24
  dependKeyCompareValue?: string
24
25
  position?: 'relative' | 'absolute'
25
26
  compareType?: '=' | '>=' | '<=' | '>' | '<' | '!=' | 'includes'
27
+ requestUrl?: string
28
+ action?: LcbActionViewProps
29
+ itemAlign?:
30
+ | 'top-left'
31
+ | 'top-center'
32
+ | 'top-right'
33
+ | 'center-left'
34
+ | 'center-center'
35
+ | 'center-right'
36
+ | 'bottom-left'
37
+ | 'bottom-center'
38
+ | 'bottom-right'
26
39
  }
@@ -30,4 +30,5 @@ export interface LcbButtonProps extends LcbBlockProps {
30
30
  | 'bottom-left'
31
31
  | 'bottom-center'
32
32
  | 'bottom-right'
33
+ dynamicActionKey?: string
33
34
  }
@@ -66,10 +66,10 @@ declare const __VLS_component: import('vue').DefineComponent<
66
66
  | 'bottom-center'
67
67
  | 'bottom-right'
68
68
  gap: number
69
+ border: boolean
69
70
  imageWidth: number
70
71
  borderRadius: number
71
72
  imageHeight: number
72
- border: boolean
73
73
  dynamicScope: string
74
74
  itemVerticalPadding: number
75
75
  itemHorizontalPadding: number
@@ -68,13 +68,13 @@ declare const _default: import('vue').DefineComponent<
68
68
  marginHorizontal: number
69
69
  fontSize: number
70
70
  fontWeight: number
71
- lineWidth: number
72
71
  justify:
73
72
  | 'justify-start'
74
73
  | 'justify-end'
75
74
  | 'justify-center'
76
75
  | 'justify-between'
77
76
  | 'justify-around'
77
+ lineWidth: number
78
78
  iconType: 'icon' | 'img'
79
79
  hintColor: string
80
80
  hintFontSize: number