@lx-frontend/wrap-element-ui 1.0.13 → 1.0.14-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
CHANGED
|
@@ -80,13 +80,16 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
82
|
!!(column.filters && (Array.isArray(column.filters)
|
|
83
|
-
? (
|
|
83
|
+
? (filteredValue.value[column.prop] as any[]).length
|
|
84
84
|
: column.filters.type === 'radio'
|
|
85
85
|
? filteredValue.value[column.filters.prop || column.prop]
|
|
86
86
|
: (filteredValue.value[column.filters.prop || column.prop] as any[]).length))
|
|
87
87
|
) || (
|
|
88
88
|
!!(column.search
|
|
89
|
-
? Array.isArray(column.search) && column.search?.some(v =>
|
|
89
|
+
? Array.isArray(column.search) && column.search?.some(v => {
|
|
90
|
+
const props = typeof v.prop === 'string' ? [v.prop] : v.prop
|
|
91
|
+
return props.some(p => searchValue.value[p])
|
|
92
|
+
})
|
|
90
93
|
: searchValue.value[column.prop])
|
|
91
94
|
) || hasPickerParams || sortingColumn.value?.prop === column.prop || summaryList.value.includes(column.prop);
|
|
92
95
|
}
|
|
@@ -130,12 +133,16 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
130
133
|
showingColumns.value.forEach(prop => {
|
|
131
134
|
const column = columnMap.value[prop]
|
|
132
135
|
if (column.filters) {
|
|
133
|
-
|
|
136
|
+
const _prop = (Array.isArray(column.filters) ? prop : column.filters.prop) || prop
|
|
137
|
+
params[_prop] = filteredValue.value[_prop]
|
|
134
138
|
}
|
|
135
139
|
if (column.search) {
|
|
136
140
|
if (Array.isArray(column.search)) {
|
|
137
141
|
column.search.forEach(v => {
|
|
138
|
-
|
|
142
|
+
const props = typeof v.prop === 'string' ? [v.prop] : v.prop
|
|
143
|
+
props.forEach(p => {
|
|
144
|
+
params[p] = searchValue.value[p]
|
|
145
|
+
})
|
|
139
146
|
})
|
|
140
147
|
} else {
|
|
141
148
|
params[prop] = searchValue.value[prop]
|
|
@@ -168,11 +175,13 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
168
175
|
if (Array.isArray(column.search)) {
|
|
169
176
|
let validate = true;
|
|
170
177
|
column.search.forEach(v => {
|
|
171
|
-
if (!
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
if (!('type' in v) || v.type === 'input') {
|
|
179
|
+
if (!tempSearchValue.value[v.prop]) tempSearchValue.value[v.prop] = ''
|
|
180
|
+
if (!validate) return
|
|
181
|
+
if (v.validator) {
|
|
182
|
+
const result = v.validator(tempSearchValue.value[v.prop]?.trim());
|
|
183
|
+
if (validate && !result) validate = false;
|
|
184
|
+
}
|
|
176
185
|
}
|
|
177
186
|
})
|
|
178
187
|
// 校验未通过
|
|
@@ -237,7 +246,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
237
246
|
function handleResetFilterValue (column: IColumnConfig) {
|
|
238
247
|
if (column.filters) {
|
|
239
248
|
if (Array.isArray(column.filters)) {
|
|
240
|
-
filteredValue.value[column.
|
|
249
|
+
filteredValue.value[column.prop] = []
|
|
241
250
|
} else if (column.filters.default) {
|
|
242
251
|
filteredValue.value[column.filters.prop || column.prop] = column.filters.default
|
|
243
252
|
} else {
|
|
@@ -260,7 +269,10 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
260
269
|
searchValue.value[column.prop] = '';
|
|
261
270
|
} else {
|
|
262
271
|
column.search.forEach(v => {
|
|
263
|
-
|
|
272
|
+
const props = typeof v.prop === 'string' ? [v.prop] : v.prop
|
|
273
|
+
props.forEach(p => {
|
|
274
|
+
searchValue.value[p] = '';
|
|
275
|
+
})
|
|
264
276
|
})
|
|
265
277
|
}
|
|
266
278
|
}
|
|
@@ -314,15 +326,19 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
314
326
|
if (column.search) {
|
|
315
327
|
if (Array.isArray(column.search)) {
|
|
316
328
|
column.search.forEach(v => {
|
|
317
|
-
|
|
329
|
+
const props = typeof v.prop === 'string' ? [v.prop] : v.prop
|
|
330
|
+
props.forEach(p => {
|
|
331
|
+
_searchValue[p] = params[p];
|
|
332
|
+
})
|
|
318
333
|
});
|
|
319
334
|
} else {
|
|
320
335
|
_searchValue[column.prop] = params[column.prop] ?? '';
|
|
321
336
|
}
|
|
322
337
|
}
|
|
323
338
|
if (column.filters) {
|
|
324
|
-
const
|
|
325
|
-
|
|
339
|
+
const _prop = (Array.isArray(column.filters) ? column.prop : column.filters.prop) || column.prop
|
|
340
|
+
const value = params[_prop] ?? (Array.isArray(column.filters) ? [] : column.filters.default);
|
|
341
|
+
_filteredValue[_prop] = value;
|
|
326
342
|
}
|
|
327
343
|
if (column.doubleDatePicker) {
|
|
328
344
|
_searchValue[column.doubleDatePicker.props[0]] = params[column.doubleDatePicker.props[0]] ?? '';
|
|
@@ -332,7 +348,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
|
|
|
332
348
|
|
|
333
349
|
if (props.colorFilterConfig) {
|
|
334
350
|
const { prop, filters } = props.colorFilterConfig
|
|
335
|
-
_filteredValue[prop] = params[prop] ?? (Array.isArray(filters) ? [] : filters
|
|
351
|
+
_filteredValue[prop] = params[prop] ?? (Array.isArray(filters) ? [] : filters?.default);
|
|
336
352
|
}
|
|
337
353
|
|
|
338
354
|
searchValue.value = { ...searchValue.value, ..._searchValue }
|
|
@@ -70,17 +70,43 @@
|
|
|
70
70
|
>
|
|
71
71
|
<div
|
|
72
72
|
v-for="item in column.search"
|
|
73
|
-
:key="item.
|
|
73
|
+
:key="item.label"
|
|
74
74
|
>
|
|
75
75
|
<div class="editable-table-sort-filter__search-title">
|
|
76
76
|
{{ item.label }}
|
|
77
77
|
</div>
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
<template v-if="!('type' in item) || item.type === 'input'">
|
|
79
|
+
<el-input
|
|
80
|
+
class="editable-table-sort-filter__search-input"
|
|
81
|
+
placeholder="请输入内容"
|
|
82
|
+
:value="tempSearchValue[item.prop]"
|
|
83
|
+
@input="val => emit('update:tempSearchValue', item.prop, val)"
|
|
84
|
+
/>
|
|
85
|
+
</template>
|
|
86
|
+
<template v-if="item.type === 'dateRange'">
|
|
87
|
+
<div
|
|
88
|
+
style="display: flex;flex-direction: column;gap: 12px;"
|
|
89
|
+
>
|
|
90
|
+
<el-date-picker
|
|
91
|
+
@input="val => emit('update:tempSearchValue', item.prop[0], val || '')"
|
|
92
|
+
:value="tempSearchValue[item.prop[0]]"
|
|
93
|
+
value-format="yyyy-MM-dd"
|
|
94
|
+
format="yyyy-MM-dd"
|
|
95
|
+
type="date"
|
|
96
|
+
size="small"
|
|
97
|
+
placeholder="开始日期"
|
|
98
|
+
/>
|
|
99
|
+
<el-date-picker
|
|
100
|
+
@input="val => emit('update:tempSearchValue', item.prop[1], val || '')"
|
|
101
|
+
:value="tempSearchValue[item.prop[1]]"
|
|
102
|
+
value-format="yyyy-MM-dd"
|
|
103
|
+
format="yyyy-MM-dd"
|
|
104
|
+
size="small"
|
|
105
|
+
type="date"
|
|
106
|
+
placeholder="结束日期"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
84
110
|
</div>
|
|
85
111
|
</div>
|
|
86
112
|
|
|
@@ -48,11 +48,22 @@ export type IColumnConfigRequired = _IColumnConfigRequired & Partial<Omit<TableC
|
|
|
48
48
|
|
|
49
49
|
type FiltersOption = { value: string | number; text: string; [key: string]: any }
|
|
50
50
|
|
|
51
|
-
type
|
|
51
|
+
type InputSearchOption = {
|
|
52
52
|
prop: string,
|
|
53
53
|
label: string,
|
|
54
54
|
validator?: (value: string) => boolean
|
|
55
|
-
|
|
55
|
+
type?: 'input',
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type DateRangeSearchOption = {
|
|
59
|
+
prop: [string, string],
|
|
60
|
+
label: string,
|
|
61
|
+
type: 'dateRange',
|
|
62
|
+
// max?: string,
|
|
63
|
+
// min?: string,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type ISearchOptions = (InputSearchOption | DateRangeSearchOption)[]
|
|
56
67
|
|
|
57
68
|
type IInputColumn = IColumnConfigRequired & {
|
|
58
69
|
inputType: string | number;
|