mirror of
https://github.com/apache/superset.git
synced 2026-05-22 00:05:15 +00:00
refactor(Components): Use named imports
This commit is contained in:
@@ -20,7 +20,7 @@ import { useEffect, useMemo, useState } from 'react';
|
||||
import { shallowEqual, useSelector } from 'react-redux';
|
||||
import { useInView } from 'react-intersection-observer';
|
||||
import { omit } from 'lodash';
|
||||
import { EmptyState } from 'src/components';
|
||||
import { EmptyState, Skeleton } from 'src/components';
|
||||
import {
|
||||
t,
|
||||
styled,
|
||||
@@ -31,7 +31,6 @@ import {
|
||||
import QueryTable from 'src/SqlLab/components/QueryTable';
|
||||
import { SqlLabRootState } from 'src/SqlLab/types';
|
||||
import { useEditorQueriesQuery } from 'src/hooks/apiResources/queries';
|
||||
import Skeleton from 'src/components/Skeleton';
|
||||
import useEffectEvent from 'src/hooks/useEffectEvent';
|
||||
|
||||
interface QueryHistoryProps {
|
||||
|
||||
@@ -62,7 +62,7 @@ import {
|
||||
} from 'src/components';
|
||||
import Timer from 'src/components/Timer';
|
||||
import ResizableSidebar from 'src/components/ResizableSidebar';
|
||||
import Skeleton from 'src/components/Skeleton';
|
||||
import { Skeleton } from 'src/components/Skeleton';
|
||||
import { Switch } from 'src/components/Switch';
|
||||
import { Menu } from 'src/components/Menu';
|
||||
import { Icons } from 'src/components/Icons';
|
||||
|
||||
@@ -40,8 +40,8 @@ import {
|
||||
CopyToClipboard,
|
||||
Dropdown,
|
||||
FilterableTable,
|
||||
Skeleton,
|
||||
} from 'src/components';
|
||||
import Skeleton from 'src/components/Skeleton';
|
||||
import Tabs from 'src/components/Tabs';
|
||||
import {
|
||||
tableApiUtil,
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { styled, useTheme } from '@superset-ui/core';
|
||||
import Skeleton from 'src/components/Skeleton';
|
||||
import { FC } from 'react';
|
||||
import { styled, useTheme } from '@superset-ui/core';
|
||||
import { Skeleton } from '../Skeleton';
|
||||
import { Card } from '../Card';
|
||||
import { CertifiedBadge } from '../CertifiedBadge';
|
||||
import { Tooltip } from '../Tooltip';
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { Icons } from 'src/components/Icons';
|
||||
import { css } from '@superset-ui/core';
|
||||
import { Icons } from 'src/components/Icons';
|
||||
import { Space } from '../Space';
|
||||
import { Radio, RadioProps, RadioGroupWrapperProps } from './index';
|
||||
import { Radio, type RadioProps, type RadioGroupWrapperProps } from '.';
|
||||
|
||||
export default {
|
||||
title: 'Components/Radio',
|
||||
|
||||
@@ -16,14 +16,13 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { Radio as Antd5Radio, CheckboxOptionType } from 'antd-v5';
|
||||
import type {
|
||||
RadioChangeEvent,
|
||||
RadioProps,
|
||||
RadioGroupProps,
|
||||
} from 'antd-v5/es/radio';
|
||||
import {
|
||||
Radio as Antd5Radio,
|
||||
type CheckboxOptionType,
|
||||
type RadioGroupProps,
|
||||
} from 'antd-v5';
|
||||
|
||||
import { Space, SpaceProps } from '../Space';
|
||||
import { Space, type SpaceProps } from '../Space';
|
||||
|
||||
export type RadioGroupWrapperProps = RadioGroupProps & {
|
||||
spaceConfig?: {
|
||||
@@ -51,13 +50,13 @@ const RadioGroup = ({
|
||||
</Antd5Radio.Group>
|
||||
);
|
||||
};
|
||||
export const Radio = Object.assign(Antd5Radio, {
|
||||
GroupWrapper: RadioGroup,
|
||||
Button: Antd5Radio.Button,
|
||||
});
|
||||
export type {
|
||||
RadioChangeEvent,
|
||||
RadioGroupProps,
|
||||
RadioProps,
|
||||
CheckboxOptionType,
|
||||
};
|
||||
export const Radio = Object.assign(Antd5Radio, {
|
||||
GroupWrapper: RadioGroup,
|
||||
Button: Antd5Radio.Button,
|
||||
});
|
||||
} from 'antd-v5';
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { SkeletonButtonProps } from 'antd-v5/es/skeleton/Button';
|
||||
import { type SkeletonButtonProps } from 'antd-v5/es/skeleton/Button';
|
||||
import { Space } from '../Space';
|
||||
import { AvatarProps } from '../Avatar/types';
|
||||
import Skeleton, { type SkeletonProps } from './index';
|
||||
import { Skeleton, type SkeletonProps } from '.';
|
||||
|
||||
const { Avatar, Button, Input, Image } = Skeleton;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { Skeleton } from 'antd';
|
||||
import { Skeleton } from '.';
|
||||
|
||||
describe('Skeleton Component', () => {
|
||||
test('renders skeleton', () => {
|
||||
|
||||
@@ -16,7 +16,4 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { Skeleton, type SkeletonProps } from 'antd-v5';
|
||||
|
||||
export type { SkeletonProps };
|
||||
export default Skeleton;
|
||||
export { Skeleton, type SkeletonProps } from 'antd-v5';
|
||||
|
||||
@@ -16,14 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Re-exporting of components in src/components to facilitate
|
||||
* their imports by other components.
|
||||
* E.g. import { Select } from 'src/components'
|
||||
*/
|
||||
|
||||
import { Space, SpaceProps } from 'src/components/Space';
|
||||
import { Space, type SpaceProps } from '.';
|
||||
|
||||
export default {
|
||||
title: 'Design System/Components/Space',
|
||||
|
||||
@@ -16,12 +16,4 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Re-exporting of components in src/components to facilitate
|
||||
* their imports by other components.
|
||||
* E.g. import { Select } from 'src/components'
|
||||
*/
|
||||
|
||||
export { Space } from 'antd-v5';
|
||||
export type { SpaceProps } from 'antd-v5/es/space';
|
||||
export { Space, type SpaceProps } from 'antd-v5';
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import { Steps as AntdSteps } from 'antd-v5';
|
||||
import { Steps, StepsProps } from '.';
|
||||
import { Steps, type StepsProps } from '.';
|
||||
|
||||
export default {
|
||||
title: 'Components/Steps',
|
||||
|
||||
@@ -16,18 +16,4 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Re-exporting of components in src/components to facilitate
|
||||
* their imports by other components.
|
||||
* E.g. import { Select } from 'src/components'
|
||||
*/
|
||||
|
||||
import { Steps as AntdSteps } from 'antd-v5';
|
||||
import { StepsProps as AntdStepsProps } from 'antd-v5/es/steps';
|
||||
|
||||
export type StepsProps = AntdStepsProps;
|
||||
|
||||
export const Steps: typeof AntdSteps = Object.assign(AntdSteps, {
|
||||
Step: AntdSteps.Step,
|
||||
});
|
||||
export { Steps, type StepsProps } from 'antd-v5';
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import { useArgs } from '@storybook/preview-api';
|
||||
import { Switch, SwitchProps } from '.';
|
||||
import { Switch, type SwitchProps } from '.';
|
||||
|
||||
export default {
|
||||
title: 'Components/Switch',
|
||||
|
||||
@@ -16,8 +16,4 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { SwitchProps } from 'antd-v5/es/switch';
|
||||
import { Switch as AntdSwitch } from 'antd-v5';
|
||||
|
||||
export const Switch = (props: SwitchProps) => <AntdSwitch {...props} />;
|
||||
export type { SwitchProps };
|
||||
export { Switch, type SwitchProps } from 'antd-v5';
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import TreeSelect, { type TreeSelectProps } from 'src/components/TreeSelect';
|
||||
import { TreeSelect, type TreeSelectProps } from '.';
|
||||
|
||||
export default {
|
||||
title: 'Components/TreeSelect',
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
import { render, fireEvent, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import TreeSelect from '.';
|
||||
import { TreeSelect } from '.';
|
||||
|
||||
const treeData = [
|
||||
{
|
||||
|
||||
@@ -16,8 +16,4 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { TreeSelect } from 'antd-v5';
|
||||
import type { TreeSelectProps } from 'antd-v5/es/tree-select';
|
||||
|
||||
export default TreeSelect;
|
||||
export type { TreeSelectProps };
|
||||
export { TreeSelect, type TreeSelectProps } from 'antd-v5';
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
* Re-exporting of components in src/components to facilitate
|
||||
* their imports by other components.
|
||||
* E.g. import { Select } from 'src/components', probably in the future from '@superset-ui/components'
|
||||
import { StepsProps, type TreeSelectProps } from '.';
|
||||
import { SwitchProps } from '../features/databases/types';
|
||||
import TreeSelect from '.';
|
||||
*/
|
||||
export { AntdThemeProvider } from './AntdThemeProvider';
|
||||
export { Alert, type AlertProps } from './Alert';
|
||||
@@ -188,6 +191,17 @@ export {
|
||||
type RefSelectProps,
|
||||
} from './Select';
|
||||
|
||||
export { Image, type ImageProps } from './Image';
|
||||
export { Steps, StepsProps } from './Steps';
|
||||
|
||||
export { Space, type SpaceProps } from './Space';
|
||||
|
||||
export { Skeleton, type SkeletonProps } from './Skeleton';
|
||||
|
||||
export { Switch, type SwitchProps } from './Switch';
|
||||
|
||||
export { TreeSelect, type TreeSelectProps } from './TreeSelect';
|
||||
|
||||
export { Typography, type TypographyProps } from './Typography';
|
||||
|
||||
export { Image, type ImageProps } from './Image';
|
||||
export { Upload, type UploadFile, type UploadChangeParam } from './Upload';
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
*/
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { css, t } from '@superset-ui/core';
|
||||
import { Input, CopyToClipboard } from 'src/components';
|
||||
import { Input, CopyToClipboard, Space, Typography } from 'src/components';
|
||||
import { URL_PARAMS } from 'src/constants';
|
||||
import { getChartPermalink } from 'src/utils/urlUtils';
|
||||
import { Typography } from 'src/components/Typography';
|
||||
import { Icons } from 'src/components/Icons';
|
||||
import { Space } from 'src/components/Space';
|
||||
|
||||
const EmbedCodeContent = ({ formData, addDangerToast }) => {
|
||||
const [height, setHeight] = useState('400');
|
||||
|
||||
@@ -42,18 +42,18 @@ import {
|
||||
Input,
|
||||
InputNumber,
|
||||
Modal,
|
||||
Switch,
|
||||
Collapse,
|
||||
Select,
|
||||
AsyncSelect,
|
||||
Checkbox,
|
||||
TreeSelect,
|
||||
type CheckboxChangeEvent,
|
||||
} from 'src/components';
|
||||
import { Switch } from 'src/components/Switch';
|
||||
import TimezoneSelector from 'src/components/TimezoneSelector';
|
||||
import { propertyComparator } from 'src/components/Select/utils';
|
||||
import withToasts from 'src/components/MessageToasts/withToasts';
|
||||
import Owner from 'src/types/Owner';
|
||||
import TreeSelect from 'src/components/TreeSelect';
|
||||
import TextAreaControl from 'src/explore/components/controls/TextAreaControl';
|
||||
import { useCommonConf } from 'src/features/databases/state';
|
||||
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
|
||||
|
||||
@@ -33,8 +33,7 @@ import {
|
||||
} from '@superset-ui/core';
|
||||
import { debounce, isUndefined } from 'lodash';
|
||||
import { useImmerReducer } from 'use-immer';
|
||||
import { FormItem, LabeledValue, Select } from 'src/components';
|
||||
import { Space } from 'src/components/Space';
|
||||
import { FormItem, LabeledValue, Select, Space } from 'src/components';
|
||||
import { SLOW_DEBOUNCE } from 'src/constants';
|
||||
import { hasOption, propertyComparator } from 'src/components/Select/utils';
|
||||
import { FilterBarOrientation } from 'src/dashboard/types';
|
||||
|
||||
@@ -30,8 +30,7 @@ import { withTheme, Theme } from '@emotion/react';
|
||||
import { getUrlParam } from 'src/utils/urlUtils';
|
||||
import { FilterPlugins, URL_PARAMS } from 'src/constants';
|
||||
import { Link, withRouter, RouteComponentProps } from 'react-router-dom';
|
||||
import { AsyncSelect, Button } from 'src/components';
|
||||
import { Steps } from 'src/components/Steps';
|
||||
import { AsyncSelect, Button, Steps } from 'src/components';
|
||||
import withToasts from 'src/components/MessageToasts/withToasts';
|
||||
|
||||
import VizTypeGallery, {
|
||||
|
||||
Reference in New Issue
Block a user