@tplc/business 0.4.117 → 0.4.118

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,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.4.118](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.117...v0.4.118) (2025-05-19)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.4.115 ([2d74c83](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/2d74c838e391ad6517877fbcbf3a1867a8cdf053))
11
+
12
+
13
+ ### ✨ Features | 新功能
14
+
15
+ * button 预览图片修改 ([1e27b47](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1e27b4719962edb6d1223f159b75c7784aea4066))
16
+ * 反选判断 ([6dea74e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6dea74e65d9843766f7911eff2b01b00d72320d6))
17
+ * 暂时提交 ([0921daa](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0921daa2e8226bbedafeb64a5e3c2e0522228c82))
18
+ * 暂时提交area支持list 还差样式 ([a815d4b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a815d4be226a97ef91a63cbce90cdb51feb4540d))
19
+ * 补充文档 ([45cffbd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/45cffbd548e36ac779c44e6caee637c0b858a432))
20
+
21
+ ### [0.4.115](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.112...v0.4.115) (2025-05-15)
22
+
23
+
24
+ ### 🚀 Chore | 构建/工程依赖/工具
25
+
26
+ * **release:** 0.4.113 ([72dd9dd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/72dd9dd453292322440b0b1ce06ec70e6ba094ff))
27
+ * **release:** 0.4.114 ([775e408](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/775e408f8aa9ecca5477c60ec99c28cbd34a0e8b))
5
28
  ### [0.4.117](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.116...v0.4.117) (2025-05-15)
6
29
 
7
30
  ### [0.4.116](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.115...v0.4.116) (2025-05-15)
@@ -16,12 +39,9 @@ All notable changes to this project will be documented in this file. See [standa
16
39
 
17
40
  ### ✨ Features | 新功能
18
41
 
19
- * 动态图片跳转 ([2061cc9](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/2061cc92205af00523e94825b3aef32102fabe17))
20
-
21
- ### [0.4.114](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.113...v0.4.114) (2025-05-14)
22
-
42
+ * history 根据productName唯一 ([27149ba](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/27149ba0de8dd19cb84be79703d9915222634a99))
43
+ * propmt ([7904ba7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7904ba753b23dd38ca995c64a2a9c269ad9c95de))
23
44
 
24
- ### ✨ Features | 新功能
25
45
 
26
46
  * wec ([86e30e1](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/86e30e1b610da8c4441b264cf2e0cefe35739af6))
27
47
 
package/action.d.ts CHANGED
@@ -18,7 +18,15 @@ export type IResData<T> = {
18
18
  msg: string
19
19
  data: T
20
20
  }
21
-
21
+ export interface DataSource {
22
+ source?: 'remote' | 'context' | 'user'
23
+ requestInfo?: {
24
+ requestUrl: string
25
+ requestParams: Record<string, unknown>
26
+ }
27
+ /** 动态key */
28
+ dependKey?: string
29
+ }
22
30
  export interface LcbGlobal {
23
31
  http: {
24
32
  get<T>(url: string, query?: Record<string, any> | undefined): Promise<IResData<T>>
@@ -0,0 +1,81 @@
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>
@@ -1,34 +1,16 @@
1
1
  <template>
2
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
- >
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>
3
+ <view v-for="(item, index) in renderList" :key="index">
4
+ <lcb-area-item v-bind="$props" :data="item" />
23
5
  </view>
24
6
  </lcb-block>
25
7
  </template>
26
8
 
27
9
  <script setup lang="ts">
28
- import { computed, inject, Ref } from 'vue'
10
+ import { computed, inject, Ref, watchEffect, ref } from 'vue'
29
11
  import { LcbAreaProps } from './types'
30
- import { transformValueUnit } from '@tplc/business/utils/transform'
31
12
  import { get } from 'lodash-es'
13
+ import LcbAreaItem from './components/LcbAreaItem/index.vue'
32
14
  import { PAGE_PROVIDE_KEY } from '@tplc/business/constants'
33
15
  defineOptions({
34
16
  name: 'LcbArea',
@@ -38,36 +20,14 @@ defineOptions({
38
20
  styleIsolation: 'shared',
39
21
  },
40
22
  })
23
+ const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
24
+ const userStore = uni.$lcb.userStore?.()
41
25
  const props = withDefaults(defineProps<LcbAreaProps>(), {
42
26
  displayFlex: 'row',
43
27
  display: 'flex',
44
28
  overflowX: 'initial',
29
+ mode: 'single',
45
30
  })
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
- }
58
- })
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
31
 
72
32
  const showArea = computed(() => {
73
33
  if (props.dependKey) {
@@ -76,20 +36,35 @@ const showArea = computed(() => {
76
36
  if (props.dependKeyCompareValue) {
77
37
  return `${value}` === `${props.dependKeyCompareValue}`
78
38
  }
39
+ if (value === undefined) {
40
+ return false
41
+ }
79
42
  return props.reverse ? !value : Boolean(value)
80
43
  }
81
44
  return true
82
45
  })
83
- </script>
84
46
 
85
- <style lang="scss" scoped>
86
- // 小程序的情况
87
- // #ifdef MP-WEIXIN
88
- .slot-wrapper {
89
- :deep(> view) {
90
- width: 100%;
91
- height: 100%;
47
+ const renderList = ref<unknown[]>([])
48
+
49
+ watchEffect(async () => {
50
+ if (props.mode === 'single') {
51
+ renderList.value = [props.list]
52
+ } else {
53
+ if (props.dataSource?.source === 'remote') {
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
+ }
92
68
  }
93
- }
94
- // #endif
95
- </style>
69
+ })
70
+ </script>
@@ -1,5 +1,8 @@
1
+ import { DataSource } from '../../action'
1
2
  import { LcbBlockProps } from '../lcb-block/types'
2
3
  export interface LcbAreaProps extends LcbBlockProps {
4
+ mode?: 'single' | 'multiple'
5
+ dataSource?: DataSource
3
6
  id?: number
4
7
  fixed?: boolean
5
8
  unDraggable?: boolean
@@ -143,6 +143,9 @@ const renderItems = computed(() => {
143
143
  if (item.dependKeyCompareValue) {
144
144
  return `${value}` === `${item.dependKeyCompareValue}`
145
145
  }
146
+ if (value === undefined) {
147
+ return false
148
+ }
146
149
  return item.reverse ? !value : Boolean(value)
147
150
  }
148
151
  return true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.117",
3
+ "version": "0.4.118",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -0,0 +1,70 @@
1
+ import { LcbAreaProps } from '../../types'
2
+ declare function __VLS_template(): {
3
+ default?(_: { item: LcbAreaProps }): any
4
+ }
5
+ declare const __VLS_component: import('vue').DefineComponent<
6
+ __VLS_WithDefaults<
7
+ __VLS_TypePropsToOption<
8
+ LcbAreaProps & {
9
+ data?: unknown
10
+ }
11
+ >,
12
+ {}
13
+ >,
14
+ {},
15
+ unknown,
16
+ {},
17
+ {},
18
+ import('vue').ComponentOptionsMixin,
19
+ import('vue').ComponentOptionsMixin,
20
+ {},
21
+ string,
22
+ import('vue').PublicProps,
23
+ Readonly<
24
+ import('vue').ExtractPropTypes<
25
+ __VLS_WithDefaults<
26
+ __VLS_TypePropsToOption<
27
+ LcbAreaProps & {
28
+ data?: unknown
29
+ }
30
+ >,
31
+ {}
32
+ >
33
+ >
34
+ >,
35
+ {},
36
+ {}
37
+ >
38
+ declare const _default: __VLS_WithTemplateSlots<
39
+ typeof __VLS_component,
40
+ ReturnType<typeof __VLS_template>
41
+ >
42
+ export default _default
43
+ type __VLS_WithDefaults<P, D> = {
44
+ [K in keyof Pick<P, keyof P>]: K extends keyof D
45
+ ? __VLS_Prettify<
46
+ P[K] & {
47
+ default: D[K]
48
+ }
49
+ >
50
+ : P[K]
51
+ }
52
+ type __VLS_Prettify<T> = {
53
+ [K in keyof T]: T[K]
54
+ } & {}
55
+ type __VLS_WithTemplateSlots<T, S> = T & {
56
+ new (): {
57
+ $slots: S
58
+ }
59
+ }
60
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
61
+ type __VLS_TypePropsToOption<T> = {
62
+ [K in keyof T]-?: {} extends Pick<T, K>
63
+ ? {
64
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>
65
+ }
66
+ : {
67
+ type: import('vue').PropType<T[K]>
68
+ required: true
69
+ }
70
+ }
@@ -1,14 +1,12 @@
1
1
  import { LcbAreaProps } from './types'
2
- declare function __VLS_template(): {
3
- default?(_: { item: LcbAreaProps }): any
4
- }
5
- declare const __VLS_component: import('vue').DefineComponent<
2
+ declare const _default: import('vue').DefineComponent<
6
3
  __VLS_WithDefaults<
7
4
  __VLS_TypePropsToOption<LcbAreaProps>,
8
5
  {
9
6
  displayFlex: string
10
7
  display: string
11
8
  overflowX: string
9
+ mode: string
12
10
  }
13
11
  >,
14
12
  {},
@@ -28,21 +26,19 @@ declare const __VLS_component: import('vue').DefineComponent<
28
26
  displayFlex: string
29
27
  display: string
30
28
  overflowX: string
29
+ mode: string
31
30
  }
32
31
  >
33
32
  >
34
33
  >,
35
34
  {
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
- >
46
42
  export default _default
47
43
  type __VLS_WithDefaults<P, D> = {
48
44
  [K in keyof Pick<P, keyof P>]: K extends keyof D
@@ -56,11 +52,6 @@ type __VLS_WithDefaults<P, D> = {
56
52
  type __VLS_Prettify<T> = {
57
53
  [K in keyof T]: T[K]
58
54
  } & {}
59
- type __VLS_WithTemplateSlots<T, S> = T & {
60
- new (): {
61
- $slots: S
62
- }
63
- }
64
55
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
65
56
  type __VLS_TypePropsToOption<T> = {
66
57
  [K in keyof T]-?: {} extends Pick<T, K>
@@ -1,5 +1,8 @@
1
+ import { DataSource } from '../../action'
1
2
  import { LcbBlockProps } from '../lcb-block/types'
2
3
  export interface LcbAreaProps extends LcbBlockProps {
4
+ mode?: 'single' | 'multiple'
5
+ dataSource?: DataSource
3
6
  id?: number
4
7
  fixed?: boolean
5
8
  unDraggable?: boolean