|
|
|
@ -87,6 +87,11 @@ const { isExpandedFormCommentMode } = storeToRefs(useConfigStore())
|
|
|
|
|
// override cell click hook to avoid unexpected behavior at form fields |
|
|
|
|
provide(CellClickHookInj, undefined) |
|
|
|
|
|
|
|
|
|
const loadingEmit = (event: 'update:modelValue' | 'cancel' | 'next' | 'prev' | 'createdRecord') => { |
|
|
|
|
emits(event) |
|
|
|
|
isLoading.value = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const fields = computedInject(FieldsInj, (_fields) => { |
|
|
|
|
if (props.useMetaFields) { |
|
|
|
|
return (meta.value.columns ?? []).filter((col) => !isSystemColumn(col)) |
|
|
|
@ -124,7 +129,6 @@ const {
|
|
|
|
|
isNew, |
|
|
|
|
loadRow: _loadRow, |
|
|
|
|
primaryKey, |
|
|
|
|
saveRowAndStay, |
|
|
|
|
row: _row, |
|
|
|
|
save: _save, |
|
|
|
|
loadComments, |
|
|
|
@ -240,7 +244,7 @@ const isCloseModalOpen = ref(false)
|
|
|
|
|
const discardPreventModal = () => { |
|
|
|
|
// when user click on next or previous button |
|
|
|
|
if (isPreventChangeModalOpen.value) { |
|
|
|
|
emits('next') |
|
|
|
|
loadingEmit('next') |
|
|
|
|
if (_row.value?.rowMeta?.new) emits('cancel') |
|
|
|
|
isPreventChangeModalOpen.value = false |
|
|
|
|
} |
|
|
|
@ -259,7 +263,7 @@ const onNext = async () => {
|
|
|
|
|
isPreventChangeModalOpen.value = true |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
emits('next') |
|
|
|
|
loadingEmit('next') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const copyRecordUrl = async () => { |
|
|
|
@ -278,7 +282,7 @@ const saveChanges = async () => {
|
|
|
|
|
if (isPreventChangeModalOpen.value) { |
|
|
|
|
isUnsavedFormExist.value = false |
|
|
|
|
await save() |
|
|
|
|
emits('next') |
|
|
|
|
loadingEmit('next') |
|
|
|
|
isPreventChangeModalOpen.value = false |
|
|
|
|
} |
|
|
|
|
if (isCloseModalOpen.value) { |
|
|
|
@ -313,6 +317,7 @@ provide(IsExpandedFormOpenInj, isExpanded)
|
|
|
|
|
|
|
|
|
|
const triggerRowLoad = async (rowId?: string) => { |
|
|
|
|
await Promise.allSettled([loadComments(), loadAudits(), _loadRow(rowId)]) |
|
|
|
|
isLoading.value = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const cellWrapperEl = ref() |
|
|
|
@ -362,7 +367,7 @@ useActiveKeyupListener(
|
|
|
|
|
if (!e.altKey) return |
|
|
|
|
if (e.key === 'ArrowLeft') { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
emits('prev') |
|
|
|
|
loadingEmit('prev') |
|
|
|
|
} else if (e.key === 'ArrowRight') { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
onNext() |
|
|
|
@ -382,9 +387,6 @@ useActiveKeyupListener(
|
|
|
|
|
await save() |
|
|
|
|
reloadHook?.trigger(null) |
|
|
|
|
} |
|
|
|
|
if (!saveRowAndStay.value) { |
|
|
|
|
onClose() |
|
|
|
|
} |
|
|
|
|
} catch (e: any) { |
|
|
|
|
if (isNew.value) { |
|
|
|
|
message.error(`Add row failed: ${await extractSdkResponseErrorMsg(e)}`) |
|
|
|
@ -571,7 +573,7 @@ export default {
|
|
|
|
|
class="nc-prev-arrow !w-7 !h-7 !text-gray-500 !disabled:text-gray-300" |
|
|
|
|
type="text" |
|
|
|
|
size="xsmall" |
|
|
|
|
@click="$emit('prev')" |
|
|
|
|
@click="loadingEmit('prev')" |
|
|
|
|
> |
|
|
|
|
<GeneralIcon icon="chevronDown" class="transform rotate-180" /> |
|
|
|
|
</NcButton> |
|
|
|
@ -600,16 +602,6 @@ export default {
|
|
|
|
|
'xs:max-w-[calc(100%_-_82px)]': !isNew, |
|
|
|
|
}" |
|
|
|
|
> |
|
|
|
|
<div v-if="meta.title" class="flex items-center gap-2 px-2 py-1 rounded-lg bg-gray-100 text-gray-800"> |
|
|
|
|
<GeneralTableIcon :meta="meta" class="!text-gray-800 !mx-0" /> |
|
|
|
|
|
|
|
|
|
<NcTooltip class="truncate text-sm max-w-[100px] xs:(max-w-[82px]) align-middle" show-on-truncate-only> |
|
|
|
|
<template #title> |
|
|
|
|
{{ meta.title }} |
|
|
|
|
</template> |
|
|
|
|
<span class="font-weight-500 truncate text-sm">{{ meta.title }}</span> |
|
|
|
|
</NcTooltip> |
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
v-if="row.rowMeta?.new || props.newRecordHeader" |
|
|
|
|
class="flex items-center truncate font-bold text-gray-800 text-base overflow-hidden" |
|
|
|
@ -642,24 +634,22 @@ export default {
|
|
|
|
|
<div class="xs:px-1">{{ newRecordSubmitBtnText ?? 'Save Record' }}</div> |
|
|
|
|
</NcButton> |
|
|
|
|
</NcTooltip> |
|
|
|
|
<NcButton |
|
|
|
|
v-if="!isNew && rowId && !isMobileMode" |
|
|
|
|
:disabled="isLoading" |
|
|
|
|
class="!<lg:hidden text-gray-700 !h-7 !px-2" |
|
|
|
|
type="text" |
|
|
|
|
size="xsmall" |
|
|
|
|
@click="copyRecordUrl()" |
|
|
|
|
> |
|
|
|
|
<div |
|
|
|
|
v-e="['c:row-expand:copy-url']" |
|
|
|
|
data-testid="nc-expanded-form-copy-url" |
|
|
|
|
class="flex gap-2 items-center text-small" |
|
|
|
|
<NcTooltip> |
|
|
|
|
<template #title> {{ isRecordLinkCopied ? $t('labels.copiedRecordURL') : $t('labels.copyRecordURL') }} </template> |
|
|
|
|
<NcButton |
|
|
|
|
v-if="!isNew && rowId && !isMobileMode" |
|
|
|
|
:disabled="isLoading" |
|
|
|
|
class="!<lg:hidden text-gray-700 !h-7 !w-7" |
|
|
|
|
type="text" |
|
|
|
|
size="xsmall" |
|
|
|
|
@click="copyRecordUrl()" |
|
|
|
|
> |
|
|
|
|
<component :is="iconMap.check" v-if="isRecordLinkCopied" class="cursor-pointer nc-duplicate-row" /> |
|
|
|
|
<component :is="iconMap.copy" v-else class="cursor-pointer nc-duplicate-row" /> |
|
|
|
|
{{ isRecordLinkCopied ? $t('labels.copiedRecordURL') : $t('labels.copyRecordURL') }} |
|
|
|
|
</div> |
|
|
|
|
</NcButton> |
|
|
|
|
<div v-e="['c:row-expand:copy-url']" data-testid="nc-expanded-form-copy-url" class="flex items-center"> |
|
|
|
|
<component :is="iconMap.check" v-if="isRecordLinkCopied" class="cursor-pointer nc-duplicate-row h-4 w-4" /> |
|
|
|
|
<component :is="iconMap.copy" v-else class="cursor-pointer nc-duplicate-row h-4 w-4" /> |
|
|
|
|
</div> |
|
|
|
|
</NcButton> |
|
|
|
|
</NcTooltip> |
|
|
|
|
<NcDropdown v-if="!isNew && rowId && !isMobileMode" placement="bottomRight"> |
|
|
|
|
<NcButton type="text" size="xsmall" class="nc-expand-form-more-actions !w-7 !h-7" :disabled="isLoading"> |
|
|
|
|
<GeneralIcon icon="threeDotVertical" class="text-md" :class="isLoading ? 'text-gray-300' : 'text-gray-700'" /> |
|
|
|
@ -871,7 +861,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
|
v-if="isUIAllowed('dataEdit')" |
|
|
|
|
class="w-full flex items-center justify-end px-2 py-[9px] xs:(p-0 gap-x-4 justify-between)" |
|
|
|
|
class="w-full flex items-center justify-end px-2 xs:(p-0 gap-x-4 justify-between)" |
|
|
|
|
:class="{ |
|
|
|
|
'xs(border-t-1 border-gray-200)': !isNew, |
|
|
|
|
}" |
|
|
|
@ -896,7 +886,7 @@ export default {
|
|
|
|
|
class="flex gap-2 items-center" |
|
|
|
|
data-testid="nc-expanded-form-copy-url" |
|
|
|
|
> |
|
|
|
|
<component :is="iconMap.link" class="cursor-pointer nc-duplicate-row" /> |
|
|
|
|
<component :is="iconMap.copy" class="cursor-pointer nc-duplicate-row" /> |
|
|
|
|
{{ $t('labels.copyRecordURL') }} |
|
|
|
|
</div> |
|
|
|
|
</NcMenuItem> |
|
|
|
|