(row, rowIndex)
| 407 | }; |
| 408 | |
| 409 | const renderRow = (row, rowIndex) => { |
| 410 | if (!Array.isArray(row)) { |
| 411 | console.warn(`[DynamicComponents] Invalid row at index ${rowIndex}`); |
| 412 | return null; |
| 413 | } |
| 414 | |
| 415 | return ( |
| 416 | <div key={`row-${rowIndex}`} className="dynamiccomponent-row"> |
| 417 | {row.map((component, index) => { |
| 418 | if (!component) return null; |
| 419 | |
| 420 | const componentKey = component.id || `component-${index}`; |
| 421 | const isSeparator = component.type === 'separator'; |
| 422 | |
| 423 | return ( |
| 424 | <React.Fragment key={componentKey}> |
| 425 | <div |
| 426 | className={cn(isSeparator ? 'w-full' : 'dynamiccomponent-component')} |
| 427 | style={!isSeparator ? { flex: component.flex || 1 } : undefined} |
| 428 | > |
| 429 | <ErrorBoundary> |
| 430 | <MemoizedComponent |
| 431 | component={component} |
| 432 | index={index} |
| 433 | handleUpdate={handleUpdate} |
| 434 | extractKeyProps={extractKeyProps} |
| 435 | /> |
| 436 | </ErrorBoundary> |
| 437 | </div> |
| 438 | {index < row.length - 1 && !isSeparator && ( |
| 439 | <div className="dynamiccomponent-separator" /> |
| 440 | )} |
| 441 | </React.Fragment> |
| 442 | ); |
| 443 | })} |
| 444 | </div> |
| 445 | ); |
| 446 | }; |
| 447 | |
| 448 | return ( |
| 449 | <div className="dynamiccomponent-container"> |
no test coverage detected