* refactor: kanban * refactor: gantt * refactor: map * refactor: calendar * refactor: compat * refactor: rename to createKanbanBlockUISchema * refactor(kanban): use x-use-component-props instead of useProps * refactor(Gantt): rename to createGanttBlockUISchema * refactor: use x-use-component-props instead of useProps * refactor: rename * refactor(Map): use x-use-component-props instead of useProps * refactor(Calendar): rename * refactor(Calendar): should not get collection on getting association in UISchema * refactor(Calendar): use x-use-component-props instead of useProps * chore: add comment * chore: fix unit test * fix: add scopes to fix e2e * fix(Calendar): add association property to CalendarBlockProvider decorator * test: add e2e for Calenndar
		
			
				
	
	
		
			23 lines
		
	
	
		
			919 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			919 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import {
 | ||
|   useCollection_deprecated,
 | ||
|   useCollectionManager_deprecated,
 | ||
|   useProps,
 | ||
|   withDynamicSchemaProps,
 | ||
| } from '@nocobase/client';
 | ||
| import React, { useMemo } from 'react';
 | ||
| import { MapBlockComponent } from '../components';
 | ||
| 
 | ||
| export const MapBlock = withDynamicSchemaProps((props) => {
 | ||
|   // 新版 UISchema(1.0 之后)中已经废弃了 useProps,这里之所以继续保留是为了兼容旧版的 UISchema
 | ||
|   const { fieldNames } = useProps(props);
 | ||
| 
 | ||
|   const { getCollectionJoinField } = useCollectionManager_deprecated();
 | ||
|   const { name } = useCollection_deprecated();
 | ||
|   const collectionField = useMemo(() => {
 | ||
|     return getCollectionJoinField([name, fieldNames?.field].flat().join('.'));
 | ||
|   }, [name, fieldNames?.field]);
 | ||
| 
 | ||
|   const fieldComponentProps = collectionField?.uiSchema?.['x-component-props'];
 | ||
|   return <MapBlockComponent {...fieldComponentProps} {...props} collectionField={collectionField} />;
 | ||
| });
 |