ct-component-plus 0.0.49 → 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ct-component-plus",
3
3
  "private": false,
4
- "version": "0.0.49",
4
+ "version": "0.0.50",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -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 { onMounted, computed, ref, watch, inject, watchEffect, nextTick } from "vue";
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
- if (!props.multiple) return "";
132
- if (
133
- showOptions.value.length &&
134
- showOptions.value.length === valueModel.value.length
135
- )
136
- return props.selectAllText;
137
- const cnt = props.connectors;
138
- return selectObj.value.map((item) => item.label).join(cnt);
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,11 +171,11 @@ watch(
150
171
  () => selectText.value,
151
172
  (newVal) => {
152
173
  selectRef.value.selectedLabel = newVal;
153
- if (props.multiple) {
154
- nextTick(() => {
155
- selectRef.value.$refs.reference.input.value = newVal;
156
- })
157
- }
174
+ // if (props.multiple) {
175
+ // nextTick(() => {
176
+ // selectRef.value.$refs.reference.input.value = newVal;
177
+ // })
178
+ // }
158
179
  }
159
180
  );
160
181
  watchEffect(async () => {