UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines 921 B
{"version":3,"file":"FormProvider.mjs","names":[],"sources":["../../../src/Form/components/FormProvider.tsx"],"sourcesContent":["'use client';\n\nimport { type FormProps } from 'antd';\nimport { createContext, memo, type ReactNode, use } from 'react';\n\ninterface FormContentConfig {\n form?: FormProps['form'];\n initialValues?: FormProps['initialValues'];\n submitLoading?: boolean;\n}\n\nexport const FormContext = createContext<FormContentConfig>({});\n\nexport const FormProvider = memo<{ children: ReactNode; config: FormContentConfig }>(\n ({ children, config }) => {\n return <FormContext value={config}>{children}</FormContext>;\n },\n);\n\nexport const useFormContext = () => {\n return use(FormContext);\n};\n"],"mappings":";;;;AAWA,MAAa,cAAc,cAAiC,CAAC,CAAC;AAE9D,MAAa,eAAe,MACzB,EAAE,UAAU,aAAa;CACxB,OAAO,oBAAC,aAAD;EAAa,OAAO;EAAS;CAAsB,CAAA;AAC5D,CACF;AAEA,MAAa,uBAAuB;CAClC,OAAO,IAAI,WAAW;AACxB"}