ct-component-plus 2.2.12 → 2.2.13

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,7 @@
1
+ # v2.2.13版本更新内容:
2
+
3
+ 1. 分页下拉组件添加补充项配置
4
+
1
5
  # v2.2.12版本更新内容:
2
6
 
3
7
  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.12",
4
+ "version": "2.2.13",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -7,6 +7,12 @@ export const selectProps = {
7
7
  ...searchComponentProps,
8
8
  modelValue: [String, Number, Array, Boolean],
9
9
  multiple: Boolean,
10
+ options: {
11
+ type: Array,
12
+ default() {
13
+ return [];
14
+ },
15
+ },
10
16
  filterable: Boolean,
11
17
  api: String,
12
18
  serviceMethod: String,
@@ -107,8 +107,23 @@ const attrs = useAttrs();
107
107
 
108
108
  const ns = useNamespace("paging-select");
109
109
  const optionsByApi = ref([]);
110
+ const extraOptions = computed(() => {
111
+ return props.options && Array.isArray(props.options) ? props.options : [];
112
+ });
113
+
110
114
  const showOptions = computed(() => {
111
- return optionsByApi.value;
115
+ const map = new Map();
116
+ (extraOptions.value || []).forEach((item) => {
117
+ if (!item || item.value === undefined || item.value === null) return;
118
+ map.set(item.value, item);
119
+ });
120
+ (optionsByApi.value || []).forEach((item) => {
121
+ if (!item || item.value === undefined || item.value === null) return;
122
+ if (!map.has(item.value)) {
123
+ map.set(item.value, item);
124
+ }
125
+ });
126
+ return Array.from(map.values());
112
127
  });
113
128
  const valueModel = computed({
114
129
  get() {
@@ -197,8 +212,8 @@ watch(
197
212
  selectRef.value.selectedLabel = newVal;
198
213
  },
199
214
  );
200
- watch(optionsByApi, () => {
201
- const arr = optionsByApi.value || [];
215
+ watch(showOptions, () => {
216
+ const arr = showOptions.value || [];
202
217
  if (arr.length) {
203
218
  filterOptions.value = arr;
204
219
  noFilterOptions.value = false;