ct-component-plus 2.0.1 → 2.0.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { buriedParamsKey, searchComponentProps } from
|
|
2
|
-
import arrowDown from
|
|
3
|
-
import clearIcon from
|
|
1
|
+
import { buriedParamsKey, searchComponentProps } from "../../../hooks";
|
|
2
|
+
import arrowDown from "./arrow-down.vue";
|
|
3
|
+
import clearIcon from "./clear-icon.vue";
|
|
4
4
|
|
|
5
5
|
export const selectEmits = ["update:modelValue", buriedParamsKey];
|
|
6
6
|
export const selectProps = {
|
|
@@ -10,8 +10,8 @@ export const selectProps = {
|
|
|
10
10
|
options: {
|
|
11
11
|
type: Array,
|
|
12
12
|
default() {
|
|
13
|
-
return []
|
|
14
|
-
}
|
|
13
|
+
return [];
|
|
14
|
+
},
|
|
15
15
|
},
|
|
16
16
|
filterable: Boolean,
|
|
17
17
|
api: String,
|
|
@@ -20,16 +20,16 @@ export const selectProps = {
|
|
|
20
20
|
mapObj: {
|
|
21
21
|
type: Object,
|
|
22
22
|
default() {
|
|
23
|
-
return {}
|
|
24
|
-
}
|
|
23
|
+
return {};
|
|
24
|
+
},
|
|
25
25
|
},
|
|
26
26
|
selectAllText: {
|
|
27
27
|
type: String,
|
|
28
|
-
default:
|
|
28
|
+
default: "全部",
|
|
29
29
|
},
|
|
30
30
|
connectors: {
|
|
31
31
|
type: String,
|
|
32
|
-
default:
|
|
32
|
+
default: "、",
|
|
33
33
|
},
|
|
34
34
|
fitInputWidth: {
|
|
35
35
|
type: Boolean,
|
|
@@ -38,15 +38,20 @@ export const selectProps = {
|
|
|
38
38
|
clearIcon: {
|
|
39
39
|
type: [String, Object],
|
|
40
40
|
default() {
|
|
41
|
-
return clearIcon
|
|
42
|
-
}
|
|
41
|
+
return clearIcon;
|
|
42
|
+
},
|
|
43
43
|
},
|
|
44
44
|
suffixIcon: {
|
|
45
45
|
type: [String, Object],
|
|
46
46
|
default() {
|
|
47
|
-
return arrowDown
|
|
48
|
-
}
|
|
47
|
+
return arrowDown;
|
|
48
|
+
},
|
|
49
49
|
},
|
|
50
50
|
noMatchText: String,
|
|
51
51
|
noDataText: String,
|
|
52
|
-
|
|
52
|
+
// 是否保持原始 options 顺序(用于一些情况下不想让多选时“已选项置顶”逻辑)
|
|
53
|
+
keepOrder: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -178,7 +178,7 @@ watch(
|
|
|
178
178
|
// selectRef.value.$refs.reference.input.value = newVal;
|
|
179
179
|
// })
|
|
180
180
|
// }
|
|
181
|
-
}
|
|
181
|
+
},
|
|
182
182
|
);
|
|
183
183
|
watchEffect(async () => {
|
|
184
184
|
// 输入框过滤,触发的事件
|
|
@@ -191,7 +191,7 @@ watchEffect(async () => {
|
|
|
191
191
|
const filterCallbackHandle = await cbs.filterCallback(
|
|
192
192
|
keyword.value,
|
|
193
193
|
showOptions.value,
|
|
194
|
-
valueModel
|
|
194
|
+
valueModel,
|
|
195
195
|
);
|
|
196
196
|
if (filterCallbackHandle === false) return;
|
|
197
197
|
arr = filterCallbackHandle || arr;
|
|
@@ -208,8 +208,9 @@ watchEffect(async () => {
|
|
|
208
208
|
|
|
209
209
|
const optionsRef = ref(null);
|
|
210
210
|
//针对多选时,已选的项要排在整个列表的最前面
|
|
211
|
+
// 当 keepOrder 为 true 时,不做置顶,保持原有顺序(用于层级选择等场景)
|
|
211
212
|
const handleListSort = (val) => {
|
|
212
|
-
if (props.multiple) {
|
|
213
|
+
if (props.multiple && !props.keepOrder) {
|
|
213
214
|
if (val) {
|
|
214
215
|
const selectedSet = new Set(valueModel.value);
|
|
215
216
|
filterOptions.value = [
|
|
@@ -271,7 +272,7 @@ const watchServiceHandle = async () => {
|
|
|
271
272
|
try {
|
|
272
273
|
const defineSearchHandle = await cbs.defineSearch(
|
|
273
274
|
optionsByApi,
|
|
274
|
-
valueModel
|
|
275
|
+
valueModel,
|
|
275
276
|
);
|
|
276
277
|
if (defineSearchHandle === false) return;
|
|
277
278
|
if (defineSearchHandle) {
|
|
@@ -292,7 +293,7 @@ watch(
|
|
|
292
293
|
},
|
|
293
294
|
{
|
|
294
295
|
immediate: true,
|
|
295
|
-
}
|
|
296
|
+
},
|
|
296
297
|
);
|
|
297
298
|
const checkedAll = useCheckedAll(filterOptions, valueModel, {
|
|
298
299
|
onCheckedAll: (falg) => {
|