ct-component-plus 0.0.48 → 0.0.50
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
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
:select-text="selectText"
|
|
15
15
|
:popper-class="ns.e('popper')"
|
|
16
16
|
@focus="showSearchPrefix"
|
|
17
|
-
@blur="hideSearchPrefix"
|
|
17
|
+
@blur="hideSearchPrefix"
|
|
18
|
+
>
|
|
18
19
|
<template #prefix>
|
|
19
20
|
<div
|
|
20
21
|
:class="[ns.e('filterable-icon')]"
|
|
21
|
-
v-if="filterable && !valueModel && showSearch"
|
|
22
|
+
v-if="filterable && !valueModel && showSearch"
|
|
23
|
+
>
|
|
22
24
|
<ct-icon name="search_line"></ct-icon>
|
|
23
25
|
</div>
|
|
24
26
|
<slot name="prefix"></slot>
|
|
@@ -51,7 +53,8 @@
|
|
|
51
53
|
:key="item.value"
|
|
52
54
|
:label="item.label"
|
|
53
55
|
:value="item.value"
|
|
54
|
-
:disabled="item.disabled"
|
|
56
|
+
:disabled="item.disabled"
|
|
57
|
+
>
|
|
55
58
|
<slot name="option" :item="item" :index="index">
|
|
56
59
|
<span :title="selectTooltip ? item.label : undefined">{{
|
|
57
60
|
item.label
|
|
@@ -70,7 +73,15 @@
|
|
|
70
73
|
</template>
|
|
71
74
|
|
|
72
75
|
<script setup>
|
|
73
|
-
import {
|
|
76
|
+
import {
|
|
77
|
+
onMounted,
|
|
78
|
+
computed,
|
|
79
|
+
ref,
|
|
80
|
+
watch,
|
|
81
|
+
inject,
|
|
82
|
+
watchEffect,
|
|
83
|
+
nextTick,
|
|
84
|
+
} from "vue";
|
|
74
85
|
import { selectEmits, selectProps } from "./index";
|
|
75
86
|
import { useNamespace, useBuriedParams, useCheckedAll } from "../../../hooks";
|
|
76
87
|
import { isFunction, isArray } from "../../../utils";
|
|
@@ -128,14 +139,24 @@ const selectObj = computed({
|
|
|
128
139
|
},
|
|
129
140
|
});
|
|
130
141
|
const selectText = computed(() => {
|
|
131
|
-
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
let result = "";
|
|
143
|
+
if (!props.multiple) {
|
|
144
|
+
return result;
|
|
145
|
+
} else {
|
|
146
|
+
if (
|
|
147
|
+
showOptions.value.length &&
|
|
148
|
+
showOptions.value.length === valueModel.value.length
|
|
149
|
+
) {
|
|
150
|
+
result = props.selectAllText;
|
|
151
|
+
} else {
|
|
152
|
+
const cnt = props.connectors;
|
|
153
|
+
result = selectObj.value.map((item) => item.label).join(cnt);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
nextTick(() => {
|
|
157
|
+
selectRef.value.$refs.reference.input.value = result;
|
|
158
|
+
});
|
|
159
|
+
return result;
|
|
139
160
|
});
|
|
140
161
|
const emptyText = computed(() => {
|
|
141
162
|
return showOptions.value.length
|
|
@@ -150,6 +171,11 @@ watch(
|
|
|
150
171
|
() => selectText.value,
|
|
151
172
|
(newVal) => {
|
|
152
173
|
selectRef.value.selectedLabel = newVal;
|
|
174
|
+
// if (props.multiple) {
|
|
175
|
+
// nextTick(() => {
|
|
176
|
+
// selectRef.value.$refs.reference.input.value = newVal;
|
|
177
|
+
// })
|
|
178
|
+
// }
|
|
153
179
|
}
|
|
154
180
|
);
|
|
155
181
|
watchEffect(async () => {
|
|
@@ -363,18 +389,18 @@ defineExpose({
|
|
|
363
389
|
color: var(--ct-color-grey-sub);
|
|
364
390
|
}
|
|
365
391
|
&.is-multiple {
|
|
366
|
-
&::after {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
392
|
+
// &::after {
|
|
393
|
+
// content: attr(select-text);
|
|
394
|
+
// position: absolute;
|
|
395
|
+
// left: var(--ct-component-inner-padding);
|
|
396
|
+
// right: calc(var(--ct-component-inner-padding) * 2);
|
|
397
|
+
// top: 50%;
|
|
398
|
+
// transform: translateY(-50%);
|
|
399
|
+
// text-overflow: ellipsis;
|
|
400
|
+
// overflow: hidden;
|
|
401
|
+
// white-space: nowrap;
|
|
402
|
+
// cursor: pointer;
|
|
403
|
+
// }
|
|
378
404
|
}
|
|
379
405
|
}
|
|
380
406
|
</style>
|