|
|
|
@ -48,12 +48,17 @@ const view = inject(ActiveViewInj)
|
|
|
|
|
|
|
|
|
|
const { loadFormView, insertRow, formColumnData, formViewData, updateFormView } = useViewData(meta, view as any) |
|
|
|
|
|
|
|
|
|
const { showAll, hideAll, saveOrUpdate } = useViewColumns(view, meta as any, async () => { |
|
|
|
|
const reloadEventHook = createEventHook<void>() |
|
|
|
|
provide(ReloadViewDataHookInj, reloadEventHook) |
|
|
|
|
|
|
|
|
|
reloadEventHook.on(async () => { |
|
|
|
|
await loadFormView() |
|
|
|
|
setFormData() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const { syncLTARRefs } = useProvideSmartsheetRowStore( |
|
|
|
|
const { showAll, hideAll, saveOrUpdate } = useViewColumns(view, meta as any, async () => reloadEventHook.trigger()) |
|
|
|
|
|
|
|
|
|
const { syncLTARRefs, row } = useProvideSmartsheetRowStore( |
|
|
|
|
meta, |
|
|
|
|
ref({ |
|
|
|
|
row: formState, |
|
|
|
@ -144,8 +149,9 @@ function isDbRequired(column: Record<string, any>) {
|
|
|
|
|
return isRequired |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** Block user from drag n drop required column to hidden fields */ |
|
|
|
|
function onMoveCallback(event: any) { |
|
|
|
|
if (shouldSkipColumn(event.draggedContext.element)) { |
|
|
|
|
if (event.from !== event.to && shouldSkipColumn(event.draggedContext.element)) { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -334,11 +340,16 @@ watch(submitted, (v) => {
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
function handleMouseUp(col: Record<string, any>) { |
|
|
|
|
function handleMouseUp(col: Record<string, any>, hiddenColIndex: number) { |
|
|
|
|
if (!moved.value) { |
|
|
|
|
const index = localColumns.value.length |
|
|
|
|
col.order = (index ? localColumns.value[index - 1].order : 0) + 1 |
|
|
|
|
col.show = true |
|
|
|
|
|
|
|
|
|
/** remove column from hiddenColumns and add to localColumns */ |
|
|
|
|
localColumns.value.push(col) |
|
|
|
|
hiddenColumns.value.splice(hiddenColIndex, 1) |
|
|
|
|
|
|
|
|
|
saveOrUpdate(col, index) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -415,13 +426,13 @@ onMounted(async () => {
|
|
|
|
|
@start="drag = true" |
|
|
|
|
@end="drag = false" |
|
|
|
|
> |
|
|
|
|
<template #item="{ element }"> |
|
|
|
|
<template #item="{ element, index }"> |
|
|
|
|
<a-card |
|
|
|
|
size="small" |
|
|
|
|
class="m-0 p-0 cursor-pointer item mb-2" |
|
|
|
|
@mousedown="moved = false" |
|
|
|
|
@mousemove="moved = false" |
|
|
|
|
@mouseup="handleMouseUp(element)" |
|
|
|
|
@mouseup="handleMouseUp(element, index)" |
|
|
|
|
> |
|
|
|
|
<div class="flex"> |
|
|
|
|
<div class="flex flex-row flex-1"> |
|
|
|
@ -625,6 +636,7 @@ onMounted(async () => {
|
|
|
|
|
> |
|
|
|
|
<SmartsheetVirtualCell |
|
|
|
|
v-model="formState[element.title]" |
|
|
|
|
:row="row" |
|
|
|
|
class="nc-input" |
|
|
|
|
:class="`nc-form-input-${element.title.replaceAll(' ', '')}`" |
|
|
|
|
:column="element" |
|
|
|
|