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

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

@ -605,7 +605,9 @@
"deleteViewConfirmation": "Are you sure you want to delete this view?", "deleteViewConfirmation": "Are you sure you want to delete this view?",
"deleteTableConfirmation": "Do you want to delete the table", "deleteTableConfirmation": "Do you want to delete the table",
"showM2mTables": "Show M2M Tables", "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": { "error": {
"searchProject": "Your search for {search} found no results", "searchProject": "Your search for {search} found no results",

Loading…
Cancel
Save