Add inline functionality to apply value filters in record lists
This commit is contained in:
parent
c0b3d9d5ac
commit
8cb5bd8d5d
@ -474,11 +474,11 @@
|
|||||||
:extra-options="options"
|
:extra-options="options"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="options.inlineRecordEditEnabled && field.canEdit && !showingDeletedRecords"
|
|
||||||
class="inline-actions"
|
class="inline-actions"
|
||||||
>
|
>
|
||||||
<b-button
|
<b-button
|
||||||
v-b-tooltip.noninteractive.hover="{ title: $t('recordList.inlineEdit.button.title', { label: field.label }), container: '#body' }"
|
v-if="options.inlineRecordEditEnabled && field.canEdit && !showingDeletedRecords"
|
||||||
|
v-b-tooltip.noninteractive.hover="{ title: $t('recordList.inlineEdit.button.title'), container: '#body' }"
|
||||||
variant="outline-extra-light"
|
variant="outline-extra-light"
|
||||||
size="sm"
|
size="sm"
|
||||||
class="text-secondary border-0 ml-1"
|
class="text-secondary border-0 ml-1"
|
||||||
@ -488,6 +488,18 @@
|
|||||||
:icon="['fas', 'pen']"
|
:icon="['fas', 'pen']"
|
||||||
/>
|
/>
|
||||||
</b-button>
|
</b-button>
|
||||||
|
<b-button
|
||||||
|
v-if="options.inlineValueFiltering"
|
||||||
|
v-b-tooltip.noninteractive.hover="{ title: $t('recordList.filterByValue'), container: '#body' }"
|
||||||
|
variant="outline-extra-light"
|
||||||
|
size="sm"
|
||||||
|
class="text-secondary border-0 ml-1"
|
||||||
|
@click.stop="filterByValue(item.r, field)"
|
||||||
|
>
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="['fas', 'filter']"
|
||||||
|
/>
|
||||||
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -2066,6 +2078,30 @@ export default {
|
|||||||
this.inlineEdit.query = `recordID = ${record.recordID}`
|
this.inlineEdit.query = `recordID = ${record.recordID}`
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filterByValue (record, { moduleField: field }) {
|
||||||
|
const value = field.isSystem ? record[field.name] : record.values[field.name]
|
||||||
|
|
||||||
|
if (!this.recordListFilter.length) {
|
||||||
|
this.recordListFilter = [
|
||||||
|
{
|
||||||
|
groupCondition: undefined,
|
||||||
|
filter: [
|
||||||
|
this.createDefaultFilter('Where', field, value, '='),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
const { filter } = this.recordListFilter[0]
|
||||||
|
if (!filter.length || (filter.length && !filter[0].name)) {
|
||||||
|
this.recordListFilter[0].filter = []
|
||||||
|
this.recordListFilter[0].filter.push(this.createDefaultFilter('Where', field, value))
|
||||||
|
} else {
|
||||||
|
this.recordListFilter[0].filter.push(this.createDefaultFilter('OR', field, value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.pullRecords(true)
|
||||||
|
},
|
||||||
|
|
||||||
onInlineEditClose () {
|
onInlineEditClose () {
|
||||||
this.inlineEdit.fields = []
|
this.inlineEdit.fields = []
|
||||||
this.inlineEdit.record = {}
|
this.inlineEdit.record = {}
|
||||||
@ -2286,6 +2322,7 @@ tr:hover td.actions {
|
|||||||
margin-top: -2px;
|
margin-top: -2px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.25s;
|
transition: opacity 0.25s;
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
td:hover .inline-actions {
|
td:hover .inline-actions {
|
||||||
|
|||||||
@ -714,6 +714,22 @@
|
|||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
|
|
||||||
|
<b-col
|
||||||
|
cols="12"
|
||||||
|
lg="6"
|
||||||
|
>
|
||||||
|
<b-form-group
|
||||||
|
:label="$t('recordList.inlineValueFilter.enabled')"
|
||||||
|
label-class="text-primary"
|
||||||
|
>
|
||||||
|
<c-input-checkbox
|
||||||
|
v-model="options.inlineValueFiltering"
|
||||||
|
switch
|
||||||
|
:labels="checkboxLabel"
|
||||||
|
/>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
|
|
||||||
<b-col
|
<b-col
|
||||||
cols="12"
|
cols="12"
|
||||||
lg="6"
|
lg="6"
|
||||||
|
|||||||
@ -66,6 +66,7 @@ export interface Options {
|
|||||||
|
|
||||||
bulkRecordEditEnabled: boolean;
|
bulkRecordEditEnabled: boolean;
|
||||||
inlineRecordEditEnabled: boolean;
|
inlineRecordEditEnabled: boolean;
|
||||||
|
inlineValueFiltering: boolean;
|
||||||
filterPresets: FilterPreset[];
|
filterPresets: FilterPreset[];
|
||||||
showRecordPerPageOption: boolean;
|
showRecordPerPageOption: boolean;
|
||||||
openRecordInEditMode: boolean;
|
openRecordInEditMode: boolean;
|
||||||
@ -125,6 +126,7 @@ const defaults: Readonly<Options> = Object.freeze({
|
|||||||
|
|
||||||
bulkRecordEditEnabled: true,
|
bulkRecordEditEnabled: true,
|
||||||
inlineRecordEditEnabled: false,
|
inlineRecordEditEnabled: false,
|
||||||
|
inlineValueFiltering: false,
|
||||||
filterPresets: [],
|
filterPresets: [],
|
||||||
showRecordPerPageOption: false,
|
showRecordPerPageOption: false,
|
||||||
openRecordInEditMode: false,
|
openRecordInEditMode: false,
|
||||||
@ -206,6 +208,7 @@ export class PageBlockRecordList extends PageBlock {
|
|||||||
'showRefresh',
|
'showRefresh',
|
||||||
'bulkRecordEditEnabled',
|
'bulkRecordEditEnabled',
|
||||||
'inlineRecordEditEnabled',
|
'inlineRecordEditEnabled',
|
||||||
|
'inlineValueFiltering',
|
||||||
'showRecordPerPageOption',
|
'showRecordPerPageOption',
|
||||||
'openRecordInEditMode',
|
'openRecordInEditMode',
|
||||||
)
|
)
|
||||||
|
|||||||
@ -325,13 +325,16 @@ recordList:
|
|||||||
customFilter: Custom filter
|
customFilter: Custom filter
|
||||||
prefilter:
|
prefilter:
|
||||||
toggleInputType: Toggle input type
|
toggleInputType: Toggle input type
|
||||||
|
filterByValue: Filter by value
|
||||||
filterPresets:
|
filterPresets:
|
||||||
filterName: Filter name
|
filterName: Filter name
|
||||||
saveFilterAsPreset: Save filter as preset
|
saveFilterAsPreset: Save filter as preset
|
||||||
|
inlineValueFilter:
|
||||||
|
enabled: Enable inline value filtering
|
||||||
inlineEdit:
|
inlineEdit:
|
||||||
enabled: Inline value editing enabled
|
enabled: Inline value editing enabled
|
||||||
button:
|
button:
|
||||||
title: Edit {{label}}
|
title: Edit value
|
||||||
modal:
|
modal:
|
||||||
title: Update record values
|
title: Update record values
|
||||||
bulkRecord:
|
bulkRecord:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user