@tplc/business 0.4.14 → 0.4.15
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 +2 -0
- package/components/lcb-list/components/ComponentGroup/index.vue +2 -2
- package/components/lcb-list/components/FilterSlider/index.vue +3 -1
- package/components/lcb-list/components/FilterView/index.vue +36 -4
- package/components/lcb-list/components/TreeSelect/index.vue +5 -13
- package/package.json +1 -1
- package/types/components/lcb-list/components/TreeSelect/index.vue.d.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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.15](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.14...v0.4.15) (2025-03-25)
|
|
6
|
+
|
|
5
7
|
### [0.4.14](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.13...v0.4.14) (2025-03-25)
|
|
6
8
|
|
|
7
9
|
### [0.4.13](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.12...v0.4.13) (2025-03-25)
|
|
@@ -54,8 +54,8 @@ const disabled = computed(() => {
|
|
|
54
54
|
const list = (props.componentList || []).filter((item) => {
|
|
55
55
|
if (item.component === 'slider') {
|
|
56
56
|
return (
|
|
57
|
-
item.componentProps.min === innerFilter.value[item.valueName][0] &&
|
|
58
|
-
item.componentProps.max === innerFilter.value[item.valueName][1]
|
|
57
|
+
item.componentProps.min === innerFilter.value[item.valueName]?.[0] &&
|
|
58
|
+
item.componentProps.max === innerFilter.value[item.valueName]?.[1]
|
|
59
59
|
)
|
|
60
60
|
} else {
|
|
61
61
|
return !innerFilter.value[item.valueName]
|
|
@@ -79,7 +79,9 @@ watch(
|
|
|
79
79
|
if (val?.length === 1) {
|
|
80
80
|
innerValue.value = [val[0], val[0]]
|
|
81
81
|
} else {
|
|
82
|
-
innerValue.value = val
|
|
82
|
+
innerValue.value = val
|
|
83
|
+
? val.map((v) => (typeof v === 'string' ? parseInt(v) : v))
|
|
84
|
+
: [props.min, props.max]
|
|
83
85
|
}
|
|
84
86
|
},
|
|
85
87
|
{ immediate: true },
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
:title="titleObj[item.valueName] || item.filterName"
|
|
20
20
|
icon="caret-down-small"
|
|
21
21
|
icon-size="26rpx"
|
|
22
|
-
:selected="getSelect(item)"
|
|
22
|
+
:selected="getSelect(item, index)"
|
|
23
|
+
:dot="getCount(item, index)"
|
|
23
24
|
ref="dropMenu"
|
|
24
25
|
@opened="handleOpened"
|
|
25
26
|
@open="handleOpen"
|
|
@@ -37,8 +38,8 @@
|
|
|
37
38
|
v-bind="item.componentProps"
|
|
38
39
|
:value="filter[item.valueName]"
|
|
39
40
|
:value-name="item.valueName"
|
|
40
|
-
v-model:count="titleCount[item.valueName]"
|
|
41
41
|
:filter-value="filter"
|
|
42
|
+
v-model:keys="dynamicKeys[index]"
|
|
42
43
|
@submit="onSubmit(index, $event)"
|
|
43
44
|
/>
|
|
44
45
|
<ComponentGroup
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
|
|
75
76
|
<script setup lang="ts">
|
|
76
77
|
import { computed, ref } from 'vue'
|
|
77
|
-
import { FilterComponent } from '../../../lcb-list/api'
|
|
78
|
+
import { ComponentList, FilterComponent } from '../../../lcb-list/api'
|
|
78
79
|
import ComponentGroup from '../ComponentGroup/index.vue'
|
|
79
80
|
import FilterSelect from '../FilterSelect/index.vue'
|
|
80
81
|
import FilterTabs from '../FilterTabs/index.vue'
|
|
@@ -96,6 +97,8 @@ const props = defineProps<FilterViewProps>()
|
|
|
96
97
|
const filter = defineModel<Record<string, any>>({
|
|
97
98
|
default: {},
|
|
98
99
|
})
|
|
100
|
+
// 动态key集合
|
|
101
|
+
const dynamicKeys = ref<Record<string, string[]>>({})
|
|
99
102
|
const showPlain = computed(() => {
|
|
100
103
|
return props.styleMode === 'plain' && !props.sticky
|
|
101
104
|
})
|
|
@@ -109,14 +112,43 @@ const onSubmit = (index: number, filterObj?: Record<string, any>) => {
|
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
|
-
const getSelect = (item: FilterComponent) => {
|
|
115
|
+
const getSelect = (item: FilterComponent, index: number) => {
|
|
113
116
|
if (item.component === 'componentGroup') {
|
|
114
117
|
return item.componentProps.componentList?.some((v) => filter.value[v.valueName])
|
|
118
|
+
} else if (dynamicKeys.value[index]) {
|
|
119
|
+
return dynamicKeys.value[index].some((v) => filter.value[v])
|
|
115
120
|
} else {
|
|
116
121
|
return Boolean(filter.value[item.valueName])
|
|
117
122
|
}
|
|
118
123
|
}
|
|
119
124
|
|
|
125
|
+
const getCount = (item: FilterComponent, index: number) => {
|
|
126
|
+
const getValuesLength = (value: string[], components?: ComponentList[]) => {
|
|
127
|
+
let count = 0
|
|
128
|
+
value.forEach((v, i) => {
|
|
129
|
+
// 如果是slider组件只算一个
|
|
130
|
+
if (components && components[i].component === 'slider') {
|
|
131
|
+
if (filter.value[v]) count += 1
|
|
132
|
+
} else if (Array.isArray(filter.value[v])) {
|
|
133
|
+
count += filter.value[v].length
|
|
134
|
+
} else if (filter.value[v]) {
|
|
135
|
+
count += 1
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
return count
|
|
139
|
+
}
|
|
140
|
+
if (item.component === 'componentGroup') {
|
|
141
|
+
const componentList = item.componentProps.componentList || []
|
|
142
|
+
return getValuesLength(
|
|
143
|
+
componentList.map((v) => v.valueName),
|
|
144
|
+
componentList,
|
|
145
|
+
)
|
|
146
|
+
} else if (dynamicKeys.value[index]) {
|
|
147
|
+
return getValuesLength(dynamicKeys.value[index])
|
|
148
|
+
}
|
|
149
|
+
return 0
|
|
150
|
+
}
|
|
151
|
+
|
|
120
152
|
const handleOpened = () => {
|
|
121
153
|
uni.$emit('drop-opened')
|
|
122
154
|
}
|
|
@@ -74,7 +74,7 @@ defineOptions({
|
|
|
74
74
|
},
|
|
75
75
|
})
|
|
76
76
|
const props = defineProps<TreeSelectProps>()
|
|
77
|
-
const
|
|
77
|
+
const modelKeys = defineModel<string[]>('keys')
|
|
78
78
|
const innerValue = ref(props.value)
|
|
79
79
|
const toView = ref('')
|
|
80
80
|
const extraModel = ref({
|
|
@@ -95,18 +95,6 @@ const { onItemClick, options, getChecked } = useSelect(props, {
|
|
|
95
95
|
})
|
|
96
96
|
const currentCategory = ref(0)
|
|
97
97
|
const onSubmit = () => {
|
|
98
|
-
let count = 0
|
|
99
|
-
options.value.forEach((item) => {
|
|
100
|
-
if (item.valueName) {
|
|
101
|
-
count += extraModel.value[item.valueName]
|
|
102
|
-
? props.mode !== 'multiple'
|
|
103
|
-
? 1
|
|
104
|
-
: extraModel.value[item.valueName].length
|
|
105
|
-
: 0
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
count += innerValue.value ? (props.mode !== 'multiple' ? 1 : innerValue.value.length) : 0
|
|
109
|
-
modelCount.value = count
|
|
110
98
|
emits('submit', {
|
|
111
99
|
...extraModel.value,
|
|
112
100
|
[props.valueName]: innerValue.value,
|
|
@@ -130,6 +118,10 @@ watch(
|
|
|
130
118
|
.filter((v) => v)
|
|
131
119
|
.map((rect) => ({ top: rect.top, bottom: rect.bottom }))
|
|
132
120
|
})
|
|
121
|
+
modelKeys.value = [
|
|
122
|
+
props.valueName,
|
|
123
|
+
...((options.value.filter((v) => v.valueName).map((v) => v.valueName) as string[]) || []),
|
|
124
|
+
]
|
|
133
125
|
})
|
|
134
126
|
},
|
|
135
127
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TreeSelectProps } from './type'
|
|
2
2
|
declare let __VLS_typeProps: TreeSelectProps
|
|
3
3
|
type __VLS_PublicProps = {
|
|
4
|
-
|
|
4
|
+
keys?: string[]
|
|
5
5
|
} & typeof __VLS_typeProps
|
|
6
6
|
declare const _default: import('vue').DefineComponent<
|
|
7
7
|
__VLS_TypePropsToOption<__VLS_PublicProps>,
|
|
@@ -12,14 +12,14 @@ declare const _default: import('vue').DefineComponent<
|
|
|
12
12
|
import('vue').ComponentOptionsMixin,
|
|
13
13
|
import('vue').ComponentOptionsMixin,
|
|
14
14
|
{
|
|
15
|
-
'update:
|
|
15
|
+
'update:keys': (keys: string[]) => void
|
|
16
16
|
submit: (...args: any[]) => void
|
|
17
17
|
},
|
|
18
18
|
string,
|
|
19
19
|
import('vue').PublicProps,
|
|
20
20
|
Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
|
|
21
21
|
onSubmit?: ((...args: any[]) => any) | undefined
|
|
22
|
-
'onUpdate:
|
|
22
|
+
'onUpdate:keys'?: ((keys: string[]) => any) | undefined
|
|
23
23
|
},
|
|
24
24
|
{},
|
|
25
25
|
{}
|