From 83cc3958109ced82281667dd9377964b8919b888 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 24 Nov 2022 14:30:27 +0800 Subject: [PATCH] feat(nc-gui): add computedFieldEditWarning & computedFieldDeleteWarning --- packages/nc-gui/components/virtual-cell/Formula.vue | 10 ++++------ packages/nc-gui/components/virtual-cell/Lookup.vue | 9 +++------ packages/nc-gui/components/virtual-cell/Rollup.vue | 10 ++++------ packages/nc-gui/lang/en.json | 4 +++- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/packages/nc-gui/components/virtual-cell/Formula.vue b/packages/nc-gui/components/virtual-cell/Formula.vue index 7d25764c04..cc0e3159ed 100644 --- a/packages/nc-gui/components/virtual-cell/Formula.vue +++ b/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 } }) @@ -47,12 +47,10 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
{{ result }}
- - Warning: Formula fields should be configured in the field menu dropdown. + {{ $t('msg.info.computedFieldEditWarning') }}
- - Warning: Computed field - unable to clear text. + {{ $t('msg.info.computedFieldDeleteWarning') }}
diff --git a/packages/nc-gui/components/virtual-cell/Lookup.vue b/packages/nc-gui/components/virtual-cell/Lookup.vue index 4b4af84c55..dff4dab7c1 100644 --- a/packages/nc-gui/components/virtual-cell/Lookup.vue +++ b/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 } }) @@ -130,12 +129,10 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
- - Warning: Computed field - unable to edit content. + {{ $t('msg.info.computedFieldEditWarning') }}
- - Warning: Computed field - unable to clear content. + {{ $t('msg.info.computedFieldDeleteWarning') }}
diff --git a/packages/nc-gui/components/virtual-cell/Rollup.vue b/packages/nc-gui/components/virtual-cell/Rollup.vue index dea3a85e7c..c0bc8a9611 100644 --- a/packages/nc-gui/components/virtual-cell/Rollup.vue +++ b/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 } }) @@ -28,12 +28,10 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
- - Warning: Computed field - unable to edit content. + {{ $t('msg.info.computedFieldEditWarning') }}
- - Warning: Computed field - unable to clear content. + {{ $t('msg.info.computedFieldDeleteWarning') }}
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json index bd19e8ad4a..a7d4ed55d6 100644 --- a/packages/nc-gui/lang/en.json +++ b/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",