mirror of https://github.com/Fabio286/antares.git
feat(UI): canc press to delete selected rows
This commit is contained in:
parent
9ffd443a66
commit
20cba6ee9b
|
@ -1,16 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
ref="tableWrapper"
|
ref="tableWrapper"
|
||||||
class="vscroll"
|
class="vscroll no-outline"
|
||||||
|
tabindex="0"
|
||||||
:style="{'height': resultsSize+'px'}"
|
:style="{'height': resultsSize+'px'}"
|
||||||
|
@keyup.46="showDeleteConfirmModal"
|
||||||
>
|
>
|
||||||
<TableContext
|
<TableContext
|
||||||
v-if="isContext"
|
v-if="isContext"
|
||||||
:context-event="contextEvent"
|
:context-event="contextEvent"
|
||||||
:selected-rows="selectedRows"
|
:selected-rows="selectedRows"
|
||||||
@delete-selected="deleteSelected"
|
@show-delete-modal="showDeleteConfirmModal"
|
||||||
@set-null="setNull"
|
@set-null="setNull"
|
||||||
@close-context="isContext = false"
|
@close-context="closeContext"
|
||||||
/>
|
/>
|
||||||
<ul v-if="resultsWithRows.length > 1" class="tab tab-block result-tabs">
|
<ul v-if="resultsWithRows.length > 1" class="tab tab-block result-tabs">
|
||||||
<li
|
<li
|
||||||
|
@ -75,6 +77,23 @@
|
||||||
</template>
|
</template>
|
||||||
</BaseVirtualScroll>
|
</BaseVirtualScroll>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ConfirmModal
|
||||||
|
v-if="isDeleteConfirmModal"
|
||||||
|
@confirm="deleteSelected"
|
||||||
|
@hide="hideDeleteConfirmModal"
|
||||||
|
>
|
||||||
|
<template :slot="'header'">
|
||||||
|
<div class="d-flex">
|
||||||
|
<i class="mdi mdi-24px mdi-delete mr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div :slot="'body'">
|
||||||
|
<div class="mb-2">
|
||||||
|
{{ $tc('message.confirmToDeleteRows', selectedRows.length) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ConfirmModal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -85,6 +104,7 @@ import { TEXT, LONG_TEXT, BLOB } from 'common/fieldTypes';
|
||||||
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
||||||
import WorkspaceQueryTableRow from '@/components/WorkspaceQueryTableRow';
|
import WorkspaceQueryTableRow from '@/components/WorkspaceQueryTableRow';
|
||||||
import TableContext from '@/components/WorkspaceQueryTableContext';
|
import TableContext from '@/components/WorkspaceQueryTableContext';
|
||||||
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
|
@ -93,7 +113,8 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
BaseVirtualScroll,
|
BaseVirtualScroll,
|
||||||
WorkspaceQueryTableRow,
|
WorkspaceQueryTableRow,
|
||||||
TableContext
|
TableContext,
|
||||||
|
ConfirmModal
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
results: Array,
|
results: Array,
|
||||||
|
@ -106,6 +127,7 @@ export default {
|
||||||
resultsSize: 1000,
|
resultsSize: 1000,
|
||||||
localResults: [],
|
localResults: [],
|
||||||
isContext: false,
|
isContext: false,
|
||||||
|
isDeleteConfirmModal: false,
|
||||||
contextEvent: null,
|
contextEvent: null,
|
||||||
selectedCell: null,
|
selectedCell: null,
|
||||||
selectedRows: [],
|
selectedRows: [],
|
||||||
|
@ -322,7 +344,17 @@ export default {
|
||||||
};
|
};
|
||||||
this.$emit('update-field', params);
|
this.$emit('update-field', params);
|
||||||
},
|
},
|
||||||
|
closeContext () {
|
||||||
|
this.isContext = false;
|
||||||
|
},
|
||||||
|
showDeleteConfirmModal () {
|
||||||
|
this.isDeleteConfirmModal = true;
|
||||||
|
},
|
||||||
|
hideDeleteConfirmModal () {
|
||||||
|
this.isDeleteConfirmModal = false;
|
||||||
|
},
|
||||||
deleteSelected () {
|
deleteSelected () {
|
||||||
|
this.closeContext();
|
||||||
const rows = this.localResults.filter(row => this.selectedRows.includes(row._id)).map(row => {
|
const rows = this.localResults.filter(row => this.selectedRows.includes(row._id)).map(row => {
|
||||||
delete row._id;
|
delete row._id;
|
||||||
return row;
|
return row;
|
||||||
|
|
|
@ -17,61 +17,30 @@
|
||||||
<i class="mdi mdi-18px mdi-delete text-light pr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }}
|
<i class="mdi mdi-18px mdi-delete text-light pr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ConfirmModal
|
|
||||||
v-if="isConfirmModal"
|
|
||||||
@confirm="deleteRows"
|
|
||||||
@hide="hideConfirmModal"
|
|
||||||
>
|
|
||||||
<template :slot="'header'">
|
|
||||||
<div class="d-flex">
|
|
||||||
<i class="mdi mdi-24px mdi-delete mr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<div :slot="'body'">
|
|
||||||
<div class="mb-2">
|
|
||||||
{{ $tc('message.confirmToDeleteRows', selectedRows.length) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ConfirmModal>
|
|
||||||
</BaseContextMenu>
|
</BaseContextMenu>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu';
|
import BaseContextMenu from '@/components/BaseContextMenu';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceQueryTableContext',
|
name: 'WorkspaceQueryTableContext',
|
||||||
components: {
|
components: {
|
||||||
BaseContextMenu,
|
BaseContextMenu
|
||||||
ConfirmModal
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
contextEvent: MouseEvent,
|
contextEvent: MouseEvent,
|
||||||
selectedRows: Array
|
selectedRows: Array
|
||||||
},
|
},
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
isConfirmModal: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showConfirmModal () {
|
showConfirmModal () {
|
||||||
this.isConfirmModal = true;
|
this.$emit('show-delete-modal');
|
||||||
},
|
|
||||||
hideConfirmModal () {
|
|
||||||
this.isConfirmModal = false;
|
|
||||||
},
|
},
|
||||||
closeContext () {
|
closeContext () {
|
||||||
this.$emit('close-context');
|
this.$emit('close-context');
|
||||||
},
|
},
|
||||||
deleteRows () {
|
|
||||||
this.$emit('delete-selected');
|
|
||||||
this.closeContext();
|
|
||||||
},
|
|
||||||
setNull () {
|
setNull () {
|
||||||
this.$emit('set-null');
|
this.$emit('set-null');
|
||||||
this.closeContext();
|
this.closeContext();
|
||||||
|
|
Loading…
Reference in New Issue