Browse Source

refactor(gui): add class to gridview row, update delete roe toast

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/865/head
Pranav C 3 years ago
parent
commit
556f49d57d
  1. 13
      packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue
  2. 4
      packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue

13
packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue

@ -1,6 +1,11 @@
<template> <template>
<v-container class="h-100 j-excel-container pa-0 ma-0" fluid> <v-container class="h-100 j-excel-container pa-0 ma-0" fluid>
<v-toolbar height="32" dense class="nc-table-toolbar elevation-0 xc-toolbar xc-border-bottom mx-1" style="z-index: 7"> <v-toolbar
height="32"
dense
class="nc-table-toolbar elevation-0 xc-toolbar xc-border-bottom mx-1"
style="z-index: 7"
>
<div v-if="!isForm" class="d-flex xc-border align-center search-box" style="min-width:156px"> <div v-if="!isForm" class="d-flex xc-border align-center search-box" style="min-width:156px">
<v-menu bottom offset-y> <v-menu bottom offset-y>
<template #activator="{on}"> <template #activator="{on}">
@ -1042,6 +1047,7 @@ export default {
}, },
async deleteSelectedRows() { async deleteSelectedRows() {
let row = this.rowLength let row = this.rowLength
let success = 0
while (row--) { while (row--) {
try { try {
const { row: rowObj, rowMeta } = this.data[row] const { row: rowObj, rowMeta } = this.data[row]
@ -1058,12 +1064,12 @@ export default {
await this.api.delete(id) await this.api.delete(id)
} }
this.data.splice(row, 1) this.data.splice(row, 1)
success++
} catch (e) { } catch (e) {
return this.$toast.error(`Failed to delete row : ${e.message}`).goAway(3000) return this.$toast.error(`Failed to delete row : ${e.message}`).goAway(3000)
} }
this.$toast.success('Deleted selected rows successfully').goAway(3000)
} }
if (success) { this.$toast.success(`Deleted ${success} selected row${success > 1 ? 's' : ''} successfully`).goAway(3000) }
}, },
async clearCellValue() { async clearCellValue() {
@ -1332,6 +1338,7 @@ export default {
/deep/ .v-input__control label { /deep/ .v-input__control label {
font-size: inherit; font-size: inherit;
} }
/deep/ .nc-table-toolbar > .v-toolbar__content { /deep/ .nc-table-toolbar > .v-toolbar__content {
padding: 0; padding: 0;
} }

4
packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue

@ -100,6 +100,10 @@
v-for="({row:rowObj, rowMeta, saving},row) in data" v-for="({row:rowObj, rowMeta, saving},row) in data"
:key="row" :key="row"
class=" nc-grid-row" class=" nc-grid-row"
:class="{
'nc-new-row':rowMeta.new,
'nc-saved-row':!rowMeta.new,
}"
> >
<td <td
style="width: 65px" style="width: 65px"

Loading…
Cancel
Save