@lx-frontend/wrap-element-ui 1.0.7-beta.1 → 1.0.7-beta.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@lx-frontend/wrap-element-ui",
3
- "version": "1.0.7-beta.1",
3
+ "version": "1.0.7-beta.3",
4
4
  "description": "wrap-element-ui",
5
5
  "author": "",
6
6
  "main": "src/components/index.ts",
@@ -46,7 +46,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, sortFilterPopover
46
46
  watch(
47
47
  () => props.columnConfig,
48
48
  (val) => {
49
- filteredValue.value = val.reduce((prev, curr) => ({ ...prev, [curr.prop]: [] }), {});
49
+ val?.forEach(v => handleResetFilterValue(v));
50
50
  tempFilteredValue.value = { ...filteredValue.value };
51
51
  },
52
52
  { immediate: true }
@@ -166,7 +166,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, sortFilterPopover
166
166
  if (!tempSearchValue.value[v.prop]) tempSearchValue.value[v.prop] = ''
167
167
  if (!validate) return
168
168
  if (v.validator) {
169
- const result = v.validator(tempSearchValue.value[v.prop]);
169
+ const result = v.validator(tempSearchValue.value[v.prop]?.trim());
170
170
  if (validate && !result) validate = false;
171
171
  }
172
172
  })
@@ -194,7 +194,10 @@ export function useColumnHeaderOperation({ props, tableDomRef, sortFilterPopover
194
194
  }
195
195
 
196
196
  filteredValue.value = { ...tempFilteredValue.value };
197
- searchValue.value = { ...tempSearchValue.value };
197
+ searchValue.value = Object.keys(tempSearchValue.value).reduce((pre, key) => {
198
+ pre[key] = tempSearchValue.value[key]?.trim() ?? '';
199
+ return pre;
200
+ }, {});
198
201
 
199
202
  emitSearch();
200
203
 
@@ -226,6 +229,18 @@ export function useColumnHeaderOperation({ props, tableDomRef, sortFilterPopover
226
229
  }
227
230
  }
228
231
 
232
+ function handleResetFilterValue (column: IColumnConfig) {
233
+ if (column.filters) {
234
+ if (Array.isArray(column.filters)) {
235
+ filteredValue.value[column.prop] = []
236
+ } else if (column.filters.default) {
237
+ filteredValue.value[column.prop] = column.filters.default
238
+ } else {
239
+ filteredValue.value[column.prop] = column.filters.type === 'radio' ? '' : []
240
+ }
241
+ }
242
+ }
243
+
229
244
  const handleHeaderOperationReset = async (column: IColumnConfig, scope) => {
230
245
  if (sortingColumn.value && sortingColumn.value.prop === column.prop) {
231
246
  clearSort();
@@ -234,11 +249,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, sortFilterPopover
234
249
  // 合计
235
250
  summaryList.value = summaryList.value.filter(item => item !== column.prop);
236
251
 
237
- if (column.filters) {
238
- filteredValue.value[column.prop] = Array.isArray(column.filters)
239
- ? []
240
- : column.filters.default ?? []
241
- }
252
+ handleResetFilterValue(column)
242
253
  if (column.search) {
243
254
  if (!Array.isArray(column.search)) {
244
255
  searchValue.value[column.prop] = '';
@@ -88,7 +88,7 @@
88
88
  style="display: flex;flex-direction: column;gap: 12px;"
89
89
  >
90
90
  <el-date-picker
91
- @input="val => emit('update:tempSearchValue', column.doubleDatePicker.props[0], val)"
91
+ @input="val => emit('update:tempSearchValue', column.doubleDatePicker.props[0], val || '')"
92
92
  :value="tempSearchValue[column.doubleDatePicker.props[0]]"
93
93
  value-format="yyyy-MM-dd"
94
94
  format="yyyy-MM-dd"
@@ -97,7 +97,7 @@
97
97
  placeholder="开始日期"
98
98
  />
99
99
  <el-date-picker
100
- @input="val => emit('update:tempSearchValue', column.doubleDatePicker.props[1], val)"
100
+ @input="val => emit('update:tempSearchValue', column.doubleDatePicker.props[1], val || '')"
101
101
  :value="tempSearchValue[column.doubleDatePicker.props[1]]"
102
102
  value-format="yyyy-MM-dd"
103
103
  format="yyyy-MM-dd"
@@ -125,6 +125,7 @@
125
125
  v-for="item in (Array.isArray(column.filters) ? column.filters : column.filters.options)"
126
126
  :key="item.value"
127
127
  :label="item.value"
128
+ :title="item.text"
128
129
  class="editable-table-sort-filter__filter-checkbox"
129
130
  >
130
131
  <slot
@@ -146,6 +147,7 @@
146
147
  v-for="item in column.filters.options"
147
148
  :key="item.value"
148
149
  :label="item.value"
150
+ :title="item.text"
149
151
  >
150
152
  <slot
151
153
  name="filter-item"
@@ -387,10 +387,26 @@
387
387
  &__sort,
388
388
  &__search {
389
389
  padding: 14px;
390
+
391
+ .el-radio__label {
392
+ white-space: nowrap;
393
+ overflow: hidden;
394
+ text-overflow: ellipsis;
395
+ width: calc(100% + 10px);
396
+ display: inline-block;
397
+ vertical-align: middle;
398
+ }
390
399
  }
391
400
 
392
401
  &__filter {
393
402
  padding-top: 0;
403
+
404
+ .el-radio-group,
405
+ .el-checkbox-group {
406
+ max-height: 166px;
407
+ overflow-y: auto;
408
+ overflow-x: hidden;
409
+ }
394
410
  }
395
411
 
396
412
  &__filter-title,
@@ -447,6 +463,7 @@
447
463
  }
448
464
 
449
465
  &__filter-checkbox-group {
466
+ width: 100%;
450
467
  display: flex;
451
468
  flex-direction: column;
452
469
  justify-content: flex-start;
@@ -456,10 +473,20 @@
456
473
  &__filter-checkbox {
457
474
  margin-top: 10px;
458
475
  font-size: 14px;
476
+ width: 100%;
459
477
 
460
478
  &:first-child {
461
479
  margin-top: 0;
462
480
  }
481
+
482
+ .el-checkbox__label {
483
+ white-space: nowrap;
484
+ overflow: hidden;
485
+ text-overflow: ellipsis;
486
+ width: calc(100% - 20px);
487
+ display: inline-block;
488
+ vertical-align: middle;
489
+ }
463
490
  }
464
491
 
465
492
  &__footer {
@@ -496,6 +523,11 @@
496
523
  background: @--theme-blue--;
497
524
  border-color: @--theme-blue--;
498
525
  }
526
+
527
+ .el-checkbox__input.is-checked+.el-checkbox__label,
528
+ .el-radio__input.is-checked+.el-radio__label {
529
+ color: @--theme-blue--;
530
+ }
499
531
  }
500
532
 
501
533
  &__pin-top {
@@ -725,4 +757,4 @@
725
757
  &::before {
726
758
  bottom: -4px;
727
759
  }
728
- }
760
+ }
@@ -561,7 +561,7 @@ const doTableLayout = async () => {
561
561
  // 过滤出自定义属性,将其它属性全部透传给 el-table-column
562
562
  const getColumnBindProps = (column: IColumnConfig) => {
563
563
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
564
- const { editAble, editType, slotName, inputType, options, filters, ...rest } = column;
564
+ const { editType, slotName, inputType, options, filters, ...rest } = column;
565
565
  return rest;
566
566
  };
567
567
 
@@ -12,6 +12,8 @@ type _IColumnConfigRequired = {
12
12
  editType?: IEditType; // 编辑格式
13
13
  editSlotName?: string; // 编辑时,自定义编辑组件的slotName
14
14
  sortable?: boolean; // 该列是否允许排序,ture则表头弹窗会显示升降序按钮
15
+ /** 内部使用, */
16
+ isColumnSortable?: boolean;
15
17
  slotName?: string; // 如果要自定义,传入 slotName
16
18
  hoverSlotName?: string; // 悬浮时,自定义悬浮组件的slotName
17
19
  isAlwaysShow?: boolean; // 不可隐藏,显示设置中,该列不允许隐藏
@@ -54,7 +54,7 @@
54
54
  />
55
55
  <el-option
56
56
  v-for="({name, value, code, id}) in candidate"
57
- :key="id || name"
57
+ :key="value || code || id"
58
58
  :value="value || code || id"
59
59
  :label="name"
60
60
  />