@tplc/business 0.4.118 → 0.4.120
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 +35 -0
- package/action.d.ts +1 -1
- package/components/lcb-area/lcb-area.vue +58 -30
- package/components/lcb-area/types.ts +0 -3
- package/components/lcb-button/lcb-button.vue +35 -10
- package/components/lcb-tabs/components/Imgs/index.vue +20 -11
- package/components/lcb-tabs/types.ts +4 -0
- package/components/lcb-wrapper-list/components/WrapperItem/index.vue +34 -0
- package/components/lcb-wrapper-list/lcb-wrapper-list.vue +82 -0
- package/components/lcb-wrapper-list/types.ts +13 -0
- package/constants.ts +2 -0
- package/global.d.ts +1 -0
- package/package.json +1 -1
- package/types/components/lcb-area/lcb-area.vue.d.ts +13 -4
- package/types/components/lcb-area/types.d.ts +0 -3
- package/types/components/lcb-tabs/components/Imgs/index.vue.d.ts +23 -3
- package/types/components/lcb-tabs/types.d.ts +4 -0
- package/types/components/lcb-wrapper-list/components/WrapperItem/index.vue.d.ts +47 -0
- package/types/components/{lcb-area/components/LcbAreaItem/index.vue.d.ts → lcb-wrapper-list/lcb-wrapper-list.vue.d.ts} +16 -15
- package/types/components/lcb-wrapper-list/types.d.ts +13 -0
- package/types/constants.d.ts +2 -0
- package/components/lcb-area/components/LcbAreaItem/index.vue +0 -81
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,41 @@
|
|
|
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.120](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.119...v0.4.120) (2025-05-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* 支持wrapper list ([8727bb8](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/8727bb8d2b55f9d9d5d521175662777649acfada))
|
|
11
|
+
* 新增tabs title ([9aad0cf](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/9aad0cfe0c510616b21b3656a2d6b73b7c11fcfd))
|
|
12
|
+
* 暂时提交字段 ([d2378a3](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d2378a3fe2d6a68a6a32573aae61085d67bcb6e7))
|
|
13
|
+
* 暂时支持列表 ([a0e6b7b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a0e6b7b3e2c1e013427c5ab659005818ace3b092))
|
|
14
|
+
* 调整按钮信息 ([17424ef](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/17424ef9e93fcda51e5b79de86a94c5e818f152b))
|
|
15
|
+
|
|
16
|
+
### [0.4.119](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.115...v0.4.119) (2025-05-21)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### 🚀 Chore | 构建/工程依赖/工具
|
|
20
|
+
|
|
21
|
+
* **release:** 0.4.115 ([15cc0e1](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/15cc0e19900cf11bb7e8ac16cfc9c5e67e1b1bf6))
|
|
22
|
+
* **release:** 0.4.116 ([55d9a73](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/55d9a737f40a44ea1170a4b63e8c6cba0f03e535))
|
|
23
|
+
* **release:** 0.4.117 ([3b53e8e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3b53e8eb27df03cfe005f41ef899141021ecf9e4))
|
|
24
|
+
* **release:** 0.4.118 ([c953fde](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c953fdefd8171082bc6e7c265905cbcd423f2cdd))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### ✨ Features | 新功能
|
|
28
|
+
|
|
29
|
+
* button 预览图片修改 ([1e27b47](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1e27b4719962edb6d1223f159b75c7784aea4066))
|
|
30
|
+
* 修改脚本 ([fa308af](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/fa308afcd6221c79d32947881b81c13288d6bc72))
|
|
31
|
+
* 反选判断 ([6dea74e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6dea74e65d9843766f7911eff2b01b00d72320d6))
|
|
32
|
+
* 新增button enablePreview ([ab91670](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ab91670293731aa12ce7f76a6dc2e8f63c77a3dd))
|
|
33
|
+
* 暂时提交 ([0921daa](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0921daa2e8226bbedafeb64a5e3c2e0522228c82))
|
|
34
|
+
* 暂时提交area支持list 还差样式 ([a815d4b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a815d4be226a97ef91a63cbce90cdb51feb4540d))
|
|
35
|
+
* 补充文档 ([45cffbd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/45cffbd548e36ac779c44e6caee637c0b858a432))
|
|
36
|
+
* 调整button位置 ([f13c6ee](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/f13c6ee1d678b7e24d1d71286ee10ea82a27d7d3))
|
|
37
|
+
* 调整数据 ([f5e0fd2](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/f5e0fd2ccd9153d089949ce24620cd222bfc47ea))
|
|
38
|
+
* 调整配置 ([426199e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/426199e2b441a2bf17288add847874218d0f2032))
|
|
39
|
+
|
|
5
40
|
### [0.4.118](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.117...v0.4.118) (2025-05-19)
|
|
6
41
|
|
|
7
42
|
|
package/action.d.ts
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<lcb-block v-bind="$props" v-if="showArea">
|
|
3
|
-
<view
|
|
4
|
-
|
|
3
|
+
<view
|
|
4
|
+
class="h-full"
|
|
5
|
+
:style="{
|
|
6
|
+
display: display,
|
|
7
|
+
gap: transformValueUnit(gap),
|
|
8
|
+
overflowX: scrollX ? 'auto' : 'initial',
|
|
9
|
+
...innerStyle,
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
12
|
+
<view
|
|
13
|
+
v-for="(item, index) in list"
|
|
14
|
+
:key="item.id"
|
|
15
|
+
class="slot-wrapper"
|
|
16
|
+
:style="{
|
|
17
|
+
...getStyle(index),
|
|
18
|
+
overflowX,
|
|
19
|
+
}"
|
|
20
|
+
>
|
|
21
|
+
<slot :item="item" />
|
|
22
|
+
</view>
|
|
5
23
|
</view>
|
|
6
24
|
</lcb-block>
|
|
7
25
|
</template>
|
|
8
26
|
|
|
9
27
|
<script setup lang="ts">
|
|
10
|
-
import { computed, inject, Ref
|
|
28
|
+
import { computed, inject, Ref } from 'vue'
|
|
11
29
|
import { LcbAreaProps } from './types'
|
|
30
|
+
import { transformValueUnit } from '@tplc/business/utils/transform'
|
|
12
31
|
import { get } from 'lodash-es'
|
|
13
|
-
import LcbAreaItem from './components/LcbAreaItem/index.vue'
|
|
14
32
|
import { PAGE_PROVIDE_KEY } from '@tplc/business/constants'
|
|
15
33
|
defineOptions({
|
|
16
34
|
name: 'LcbArea',
|
|
@@ -20,15 +38,37 @@ defineOptions({
|
|
|
20
38
|
styleIsolation: 'shared',
|
|
21
39
|
},
|
|
22
40
|
})
|
|
23
|
-
const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
|
|
24
|
-
const userStore = uni.$lcb.userStore?.()
|
|
25
41
|
const props = withDefaults(defineProps<LcbAreaProps>(), {
|
|
26
42
|
displayFlex: 'row',
|
|
27
43
|
display: 'flex',
|
|
28
44
|
overflowX: 'initial',
|
|
29
|
-
|
|
45
|
+
})
|
|
46
|
+
const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
|
|
47
|
+
const innerStyle = computed(() => {
|
|
48
|
+
// col-span-2
|
|
49
|
+
if (props.display === 'grid') {
|
|
50
|
+
return {
|
|
51
|
+
gridTemplateColumns: `repeat(${props.gridColumns}, minmax(0, 1fr))`,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
flexDirection: props.displayFlex,
|
|
56
|
+
alignItems: 'stretch',
|
|
57
|
+
}
|
|
30
58
|
})
|
|
31
59
|
|
|
60
|
+
const getStyle = (index: number) => {
|
|
61
|
+
const flex = props.areaFlexs?.[index]?.flex ?? 1
|
|
62
|
+
return {
|
|
63
|
+
gridColumn:
|
|
64
|
+
props.areaItems?.[index]?.colSpan && props.display === 'grid'
|
|
65
|
+
? `span ${props.areaItems?.[index]?.colSpan} / span ${props.areaItems?.[index]?.colSpan}`
|
|
66
|
+
: undefined,
|
|
67
|
+
flex: props.display === 'flex' ? flex || 'auto' : undefined,
|
|
68
|
+
flexShrink: props.display === 'flex' ? (props.flexShrink ?? 1) : undefined,
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
32
72
|
const showArea = computed(() => {
|
|
33
73
|
if (props.dependKey) {
|
|
34
74
|
const userStore = uni.$lcb.userStore?.()
|
|
@@ -43,28 +83,16 @@ const showArea = computed(() => {
|
|
|
43
83
|
}
|
|
44
84
|
return true
|
|
45
85
|
})
|
|
86
|
+
</script>
|
|
46
87
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (props.dataSource.requestInfo?.requestUrl) {
|
|
55
|
-
const { data } = await uni.$lcb.http.post(
|
|
56
|
-
props.dataSource.requestInfo.requestUrl,
|
|
57
|
-
props.dataSource.requestInfo.requestParams,
|
|
58
|
-
)
|
|
59
|
-
renderList.value = data as unknown[]
|
|
60
|
-
}
|
|
61
|
-
} else if (props.dataSource?.dependKey) {
|
|
62
|
-
renderList.value = get(
|
|
63
|
-
props.dataSource?.source === 'context' ? pageInfo.value : userStore?.userInfo,
|
|
64
|
-
props.dataSource?.dependKey,
|
|
65
|
-
[],
|
|
66
|
-
)
|
|
67
|
-
}
|
|
88
|
+
<style lang="scss" scoped>
|
|
89
|
+
// 小程序的情况
|
|
90
|
+
// #ifdef MP-WEIXIN
|
|
91
|
+
.slot-wrapper {
|
|
92
|
+
:deep(> view) {
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 100%;
|
|
68
95
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
96
|
+
}
|
|
97
|
+
// #endif
|
|
98
|
+
</style>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
v-else-if="dynamicKey && hideWhenDynamicKeyNotExist ? dynamicValue : true"
|
|
9
9
|
>
|
|
10
10
|
<lcb-block
|
|
11
|
-
v-bind="
|
|
11
|
+
v-bind="styleOptions[0]"
|
|
12
12
|
:customClass="`${customClass} border-solid`"
|
|
13
13
|
:customStyle="{
|
|
14
14
|
width: props.fillWidth ? '100%' : 'fit-content',
|
|
@@ -16,7 +16,12 @@
|
|
|
16
16
|
...innerItemStyle,
|
|
17
17
|
}"
|
|
18
18
|
>
|
|
19
|
-
<lcb-action-view
|
|
19
|
+
<lcb-action-view
|
|
20
|
+
v-bind="actionProps"
|
|
21
|
+
@avatar="onAvatar"
|
|
22
|
+
@click="handleClick"
|
|
23
|
+
:customStyle="styleOptions[1]"
|
|
24
|
+
>
|
|
20
25
|
<view class="!flex items-center justify-center" :style="`gap: ${iconGap}rpx`">
|
|
21
26
|
<wd-icon
|
|
22
27
|
v-if="icon"
|
|
@@ -45,7 +50,7 @@
|
|
|
45
50
|
<script setup lang="ts">
|
|
46
51
|
import { computed, inject, Ref } from 'vue'
|
|
47
52
|
import { LcbButtonProps } from './types'
|
|
48
|
-
import { PAGE_PROVIDE_KEY } from '../../constants'
|
|
53
|
+
import { PAGE_PROVIDE_KEY, WRAPPER_ITEM_KEY } from '../../constants'
|
|
49
54
|
import { getFlexStyle, transformValueUnit } from '../../utils/transform'
|
|
50
55
|
import { getDynamicData } from '../../utils/utils'
|
|
51
56
|
import { get } from 'lodash-es'
|
|
@@ -66,16 +71,20 @@ const props = withDefaults(defineProps<LcbButtonProps>(), {
|
|
|
66
71
|
iconSize: 24,
|
|
67
72
|
})
|
|
68
73
|
const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
|
|
74
|
+
const wrapperItemData = inject(WRAPPER_ITEM_KEY) as Ref<Record<string, any>>
|
|
69
75
|
const userStore = uni.$lcb.userStore?.()
|
|
76
|
+
const store = computed(() => {
|
|
77
|
+
return props.keyFromUser
|
|
78
|
+
? userStore?.userInfo
|
|
79
|
+
: wrapperItemData
|
|
80
|
+
? wrapperItemData.value
|
|
81
|
+
: pageInfo.value
|
|
82
|
+
})
|
|
70
83
|
|
|
71
84
|
const dynamicValue = computed(() => {
|
|
72
85
|
let value = props.textDefaultValue
|
|
73
86
|
if (props.dynamicKey) {
|
|
74
|
-
value = get(
|
|
75
|
-
props.keyFromUser ? userStore?.userInfo : pageInfo.value,
|
|
76
|
-
props.dynamicKey,
|
|
77
|
-
props.textDefaultValue,
|
|
78
|
-
)
|
|
87
|
+
value = get(store.value, props.dynamicKey, props.textDefaultValue)
|
|
79
88
|
}
|
|
80
89
|
return value
|
|
81
90
|
})
|
|
@@ -93,7 +102,7 @@ const innerValue = computed(() => {
|
|
|
93
102
|
return dynamicValue.value || props.url
|
|
94
103
|
}
|
|
95
104
|
return getDynamicData(props.text, {
|
|
96
|
-
store:
|
|
105
|
+
store: store.value,
|
|
97
106
|
defaultText: props.textDefaultValue,
|
|
98
107
|
})
|
|
99
108
|
})
|
|
@@ -103,7 +112,7 @@ const actionProps = computed(() => {
|
|
|
103
112
|
return {
|
|
104
113
|
...props.action,
|
|
105
114
|
jumpUrl: getDynamicData(props.action?.jumpUrl, {
|
|
106
|
-
store:
|
|
115
|
+
store: store.value,
|
|
107
116
|
}),
|
|
108
117
|
}
|
|
109
118
|
})
|
|
@@ -118,7 +127,23 @@ const onAvatar = (headImgUrl) => {
|
|
|
118
127
|
const innerStyle = computed(() => {
|
|
119
128
|
return getFlexStyle(props.align)
|
|
120
129
|
})
|
|
130
|
+
|
|
121
131
|
const innerItemStyle = computed(() => {
|
|
122
132
|
return getFlexStyle(props.itemAlign)
|
|
123
133
|
})
|
|
134
|
+
|
|
135
|
+
const styleOptions = computed<[Record<string, any>, string]>(() => {
|
|
136
|
+
const {
|
|
137
|
+
paddingVertical,
|
|
138
|
+
paddingHorizontal,
|
|
139
|
+
paddingTop,
|
|
140
|
+
paddingBottom,
|
|
141
|
+
paddingLeft,
|
|
142
|
+
paddingRight,
|
|
143
|
+
...other
|
|
144
|
+
} = props
|
|
145
|
+
|
|
146
|
+
const actionStyle = `width: 100%; padding:${transformValueUnit(paddingTop || paddingVertical)} ${transformValueUnit(paddingRight || paddingHorizontal)} ${transformValueUnit(paddingBottom || paddingVertical)} ${transformValueUnit(paddingLeft || paddingHorizontal)}`
|
|
147
|
+
return [other, actionStyle]
|
|
148
|
+
})
|
|
124
149
|
</script>
|
|
@@ -9,21 +9,30 @@
|
|
|
9
9
|
gap: transformValueUnit(gap),
|
|
10
10
|
}"
|
|
11
11
|
>
|
|
12
|
-
<
|
|
12
|
+
<view
|
|
13
13
|
v-for="(item, index) in items"
|
|
14
14
|
:key="index"
|
|
15
|
+
class="flex flex-col items-center justify-center"
|
|
15
16
|
:class="{
|
|
17
|
+
'lcb-tag-active': current === index,
|
|
16
18
|
'inline-block': tagsMode === 'scroll',
|
|
17
19
|
}"
|
|
18
20
|
:style="{
|
|
19
21
|
fontSize: transformValueUnit(itemFontSize),
|
|
22
|
+
width: transformValueUnit(imgWidth),
|
|
23
|
+
gap: transformValueUnit(imgTitleGap),
|
|
24
|
+
color: current === index ? activeColor : inactiveColor,
|
|
20
25
|
}"
|
|
21
|
-
:width="transformValueUnit(imgWidth)"
|
|
22
|
-
height="auto"
|
|
23
|
-
mode="widthFix"
|
|
24
|
-
:src="current === index ? item.activeUrl : item.inactiveUrl"
|
|
25
26
|
@click="handleTagClick(item.name, index)"
|
|
26
|
-
|
|
27
|
+
>
|
|
28
|
+
<wd-img
|
|
29
|
+
:width="transformValueUnit(imgWidth)"
|
|
30
|
+
height="auto"
|
|
31
|
+
mode="widthFix"
|
|
32
|
+
:src="current === index ? item.activeUrl : item.inactiveUrl"
|
|
33
|
+
/>
|
|
34
|
+
<view v-if="showTitle" class="truncate px-2">{{ item.title }}</view>
|
|
35
|
+
</view>
|
|
27
36
|
</view>
|
|
28
37
|
</lcb-block>
|
|
29
38
|
</template>
|
|
@@ -33,7 +42,11 @@ import { ref } from 'vue'
|
|
|
33
42
|
import useSyncForm from '../../../../hooks/useSyncForm'
|
|
34
43
|
import { transformValueUnit } from '../../../../utils/transform'
|
|
35
44
|
import { LcbTabsProps } from '../../types'
|
|
36
|
-
const props = withDefaults(defineProps<LcbTabsProps>(), {
|
|
45
|
+
const props = withDefaults(defineProps<LcbTabsProps>(), {
|
|
46
|
+
imgTitleGap: 24,
|
|
47
|
+
activeColor: 'var(--wot-color-theme)',
|
|
48
|
+
inactiveColor: '#333333',
|
|
49
|
+
})
|
|
37
50
|
const { syncForm } = useSyncForm(props.dynamicScope)
|
|
38
51
|
const current = ref(0)
|
|
39
52
|
defineOptions({
|
|
@@ -54,7 +67,3 @@ const handleTagClick = (name: string, index: number) => {
|
|
|
54
67
|
}
|
|
55
68
|
handleTagClick(props.items?.[0].name, 0)
|
|
56
69
|
</script>
|
|
57
|
-
|
|
58
|
-
<style lang="scss" scoped>
|
|
59
|
-
@import '@tplc/wot/components/common/abstracts/variable';
|
|
60
|
-
</style>
|
|
@@ -9,6 +9,7 @@ export interface LcbTabsProps extends LcbBlockProps {
|
|
|
9
9
|
activeUrl?: string
|
|
10
10
|
inactiveUrl?: string
|
|
11
11
|
}[]
|
|
12
|
+
showTitle?: boolean
|
|
12
13
|
lineWidth?: number
|
|
13
14
|
lineHeight?: number
|
|
14
15
|
slidable?: 'always' | 'auto'
|
|
@@ -19,4 +20,7 @@ export interface LcbTabsProps extends LcbBlockProps {
|
|
|
19
20
|
gap?: number
|
|
20
21
|
dynamicScope?: string
|
|
21
22
|
imgWidth?: number
|
|
23
|
+
imgTitleGap?: number
|
|
24
|
+
activeColor?: string
|
|
25
|
+
inactiveColor?: string
|
|
22
26
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<slot />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { WRAPPER_ITEM_KEY } from '../../../../constants'
|
|
7
|
+
import { provide, ref, watch } from 'vue'
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
name: 'LcbWrapperItem',
|
|
11
|
+
options: {
|
|
12
|
+
addGlobalClass: true,
|
|
13
|
+
virtualHost: true,
|
|
14
|
+
styleIsolation: 'shared',
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
const props = defineProps<{
|
|
18
|
+
data?: unknown
|
|
19
|
+
}>()
|
|
20
|
+
const data = ref(props.data)
|
|
21
|
+
provide(WRAPPER_ITEM_KEY, data)
|
|
22
|
+
|
|
23
|
+
watch(
|
|
24
|
+
() => props.data,
|
|
25
|
+
(newVal) => {
|
|
26
|
+
data.value = newVal
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
deep: true,
|
|
30
|
+
},
|
|
31
|
+
)
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<lcb-block v-bind="$props" :custom-style="listStyle" v-if="renderList.length">
|
|
3
|
+
<view
|
|
4
|
+
v-for="(item, index) in renderList"
|
|
5
|
+
:key="index"
|
|
6
|
+
class="flex-shrink-0"
|
|
7
|
+
:style="{
|
|
8
|
+
width: width ? transformValueUnit(width) : '100%',
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<WrapperItem :data="item">
|
|
12
|
+
<block v-for="com in list" :key="com.id">
|
|
13
|
+
<slot :item="com" />
|
|
14
|
+
</block>
|
|
15
|
+
</WrapperItem>
|
|
16
|
+
</view>
|
|
17
|
+
</lcb-block>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import { computed, inject, Ref, ref, watchEffect } from 'vue'
|
|
22
|
+
import { LcbWrapperListProps } from './types'
|
|
23
|
+
import { get } from 'lodash-es'
|
|
24
|
+
import { PAGE_PROVIDE_KEY } from '@tplc/business/constants'
|
|
25
|
+
import { transformValueUnit } from '@tplc/business/utils/transform'
|
|
26
|
+
import WrapperItem from './components/WrapperItem/index.vue'
|
|
27
|
+
defineOptions({
|
|
28
|
+
name: 'LcbWrapperList',
|
|
29
|
+
options: {
|
|
30
|
+
addGlobalClass: true,
|
|
31
|
+
virtualHost: true,
|
|
32
|
+
styleIsolation: 'shared',
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
const props = withDefaults(defineProps<LcbWrapperListProps>(), {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
flexDirection: 'column',
|
|
38
|
+
})
|
|
39
|
+
const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
|
|
40
|
+
const userStore = uni.$lcb.userStore?.()
|
|
41
|
+
const renderList = ref<unknown[]>([
|
|
42
|
+
{ walletAmount: 1 },
|
|
43
|
+
{ walletAmount: 2 },
|
|
44
|
+
{ walletAmount: 3 },
|
|
45
|
+
{ walletAmount: 4 },
|
|
46
|
+
])
|
|
47
|
+
|
|
48
|
+
watchEffect(async () => {
|
|
49
|
+
if (props.dataSource?.source === 'remote') {
|
|
50
|
+
if (props.dataSource.requestInfo?.requestUrl) {
|
|
51
|
+
const { data } = await uni.$lcb.http.post(
|
|
52
|
+
props.dataSource.requestInfo.requestUrl,
|
|
53
|
+
JSON.parse(props.dataSource.requestInfo.requestParams || '{}'),
|
|
54
|
+
)
|
|
55
|
+
renderList.value = data as unknown[]
|
|
56
|
+
}
|
|
57
|
+
} else if (props.dataSource?.dependKey) {
|
|
58
|
+
renderList.value = get(
|
|
59
|
+
props.dataSource?.source === 'context' ? pageInfo.value : userStore?.userInfo,
|
|
60
|
+
props.dataSource?.dependKey,
|
|
61
|
+
[],
|
|
62
|
+
)
|
|
63
|
+
} else {
|
|
64
|
+
renderList.value = []
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
const listStyle = computed(() => {
|
|
68
|
+
const style = {
|
|
69
|
+
width: '100%',
|
|
70
|
+
display: props.display,
|
|
71
|
+
'flex-direction': props.flexDirection,
|
|
72
|
+
gap: transformValueUnit(props.gap),
|
|
73
|
+
'align-items': 'stretch',
|
|
74
|
+
'grid-template-columns': `repeat(${props.gridColumns}, minmax(0, 1fr))`,
|
|
75
|
+
'overflow-x': props.scrollX ? 'auto' : 'hidden',
|
|
76
|
+
'white-space': props.scrollX ? 'nowrap' : 'normal',
|
|
77
|
+
}
|
|
78
|
+
return style
|
|
79
|
+
})
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LcbAreaProps } from '../lcb-area/types'
|
|
2
|
+
import { DataSource } from '../../action'
|
|
3
|
+
import { LcbBlockProps } from '../lcb-block/types'
|
|
4
|
+
export interface LcbWrapperListProps extends LcbBlockProps {
|
|
5
|
+
dataSource?: DataSource
|
|
6
|
+
gap?: number
|
|
7
|
+
width?: number
|
|
8
|
+
display?: 'flex' | 'grid'
|
|
9
|
+
flexDirection?: 'row' | 'column'
|
|
10
|
+
gridColumns?: number
|
|
11
|
+
scrollX?: boolean
|
|
12
|
+
list?: LcbAreaProps[]
|
|
13
|
+
}
|
package/constants.ts
CHANGED
package/global.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare module 'vue' {
|
|
|
47
47
|
'lcb-vip': (typeof import('@tplc/business/components/lcb-vip/lcb-vip.vue'))['default']
|
|
48
48
|
'lcb-waterfall-item': (typeof import('@tplc/business/components/lcb-waterfall/lcb-waterfall-item.vue'))['default']
|
|
49
49
|
'lcb-waterfall': (typeof import('@tplc/business/components/lcb-waterfall/lcb-waterfall.vue'))['default']
|
|
50
|
+
'lcb-wrapper-list': (typeof import('@tplc/business/components/lcb-wrapper-list/lcb-wrapper-list.vue'))['default']
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { LcbAreaProps } from './types'
|
|
2
|
-
declare
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
default?(_: { item: LcbAreaProps }): any
|
|
4
|
+
}
|
|
5
|
+
declare const __VLS_component: import('vue').DefineComponent<
|
|
3
6
|
__VLS_WithDefaults<
|
|
4
7
|
__VLS_TypePropsToOption<LcbAreaProps>,
|
|
5
8
|
{
|
|
6
9
|
displayFlex: string
|
|
7
10
|
display: string
|
|
8
11
|
overflowX: string
|
|
9
|
-
mode: string
|
|
10
12
|
}
|
|
11
13
|
>,
|
|
12
14
|
{},
|
|
@@ -26,19 +28,21 @@ declare const _default: import('vue').DefineComponent<
|
|
|
26
28
|
displayFlex: string
|
|
27
29
|
display: string
|
|
28
30
|
overflowX: string
|
|
29
|
-
mode: string
|
|
30
31
|
}
|
|
31
32
|
>
|
|
32
33
|
>
|
|
33
34
|
>,
|
|
34
35
|
{
|
|
35
|
-
mode: 'single' | 'multiple'
|
|
36
36
|
display: 'flex' | 'grid'
|
|
37
37
|
displayFlex: 'row' | 'column'
|
|
38
38
|
overflowX: 'hidden' | 'initial' | 'auto'
|
|
39
39
|
},
|
|
40
40
|
{}
|
|
41
41
|
>
|
|
42
|
+
declare const _default: __VLS_WithTemplateSlots<
|
|
43
|
+
typeof __VLS_component,
|
|
44
|
+
ReturnType<typeof __VLS_template>
|
|
45
|
+
>
|
|
42
46
|
export default _default
|
|
43
47
|
type __VLS_WithDefaults<P, D> = {
|
|
44
48
|
[K in keyof Pick<P, keyof P>]: K extends keyof D
|
|
@@ -52,6 +56,11 @@ type __VLS_WithDefaults<P, D> = {
|
|
|
52
56
|
type __VLS_Prettify<T> = {
|
|
53
57
|
[K in keyof T]: T[K]
|
|
54
58
|
} & {}
|
|
59
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
60
|
+
new (): {
|
|
61
|
+
$slots: S
|
|
62
|
+
}
|
|
63
|
+
}
|
|
55
64
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
|
|
56
65
|
type __VLS_TypePropsToOption<T> = {
|
|
57
66
|
[K in keyof T]-?: {} extends Pick<T, K>
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { LcbTabsProps } from '../../types'
|
|
2
2
|
declare const _default: import('vue').DefineComponent<
|
|
3
|
-
__VLS_WithDefaults<
|
|
3
|
+
__VLS_WithDefaults<
|
|
4
|
+
__VLS_TypePropsToOption<LcbTabsProps>,
|
|
5
|
+
{
|
|
6
|
+
imgTitleGap: number
|
|
7
|
+
activeColor: string
|
|
8
|
+
inactiveColor: string
|
|
9
|
+
}
|
|
10
|
+
>,
|
|
4
11
|
{},
|
|
5
12
|
unknown,
|
|
6
13
|
{},
|
|
@@ -11,9 +18,22 @@ declare const _default: import('vue').DefineComponent<
|
|
|
11
18
|
string,
|
|
12
19
|
import('vue').PublicProps,
|
|
13
20
|
Readonly<
|
|
14
|
-
import('vue').ExtractPropTypes<
|
|
21
|
+
import('vue').ExtractPropTypes<
|
|
22
|
+
__VLS_WithDefaults<
|
|
23
|
+
__VLS_TypePropsToOption<LcbTabsProps>,
|
|
24
|
+
{
|
|
25
|
+
imgTitleGap: number
|
|
26
|
+
activeColor: string
|
|
27
|
+
inactiveColor: string
|
|
28
|
+
}
|
|
29
|
+
>
|
|
30
|
+
>
|
|
15
31
|
>,
|
|
16
|
-
{
|
|
32
|
+
{
|
|
33
|
+
inactiveColor: string
|
|
34
|
+
activeColor: string
|
|
35
|
+
imgTitleGap: number
|
|
36
|
+
},
|
|
17
37
|
{}
|
|
18
38
|
>
|
|
19
39
|
export default _default
|
|
@@ -8,6 +8,7 @@ export interface LcbTabsProps extends LcbBlockProps {
|
|
|
8
8
|
activeUrl?: string
|
|
9
9
|
inactiveUrl?: string
|
|
10
10
|
}[]
|
|
11
|
+
showTitle?: boolean
|
|
11
12
|
lineWidth?: number
|
|
12
13
|
lineHeight?: number
|
|
13
14
|
slidable?: 'always' | 'auto'
|
|
@@ -18,4 +19,7 @@ export interface LcbTabsProps extends LcbBlockProps {
|
|
|
18
19
|
gap?: number
|
|
19
20
|
dynamicScope?: string
|
|
20
21
|
imgWidth?: number
|
|
22
|
+
imgTitleGap?: number
|
|
23
|
+
activeColor?: string
|
|
24
|
+
inactiveColor?: string
|
|
21
25
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare function __VLS_template(): {
|
|
2
|
+
default?(_: {}): any
|
|
3
|
+
}
|
|
4
|
+
declare const __VLS_component: import('vue').DefineComponent<
|
|
5
|
+
__VLS_TypePropsToOption<{
|
|
6
|
+
data?: unknown
|
|
7
|
+
}>,
|
|
8
|
+
{},
|
|
9
|
+
unknown,
|
|
10
|
+
{},
|
|
11
|
+
{},
|
|
12
|
+
import('vue').ComponentOptionsMixin,
|
|
13
|
+
import('vue').ComponentOptionsMixin,
|
|
14
|
+
{},
|
|
15
|
+
string,
|
|
16
|
+
import('vue').PublicProps,
|
|
17
|
+
Readonly<
|
|
18
|
+
import('vue').ExtractPropTypes<
|
|
19
|
+
__VLS_TypePropsToOption<{
|
|
20
|
+
data?: unknown
|
|
21
|
+
}>
|
|
22
|
+
>
|
|
23
|
+
>,
|
|
24
|
+
{},
|
|
25
|
+
{}
|
|
26
|
+
>
|
|
27
|
+
declare const _default: __VLS_WithTemplateSlots<
|
|
28
|
+
typeof __VLS_component,
|
|
29
|
+
ReturnType<typeof __VLS_template>
|
|
30
|
+
>
|
|
31
|
+
export default _default
|
|
32
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
|
|
38
|
+
type __VLS_TypePropsToOption<T> = {
|
|
39
|
+
[K in keyof T]-?: {} extends Pick<T, K>
|
|
40
|
+
? {
|
|
41
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>
|
|
42
|
+
}
|
|
43
|
+
: {
|
|
44
|
+
type: import('vue').PropType<T[K]>
|
|
45
|
+
required: true
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LcbWrapperListProps } from './types'
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
|
-
default?(_: { item: LcbAreaProps }): any
|
|
3
|
+
default?(_: { item: import('../lcb-area/types').LcbAreaProps }): any
|
|
4
4
|
}
|
|
5
5
|
declare const __VLS_component: import('vue').DefineComponent<
|
|
6
6
|
__VLS_WithDefaults<
|
|
7
|
-
__VLS_TypePropsToOption<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{}
|
|
7
|
+
__VLS_TypePropsToOption<LcbWrapperListProps>,
|
|
8
|
+
{
|
|
9
|
+
display: string
|
|
10
|
+
flexDirection: string
|
|
11
|
+
}
|
|
13
12
|
>,
|
|
14
13
|
{},
|
|
15
14
|
unknown,
|
|
@@ -23,16 +22,18 @@ declare const __VLS_component: import('vue').DefineComponent<
|
|
|
23
22
|
Readonly<
|
|
24
23
|
import('vue').ExtractPropTypes<
|
|
25
24
|
__VLS_WithDefaults<
|
|
26
|
-
__VLS_TypePropsToOption<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{}
|
|
25
|
+
__VLS_TypePropsToOption<LcbWrapperListProps>,
|
|
26
|
+
{
|
|
27
|
+
display: string
|
|
28
|
+
flexDirection: string
|
|
29
|
+
}
|
|
32
30
|
>
|
|
33
31
|
>
|
|
34
32
|
>,
|
|
35
|
-
{
|
|
33
|
+
{
|
|
34
|
+
display: 'flex' | 'grid'
|
|
35
|
+
flexDirection: 'row' | 'column'
|
|
36
|
+
},
|
|
36
37
|
{}
|
|
37
38
|
>
|
|
38
39
|
declare const _default: __VLS_WithTemplateSlots<
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LcbAreaProps } from '../lcb-area/types'
|
|
2
|
+
import { DataSource } from '../../action'
|
|
3
|
+
import { LcbBlockProps } from '../lcb-block/types'
|
|
4
|
+
export interface LcbWrapperListProps extends LcbBlockProps {
|
|
5
|
+
dataSource?: DataSource
|
|
6
|
+
gap?: number
|
|
7
|
+
width?: number
|
|
8
|
+
display?: 'flex' | 'grid'
|
|
9
|
+
flexDirection?: 'row' | 'column'
|
|
10
|
+
gridColumns?: number
|
|
11
|
+
scrollX?: boolean
|
|
12
|
+
list?: LcbAreaProps[]
|
|
13
|
+
}
|
package/types/constants.d.ts
CHANGED
|
@@ -11,3 +11,5 @@ export declare const USER_BASIC_INFO = 'user_basic_info'
|
|
|
11
11
|
export declare const LIST_FORM_CHOOSER_VALUES = 'list_form_chooser_values'
|
|
12
12
|
/** 页面动态数据 */
|
|
13
13
|
export declare const PAGE_DYNAMIC_DATA = 'page_dynamic_data'
|
|
14
|
+
/** 列表页表单选择项 */
|
|
15
|
+
export declare const WRAPPER_ITEM_KEY = 'wrapper_item_key'
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view
|
|
3
|
-
class="h-full"
|
|
4
|
-
:style="{
|
|
5
|
-
display: display,
|
|
6
|
-
gap: transformValueUnit(gap),
|
|
7
|
-
overflowX: scrollX ? 'auto' : 'initial',
|
|
8
|
-
...innerStyle,
|
|
9
|
-
}"
|
|
10
|
-
>
|
|
11
|
-
<view
|
|
12
|
-
v-for="(item, index) in list"
|
|
13
|
-
:key="item.id"
|
|
14
|
-
class="slot-wrapper"
|
|
15
|
-
:style="{
|
|
16
|
-
...getStyle(index),
|
|
17
|
-
overflowX,
|
|
18
|
-
}"
|
|
19
|
-
>
|
|
20
|
-
<slot :item="item" />
|
|
21
|
-
</view>
|
|
22
|
-
</view>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script setup lang="ts">
|
|
26
|
-
import { computed } from 'vue'
|
|
27
|
-
import { LcbAreaProps } from '../../types'
|
|
28
|
-
import { transformValueUnit } from '@tplc/business/utils/transform'
|
|
29
|
-
defineOptions({
|
|
30
|
-
name: 'LcbAreaItem',
|
|
31
|
-
options: {
|
|
32
|
-
addGlobalClass: true,
|
|
33
|
-
virtualHost: true,
|
|
34
|
-
styleIsolation: 'shared',
|
|
35
|
-
},
|
|
36
|
-
})
|
|
37
|
-
const props = withDefaults(
|
|
38
|
-
defineProps<
|
|
39
|
-
LcbAreaProps & {
|
|
40
|
-
data?: unknown
|
|
41
|
-
}
|
|
42
|
-
>(),
|
|
43
|
-
{},
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
const getStyle = (index: number) => {
|
|
47
|
-
const flex = props.areaFlexs?.[index]?.flex ?? 1
|
|
48
|
-
return {
|
|
49
|
-
gridColumn:
|
|
50
|
-
props.areaItems?.[index]?.colSpan && props.display === 'grid'
|
|
51
|
-
? `span ${props.areaItems?.[index]?.colSpan} / span ${props.areaItems?.[index]?.colSpan}`
|
|
52
|
-
: undefined,
|
|
53
|
-
flex: props.display === 'flex' ? flex || 'auto' : undefined,
|
|
54
|
-
flexShrink: props.display === 'flex' ? (props.flexShrink ?? 1) : undefined,
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const innerStyle = computed(() => {
|
|
58
|
-
// col-span-2
|
|
59
|
-
if (props.display === 'grid') {
|
|
60
|
-
return {
|
|
61
|
-
gridTemplateColumns: `repeat(${props.gridColumns}, minmax(0, 1fr))`,
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
flexDirection: props.displayFlex,
|
|
66
|
-
alignItems: 'stretch',
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
</script>
|
|
70
|
-
|
|
71
|
-
<style lang="scss" scoped>
|
|
72
|
-
// 小程序的情况
|
|
73
|
-
// #ifdef MP-WEIXIN
|
|
74
|
-
.slot-wrapper {
|
|
75
|
-
:deep(> view) {
|
|
76
|
-
width: 100%;
|
|
77
|
-
height: 100%;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// #endif
|
|
81
|
-
</style>
|