Merge remote-tracking branch 'upstream/master'

This commit is contained in:
be_loving@163.com 2025-01-01 11:03:59 +08:00
commit 2b55dc5a9e
18 changed files with 182 additions and 19 deletions

View File

@ -120,7 +120,7 @@ class BigNumberVis extends PureComponent<BigNumberVizProps> {
className="kicker" className="kicker"
style={{ style={{
fontSize, fontSize,
height: maxHeight, height: 'auto',
}} }}
> >
{text} {text}
@ -156,7 +156,7 @@ class BigNumberVis extends PureComponent<BigNumberVizProps> {
document.body.append(container); document.body.append(container);
const fontSize = computeMaxFontSize({ const fontSize = computeMaxFontSize({
text, text,
maxWidth: width - 8, // Decrease 8px for more precise font size maxWidth: width * 0.9, // reduced it's max width
maxHeight, maxHeight,
className: 'header-line', className: 'header-line',
container, container,
@ -174,8 +174,10 @@ class BigNumberVis extends PureComponent<BigNumberVizProps> {
<div <div
className="header-line" className="header-line"
style={{ style={{
display: 'flex',
alignItems: 'center',
fontSize, fontSize,
height: maxHeight, height: 'auto',
color: numberColor, color: numberColor,
}} }}
onContextMenu={onContextMenu} onContextMenu={onContextMenu}
@ -204,7 +206,7 @@ class BigNumberVis extends PureComponent<BigNumberVizProps> {
document.body.append(container); document.body.append(container);
fontSize = computeMaxFontSize({ fontSize = computeMaxFontSize({
text, text,
maxWidth: width, maxWidth: width * 0.9, // max width reduced
maxHeight, maxHeight,
className: 'subheader-line', className: 'subheader-line',
container, container,
@ -356,6 +358,7 @@ export default styled(BigNumberVis)`
position: relative; position: relative;
line-height: 1em; line-height: 1em;
white-space: nowrap; white-space: nowrap;
margin-bottom:${theme.gridUnit * 2}px;
span { span {
position: absolute; position: absolute;
bottom: 0; bottom: 0;

View File

@ -42,7 +42,7 @@ interface QueryHistoryProps {
const StyledEmptyStateWrapper = styled.div` const StyledEmptyStateWrapper = styled.div`
height: 100%; height: 100%;
.ant-empty-image img { .antd5-empty-image img {
margin-right: 28px; margin-right: 28px;
} }

View File

@ -37,7 +37,7 @@ type Props = {
const StyledEmptyStateWrapper = styled.div` const StyledEmptyStateWrapper = styled.div`
height: 100%; height: 100%;
.ant-empty-image img { .antd5-empty-image img {
margin-right: 28px; margin-right: 28px;
} }

View File

@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
import { useState, useRef, useCallback } from 'react'; import { useState, useRef, useCallback } from 'react';
import { Divider } from 'src/components'; import { Divider } from 'src/components/Divider';
import { Input } from 'src/components/Input'; import { Input } from 'src/components/Input';
import { CronPicker, CronError, CronProps } from '.'; import { CronPicker, CronError, CronProps } from '.';

View File

@ -0,0 +1,52 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Divider, DividerProps } from 'src/components/Divider';
export default {
title: 'Divider',
component: Divider,
};
export const InteractiveDivider = (args: DividerProps) => <Divider {...args} />;
InteractiveDivider.args = {
dashed: false,
variant: 'solid',
orientation: 'center',
plain: true,
type: 'horizontal',
};
InteractiveDivider.argTypes = {
variant: {
control: { type: 'select' },
options: ['dashed', 'dotted', 'solid'],
},
orientation: {
control: { type: 'select' },
options: ['left', 'right', 'center'],
},
orientationMargin: {
control: { type: 'text' },
},
type: {
control: { type: 'select' },
options: ['horizontal', 'vertical'],
},
};

View File

@ -0,0 +1,25 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { render } from 'spec/helpers/testing-library';
import { Divider } from '.';
test('should render', () => {
const { container } = render(<Divider />);
expect(container).toBeInTheDocument();
});

View File

@ -0,0 +1,27 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Divider as AntdDivider } from 'antd-v5';
import type { DividerProps } from 'antd-v5/es/divider';
export function Divider(props: DividerProps) {
return <AntdDivider {...props} />;
}
export { DividerProps };

View File

@ -0,0 +1,26 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { render } from 'spec/helpers/testing-library';
import { Empty } from './Empty';
test('should render', () => {
const { container } = render(<Empty />);
expect(container).toBeInTheDocument();
});

View File

@ -0,0 +1,29 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Empty as AntdEmpty } from 'antd-v5';
import { EmptyProps } from 'antd-v5/es/empty';
export const Empty = Object.assign(
(props: EmptyProps) => <AntdEmpty {...props} />,
{
PRESENTED_IMAGE_SIMPLE: AntdEmpty.PRESENTED_IMAGE_SIMPLE,
PRESENTED_IMAGE_DEFAULT: AntdEmpty.PRESENTED_IMAGE_DEFAULT,
},
);

View File

@ -23,8 +23,8 @@ import {
MouseEventHandler as ReactMouseEventHandler, MouseEventHandler as ReactMouseEventHandler,
} from 'react'; } from 'react';
import { styled, css, SupersetTheme, t } from '@superset-ui/core'; import { styled, css, SupersetTheme, t } from '@superset-ui/core';
import { Empty } from 'src/components';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import { Empty } from './Empty';
export enum EmptyStateSize { export enum EmptyStateSize {
Small, Small,
@ -60,7 +60,7 @@ const EmptyStateContainer = styled.div`
padding: ${theme.gridUnit * 4}px; padding: ${theme.gridUnit * 4}px;
text-align: center; text-align: center;
& .ant-empty-image svg { & .antd5-empty-image svg {
width: auto; width: auto;
} }

View File

@ -22,7 +22,7 @@ import { QueryParamProvider } from 'use-query-params';
import { supersetTheme, ThemeProvider } from '@superset-ui/core'; import { supersetTheme, ThemeProvider } from '@superset-ui/core';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import { Empty } from 'src/components'; import { Empty } from 'src/components/EmptyState/Empty';
import CardCollection from 'src/components/ListView/CardCollection'; import CardCollection from 'src/components/ListView/CardCollection';
import { CardSortSelect } from 'src/components/ListView/CardSortSelect'; import { CardSortSelect } from 'src/components/ListView/CardSortSelect';
import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox'; import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox';

View File

@ -67,8 +67,8 @@ const ListViewStyles = styled.div`
overflow-x: auto; overflow-x: auto;
} }
.ant-empty { .antd5-empty {
.ant-empty-image { .antd5-empty-image {
height: auto; height: auto;
} }
} }

View File

@ -20,7 +20,7 @@ import { memo, useEffect, useRef } from 'react';
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
import { styled, t } from '@superset-ui/core'; import { styled, t } from '@superset-ui/core';
import { useFilters, usePagination, useSortBy, useTable } from 'react-table'; import { useFilters, usePagination, useSortBy, useTable } from 'react-table';
import { Empty } from 'src/components'; import { Empty } from 'src/components/EmptyState/Empty';
import Pagination from 'src/components/Pagination'; import Pagination from 'src/components/Pagination';
import TableCollection from 'src/components/TableCollection'; import TableCollection from 'src/components/TableCollection';
import { SortByType, ServerPagination } from './types'; import { SortByType, ServerPagination } from './types';

View File

@ -34,8 +34,6 @@ export { default as Card } from './Card';
export { export {
AutoComplete, AutoComplete,
Col, Col,
Divider,
Empty,
Grid, Grid,
Row, Row,
Skeleton, Skeleton,

View File

@ -30,7 +30,7 @@ import {
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import ControlHeader from 'src/explore/components/ControlHeader'; import ControlHeader from 'src/explore/components/ControlHeader';
import Modal from 'src/components/Modal'; import Modal from 'src/components/Modal';
import { Divider } from 'src/components'; import { Divider } from 'src/components/Divider';
import Icons from 'src/components/Icons'; import Icons from 'src/components/Icons';
import Select from 'src/components/Select/Select'; import Select from 'src/components/Select/Select';
import { Tooltip } from 'src/components/Tooltip'; import { Tooltip } from 'src/components/Tooltip';
@ -75,7 +75,7 @@ const ContentStyleWrapper = styled.div`
width: 100%; width: 100%;
} }
.ant-divider-horizontal { .antd5-divider-horizontal {
margin: 16px 0; margin: 16px 0;
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import { Empty } from 'src/components'; import { Empty } from 'src/components/EmptyState/Empty';
import { TableTab } from 'src/views/CRUD/types'; import { TableTab } from 'src/views/CRUD/types';
import { styled, t } from '@superset-ui/core'; import { styled, t } from '@superset-ui/core';
import { WelcomeTable } from './types'; import { WelcomeTable } from './types';

View File

@ -24,7 +24,7 @@ import AsyncSelect from 'src/components/Select/AsyncSelect';
import { FormLabel } from 'src/components/Form'; import { FormLabel } from 'src/components/Form';
import { t, styled, SupersetClient } from '@superset-ui/core'; import { t, styled, SupersetClient } from '@superset-ui/core';
import { Input } from 'antd'; import { Input } from 'antd';
import { Divider } from 'src/components'; import { Divider } from 'src/components/Divider';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import { Tag } from 'src/views/CRUD/types'; import { Tag } from 'src/views/CRUD/types';
import { fetchObjectsByTagIds } from 'src/features/tags/tags'; import { fetchObjectsByTagIds } from 'src/features/tags/tags';

View File

@ -77,6 +77,9 @@ const baseConfig: ThemeConfig = {
fontWeightStrong: supersetTheme.typography.weights.medium, fontWeightStrong: supersetTheme.typography.weights.medium,
colorBgContainer: supersetTheme.colors.grayscale.light4, colorBgContainer: supersetTheme.colors.grayscale.light4,
}, },
Divider: {
colorSplit: supersetTheme.colors.grayscale.light3,
},
Input: { Input: {
colorBorder: supersetTheme.colors.secondary.light3, colorBorder: supersetTheme.colors.secondary.light3,
colorBgContainer: supersetTheme.colors.grayscale.light5, colorBgContainer: supersetTheme.colors.grayscale.light5,