From cbc7740a5124980afa2090c179856770df93d4a7 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 19 Jun 2023 18:39:16 +0530 Subject: [PATCH] fix: add validation for singular/plural Signed-off-by: Pranav C --- .../smartsheet/column/LinkOptions.vue | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/column/LinkOptions.vue b/packages/nc-gui/components/smartsheet/column/LinkOptions.vue index 6bb12006eb..5411a0f7dc 100644 --- a/packages/nc-gui/components/smartsheet/column/LinkOptions.vue +++ b/packages/nc-gui/components/smartsheet/column/LinkOptions.vue @@ -9,16 +9,33 @@ const emit = defineEmits(['update:value']) const vModel = useVModel(props, 'value', emit) -const validators = {} - -const { setAdditionalValidations, validateInfos } = useColumnCreateStoreOrThrow() - -const { appInfo } = useGlobal() - -const searchValue = ref('') +const { validateInfos, setAdditionalValidations } = useColumnCreateStoreOrThrow() setAdditionalValidations({ - ...validators, + 'meta.singular': [ + { + validator: (_, value: string) => { + return new Promise((resolve, reject) => { + if (value?.length > 64) { + return reject(new Error('The length exceeds the max 64 characters')) + } + resolve(true) + }) + }, + }, + ], + 'meta.plural': [ + { + validator: (_, value: string) => { + return new Promise((resolve, reject) => { + if (value?.length > 64) { + return reject(new Error('The length exceeds the max 64 characters')) + } + resolve(true) + }) + }, + }, + ], }) // set default valueO @@ -33,13 +50,13 @@ vModel.value.meta = { - + - +