mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
commit
1ad266f7bf
@ -1,6 +1,6 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import { TinyColor, type ColorInput } from '@ctrl/tinycolor';
|
import { TinyColor, type ColorInput } from '@ctrl/tinycolor';
|
||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
|
import * as React from 'react';
|
||||||
import useSiteToken from '../../../hooks/useSiteToken';
|
import useSiteToken from '../../../hooks/useSiteToken';
|
||||||
|
|
||||||
interface ColorChunkProps {
|
interface ColorChunkProps {
|
||||||
@ -23,7 +23,7 @@ const useStyle = () => {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 6px;
|
width: 6px;
|
||||||
height: 6px;
|
height: 6px;
|
||||||
border-radius: ${token.borderRadiusSM}px;
|
border-radius: 50%;
|
||||||
margin-inline-end: 4px;
|
margin-inline-end: 4px;
|
||||||
border: 1px solid ${token.colorSplit};
|
border: 1px solid ${token.colorSplit};
|
||||||
`,
|
`,
|
||||||
|
@ -17,12 +17,16 @@ const locales = {
|
|||||||
description: '描述',
|
description: '描述',
|
||||||
type: '类型',
|
type: '类型',
|
||||||
value: '默认值',
|
value: '默认值',
|
||||||
|
componentToken: '组件 Token',
|
||||||
|
globalToken: '全局 Token',
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
token: 'Token Name',
|
token: 'Token Name',
|
||||||
description: 'Description',
|
description: 'Description',
|
||||||
type: 'Type',
|
type: 'Type',
|
||||||
value: 'Default Value',
|
value: 'Default Value',
|
||||||
|
componentToken: 'Component Token',
|
||||||
|
globalToken: 'Global Token',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -48,9 +52,10 @@ interface SubTokenTableProps {
|
|||||||
defaultOpen?: boolean;
|
defaultOpen?: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
tokens: string[];
|
tokens: string[];
|
||||||
|
component?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SubTokenTable: React.FC<SubTokenTableProps> = ({ defaultOpen, tokens, title }) => {
|
const SubTokenTable: React.FC<SubTokenTableProps> = ({ defaultOpen, tokens, title, component }) => {
|
||||||
const [, lang] = useLocale(locales);
|
const [, lang] = useLocale(locales);
|
||||||
const { token } = useSiteToken();
|
const { token } = useSiteToken();
|
||||||
const columns = useColumns();
|
const columns = useColumns();
|
||||||
@ -64,22 +69,28 @@ const SubTokenTable: React.FC<SubTokenTableProps> = ({ defaultOpen, tokens, titl
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = tokens
|
const data = tokens
|
||||||
.sort((token1, token2) => {
|
.sort(
|
||||||
const hasColor1 = token1.toLowerCase().includes('color');
|
component
|
||||||
const hasColor2 = token2.toLowerCase().includes('color');
|
? undefined
|
||||||
|
: (token1, token2) => {
|
||||||
|
const hasColor1 = token1.toLowerCase().includes('color');
|
||||||
|
const hasColor2 = token2.toLowerCase().includes('color');
|
||||||
|
|
||||||
if (hasColor1 && !hasColor2) {
|
if (hasColor1 && !hasColor2) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasColor1 && hasColor2) {
|
if (!hasColor1 && hasColor2) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return token1 < token2 ? -1 : 1;
|
return token1 < token2 ? -1 : 1;
|
||||||
})
|
},
|
||||||
|
)
|
||||||
.map((name) => {
|
.map((name) => {
|
||||||
const meta = tokenMeta[name];
|
const meta = component
|
||||||
|
? tokenMeta.components[component].find((item) => item.token === name)
|
||||||
|
: tokenMeta.global[name];
|
||||||
|
|
||||||
if (!meta) {
|
if (!meta) {
|
||||||
return null;
|
return null;
|
||||||
@ -89,7 +100,7 @@ const SubTokenTable: React.FC<SubTokenTableProps> = ({ defaultOpen, tokens, titl
|
|||||||
name,
|
name,
|
||||||
desc: lang === 'cn' ? meta.desc : meta.descEn,
|
desc: lang === 'cn' ? meta.desc : meta.descEn,
|
||||||
type: meta.type,
|
type: meta.type,
|
||||||
value: defaultToken[name],
|
value: component ? tokenData[component].component[name] : defaultToken[name],
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
@ -122,28 +133,31 @@ export interface ComponentTokenTableProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ComponentTokenTable: React.FC<ComponentTokenTableProps> = ({ component }) => {
|
const ComponentTokenTable: React.FC<ComponentTokenTableProps> = ({ component }) => {
|
||||||
|
const [locale] = useLocale(locales);
|
||||||
const [mergedGlobalTokens] = useMemo(() => {
|
const [mergedGlobalTokens] = useMemo(() => {
|
||||||
const globalTokenSet = new Set<string>();
|
const globalTokenSet = new Set<string>();
|
||||||
let componentTokens: Record<string, string> = {};
|
|
||||||
|
|
||||||
component.split(',').forEach((comp) => {
|
component.split(',').forEach((comp) => {
|
||||||
const { global: globalTokens = [], component: singleComponentTokens = [] } =
|
const { global: globalTokens = [] } = tokenData[comp] || {};
|
||||||
tokenData[comp] || {};
|
|
||||||
|
|
||||||
globalTokens.forEach((token: string) => {
|
globalTokens.forEach((token: string) => {
|
||||||
globalTokenSet.add(token);
|
globalTokenSet.add(token);
|
||||||
});
|
});
|
||||||
|
|
||||||
componentTokens = {
|
|
||||||
...componentTokens,
|
|
||||||
...singleComponentTokens,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return [Array.from(globalTokenSet), componentTokens] as const;
|
return [Array.from(globalTokenSet)] as const;
|
||||||
}, [component]);
|
}, [component]);
|
||||||
|
|
||||||
return <SubTokenTable title="Global Token" tokens={mergedGlobalTokens} />;
|
return (
|
||||||
|
<>
|
||||||
|
<SubTokenTable
|
||||||
|
title={locale.componentToken}
|
||||||
|
tokens={tokenMeta.components[component].map((item) => item.token)}
|
||||||
|
component={component}
|
||||||
|
/>
|
||||||
|
<SubTokenTable title={locale.globalToken} tokens={mergedGlobalTokens} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(ComponentTokenTable);
|
export default React.memo(ComponentTokenTable);
|
||||||
|
@ -98,7 +98,7 @@ const TokenTable: FC<TokenTableProps> = ({ type }) => {
|
|||||||
|
|
||||||
const data = React.useMemo<TokenData[]>(
|
const data = React.useMemo<TokenData[]>(
|
||||||
() =>
|
() =>
|
||||||
Object.entries(tokenMeta)
|
Object.entries(tokenMeta.global)
|
||||||
.filter(([, meta]) => meta.source === type)
|
.filter(([, meta]) => meta.source === type)
|
||||||
.map(([token, meta]) => ({
|
.map(([token, meta]) => ({
|
||||||
name: token,
|
name: token,
|
||||||
|
@ -4,12 +4,20 @@ const path = require('path');
|
|||||||
|
|
||||||
const blogList = [
|
const blogList = [
|
||||||
'check-conduct',
|
'check-conduct',
|
||||||
|
'contributor-development-maintenance-guide',
|
||||||
'css-in-js',
|
'css-in-js',
|
||||||
|
'extract-ssr',
|
||||||
'getContainer',
|
'getContainer',
|
||||||
|
'github-actions-workflow',
|
||||||
|
'issue-helper',
|
||||||
|
'mock-project-build',
|
||||||
'modal-hook-order',
|
'modal-hook-order',
|
||||||
'render-times',
|
|
||||||
'testing-migrate',
|
'testing-migrate',
|
||||||
|
'render-times',
|
||||||
'to-be-collaborator',
|
'to-be-collaborator',
|
||||||
|
'tooltip-align',
|
||||||
|
'tree-shaking',
|
||||||
|
'why-not-static',
|
||||||
].map((blogName) => path.join(__dirname, `../../docs/blog/${blogName}.en-US.md`));
|
].map((blogName) => path.join(__dirname, `../../docs/blog/${blogName}.en-US.md`));
|
||||||
|
|
||||||
describe('blog', () => {
|
describe('blog', () => {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import type { AnyObject } from './type';
|
||||||
|
|
||||||
export const { isValidElement } = React;
|
export const { isValidElement } = React;
|
||||||
|
|
||||||
@ -6,8 +7,6 @@ export function isFragment(child: any): boolean {
|
|||||||
return child && isValidElement(child) && child.type === React.Fragment;
|
return child && isValidElement(child) && child.type === React.Fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
type AnyObject = Record<PropertyKey, any>;
|
|
||||||
|
|
||||||
type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | void);
|
type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | void);
|
||||||
|
|
||||||
export function replaceElement(
|
export function replaceElement(
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
||||||
export type LiteralUnion<T extends string> = T | (string & {});
|
export type LiteralUnion<T extends string> = T | (string & {});
|
||||||
|
|
||||||
|
export type AnyObject = Record<PropertyKey, any>;
|
||||||
|
@ -4,7 +4,15 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 链接横向内间距
|
||||||
|
* @descEN Link horizontal padding
|
||||||
|
*/
|
||||||
linkPaddingBlock: number;
|
linkPaddingBlock: number;
|
||||||
|
/**
|
||||||
|
* @desc 链接纵向内间距
|
||||||
|
* @descEN Link vertical padding
|
||||||
|
*/
|
||||||
linkPaddingInlineStart: number;
|
linkPaddingInlineStart: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,14 +4,50 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 头像背景色
|
||||||
|
* @descEN Background color of Avatar
|
||||||
|
*/
|
||||||
containerSize: number;
|
containerSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 大号头像尺寸
|
||||||
|
* @descEN Size of large Avatar
|
||||||
|
*/
|
||||||
containerSizeLG: number;
|
containerSizeLG: number;
|
||||||
|
/**
|
||||||
|
* @desc 小号头像尺寸
|
||||||
|
* @descEN Size of small Avatar
|
||||||
|
*/
|
||||||
containerSizeSM: number;
|
containerSizeSM: number;
|
||||||
|
/**
|
||||||
|
* @desc 头像文字大小
|
||||||
|
* @descEN Font size of Avatar
|
||||||
|
*/
|
||||||
textFontSize: number;
|
textFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 大号头像文字大小
|
||||||
|
* @descEN Font size of large Avatar
|
||||||
|
*/
|
||||||
textFontSizeLG: number;
|
textFontSizeLG: number;
|
||||||
|
/**
|
||||||
|
* @desc 小号头像文字大小
|
||||||
|
* @descEN Font size of small Avatar
|
||||||
|
*/
|
||||||
textFontSizeSM: number;
|
textFontSizeSM: number;
|
||||||
|
/**
|
||||||
|
* @desc 头像组间距
|
||||||
|
* @descEN Spacing between avatars in a group
|
||||||
|
*/
|
||||||
groupSpace: number;
|
groupSpace: number;
|
||||||
|
/**
|
||||||
|
* @desc 头像组重叠宽度
|
||||||
|
* @descEN Overlapping of avatars in a group
|
||||||
|
*/
|
||||||
groupOverlapping: number;
|
groupOverlapping: number;
|
||||||
|
/**
|
||||||
|
* @desc 头像组边框颜色
|
||||||
|
* @descEN Border color of avatars in a group
|
||||||
|
*/
|
||||||
groupBorderColor: string;
|
groupBorderColor: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,40 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 面包屑项文字颜色
|
||||||
|
* @descEN Text color of Breadcrumb item
|
||||||
|
*/
|
||||||
itemColor: string;
|
itemColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 图标大小
|
||||||
|
* @descEN Icon size
|
||||||
|
*/
|
||||||
iconFontSize: number;
|
iconFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 链接文字颜色
|
||||||
|
* @descEN Text color of link
|
||||||
|
*/
|
||||||
linkColor: string;
|
linkColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 链接文字悬浮颜色
|
||||||
|
* @descEN Color of hovered link
|
||||||
|
*/
|
||||||
linkHoverColor: string;
|
linkHoverColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 最后一项文字颜色
|
||||||
|
* @descEN Text color of the last item
|
||||||
|
*/
|
||||||
lastItemColor: string;
|
lastItemColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 分隔符外间距
|
||||||
|
* @descEN Margin of separator
|
||||||
|
*/
|
||||||
separatorMargin: number;
|
separatorMargin: number;
|
||||||
|
/**
|
||||||
|
* @desc 分隔符颜色
|
||||||
|
* @descEN Color of separator
|
||||||
|
*/
|
||||||
separatorColor: string;
|
separatorColor: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,11 +8,35 @@ import type { FullToken } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 年选择器宽度
|
||||||
|
* @descEN Width of year select
|
||||||
|
*/
|
||||||
yearControlWidth: number;
|
yearControlWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 月选择器宽度
|
||||||
|
* @descEN Width of month select
|
||||||
|
*/
|
||||||
monthControlWidth: number;
|
monthControlWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 迷你日历内容高度
|
||||||
|
* @descEN Height of mini calendar content
|
||||||
|
*/
|
||||||
miniContentHeight: number;
|
miniContentHeight: number;
|
||||||
|
/**
|
||||||
|
* @desc 完整日历背景色
|
||||||
|
* @descEN Background color of full calendar
|
||||||
|
*/
|
||||||
fullBg: string;
|
fullBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 完整日历面板背景色
|
||||||
|
* @descEN Background color of full calendar panel
|
||||||
|
*/
|
||||||
fullPanelBg: string;
|
fullPanelBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 日期项选中背景色
|
||||||
|
* @descEN Background color of selected date item
|
||||||
|
*/
|
||||||
itemActiveBg: string;
|
itemActiveBg: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,14 +5,50 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 卡片头部背景色
|
||||||
|
* @descEN Background color of card header
|
||||||
|
*/
|
||||||
headerBg: string;
|
headerBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 卡片头部文字大小
|
||||||
|
* @descEN Font size of card header
|
||||||
|
*/
|
||||||
headerFontSize: number;
|
headerFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 小号卡片头部文字大小
|
||||||
|
* @descEN Font size of small card header
|
||||||
|
*/
|
||||||
headerFontSizeSM: number;
|
headerFontSizeSM: number;
|
||||||
|
/**
|
||||||
|
* @desc 卡片头部高度
|
||||||
|
* @descEN Height of card header
|
||||||
|
*/
|
||||||
headerHeight: number;
|
headerHeight: number;
|
||||||
|
/**
|
||||||
|
* @desc 小号卡片头部高度
|
||||||
|
* @descEN Height of small card header
|
||||||
|
*/
|
||||||
headerHeightSM: number;
|
headerHeightSM: number;
|
||||||
|
/**
|
||||||
|
* @desc 操作区背景色
|
||||||
|
* @descEN Background color of card actions
|
||||||
|
*/
|
||||||
actionsBg: string;
|
actionsBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 操作区每一项的外间距
|
||||||
|
* @descEN Margin of each item in card actions
|
||||||
|
*/
|
||||||
actionsLiMargin: string;
|
actionsLiMargin: string;
|
||||||
|
/**
|
||||||
|
* @desc 内置标签页组件下间距
|
||||||
|
* @descEN Margin bottom of tabs component
|
||||||
|
*/
|
||||||
tabsMarginBottom: number;
|
tabsMarginBottom: number;
|
||||||
|
/**
|
||||||
|
* @desc 额外区文字颜色
|
||||||
|
* @descEN Text color of extra area
|
||||||
|
*/
|
||||||
extraColor: string;
|
extraColor: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,22 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 指示点宽度
|
||||||
|
* @descEN Width of indicator
|
||||||
|
*/
|
||||||
dotWidth: number;
|
dotWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 指示点高度
|
||||||
|
* @descEN Height of indicator
|
||||||
|
*/
|
||||||
dotHeight: number;
|
dotHeight: number;
|
||||||
/** @deprecated Use `dotActiveWidth` instead. */
|
/** @deprecated Use `dotActiveWidth` instead. */
|
||||||
dotWidthActive: number;
|
dotWidthActive: number;
|
||||||
|
/**
|
||||||
|
* @desc 激活态指示点宽度
|
||||||
|
* @descEN Width of active indicator
|
||||||
|
*/
|
||||||
dotActiveWidth: number;
|
dotActiveWidth: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,24 @@
|
|||||||
import { getStyle as getCheckboxStyle } from '../../checkbox/style';
|
import { getStyle as getCheckboxStyle } from '../../checkbox/style';
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|
||||||
import { genComponentStyleHook } from '../../theme/internal';
|
|
||||||
import { textEllipsis } from '../../style';
|
import { textEllipsis } from '../../style';
|
||||||
import { genCompactItemStyle } from '../../style/compact-item';
|
import { genCompactItemStyle } from '../../style/compact-item';
|
||||||
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||||
|
import { genComponentStyleHook } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 选择器宽度
|
||||||
|
* @descEN Width of Cascader
|
||||||
|
*/
|
||||||
controlWidth: number;
|
controlWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 选项宽度
|
||||||
|
* @descEN Width of item
|
||||||
|
*/
|
||||||
controlItemWidth: number;
|
controlItemWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 下拉菜单高度
|
||||||
|
* @descEN Height of dropdown
|
||||||
|
*/
|
||||||
dropdownHeight: number;
|
dropdownHeight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,8 +23,20 @@ import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|||||||
import type { TokenWithCommonCls } from '../../theme/util/genComponentStyleHook';
|
import type { TokenWithCommonCls } from '../../theme/util/genComponentStyleHook';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 预设区域宽度
|
||||||
|
* @descEN Width of preset area
|
||||||
|
*/
|
||||||
presetsWidth: number;
|
presetsWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 预设区域最大宽度
|
||||||
|
* @descEN Max width of preset area
|
||||||
|
*/
|
||||||
presetsMaxWidth: number;
|
presetsMaxWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 弹窗 z-index
|
||||||
|
* @descEN z-index of popup
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,11 +6,35 @@ import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
// Component token here
|
// Component token here
|
||||||
|
/**
|
||||||
|
* @desc 标签背景色
|
||||||
|
* @descEN Background color of label
|
||||||
|
*/
|
||||||
labelBg: string;
|
labelBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 标题下间距
|
||||||
|
* @descEN Bottom margin of title
|
||||||
|
*/
|
||||||
titleMarginBottom: number;
|
titleMarginBottom: number;
|
||||||
|
/**
|
||||||
|
* @desc 子项下间距
|
||||||
|
* @descEN Bottom padding of item
|
||||||
|
*/
|
||||||
itemPaddingBottom: number;
|
itemPaddingBottom: number;
|
||||||
|
/**
|
||||||
|
* @desc 分号右间距
|
||||||
|
* @descEN Right margin of colon
|
||||||
|
*/
|
||||||
colonMarginRight: number;
|
colonMarginRight: number;
|
||||||
|
/**
|
||||||
|
* @desc 分号左间距
|
||||||
|
* @descEN Left margin of colon
|
||||||
|
*/
|
||||||
colonMarginLeft: number;
|
colonMarginLeft: number;
|
||||||
|
/**
|
||||||
|
* @desc 额外区域文字颜色
|
||||||
|
* @descEN Text color of extra area
|
||||||
|
*/
|
||||||
extraColor: string;
|
extraColor: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,20 @@ import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|||||||
import genMotionStyle from './motion';
|
import genMotionStyle from './motion';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 弹窗 z-index
|
||||||
|
* @descEN z-index of drawer
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
|
/**
|
||||||
|
* @desc 底部区域横向内间距
|
||||||
|
* @descEN Horizontal padding of footer
|
||||||
|
*/
|
||||||
footerPaddingBlock: number;
|
footerPaddingBlock: number;
|
||||||
|
/**
|
||||||
|
* @desc 底部区域纵向内间距
|
||||||
|
* @descEN Vertical padding of footer
|
||||||
|
*/
|
||||||
footerPaddingInline: number;
|
footerPaddingInline: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,10 @@ import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|||||||
import genStatusStyle from './status';
|
import genStatusStyle from './status';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 下拉菜单 z-index
|
||||||
|
* @descEN z-index of dropdown
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,9 +7,25 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 预览浮层 z-index
|
||||||
|
* @descEN z-index of preview popup
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
|
/**
|
||||||
|
* @desc 预览操作图标大小
|
||||||
|
* @descEN Size of preview operation icon
|
||||||
|
*/
|
||||||
previewOperationSize: number;
|
previewOperationSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 预览操作图标颜色
|
||||||
|
* @descEN Color of preview operation icon
|
||||||
|
*/
|
||||||
previewOperationColor: string;
|
previewOperationColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 预览操作图标禁用颜色
|
||||||
|
* @descEN Disabled color of preview operation icon
|
||||||
|
*/
|
||||||
previewOperationColorDisabled: string;
|
previewOperationColorDisabled: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,10 +15,26 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook } from '../../theme/internal';
|
import { genComponentStyleHook } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 输入框宽度
|
||||||
|
* @descEN Width of input
|
||||||
|
*/
|
||||||
controlWidth: number;
|
controlWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 操作按钮宽度
|
||||||
|
* @descEN Width of control button
|
||||||
|
*/
|
||||||
handleWidth: number;
|
handleWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 操作按钮图标大小
|
||||||
|
* @descEN Icon size of control button
|
||||||
|
*/
|
||||||
handleFontSize: number;
|
handleFontSize: number;
|
||||||
/** Default `auto`. Set `true` will always show the handle */
|
/**
|
||||||
|
* Default `auto`. Set `true` will always show the handle
|
||||||
|
* @desc 操作按钮可见性
|
||||||
|
* @descEN Handle visible
|
||||||
|
*/
|
||||||
handleVisible: 'auto' | true;
|
handleVisible: 'auto' | true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,16 +5,60 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 内容宽度
|
||||||
|
* @descEN Width of content
|
||||||
|
*/
|
||||||
contentWidth: number;
|
contentWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 大号列表项内间距
|
||||||
|
* @descEN Padding of large item
|
||||||
|
*/
|
||||||
itemPaddingLG: string;
|
itemPaddingLG: string;
|
||||||
|
/**
|
||||||
|
* @desc 小号列表项内间距
|
||||||
|
* @descEN Padding of small item
|
||||||
|
*/
|
||||||
itemPaddingSM: string;
|
itemPaddingSM: string;
|
||||||
|
/**
|
||||||
|
* @desc 列表项内间距
|
||||||
|
* @descEN Padding of item
|
||||||
|
*/
|
||||||
itemPadding: string;
|
itemPadding: string;
|
||||||
|
/**
|
||||||
|
* @desc 头部区域背景色
|
||||||
|
* @descEN Background color of header
|
||||||
|
*/
|
||||||
headerBg: string;
|
headerBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 底部区域背景色
|
||||||
|
* @descEN Background color of footer
|
||||||
|
*/
|
||||||
footerBg: string;
|
footerBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 空文本内边距
|
||||||
|
* @descEN Padding of empty text
|
||||||
|
*/
|
||||||
emptyTextPadding: CSSProperties['padding'];
|
emptyTextPadding: CSSProperties['padding'];
|
||||||
|
/**
|
||||||
|
* @desc Meta 下间距
|
||||||
|
* @descEN Margin bottom of meta
|
||||||
|
*/
|
||||||
metaMarginBottom: CSSProperties['marginBottom'];
|
metaMarginBottom: CSSProperties['marginBottom'];
|
||||||
|
/**
|
||||||
|
* @desc 头像右间距
|
||||||
|
* @descEN Right margin of avatar
|
||||||
|
*/
|
||||||
avatarMarginRight: CSSProperties['marginRight'];
|
avatarMarginRight: CSSProperties['marginRight'];
|
||||||
|
/**
|
||||||
|
* @desc 标题下间距
|
||||||
|
* @descEN Margin bottom of title
|
||||||
|
*/
|
||||||
titleMarginBottom: CSSProperties['marginBottom'];
|
titleMarginBottom: CSSProperties['marginBottom'];
|
||||||
|
/**
|
||||||
|
* @desc 描述文字大小
|
||||||
|
* @descEN Font size of description
|
||||||
|
*/
|
||||||
descriptionFontSize: number;
|
descriptionFontSize: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,13 +7,25 @@ import {
|
|||||||
genStatusStyle,
|
genStatusStyle,
|
||||||
initInputToken,
|
initInputToken,
|
||||||
} from '../../input/style';
|
} from '../../input/style';
|
||||||
|
import { resetComponent, textEllipsis } from '../../style';
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||||
import { genComponentStyleHook } from '../../theme/internal';
|
import { genComponentStyleHook } from '../../theme/internal';
|
||||||
import { resetComponent, textEllipsis } from '../../style';
|
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 弹层 z-index
|
||||||
|
* @descEN z-index of popup
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
|
/**
|
||||||
|
* @desc 弹层高度
|
||||||
|
* @descEN Height of popup
|
||||||
|
*/
|
||||||
dropdownHeight: number;
|
dropdownHeight: number;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项高度
|
||||||
|
* @descEN Height of menu item
|
||||||
|
*/
|
||||||
controlItemWidth: number;
|
controlItemWidth: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,112 +11,223 @@ import getVerticalStyle from './vertical';
|
|||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 弹出菜单的宽度
|
||||||
|
* @descEN Width of popup menu
|
||||||
|
*/
|
||||||
dropdownWidth: number;
|
dropdownWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 弹出菜单的 z-index
|
||||||
|
* @descEN z-index of popup menu
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
|
|
||||||
// Group
|
// Group
|
||||||
/** @deprecated Use `groupTitleColor` instead */
|
/** @deprecated Use `groupTitleColor` instead */
|
||||||
colorGroupTitle: string;
|
colorGroupTitle: string;
|
||||||
|
/**
|
||||||
|
* @desc 分组标题文字颜色
|
||||||
|
* @descEN Color of group title text
|
||||||
|
*/
|
||||||
groupTitleColor: string;
|
groupTitleColor: string;
|
||||||
|
|
||||||
// radius
|
// radius
|
||||||
/** @deprecated Use `itemBorderRadius` instead */
|
/** @deprecated Use `itemBorderRadius` instead */
|
||||||
radiusItem: number;
|
radiusItem: number;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项的圆角
|
||||||
|
* @descEN Radius of menu item
|
||||||
|
*/
|
||||||
itemBorderRadius: number;
|
itemBorderRadius: number;
|
||||||
|
|
||||||
/** @deprecated Use `subMenuItemBorderRadius` instead */
|
/** @deprecated Use `subMenuItemBorderRadius` instead */
|
||||||
radiusSubMenuItem: number;
|
radiusSubMenuItem: number;
|
||||||
|
/**
|
||||||
|
* @desc 子菜单项的圆角
|
||||||
|
* @descEN Radius of sub-menu item
|
||||||
|
*/
|
||||||
subMenuItemBorderRadius: number;
|
subMenuItemBorderRadius: number;
|
||||||
|
|
||||||
// Item Text
|
// Item Text
|
||||||
// > Default
|
// > Default
|
||||||
/** @deprecated Use `itemColor` instead */
|
/** @deprecated Use `itemColor` instead */
|
||||||
colorItemText: string;
|
colorItemText: string;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项文字颜色
|
||||||
|
* @descEN Color of menu item text
|
||||||
|
*/
|
||||||
itemColor: string;
|
itemColor: string;
|
||||||
|
|
||||||
/** @deprecated Use `itemHoverColor` instead */
|
/** @deprecated Use `itemHoverColor` instead */
|
||||||
colorItemTextHover: string;
|
colorItemTextHover: string;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项文字悬浮颜色
|
||||||
|
* @descEN Hover color of menu item text
|
||||||
|
*/
|
||||||
itemHoverColor: string;
|
itemHoverColor: string;
|
||||||
|
|
||||||
/** @deprecated Use `horizontalItemHoverColor` instead */
|
/** @deprecated Use `horizontalItemHoverColor` instead */
|
||||||
colorItemTextHoverHorizontal: string;
|
colorItemTextHoverHorizontal: string;
|
||||||
|
/**
|
||||||
|
* @desc 水平菜单项文字悬浮颜色
|
||||||
|
* @descEN Hover color of horizontal menu item text
|
||||||
|
*/
|
||||||
horizontalItemHoverColor: string;
|
horizontalItemHoverColor: string;
|
||||||
|
|
||||||
/** @deprecated Use `itemSelectedColor` instead */
|
/** @deprecated Use `itemSelectedColor` instead */
|
||||||
colorItemTextSelected: string;
|
colorItemTextSelected: string;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项文字选中颜色
|
||||||
|
* @descEN Color of selected menu item text
|
||||||
|
*/
|
||||||
itemSelectedColor: string;
|
itemSelectedColor: string;
|
||||||
|
|
||||||
/** @deprecated Use `horizontalItemSelectedColor` instead */
|
/** @deprecated Use `horizontalItemSelectedColor` instead */
|
||||||
colorItemTextSelectedHorizontal: string;
|
colorItemTextSelectedHorizontal: string;
|
||||||
|
/**
|
||||||
|
* @desc 水平菜单项文字选中颜色
|
||||||
|
* @descEN Color of selected horizontal menu item text
|
||||||
|
*/
|
||||||
horizontalItemSelectedColor: string;
|
horizontalItemSelectedColor: string;
|
||||||
|
|
||||||
// > Disabled
|
// > Disabled
|
||||||
/** @deprecated Use `itemDisabledColor` instead */
|
/** @deprecated Use `itemDisabledColor` instead */
|
||||||
colorItemTextDisabled: string;
|
colorItemTextDisabled: string;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项文字禁用颜色
|
||||||
|
* @descEN Color of disabled menu item text
|
||||||
|
*/
|
||||||
itemDisabledColor: string;
|
itemDisabledColor: string;
|
||||||
|
|
||||||
// > Danger
|
// > Danger
|
||||||
/** @deprecated Use `dangerItemColor` instead */
|
/** @deprecated Use `dangerItemColor` instead */
|
||||||
colorDangerItemText: string;
|
colorDangerItemText: string;
|
||||||
|
/**
|
||||||
|
* @desc 危险菜单项文字颜色
|
||||||
|
* @descEN Color of danger menu item text
|
||||||
|
*/
|
||||||
dangerItemColor: string;
|
dangerItemColor: string;
|
||||||
|
|
||||||
/** @deprecated Use `dangerItemHoverColor` instead */
|
/** @deprecated Use `dangerItemHoverColor` instead */
|
||||||
colorDangerItemTextHover: string;
|
colorDangerItemTextHover: string;
|
||||||
|
/**
|
||||||
|
* @desc 危险菜单项文字悬浮颜色
|
||||||
|
* @descEN Hover color of danger menu item text
|
||||||
|
*/
|
||||||
dangerItemHoverColor: string;
|
dangerItemHoverColor: string;
|
||||||
|
|
||||||
/** @deprecated Use `dangerItemSelectedColor` instead */
|
/** @deprecated Use `dangerItemSelectedColor` instead */
|
||||||
colorDangerItemTextSelected: string;
|
colorDangerItemTextSelected: string;
|
||||||
|
/**
|
||||||
|
* @desc 危险菜单项文字选中颜色
|
||||||
|
* @descEN Color of selected danger menu item text
|
||||||
|
*/
|
||||||
dangerItemSelectedColor: string;
|
dangerItemSelectedColor: string;
|
||||||
|
|
||||||
/** @deprecated Use `dangerItemActiveBg` instead */
|
/** @deprecated Use `dangerItemActiveBg` instead */
|
||||||
colorDangerItemBgActive: string;
|
colorDangerItemBgActive: string;
|
||||||
|
/**
|
||||||
|
* @desc 危险菜单项文字激活颜色
|
||||||
|
* @descEN Color of active danger menu item text
|
||||||
|
*/
|
||||||
dangerItemActiveBg: string;
|
dangerItemActiveBg: string;
|
||||||
|
|
||||||
/** @deprecated Use `dangerItemSelectedBg` instead */
|
/** @deprecated Use `dangerItemSelectedBg` instead */
|
||||||
colorDangerItemBgSelected: string;
|
colorDangerItemBgSelected: string;
|
||||||
|
/**
|
||||||
|
* @desc 危险菜单项文字选中颜色
|
||||||
|
* @descEN Color of selected danger menu item text
|
||||||
|
*/
|
||||||
dangerItemSelectedBg: string;
|
dangerItemSelectedBg: string;
|
||||||
|
|
||||||
// Item Bg
|
// Item Bg
|
||||||
/** @deprecated Use `itemBg` instead */
|
/** @deprecated Use `itemBg` instead */
|
||||||
colorItemBg: string;
|
colorItemBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项背景色
|
||||||
|
*/
|
||||||
itemBg: string;
|
itemBg: string;
|
||||||
|
|
||||||
/** @deprecated Use `itemHoverBg` instead */
|
/** @deprecated Use `itemHoverBg` instead */
|
||||||
colorItemBgHover: string;
|
colorItemBgHover: string;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项悬浮态背景色
|
||||||
|
* @descEN Background color of menu item when hover
|
||||||
|
*/
|
||||||
itemHoverBg: string;
|
itemHoverBg: string;
|
||||||
|
|
||||||
/** @deprecated Use `subMenuItemBg` instead */
|
/** @deprecated Use `subMenuItemBg` instead */
|
||||||
colorSubItemBg: string;
|
colorSubItemBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 子菜单项背景色
|
||||||
|
* @descEN Background color of sub-menu item
|
||||||
|
*/
|
||||||
subMenuItemBg: string;
|
subMenuItemBg: string;
|
||||||
|
|
||||||
// > Default
|
// > Default
|
||||||
/** @deprecated Use `itemActiveBg` instead */
|
/** @deprecated Use `itemActiveBg` instead */
|
||||||
colorItemBgActive: string;
|
colorItemBgActive: string;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项激活态背景色
|
||||||
|
* @descEN Background color of menu item when active
|
||||||
|
*/
|
||||||
itemActiveBg: string;
|
itemActiveBg: string;
|
||||||
|
|
||||||
/** @deprecated Use `itemSelectedBg` instead */
|
/** @deprecated Use `itemSelectedBg` instead */
|
||||||
colorItemBgSelected: string;
|
colorItemBgSelected: string;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项选中态背景色
|
||||||
|
* @descEN Background color of menu item when selected
|
||||||
|
*/
|
||||||
itemSelectedBg: string;
|
itemSelectedBg: string;
|
||||||
|
|
||||||
/** @deprecated Use `horizontalItemSelectedBg` instead */
|
/** @deprecated Use `horizontalItemSelectedBg` instead */
|
||||||
colorItemBgSelectedHorizontal: string;
|
colorItemBgSelectedHorizontal: string;
|
||||||
|
/**
|
||||||
|
* @desc 水平菜单项选中态背景色
|
||||||
|
* @descEN Background color of horizontal menu item when selected
|
||||||
|
*/
|
||||||
horizontalItemSelectedBg: string;
|
horizontalItemSelectedBg: string;
|
||||||
|
|
||||||
// Ink Bar
|
// Ink Bar
|
||||||
/** @deprecated Use `activeBarWidth` instead */
|
/** @deprecated Use `activeBarWidth` instead */
|
||||||
colorActiveBarWidth: number;
|
colorActiveBarWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项指示条宽度
|
||||||
|
* @descEN Width of menu item active bar
|
||||||
|
*/
|
||||||
activeBarWidth: number;
|
activeBarWidth: number;
|
||||||
|
|
||||||
/** @deprecated Use `activeBarHeight` instead */
|
/** @deprecated Use `activeBarHeight` instead */
|
||||||
colorActiveBarHeight: number;
|
colorActiveBarHeight: number;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项指示条高度
|
||||||
|
* @descEN Height of menu item active bar
|
||||||
|
*/
|
||||||
activeBarHeight: number;
|
activeBarHeight: number;
|
||||||
|
|
||||||
/** @deprecated Use `activeBarBorderWidth` instead */
|
/** @deprecated Use `activeBarBorderWidth` instead */
|
||||||
colorActiveBarBorderSize: number;
|
colorActiveBarBorderSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 菜单项指示条边框宽度
|
||||||
|
* @descEN Border width of menu item active bar
|
||||||
|
*/
|
||||||
activeBarBorderWidth: number;
|
activeBarBorderWidth: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc 菜单项横向外间距
|
||||||
|
* @descEN Horizontal margin of menu item
|
||||||
|
*/
|
||||||
itemMarginInline: number;
|
itemMarginInline: number;
|
||||||
|
/**
|
||||||
|
* @desc 横向菜单项横悬浮态背景色
|
||||||
|
* @descEN Background color of horizontal menu item when hover
|
||||||
|
*/
|
||||||
horizontalItemHoverBg: string;
|
horizontalItemHoverBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 横向菜单项圆角
|
||||||
|
* @descEN Border radius of horizontal menu item
|
||||||
|
*/
|
||||||
horizontalItemBorderRadius: number;
|
horizontalItemBorderRadius: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,20 @@ import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
// Component token here
|
// Component token here
|
||||||
|
/**
|
||||||
|
* @desc 提示框 z-index
|
||||||
|
* @descEN z-index of Message
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
|
/**
|
||||||
|
* @desc 提示框背景色
|
||||||
|
* @descEN Background color of Message
|
||||||
|
*/
|
||||||
contentBg: string;
|
contentBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 提示框内边距
|
||||||
|
* @descEN Padding of Message
|
||||||
|
*/
|
||||||
contentPadding: CSSProperties['padding'];
|
contentPadding: CSSProperties['padding'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,11 +8,35 @@ import type { TokenWithCommonCls } from '../../theme/util/genComponentStyleHook'
|
|||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
// Component token here
|
// Component token here
|
||||||
|
/**
|
||||||
|
* @desc 顶部背景色
|
||||||
|
* @descEN Background color of header
|
||||||
|
*/
|
||||||
headerBg: string;
|
headerBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 标题行高
|
||||||
|
* @descEN Line height of title
|
||||||
|
*/
|
||||||
titleLineHeight: number;
|
titleLineHeight: number;
|
||||||
|
/**
|
||||||
|
* @desc 标题字体大小
|
||||||
|
* @descEN Font size of title
|
||||||
|
*/
|
||||||
titleFontSize: number;
|
titleFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 标题字体颜色
|
||||||
|
* @descEN Font color of title
|
||||||
|
*/
|
||||||
titleColor: string;
|
titleColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 内容区域背景色
|
||||||
|
* @descEN Background color of content
|
||||||
|
*/
|
||||||
contentBg: string;
|
contentBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 底部区域背景色
|
||||||
|
* @descEN Background color of footer
|
||||||
|
*/
|
||||||
footerBg: string;
|
footerBg: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,15 @@ import genNotificationPlacementStyle from './placement';
|
|||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 提醒框 z-index
|
||||||
|
* @descEN z-index of Notification
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
|
/**
|
||||||
|
* @desc 提醒框宽度
|
||||||
|
* @descEN Width of Notification
|
||||||
|
*/
|
||||||
width: number;
|
width: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,14 +10,50 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 页码选项背景色
|
||||||
|
* @descEN Background color of Pagination item
|
||||||
|
*/
|
||||||
itemBg: string;
|
itemBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 页码尺寸
|
||||||
|
* @descEN Size of Pagination item
|
||||||
|
*/
|
||||||
itemSize: number;
|
itemSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 页码激活态背景色
|
||||||
|
* @descEN Background color of active Pagination item
|
||||||
|
*/
|
||||||
itemActiveBg: string;
|
itemActiveBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 小号页码尺寸
|
||||||
|
* @descEN Size of small Pagination item
|
||||||
|
*/
|
||||||
itemSizeSM: number;
|
itemSizeSM: number;
|
||||||
|
/**
|
||||||
|
* @desc 页码链接背景色
|
||||||
|
* @descEN Background color of Pagination item link
|
||||||
|
*/
|
||||||
itemLinkBg: string;
|
itemLinkBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 页码激活态禁用状态背景色
|
||||||
|
* @descEN Background color of disabled active Pagination item
|
||||||
|
*/
|
||||||
itemActiveBgDisabled: string;
|
itemActiveBgDisabled: string;
|
||||||
|
/**
|
||||||
|
* @desc 页码激活态禁用状态文字颜色
|
||||||
|
* @descEN Text color of disabled active Pagination item
|
||||||
|
*/
|
||||||
itemActiveColorDisabled: string;
|
itemActiveColorDisabled: string;
|
||||||
|
/**
|
||||||
|
* @desc 输入框背景色
|
||||||
|
* @descEN Background color of input
|
||||||
|
*/
|
||||||
itemInputBg: string;
|
itemInputBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 每页展示数量选择器 top
|
||||||
|
* @descEN Top of Pagination size changer
|
||||||
|
*/
|
||||||
miniOptionsSizeChangerTop: number;
|
miniOptionsSizeChangerTop: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,10 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook } from '../../theme/internal';
|
import { genComponentStyleHook } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 确认框 z-index
|
||||||
|
* @descEN z-index of Popconfirm
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,20 @@ import type { FullToken, GenerateStyle, PresetColorType } from '../../theme/inte
|
|||||||
import { PresetColors, genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { PresetColors, genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 气泡卡片宽度
|
||||||
|
* @descEN Width of Popover
|
||||||
|
*/
|
||||||
width: number;
|
width: number;
|
||||||
|
/**
|
||||||
|
* @desc 气泡卡片最小宽度
|
||||||
|
* @descEN Min width of Popover
|
||||||
|
*/
|
||||||
minWidth: number;
|
minWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 气泡卡片 z-index
|
||||||
|
* @descEN z-index of Popover
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,18 +6,62 @@ import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|||||||
// ============================== Tokens ==============================
|
// ============================== Tokens ==============================
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
// Radio
|
// Radio
|
||||||
|
/**
|
||||||
|
* @desc 单选框大小
|
||||||
|
* @descEN Radio size
|
||||||
|
*/
|
||||||
radioSize: number;
|
radioSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 单选框圆点大小
|
||||||
|
* @descEN Size of Radio dot
|
||||||
|
*/
|
||||||
dotSize: number;
|
dotSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 单选框圆点禁用颜色
|
||||||
|
* @descEN Color of disabled Radio dot
|
||||||
|
*/
|
||||||
dotColorDisabled: string;
|
dotColorDisabled: string;
|
||||||
|
|
||||||
// Radio buttons
|
// Radio buttons
|
||||||
|
/**
|
||||||
|
* @desc 单选框按钮背景色
|
||||||
|
* @descEN Background color of Radio button
|
||||||
|
*/
|
||||||
buttonBg: string;
|
buttonBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 单选框按钮选中背景色
|
||||||
|
* @descEN Background color of checked Radio button
|
||||||
|
*/
|
||||||
buttonCheckedBg: string;
|
buttonCheckedBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 单选框按钮文本颜色
|
||||||
|
* @descEN Color of Radio button text
|
||||||
|
*/
|
||||||
buttonColor: string;
|
buttonColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 单选框按钮横向内间距
|
||||||
|
* @descEN Horizontal padding of Radio button
|
||||||
|
*/
|
||||||
buttonPaddingInline: number;
|
buttonPaddingInline: number;
|
||||||
|
/**
|
||||||
|
* @desc 单选框按钮选中并禁用时的背景色
|
||||||
|
* @descEN Background color of checked and disabled Radio button
|
||||||
|
*/
|
||||||
buttonCheckedBgDisabled: string;
|
buttonCheckedBgDisabled: string;
|
||||||
|
/**
|
||||||
|
* @desc 单选框按钮选中并禁用时的文本颜色
|
||||||
|
* @descEN Color of checked and disabled Radio button text
|
||||||
|
*/
|
||||||
buttonCheckedColorDisabled: string;
|
buttonCheckedColorDisabled: string;
|
||||||
|
/**
|
||||||
|
* @desc 单选框实色按钮选中时的文本颜色
|
||||||
|
* @descEN Color of checked solid Radio button text
|
||||||
|
*/
|
||||||
buttonSolidCheckedColor: string;
|
buttonSolidCheckedColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 单选框右间距
|
||||||
|
* @descEN Margin right of Radio button
|
||||||
|
*/
|
||||||
wrapperMarginInlineEnd: number;
|
wrapperMarginInlineEnd: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,9 +4,25 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export type ComponentToken = {
|
export type ComponentToken = {
|
||||||
|
/**
|
||||||
|
* @desc 星星颜色
|
||||||
|
* @descEN Star color
|
||||||
|
*/
|
||||||
starColor: string;
|
starColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 星星大小
|
||||||
|
* @descEN Star size
|
||||||
|
*/
|
||||||
starSize: number;
|
starSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 星星悬浮时的缩放
|
||||||
|
* @descEN Scale of star when hover
|
||||||
|
*/
|
||||||
starHoverScale: CSSObject['transform'];
|
starHoverScale: CSSObject['transform'];
|
||||||
|
/**
|
||||||
|
* @desc 星星背景色
|
||||||
|
* @descEN Star background color
|
||||||
|
*/
|
||||||
starBg: string;
|
starBg: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,9 +4,25 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 标题字体大小
|
||||||
|
* @descEN Title font size
|
||||||
|
*/
|
||||||
titleFontSize: number;
|
titleFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 副标题字体大小
|
||||||
|
* @descEN Subtitle font size
|
||||||
|
*/
|
||||||
subtitleFontSize: number;
|
subtitleFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 图标大小
|
||||||
|
* @descEN Icon size
|
||||||
|
*/
|
||||||
iconFontSize: number;
|
iconFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 额外区域外间距
|
||||||
|
* @descEN Margin of extra area
|
||||||
|
*/
|
||||||
extraMargin: CSSProperties['margin'];
|
extraMargin: CSSProperties['margin'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,30 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 选项文本颜色
|
||||||
|
* @descEN Text color of item
|
||||||
|
*/
|
||||||
itemColor: string;
|
itemColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 选项悬浮态文本颜色
|
||||||
|
* @descEN Text color of item when hover
|
||||||
|
*/
|
||||||
itemHoverColor: string;
|
itemHoverColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 选项悬浮态背景颜色
|
||||||
|
* @descEN Background color of item when hover
|
||||||
|
*/
|
||||||
itemHoverBg: string;
|
itemHoverBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 选项激活态背景颜色
|
||||||
|
* @descEN Background color of item when active
|
||||||
|
*/
|
||||||
itemActiveBg: string;
|
itemActiveBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 选项选中时背景颜色
|
||||||
|
* @descEN Background color of item when selected
|
||||||
|
*/
|
||||||
itemSelectedBg: string;
|
itemSelectedBg: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@ import genMultipleStyle from './multiple';
|
|||||||
import genSingleStyle from './single';
|
import genSingleStyle from './single';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 下拉菜单 z-index
|
||||||
|
* @descEN z-index of dropdown
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,11 +8,35 @@ export type ComponentToken = {
|
|||||||
color: string;
|
color: string;
|
||||||
/** @deprecated use gradientToColor instead. */
|
/** @deprecated use gradientToColor instead. */
|
||||||
colorGradientEnd: string;
|
colorGradientEnd: string;
|
||||||
|
/**
|
||||||
|
* @desc 渐变色起点颜色
|
||||||
|
* @descEN Start color of gradient
|
||||||
|
*/
|
||||||
gradientFromColor: string;
|
gradientFromColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 渐变色终点颜色
|
||||||
|
* @descEN End color of gradient
|
||||||
|
*/
|
||||||
gradientToColor: string;
|
gradientToColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 标题骨架屏高度
|
||||||
|
* @descEN Height of title skeleton
|
||||||
|
*/
|
||||||
titleHeight: number;
|
titleHeight: number;
|
||||||
|
/**
|
||||||
|
* @desc 骨架屏圆角
|
||||||
|
* @descEN Border radius of skeleton
|
||||||
|
*/
|
||||||
blockRadius: number;
|
blockRadius: number;
|
||||||
|
/**
|
||||||
|
* @desc 段落骨架屏上间距
|
||||||
|
* @descEN Margin top of paragraph skeleton
|
||||||
|
*/
|
||||||
paragraphMarginTop: number;
|
paragraphMarginTop: number;
|
||||||
|
/**
|
||||||
|
* @desc 段落骨架屏单行高度
|
||||||
|
* @descEN Line height of paragraph skeleton
|
||||||
|
*/
|
||||||
paragraphLiHeight: number;
|
paragraphLiHeight: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,12 +12,40 @@ import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|||||||
// horizontal: full (水平时,水平方向命名为 full)
|
// horizontal: full (水平时,水平方向命名为 full)
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 滑动输入高度
|
||||||
|
* @descEN Height of slider
|
||||||
|
*/
|
||||||
controlSize: number;
|
controlSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 轨道高度
|
||||||
|
* @descEN Height of rail
|
||||||
|
*/
|
||||||
railSize: number;
|
railSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 滑块尺寸
|
||||||
|
* @descEN Size of handle
|
||||||
|
*/
|
||||||
handleSize: number;
|
handleSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 滑块尺寸(悬浮态)
|
||||||
|
* @descEN Size of handle when hover
|
||||||
|
*/
|
||||||
handleSizeHover: number;
|
handleSizeHover: number;
|
||||||
|
/**
|
||||||
|
* @desc 滑块边框宽度
|
||||||
|
* @descEN Border width of handle
|
||||||
|
*/
|
||||||
handleLineWidth: number;
|
handleLineWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 滑块边框宽度(悬浮态)
|
||||||
|
* @descEN Border width of handle when hover
|
||||||
|
*/
|
||||||
handleLineWidthHover: number;
|
handleLineWidthHover: number;
|
||||||
|
/**
|
||||||
|
* @desc 滑块圆点尺寸
|
||||||
|
* @descEN Size of dot
|
||||||
|
*/
|
||||||
dotSize: number;
|
dotSize: number;
|
||||||
railBg: string;
|
railBg: string;
|
||||||
railHoverBg: string;
|
railHoverBg: string;
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
import type { CSSObject } from '@ant-design/cssinjs';
|
import type { CSSObject } from '@ant-design/cssinjs';
|
||||||
import { Keyframes } from '@ant-design/cssinjs';
|
import { Keyframes } from '@ant-design/cssinjs';
|
||||||
|
import { resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
import { resetComponent } from '../../style';
|
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 内容区域高度
|
||||||
|
* @descEN Height of content area
|
||||||
|
*/
|
||||||
contentHeight: number;
|
contentHeight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,15 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 标题字体大小
|
||||||
|
* @descEN Title font size
|
||||||
|
*/
|
||||||
titleFontSize: number;
|
titleFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 内容字体大小
|
||||||
|
* @descEN Content font size
|
||||||
|
*/
|
||||||
contentFontSize: number;
|
contentFontSize: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,18 +14,70 @@ import genStepsSmallStyle from './small';
|
|||||||
import genStepsVerticalStyle from './vertical';
|
import genStepsVerticalStyle from './vertical';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 描述区域最大宽度
|
||||||
|
* @descEN Max width of description area
|
||||||
|
*/
|
||||||
descriptionMaxWidth: number;
|
descriptionMaxWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 自定义图标容器尺寸
|
||||||
|
* @descEN Size of custom icon container
|
||||||
|
*/
|
||||||
customIconSize: number;
|
customIconSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 自定义图标 top
|
||||||
|
* @descEN Top of custom icon
|
||||||
|
*/
|
||||||
customIconTop: number;
|
customIconTop: number;
|
||||||
|
/**
|
||||||
|
* @desc 自定义图标大小
|
||||||
|
* @descEN Font size of custom icon
|
||||||
|
*/
|
||||||
customIconFontSize: number;
|
customIconFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 图标容器尺寸
|
||||||
|
* @descEN Size of icon container
|
||||||
|
*/
|
||||||
iconSize: number;
|
iconSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 图标 top
|
||||||
|
* @descEN Top of icon
|
||||||
|
*/
|
||||||
iconTop: number;
|
iconTop: number;
|
||||||
|
/**
|
||||||
|
* @desc 图标大小
|
||||||
|
* @descEN Size of icon
|
||||||
|
*/
|
||||||
iconFontSize: number;
|
iconFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 点状步骤点大小
|
||||||
|
* @descEN Size of dot
|
||||||
|
*/
|
||||||
dotSize: number;
|
dotSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 点状步骤点当前大小
|
||||||
|
* @descEN Current size of dot
|
||||||
|
*/
|
||||||
dotCurrentSize: number;
|
dotCurrentSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 可跳转步骤条箭头颜色
|
||||||
|
* @descEN Color of arrow in nav
|
||||||
|
*/
|
||||||
navArrowColor: string;
|
navArrowColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 可跳转步骤条内容最大宽度
|
||||||
|
* @descEN Max width of nav content
|
||||||
|
*/
|
||||||
navContentMaxWidth: CSSProperties['maxWidth'];
|
navContentMaxWidth: CSSProperties['maxWidth'];
|
||||||
|
/**
|
||||||
|
* @desc 小号步骤条图标大小
|
||||||
|
* @descEN Size of small steps icon
|
||||||
|
*/
|
||||||
iconSizeSM: number;
|
iconSizeSM: number;
|
||||||
|
/**
|
||||||
|
* @desc 标题行高
|
||||||
|
* @descEN Line height of title
|
||||||
|
*/
|
||||||
titleLineHeight: number;
|
titleLineHeight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import omit from 'rc-util/lib/omit';
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import type { Breakpoint } from '../_util/responsiveObserver';
|
import type { Breakpoint } from '../_util/responsiveObserver';
|
||||||
import scrollTo from '../_util/scrollTo';
|
import scrollTo from '../_util/scrollTo';
|
||||||
|
import type { AnyObject } from '../_util/type';
|
||||||
import warning from '../_util/warning';
|
import warning from '../_util/warning';
|
||||||
import type { SizeType } from '../config-provider/SizeContext';
|
import type { SizeType } from '../config-provider/SizeContext';
|
||||||
import type { ConfigConsumerProps } from '../config-provider/context';
|
import type { ConfigConsumerProps } from '../config-provider/context';
|
||||||
@ -19,7 +20,6 @@ import Spin from '../spin';
|
|||||||
import type { TooltipProps } from '../tooltip';
|
import type { TooltipProps } from '../tooltip';
|
||||||
import renderExpandIcon from './ExpandIcon';
|
import renderExpandIcon from './ExpandIcon';
|
||||||
import RcTable from './RcTable';
|
import RcTable from './RcTable';
|
||||||
import type { AnyObject } from './Table';
|
|
||||||
import type { FilterState } from './hooks/useFilter';
|
import type { FilterState } from './hooks/useFilter';
|
||||||
import useFilter, { getFilterData } from './hooks/useFilter';
|
import useFilter, { getFilterData } from './hooks/useFilter';
|
||||||
import useLazyKVMap from './hooks/useLazyKVMap';
|
import useLazyKVMap from './hooks/useLazyKVMap';
|
||||||
@ -109,7 +109,7 @@ export interface TableProps<RecordType>
|
|||||||
showSorterTooltip?: boolean | TooltipProps;
|
showSorterTooltip?: boolean | TooltipProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
const InternalTable = <RecordType extends AnyObject = any>(
|
const InternalTable = <RecordType extends AnyObject = AnyObject>(
|
||||||
props: InternalTableProps<RecordType>,
|
props: InternalTableProps<RecordType>,
|
||||||
ref: React.MutableRefObject<HTMLDivElement>,
|
ref: React.MutableRefObject<HTMLDivElement>,
|
||||||
) => {
|
) => {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { EXPAND_COLUMN, Summary } from 'rc-table';
|
import { EXPAND_COLUMN, Summary } from 'rc-table';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import type { AnyObject } from '../_util/type';
|
||||||
import Column from './Column';
|
import Column from './Column';
|
||||||
import ColumnGroup from './ColumnGroup';
|
import ColumnGroup from './ColumnGroup';
|
||||||
import type { TableProps } from './InternalTable';
|
import type { TableProps } from './InternalTable';
|
||||||
@ -12,13 +13,11 @@ import {
|
|||||||
} from './hooks/useSelection';
|
} from './hooks/useSelection';
|
||||||
import type { RefTable } from './interface';
|
import type { RefTable } from './interface';
|
||||||
|
|
||||||
export type AnyObject = Record<PropertyKey, any>;
|
const Table = <RecordType extends AnyObject = AnyObject>(
|
||||||
|
|
||||||
const Table = <RecordType extends AnyObject = any>(
|
|
||||||
props: TableProps<RecordType>,
|
props: TableProps<RecordType>,
|
||||||
ref: React.Ref<HTMLDivElement>,
|
ref: React.Ref<HTMLDivElement>,
|
||||||
) => {
|
) => {
|
||||||
const renderTimesRef = React.useRef(0);
|
const renderTimesRef = React.useRef<number>(0);
|
||||||
renderTimesRef.current += 1;
|
renderTimesRef.current += 1;
|
||||||
return <InternalTable<RecordType> {...props} ref={ref} _renderTimes={renderTimesRef.current} />;
|
return <InternalTable<RecordType> {...props} ref={ref} _renderTimes={renderTimesRef.current} />;
|
||||||
};
|
};
|
||||||
|
@ -251,7 +251,7 @@ describe('Table', () => {
|
|||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
render(<Table columns={columns} rowKey={(record, index) => record + index} />);
|
render(<Table columns={columns} rowKey={(record, index) => record.key + index} />);
|
||||||
expect(warnSpy).toHaveBeenCalledWith(
|
expect(warnSpy).toHaveBeenCalledWith(
|
||||||
'Warning: [antd: Table] `index` parameter of `rowKey` function is deprecated. There is no guarantee that it will work as expected.',
|
'Warning: [antd: Table] `index` parameter of `rowKey` function is deprecated. There is no guarantee that it will work as expected.',
|
||||||
);
|
);
|
||||||
|
@ -9,12 +9,12 @@ import { convertDataToEntities } from 'rc-tree/lib/utils/treeUtil';
|
|||||||
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
import type { AnyObject } from '../../_util/type';
|
||||||
import warning from '../../_util/warning';
|
import warning from '../../_util/warning';
|
||||||
import type { CheckboxProps } from '../../checkbox';
|
import type { CheckboxProps } from '../../checkbox';
|
||||||
import Checkbox from '../../checkbox';
|
import Checkbox from '../../checkbox';
|
||||||
import Dropdown from '../../dropdown';
|
import Dropdown from '../../dropdown';
|
||||||
import Radio from '../../radio';
|
import Radio from '../../radio';
|
||||||
import type { AnyObject } from '../Table';
|
|
||||||
import type {
|
import type {
|
||||||
ColumnType,
|
ColumnType,
|
||||||
ColumnsType,
|
ColumnsType,
|
||||||
@ -38,7 +38,7 @@ export const SELECTION_NONE = 'SELECT_NONE' as const;
|
|||||||
|
|
||||||
const EMPTY_LIST: React.Key[] = [];
|
const EMPTY_LIST: React.Key[] = [];
|
||||||
|
|
||||||
interface UseSelectionConfig<RecordType extends AnyObject = any> {
|
interface UseSelectionConfig<RecordType extends AnyObject = AnyObject> {
|
||||||
prefixCls: string;
|
prefixCls: string;
|
||||||
pageData: RecordType[];
|
pageData: RecordType[];
|
||||||
data: RecordType[];
|
data: RecordType[];
|
||||||
@ -56,7 +56,7 @@ export type INTERNAL_SELECTION_ITEM =
|
|||||||
| typeof SELECTION_INVERT
|
| typeof SELECTION_INVERT
|
||||||
| typeof SELECTION_NONE;
|
| typeof SELECTION_NONE;
|
||||||
|
|
||||||
const flattenData = <RecordType extends AnyObject = any>(
|
const flattenData = <RecordType extends AnyObject = AnyObject>(
|
||||||
childrenColumnName: keyof RecordType,
|
childrenColumnName: keyof RecordType,
|
||||||
data?: RecordType[],
|
data?: RecordType[],
|
||||||
): RecordType[] => {
|
): RecordType[] => {
|
||||||
@ -70,7 +70,7 @@ const flattenData = <RecordType extends AnyObject = any>(
|
|||||||
return list;
|
return list;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useSelection = <RecordType extends AnyObject = any>(
|
const useSelection = <RecordType extends AnyObject = AnyObject>(
|
||||||
config: UseSelectionConfig<RecordType>,
|
config: UseSelectionConfig<RecordType>,
|
||||||
rowSelection?: TableRowSelection<RecordType>,
|
rowSelection?: TableRowSelection<RecordType>,
|
||||||
): readonly [TransformColumns<RecordType>, Set<Key>] => {
|
): readonly [TransformColumns<RecordType>, Set<Key>] => {
|
||||||
|
@ -7,23 +7,24 @@ import type {
|
|||||||
import { ExpandableConfig, GetRowKey } from 'rc-table/lib/interface';
|
import { ExpandableConfig, GetRowKey } from 'rc-table/lib/interface';
|
||||||
import type * as React from 'react';
|
import type * as React from 'react';
|
||||||
import type { Breakpoint } from '../_util/responsiveObserver';
|
import type { Breakpoint } from '../_util/responsiveObserver';
|
||||||
|
import type { AnyObject } from '../_util/type';
|
||||||
import type { CheckboxProps } from '../checkbox';
|
import type { CheckboxProps } from '../checkbox';
|
||||||
import type { PaginationProps } from '../pagination';
|
import type { PaginationProps } from '../pagination';
|
||||||
import type { TooltipProps } from '../tooltip';
|
import type { TooltipProps } from '../tooltip';
|
||||||
import type { InternalTableProps, TableProps } from './InternalTable';
|
import type { InternalTableProps, TableProps } from './InternalTable';
|
||||||
import type { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
|
import type { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
|
||||||
|
|
||||||
export type RefTable = <RecordType extends object = any>(
|
export type RefTable = <RecordType extends AnyObject = AnyObject>(
|
||||||
props: React.PropsWithChildren<TableProps<RecordType>> & { ref?: React.Ref<HTMLDivElement> },
|
props: React.PropsWithChildren<TableProps<RecordType>> & { ref?: React.Ref<HTMLDivElement> },
|
||||||
) => React.ReactElement;
|
) => React.ReactElement;
|
||||||
|
|
||||||
export type RefInternalTable = <RecordType extends object = any>(
|
export type RefInternalTable = <RecordType extends AnyObject = AnyObject>(
|
||||||
props: React.PropsWithChildren<InternalTableProps<RecordType>> & {
|
props: React.PropsWithChildren<InternalTableProps<RecordType>> & {
|
||||||
ref?: React.Ref<HTMLDivElement>;
|
ref?: React.Ref<HTMLDivElement>;
|
||||||
},
|
},
|
||||||
) => React.ReactElement;
|
) => React.ReactElement;
|
||||||
|
|
||||||
export { GetRowKey, ExpandableConfig };
|
export { ExpandableConfig, GetRowKey };
|
||||||
|
|
||||||
export type Key = React.Key;
|
export type Key = React.Key;
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ export type ColumnTitle<RecordType> =
|
|||||||
|
|
||||||
export type FilterValue = (Key | boolean)[];
|
export type FilterValue = (Key | boolean)[];
|
||||||
export type FilterKey = Key[] | null;
|
export type FilterKey = Key[] | null;
|
||||||
export type FilterSearchType<RecordType = Record<string, any>> =
|
export type FilterSearchType<RecordType = AnyObject> =
|
||||||
| boolean
|
| boolean
|
||||||
| ((input: string, record: RecordType) => boolean);
|
| ((input: string, record: RecordType) => boolean);
|
||||||
export interface FilterConfirmProps {
|
export interface FilterConfirmProps {
|
||||||
|
@ -5,28 +5,120 @@ import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|||||||
import genMotionStyle from './motion';
|
import genMotionStyle from './motion';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 下拉菜单 z-index
|
||||||
|
* @descEN z-index of dropdown menu
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
|
/**
|
||||||
|
* @desc 卡片标签页背景色
|
||||||
|
* @descEN Background color of card tab
|
||||||
|
*/
|
||||||
cardBg: string;
|
cardBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 卡片标签页高度
|
||||||
|
* @descEN Height of card tab
|
||||||
|
*/
|
||||||
cardHeight: number;
|
cardHeight: number;
|
||||||
|
/**
|
||||||
|
* @desc 卡片标签页内间距
|
||||||
|
* @descEN Padding of card tab
|
||||||
|
*/
|
||||||
cardPadding: string;
|
cardPadding: string;
|
||||||
|
/**
|
||||||
|
* @desc 小号卡片标签页内间距
|
||||||
|
* @descEN Padding of small card tab
|
||||||
|
*/
|
||||||
cardPaddingSM: string;
|
cardPaddingSM: string;
|
||||||
|
/**
|
||||||
|
* @desc 大号卡片标签页内间距
|
||||||
|
* @descEN Padding of large card tab
|
||||||
|
*/
|
||||||
cardPaddingLG: string;
|
cardPaddingLG: string;
|
||||||
|
/**
|
||||||
|
* @desc 标齐页标题文本大小
|
||||||
|
* @descEN Font size of title
|
||||||
|
*/
|
||||||
titleFontSize: number;
|
titleFontSize: number;
|
||||||
|
/**
|
||||||
|
* @desc 大号标签页标题文本大小
|
||||||
|
* @descEN Font size of large title
|
||||||
|
*/
|
||||||
titleFontSizeLG: number;
|
titleFontSizeLG: number;
|
||||||
|
/**
|
||||||
|
* @desc 小号标签页标题文本大小
|
||||||
|
* @descEN Font size of small title
|
||||||
|
*/
|
||||||
titleFontSizeSM: number;
|
titleFontSizeSM: number;
|
||||||
|
/**
|
||||||
|
* @desc 指示条颜色
|
||||||
|
* @descEN Color of indicator
|
||||||
|
*/
|
||||||
inkBarColor: string;
|
inkBarColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 横向标签页外间距
|
||||||
|
* @descEN Horizontal margin of horizontal tab
|
||||||
|
*/
|
||||||
horizontalMargin: string;
|
horizontalMargin: string;
|
||||||
|
/**
|
||||||
|
* @desc 横向标签页标签间距
|
||||||
|
* @descEN Horizontal gutter of horizontal tab
|
||||||
|
*/
|
||||||
horizontalItemGutter: number;
|
horizontalItemGutter: number;
|
||||||
|
/**
|
||||||
|
* @desc 横向标签页标签外间距
|
||||||
|
* @descEN Horizontal margin of horizontal tab item
|
||||||
|
*/
|
||||||
horizontalItemMargin: string;
|
horizontalItemMargin: string;
|
||||||
|
/**
|
||||||
|
* @desc 横向标签页标签外间距(RTL)
|
||||||
|
* @descEN Horizontal margin of horizontal tab item (RTL)
|
||||||
|
*/
|
||||||
horizontalItemMarginRTL: string;
|
horizontalItemMarginRTL: string;
|
||||||
|
/**
|
||||||
|
* @desc 横向标签页标签内间距
|
||||||
|
* @descEN Horizontal padding of horizontal tab item
|
||||||
|
*/
|
||||||
horizontalItemPadding: string;
|
horizontalItemPadding: string;
|
||||||
|
/**
|
||||||
|
* @desc 大号横向标签页标签内间距
|
||||||
|
* @descEN Horizontal padding of large horizontal tab item
|
||||||
|
*/
|
||||||
horizontalItemPaddingLG: string;
|
horizontalItemPaddingLG: string;
|
||||||
|
/**
|
||||||
|
* @desc 小号横向标签页标签内间距
|
||||||
|
* @descEN Horizontal padding of small horizontal tab item
|
||||||
|
*/
|
||||||
horizontalItemPaddingSM: string;
|
horizontalItemPaddingSM: string;
|
||||||
|
/**
|
||||||
|
* @desc 纵向标签页标签内间距
|
||||||
|
* @descEN Vertical padding of vertical tab item
|
||||||
|
*/
|
||||||
verticalItemPadding: string;
|
verticalItemPadding: string;
|
||||||
|
/**
|
||||||
|
* @desc 纵向标签页标签外间距
|
||||||
|
* @descEN Vertical margin of vertical tab item
|
||||||
|
*/
|
||||||
verticalItemMargin: string;
|
verticalItemMargin: string;
|
||||||
|
/**
|
||||||
|
* @desc 标签激活态文本颜色
|
||||||
|
* @descEN Text color of active tab
|
||||||
|
*/
|
||||||
itemActiveColor: string;
|
itemActiveColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 标签悬浮态文本颜色
|
||||||
|
* @descEN Text color of hover tab
|
||||||
|
*/
|
||||||
itemHoverColor: string;
|
itemHoverColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 标签选中态文本颜色
|
||||||
|
* @descEN Text color of selected tab
|
||||||
|
*/
|
||||||
itemSelectedColor: string;
|
itemSelectedColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 卡片标签间距
|
||||||
|
* @descEN Gutter of card tab
|
||||||
|
*/
|
||||||
cardGutter: number;
|
cardGutter: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,15 @@ import type { FullToken } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, genPresetColor, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, genPresetColor, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 默认背景色
|
||||||
|
* @descEN Default background color
|
||||||
|
*/
|
||||||
defaultBg: string;
|
defaultBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 默认文字颜色
|
||||||
|
* @descEN Default text color
|
||||||
|
*/
|
||||||
defaultColor: string;
|
defaultColor: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,30 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 轨迹颜色
|
||||||
|
* @descEN Line color
|
||||||
|
*/
|
||||||
tailColor: string;
|
tailColor: string;
|
||||||
|
/**
|
||||||
|
* @desc 轨迹宽度
|
||||||
|
* @descEN Line width
|
||||||
|
*/
|
||||||
tailWidth: number;
|
tailWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 节点边框宽度
|
||||||
|
* @descEN Border width of node
|
||||||
|
*/
|
||||||
dotBorderWidth: number;
|
dotBorderWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 节点背景色
|
||||||
|
* @descEN Background color of node
|
||||||
|
*/
|
||||||
dotBg: string;
|
dotBg: string;
|
||||||
|
/**
|
||||||
|
* @desc 时间项下间距
|
||||||
|
* @descEN Bottom padding of item
|
||||||
|
*/
|
||||||
itemPaddingBottom: number;
|
itemPaddingBottom: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,12 @@ import type { FullToken, GenerateStyle, UseComponentStyleResult } from '../../th
|
|||||||
import { genComponentStyleHook, genPresetColor, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, genPresetColor, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 文字提示 z-index
|
||||||
|
* @descEN z-index of tooltip
|
||||||
|
*/
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
|
/** @deprecated */
|
||||||
colorBgDefault: string;
|
colorBgDefault: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,11 +4,35 @@ import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 列表宽度
|
||||||
|
* @descEN Width of list
|
||||||
|
*/
|
||||||
listWidth: number;
|
listWidth: number;
|
||||||
|
/**
|
||||||
|
* @desc 大号列表宽度
|
||||||
|
* @descEN Width of large list
|
||||||
|
*/
|
||||||
listWidthLG: number;
|
listWidthLG: number;
|
||||||
|
/**
|
||||||
|
* @desc 列表高度
|
||||||
|
* @descEN Height of list
|
||||||
|
*/
|
||||||
listHeight: number;
|
listHeight: number;
|
||||||
|
/**
|
||||||
|
* @desc 列表项高度
|
||||||
|
* @descEN Height of list item
|
||||||
|
*/
|
||||||
itemHeight: number;
|
itemHeight: number;
|
||||||
|
/**
|
||||||
|
* @desc 列表项纵向内边距
|
||||||
|
* @descEN Vertical padding of list item
|
||||||
|
*/
|
||||||
itemPaddingBlock: number;
|
itemPaddingBlock: number;
|
||||||
|
/**
|
||||||
|
* @desc 顶部高度
|
||||||
|
* @descEN Height of header
|
||||||
|
*/
|
||||||
headerHeight: number;
|
headerHeight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,9 +12,16 @@ import {
|
|||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 标题上间距
|
||||||
|
* @descEN Margin top of title
|
||||||
|
*/
|
||||||
titleMarginTop: number | string;
|
titleMarginTop: number | string;
|
||||||
|
/**
|
||||||
|
* @desc 标题下间距
|
||||||
|
* @descEN Margin bottom of title
|
||||||
|
*/
|
||||||
titleMarginBottom: number | string;
|
titleMarginBottom: number | string;
|
||||||
fontWeightStrong: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TypographyToken = FullToken<'Typography'>;
|
export type TypographyToken = FullToken<'Typography'>;
|
||||||
@ -126,9 +133,8 @@ const genTypographyStyle: GenerateStyle<TypographyToken> = (token) => {
|
|||||||
export default genComponentStyleHook(
|
export default genComponentStyleHook(
|
||||||
'Typography',
|
'Typography',
|
||||||
(token) => [genTypographyStyle(token)],
|
(token) => [genTypographyStyle(token)],
|
||||||
(token) => ({
|
() => ({
|
||||||
titleMarginTop: '1.2em',
|
titleMarginTop: '1.2em',
|
||||||
titleMarginBottom: '0.5em',
|
titleMarginBottom: '0.5em',
|
||||||
fontWeightStrong: token.fontWeightStrong,
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -9,6 +9,10 @@ import { genPictureCardStyle, genPictureStyle } from './picture';
|
|||||||
import genRtlStyle from './rtl';
|
import genRtlStyle from './rtl';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
|
/**
|
||||||
|
* @desc 操作按扭颜色
|
||||||
|
* @descEN Action button color
|
||||||
|
*/
|
||||||
actionsColor: string;
|
actionsColor: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,20 @@ import fs from 'fs-extra';
|
|||||||
import type { DeclarationReflection } from 'typedoc';
|
import type { DeclarationReflection } from 'typedoc';
|
||||||
import { Application, TSConfigReader, TypeDocReader } from 'typedoc';
|
import { Application, TSConfigReader, TypeDocReader } from 'typedoc';
|
||||||
|
|
||||||
|
type TokenMeta = {
|
||||||
|
seed: ReturnType<typeof getTokenList>;
|
||||||
|
map: ReturnType<typeof getTokenList>;
|
||||||
|
alias: ReturnType<typeof getTokenList>;
|
||||||
|
components: Record<string, ReturnType<typeof getTokenList>>;
|
||||||
|
};
|
||||||
|
|
||||||
function getTokenList(list?: DeclarationReflection[], source?: string) {
|
function getTokenList(list?: DeclarationReflection[], source?: string) {
|
||||||
return (list || [])
|
return (list || [])
|
||||||
.filter(
|
.filter(
|
||||||
(item) =>
|
(item) =>
|
||||||
!item.comment?.blockTags.some((tag) => tag.tag === '@internal' || tag.tag === '@private'),
|
!item.comment?.blockTags.some(
|
||||||
|
(tag) => tag.tag === '@internal' || tag.tag === '@private' || tag.tag === '@deprecated',
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.map((item) => ({
|
.map((item) => ({
|
||||||
source,
|
source,
|
||||||
@ -40,7 +49,8 @@ const main = () => {
|
|||||||
|
|
||||||
app.bootstrap({
|
app.bootstrap({
|
||||||
// typedoc options here
|
// typedoc options here
|
||||||
entryPoints: ['components/theme/interface/index.ts'],
|
entryPoints: ['components/theme/interface/index.ts', 'components/*/style/index.{ts,tsx}'],
|
||||||
|
skipErrorChecking: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const project = app.convert();
|
const project = app.convert();
|
||||||
@ -48,49 +58,74 @@ const main = () => {
|
|||||||
if (project) {
|
if (project) {
|
||||||
// Project may not have converted correctly
|
// Project may not have converted correctly
|
||||||
const output = 'components/version/token-meta.json';
|
const output = 'components/version/token-meta.json';
|
||||||
const tokenMeta: Record<PropertyKey, ReturnType<typeof getTokenList>> = {};
|
const tokenMeta: TokenMeta = {
|
||||||
let presetColors: string[] = [];
|
seed: [],
|
||||||
project.children?.forEach((type) => {
|
map: [],
|
||||||
if (type.name === 'SeedToken') {
|
alias: [],
|
||||||
tokenMeta.seed = getTokenList(type.children, 'seed');
|
components: {},
|
||||||
} else if (type.name === 'MapToken') {
|
};
|
||||||
tokenMeta.map = getTokenList(type.children, 'map');
|
|
||||||
} else if (type.name === 'AliasToken') {
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
tokenMeta.alias = getTokenList(type.children, 'alias');
|
project?.children?.forEach((file) => {
|
||||||
} else if (type.name === 'PresetColors') {
|
// Global Token
|
||||||
presetColors = (type?.type as any)?.target?.elements?.map((item: any) => item.value);
|
if (file.name === 'theme/interface') {
|
||||||
|
let presetColors: string[] = [];
|
||||||
|
file.children?.forEach((type) => {
|
||||||
|
if (type.name === 'SeedToken') {
|
||||||
|
tokenMeta.seed = getTokenList(type.children, 'seed');
|
||||||
|
} else if (type.name === 'MapToken') {
|
||||||
|
tokenMeta.map = getTokenList(type.children, 'map');
|
||||||
|
} else if (type.name === 'AliasToken') {
|
||||||
|
tokenMeta.alias = getTokenList(type.children, 'alias');
|
||||||
|
} else if (type.name === 'PresetColors') {
|
||||||
|
presetColors = (type?.type as any)?.target?.elements?.map((item: any) => item.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Exclude preset colors
|
||||||
|
tokenMeta.seed = tokenMeta.seed.filter(
|
||||||
|
(item) => !presetColors.some((color) => item.token.startsWith(color)),
|
||||||
|
);
|
||||||
|
tokenMeta.map = tokenMeta.map.filter(
|
||||||
|
(item) => !presetColors.some((color) => item.token.startsWith(color)),
|
||||||
|
);
|
||||||
|
tokenMeta.alias = tokenMeta.alias.filter(
|
||||||
|
(item) => !presetColors.some((color) => item.token.startsWith(color)),
|
||||||
|
);
|
||||||
|
|
||||||
|
tokenMeta.alias = tokenMeta.alias.filter(
|
||||||
|
(item) => !tokenMeta.map.some((mapItem) => mapItem.token === item.token),
|
||||||
|
);
|
||||||
|
tokenMeta.map = tokenMeta.map.filter(
|
||||||
|
(item) => !tokenMeta.seed.some((seedItem) => seedItem.token === item.token),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const component = file.name
|
||||||
|
.slice(0, file.name.indexOf('/'))
|
||||||
|
.replace(/(^(.)|-(.))/g, (match) => match.replace('-', '').toUpperCase());
|
||||||
|
const componentToken = file.children?.find((item) => item.name === `ComponentToken`);
|
||||||
|
if (componentToken) {
|
||||||
|
tokenMeta.components[component] = getTokenList(componentToken.children, component);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Exclude preset colors
|
|
||||||
tokenMeta.seed = tokenMeta.seed.filter(
|
|
||||||
(item) => !presetColors.some((color) => item.token.startsWith(color)),
|
|
||||||
);
|
|
||||||
tokenMeta.map = tokenMeta.map.filter(
|
|
||||||
(item) => !presetColors.some((color) => item.token.startsWith(color)),
|
|
||||||
);
|
|
||||||
tokenMeta.alias = tokenMeta.alias.filter(
|
|
||||||
(item) => !presetColors.some((color) => item.token.startsWith(color)),
|
|
||||||
);
|
|
||||||
|
|
||||||
tokenMeta.alias = tokenMeta.alias.filter(
|
|
||||||
(item) => !tokenMeta.map.some((mapItem) => mapItem.token === item.token),
|
|
||||||
);
|
|
||||||
tokenMeta.map = tokenMeta.map.filter(
|
|
||||||
(item) => !tokenMeta.seed.some((seedItem) => seedItem.token === item.token),
|
|
||||||
);
|
|
||||||
|
|
||||||
const finalMeta = Object.entries(tokenMeta).reduce((acc, [key, value]) => {
|
const finalMeta = Object.entries(tokenMeta).reduce((acc, [key, value]) => {
|
||||||
value.forEach((item) => {
|
if (key !== 'components') {
|
||||||
acc[item.token] = {
|
(value as any[]).forEach((item) => {
|
||||||
name: item.name,
|
acc.global = acc.global || {};
|
||||||
nameEn: item.nameEn,
|
acc.global[item.token] = {
|
||||||
desc: item.desc,
|
name: item.name,
|
||||||
descEn: item.descEn,
|
nameEn: item.nameEn,
|
||||||
type: item.type,
|
desc: item.desc,
|
||||||
source: key,
|
descEn: item.descEn,
|
||||||
};
|
type: item.type,
|
||||||
});
|
source: key,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
acc.components = value;
|
||||||
|
}
|
||||||
return acc;
|
return acc;
|
||||||
}, {} as any);
|
}, {} as any);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user