| 
									
										
										
										
											2025-05-22 17:39:39 +08:00
										 |  |  | import { generateZodSchema } from '@/app/components/base/form/form-scenarios/base/utils' | 
					
						
							|  |  |  | import { useConfigurations } from './hooks' | 
					
						
							| 
									
										
										
										
											2025-05-28 13:44:37 +08:00
										 |  |  | import Form from './form' | 
					
						
							| 
									
										
										
										
											2025-05-22 17:39:39 +08:00
										 |  |  | import Actions from './actions' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type ProcessDocumentsProps = { | 
					
						
							|  |  |  |   dataSourceNodeId: string | 
					
						
							| 
									
										
										
										
											2025-05-23 10:29:59 +08:00
										 |  |  |   ref: React.RefObject<any> | 
					
						
							|  |  |  |   onProcess: () => void | 
					
						
							|  |  |  |   onPreview: () => void | 
					
						
							|  |  |  |   onSubmit: (data: Record<string, any>) => void | 
					
						
							| 
									
										
										
										
											2025-05-22 17:39:39 +08:00
										 |  |  |   onBack: () => void | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const ProcessDocuments = ({ | 
					
						
							|  |  |  |   dataSourceNodeId, | 
					
						
							|  |  |  |   onProcess, | 
					
						
							| 
									
										
										
										
											2025-05-22 23:05:58 +08:00
										 |  |  |   onPreview, | 
					
						
							| 
									
										
										
										
											2025-05-23 10:29:59 +08:00
										 |  |  |   onSubmit, | 
					
						
							| 
									
										
										
										
											2025-05-22 17:39:39 +08:00
										 |  |  |   onBack, | 
					
						
							| 
									
										
										
										
											2025-05-23 10:29:59 +08:00
										 |  |  |   ref, | 
					
						
							| 
									
										
										
										
											2025-05-22 17:39:39 +08:00
										 |  |  | }: ProcessDocumentsProps) => { | 
					
						
							|  |  |  |   const { initialData, configurations } = useConfigurations(dataSourceNodeId) | 
					
						
							|  |  |  |   const schema = generateZodSchema(configurations) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return ( | 
					
						
							|  |  |  |     <div className='flex flex-col gap-y-4 pt-4'> | 
					
						
							| 
									
										
										
										
											2025-05-28 13:44:37 +08:00
										 |  |  |       <Form | 
					
						
							|  |  |  |         ref={ref} | 
					
						
							|  |  |  |         initialData={initialData} | 
					
						
							|  |  |  |         configurations={configurations} | 
					
						
							|  |  |  |         schema={schema} | 
					
						
							|  |  |  |         onSubmit={onSubmit} | 
					
						
							|  |  |  |         onPreview={onPreview} | 
					
						
							|  |  |  |       /> | 
					
						
							| 
									
										
										
										
											2025-05-23 10:29:59 +08:00
										 |  |  |       <Actions onBack={onBack} onProcess={onProcess} /> | 
					
						
							| 
									
										
										
										
											2025-05-22 17:39:39 +08:00
										 |  |  |     </div> | 
					
						
							|  |  |  |   ) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default ProcessDocuments |