Browse Source

feat: on clear cell set rating and checkbox value 0 and false

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4885/head
Pranav C 2 years ago
parent
commit
46f19611b2
  1. 17
      packages/nc-gui/components/smartsheet/Grid.vue

17
packages/nc-gui/components/smartsheet/Grid.vue

@ -418,7 +418,18 @@ async function clearCell(ctx: { row: number; col: number } | null, skipUpdate =
return return
} }
// handle Checkbox and rating fields in a special way
switch (columnObj.uidt) {
case UITypes.Checkbox:
rowObj.row[columnObj.title] = false
break
case UITypes.Rating:
rowObj.row[columnObj.title] = 0
break
default:
rowObj.row[columnObj.title] = null rowObj.row[columnObj.title] = null
break
}
if (!skipUpdate) { if (!skipUpdate) {
// update/save cell value // update/save cell value
@ -663,7 +674,8 @@ const closeAddColumnDropdown = () => {
<thead ref="tableHead"> <thead ref="tableHead">
<tr class="nc-grid-header border-1 bg-gray-100 sticky top[-1px]"> <tr class="nc-grid-header border-1 bg-gray-100 sticky top[-1px]">
<th data-testid="grid-id-column"> <th data-testid="grid-id-column">
<div class="w-full h-full bg-gray-100 flex min-w-[70px] pl-5 pr-1 items-center" data-testid="nc-check-all"> <div class="w-full h-full bg-gray-100 flex min-w-[70px] pl-5 pr-1 items-center"
data-testid="nc-check-all">
<template v-if="!readOnly"> <template v-if="!readOnly">
<div class="nc-no-label text-gray-500" :class="{ hidden: selectedAllRecords }">#</div> <div class="nc-no-label text-gray-500" :class="{ hidden: selectedAllRecords }">#</div>
<div <div
@ -885,7 +897,8 @@ const closeAddColumnDropdown = () => {
</div> </div>
</a-menu-item> </a-menu-item>
<a-menu-item v-if="contextMenuTarget" data-testid="context-menu-item-copy" @click="copyValue(contextMenuTarget)"> <a-menu-item v-if="contextMenuTarget" data-testid="context-menu-item-copy"
@click="copyValue(contextMenuTarget)">
<div v-e="['a:row:copy']" class="nc-project-menu-item"> <div v-e="['a:row:copy']" class="nc-project-menu-item">
<!-- Copy --> <!-- Copy -->
{{ $t('general.copy') }} {{ $t('general.copy') }}

Loading…
Cancel
Save