Browse Source

refactor(nc-gui): form view code

pull/7664/head
Ramesh Mane 9 months ago
parent
commit
ae63e337b9
  1. 51
      packages/nc-gui/components/smartsheet/Form.vue

51
packages/nc-gui/components/smartsheet/Form.vue

@ -380,22 +380,24 @@ const updateColMeta = useDebounceFn(async (col: Record<string, any>) => {
} }
}, 250) }, 250)
watch(submitted, (v) => {
if (v && formViewData.value?.show_blank_form) {
secondsRemain.value = 5
const intvl = setInterval(() => {
if (--secondsRemain.value < 0) {
submitted.value = false
clearInterval(intvl)
}
}, 1000)
}
})
const columnSupportsScanning = (elementType: UITypes) => const columnSupportsScanning = (elementType: UITypes) =>
betaFeatureToggleState.show && betaFeatureToggleState.show &&
[UITypes.SingleLineText, UITypes.Number, UITypes.Email, UITypes.URL, UITypes.LongText].includes(elementType) [UITypes.SingleLineText, UITypes.Number, UITypes.Email, UITypes.URL, UITypes.LongText].includes(elementType)
const onFormItemClick = (element: any) => {
if (isLocked.value || !isEditable) return
activeRow.value = element.title
isTabPressed.value = false
}
const handleChangeBackground = (color: string) => {
const tcolor = tinycolor(color)
if (tcolor.isValid()) {
;(formViewData.value?.meta as Record<string, any>).background_color = color
updateView()
}
}
onClickOutside(draggableRef, () => { onClickOutside(draggableRef, () => {
activeRow.value = '' activeRow.value = ''
isTabPressed.value = false isTabPressed.value = false
@ -408,6 +410,18 @@ onMounted(async () => {
isLoadingFormView.value = false isLoadingFormView.value = false
}) })
watch(submitted, (v) => {
if (v && formViewData.value?.show_blank_form) {
secondsRemain.value = 5
const intvl = setInterval(() => {
if (--secondsRemain.value < 0) {
submitted.value = false
clearInterval(intvl)
}
}, 1000)
}
})
watch(view, (nextView) => { watch(view, (nextView) => {
if (nextView?.type === ViewTypes.FORM) { if (nextView?.type === ViewTypes.FORM) {
reloadEventHook.trigger() reloadEventHook.trigger()
@ -420,19 +434,6 @@ watch(activeRow, (newValue) => {
} }
}) })
const onFormItemClick = (element: any) => {
if (isLocked.value || !isEditable) return
activeRow.value = element.title
isTabPressed.value = false
}
const handleChangeBackground = (color: string) => {
const tcolor = tinycolor(color)
if (tcolor.isValid()) {
;(formViewData.value?.meta as Record<string, any>).background_color = color
updateView()
}
}
useEventListener( useEventListener(
formRef, formRef,
'focusout', 'focusout',

Loading…
Cancel
Save