@lx-frontend/wrap-element-ui 1.0.19 → 1.0.20-beta.1
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 +1 -1
- package/src/components/EditableTable/bizHooks/useColumnHeaderOperation.ts +17 -9
- package/src/components/EditableTable/features/bizTableHeaderPopover/index.vue +6 -1
- package/src/components/EditableTable/index.vue +39 -9
- package/src/components/EditableTable/types/index.ts +7 -1
package/package.json
CHANGED
|
@@ -92,6 +92,10 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
92
92
|
return !!(filteredValue.value[item.prop] as any[]).length
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
if (item.type === 'slot') {
|
|
96
|
+
return item.active()
|
|
97
|
+
}
|
|
98
|
+
|
|
95
99
|
return !!filteredValue.value[item.prop]
|
|
96
100
|
}
|
|
97
101
|
)
|
|
@@ -139,15 +143,17 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
139
143
|
const params: Record<string, any> = {};
|
|
140
144
|
|
|
141
145
|
const processFilter = (filters: FilterListType) => {
|
|
142
|
-
filters
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
filters
|
|
147
|
+
.filter(item => item.type !== 'slot')
|
|
148
|
+
.forEach((item) => {
|
|
149
|
+
if (item.type === 'doubleDatePicker' || item.type === 'monthDayPicker') {
|
|
150
|
+
const [start, end] = item.prop
|
|
151
|
+
params[start] = filteredValue.value[start];
|
|
152
|
+
params[end] = filteredValue.value[end];
|
|
153
|
+
} else {
|
|
154
|
+
params[item.prop] = filteredValue.value[item.prop];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
// 仅提交显示的列的相关数据
|
|
@@ -242,6 +248,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
242
248
|
|
|
243
249
|
function handleResetFilterValue (column: IColumnConfig) {
|
|
244
250
|
(column.filters || [])
|
|
251
|
+
.filter(item => item.type !== 'slot')
|
|
245
252
|
.forEach(
|
|
246
253
|
(item) => {
|
|
247
254
|
if (item.type === 'radio' || item.type === 'checkbox') {
|
|
@@ -287,6 +294,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
287
294
|
// 设置搜索和过滤参数时,如果使用 showingColumns 遍历,会导致通过外部设置未显示的列的搜索和过滤参数丢失
|
|
288
295
|
[props.colorFilterConfig, ...props.columnConfig].forEach(column => {
|
|
289
296
|
(column?.filters ?? [])
|
|
297
|
+
.filter(item => item.type !== 'slot')
|
|
290
298
|
.forEach(
|
|
291
299
|
(item) => {
|
|
292
300
|
if (item.type === 'doubleDatePicker' || item.type === 'monthDayPicker') {
|
|
@@ -40,7 +40,12 @@
|
|
|
40
40
|
:key="index"
|
|
41
41
|
class="editable-table-sort-filter__item editable-table__filter-group__filter"
|
|
42
42
|
>
|
|
43
|
+
<slot
|
|
44
|
+
v-if="filterItem.type === 'slot'"
|
|
45
|
+
:name="filterItem.slotName"
|
|
46
|
+
/>
|
|
43
47
|
<component
|
|
48
|
+
v-else
|
|
44
49
|
:is="componentMap[filterItem.type]"
|
|
45
50
|
:config="filterItem"
|
|
46
51
|
:temp-filtered-value="tempFilteredValue"
|
|
@@ -125,7 +130,7 @@ const emit = defineEmits<{
|
|
|
125
130
|
}>()
|
|
126
131
|
|
|
127
132
|
// 把 filterItem.type 映射到组件
|
|
128
|
-
const componentMap: Record<FilterItem['type'], any> = {
|
|
133
|
+
const componentMap: Record<Exclude<FilterItem['type'], 'slot'>, any> = {
|
|
129
134
|
/** 输入框 */
|
|
130
135
|
input: BizInputFilter,
|
|
131
136
|
/** 日期范围 */
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
@selection-change="handleSelectionChange"
|
|
45
45
|
@cell-mouse-enter="debouncedHoverHandler"
|
|
46
46
|
@header-dragend="doTableLayout"
|
|
47
|
-
@row-dblclick="handleRowDblClick"
|
|
48
47
|
>
|
|
49
48
|
<el-table-column
|
|
50
49
|
v-if="rowDragAble"
|
|
@@ -162,10 +161,10 @@
|
|
|
162
161
|
:temp-filtered-value="tempFilteredValue"
|
|
163
162
|
@update:tempSummaryList="val => { tempSummaryList = val }"
|
|
164
163
|
@update:tempFilteredValue="(key, value) => { $set(tempFilteredValue, key, value) }"
|
|
165
|
-
@popover-show="() =>
|
|
164
|
+
@popover-show="() => handleOpenFilter(column)"
|
|
166
165
|
@update:sort="handleSort"
|
|
167
|
-
@reset="() =>
|
|
168
|
-
@confirm="() =>
|
|
166
|
+
@reset="() => handleResetFilter(column)"
|
|
167
|
+
@confirm="() => handleConfirmFilter(column)"
|
|
169
168
|
>
|
|
170
169
|
<template #summay-item>
|
|
171
170
|
<slot
|
|
@@ -175,6 +174,16 @@
|
|
|
175
174
|
{{ column.label }}
|
|
176
175
|
</slot>
|
|
177
176
|
</template>
|
|
177
|
+
<!-- 动态地将父组件传递的所有slot下发给孙子组件(biz-table-header-popover),以实现slot的透传 -->
|
|
178
|
+
<template
|
|
179
|
+
v-for="(_, name) in $slots"
|
|
180
|
+
#[name]="slotProps"
|
|
181
|
+
>
|
|
182
|
+
<slot
|
|
183
|
+
:name="name"
|
|
184
|
+
v-bind="slotProps || column"
|
|
185
|
+
/>
|
|
186
|
+
</template>
|
|
178
187
|
</biz-table-header-popover>
|
|
179
188
|
</template>
|
|
180
189
|
<!-- 默认操作按钮,defaultOperations属性不为空数组时展示。编辑状态下隐藏 -->
|
|
@@ -395,8 +404,12 @@ interface IEmits {
|
|
|
395
404
|
(e: 'search', param: Record<string, any>): void
|
|
396
405
|
/** 排序 */
|
|
397
406
|
(e: 'sort-change', param: { order: 'descending' | 'ascending' | null, prop: string }): void
|
|
398
|
-
/**
|
|
399
|
-
(e: '
|
|
407
|
+
/** 筛选条件打开 */
|
|
408
|
+
(e: 'open-filter', prop: string): void
|
|
409
|
+
/** 重置筛选 */
|
|
410
|
+
(e: 'reset-filter', prop: string): void
|
|
411
|
+
/** 筛选条件确认 */
|
|
412
|
+
(e: 'confirm-filter', prop: string): void
|
|
400
413
|
}
|
|
401
414
|
|
|
402
415
|
const props = withDefaults(defineProps<IProps>(), {
|
|
@@ -604,9 +617,26 @@ const handleSelectionChange = (e) => {
|
|
|
604
617
|
emit('selection-change', e);
|
|
605
618
|
};
|
|
606
619
|
|
|
607
|
-
const
|
|
608
|
-
emit('
|
|
609
|
-
|
|
620
|
+
const handleOpenFilter = (column: IColumnConfig) => {
|
|
621
|
+
emit('open-filter', column.prop);
|
|
622
|
+
nextTick(() => {
|
|
623
|
+
handleHeaderPopoverShow(column)
|
|
624
|
+
})
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
const handleResetFilter = (column: IColumnConfig) => {
|
|
628
|
+
emit('reset-filter', column.prop);
|
|
629
|
+
nextTick(() => {
|
|
630
|
+
handleHeaderOperationReset(column)
|
|
631
|
+
})
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
const handleConfirmFilter = (column: IColumnConfig) => {
|
|
635
|
+
emit('confirm-filter', column.prop);
|
|
636
|
+
nextTick(() => {
|
|
637
|
+
handleHeaderOperationConfirm(column)
|
|
638
|
+
})
|
|
639
|
+
}
|
|
610
640
|
|
|
611
641
|
const bizViewSettingDialogRef = ref(null as unknown as InstanceType<typeof BizViewSettingDialog>)
|
|
612
642
|
const handleViewSettingShow = () => bizViewSettingDialogRef.value.open()
|
|
@@ -60,7 +60,13 @@ export interface IFilterColorRadio {
|
|
|
60
60
|
options: Array<IFilterSelectOptions & { color: string }>
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export
|
|
63
|
+
export interface IFilterSolt {
|
|
64
|
+
type: 'slot',
|
|
65
|
+
slotName: string,
|
|
66
|
+
active: () => boolean
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type FilterItem = IFilterInput | IFilterSelect | IFilterDoubleDatePicker | IFilterMonthDayPicker | IFilterColorRadio | IFilterSolt
|
|
64
70
|
|
|
65
71
|
/** 筛选组件类型 */
|
|
66
72
|
export type FilterListType = Array<FilterItem>
|