Browse Source

fix: form view ui fix

pull/6500/head
sreehari jayaraj 1 year ago
parent
commit
b35973929a
  1. 14
      packages/nc-gui/components/cell/attachment/utils.ts
  2. 2
      packages/nc-gui/components/smartsheet/Cell.vue
  3. 2
      packages/nc-gui/components/smartsheet/header/Cell.vue
  4. 1
      packages/nc-gui/lang/en.json
  5. 4
      packages/nc-gui/pages/index/[typeOrId]/form/[viewId]/index/index.vue

14
packages/nc-gui/components/cell/attachment/utils.ts

@ -33,6 +33,8 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
(updateModelValue: (data: string | Record<string, any>[]) => void) => { (updateModelValue: (data: string | Record<string, any>[]) => void) => {
const isReadonly = inject(ReadonlyInj, ref(false)) const isReadonly = inject(ReadonlyInj, ref(false))
const { t } = useI18n()
const isPublic = inject(IsPublicInj, ref(false)) const isPublic = inject(IsPublicInj, ref(false))
const isForm = inject(IsFormInj, ref(false)) const isForm = inject(IsFormInj, ref(false))
@ -61,8 +63,6 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
const { appInfo } = useGlobal() const { appInfo } = useGlobal()
const { t } = useI18n()
const { getAttachmentSrc } = useAttachment() const { getAttachmentSrc } = useAttachment()
const defaultAttachmentMeta = { const defaultAttachmentMeta = {
@ -140,8 +140,14 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
} }
// this prevent file with same names // this prevent file with same names
const isFileNameAlreadyExist = attachments.value.some((el) => el.title === file.name) const isFileNameAlreadyExist = attachments.value.some((el) => el.title === file.name)
if (isFileNameAlreadyExist) return if (isFileNameAlreadyExist) {
message.error(
t('labels.duplicateAttachment', {
filename: file.name,
}),
)
return
}
files.push(file) files.push(file)
} }

2
packages/nc-gui/components/smartsheet/Cell.vue

@ -211,7 +211,7 @@ onUnmounted(() => {
'nc-grid-numeric-cell-right': isGrid && isNumericField && !isEditColumnMenu && !isForm && !isExpandedFormOpen, 'nc-grid-numeric-cell-right': isGrid && isNumericField && !isEditColumnMenu && !isForm && !isExpandedFormOpen,
'h-10': isForm && !isSurveyForm && !isAttachment(column) && !props.virtual, 'h-10': isForm && !isSurveyForm && !isAttachment(column) && !props.virtual,
'nc-grid-numeric-cell-left': (isForm && isNumericField && isExpandedFormOpen) || isEditColumnMenu, 'nc-grid-numeric-cell-left': (isForm && isNumericField && isExpandedFormOpen) || isEditColumnMenu,
'!min-h-40 resize-y': isTextArea(column) && props.editEnabled, '!min-h-30 resize-y': isTextArea(column) && (isForm || isSurveyForm),
'!border-2': props.editEnabled && (isSurveyForm || isForm), '!border-2': props.editEnabled && (isSurveyForm || isForm),
}, },
]" ]"

2
packages/nc-gui/components/smartsheet/header/Cell.vue

@ -63,7 +63,7 @@ const openDropDown = () => {
@click.right="openDropDown" @click.right="openDropDown"
@click="isDropDownOpen = false" @click="isDropDownOpen = false"
> >
<SmartsheetHeaderCellIcon v-if="column && !props.hideIcon" /> <SmartsheetHeaderCellIcon v-if="column && !props.hideIcon" class="self-start" />
<div <div
v-if="column" v-if="column"
class="name pl-1" class="name pl-1"

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

@ -385,6 +385,7 @@
} }
}, },
"labels": { "labels": {
"duplicateAttachment": "File with name {filename} already attached",
"toAddress": "To Address", "toAddress": "To Address",
"subject": "Subject", "subject": "Subject",
"body": "Body", "body": "Body",

4
packages/nc-gui/pages/index/[typeOrId]/form/[viewId]/index/index.vue

@ -186,8 +186,8 @@ const onDecode = async (scannedCodeValue: string) => {
</LazySmartsheetDivDataCell> </LazySmartsheetDivDataCell>
<div <div
class="flex flex-col gap-2 text-slate-500 dark:text-slate-300 text-[0.75rem] my-2 px-1" class="flex flex-col gap-2 text-slate-500 dark:text-slate-300 text-[0.75rem] my-2 px-1 leading-[18px]"
style="word-break: break-all" style="word-break: break-word"
> >
<div v-for="error of v$.localState[field.title]?.$errors" :key="error" class="text-red-500"> <div v-for="error of v$.localState[field.title]?.$errors" :key="error" class="text-red-500">
{{ error.$message }} {{ error.$message }}

Loading…
Cancel
Save