@tplc/business 0.7.54 → 0.7.56

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,54 @@
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.7.56](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.54...v0.7.56) (2026-01-08)
6
+
7
+
8
+ ### ♻️ Code Refactoring | 代码重构
9
+
10
+ * **lcb-product-item:** remove unused type definitions and clean up component structure ([29c4cd2](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/29c4cd2da45f3486d5efc654ef736120be697349))
11
+ * **lcb-tabs, lcb-filter-grid, lcb-list, lcb-product:** update useSyncForm to accept an object with dynamicScope and visibleScope, and set defaultIndex for tabs components ([578529d](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/578529d7fadd466d22f660ebfe90362740b8e630))
12
+
13
+
14
+ ### 🚀 Chore | 构建/工程依赖/工具
15
+
16
+ * **release:** 0.7.55 ([fe46af8](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/fe46af87b2c0b2cc17f639dbd9a4b18ed43e8efb))
17
+
18
+
19
+ ### ✨ Features | 新功能
20
+
21
+ * **lcb-tabs:** add defaultIndex prop to tabs components and update useSyncForm to accept visibleScope ([d46356f](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/d46356f58a2c8b8f035a036d53e39fee0de9e69d))
22
+ * **lcb-wrapper-list:** enhance data handling by adding dynamicScope support and improving form synchronization ([48a562c](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/48a562c69d1037073b1bff62b4491959c0ac5ea0))
23
+
24
+ ### [0.7.55](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.52...v0.7.55) (2026-01-08)
25
+
26
+
27
+ ### ✨ Features | 新功能
28
+
29
+ * **lcb-calendar-search, lcb-product-item:** add new props for placeholder styling and image display options ([c17182d](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/c17182da05d8db59764f3dd7127a98304a096b83))
30
+ * **lcb-wrapper-list:** implement pagination support with z-paging and enhance dynamic style handling in lcb-block ([f345e4e](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/f345e4e0d84231db8e72fd55fefebdf01eac3bd6))
31
+
32
+
33
+ ### 🐛 Bug Fixes | Bug 修复
34
+
35
+ * **lcb-area:** use nullish coalescing for default flex value in itemStylesCache ([421d71c](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/421d71c428f4a2f3db37169e9d5dd6ccdc1d6d07))
36
+ * **wd-img:** remove unnecessary z-index class from image component ([064ed39](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/064ed3962a45987ac7f22140312659df29259a0d))
37
+
38
+
39
+ ### 🚀 Chore | 构建/工程依赖/工具
40
+
41
+ * **release:** 0.7.53 ([1a4d9f8](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/1a4d9f8d00b444997f97ee7b8469ffceda2b3f86))
42
+ * **release:** 0.7.54 ([29b264d](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/29b264d0d52a07f3598e4663c4463b8770beca91))
43
+ * **release:** 1.0.25 ([7dcdf05](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/7dcdf052c6144d79356f92574c12f94da2b1cd55))
44
+
45
+
46
+ ### ♻️ Code Refactoring | 代码重构
47
+
48
+ * **lcb-area, lcb-button:** optimize actionProps computation and streamline data source selection ([117ce0d](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/117ce0df62ee17b25a341c4dd3b51b90a0f78bd8))
49
+ * **lcb-product-item:** remove unused type definitions and clean up component structure ([29c4cd2](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/29c4cd2da45f3486d5efc654ef736120be697349))
50
+ * **lcb-tabs, lcb-filter-grid, lcb-list, lcb-product:** update useSyncForm to accept an object with dynamicScope and visibleScope, and set defaultIndex for tabs components ([578529d](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/578529d7fadd466d22f660ebfe90362740b8e630))
51
+ * **lcb-wrapper-list:** streamline pagination implementation and enhance style handling in lcb-block ([9bb70e5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/9bb70e58d28cb5575760d6fad0da81dec229beab))
52
+
5
53
  ### [0.7.54](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v1.0.25...v0.7.54) (2026-01-07)
6
54
 
7
55
 
package/action.d.ts CHANGED
@@ -23,6 +23,7 @@ export interface DataSource {
23
23
  requestInfo?: {
24
24
  requestUrl: string
25
25
  requestParams: string
26
+ dynamicScope?: string
26
27
  }
27
28
  /** 动态key */
28
29
  dependKey?: string
@@ -63,7 +63,7 @@ const props = withDefaults(defineProps<LcbFilterGridProps>(), {
63
63
  activeFontSize: 28,
64
64
  activeBgColor: 'var(--wot-color-theme)',
65
65
  })
66
- const { syncForm } = useSyncForm(props.dynamicScope)
66
+ const { syncForm } = useSyncForm({ dynamicScope: props.dynamicScope })
67
67
  const current = ref(-1)
68
68
  const handleClick = (index: number) => {
69
69
  const isCurrent = index === current.value
@@ -37,7 +37,7 @@ const props = defineProps<LcbFilterListProps>()
37
37
  const dataList = ref<unknown[]>([])
38
38
  const paging = ref()
39
39
  const { height } = useAutoHeight()
40
- const { form } = useSyncForm(props.dynamicScope)
40
+ const { form } = useSyncForm({ dynamicScope: props.dynamicScope })
41
41
  const refreshed = ref(false)
42
42
  useZPaging(paging)
43
43
  const modelValue = defineModel<unknown[]>({
@@ -32,7 +32,7 @@ const props = withDefaults(defineProps<LcbProductProps>(), {
32
32
  sourceMode: 1,
33
33
  gap: 16,
34
34
  })
35
- const { form } = useSyncForm(props.dynamicScope)
35
+ const { form } = useSyncForm({ dynamicScope: props.dynamicScope })
36
36
  const loading = ref(false)
37
37
  const renderList = ref<Record<string, any>[]>([])
38
38
  const screenWidth = isH5
@@ -47,9 +47,13 @@ const props = withDefaults(defineProps<LcbTabsProps>(), {
47
47
  imgTitleGap: 24,
48
48
  activeColor: 'var(--wot-color-theme)',
49
49
  inactiveColor: '#333333',
50
+ defaultIndex: 0,
50
51
  })
51
- const { syncForm } = useSyncForm(props.dynamicScope)
52
- const current = ref(0)
52
+ const { syncForm } = useSyncForm({
53
+ dynamicScope: props.dynamicScope,
54
+ visibleScope: props.visibleScope,
55
+ })
56
+ const current = ref(props.defaultIndex)
53
57
  const imgKey = ref(0)
54
58
  const debounceFn = throttle(() => {
55
59
  imgKey.value++
@@ -70,11 +74,7 @@ watch(
70
74
  )
71
75
  const handleTagClick = (name: string, index: number) => {
72
76
  current.value = index
73
- try {
74
- syncForm(JSON.parse(name))
75
- } catch (error) {
76
- console.error(error)
77
- }
77
+ syncForm(JSON.parse(name))
78
78
  }
79
- handleTagClick(props.items?.[0].name, 0)
79
+ handleTagClick(props.items?.[current.value].name, current.value)
80
80
  </script>
@@ -14,6 +14,7 @@
14
14
  ref="tabs"
15
15
  :inactiveColor="tagTitleInactiveColor"
16
16
  :color="tagTitleActiveColor"
17
+ v-model="currentTab"
17
18
  >
18
19
  <wd-tab v-for="tab in items" :key="tab.name" :title="tab.title" :name="tab.name" />
19
20
  </wd-tabs>
@@ -39,14 +40,15 @@ const props = withDefaults(defineProps<LcbTabsProps>(), {
39
40
  lineHeight: 3,
40
41
  slidable: 'auto',
41
42
  slidableNum: 6,
43
+ defaultIndex: 0,
44
+ })
45
+ const currentTab = ref(props.defaultIndex)
46
+ const { syncForm } = useSyncForm({
47
+ dynamicScope: props.dynamicScope,
48
+ visibleScope: props.visibleScope,
42
49
  })
43
- const { syncForm } = useSyncForm(props.dynamicScope)
44
50
  const handleChange = (e: { name: string }) => {
45
- try {
46
- syncForm(JSON.parse(e.name))
47
- } catch (error) {
48
- console.error(error)
49
- }
51
+ syncForm(JSON.parse(e.name))
50
52
  }
51
53
  watch(
52
54
  () => [props.lineWidth, props.lineHeight, props.slidable, props.slidableNum],
@@ -43,10 +43,13 @@ const props = withDefaults(defineProps<LcbTabsProps>(), {
43
43
  tagTitleActiveColor: '#ffffff',
44
44
  tagTitleInactiveColor: '#000000',
45
45
  tagRadius: 100,
46
+ defaultIndex: 0,
46
47
  })
47
- console.log(props, 'props')
48
- const { syncForm } = useSyncForm(props.dynamicScope)
49
- const current = ref()
48
+ const { syncForm } = useSyncForm({
49
+ dynamicScope: props.dynamicScope,
50
+ visibleScope: props.visibleScope,
51
+ })
52
+ const current = ref(props.defaultIndex)
50
53
  defineOptions({
51
54
  name: 'LcbTagsItem',
52
55
  options: {
@@ -57,13 +60,9 @@ defineOptions({
57
60
  })
58
61
  const handleTagClick = (name: string, index: number) => {
59
62
  current.value = index
60
- try {
61
- syncForm(JSON.parse(name))
62
- } catch (error) {
63
- console.error(error)
64
- }
63
+ syncForm(JSON.parse(name))
65
64
  }
66
- handleTagClick(props.items[0]?.name, 0)
65
+ handleTagClick(props.items[current.value]?.name, current.value)
67
66
  </script>
68
67
 
69
68
  <style lang="scss" scoped>
@@ -34,6 +34,7 @@ withDefaults(defineProps<LcbTabsProps>(), {
34
34
  tagsMode: 'tiled',
35
35
  gap: 16,
36
36
  imgHeight: 50,
37
+ defaultIndex: 0,
37
38
  })
38
39
  const isSticky = ref(false)
39
40
  const contentWidth = ref(0)
@@ -19,6 +19,8 @@ export interface LcbTabsProps extends LcbBlockProps {
19
19
  tagsMode?: 'scroll' | 'tiled'
20
20
  gap?: number
21
21
  dynamicScope?: string
22
+ visibleScope?: string
23
+ defaultIndex?: number
22
24
  imgHeight?: number
23
25
  imgTitleGap?: number
24
26
  activeColor?: string
@@ -40,6 +40,7 @@ import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging'
40
40
  import useDynamicData from '../../hooks/useDynamicData'
41
41
  import { dynamicRequest } from '../../utils/request'
42
42
  import { LcbWrapperListProps } from './types'
43
+ import useSyncForm from '../../hooks/useSyncForm'
43
44
  defineOptions({
44
45
  name: 'LcbWrapperList',
45
46
  options: {
@@ -56,6 +57,7 @@ const props = withDefaults(defineProps<LcbWrapperListProps>(), {
56
57
  pagingUsePageScroll: true,
57
58
  })
58
59
  const { userStore, innerDynamicData } = useDynamicData()
60
+ const { form } = useSyncForm({ dynamicScope: props.dataSource?.requestInfo?.dynamicScope })
59
61
  // 使用 shallowRef 优化大数组的响应式性能
60
62
  const renderList = shallowRef<unknown[]>([])
61
63
  const paging = ref()
@@ -83,10 +85,19 @@ const queryList = async (page: number, limit: number) => {
83
85
  pageSearch.value = { page, limit }
84
86
  const data = await dynamicRequest(props.dataSource, innerDynamicData.value, userStore?.userInfo, {
85
87
  pageSearch: pageSearch.value,
88
+ ...form.value,
86
89
  })
87
90
  paging.value?.complete?.(data)
88
91
  }
89
92
 
93
+ const getPageData = () => {
94
+ pageSearch.value = {
95
+ limit: props.pageProps?.pageLimit || 10,
96
+ page: 1,
97
+ }
98
+ paging.value?.reload?.()
99
+ }
100
+
90
101
  watch(
91
102
  () =>
92
103
  [
@@ -99,11 +110,7 @@ watch(
99
110
 
100
111
  async ([dataSource, dynamicData, userInfo, pagingEnabled, pageLimit = 10]) => {
101
112
  if (pagingEnabled) {
102
- pageSearch.value = {
103
- limit: pageLimit,
104
- page: 1,
105
- }
106
- paging.value?.reload?.()
113
+ getPageData()
107
114
  return
108
115
  }
109
116
  // 防止重复请求
@@ -118,6 +125,18 @@ watch(
118
125
  { immediate: true },
119
126
  )
120
127
 
128
+ watch(
129
+ () => form.value,
130
+ () => {
131
+ if (props.pageProps?.pagingEnabled) {
132
+ getPageData()
133
+ }
134
+ },
135
+ {
136
+ deep: true,
137
+ },
138
+ )
139
+
121
140
  // 优化:缓存 key 获取逻辑,减少属性访问
122
141
  const getItemKey = (item: any, index: number) => {
123
142
  return item?.id ?? item?.key ?? index
@@ -1,17 +1,26 @@
1
- import { FORM_KEY, PAGE_DYNAMIC_DATA } from '../constants'
1
+ import { FORM_KEY, PAGE_DYNAMIC_DATA, PAGE_PROVIDE_KEY } from '../constants'
2
2
  import { computed, inject, Ref } from 'vue'
3
3
 
4
- const useSyncForm = (dynamicScope?: string) => {
4
+ const useSyncForm = ({
5
+ dynamicScope,
6
+ visibleScope,
7
+ }: {
8
+ dynamicScope?: string
9
+ visibleScope?: string
10
+ }) => {
5
11
  /** 上下文全局 */
6
12
  const globalForm = inject(FORM_KEY) as Ref<Record<string, any>>
7
13
  /** 上下文局部form */
8
14
  const pageDynamicData = inject(PAGE_DYNAMIC_DATA) as Ref<Record<string, any>>
15
+ const visiblePageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
9
16
  const syncForm = (params: Record<string, any>) => {
10
17
  if (dynamicScope) {
11
18
  pageDynamicData.value[dynamicScope] = {
12
19
  ...pageDynamicData.value[dynamicScope],
13
20
  ...params,
14
21
  }
22
+ } else if (visibleScope) {
23
+ visiblePageInfo.value[visibleScope] = params
15
24
  } else {
16
25
  globalForm.value = {
17
26
  ...globalForm.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.7.54",
3
+ "version": "0.7.56",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -6,6 +6,7 @@ declare const _default: import('vue').DefineComponent<
6
6
  imgTitleGap: number
7
7
  activeColor: string
8
8
  inactiveColor: string
9
+ defaultIndex: number
9
10
  }
10
11
  >,
11
12
  {},
@@ -25,6 +26,7 @@ declare const _default: import('vue').DefineComponent<
25
26
  imgTitleGap: number
26
27
  activeColor: string
27
28
  inactiveColor: string
29
+ defaultIndex: number
28
30
  }
29
31
  >
30
32
  >
@@ -32,6 +34,7 @@ declare const _default: import('vue').DefineComponent<
32
34
  {
33
35
  activeColor: string
34
36
  inactiveColor: string
37
+ defaultIndex: number
35
38
  imgTitleGap: number
36
39
  },
37
40
  {}
@@ -7,6 +7,7 @@ declare const _default: import('vue').DefineComponent<
7
7
  lineHeight: number
8
8
  slidable: string
9
9
  slidableNum: number
10
+ defaultIndex: number
10
11
  }
11
12
  >,
12
13
  {},
@@ -27,6 +28,7 @@ declare const _default: import('vue').DefineComponent<
27
28
  lineHeight: number
28
29
  slidable: string
29
30
  slidableNum: number
31
+ defaultIndex: number
30
32
  }
31
33
  >
32
34
  >
@@ -36,6 +38,7 @@ declare const _default: import('vue').DefineComponent<
36
38
  lineWidth: number
37
39
  slidableNum: number
38
40
  slidable: 'always' | 'auto'
41
+ defaultIndex: number
39
42
  },
40
43
  {}
41
44
  >
@@ -8,6 +8,7 @@ declare const _default: import('vue').DefineComponent<
8
8
  tagTitleActiveColor: string
9
9
  tagTitleInactiveColor: string
10
10
  tagRadius: number
11
+ defaultIndex: number
11
12
  }
12
13
  >,
13
14
  {},
@@ -29,11 +30,13 @@ declare const _default: import('vue').DefineComponent<
29
30
  tagTitleActiveColor: string
30
31
  tagTitleInactiveColor: string
31
32
  tagRadius: number
33
+ defaultIndex: number
32
34
  }
33
35
  >
34
36
  >
35
37
  >,
36
38
  {
39
+ defaultIndex: number
37
40
  tagActiveColor: string
38
41
  tagInactiveColor: string
39
42
  tagTitleActiveColor: string
@@ -7,6 +7,7 @@ declare const _default: import('vue').DefineComponent<
7
7
  tagsMode: string
8
8
  gap: number
9
9
  imgHeight: number
10
+ defaultIndex: number
10
11
  }
11
12
  >,
12
13
  {},
@@ -27,6 +28,7 @@ declare const _default: import('vue').DefineComponent<
27
28
  tagsMode: string
28
29
  gap: number
29
30
  imgHeight: number
31
+ defaultIndex: number
30
32
  }
31
33
  >
32
34
  >
@@ -35,6 +37,7 @@ declare const _default: import('vue').DefineComponent<
35
37
  gap: number
36
38
  itemFontSize: number
37
39
  tagsMode: 'scroll' | 'tiled'
40
+ defaultIndex: number
38
41
  imgHeight: number
39
42
  },
40
43
  {}
@@ -18,6 +18,8 @@ export interface LcbTabsProps extends LcbBlockProps {
18
18
  tagsMode?: 'scroll' | 'tiled'
19
19
  gap?: number
20
20
  dynamicScope?: string
21
+ visibleScope?: string
22
+ defaultIndex?: number
21
23
  imgHeight?: number
22
24
  imgTitleGap?: number
23
25
  activeColor?: string
@@ -1,4 +1,10 @@
1
- declare const useSyncForm: (dynamicScope?: string) => {
1
+ declare const useSyncForm: ({
2
+ dynamicScope,
3
+ visibleScope,
4
+ }: {
5
+ dynamicScope?: string
6
+ visibleScope?: string
7
+ }) => {
2
8
  syncForm: (params: Record<string, any>) => void
3
9
  form: import('vue').ComputedRef<any>
4
10
  }
package/utils/request.ts CHANGED
@@ -10,13 +10,10 @@ export const dynamicRequest = async (
10
10
  if (dataSource?.source === 'remote') {
11
11
  if (dataSource.requestInfo?.requestUrl) {
12
12
  const baseParams = JSON.parse(dataSource.requestInfo.requestParams || '{}')
13
- const response = await uni.$lcb.http.post(
14
- dataSource.requestInfo.requestUrl,
15
- {
16
- ...baseParams,
17
- ...(extraParams || {}),
18
- },
19
- )
13
+ const response = await uni.$lcb.http.post(dataSource.requestInfo.requestUrl, {
14
+ ...baseParams,
15
+ ...(extraParams || {}),
16
+ })
20
17
  /** 如果依赖key存在,则取依赖key的值 */
21
18
  return response[dataSource?.dependKey || 'data'] as unknown
22
19
  }