-
- {title}
-
-
{subTitle}
+ const getContent = ({ title, subTitle, img, links, url }) => {
+ return (
+
+
+
+ {title}
-
-
- {ANTV_LINKS.map((link) => {
- let href = links[link.href]?.url?.replace(
- /https:\/\/.+?\//,
- `${url}/`,
- );
+
{subTitle}
+
+
+
+ {ANTV_LINKS.map((link) => {
+ let href = links[link.href]?.url?.replace(
+ /https:\/\/.+?\//,
+ `${url}/`,
+ );
- // Ant Design Charts 本身跳转 https://charts.ant.design/example 为 404, 修改为 https://ant-design-charts.antgroup.com/examples
- if (title === 'Ant Design Charts') {
- href =
- link.href === 'home'
- ? url
- : `${url}/${language}/${
- {
- example: 'examples',
- api: 'options/plots/overview',
- }[link.href]
- }`;
- }
- if (href && title === 'F6' && link.href === 'api') {
- href = href + '/Graph';
- }
+ // Ant Design Charts 本身跳转 https://charts.ant.design/example 为 404, 修改为 https://ant-design-charts.antgroup.com/examples
+ if (title === 'Ant Design Charts') {
+ href =
+ link.href === 'home'
+ ? url
+ : `${url}/${language}/${
+ {
+ example: 'examples',
+ api: 'options/plots/overview',
+ }[link.href]
+ }`;
+ }
+ if (href && title === 'F6' && link.href === 'api') {
+ href = href + '/Graph';
+ }
- return (
-
- );
- })}
-
+ return (
+
+ );
+ })}
- );
- },
- [language],
- );
+
+ );
+ };
return (
-
-
- );
-}
diff --git a/src/components/ThemeCharts/index.tsx b/src/components/ThemeCharts/index.tsx
index e043ecf7..7f3f9e1b 100644
--- a/src/components/ThemeCharts/index.tsx
+++ b/src/components/ThemeCharts/index.tsx
@@ -1,5 +1,5 @@
import classNames from 'classnames';
-import { useTranslation } from '../../lib/i18n';
+import { LocaleProvider, useTranslation, type Locale } from '../../lib/i18n';
import { useCallback, useState } from 'react';
import THEME_DATAS from '../../data/theme-charts.json';
import THEME_COLORS1 from '../../data/theme-colors1.json';
@@ -45,7 +45,7 @@ const CHARTS = [
];
// 定制主题,一键生成
-export function ThemeCharts() {
+function ThemeCharts() {
const { t: useT } = useTranslation();
const [selectedIndex, setSelectedIndex] = useState(0);
@@ -215,3 +215,11 @@ export function ThemeCharts() {
);
}
+
+export default function ThemeIsland({ locale }: { locale: Locale }) {
+ return (
+
+
+
+ );
+}
diff --git a/src/components/common/OverflowedText/index.tsx b/src/components/common/OverflowedText/index.tsx
index 2eacca1a..5e4ce556 100644
--- a/src/components/common/OverflowedText/index.tsx
+++ b/src/components/common/OverflowedText/index.tsx
@@ -1,9 +1,5 @@
import { ConfigProvider, Tooltip } from 'antd';
import cx from 'classnames';
-import isNumber from 'lodash/isNumber.js';
-import isString from 'lodash/isString.js';
-import omit from 'lodash/omit.js';
-import toNumber from 'lodash/toNumber.js';
import { PureComponent } from 'react';
type Props = {
@@ -15,23 +11,18 @@ type Props = {
};
const getPixel = (value: string | number) => {
- if (isNumber(value)) return `${value}px`;
+ if (typeof value === 'number') return `${value}px`;
return value;
};
const getNumber = (value: string | number) => {
- if (isString(value)) return toNumber(value.replace(/[^0-9]+/, ''));
+ if (typeof value === 'string') return Number(value.replace(/[^0-9]+/, ''));
return value;
};
// 自动省略并提示组件
export class OverflowedText extends PureComponent
{
- static defaultProps = {
- className: '',
- text: 'overflowed text',
- maxWidth: '100px',
- style: {},
- };
+ private textElement: HTMLDivElement | null = null;
state = {
isOverflow: false,
@@ -44,14 +35,12 @@ export class OverflowedText extends PureComponent {
prevProps.maxHeight !== this.props.maxHeight ||
prevProps.style !== this.props.style
) {
- // @ts-ignore
- this.init(this.$text);
+ this.init(this.textElement);
}
}
- init = (node: HTMLDivElement) => {
- // @ts-ignore
- this.$text = node;
+ init = (node: HTMLDivElement | null) => {
+ this.textElement = node;
if (!node) return;
const { maxHeight } = this.props;
this.setState({
@@ -64,14 +53,6 @@ export class OverflowedText extends PureComponent {
render() {
const { text, className, maxWidth, maxHeight, style = {} } = this.props;
const { fontSize, lineHeight } = style;
- const props = omit(this.props, [
- 'className',
- 'text',
- 'maxWidth',
- 'maxHeight',
- 'style',
- 'width',
- ]);
const cls = cx(
'overflow-hidden text-ellipsis',
className,
@@ -104,7 +85,6 @@ export class OverflowedText extends PureComponent {
title={text}
placement="topLeft"
overlayStyle={{ maxWidth: '50vw' }}
- {...props}
>
{text}