Browse Source

Merge pull request #4762 from nocodb/fix/miscellaneous-bugs

Fix - Miscellaneous bugs
pull/4809/head
Raju Udava 2 years ago committed by GitHub
parent
commit
a6dd286484
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      packages/nc-gui/components/cell/Currency.vue
  2. 8
      packages/nc-gui/components/cell/Json.vue
  3. 13
      packages/nc-gui/components/cell/Percent.vue
  4. 3
      packages/nc-gui/composables/useMultiSelect/index.ts

13
packages/nc-gui/components/cell/Currency.vue

@ -14,7 +14,18 @@ const column = inject(ColumnInj)!
const editEnabled = inject(EditModeInj)! const editEnabled = inject(EditModeInj)!
const vModel = useVModel(props, 'modelValue', emit) const _vModel = useVModel(props, 'modelValue', emit)
const vModel = computed({
get: () => _vModel.value,
set: (value: unknown) => {
if (value === '') {
_vModel.value = null
} else {
_vModel.value = value as number
}
},
})
const lastSaved = ref() const lastSaved = ref()

8
packages/nc-gui/components/cell/Json.vue

@ -123,8 +123,8 @@ useSelectedCellKeyupListener(active, (e) => {
<template> <template>
<component :is="isExpanded ? AModal : 'div'" v-model:visible="isExpanded" :closable="false" centered :footer="null"> <component :is="isExpanded ? AModal : 'div'" v-model:visible="isExpanded" :closable="false" centered :footer="null">
<div v-if="editEnabled && !readonly" class="flex flex-col w-full"> <div v-if="editEnabled && !readonly" class="flex flex-col w-full" @mousedown.stop @mouseup.stop @click.stop>
<div class="flex flex-row justify-between pt-1 pb-2"> <div class="flex flex-row justify-between pt-1 pb-2" @mousedown.stop>
<a-button type="text" size="small" @click="isExpanded = !isExpanded"> <a-button type="text" size="small" @click="isExpanded = !isExpanded">
<CilFullscreenExit v-if="isExpanded" class="h-2.5" /> <CilFullscreenExit v-if="isExpanded" class="h-2.5" />
@ -134,8 +134,8 @@ useSelectedCellKeyupListener(active, (e) => {
<div v-if="!isForm || isExpanded" class="flex flex-row"> <div v-if="!isForm || isExpanded" class="flex flex-row">
<a-button type="text" size="small" :onclick="clear"><div class="text-xs">Cancel</div></a-button> <a-button type="text" size="small" :onclick="clear"><div class="text-xs">Cancel</div></a-button>
<a-button type="primary" size="small" :disabled="!!error || localValue === vModel"> <a-button type="primary" size="small" :disabled="!!error || localValue === vModel" @click="onSave">
<div class="text-xs" @click="onSave">Save</div> <div class="text-xs">Save</div>
</a-button> </a-button>
</div> </div>
</div> </div>

13
packages/nc-gui/components/cell/Percent.vue

@ -12,7 +12,18 @@ const emits = defineEmits(['update:modelValue'])
const editEnabled = inject(EditModeInj) const editEnabled = inject(EditModeInj)
const vModel = useVModel(props, 'modelValue', emits) const _vModel = useVModel(props, 'modelValue', emits)
const vModel = computed({
get: () => _vModel.value,
set: (value) => {
if (value === '') {
_vModel.value = null
} else {
_vModel.value = value
}
},
})
const focus: VNodeRef = (el) => { const focus: VNodeRef = (el) => {
;(el as HTMLInputElement)?.focus() ;(el as HTMLInputElement)?.focus()

3
packages/nc-gui/composables/useMultiSelect/index.ts

@ -267,7 +267,8 @@ export function useMultiSelect(
// copy - ctrl/cmd +c // copy - ctrl/cmd +c
case 67: case 67:
// set clipboard context only if single cell selected // set clipboard context only if single cell selected
if (selectedRange.isSingleCell() && rowObj.row[columnObj.title!]) { // or if selected range is empty
if (selectedRange.isSingleCell() || (selectedRange.isEmpty() && rowObj && columnObj)) {
clipboardContext = { clipboardContext = {
value: rowObj.row[columnObj.title!], value: rowObj.row[columnObj.title!],
uidt: columnObj.uidt as UITypes, uidt: columnObj.uidt as UITypes,

Loading…
Cancel
Save