@tplc/business 0.5.68 → 0.5.70
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 +23 -0
- package/components/lcb-area/lcb-area.vue +8 -10
- package/components/lcb-area/types.ts +2 -1
- package/components/lcb-wrapper-list/lcb-wrapper-list.vue +4 -16
- package/package.json +1 -1
- package/types/components/lcb-area/types.d.ts +2 -1
- package/types/utils/request.d.ts +6 -0
- package/utils/request.ts +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
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.70](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.66...v0.5.70) (2025-12-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
9
|
+
|
|
10
|
+
* image 横向 ([ef2fe2a](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/ef2fe2a4f62fc8e5a28d911ef2c9bf816806e32b))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### 🚀 Chore | 构建/工程依赖/工具
|
|
14
|
+
|
|
15
|
+
* **release:** 0.5.67 ([4f4f9b5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/4f4f9b54a17cae3798f395355af52fb99fc2e8bd))
|
|
16
|
+
* **release:** 0.5.68 ([32622d5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/32622d5b42001a4c5df49d00096f58fbc54daeb1))
|
|
17
|
+
* **release:** 0.5.69 ([2120870](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/21208704ca43470de5646948fa86d0a27a6e16f5))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### ✨ Features | 新功能
|
|
21
|
+
|
|
22
|
+
* area 支持 点击 支持布局调整 button 支持动态链接 接口 ([2fdcfc5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/2fdcfc502f5acf9c2c23beea1cea1a3691ada41b))
|
|
23
|
+
* 修改字段数据 ([45a6a74](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/45a6a74d6cb4090314a2113cfcb6c4eb9df9ffa8))
|
|
24
|
+
* 支持自适应 ([8cf03cc](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/8cf03cc6397ad85ff1d3938d60b769fc2f0d50ac))
|
|
25
|
+
|
|
26
|
+
### [0.5.69](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.68...v0.5.69) (2025-12-03)
|
|
27
|
+
|
|
5
28
|
### [0.5.68](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.67...v0.5.68) (2025-12-03)
|
|
6
29
|
|
|
7
30
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
overflowX: scrollX ? 'auto' : 'initial',
|
|
9
9
|
...innerStyle,
|
|
10
10
|
}"
|
|
11
|
-
class="h-full"
|
|
11
|
+
class="h-full z-1"
|
|
12
12
|
>
|
|
13
13
|
<view
|
|
14
14
|
v-for="(item, index) in list"
|
|
@@ -32,6 +32,7 @@ import { LcbAreaProps } from './types'
|
|
|
32
32
|
import { getFlexStyle, transformValueUnit } from '@tplc/business/utils/transform'
|
|
33
33
|
import { get } from 'lodash-es'
|
|
34
34
|
import { PAGE_PROVIDE_KEY } from '@tplc/business/constants'
|
|
35
|
+
import { dynamicRequest } from 'utils/request'
|
|
35
36
|
defineOptions({
|
|
36
37
|
name: 'LcbArea',
|
|
37
38
|
options: {
|
|
@@ -46,6 +47,7 @@ const props = withDefaults(defineProps<LcbAreaProps>(), {
|
|
|
46
47
|
overflowX: 'initial',
|
|
47
48
|
})
|
|
48
49
|
const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
|
|
50
|
+
const userStore = uni.$lcb.userStore?.()
|
|
49
51
|
const innerStyle = computed(() => {
|
|
50
52
|
if (props.display === 'grid') {
|
|
51
53
|
return {
|
|
@@ -73,27 +75,27 @@ const getStyle = (index: number) => {
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
const getData = async () => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
const daynamicData = await dynamicRequest(props.dataSource, pageInfo.value, userStore?.userInfo)
|
|
79
|
+
if (daynamicData) {
|
|
78
80
|
pageInfo.value = {
|
|
79
81
|
...pageInfo.value,
|
|
80
|
-
...
|
|
82
|
+
...daynamicData,
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
watch(
|
|
86
|
-
() => props.
|
|
88
|
+
() => props.dataSource,
|
|
87
89
|
() => {
|
|
88
90
|
getData()
|
|
89
91
|
},
|
|
90
92
|
{
|
|
91
93
|
immediate: true,
|
|
94
|
+
deep: true,
|
|
92
95
|
},
|
|
93
96
|
)
|
|
94
97
|
const showArea = computed(() => {
|
|
95
98
|
if (props.dependKey) {
|
|
96
|
-
const userStore = uni.$lcb.userStore?.()
|
|
97
99
|
const value = get(props.keyFromUser ? userStore?.userInfo : pageInfo.value, props.dependKey)
|
|
98
100
|
|
|
99
101
|
if (props.dependKeyCompareValue) {
|
|
@@ -124,10 +126,6 @@ const showArea = computed(() => {
|
|
|
124
126
|
}
|
|
125
127
|
return true
|
|
126
128
|
})
|
|
127
|
-
|
|
128
|
-
const handleClick = () => {
|
|
129
|
-
console.log('handleClick')
|
|
130
|
-
}
|
|
131
129
|
</script>
|
|
132
130
|
|
|
133
131
|
<style lang="scss" scoped>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LcbActionViewProps } from 'components/lcb-action-view/types'
|
|
2
2
|
import { LcbBlockProps } from '../lcb-block/types'
|
|
3
|
+
import { DataSource } from 'action'
|
|
3
4
|
export interface LcbAreaProps extends LcbBlockProps {
|
|
4
5
|
id?: number
|
|
5
6
|
fixed?: boolean
|
|
@@ -24,7 +25,7 @@ export interface LcbAreaProps extends LcbBlockProps {
|
|
|
24
25
|
dependKeyCompareValue?: string
|
|
25
26
|
position?: 'relative' | 'absolute'
|
|
26
27
|
compareType?: '=' | '>=' | '<=' | '>' | '<' | '!=' | 'includes'
|
|
27
|
-
|
|
28
|
+
dataSource?: DataSource
|
|
28
29
|
action?: LcbActionViewProps
|
|
29
30
|
itemAlign?:
|
|
30
31
|
| 'top-left'
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
17
|
import { computed, inject, Ref, ref, watchEffect } from 'vue'
|
|
18
18
|
import { LcbWrapperListProps } from './types'
|
|
19
|
-
import { get } from 'lodash-es'
|
|
20
19
|
import { PAGE_PROVIDE_KEY } from '@tplc/business/constants'
|
|
21
20
|
import { transformValueUnit } from '@tplc/business/utils/transform'
|
|
21
|
+
import { dynamicRequest } from '../../utils/request'
|
|
22
22
|
defineOptions({
|
|
23
23
|
name: 'LcbWrapperList',
|
|
24
24
|
options: {
|
|
@@ -46,21 +46,9 @@ const transformStringArrayToObjectArray = (data: unknown[]): unknown[] => {
|
|
|
46
46
|
|
|
47
47
|
watchEffect(async () => {
|
|
48
48
|
let data: unknown[] = []
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
props.dataSource.requestInfo.requestUrl,
|
|
53
|
-
JSON.parse(props.dataSource.requestInfo.requestParams || '{}'),
|
|
54
|
-
)
|
|
55
|
-
/** 如果依赖key存在,则取依赖key的值 */
|
|
56
|
-
data = response[props.dataSource?.dependKey || 'data'] as unknown[]
|
|
57
|
-
}
|
|
58
|
-
} else if (props.dataSource?.dependKey) {
|
|
59
|
-
data = get(
|
|
60
|
-
props.dataSource?.source === 'context' ? pageInfo.value : userStore?.userInfo,
|
|
61
|
-
props.dataSource?.dependKey,
|
|
62
|
-
[],
|
|
63
|
-
)
|
|
49
|
+
const daynamicData = await dynamicRequest(props.dataSource, pageInfo.value, userStore?.userInfo)
|
|
50
|
+
if (daynamicData) {
|
|
51
|
+
data = daynamicData
|
|
64
52
|
}
|
|
65
53
|
// 转换字符串数组为对象数组的辅助函数
|
|
66
54
|
renderList.value = Array.isArray(data) ? transformStringArrayToObjectArray(data) : []
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LcbActionViewProps } from 'components/lcb-action-view/types'
|
|
2
2
|
import { LcbBlockProps } from '../lcb-block/types'
|
|
3
|
+
import { DataSource } from 'action'
|
|
3
4
|
export interface LcbAreaProps extends LcbBlockProps {
|
|
4
5
|
id?: number
|
|
5
6
|
fixed?: boolean
|
|
@@ -24,7 +25,7 @@ export interface LcbAreaProps extends LcbBlockProps {
|
|
|
24
25
|
dependKeyCompareValue?: string
|
|
25
26
|
position?: 'relative' | 'absolute'
|
|
26
27
|
compareType?: '=' | '>=' | '<=' | '>' | '<' | '!=' | 'includes'
|
|
27
|
-
|
|
28
|
+
dataSource?: DataSource
|
|
28
29
|
action?: LcbActionViewProps
|
|
29
30
|
itemAlign?:
|
|
30
31
|
| 'top-left'
|
package/utils/request.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DataSource } from 'action'
|
|
2
|
+
import { get } from 'lodash-es'
|
|
3
|
+
|
|
4
|
+
export const dynamicRequest = async (
|
|
5
|
+
dataSource?: DataSource,
|
|
6
|
+
pageInfo?: Record<string, any>,
|
|
7
|
+
userInfo?: Record<string, any>,
|
|
8
|
+
) => {
|
|
9
|
+
if (dataSource?.source === 'remote') {
|
|
10
|
+
if (dataSource.requestInfo?.requestUrl) {
|
|
11
|
+
const response = await uni.$lcb.http.post(
|
|
12
|
+
dataSource.requestInfo.requestUrl,
|
|
13
|
+
JSON.parse(dataSource.requestInfo.requestParams || '{}'),
|
|
14
|
+
)
|
|
15
|
+
/** 如果依赖key存在,则取依赖key的值 */
|
|
16
|
+
return response[dataSource?.dependKey || 'data'] as unknown
|
|
17
|
+
}
|
|
18
|
+
} else if (dataSource?.dependKey) {
|
|
19
|
+
return get(dataSource?.source === 'context' ? pageInfo : userInfo, dataSource?.dependKey)
|
|
20
|
+
}
|
|
21
|
+
}
|