d857cef5768a69bd038eb4c2b2a2235b2ee550ea221a751cb199dc6f37ad69e1.json 8.6 KB

1
  1. {"ast":null,"code":"\"use client\";\n\nimport React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useMessage from '../message/useMessage';\nimport useModal from '../modal/useModal';\nimport useNotification from '../notification/useNotification';\nimport AppContext, { AppConfigContext } from './context';\nimport useStyle from './style';\nconst App = props => {\n const {\n prefixCls: customizePrefixCls,\n children,\n className,\n rootClassName,\n message,\n notification,\n style,\n component = 'div'\n } = props;\n const {\n direction,\n getPrefixCls\n } = useContext(ConfigContext);\n const prefixCls = getPrefixCls('app', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const customClassName = classNames(hashId, prefixCls, className, rootClassName, cssVarCls, {\n [`${prefixCls}-rtl`]: direction === 'rtl'\n });\n const appConfig = useContext(AppConfigContext);\n const mergedAppConfig = React.useMemo(() => ({\n message: Object.assign(Object.assign({}, appConfig.message), message),\n notification: Object.assign(Object.assign({}, appConfig.notification), notification)\n }), [message, notification, appConfig.message, appConfig.notification]);\n const [messageApi, messageContextHolder] = useMessage(mergedAppConfig.message);\n const [notificationApi, notificationContextHolder] = useNotification(mergedAppConfig.notification);\n const [ModalApi, ModalContextHolder] = useModal();\n const memoizedContextValue = React.useMemo(() => ({\n message: messageApi,\n notification: notificationApi,\n modal: ModalApi\n }), [messageApi, notificationApi, ModalApi]);\n // https://github.com/ant-design/ant-design/issues/48802#issuecomment-2097813526\n devUseWarning('App')(!(cssVarCls && component === false), 'usage', 'When using cssVar, ensure `component` is assigned a valid React component string.');\n // ============================ Render ============================\n const Component = component === false ? React.Fragment : component;\n const rootProps = {\n className: customClassName,\n style\n };\n return wrapCSSVar(/*#__PURE__*/React.createElement(AppContext.Provider, {\n value: memoizedContextValue\n }, /*#__PURE__*/React.createElement(AppConfigContext.Provider, {\n value: mergedAppConfig\n }, /*#__PURE__*/React.createElement(Component, Object.assign({}, component === false ? undefined : rootProps), ModalContextHolder, messageContextHolder, notificationContextHolder, children))));\n};\nif (process.env.NODE_ENV !== 'production') {\n App.displayName = 'App';\n}\nexport default App;","map":{"version":3,"names":["React","useContext","classNames","devUseWarning","ConfigContext","useMessage","useModal","useNotification","AppContext","AppConfigContext","useStyle","App","props","prefixCls","customizePrefixCls","children","className","rootClassName","message","notification","style","component","direction","getPrefixCls","wrapCSSVar","hashId","cssVarCls","customClassName","appConfig","mergedAppConfig","useMemo","Object","assign","messageApi","messageContextHolder","notificationApi","notificationContextHolder","ModalApi","ModalContextHolder","memoizedContextValue","modal","Component","Fragment","rootProps","createElement","Provider","value","undefined","process","env","NODE_ENV","displayName"],"sources":["/Users/max_liu/max_liu/company/tools_auto_pt/node_modules/antd/es/app/App.js"],"sourcesContent":["\"use client\";\n\nimport React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useMessage from '../message/useMessage';\nimport useModal from '../modal/useModal';\nimport useNotification from '../notification/useNotification';\nimport AppContext, { AppConfigContext } from './context';\nimport useStyle from './style';\nconst App = props => {\n const {\n prefixCls: customizePrefixCls,\n children,\n className,\n rootClassName,\n message,\n notification,\n style,\n component = 'div'\n } = props;\n const {\n direction,\n getPrefixCls\n } = useContext(ConfigContext);\n const prefixCls = getPrefixCls('app', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const customClassName = classNames(hashId, prefixCls, className, rootClassName, cssVarCls, {\n [`${prefixCls}-rtl`]: direction === 'rtl'\n });\n const appConfig = useContext(AppConfigContext);\n const mergedAppConfig = React.useMemo(() => ({\n message: Object.assign(Object.assign({}, appConfig.message), message),\n notification: Object.assign(Object.assign({}, appConfig.notification), notification)\n }), [message, notification, appConfig.message, appConfig.notification]);\n const [messageApi, messageContextHolder] = useMessage(mergedAppConfig.message);\n const [notificationApi, notificationContextHolder] = useNotification(mergedAppConfig.notification);\n const [ModalApi, ModalContextHolder] = useModal();\n const memoizedContextValue = React.useMemo(() => ({\n message: messageApi,\n notification: notificationApi,\n modal: ModalApi\n }), [messageApi, notificationApi, ModalApi]);\n // https://github.com/ant-design/ant-design/issues/48802#issuecomment-2097813526\n devUseWarning('App')(!(cssVarCls && component === false), 'usage', 'When using cssVar, ensure `component` is assigned a valid React component string.');\n // ============================ Render ============================\n const Component = component === false ? React.Fragment : component;\n const rootProps = {\n className: customClassName,\n style\n };\n return wrapCSSVar(/*#__PURE__*/React.createElement(AppContext.Provider, {\n value: memoizedContextValue\n }, /*#__PURE__*/React.createElement(AppConfigContext.Provider, {\n value: mergedAppConfig\n }, /*#__PURE__*/React.createElement(Component, Object.assign({}, component === false ? undefined : rootProps), ModalContextHolder, messageContextHolder, notificationContextHolder, children))));\n};\nif (process.env.NODE_ENV !== 'production') {\n App.displayName = 'App';\n}\nexport default App;"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,QAAQ,MAAM,mBAAmB;AACxC,OAAOC,eAAe,MAAM,iCAAiC;AAC7D,OAAOC,UAAU,IAAIC,gBAAgB,QAAQ,WAAW;AACxD,OAAOC,QAAQ,MAAM,SAAS;AAC9B,MAAMC,GAAG,GAAGC,KAAK,IAAI;EACnB,MAAM;IACJC,SAAS,EAAEC,kBAAkB;IAC7BC,QAAQ;IACRC,SAAS;IACTC,aAAa;IACbC,OAAO;IACPC,YAAY;IACZC,KAAK;IACLC,SAAS,GAAG;EACd,CAAC,GAAGT,KAAK;EACT,MAAM;IACJU,SAAS;IACTC;EACF,CAAC,GAAGtB,UAAU,CAACG,aAAa,CAAC;EAC7B,MAAMS,SAAS,GAAGU,YAAY,C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