import { useField, useFieldSchema } from '@formily/react'; import { BlockProvider, FixedBlockWrapper, SchemaComponentOptions, useBlockRequestContext } from '@nocobase/client'; import React, { createContext, useContext, useEffect, useState } from 'react'; export const MapBlockContext = createContext({}); const InternalMapBlockProvider = (props) => { const { fieldNames } = props; const fieldSchema = useFieldSchema(); const field = useField(); const { resource, service } = useBlockRequestContext(); const [selectedRecordKeys, setSelectedRecordKeys] = useState([]); return ( {props.children} ); }; export const MapBlockProvider = (props) => { return ( ); }; export const useMapBlockContext = () => { return useContext(MapBlockContext); }; export const useMapBlockProps = () => { const ctx = useMapBlockContext(); return { ...ctx, dataSource: ctx?.service?.data?.data, zoom: ctx?.field?.componentProps?.zoom || 13, }; };