@tplc/business 0.5.66 → 0.5.68

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,33 @@
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.68](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.67...v0.5.68) (2025-12-03)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * area 支持 点击 支持布局调整 button 支持动态链接 接口 ([2fdcfc5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/2fdcfc502f5acf9c2c23beea1cea1a3691ada41b))
11
+
12
+ ### [0.5.67](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.64...v0.5.67) (2025-12-03)
13
+
14
+
15
+ ### 🚀 Chore | 构建/工程依赖/工具
16
+
17
+ * **release:** 0.5.65 ([8752c6d](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/8752c6dca30392c83235e19e5c8a4d4bf8751ec7))
18
+ * **release:** 0.5.66 ([776fb88](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/776fb889e9a92612f9fe58606c283b4970e9a6eb))
19
+
20
+
21
+ ### 🐛 Bug Fixes | Bug 修复
22
+
23
+ * image 横向 ([ef2fe2a](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/ef2fe2a4f62fc8e5a28d911ef2c9bf816806e32b))
24
+ * 修改外面包裹view ([9d7906e](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/9d7906e6f0f754ee35bb0a5eb69e42cba42330e2))
25
+
26
+
27
+ ### ✨ Features | 新功能
28
+
29
+ * 修改字段数据 ([45a6a74](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/45a6a74d6cb4090314a2113cfcb6c4eb9df9ffa8))
30
+ * 兼容nav ([bcb45b6](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/bcb45b679894e6e72d3a9c75b1de326e3424c395))
31
+
5
32
  ### [0.5.66](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.65...v0.5.66) (2025-12-03)
6
33
 
7
34
  ### [0.5.65](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.54...v0.5.65) (2025-12-03)
@@ -8,6 +8,7 @@
8
8
  >
9
9
  <slot />
10
10
  </view>
11
+
11
12
  <button
12
13
  v-else
13
14
  @click.stop="onActionClick"
@@ -1,33 +1,35 @@
1
1
  <template>
2
- <lcb-block v-bind="$props" v-if="showArea">
3
- <view
4
- class="h-full"
5
- :style="{
6
- display: display,
7
- gap: transformValueUnit(gap),
8
- overflowX: scrollX ? 'auto' : 'initial',
9
- ...innerStyle,
10
- }"
11
- >
2
+ <lcb-action-view v-bind="action" v-if="showArea">
3
+ <lcb-block v-bind="$props">
12
4
  <view
13
- v-for="(item, index) in list"
14
- :key="item.id"
15
- class="slot-wrapper"
16
5
  :style="{
17
- ...getStyle(index),
18
- overflowX,
6
+ display: display,
7
+ gap: transformValueUnit(gap),
8
+ overflowX: scrollX ? 'auto' : 'initial',
9
+ ...innerStyle,
19
10
  }"
11
+ class="h-full"
20
12
  >
21
- <slot :item="item" />
13
+ <view
14
+ v-for="(item, index) in list"
15
+ :key="item.id"
16
+ class="slot-wrapper"
17
+ :style="{
18
+ ...getStyle(index),
19
+ overflowX,
20
+ }"
21
+ >
22
+ <slot :item="item" />
23
+ </view>
22
24
  </view>
23
- </view>
24
- </lcb-block>
25
+ </lcb-block>
26
+ </lcb-action-view>
25
27
  </template>
26
28
 
27
29
  <script setup lang="ts">
28
- import { computed, inject, Ref } from 'vue'
30
+ import { computed, inject, Ref, watch } from 'vue'
29
31
  import { LcbAreaProps } from './types'
30
- import { transformValueUnit } from '@tplc/business/utils/transform'
32
+ import { getFlexStyle, transformValueUnit } from '@tplc/business/utils/transform'
31
33
  import { get } from 'lodash-es'
32
34
  import { PAGE_PROVIDE_KEY } from '@tplc/business/constants'
33
35
  defineOptions({
@@ -59,6 +61,7 @@ const innerStyle = computed(() => {
59
61
  const getStyle = (index: number) => {
60
62
  const flex = props.areaFlexs?.[index]?.flex ?? 1
61
63
  return {
64
+ ...getFlexStyle(props.itemAlign),
62
65
  gridColumn:
63
66
  props.areaItems?.[index]?.colSpan && props.display === 'grid'
64
67
  ? `span ${props.areaItems?.[index]?.colSpan} / span ${props.areaItems?.[index]?.colSpan}`
@@ -69,6 +72,25 @@ const getStyle = (index: number) => {
69
72
  }
70
73
  }
71
74
 
75
+ const getData = async () => {
76
+ if (props.requestUrl) {
77
+ const { data } = await uni.$lcb.http.post(props.requestUrl, {})
78
+ pageInfo.value = {
79
+ ...pageInfo.value,
80
+ ...(data as Record<string, any>),
81
+ }
82
+ }
83
+ }
84
+
85
+ watch(
86
+ () => props.requestUrl,
87
+ () => {
88
+ getData()
89
+ },
90
+ {
91
+ immediate: true,
92
+ },
93
+ )
72
94
  const showArea = computed(() => {
73
95
  if (props.dependKey) {
74
96
  const userStore = uni.$lcb.userStore?.()
@@ -102,6 +124,10 @@ const showArea = computed(() => {
102
124
  }
103
125
  return true
104
126
  })
127
+
128
+ const handleClick = () => {
129
+ console.log('handleClick')
130
+ }
105
131
  </script>
106
132
 
107
133
  <style lang="scss" scoped>
@@ -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
  }
@@ -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="{
@@ -5,7 +5,7 @@
5
5
  :key="index"
6
6
  class="flex-shrink-0"
7
7
  :style="{
8
- width: width ? transformValueUnit(width) : '100%',
8
+ width: childrenAutoWidth ? 'auto' : width ? transformValueUnit(width) : '100%',
9
9
  }"
10
10
  >
11
11
  <slot :data="item" :list="list" />
@@ -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 = {
@@ -10,4 +10,5 @@ export interface LcbWrapperListProps extends LcbBlockProps {
10
10
  gridColumns?: number
11
11
  scrollX?: boolean
12
12
  list?: LcbAreaProps[]
13
+ childrenAutoWidth?: boolean
13
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.66",
3
+ "version": "0.5.68",
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
  }
@@ -10,4 +10,5 @@ export interface LcbWrapperListProps extends LcbBlockProps {
10
10
  gridColumns?: number
11
11
  scrollX?: boolean
12
12
  list?: LcbAreaProps[]
13
+ childrenAutoWidth?: boolean
13
14
  }