Browse Source

feat(nc-gui): add computedFieldEditWarning & computedFieldDeleteWarning

pull/4482/head
Wing-Kam Wong 2 years ago
parent
commit
83cc395810
  1. 10
      packages/nc-gui/components/virtual-cell/Formula.vue
  2. 9
      packages/nc-gui/components/virtual-cell/Lookup.vue
  3. 10
      packages/nc-gui/components/virtual-cell/Rollup.vue
  4. 4
      packages/nc-gui/lang/en.json

10
packages/nc-gui/components/virtual-cell/Formula.vue

@ -17,6 +17,7 @@ const urls = computed(() => replaceUrlsWithLink(result.value))
const timeout = 3000 // in ms
const showEditFormulaWarning = refAutoReset(false, timeout)
const showClearFormulaWarning = refAutoReset(false, timeout)
useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEvent) => {
@ -24,9 +25,8 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
case 'Enter':
showEditFormulaWarning.value = true
break
case 'Delete':
default:
showClearFormulaWarning.value = true
break
}
})
</script>
@ -47,12 +47,10 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
<div v-else>{{ result }}</div>
<div v-if="showEditFormulaWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
<!-- TODO: i18n -->
Warning: Formula fields should be configured in the field menu dropdown.
{{ $t('msg.info.computedFieldEditWarning') }}
</div>
<div v-if="showClearFormulaWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
<!-- TODO: i18n -->
Warning: Computed field - unable to clear text.
{{ $t('msg.info.computedFieldDeleteWarning') }}
</div>
</div>
</div>

9
packages/nc-gui/components/virtual-cell/Lookup.vue

@ -81,9 +81,8 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
case 'Enter':
showEditWarning.value = true
break
case 'Delete':
default:
showClearWarning.value = true
break
}
})
</script>
@ -130,12 +129,10 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
</div>
<div>
<div v-if="showEditWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
<!-- TODO: i18n -->
Warning: Computed field - unable to edit content.
{{ $t('msg.info.computedFieldEditWarning') }}
</div>
<div v-if="showClearWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
<!-- TODO: i18n -->
Warning: Computed field - unable to clear content.
{{ $t('msg.info.computedFieldDeleteWarning') }}
</div>
</div>
</div>

10
packages/nc-gui/components/virtual-cell/Rollup.vue

@ -6,6 +6,7 @@ const value = inject(CellValueInj)
const timeout = 3000 // in ms
const showEditWarning = refAutoReset(false, timeout)
const showClearWarning = refAutoReset(false, timeout)
useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEvent) => {
@ -13,9 +14,8 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
case 'Enter':
showEditWarning.value = true
break
case 'Delete':
default:
showClearWarning.value = true
break
}
})
</script>
@ -28,12 +28,10 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
<div>
<div v-if="showEditWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
<!-- TODO: i18n -->
Warning: Computed field - unable to edit content.
{{ $t('msg.info.computedFieldEditWarning') }}
</div>
<div v-if="showClearWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
<!-- TODO: i18n -->
Warning: Computed field - unable to clear content.
{{ $t('msg.info.computedFieldDeleteWarning') }}
</div>
</div>
</div>

4
packages/nc-gui/lang/en.json

@ -605,7 +605,9 @@
"deleteViewConfirmation": "Are you sure you want to delete this view?",
"deleteTableConfirmation": "Do you want to delete the table",
"showM2mTables": "Show M2M Tables",
"deleteKanbanStackConfirmation": "Deleting this stack will also remove the select option `{stackToBeDeleted}` from the `{groupingField}`. The records will move to the uncategorized stack."
"deleteKanbanStackConfirmation": "Deleting this stack will also remove the select option `{stackToBeDeleted}` from the `{groupingField}`. The records will move to the uncategorized stack.",
"computedFieldEditWarning": "Computed field: contents are read-only. Use column edit menu to reconfigure",
"computedFieldDeleteWarning": "Computed field: contents are read-only. Unable to clear content."
},
"error": {
"searchProject": "Your search for {search} found no results",

Loading…
Cancel
Save