@lx-frontend/wrap-element-ui 1.0.19-beta.6 → 1.0.19-beta.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/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 +8 -1
- package/src/components/EditableTable/types/index.ts +7 -1
- package/src/components/SearchForm/index.vue +1 -9
- package/src/components/SearchForm/helper.ts +0 -35
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
|
/** 日期范围 */
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
:temp-filtered-value="tempFilteredValue"
|
|
162
162
|
@update:tempSummaryList="val => { tempSummaryList = val }"
|
|
163
163
|
@update:tempFilteredValue="(key, value) => { $set(tempFilteredValue, key, value) }"
|
|
164
|
-
@popover-show="() =>
|
|
164
|
+
@popover-show="() => handleOpenFilter(column)"
|
|
165
165
|
@update:sort="handleSort"
|
|
166
166
|
@reset="() => handleHeaderOperationReset(column)"
|
|
167
167
|
@confirm="() => handleHeaderOperationConfirm(column)"
|
|
@@ -394,6 +394,8 @@ interface IEmits {
|
|
|
394
394
|
(e: 'search', param: Record<string, any>): void
|
|
395
395
|
/** 排序 */
|
|
396
396
|
(e: 'sort-change', param: { order: 'descending' | 'ascending' | null, prop: string }): void
|
|
397
|
+
/** 筛选条件打开 */
|
|
398
|
+
(e: 'open-filter'): void
|
|
397
399
|
}
|
|
398
400
|
|
|
399
401
|
const props = withDefaults(defineProps<IProps>(), {
|
|
@@ -601,6 +603,11 @@ const handleSelectionChange = (e) => {
|
|
|
601
603
|
emit('selection-change', e);
|
|
602
604
|
};
|
|
603
605
|
|
|
606
|
+
const handleOpenFilter = (column: any) => {
|
|
607
|
+
handleHeaderPopoverShow(column)
|
|
608
|
+
emit('open-filter');
|
|
609
|
+
}
|
|
610
|
+
|
|
604
611
|
const bizViewSettingDialogRef = ref(null as unknown as InstanceType<typeof BizViewSettingDialog>)
|
|
605
612
|
const handleViewSettingShow = () => bizViewSettingDialogRef.value.open()
|
|
606
613
|
|
|
@@ -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>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
v-for="({
|
|
9
9
|
isEmpty = true, key, type, prop, label, placeholder, candidate, filterable=false, withoutAll=false, collapseTags=false,
|
|
10
10
|
clearable=false, multiple=false, multipleLimit=0, changeCb, inputLimitCallback, slotName, dateType='date',
|
|
11
|
-
doubleIsInline = true, maxlength = 255,
|
|
11
|
+
doubleIsInline = true, maxlength = 255,
|
|
12
12
|
}) in config"
|
|
13
13
|
:key="label"
|
|
14
14
|
:label="showLabel ? label : ''"
|
|
@@ -84,9 +84,7 @@
|
|
|
84
84
|
value-format="yyyy-MM-dd"
|
|
85
85
|
format="yyyy-MM-dd"
|
|
86
86
|
type="date"
|
|
87
|
-
:editable="false"
|
|
88
87
|
:placeholder="(placeholder || [])[0] || '开始日期'"
|
|
89
|
-
:picker-options="genStartDateDisabledOptions(formData[prop[1]], doubleDatePickerLimit)"
|
|
90
88
|
/>
|
|
91
89
|
<el-date-picker
|
|
92
90
|
@input="val => handleInput(val, prop[1], '', key)"
|
|
@@ -95,9 +93,7 @@
|
|
|
95
93
|
value-format="yyyy-MM-dd"
|
|
96
94
|
format="yyyy-MM-dd"
|
|
97
95
|
type="date"
|
|
98
|
-
:editable="false"
|
|
99
96
|
:placeholder="(placeholder || [])[1] || '结束日期'"
|
|
100
|
-
:picker-options="genEndDateDisabledOptions(formData[prop[0]], doubleDatePickerLimit)"
|
|
101
97
|
/>
|
|
102
98
|
<el-checkbox
|
|
103
99
|
:value="checkedIds[key]"
|
|
@@ -128,8 +124,6 @@
|
|
|
128
124
|
</template>
|
|
129
125
|
|
|
130
126
|
<script>
|
|
131
|
-
import { genStartDateDisabledOptions, genEndDateDisabledOptions } from './helper';
|
|
132
|
-
|
|
133
127
|
export default {
|
|
134
128
|
name: 'SearchForm',
|
|
135
129
|
props: {
|
|
@@ -193,8 +187,6 @@ export default {
|
|
|
193
187
|
this.initialData = Object.freeze({ ...this.formData })
|
|
194
188
|
},
|
|
195
189
|
methods: {
|
|
196
|
-
genStartDateDisabledOptions,
|
|
197
|
-
genEndDateDisabledOptions,
|
|
198
190
|
handleInput (val, prop, inputLimitCallback, key) {
|
|
199
191
|
if (inputLimitCallback && !inputLimitCallback(val)) return false
|
|
200
192
|
if (val) {
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import dayjs from "dayjs";
|
|
2
|
-
|
|
3
|
-
/** 开始日期禁用配置 */
|
|
4
|
-
export function genStartDateDisabledOptions(endDate: string, limit: number = 0) {
|
|
5
|
-
return {
|
|
6
|
-
disabledDate: (time: Date) => {
|
|
7
|
-
if (!endDate) return false;
|
|
8
|
-
|
|
9
|
-
const currentDate = dayjs(time);
|
|
10
|
-
const baseOption = currentDate.isAfter(dayjs(endDate), 'day');
|
|
11
|
-
|
|
12
|
-
if (!limit) {
|
|
13
|
-
return baseOption
|
|
14
|
-
}
|
|
15
|
-
return baseOption || currentDate.isBefore(dayjs(endDate).subtract(limit - 1, 'day'), 'day');
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** 结束日期禁用配置 */
|
|
21
|
-
export function genEndDateDisabledOptions(startDate: string, limit: number = 0) {
|
|
22
|
-
return {
|
|
23
|
-
disabledDate: (time: Date) => {
|
|
24
|
-
if (!startDate) return false;
|
|
25
|
-
|
|
26
|
-
const currentDate = dayjs(time);
|
|
27
|
-
const baseOption = currentDate.isBefore(dayjs(startDate), 'day');
|
|
28
|
-
|
|
29
|
-
if (!limit) {
|
|
30
|
-
return baseOption
|
|
31
|
-
}
|
|
32
|
-
return baseOption || currentDate.isAfter(dayjs(startDate).add(limit - 1, 'day'), 'day');
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|