@tplc/business 0.4.28 → 0.4.29

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,13 @@
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.29](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.28...v0.4.29) (2025-03-27)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * 调整组件 ([6b4ce6c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6b4ce6c95ee380e143df93b6de16e6c8af0116d7))
11
+
5
12
  ### [0.4.28](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.75...v0.4.28) (2025-03-27)
6
13
 
7
14
 
@@ -60,11 +60,13 @@
60
60
  </template>
61
61
 
62
62
  <script setup lang="ts">
63
- import { getCurrentInstance, nextTick, watch, ref, computed, onMounted } from 'vue'
63
+ import { getCurrentInstance, nextTick, watch, ref, computed } from 'vue'
64
64
  import { TreeSelectProps } from './type'
65
65
  import useSelect from '../../hooks/useSelect'
66
66
  import SelectTagView from '../SelectTagView/index.vue'
67
67
  import ActionView from '../ActionView/index.vue'
68
+ import useSyncValues from '../../hooks/useSyncValues'
69
+ import { Option } from '../../types'
68
70
  defineOptions({
69
71
  name: 'TreeSelect',
70
72
  options: {
@@ -75,6 +77,7 @@ defineOptions({
75
77
  })
76
78
  const props = defineProps<TreeSelectProps>()
77
79
  const modelKeys = defineModel<string[]>('keys')
80
+ const { syncValues } = useSyncValues()
78
81
  const innerValue = ref(props.value)
79
82
  const toView = ref('')
80
83
  const extraModel = ref({
@@ -97,11 +100,14 @@ const { onItemClick, options, getChecked } = useSelect(props, {
97
100
  onOpen,
98
101
  })
99
102
  const currentCategory = ref(0)
103
+
100
104
  const onSubmit = () => {
101
- emits('submit', {
105
+ const params = {
102
106
  ...extraModel.value,
103
107
  [props.valueName]: innerValue.value,
104
- })
108
+ }
109
+ setValues(params)
110
+ emits('submit', params)
105
111
  }
106
112
  const onCategoryClick = (index: number) => {
107
113
  currentCategory.value = index
@@ -149,6 +155,41 @@ const onCancel = () => {
149
155
  {} as Record<string, any>,
150
156
  )
151
157
  }
158
+ /** 递归获取optionsMap key为value 值位options */
159
+ const optionsMap = computed(() => {
160
+ const map = {} as Record<string, Option>
161
+ options.value.forEach((v) => {
162
+ if (!v.valueName) {
163
+ map[v.value] = v
164
+ if (v.children) {
165
+ v.children.forEach((v) => {
166
+ map[v.value] = v
167
+ })
168
+ }
169
+ }
170
+ })
171
+ return map
172
+ })
173
+
174
+ const setValues = (params: Record<string, any>) => {
175
+ if (params[props.valueName]) {
176
+ syncValues(
177
+ props.valueName,
178
+ params[props.valueName].map((v) => optionsMap.value[v]),
179
+ )
180
+ }
181
+ modelKeys.value?.forEach((v: string) => {
182
+ if (v !== props.valueName && params[v]) {
183
+ const currentOptions = options.value.find((option) => option.valueName === v)
184
+ if (currentOptions) {
185
+ syncValues(
186
+ v,
187
+ params[v].map((v) => optionsMap.value[v]),
188
+ )
189
+ }
190
+ }
191
+ })
192
+ }
152
193
  </script>
153
194
  <style lang="scss" scoped>
154
195
  @import '@tplc/wot/components/common/abstracts/variable';
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <view v-if="extendJson" :style="itemStyle" class="overflow-hidden text-3">
3
+ <view
4
+ class="flex items-center justify-center p-3 bg-white box-border"
5
+ v-if="extendJson.resultTitle"
6
+ >
7
+ <view class="flex items-center justify-center">
8
+ <img :src="extendJson.resultIcon" alt="" class="w-4 h-4" />
9
+ <view class="ml-2">
10
+ <view class="mt-1">{{ extendJson.resultTitle }}</view>
11
+ <view class="text-#969696 text-2.5">{{ extendJson.resultSubTitle }}</view>
12
+ </view>
13
+ </view>
14
+ </view>
15
+ <view class="p-3 bg-#F5F5F5 box-border">
16
+ <view class="flex items-center justify-between">
17
+ <view class="flex items-center gap-1">
18
+ <img :src="extendJson.optionIcon" alt="" class="w-3 h-3" />
19
+ {{ extendJson.optionTitle }}
20
+ </view>
21
+ <view class="flex items-center justify-center" @click="handleClearAll">
22
+ <wd-icon name="delete1" size="16" />
23
+ <text class="ml-0.5">清空</text>
24
+ </view>
25
+ </view>
26
+ <view class="flex flex-wrap gap-1 mt-2">
27
+ <block v-for="tag in options" :key="tag.key">
28
+ <view
29
+ v-for="option in tag.options"
30
+ :key="option.value"
31
+ @click="removeTag(option.value, tag.key, tag.options!.length)"
32
+ class="rounded-1 flex items-center bg-white px-2 py-0.5 gap-1 box-border overflow-hidden"
33
+ >
34
+ <text class="tag-text text-3">{{ option.label }}</text>
35
+ <wd-icon name="close" size="20rpx" color="#969696" />
36
+ </view>
37
+ </block>
38
+ </view>
39
+ </view>
40
+ </view>
41
+ </template>
42
+
43
+ <script lang="ts" setup>
44
+ import { ListFormChooserValues } from '../../types'
45
+ import { LIST_FORM_CHOOSER_VALUES, FORM_KEY } from '../../../../constants'
46
+ import { Ref, computed, inject } from 'vue'
47
+ import { transformValueUnit } from '../../../../utils/transform'
48
+ defineOptions({
49
+ name: 'UnconditionedLayout',
50
+ options: {
51
+ addGlobalClass: true,
52
+ virtualHost: true,
53
+ },
54
+ })
55
+ interface UnconditionedLayoutConfig {
56
+ optionTitle: string
57
+ resultIcon: string
58
+ resultTitle: string
59
+ optionIcon: string
60
+ resultSubTitle: string
61
+ }
62
+
63
+ const list = inject(LIST_FORM_CHOOSER_VALUES) as Ref<ListFormChooserValues>
64
+ const form = inject(FORM_KEY) as Ref<Record<string, any>>
65
+ const props = withDefaults(
66
+ defineProps<{
67
+ extendJson?: UnconditionedLayoutConfig
68
+ borderRadius?: number
69
+ shadowSize?: number
70
+ shadowColor?: string
71
+ blurSize?: number
72
+ }>(),
73
+ {
74
+ borderRadius: 12,
75
+ shadowSize: 1,
76
+ shadowColor: '#D6D7DA',
77
+ blurSize: 5,
78
+ },
79
+ )
80
+
81
+ const itemStyle = computed(() => {
82
+ return {
83
+ borderRadius: transformValueUnit(props.borderRadius),
84
+ boxShadow:
85
+ props.shadowColor && props.shadowSize
86
+ ? `0px 0px ${props.blurSize}px ${props.shadowSize}px ${props.shadowColor}`
87
+ : '',
88
+ }
89
+ })
90
+
91
+ const options = computed(() => {
92
+ return Object.keys(list.value)
93
+ .filter((v) => list.value[v])
94
+ .map((v) => {
95
+ return {
96
+ key: v,
97
+ options: list.value[v],
98
+ }
99
+ })
100
+ })
101
+
102
+ /**
103
+ * 移除单个标签
104
+ */
105
+ const removeTag = (value: string, key: string, length: number) => {
106
+ if (length === 1) {
107
+ form.value[key] = undefined
108
+ list.value[key] = []
109
+ } else {
110
+ list.value[key] = list.value[key]!.filter((v) => v.value !== value)
111
+ form.value[key] = form.value[key].filter((v: string) => v !== value)
112
+ }
113
+ }
114
+
115
+ /**
116
+ * 清空所有标签
117
+ */
118
+ const handleClearAll = () => {
119
+ Object.keys(list.value).forEach((v) => {
120
+ form.value[v] = undefined
121
+ list.value[v] = []
122
+ })
123
+ }
124
+ </script>
@@ -43,6 +43,7 @@
43
43
  import { getCurrentPage } from '../../../utils/utils'
44
44
  import { getShareConfigList } from './api'
45
45
  import { ref, inject, watch } from 'vue'
46
+ import lcbPoster from '../../lcb-poster/lcb-poster.vue'
46
47
  defineOptions({
47
48
  name: 'SharePopup',
48
49
  options: {
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { inject, Ref, ref, useAttrs, watch, watchEffect } from 'vue'
3
3
  import UWaterfall from 'uview-plus/components/u-waterfall/u-waterfall.vue'
4
+ import UnconditionedLayout from '../lcb-list/components/UnconditionedLayout/index.vue'
4
5
  import { LcbProductProps } from './types'
5
6
  import { transformValueUnit } from '../../utils/transform'
6
7
  import { calculateImageHeight } from '../../utils/utils'
@@ -149,35 +150,37 @@ defineExpose({
149
150
  width: itemWidth ? `${itemWidth}rpx` : '100%',
150
151
  }"
151
152
  >
152
- <lcb-action-view
153
- v-for="(item, index) in renderList"
154
- :key="`${item?.productId}:${index}`"
155
- v-bind="item.link"
156
- >
157
- <slot name="item" :item="item">
158
- <lcb-absolute-config-layout
159
- v-if="renderItemAbsoluteConfigLayout"
160
- :blocks="renderItemAbsoluteConfigLayout?.blocks"
161
- :canvas="renderItemAbsoluteConfigLayout?.canvas"
162
- :dataset="{
163
- ...(renderItemAbsoluteConfigLayout?.dataset ?? {}),
164
- ...item,
165
- }"
166
- />
167
- <lcb-product-item
168
- v-else
169
- v-bind="{ ...item, ...$props, ...attrs }"
170
- :layoutType="layoutType"
171
- :coverImgStyle="{
172
- width: layoutType === 'vertical' ? '100%' : transformValueUnit(imageWidth),
173
- height: layoutType === 'vertical' ? transformValueUnit(imageHeight) : undefined,
174
- minHeight: layoutType !== 'vertical' ? transformValueUnit(imageHeight) : undefined,
175
- borderRadius: imageRadius ? transformValueUnit(imageRadius) : undefined,
176
- ...($props?.coverImgStyle ?? {}),
177
- }"
178
- ></lcb-product-item>
179
- </slot>
180
- </lcb-action-view>
153
+ <block v-for="(item, index) in renderList" :key="`${item?.productId}:${index}`">
154
+ <UnconditionedLayout
155
+ v-if="item.productType === 'noProductOption'"
156
+ v-bind="{ ...item, ...$props, ...attrs }"
157
+ />
158
+ <lcb-action-view v-bind="item.link" v-else>
159
+ <slot name="item" :item="item">
160
+ <lcb-absolute-config-layout
161
+ v-if="renderItemAbsoluteConfigLayout"
162
+ :blocks="renderItemAbsoluteConfigLayout?.blocks"
163
+ :canvas="renderItemAbsoluteConfigLayout?.canvas"
164
+ :dataset="{
165
+ ...(renderItemAbsoluteConfigLayout?.dataset ?? {}),
166
+ ...item,
167
+ }"
168
+ />
169
+ <lcb-product-item
170
+ v-else
171
+ v-bind="{ ...item, ...$props, ...attrs }"
172
+ :layoutType="layoutType"
173
+ :coverImgStyle="{
174
+ width: layoutType === 'vertical' ? '100%' : transformValueUnit(imageWidth),
175
+ height: layoutType === 'vertical' ? transformValueUnit(imageHeight) : undefined,
176
+ minHeight: layoutType !== 'vertical' ? transformValueUnit(imageHeight) : undefined,
177
+ borderRadius: imageRadius ? transformValueUnit(imageRadius) : undefined,
178
+ ...($props?.coverImgStyle ?? {}),
179
+ }"
180
+ ></lcb-product-item>
181
+ </slot>
182
+ </lcb-action-view>
183
+ </block>
181
184
  </view>
182
185
  <!-- 双列 -->
183
186
  <view
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.28",
3
+ "version": "0.4.29",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -0,0 +1,83 @@
1
+ interface UnconditionedLayoutConfig {
2
+ optionTitle: string
3
+ resultIcon: string
4
+ resultTitle: string
5
+ optionIcon: string
6
+ resultSubTitle: string
7
+ }
8
+ declare const _default: import('vue').DefineComponent<
9
+ __VLS_WithDefaults<
10
+ __VLS_TypePropsToOption<{
11
+ extendJson?: UnconditionedLayoutConfig
12
+ borderRadius?: number
13
+ shadowSize?: number
14
+ shadowColor?: string
15
+ blurSize?: number
16
+ }>,
17
+ {
18
+ borderRadius: number
19
+ shadowSize: number
20
+ shadowColor: string
21
+ blurSize: number
22
+ }
23
+ >,
24
+ {},
25
+ unknown,
26
+ {},
27
+ {},
28
+ import('vue').ComponentOptionsMixin,
29
+ import('vue').ComponentOptionsMixin,
30
+ {},
31
+ string,
32
+ import('vue').PublicProps,
33
+ Readonly<
34
+ import('vue').ExtractPropTypes<
35
+ __VLS_WithDefaults<
36
+ __VLS_TypePropsToOption<{
37
+ extendJson?: UnconditionedLayoutConfig
38
+ borderRadius?: number
39
+ shadowSize?: number
40
+ shadowColor?: string
41
+ blurSize?: number
42
+ }>,
43
+ {
44
+ borderRadius: number
45
+ shadowSize: number
46
+ shadowColor: string
47
+ blurSize: number
48
+ }
49
+ >
50
+ >
51
+ >,
52
+ {
53
+ shadowColor: string
54
+ shadowSize: number
55
+ blurSize: number
56
+ borderRadius: number
57
+ },
58
+ {}
59
+ >
60
+ export default _default
61
+ type __VLS_WithDefaults<P, D> = {
62
+ [K in keyof Pick<P, keyof P>]: K extends keyof D
63
+ ? __VLS_Prettify<
64
+ P[K] & {
65
+ default: D[K]
66
+ }
67
+ >
68
+ : P[K]
69
+ }
70
+ type __VLS_Prettify<T> = {
71
+ [K in keyof T]: T[K]
72
+ } & {}
73
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
74
+ type __VLS_TypePropsToOption<T> = {
75
+ [K in keyof T]-?: {} extends Pick<T, K>
76
+ ? {
77
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>
78
+ }
79
+ : {
80
+ type: import('vue').PropType<T[K]>
81
+ required: true
82
+ }
83
+ }
@@ -1,84 +0,0 @@
1
- <template>
2
- <view class="un-condi-layout p-3">
3
- <view class="un-condi-tags">
4
- <view v-for="(tag, index) in tags" :key="index" class="un-condi-tag radius-12rpx m-1">
5
- <text class="tag-text text-3">{{ tag.label }}</text>
6
- <text class="tag-close" @click="handleRemoveTag(tag, index)">×</text>
7
- </view>
8
- </view>
9
- <view class="un-condi-clear" @click="handleClearAll">
10
- <wd-img src="/static/icons/clear.png" width="40rpx" height="40rpx" />
11
- <text class="clear-text text-3 text-#969696 m-1">清空</text>
12
- </view>
13
- </view>
14
- </template>
15
-
16
- <script lang="ts" setup>
17
- import type { PropType } from 'vue'
18
-
19
- interface TagItem {
20
- label: string
21
- value: string | number
22
- type?: string
23
- }
24
-
25
- const props = defineProps({
26
- tags: {
27
- type: Array as PropType<TagItem[]>,
28
- default: () => [],
29
- },
30
- })
31
-
32
- /**
33
- * 移除单个标签
34
- */
35
- const handleRemoveTag = (tag: TagItem, index: number) => {}
36
-
37
- /**
38
- * 清空所有标签
39
- */
40
- const handleClearAll = () => {}
41
- </script>
42
-
43
- <style lang="scss" scoped>
44
- .un-condi-layout {
45
- display: flex;
46
- flex-direction: row;
47
- justify-content: space-between;
48
- align-items: center;
49
- width: 100%;
50
- background-color: #fff;
51
- }
52
-
53
- .un-condi-tags {
54
- display: flex;
55
- flex-direction: row;
56
- flex-wrap: wrap;
57
- flex: 1;
58
- }
59
-
60
- .un-condi-tag {
61
- display: flex;
62
- flex-direction: row;
63
- align-items: center;
64
- padding: 10rpx 20rpx;
65
- background-color: #f5f5f5;
66
-
67
- .tag-text {
68
- color: #333;
69
- }
70
-
71
- .tag-close {
72
- margin-left: 10rpx;
73
- font-size: 32rpx;
74
- color: #969696;
75
- }
76
- }
77
-
78
- .un-condi-clear {
79
- display: flex;
80
- flex-direction: row;
81
- align-items: center;
82
- padding-left: 20rpx;
83
- }
84
- </style>
@@ -1,36 +0,0 @@
1
- import type { PropType } from 'vue'
2
- interface TagItem {
3
- label: string
4
- value: string | number
5
- type?: string
6
- }
7
- declare const _default: import('vue').DefineComponent<
8
- {
9
- tags: {
10
- type: PropType<TagItem[]>
11
- default: () => never[]
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
- tags: {
26
- type: PropType<TagItem[]>
27
- default: () => never[]
28
- }
29
- }>
30
- >,
31
- {
32
- tags: TagItem[]
33
- },
34
- {}
35
- >
36
- export default _default