refactor: table column field provider optimize (#2312)
This commit is contained in:
		
							parent
							
								
									063d7ca693
								
							
						
					
					
						commit
						d8befa75c6
					
				@ -14,10 +14,23 @@ export const ColumnFieldProvider = observer(
 | 
				
			|||||||
      return buf;
 | 
					      return buf;
 | 
				
			||||||
    }, null);
 | 
					    }, null);
 | 
				
			||||||
    const collectionField = fieldSchema && getCollectionJoinField(fieldSchema['x-collection-field']);
 | 
					    const collectionField = fieldSchema && getCollectionJoinField(fieldSchema['x-collection-field']);
 | 
				
			||||||
    if (fieldSchema && record?.__collection && ['select', 'multipleSelect'].includes(collectionField?.interface)) {
 | 
					    if (
 | 
				
			||||||
 | 
					      fieldSchema &&
 | 
				
			||||||
 | 
					      record?.__collection &&
 | 
				
			||||||
 | 
					      collectionField &&
 | 
				
			||||||
 | 
					      ['select', 'multipleSelect'].includes(collectionField.interface)
 | 
				
			||||||
 | 
					    ) {
 | 
				
			||||||
      const fieldName = `${record.__collection}.${fieldSchema.name}`;
 | 
					      const fieldName = `${record.__collection}.${fieldSchema.name}`;
 | 
				
			||||||
      schema.properties[fieldSchema.name]['x-collection-field'] = fieldName;
 | 
					      const newSchema = {
 | 
				
			||||||
      return <RecursionField basePath={basePath} schema={schema} onlyRenderProperties />;
 | 
					        ...schema.toJSON(),
 | 
				
			||||||
 | 
					        properties: {
 | 
				
			||||||
 | 
					          [fieldSchema.name]: {
 | 
				
			||||||
 | 
					            ...fieldSchema.toJSON(),
 | 
				
			||||||
 | 
					            'x-collection-field': fieldName,
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					      return <RecursionField basePath={basePath} schema={newSchema} onlyRenderProperties />;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return props.children;
 | 
					    return props.children;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user