ct-component-plus 2.2.6 → 2.2.7

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/README.md CHANGED
@@ -1,3 +1,16 @@
1
- # Vue 3 + Vite
1
+ # v2.2.7版本更新内容:
2
2
 
3
- 青塔组件库的 Vue 3 版本,使用 Vite 构建。
3
+ 1. 优化级联选择器没有默认值报错的情况
4
+
5
+ # v2.2.6版本更新内容:
6
+
7
+ 1. 新增数字区间组件
8
+ 2. 优化search-box中年份区间及数字区间的大小排序问题
9
+
10
+ # v2.2.3版本更新内容:
11
+
12
+ 1. 新增分页选择器组件
13
+
14
+ # v2.2.0版本更新内容:
15
+
16
+ 1. 新增单选框可以通过接口获取数据的功能
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ct-component-plus",
3
3
  "private": false,
4
- "version": "2.2.6",
4
+ "version": "2.2.7",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -33,4 +33,4 @@
33
33
  "vuepress": "^2.0.0-beta.63",
34
34
  "vuepress-plugin-demo-container": "^0.2.0"
35
35
  }
36
- }
36
+ }
@@ -1,22 +1,12 @@
1
1
  <template>
2
- <el-cascader
3
- ref="cascaderRef"
4
- :class="[
5
- ns.b(),
6
- ns.is('disabled', disabled),
7
- ns.is('filterable', filterable),
8
- componentId,
9
- ]"
10
- v-model="showValue"
11
- :props="propsShow"
12
- :options="optionsShow"
13
- :show-all-levels="showAllLevels"
14
- :filterable="filterable"
15
- :clearable="clearable"
16
- :disabled="disabled"
17
- :popper-class="popperClassShow"
18
- v-bind="{ ...$attrs, ...rawAttr }"
19
- />
2
+ <el-cascader ref="cascaderRef" :class="[
3
+ ns.b(),
4
+ ns.is('disabled', disabled),
5
+ ns.is('filterable', filterable),
6
+ componentId,
7
+ ]" v-model="showValue" :props="propsShow" :options="optionsShow" :show-all-levels="showAllLevels"
8
+ :filterable="filterable" :clearable="clearable" :disabled="disabled" :popper-class="popperClassShow"
9
+ v-bind="{ ...$attrs, ...rawAttr }" />
20
10
  <!-- <Teleport :to="appendPanelDom">
21
11
  <span>大写的六</span>
22
12
  </Teleport> -->
@@ -60,7 +50,7 @@ const optionsShow = computed(() => {
60
50
  });
61
51
  const showValue = computed({
62
52
  get() {
63
- return props.modelValue;
53
+ return props.modelValue || [];
64
54
  },
65
55
  set(newValue) {
66
56
  emit("update:modelValue", newValue);
@@ -163,7 +153,7 @@ watchEffect(async () => {
163
153
  cbs.afterSearch(res, optionsByApi, showValue);
164
154
  }
165
155
  });
166
- } catch (error) {}
156
+ } catch (error) { }
167
157
  }
168
158
  if (isFunction(cbs.defineSearch)) {
169
159
  try {
@@ -175,14 +165,14 @@ watchEffect(async () => {
175
165
  if (defineSearchHandle) {
176
166
  optionsByApi.value = defineSearchHandle;
177
167
  }
178
- } catch (error) {}
168
+ } catch (error) { }
179
169
  }
180
170
  });
181
171
  function findLabelsByValues(tree, values) {
182
172
  // 通过value值的数组获取label并返回一个包含label的数组
183
173
  const result = [];
184
174
  function traverse(node) {
185
- if (values.includes(node[props.mapObj?.value || "value"])) {
175
+ if (!values && values.includes(node[props.mapObj?.value || "value"])) {
186
176
  result.push(node[props.mapObj?.label || "label"]);
187
177
  }
188
178
 
@@ -218,6 +208,7 @@ onMounted(() => {
218
208
  .ct-cascader {
219
209
  width: var(--ct-component-width);
220
210
  --ct-cascader-inner-height: var(--ct-component-inner-height);
211
+
221
212
  &.is-filterable {
222
213
  .el-cascader__tags {
223
214
  &:focus-within {
@@ -227,6 +218,7 @@ onMounted(() => {
227
218
  }
228
219
  }
229
220
  }
221
+
230
222
  .el-cascader__tags {
231
223
  display: inline-flex;
232
224
  // display: inline-block;
@@ -237,6 +229,7 @@ onMounted(() => {
237
229
  text-overflow: ellipsis;
238
230
  overflow: hidden;
239
231
  white-space: nowrap;
232
+
240
233
  .el-tag {
241
234
  display: inline;
242
235
  height: auto;
@@ -245,14 +238,17 @@ onMounted(() => {
245
238
  background-color: inherit;
246
239
  font-size: var(--ct-font-size);
247
240
  color: var(--ct-color-black);
241
+
248
242
  &:not(:last-of-type)::after {
249
243
  content: "、";
250
244
  }
251
245
  }
246
+
252
247
  .el-tag__close {
253
248
  display: none;
254
249
  }
255
250
  }
251
+
256
252
  &__dropdown {
257
253
  &:not(.is-multiple) {
258
254
  .el-cascader__suggestion-item {
@@ -264,6 +260,7 @@ onMounted(() => {
264
260
  }
265
261
  }
266
262
  }
263
+
267
264
  .el-cascader__search-input {
268
265
  position: absolute;
269
266
  left: var(--ct-component-inner-padding);
@@ -274,11 +271,14 @@ onMounted(() => {
274
271
  font-size: var(--ct-font-size);
275
272
  margin: 0;
276
273
  }
274
+
277
275
  .el-input__wrapper {
278
276
  position: relative;
277
+
279
278
  .el-input__inner {
280
279
  height: var(--ct-cascader-inner-height) !important;
281
280
  }
281
+
282
282
  &::after {
283
283
  position: absolute;
284
284
  content: v-bind(checkedText);