ct-component-plus 2.2.13 → 2.2.15

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,11 @@
1
+ # v2.2.15版本更新内容:
2
+
3
+ 1. 年份区间组件增加下拉透传rawAttr
4
+
5
+ # v2.2.14版本更新内容:
6
+
7
+ 1. 修改cascader组件的埋点默认值处理逻辑
8
+
1
9
  # v2.2.13版本更新内容:
2
10
 
3
11
  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.13",
4
+ "version": "2.2.15",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -1,12 +1,22 @@
1
1
  <template>
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 }" />
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
+ />
10
20
  <!-- <Teleport :to="appendPanelDom">
11
21
  <span>大写的六</span>
12
22
  </Teleport> -->
@@ -91,7 +101,7 @@ watch(
91
101
  () => props.modelValue,
92
102
  (newValue) => {
93
103
  getCheckedText();
94
- }
104
+ },
95
105
  );
96
106
  const appendPanelDom = document.createElement("div");
97
107
 
@@ -153,34 +163,38 @@ watchEffect(async () => {
153
163
  cbs.afterSearch(res, optionsByApi, showValue);
154
164
  }
155
165
  });
156
- } catch (error) { }
166
+ } catch (error) {}
157
167
  }
158
168
  if (isFunction(cbs.defineSearch)) {
159
169
  try {
160
170
  const defineSearchHandle = await cbs.defineSearch(
161
171
  optionsByApi,
162
- showValue
172
+ showValue,
163
173
  );
164
174
  if (defineSearchHandle === false) return;
165
175
  if (defineSearchHandle) {
166
176
  optionsByApi.value = defineSearchHandle;
167
177
  }
168
- } catch (error) { }
178
+ } catch (error) {}
169
179
  }
170
180
  });
171
181
  function findLabelsByValues(tree, values) {
172
- // 通过value值的数组获取label并返回一个包含label的数组
173
182
  const result = [];
183
+ const valueKey = props.mapObj?.value || "value";
184
+ const labelKey = props.mapObj?.label || "label";
185
+ const childrenKey = props.mapObj?.children || "children";
174
186
  function traverse(node) {
175
- if (!values && values.includes(node[props.mapObj?.value || "value"])) {
176
- result.push(node[props.mapObj?.label || "label"]);
187
+ if (isArray(values) && values.includes(node?.[valueKey])) {
188
+ result.push(node?.[labelKey]);
177
189
  }
178
190
 
179
- if (node.children && node.children.length > 0) {
180
- node.children.forEach(traverse);
191
+ const children = node?.[childrenKey];
192
+ if (isArray(children) && children.length > 0) {
193
+ children.forEach(traverse);
181
194
  }
182
195
  }
183
196
 
197
+ if (!isArray(tree)) return result;
184
198
  tree.forEach(traverse);
185
199
  return result;
186
200
  }
@@ -188,7 +202,7 @@ useBuriedParams(props, emit, {
188
202
  getContent: () => {
189
203
  let data = findLabelsByValues(
190
204
  optionsShow.value,
191
- props.multiple ? showValue.value : [showValue.value]
205
+ props.multiple ? showValue.value : [showValue.value],
192
206
  );
193
207
  if (props.multiple) {
194
208
  return data;
@@ -13,7 +13,7 @@
13
13
  :placeholder="startPlaceholder"
14
14
  :disabled="disabled"
15
15
  filterable
16
- v-bind="eventList0"
16
+ v-bind="selectEventList0"
17
17
  >
18
18
  <el-option
19
19
  v-for="item in yearList"
@@ -38,7 +38,7 @@
38
38
  filterable
39
39
  :disabled="disabled"
40
40
  :filter-method="filterHandleE"
41
- v-bind="eventList1"
41
+ v-bind="selectEventList1"
42
42
  >
43
43
  <el-option
44
44
  v-for="item in yearList"
@@ -187,6 +187,18 @@ const eventList1 = {
187
187
  onFocus(value, 1);
188
188
  },
189
189
  };
190
+ const selectEventList0 = computed(() => {
191
+ return {
192
+ ...(props.rawAttr || {}),
193
+ ...eventList0,
194
+ };
195
+ });
196
+ const selectEventList1 = computed(() => {
197
+ return {
198
+ ...(props.rawAttr || {}),
199
+ ...eventList1,
200
+ };
201
+ });
190
202
  const onChange = (value, index) => {
191
203
  emit("changeSelect", value, index);
192
204
  };