From 34cc8197d4f862d91e44ec5a9e1047ec0b3ddd7b Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Wed, 20 Mar 2024 20:10:34 +0530 Subject: [PATCH] Nc fix: Form view bug fixes (#7899) * fix(nc-gui): show inline form field validation errors * fix(nc-gui): display inline validation error in shared form and form builder * fix(nc-gui): shared form default value issue * fix(nc-gui): limit option spell mistake * fix(nc-gui): form title update issue when toggle between grid & form view * fix(nc-gui): form banner & logo display issue on upload * chore(nc-gui): lint * fix(nc-gui): show error message on press non numeric keys in numeric field * fix(nc-gui): add key for form banner and logo * fix(nc-gui): show currency suffix only in form * fix(nc-gui): edit column default value input height issue * fix(nc-gui): form checkbox field enter keypress should navigate to next question in survey form * fix(nc-gui): escape should blur focus field in survey form * fix(nc-gui): add currency code suffix in form view currency field * chore(nc-gui): lint * fix(nc-gui): add percent suffix in form view percent field * fix(nc-gui): survey form pw test fail issue * fix(nc-gui): filter pw test fail issue * fix(nc-gui): add missing classname in oss * fix(nc-gui): survey form ui break issue * fix(nc-gui): update oss survey form file * fix(nc-gui): in survey form branding text color should be dynamic based on form bg color * chore(nc-gui): lint * fix(nc-gui): ai pr review changes * fix(nc-gui): pr review changes #2555 * fix(nc-gui): use handler instead on ternery condition --- packages/nc-gui/components/cell/Checkbox.vue | 19 ++- packages/nc-gui/components/cell/Currency.vue | 11 +- packages/nc-gui/components/cell/Email.vue | 21 ++- packages/nc-gui/components/cell/Integer.vue | 15 +- .../nc-gui/components/cell/MultiSelect.vue | 5 +- packages/nc-gui/components/cell/Percent.vue | 38 +++-- .../nc-gui/components/cell/SingleSelect.vue | 22 ++- packages/nc-gui/components/cell/Url.vue | 21 ++- .../components/cell/attachment/index.vue | 17 +- .../nc-gui/components/general/FormBanner.vue | 10 +- .../nc-gui/components/smartsheet/Cell.vue | 2 +- .../nc-gui/components/smartsheet/Form.vue | 75 +++++++-- .../composables/useSharedFormViewStore.ts | 39 ++++- packages/nc-gui/lang/en.json | 2 +- .../index/[typeOrId]/form/[viewId]/index.vue | 19 ++- .../[typeOrId]/form/[viewId]/index/index.vue | 10 +- .../[typeOrId]/form/[viewId]/index/survey.vue | 155 +++++++++--------- packages/nc-gui/utils/dataUtils.ts | 2 +- .../playwright/pages/Dashboard/Form/index.ts | 2 + .../pages/Dashboard/common/Toolbar/Filter.ts | 5 +- tests/playwright/pages/SharedForm/index.ts | 1 + 21 files changed, 338 insertions(+), 153 deletions(-) diff --git a/packages/nc-gui/components/cell/Checkbox.vue b/packages/nc-gui/components/cell/Checkbox.vue index efa710d539..155bd454d6 100644 --- a/packages/nc-gui/components/cell/Checkbox.vue +++ b/packages/nc-gui/components/cell/Checkbox.vue @@ -63,7 +63,7 @@ const vModel = computed({ set: (val: any) => emits('update:modelValue', isMssql(column?.value?.source_id) ? +val : val), }) -function onClick(force?: boolean, event?: MouseEvent) { +function onClick(force?: boolean, event?: MouseEvent | KeyboardEvent) { if ( (event?.target as HTMLElement)?.classList?.contains('nc-checkbox') || (event?.target as HTMLElement)?.closest('.nc-checkbox') @@ -75,6 +75,19 @@ function onClick(force?: boolean, event?: MouseEvent) { } } +const keydownEnter = (e: KeyboardEvent) => { + if (!isSurveyForm.value) { + onClick(true, e) + e.stopPropagation() + } +} +const keydownSpace = (e: KeyboardEvent) => { + if (isSurveyForm.value) { + onClick(true, e) + e.stopPropagation() + } +} + useSelectedCellKeyupListener(active, (e) => { switch (e.key) { case 'Enter': @@ -101,8 +114,8 @@ useSelectedCellKeyupListener(active, (e) => { }" :tabindex="readOnly ? -1 : 0" @click="onClick(false, $event)" - @keydown.enter.stop="!isSurveyForm ? onClick(true, $event) : undefined" - @keydown.space.stop="isSurveyForm ? onClick(true, $event) : undefined" + @keydown.enter="keydownEnter" + @keydown.space="keydownSpace($event)" >
{