chore: rename theme separated to inherit

This commit is contained in:
MadCcc 2022-11-17 01:06:33 +08:00
parent c0de3b2737
commit a77f1aa8fc
5 changed files with 5 additions and 5 deletions

View File

@ -186,7 +186,7 @@ describe('ConfigProvider.Theme', () => {
};
render(
<ConfigProvider theme={{ token: { colorPrimary: '#1890ff' } }}>
<ConfigProvider theme={{ seperated: true }}>
<ConfigProvider theme={{ inherit: false }}>
<Demo />
</ConfigProvider>
</ConfigProvider>,

View File

@ -30,7 +30,7 @@ export interface ThemeConfig {
components?: OverrideToken;
algorithm?: MappingAlgorithm | MappingAlgorithm[];
hashed?: boolean;
seperated?: boolean;
inherit?: boolean;
}
export interface ConfigConsumerProps {

View File

@ -10,7 +10,7 @@ export default function useTheme(
): ThemeConfig | undefined {
const themeConfig = theme || {};
const parentThemeConfig: ThemeConfig =
themeConfig.seperated || !parentTheme ? defaultConfig : parentTheme;
themeConfig.inherit === false || !parentTheme ? defaultConfig : parentTheme;
const mergedTheme = useMemo<ThemeConfig | undefined>(
() => {

View File

@ -195,7 +195,7 @@ const theme = {
| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| token | Modify Design Token | `AliasToken` | - |
| seperated | Ignore theme configured in upper ConfigProvider | boolean | - |
| inherit | Inherit theme configured in upper ConfigProvider | boolean | true |
| algorithm | Modify the algorithms of theme | `(token: SeedToken) => MapToken` \| `((token: SeedToken) => MapToken)[]` | `defaultAlgorithm` |
| components | Modify Component Token and Alias Token applied to components | OverrideToken | - |

View File

@ -195,7 +195,7 @@ const theme = {
| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| token | 用于修改 Design Token | `AliasToken` | - |
| seperated | 隔离上层 ConfigProvider 中配置的主题。 | boolean | - |
| inherit | 继承上层 ConfigProvider 中配置的主题。 | boolean | true |
| algorithm | 用于修改 Seed Token 到 Map Token 的算法 | `(token: SeedToken) => MapToken` \| `((token: SeedToken) => MapToken)[]` | `defaultAlgorithm` |
| components | 用于修改各个组件的 Component Token 以及覆盖该组件消费的 Alias Token | OverrideToken | - |