@tplc/business 0.5.17 → 0.5.19
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 +15 -0
- package/components/lcb-block/types.ts +1 -1
- package/components/lcb-swiper/lcb-swiper.vue +99 -34
- package/components/lcb-swiper/types.ts +3 -1
- package/components/lcb-tabs/components/Tags/index.vue +5 -3
- package/components/lcb-tabs/lcb-tabs.vue +16 -2
- package/components/lcb-tabs/types.ts +2 -0
- package/package.json +1 -1
- package/types/components/lcb-block/types.d.ts +1 -2
- package/types/components/lcb-list/lcb-list.vue.d.ts +1 -1
- package/types/components/lcb-swiper/lcb-swiper.vue.d.ts +6 -3
- package/types/components/lcb-swiper/types.d.ts +3 -1
- package/types/components/lcb-tabs/components/Tags/index.vue.d.ts +3 -0
- package/types/components/lcb-tabs/types.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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.19](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.18...v0.5.19) (2025-10-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* tab支持变更属性 ([3e8390b](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/3e8390be463525f4988d5ae36034a83d69031dc2))
|
|
11
|
+
* 支持 stackRight stackLeft ([81d1fd4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/81d1fd488395196cf28ef6a8df269564d87376bd))
|
|
12
|
+
|
|
13
|
+
### [0.5.18](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.17...v0.5.18) (2025-10-14)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### ✨ Features | 新功能
|
|
17
|
+
|
|
18
|
+
* mode normal 改为最大大小 ([5f59b53](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/5f59b532c7dfef47d7a6c64f1e221d6a71e10e75))
|
|
19
|
+
|
|
5
20
|
### [0.5.17](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.16...v0.5.17) (2025-10-13)
|
|
6
21
|
|
|
7
22
|
|
|
@@ -11,16 +11,7 @@
|
|
|
11
11
|
:key="i"
|
|
12
12
|
class="carousel-block"
|
|
13
13
|
@click="changeBlock(item)"
|
|
14
|
-
:style="
|
|
15
|
-
left: item.left,
|
|
16
|
-
top: item.top,
|
|
17
|
-
zIndex: item.zIndex,
|
|
18
|
-
width: itemWidth + 'rpx',
|
|
19
|
-
height: itemHeight + 'rpx',
|
|
20
|
-
transition: item.transition + 's all',
|
|
21
|
-
transform: 'translate3d(-50%, -50%, 0) scale(' + item.scale + ')',
|
|
22
|
-
opacity: item.opacity,
|
|
23
|
-
}"
|
|
14
|
+
:style="getItemStyle(item)"
|
|
24
15
|
>
|
|
25
16
|
<lcb-action-view
|
|
26
17
|
v-bind="item.item.link"
|
|
@@ -54,10 +45,11 @@ defineOptions({
|
|
|
54
45
|
})
|
|
55
46
|
|
|
56
47
|
const props = withDefaults(defineProps<LcbSwiperProps>(), {
|
|
57
|
-
mode: 'multiple',
|
|
58
48
|
itemWidth: 450,
|
|
59
49
|
itemHeight: 300,
|
|
60
50
|
enableOpacity: false,
|
|
51
|
+
mode: 'stackCenter',
|
|
52
|
+
scaleStep: 0.1,
|
|
61
53
|
})
|
|
62
54
|
type DataRecord = Record<string, any>
|
|
63
55
|
|
|
@@ -92,23 +84,53 @@ const slotStyles = ref<SlotStyle[]>([])
|
|
|
92
84
|
|
|
93
85
|
const visible = computed<number>(() => {
|
|
94
86
|
if (props.visibleCount && props.visibleCount > 0) return props.visibleCount
|
|
95
|
-
if (props.mode === 'single') return 3
|
|
96
|
-
if (props.mode === 'multiple') return 5
|
|
97
87
|
return 5
|
|
98
88
|
})
|
|
99
89
|
|
|
100
|
-
function buildSlots(n: number): SlotStyle[] {
|
|
90
|
+
function buildSlots(n: number, mode: string): SlotStyle[] {
|
|
101
91
|
const center = Math.floor(n / 2)
|
|
102
92
|
const spacing = 14 // percent per slot
|
|
103
|
-
const
|
|
93
|
+
const stepValue = props.scaleStep || 0.1 // 使用 props 中的缩放步长(仅用于 stackLeft/Right)
|
|
94
|
+
|
|
104
95
|
return Array.from({ length: n }, (_, i) => {
|
|
105
96
|
const d = Math.abs(i - center)
|
|
97
|
+
|
|
98
|
+
let leftValue: string
|
|
99
|
+
let topValue: string
|
|
100
|
+
let scale: number
|
|
101
|
+
let zIndex: number
|
|
102
|
+
|
|
103
|
+
let opacity: number
|
|
104
|
+
|
|
105
|
+
if (mode === 'stackLeft') {
|
|
106
|
+
// 左排列:从左到右,依次缩小
|
|
107
|
+
leftValue = `calc(0% + ${i * 8}%)`
|
|
108
|
+
topValue = '50%'
|
|
109
|
+
scale = Math.max(1 - i * stepValue, 0.5) // 根据 scaleStep 缩放
|
|
110
|
+
zIndex = n - i // 第1张在最上层
|
|
111
|
+
opacity = props.enableOpacity ? (i === 0 ? 1 : i === 1 ? 0.8 : 0.6) : 1
|
|
112
|
+
} else if (mode === 'stackRight') {
|
|
113
|
+
// 右排列:从右到左,依次缩小
|
|
114
|
+
leftValue = `calc(100% - ${i * 8}%)`
|
|
115
|
+
topValue = '50%'
|
|
116
|
+
scale = Math.max(1 - i * stepValue, 0.5) // 根据 scaleStep 缩放
|
|
117
|
+
zIndex = n - i // 第1张在最上层
|
|
118
|
+
opacity = props.enableOpacity ? (i === 0 ? 1 : i === 1 ? 0.8 : 0.6) : 1
|
|
119
|
+
} else {
|
|
120
|
+
// 居中:从中心向两侧分布,使用固定的 0.15 缩放步长
|
|
121
|
+
leftValue = `calc(50% + ${(i - center) * spacing}%)`
|
|
122
|
+
topValue = '50%'
|
|
123
|
+
scale = Math.max(1 - d * 0.15, 0.6) // center 模式使用固定 0.15
|
|
124
|
+
zIndex = 100 - d
|
|
125
|
+
opacity = props.enableOpacity ? (d === 0 ? 1 : d === 1 ? 0.4 : 0.7) : 1
|
|
126
|
+
}
|
|
127
|
+
|
|
106
128
|
return {
|
|
107
|
-
left:
|
|
108
|
-
top:
|
|
109
|
-
zIndex
|
|
110
|
-
scale
|
|
111
|
-
opacity
|
|
129
|
+
left: leftValue,
|
|
130
|
+
top: topValue,
|
|
131
|
+
zIndex,
|
|
132
|
+
scale,
|
|
133
|
+
opacity,
|
|
112
134
|
transition: 0.2,
|
|
113
135
|
}
|
|
114
136
|
})
|
|
@@ -118,7 +140,7 @@ function initData() {
|
|
|
118
140
|
datalist.value = Array.isArray(props.items) ? props.items.slice() : []
|
|
119
141
|
const desired = visible.value
|
|
120
142
|
const n = Math.min(desired, datalist.value.length)
|
|
121
|
-
slotStyles.value = buildSlots(n)
|
|
143
|
+
slotStyles.value = buildSlots(n, props.mode || 'stackCenter')
|
|
122
144
|
imagelist.value = slotStyles.value.map((s, i) => ({
|
|
123
145
|
...s,
|
|
124
146
|
isIndex: i,
|
|
@@ -183,23 +205,66 @@ function RightSliding() {
|
|
|
183
205
|
})
|
|
184
206
|
}
|
|
185
207
|
|
|
208
|
+
function getItemStyle(item: any) {
|
|
209
|
+
let transform: string
|
|
210
|
+
const baseScale = `scale(${item.scale})`
|
|
211
|
+
|
|
212
|
+
if (props.mode === 'stackLeft') {
|
|
213
|
+
// 左排列:从左边开始,不居中
|
|
214
|
+
transform = `translate3d(0, -50%, 0) ${baseScale}`
|
|
215
|
+
} else if (props.mode === 'stackRight') {
|
|
216
|
+
// 右排列:从右边开始,向左对齐
|
|
217
|
+
transform = `translate3d(-100%, -50%, 0) ${baseScale}`
|
|
218
|
+
} else {
|
|
219
|
+
// 居中:保持居中
|
|
220
|
+
transform = `translate3d(-50%, -50%, 0) ${baseScale}`
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
left: item.left,
|
|
225
|
+
top: item.top,
|
|
226
|
+
zIndex: item.zIndex,
|
|
227
|
+
width: props.itemWidth + 'rpx',
|
|
228
|
+
height: props.itemHeight + 'rpx',
|
|
229
|
+
transition: item.transition + 's all',
|
|
230
|
+
transform,
|
|
231
|
+
opacity: item.opacity,
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
186
235
|
function changeBlock(item: ImageItem) {
|
|
187
236
|
const n = imagelist.value.length
|
|
188
|
-
const center = Math.floor(n / 2)
|
|
189
237
|
const toor = item.slotIndex
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
238
|
+
|
|
239
|
+
if (props.mode === 'stackLeft' || props.mode === 'stackRight') {
|
|
240
|
+
// stackLeft/Right 模式:点击的卡片移动到第一个位置(slotIndex = 0)
|
|
241
|
+
if (toor === 0) {
|
|
242
|
+
// 已经是第一张,触发选中事件
|
|
243
|
+
const selected = datalist.value[item.isIndex]
|
|
244
|
+
if (selected) emit('selection', selected)
|
|
245
|
+
} else {
|
|
246
|
+
// 需要移动到第一个位置,执行 toor 次 LeftSliding
|
|
247
|
+
for (let i = 0; i < toor; i++) {
|
|
248
|
+
setTimeout(() => LeftSliding(), i * 100)
|
|
249
|
+
}
|
|
199
250
|
}
|
|
200
251
|
} else {
|
|
201
|
-
|
|
202
|
-
|
|
252
|
+
// stackCenter 模式:保持原有逻辑,移动到中心
|
|
253
|
+
const center = Math.floor(n / 2)
|
|
254
|
+
if (toor < center) {
|
|
255
|
+
RightSliding()
|
|
256
|
+
if (toor < center - 1) {
|
|
257
|
+
setTimeout(() => RightSliding(), 100)
|
|
258
|
+
}
|
|
259
|
+
} else if (toor > center) {
|
|
260
|
+
LeftSliding()
|
|
261
|
+
if (toor > center + 1) {
|
|
262
|
+
setTimeout(() => LeftSliding(), 100)
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
const selected = datalist.value[item.isIndex]
|
|
266
|
+
if (selected) emit('selection', selected)
|
|
267
|
+
}
|
|
203
268
|
}
|
|
204
269
|
}
|
|
205
270
|
|
|
@@ -226,7 +291,7 @@ onMounted(() => {
|
|
|
226
291
|
|
|
227
292
|
// Re-init when count-related inputs change or array length changes
|
|
228
293
|
watch(
|
|
229
|
-
() => [props.visibleCount, props.mode, props.items?.length],
|
|
294
|
+
() => [props.visibleCount, props.mode, props.scaleStep, props.items?.length],
|
|
230
295
|
() => initData(),
|
|
231
296
|
)
|
|
232
297
|
|
|
@@ -9,8 +9,10 @@ export interface LcbSwiperProps extends LcbBlockProps {
|
|
|
9
9
|
>[]
|
|
10
10
|
itemWidth?: number
|
|
11
11
|
itemHeight?: number
|
|
12
|
-
mode?:
|
|
12
|
+
mode?: 'stackLeft' | 'stackRight' | 'stackCenter' | 'tinder'
|
|
13
13
|
visibleCount?: number
|
|
14
14
|
imageRadius?: number
|
|
15
15
|
enableOpacity?: boolean
|
|
16
|
+
/** 缩放步长:仅针对 stackLeft/stackRight 模式,每张卡片缩小的比例,默认 0.1 (10%) */
|
|
17
|
+
scaleStep?: number
|
|
16
18
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<view
|
|
13
13
|
v-for="(item, index) in items"
|
|
14
14
|
:key="index"
|
|
15
|
-
class="lcb-tag"
|
|
15
|
+
class="lcb-tag text-center"
|
|
16
16
|
:class="{
|
|
17
17
|
'lcb-tag-active': current === index,
|
|
18
18
|
'inline-block': tagsMode === 'scroll',
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
fontSize: transformValueUnit(itemFontSize),
|
|
22
22
|
backgroundColor: current === index ? tagActiveColor : tagInactiveColor,
|
|
23
23
|
color: current === index ? tagTitleActiveColor : tagTitleInactiveColor,
|
|
24
|
+
borderRadius: transformValueUnit(tagRadius),
|
|
25
|
+
minWidth: transformValueUnit(tagMinWidth),
|
|
24
26
|
}"
|
|
25
27
|
@click="handleTagClick(item.name, index)"
|
|
26
28
|
>
|
|
@@ -40,7 +42,9 @@ const props = withDefaults(defineProps<LcbTabsProps>(), {
|
|
|
40
42
|
tagInactiveColor: '#eeeeee',
|
|
41
43
|
tagTitleActiveColor: '#ffffff',
|
|
42
44
|
tagTitleInactiveColor: '#000000',
|
|
45
|
+
tagRadius: 100,
|
|
43
46
|
})
|
|
47
|
+
console.log(props, 'props')
|
|
44
48
|
const { syncForm } = useSyncForm(props.dynamicScope)
|
|
45
49
|
const current = ref()
|
|
46
50
|
defineOptions({
|
|
@@ -63,9 +67,7 @@ handleTagClick(props.items[0]?.name, 0)
|
|
|
63
67
|
</script>
|
|
64
68
|
|
|
65
69
|
<style lang="scss" scoped>
|
|
66
|
-
@import '@tplc/wot/components/common/abstracts/variable';
|
|
67
70
|
.lcb-tag {
|
|
68
71
|
padding: 8rpx 32rpx;
|
|
69
|
-
border-radius: 10000rpx;
|
|
70
72
|
}
|
|
71
73
|
</style>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<!-- 用来计算内容宽度 -->
|
|
3
|
+
<wd-resize @resize="handleResize" custom-class="!w-full" customContainerClass="!w-full">
|
|
4
|
+
<view class="w-full"></view>
|
|
5
|
+
</wd-resize>
|
|
6
|
+
<wd-sticky v-if="sticky" @sticky="handleSticky">
|
|
7
|
+
<view :style="{ width: !isSticky ? contentWidth + 'px' : '100vw' }">
|
|
4
8
|
<Tabs v-bind="$props" v-if="mode === 'tabs'" />
|
|
5
9
|
<Imgs v-bind="$props" v-else-if="mode === 'image'" />
|
|
6
10
|
<Tags v-bind="$props" v-else />
|
|
@@ -13,6 +17,7 @@
|
|
|
13
17
|
|
|
14
18
|
<script setup lang="ts">
|
|
15
19
|
import { LcbTabsProps } from './types'
|
|
20
|
+
import { ref } from 'vue'
|
|
16
21
|
import Imgs from './components/Imgs/index.vue'
|
|
17
22
|
import Tabs from './components/Tabs/index.vue'
|
|
18
23
|
import Tags from './components/Tags/index.vue'
|
|
@@ -30,6 +35,15 @@ withDefaults(defineProps<LcbTabsProps>(), {
|
|
|
30
35
|
gap: 16,
|
|
31
36
|
imgHeight: 50,
|
|
32
37
|
})
|
|
38
|
+
const isSticky = ref(false)
|
|
39
|
+
const contentWidth = ref(0)
|
|
40
|
+
const handleSticky = (sticky: boolean) => {
|
|
41
|
+
isSticky.value = sticky
|
|
42
|
+
}
|
|
43
|
+
function handleResize(detail: Record<string, string | number>) {
|
|
44
|
+
const { width } = detail
|
|
45
|
+
contentWidth.value = Number(width)
|
|
46
|
+
}
|
|
33
47
|
</script>
|
|
34
48
|
|
|
35
49
|
<style lang="scss" scoped></style>
|
|
@@ -27,6 +27,8 @@ export interface LcbTabsProps extends LcbBlockProps {
|
|
|
27
27
|
tagInactiveColor?: string
|
|
28
28
|
tagTitleActiveColor?: string
|
|
29
29
|
tagTitleInactiveColor?: string
|
|
30
|
+
tagRadius?: number
|
|
31
|
+
tagMinWidth?: number
|
|
30
32
|
tabActiveFontWeight?: string
|
|
31
33
|
tabInactiveFontWeight?: string
|
|
32
34
|
tabActiveFontSize?: number
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StyleValue } from 'vue'
|
|
2
1
|
export interface LcbBlockProps {
|
|
3
2
|
/** 左右外距 */
|
|
4
3
|
marginHorizontal?: number
|
|
@@ -39,7 +38,7 @@ export interface LcbBlockProps {
|
|
|
39
38
|
borderColor?: string
|
|
40
39
|
borderWidth?: number
|
|
41
40
|
textAlign?: 'left' | 'center' | 'right'
|
|
42
|
-
customStyle?:
|
|
41
|
+
customStyle?: Record<string, any>
|
|
43
42
|
align?:
|
|
44
43
|
| 'top-left'
|
|
45
44
|
| 'top-center'
|
|
@@ -22,7 +22,7 @@ declare const __VLS_component: import('vue').DefineComponent<
|
|
|
22
22
|
mode: 'map' | 'list'
|
|
23
23
|
backgroundColor: string
|
|
24
24
|
color: string
|
|
25
|
-
customStyle: string
|
|
25
|
+
customStyle: Record<string, any>
|
|
26
26
|
customClass: string
|
|
27
27
|
zIndex: number
|
|
28
28
|
radius: number
|
|
@@ -4,10 +4,11 @@ declare const _default: import('vue').DefineComponent<
|
|
|
4
4
|
__VLS_WithDefaults<
|
|
5
5
|
__VLS_TypePropsToOption<LcbSwiperProps>,
|
|
6
6
|
{
|
|
7
|
-
mode: string
|
|
8
7
|
itemWidth: number
|
|
9
8
|
itemHeight: number
|
|
10
9
|
enableOpacity: boolean
|
|
10
|
+
mode: string
|
|
11
|
+
scaleStep: number
|
|
11
12
|
}
|
|
12
13
|
>,
|
|
13
14
|
{},
|
|
@@ -26,10 +27,11 @@ declare const _default: import('vue').DefineComponent<
|
|
|
26
27
|
__VLS_WithDefaults<
|
|
27
28
|
__VLS_TypePropsToOption<LcbSwiperProps>,
|
|
28
29
|
{
|
|
29
|
-
mode: string
|
|
30
30
|
itemWidth: number
|
|
31
31
|
itemHeight: number
|
|
32
32
|
enableOpacity: boolean
|
|
33
|
+
mode: string
|
|
34
|
+
scaleStep: number
|
|
33
35
|
}
|
|
34
36
|
>
|
|
35
37
|
>
|
|
@@ -37,10 +39,11 @@ declare const _default: import('vue').DefineComponent<
|
|
|
37
39
|
onSelection?: ((item: DataRecord) => any) | undefined
|
|
38
40
|
},
|
|
39
41
|
{
|
|
40
|
-
mode:
|
|
42
|
+
mode: 'stackLeft' | 'stackRight' | 'stackCenter' | 'tinder'
|
|
41
43
|
itemWidth: number
|
|
42
44
|
itemHeight: number
|
|
43
45
|
enableOpacity: boolean
|
|
46
|
+
scaleStep: number
|
|
44
47
|
},
|
|
45
48
|
{}
|
|
46
49
|
>
|
|
@@ -8,8 +8,10 @@ export interface LcbSwiperProps extends LcbBlockProps {
|
|
|
8
8
|
>[]
|
|
9
9
|
itemWidth?: number
|
|
10
10
|
itemHeight?: number
|
|
11
|
-
mode?:
|
|
11
|
+
mode?: 'stackLeft' | 'stackRight' | 'stackCenter' | 'tinder'
|
|
12
12
|
visibleCount?: number
|
|
13
13
|
imageRadius?: number
|
|
14
14
|
enableOpacity?: boolean
|
|
15
|
+
/** 缩放步长:仅针对 stackLeft/stackRight 模式,每张卡片缩小的比例,默认 0.1 (10%) */
|
|
16
|
+
scaleStep?: number
|
|
15
17
|
}
|
|
@@ -7,6 +7,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
7
7
|
tagInactiveColor: string
|
|
8
8
|
tagTitleActiveColor: string
|
|
9
9
|
tagTitleInactiveColor: string
|
|
10
|
+
tagRadius: number
|
|
10
11
|
}
|
|
11
12
|
>,
|
|
12
13
|
{},
|
|
@@ -27,6 +28,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
27
28
|
tagInactiveColor: string
|
|
28
29
|
tagTitleActiveColor: string
|
|
29
30
|
tagTitleInactiveColor: string
|
|
31
|
+
tagRadius: number
|
|
30
32
|
}
|
|
31
33
|
>
|
|
32
34
|
>
|
|
@@ -36,6 +38,7 @@ declare const _default: import('vue').DefineComponent<
|
|
|
36
38
|
tagInactiveColor: string
|
|
37
39
|
tagTitleActiveColor: string
|
|
38
40
|
tagTitleInactiveColor: string
|
|
41
|
+
tagRadius: number
|
|
39
42
|
},
|
|
40
43
|
{}
|
|
41
44
|
>
|
|
@@ -26,6 +26,8 @@ export interface LcbTabsProps extends LcbBlockProps {
|
|
|
26
26
|
tagInactiveColor?: string
|
|
27
27
|
tagTitleActiveColor?: string
|
|
28
28
|
tagTitleInactiveColor?: string
|
|
29
|
+
tagRadius?: number
|
|
30
|
+
tagMinWidth?: number
|
|
29
31
|
tabActiveFontWeight?: string
|
|
30
32
|
tabInactiveFontWeight?: string
|
|
31
33
|
tabActiveFontSize?: number
|