@ant-design/pro-provider
Advanced tools
Comparing version 2.0.7 to 2.0.8
import React from 'react'; | ||
import type { DeepPartial, ProTokenType } from './typing/layoutToken'; | ||
export * from './useStyle'; | ||
export { DeepPartial, ProTokenType }; | ||
export declare type ProSchemaValueEnumType = { | ||
@@ -132,3 +135,3 @@ /** @name 演示的文案 */ | ||
/** | ||
* 国际化的配置类型 | ||
* 自带的token 配置 | ||
*/ | ||
@@ -139,2 +142,3 @@ export declare type ConfigContextPropsType = { | ||
valueTypeMap: Record<string, ProRenderFieldPropsType>; | ||
token?: ProTokenType; | ||
}; | ||
@@ -141,0 +145,0 @@ declare const ConfigContext: React.Context<ConfigContextPropsType>; |
@@ -32,2 +32,5 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import zhTW from './locale/zh_TW'; | ||
import { getLayoutDesignToken } from './typing/layoutToken'; | ||
import { merge } from './utils/merge'; | ||
export * from './useStyle'; | ||
var _ref = theme || { | ||
@@ -188,7 +191,8 @@ useToken: function useToken() { | ||
_ref2$autoClearCache = _ref2.autoClearCache, | ||
autoClearCache = _ref2$autoClearCache === void 0 ? false : _ref2$autoClearCache; | ||
autoClearCache = _ref2$autoClearCache === void 0 ? false : _ref2$autoClearCache, | ||
propsToken = _ref2.token; | ||
var _useContext = useContext(AntdConfigProvider.ConfigContext), | ||
locale = _useContext.locale, | ||
getPrefixCls = _useContext.getPrefixCls; | ||
var token = useToken === null || useToken === void 0 ? void 0 : useToken(); | ||
var tokenContext = useToken === null || useToken === void 0 ? void 0 : useToken(); | ||
// 如果 locale 不存在自动注入的 AntdConfigProvider | ||
@@ -198,3 +202,3 @@ var Provider = locale === undefined ? AntdConfigProvider : React.Fragment; | ||
var proProvideValue = useMemo(function () { | ||
var _proProvide$intl; | ||
var _proProvide$intl, _proProvide$token; | ||
var localeName = locale === null || locale === void 0 ? void 0 : locale.locale; | ||
@@ -204,7 +208,15 @@ var key = findIntlKeyByAntdLocaleKey(localeName); | ||
var intl = localeName && ((_proProvide$intl = proProvide.intl) === null || _proProvide$intl === void 0 ? void 0 : _proProvide$intl.locale) === 'default' ? intlMap[key] : proProvide.intl || intlMap[key]; | ||
return _objectSpread(_objectSpread({}, proProvide), {}, { | ||
/** | ||
* 合并一下token,不然导致嵌套 token 失效 | ||
*/ | ||
var proLayoutTokenMerge = merge(((_proProvide$token = proProvide.token) === null || _proProvide$token === void 0 ? void 0 : _proProvide$token.layout) || {}, getLayoutDesignToken((propsToken === null || propsToken === void 0 ? void 0 : propsToken.layout) || {}, tokenContext.token)); | ||
return _objectSpread(_objectSpread({ | ||
token: _objectSpread(_objectSpread({}, proProvide.token), {}, { | ||
layout: proLayoutTokenMerge | ||
}) | ||
}, proProvide), {}, { | ||
isDeps: true, | ||
intl: intl || zhCNIntl | ||
}); | ||
}, [locale === null || locale === void 0 ? void 0 : locale.locale, proProvide]); | ||
}, [locale === null || locale === void 0 ? void 0 : locale.locale, proProvide, tokenContext, propsToken]); | ||
var configProviderDom = useMemo(function () { | ||
@@ -229,6 +241,6 @@ var _process$env$NODE_ENV; | ||
return _jsx("div", { | ||
className: "".concat((getPrefixCls === null || getPrefixCls === void 0 ? void 0 : getPrefixCls('pro')) || 'ant-pro', " ").concat(token.hashId), | ||
className: "".concat((getPrefixCls === null || getPrefixCls === void 0 ? void 0 : getPrefixCls('pro')) || 'ant-pro', " ").concat(tokenContext.hashId), | ||
children: provide | ||
}); | ||
}, [Provider, autoClearCache, children, getPrefixCls, locale, proProvide.isDeps, proProvideValue, token.hashId]); | ||
}, [Provider, autoClearCache, children, getPrefixCls, locale, proProvide.isDeps, proProvideValue, tokenContext.hashId]); | ||
if (!autoClearCache) return configProviderDom; | ||
@@ -235,0 +247,0 @@ return _jsx(SWRConfig, { |
{ | ||
"name": "@ant-design/pro-provider", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "@ant-design/pro-provider", | ||
@@ -31,3 +31,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@ant-design/cssinjs": "^0.0.0-alpha.38", | ||
"@babel/runtime": "^7.18.0", | ||
"@ctrl/tinycolor": "^3.4.0", | ||
"rc-util": "^5.0.1", | ||
@@ -34,0 +36,0 @@ "swr": "^1.2.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175791
58
6637
8
+ Added@ctrl/tinycolor@^3.4.0
+ Added@ant-design/cssinjs@0.0.0-alpha.60(transitive)