@ -63,8 +63,6 @@ const isFirstRow = toRef(props, 'firstRow')
const route = useRoute ( )
const route = useRoute ( )
const router = useRouter ( )
const isPublic = inject ( IsPublicInj , ref ( false ) )
const isPublic = inject ( IsPublicInj , ref ( false ) )
/ / t o c h e c k i f a e x p a n d e d f o r m w h i c h i s n o t y e t s a v e d e x i s t o r n o t
/ / t o c h e c k i f a e x p a n d e d f o r m w h i c h i s n o t y e t s a v e d e x i s t o r n o t
@ -303,14 +301,20 @@ provide(ReloadRowDataHookInj, reloadHook)
if ( isKanban . value ) {
if ( isKanban . value ) {
/ / a d d i n g c o l u m n t i t l e s t o c h a n g e d C o l u m n s i f t h e y a r e p r e s e t
/ / a d d i n g c o l u m n t i t l e s t o c h a n g e d C o l u m n s i f t h e y a r e p r e s e t
if ( _row . value . rowMeta . new ) {
for ( const [ k , v ] of Object . entries ( _row . value . row ) ) {
for ( const [ k , v ] of Object . entries ( _row . value . row ) ) {
if ( v ) {
if ( v ) {
changedColumns . value . add ( k )
changedColumns . value . add ( k )
}
}
}
}
}
}
}
provide ( IsExpandedFormOpenInj , isExpanded )
provide ( IsExpandedFormOpenInj , isExpanded )
const triggerRowLoad = async ( rowId ? : string ) => {
await Promise . allSettled ( [ loadComments ( ) , loadAudits ( ) , _loadRow ( rowId ) ] )
}
const cellWrapperEl = ref ( )
const cellWrapperEl = ref ( )
onMounted ( async ( ) => {
onMounted ( async ( ) => {
@ -318,22 +322,15 @@ onMounted(async () => {
isLoading . value = true
isLoading . value = true
const focusFirstCell = ! isExpandedFormCommentMode . value
const focusFirstCell = ! isExpandedFormCommentMode . value
let isTriggered = false
if ( props . loadRow ) {
if ( props . loadRow && ! props . rowId ) {
await _loadRow ( )
await triggerRowLoad ( )
await Promise . all ( [ loadComments ( ) , loadAudits ( ) ] )
isTriggered = true
}
} else if ( props . rowId && props . loadRow && ! isTriggered ) {
await triggerRowLoad ( props . rowId )
if ( props . rowId ) {
} else {
try {
_row . value = props . row
await _loadRow ( props . rowId )
await Promise . all ( [ loadComments ( ) , loadAudits ( ) ] )
} catch ( e : any ) {
if ( e . response ? . status === 404 ) {
message . error ( t ( 'msg.noRecordFound' ) )
router . replace ( { query : { } } )
} else throw e
}
}
}
isLoading . value = false
isLoading . value = false
@ -401,7 +398,7 @@ useActiveKeyupListener(
; ( document . activeElement as HTMLInputElement ) ? . blur ? . ( )
; ( document . activeElement as HTMLInputElement ) ? . blur ? . ( )
if ( changedColumns . value . size > 0 ) {
if ( changedColumns . value . size > 0 ) {
await Modal . confirm ( {
Modal . confirm ( {
title : t ( 'msg.saveChanges' ) ,
title : t ( 'msg.saveChanges' ) ,
okText : t ( 'general.save' ) ,
okText : t ( 'general.save' ) ,
cancelText : t ( 'labels.discard' ) ,
cancelText : t ( 'labels.discard' ) ,
@ -415,7 +412,7 @@ useActiveKeyupListener(
} ,
} ,
} )
} )
} else if ( isNew . value ) {
} else if ( isNew . value ) {
await Modal . confirm ( {
Modal . confirm ( {
title : 'Do you want to save the record?' ,
title : 'Do you want to save the record?' ,
okText : t ( 'general.save' ) ,
okText : t ( 'general.save' ) ,
cancelText : t ( 'labels.discard' ) ,
cancelText : t ( 'labels.discard' ) ,
@ -458,8 +455,7 @@ const onConfirmDeleteRowClick = async () => {
}
}
watch ( rowId , async ( nRow ) => {
watch ( rowId , async ( nRow ) => {
await _loadRow ( nRow )
await triggerRowLoad ( nRow )
await Promise . all ( [ loadComments ( ) , loadAudits ( ) ] )
} )
} )
const showRightSections = computed ( ( ) => {
const showRightSections = computed ( ( ) => {