chore: remove React 16.4's obsolete React imports (#28571)
Signed-off-by: hainenber <dotronghai96@gmail.com>
This commit is contained in:
parent
8a8ce16a1f
commit
0ca42a8e4d
|
|
@ -16,6 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { ReactNode } from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
import { mq } from '../utils';
|
||||
|
||||
|
|
@ -95,7 +96,7 @@ const StyledSectionHeaderH2 = styled(StyledSectionHeader)`
|
|||
interface SectionHeaderProps {
|
||||
level: any;
|
||||
title: string;
|
||||
subtitle?: string | React.ReactNode;
|
||||
subtitle?: string | ReactNode;
|
||||
dark?: boolean;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,6 +184,16 @@ module.exports = {
|
|||
'react/no-unused-class-component-methods': 0,
|
||||
'import/no-relative-packages': 0,
|
||||
'prefer-exponentiation-operator': 0,
|
||||
'react/react-in-jsx-scope': 0,
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
selector:
|
||||
"ImportDeclaration[source.value='react'] :matches(ImportDefaultSpecifier, ImportNamespaceSpecifier)",
|
||||
message:
|
||||
'Default React import is not required due to automatic JSX runtime in React 16.4',
|
||||
},
|
||||
],
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
|
|
@ -242,6 +252,15 @@ module.exports = {
|
|||
'testing-library/no-container': 0,
|
||||
'testing-library/prefer-find-by': 0,
|
||||
'testing-library/no-manual-cleanup': 0,
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
selector:
|
||||
"ImportDeclaration[source.value='react'] :matches(ImportDefaultSpecifier, ImportNamespaceSpecifier)",
|
||||
message:
|
||||
'Default React import is not required due to automatic JSX runtime in React 16.4',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -369,6 +388,7 @@ module.exports = {
|
|||
'default-case-last': 0,
|
||||
'no-promise-executor-return': 0,
|
||||
'react/no-unused-class-component-methods': 0,
|
||||
'react/react-in-jsx-scope': 0,
|
||||
},
|
||||
ignorePatterns,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { jsxDecorator } from 'storybook-addon-jsx';
|
||||
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
||||
import { combineReducers, createStore, applyMiddleware, compose } from 'redux';
|
||||
|
|
|
|||
|
|
@ -36,16 +36,13 @@ module.exports = {
|
|||
],
|
||||
[
|
||||
'@babel/preset-react',
|
||||
{ development: process.env.BABEL_ENV === 'development' },
|
||||
],
|
||||
'@babel/preset-typescript',
|
||||
[
|
||||
'@emotion/babel-preset-css-prop',
|
||||
{
|
||||
autoLabel: 'dev-only',
|
||||
labelFormat: '[local]',
|
||||
development: process.env.BABEL_ENV === 'development',
|
||||
runtime: 'automatic',
|
||||
importSource: '@emotion/react',
|
||||
},
|
||||
],
|
||||
'@babel/preset-typescript',
|
||||
],
|
||||
plugins: [
|
||||
'lodash',
|
||||
|
|
@ -58,6 +55,13 @@ module.exports = {
|
|||
// only used in packages/superset-ui-core/src/chart/components/reactify.tsx
|
||||
['babel-plugin-typescript-to-proptypes', { loose: true }],
|
||||
'react-hot-loader/babel',
|
||||
[
|
||||
'@emotion/babel-plugin',
|
||||
{
|
||||
autoLabel: 'dev-only',
|
||||
labelFormat: '[local]',
|
||||
},
|
||||
],
|
||||
],
|
||||
env: {
|
||||
// Setup a different config for tests as they run in node instead of a browser
|
||||
|
|
@ -74,7 +78,6 @@ module.exports = {
|
|||
targets: { node: 'current' },
|
||||
},
|
||||
],
|
||||
['@emotion/babel-preset-css-prop'],
|
||||
],
|
||||
plugins: ['babel-plugin-dynamic-import-node'],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.2.6",
|
||||
"@emotion/babel-preset-css-prop": "^11.11.0",
|
||||
"@emotion/cache": "^11.4.0",
|
||||
"@emotion/react": "^11.4.1",
|
||||
"@emotion/styled": "^11.3.0",
|
||||
|
|
@ -157,6 +156,7 @@
|
|||
"@babel/preset-react": "^7.22.5",
|
||||
"@babel/register": "^7.23.7",
|
||||
"@cypress/react": "^5.10.0",
|
||||
"@emotion/babel-plugin": "^11.11.0",
|
||||
"@emotion/jest": "^11.3.0",
|
||||
"@hot-loader/react-dom": "^16.14.0",
|
||||
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
||||
|
|
@ -1640,6 +1640,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz",
|
||||
"integrity": "sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.22.5"
|
||||
},
|
||||
|
|
@ -2342,6 +2343,7 @@
|
|||
"version": "7.23.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz",
|
||||
"integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
},
|
||||
|
|
@ -3136,6 +3138,8 @@
|
|||
"version": "7.23.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.23.4.tgz",
|
||||
"integrity": "sha512-5xOpoPguCZCRbo/JeHlloSkTA8Bld1J/E1/kLfD1nsuiW1m8tduTA1ERCgIZokDflX/IBzKcqR3l7VlRgiIfHA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-annotate-as-pure": "^7.22.5",
|
||||
"@babel/helper-module-imports": "^7.22.15",
|
||||
|
|
@ -4972,6 +4976,7 @@
|
|||
"version": "11.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.11.0.tgz",
|
||||
"integrity": "sha512-m4HEDZleaaCH+XgDDsPF15Ht6wTLsgDTeR3WYj9Q/k76JtWhrJjcP4+/XlG8LGT/Rol9qUfOIztXeA84ATpqPQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-module-imports": "^7.16.7",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
|
|
@ -4986,17 +4991,6 @@
|
|||
"stylis": "4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emotion/babel-plugin-jsx-pragmatic": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin-jsx-pragmatic/-/babel-plugin-jsx-pragmatic-0.2.1.tgz",
|
||||
"integrity": "sha512-xy1SlgEJygAAIvIuC2idkGKJYa6v5iwoyILkvNKgk347bV+IImXrUat5Z86EmLGyWhEoTplVT9EHqTnHZG4HFw==",
|
||||
"dependencies": {
|
||||
"@babel/plugin-syntax-jsx": "^7.17.12"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emotion/babel-plugin/node_modules/@emotion/hash": {
|
||||
"version": "0.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.1.tgz",
|
||||
|
|
@ -5062,20 +5056,6 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emotion/babel-preset-css-prop": {
|
||||
"version": "11.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/babel-preset-css-prop/-/babel-preset-css-prop-11.11.0.tgz",
|
||||
"integrity": "sha512-+1Cba68IyBeltWzvbBSXcBWqP2eKQuQcSUpIu3ma4pOUeRol4EvwWrYS2Rv51aIVqg066fLB+Z9O/8NKR7uUlQ==",
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-react-jsx": "^7.17.12",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@emotion/babel-plugin": "^11.11.0",
|
||||
"@emotion/babel-plugin-jsx-pragmatic": "^0.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emotion/cache": {
|
||||
"version": "11.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz",
|
||||
|
|
@ -72180,6 +72160,7 @@
|
|||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz",
|
||||
"integrity": "sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/types": "^7.22.5"
|
||||
}
|
||||
|
|
@ -72673,6 +72654,7 @@
|
|||
"version": "7.23.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz",
|
||||
"integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.22.5"
|
||||
}
|
||||
|
|
@ -73179,6 +73161,7 @@
|
|||
"version": "7.23.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.23.4.tgz",
|
||||
"integrity": "sha512-5xOpoPguCZCRbo/JeHlloSkTA8Bld1J/E1/kLfD1nsuiW1m8tduTA1ERCgIZokDflX/IBzKcqR3l7VlRgiIfHA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-annotate-as-pure": "^7.22.5",
|
||||
"@babel/helper-module-imports": "^7.22.15",
|
||||
|
|
@ -74708,25 +74691,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@emotion/babel-plugin-jsx-pragmatic": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin-jsx-pragmatic/-/babel-plugin-jsx-pragmatic-0.2.1.tgz",
|
||||
"integrity": "sha512-xy1SlgEJygAAIvIuC2idkGKJYa6v5iwoyILkvNKgk347bV+IImXrUat5Z86EmLGyWhEoTplVT9EHqTnHZG4HFw==",
|
||||
"requires": {
|
||||
"@babel/plugin-syntax-jsx": "^7.17.12"
|
||||
}
|
||||
},
|
||||
"@emotion/babel-preset-css-prop": {
|
||||
"version": "11.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/babel-preset-css-prop/-/babel-preset-css-prop-11.11.0.tgz",
|
||||
"integrity": "sha512-+1Cba68IyBeltWzvbBSXcBWqP2eKQuQcSUpIu3ma4pOUeRol4EvwWrYS2Rv51aIVqg066fLB+Z9O/8NKR7uUlQ==",
|
||||
"requires": {
|
||||
"@babel/plugin-transform-react-jsx": "^7.17.12",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@emotion/babel-plugin": "^11.11.0",
|
||||
"@emotion/babel-plugin-jsx-pragmatic": "^0.2.1"
|
||||
}
|
||||
},
|
||||
"@emotion/cache": {
|
||||
"version": "11.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz",
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.2.6",
|
||||
"@emotion/babel-preset-css-prop": "^11.11.0",
|
||||
"@emotion/cache": "^11.4.0",
|
||||
"@emotion/react": "^11.4.1",
|
||||
"@emotion/styled": "^11.3.0",
|
||||
|
|
@ -222,6 +221,7 @@
|
|||
"@babel/preset-react": "^7.22.5",
|
||||
"@babel/register": "^7.23.7",
|
||||
"@cypress/react": "^5.10.0",
|
||||
"@emotion/babel-plugin": "^11.11.0",
|
||||
"@emotion/jest": "^11.3.0",
|
||||
"@hot-loader/react-dom": "^16.14.0",
|
||||
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { kebabCase } from 'lodash';
|
||||
import { t, useTheme, styled } from '@superset-ui/core';
|
||||
import Tooltip from './Tooltip';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { useState, ReactNode, useLayoutEffect } from 'react';
|
||||
import { useState, ReactNode, useLayoutEffect, RefObject } from 'react';
|
||||
import { css, styled, SupersetTheme } from '@superset-ui/core';
|
||||
import { Tooltip } from './Tooltip';
|
||||
import { ColumnTypeLabel } from './ColumnTypeLabel/ColumnTypeLabel';
|
||||
|
|
@ -32,7 +32,7 @@ import { SQLPopover } from './SQLPopover';
|
|||
export type ColumnOptionProps = {
|
||||
column: ColumnMeta;
|
||||
showType?: boolean;
|
||||
labelRef?: React.RefObject<any>;
|
||||
labelRef?: RefObject<any>;
|
||||
};
|
||||
|
||||
const StyleOverrides = styled.span`
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { css, GenericDataType, styled, t } from '@superset-ui/core';
|
||||
import { ClockCircleOutlined, QuestionOutlined } from '@ant-design/icons';
|
||||
// TODO: move all icons to superset-ui/core
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { t } from '@superset-ui/core';
|
||||
import { InfoTooltipWithTrigger } from './InfoTooltipWithTrigger';
|
||||
import { Tooltip } from './Tooltip';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { CSSProperties } from 'react';
|
||||
import { CSSProperties } from 'react';
|
||||
import { kebabCase } from 'lodash';
|
||||
import { TooltipPlacement } from 'antd/lib/tooltip';
|
||||
import { t } from '@superset-ui/core';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { useState, ReactNode, useLayoutEffect } from 'react';
|
||||
import { useState, ReactNode, useLayoutEffect, RefObject } from 'react';
|
||||
|
||||
import {
|
||||
css,
|
||||
styled,
|
||||
|
|
@ -46,7 +47,7 @@ export interface MetricOptionProps {
|
|||
showFormula?: boolean;
|
||||
showType?: boolean;
|
||||
url?: string;
|
||||
labelRef?: React.RefObject<any>;
|
||||
labelRef?: RefObject<any>;
|
||||
shouldShowTooltip?: boolean;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { Popover } from 'antd';
|
||||
import type { PopoverProps } from 'antd/lib/popover';
|
||||
import AceEditor from 'react-ace';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { useState, ReactNode } from 'react';
|
||||
import { useState, ReactNode } from 'react';
|
||||
import AntdSelect, { SelectProps as AntdSelectProps } from 'antd/lib/select';
|
||||
|
||||
export const { Option }: any = AntdSelect;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { useTheme, css } from '@superset-ui/core';
|
||||
import { Tooltip as BaseTooltip } from 'antd';
|
||||
import type { TooltipProps } from 'antd/lib/tooltip';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode, RefObject } from 'react';
|
||||
|
||||
import { css, styled, t } from '@superset-ui/core';
|
||||
import { ColumnMeta, Metric } from '@superset-ui/chart-controls';
|
||||
|
|
@ -60,7 +60,7 @@ const TooltipSection = ({
|
|||
</TooltipSectionWrapper>
|
||||
);
|
||||
|
||||
export const isLabelTruncated = (labelRef?: React.RefObject<any>): boolean =>
|
||||
export const isLabelTruncated = (labelRef?: RefObject<any>): boolean =>
|
||||
!!(labelRef?.current?.scrollWidth > labelRef?.current?.clientWidth);
|
||||
|
||||
export const getColumnLabelText = (column: ColumnMeta): string =>
|
||||
|
|
@ -81,7 +81,7 @@ export const getColumnTypeTooltipNode = (column: ColumnMeta): ReactNode => {
|
|||
|
||||
export const getColumnTooltipNode = (
|
||||
column: ColumnMeta,
|
||||
labelRef?: React.RefObject<any>,
|
||||
labelRef?: RefObject<any>,
|
||||
): ReactNode => {
|
||||
if (
|
||||
(!column.column_name || !column.verbose_name) &&
|
||||
|
|
@ -110,7 +110,7 @@ type MetricType = Omit<Metric, 'id'> & { label?: string };
|
|||
|
||||
export const getMetricTooltipNode = (
|
||||
metric: MetricType,
|
||||
labelRef?: React.RefObject<any>,
|
||||
labelRef?: RefObject<any>,
|
||||
): ReactNode => {
|
||||
if (
|
||||
!metric.verbose_name &&
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { t, RollingType, ComparisonType } from '@superset-ui/core';
|
||||
|
||||
import { ControlSubSectionHeader } from '../components/ControlSubSectionHeader';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { t } from '@superset-ui/core';
|
||||
|
||||
import { ControlSubSectionHeader } from '../components/ControlSubSectionHeader';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { ReactNode } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { JsonValue, useTheme } from '@superset-ui/core';
|
||||
import ControlHeader from '../../components/ControlHeader';
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { QueryColumn, t, validateNonEmpty } from '@superset-ui/core';
|
||||
import {
|
||||
ExtraControlProps,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { ReactElement, ReactNode, ReactText } from 'react';
|
||||
import { ReactElement, ReactNode, ReactText, ComponentType } from 'react';
|
||||
|
||||
import type {
|
||||
AdhocColumn,
|
||||
Column,
|
||||
|
|
@ -175,7 +176,7 @@ export type InternalControlType =
|
|||
| keyof SharedControlComponents; // expanded in `expandControlConfig`
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type ControlType = InternalControlType | React.ComponentType<any>;
|
||||
export type ControlType = InternalControlType | ComponentType<any>;
|
||||
|
||||
export type TabOverride = 'data' | 'customize' | boolean;
|
||||
|
||||
|
|
@ -314,9 +315,7 @@ export type SharedControlConfig<
|
|||
/** --------------------------------------------
|
||||
* Custom controls
|
||||
* --------------------------------------------- */
|
||||
export type CustomControlConfig<P = {}> = BaseControlConfig<
|
||||
React.ComponentType<P>
|
||||
> &
|
||||
export type CustomControlConfig<P = {}> = BaseControlConfig<ComponentType<P>> &
|
||||
// two run-time properties from superset-frontend/src/explore/components/Control.jsx
|
||||
Omit<P, 'onChange' | 'hovered'>;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { ReactElement } from 'react';
|
||||
import { isValidElement, ReactElement } from 'react';
|
||||
import { sharedControls, sharedControlComponents } from '../shared-controls';
|
||||
import {
|
||||
ControlType,
|
||||
|
|
@ -63,11 +63,7 @@ export function expandControlConfig(
|
|||
};
|
||||
}
|
||||
// JSX/React element or NULL
|
||||
if (
|
||||
!control ||
|
||||
typeof control === 'string' ||
|
||||
React.isValidElement(control)
|
||||
) {
|
||||
if (!control || typeof control === 'string' || isValidElement(control)) {
|
||||
return control as ReactElement;
|
||||
}
|
||||
// already fully expanded control config, e.g.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { isValidElement } from 'react';
|
||||
import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import { GenericDataType } from '@superset-ui/core';
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ describe('ColumnOption', () => {
|
|||
props = { ...defaultProps };
|
||||
});
|
||||
it('is a valid element', () => {
|
||||
expect(React.isValidElement(<ColumnOption {...defaultProps} />)).toBe(true);
|
||||
expect(isValidElement(<ColumnOption {...defaultProps} />)).toBe(true);
|
||||
});
|
||||
it('shows a label with verbose_name', () => {
|
||||
const lbl = wrapper.find('.option-label');
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { isValidElement } from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { GenericDataType } from '@superset-ui/core';
|
||||
|
|
@ -35,9 +35,7 @@ describe('ColumnOption', () => {
|
|||
}
|
||||
|
||||
it('is a valid element', () => {
|
||||
expect(React.isValidElement(<ColumnTypeLabel {...defaultProps} />)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(isValidElement(<ColumnTypeLabel {...defaultProps} />)).toBe(true);
|
||||
});
|
||||
it('string type shows ABC icon', () => {
|
||||
renderColumnTypeLabel({ type: GenericDataType.String });
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { Tooltip } from '../../src/components/Tooltip';
|
||||
import { InfoTooltipWithTrigger } from '../../src';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { isValidElement } from 'react';
|
||||
import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import { MetricOption, MetricOptionProps } from '../../src';
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ describe('MetricOption', () => {
|
|||
props = { ...defaultProps };
|
||||
});
|
||||
it('is a valid element', () => {
|
||||
expect(React.isValidElement(<MetricOption {...defaultProps} />)).toBe(true);
|
||||
expect(isValidElement(<MetricOption {...defaultProps} />)).toBe(true);
|
||||
});
|
||||
it('shows a label with verbose_name', () => {
|
||||
const lbl = wrapper.find('.option-label');
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { ReactElement } from 'react';
|
||||
import { ReactElement } from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { ThemeProvider, supersetTheme } from '@superset-ui/core';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import {
|
||||
expandControlConfig,
|
||||
sharedControls,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { PureComponent } from 'react';
|
||||
import { PureComponent, ReactNode } from 'react';
|
||||
|
||||
import { isDefined } from '../utils';
|
||||
|
||||
function checkNumber(input: unknown): input is number {
|
||||
|
|
@ -34,7 +35,7 @@ type Props = {
|
|||
}: {
|
||||
height: number;
|
||||
width: number;
|
||||
}) => React.ReactNode;
|
||||
}) => ReactNode;
|
||||
width: number;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { CSSProperties, ReactNode, PureComponent } from 'react';
|
||||
import { CSSProperties, ReactNode, PureComponent } from 'react';
|
||||
import { ParentSize } from '@vx/responsive';
|
||||
|
||||
const defaultProps = {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { PureComponent } from 'react';
|
||||
import { PureComponent, ReactNode } from 'react';
|
||||
|
||||
const defaultProps = {
|
||||
className: '',
|
||||
|
|
@ -25,7 +25,7 @@ const defaultProps = {
|
|||
|
||||
type Props = {
|
||||
className?: string;
|
||||
children: React.ReactNode;
|
||||
children: ReactNode;
|
||||
} & Readonly<typeof defaultProps>;
|
||||
|
||||
const CONTAINER_STYLE = { padding: 8 };
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { CSSProperties, PureComponent, ReactNode } from 'react';
|
||||
import { CSSProperties, PureComponent, ReactNode } from 'react';
|
||||
|
||||
interface TooltipRowData {
|
||||
key: string | number;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
/* eslint react/sort-comp: 'off' */
|
||||
import React, { ReactNode } from 'react';
|
||||
import { PureComponent, ReactNode } from 'react';
|
||||
import {
|
||||
SupersetClientInterface,
|
||||
RequestConfig,
|
||||
|
|
@ -67,7 +67,7 @@ export type ChartDataProviderState = {
|
|||
error?: ProvidedProps['error'];
|
||||
};
|
||||
|
||||
class ChartDataProvider extends React.PureComponent<
|
||||
class ChartDataProvider extends PureComponent<
|
||||
ChartDataProviderProps,
|
||||
ChartDataProviderState
|
||||
> {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { t } from '@superset-ui/core';
|
||||
import { SupersetTheme } from '../../style';
|
||||
import { FallbackPropsWithDimension } from './SuperChart';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { CSSProperties } from 'react';
|
||||
import { CSSProperties } from 'react';
|
||||
import { css, styled } from '../../style';
|
||||
import { t } from '../../translation';
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,14 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { ReactNode, RefObject } from 'react';
|
||||
import {
|
||||
ReactNode,
|
||||
RefObject,
|
||||
ComponentType,
|
||||
PureComponent,
|
||||
Fragment,
|
||||
} from 'react';
|
||||
|
||||
import ErrorBoundary, {
|
||||
ErrorBoundaryProps,
|
||||
FallbackProps,
|
||||
|
|
@ -58,7 +65,7 @@ export type Props = Omit<SuperChartCoreProps, 'chartProps'> &
|
|||
/** enable "No Results" message if empty result set */
|
||||
enableNoResults?: boolean;
|
||||
/** Component to render when there are unexpected errors */
|
||||
FallbackComponent?: React.ComponentType<FallbackPropsWithDimension>;
|
||||
FallbackComponent?: ComponentType<FallbackPropsWithDimension>;
|
||||
/** Event listener for unexpected errors from chart */
|
||||
onErrorBoundary?: ErrorBoundaryProps['onError'];
|
||||
/** Prop for form plugins using superchart */
|
||||
|
|
@ -80,7 +87,7 @@ export type Props = Omit<SuperChartCoreProps, 'chartProps'> &
|
|||
* when using dynamic width or height
|
||||
* because it will clash with auto-sizing.
|
||||
*/
|
||||
Wrapper?: React.ComponentType<WrapperProps>;
|
||||
Wrapper?: ComponentType<WrapperProps>;
|
||||
/**
|
||||
* Component to display when query returns no results.
|
||||
* If not defined, NoResultsComponent is used
|
||||
|
|
@ -94,7 +101,7 @@ export type Props = Omit<SuperChartCoreProps, 'chartProps'> &
|
|||
|
||||
type PropsWithDefault = Props & Readonly<typeof defaultProps>;
|
||||
|
||||
class SuperChart extends React.PureComponent<Props, {}> {
|
||||
class SuperChart extends PureComponent<Props, {}> {
|
||||
/**
|
||||
* SuperChart's core
|
||||
*/
|
||||
|
|
@ -131,7 +138,7 @@ class SuperChart extends React.PureComponent<Props, {}> {
|
|||
heightInfo.isDynamic &&
|
||||
widthInfo.multiplier === 1 &&
|
||||
heightInfo.multiplier === 1
|
||||
? React.Fragment
|
||||
? Fragment
|
||||
: ({ children }: { children: ReactNode }) => (
|
||||
<div style={style}>{children}</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable react/jsx-sort-default-props */
|
||||
import * as React from 'react';
|
||||
import { PureComponent } from 'react';
|
||||
import { t } from '@superset-ui/core';
|
||||
import { createSelector } from 'reselect';
|
||||
import getChartComponentRegistry from '../registries/ChartComponentRegistrySingleton';
|
||||
|
|
@ -78,7 +78,7 @@ export type Props = {
|
|||
onRenderFailure?: HandlerFunction;
|
||||
};
|
||||
|
||||
export default class SuperChartCore extends React.PureComponent<Props, {}> {
|
||||
export default class SuperChartCore extends PureComponent<Props, {}> {
|
||||
/**
|
||||
* The HTML element that wraps all chart content
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
import Loadable from 'react-loadable';
|
||||
import { ComponentClass } from 'react';
|
||||
|
||||
export type LoadableRendererProps = {
|
||||
onRenderFailure?: Function;
|
||||
|
|
@ -30,7 +31,7 @@ const defaultProps = {
|
|||
};
|
||||
|
||||
export interface LoadableRenderer<Props>
|
||||
extends React.ComponentClass<Props & LoadableRendererProps>,
|
||||
extends ComponentClass<Props & LoadableRendererProps>,
|
||||
Loadable.LoadableComponent {}
|
||||
|
||||
export default function createLoadableRenderer<
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
// eslint-disable-next-line no-restricted-syntax -- whole React import is required for `reactify.test.tsx` Jest test passing.
|
||||
import React, { Component, ComponentClass, WeakValidationMap } from 'react';
|
||||
|
||||
// TODO: Note that id and className can collide between Props and ReactifyProps
|
||||
// leading to (likely) unexpected behaviors. We should either require Props to not
|
||||
|
|
@ -45,14 +46,14 @@ export interface RenderFuncType<Props> {
|
|||
(container: HTMLDivElement, props: Readonly<Props & ReactifyProps>): void;
|
||||
displayName?: string;
|
||||
defaultProps?: Partial<Props & ReactifyProps>;
|
||||
propTypes?: React.WeakValidationMap<Props & ReactifyProps>;
|
||||
propTypes?: WeakValidationMap<Props & ReactifyProps>;
|
||||
}
|
||||
|
||||
export default function reactify<Props extends object>(
|
||||
renderFn: RenderFuncType<Props>,
|
||||
callbacks?: LifeCycleCallbacks,
|
||||
): React.ComponentClass<Props & ReactifyProps> {
|
||||
class ReactifiedComponent extends React.Component<Props & ReactifyProps> {
|
||||
): ComponentClass<Props & ReactifyProps> {
|
||||
class ReactifiedComponent extends Component<Props & ReactifyProps> {
|
||||
container?: HTMLDivElement;
|
||||
|
||||
constructor(props: Props & ReactifyProps) {
|
||||
|
|
@ -92,7 +93,7 @@ export default function reactify<Props extends object>(
|
|||
}
|
||||
}
|
||||
|
||||
const ReactifiedClass: React.ComponentClass<Props & ReactifyProps> =
|
||||
const ReactifiedClass: ComponentClass<Props & ReactifyProps> =
|
||||
ReactifiedComponent;
|
||||
|
||||
if (renderFn.displayName) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { useMemo } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import React from 'react';
|
||||
import { useElementOnScreen } from './useElementOnScreen';
|
||||
|
||||
const observeMock = jest.fn();
|
||||
|
|
@ -67,7 +66,7 @@ test('should return isSticky as false when intersectionRatio >= 1', async () =>
|
|||
});
|
||||
|
||||
test('should observe and unobserve element with IntersectionObserver', async () => {
|
||||
jest.spyOn(React, 'useRef').mockReturnValue({ current: 'test' });
|
||||
jest.spyOn(global.React, 'useRef').mockReturnValue({ current: 'test' });
|
||||
const options = { threshold: 0.5 };
|
||||
const { result, unmount } = renderHook(() => useElementOnScreen(options));
|
||||
const [elementRef] = result.current;
|
||||
|
|
@ -86,7 +85,7 @@ test('should observe and unobserve element with IntersectionObserver', async ()
|
|||
});
|
||||
|
||||
test('should not observe an element if it is null', () => {
|
||||
jest.spyOn(React, 'useRef').mockReturnValue({ current: null });
|
||||
jest.spyOn(global.React, 'useRef').mockReturnValue({ current: null });
|
||||
const options = {};
|
||||
const { result } = renderHook(() => useElementOnScreen(options));
|
||||
const [ref, isSticky] = result.current;
|
||||
|
|
@ -97,7 +96,7 @@ test('should not observe an element if it is null', () => {
|
|||
});
|
||||
|
||||
test('should not unobserve the element if it is null', () => {
|
||||
jest.spyOn(React, 'useRef').mockReturnValue({ current: null });
|
||||
jest.spyOn(global.React, 'useRef').mockReturnValue({ current: null });
|
||||
const options = {};
|
||||
const { result, unmount } = renderHook(() => useElementOnScreen(options));
|
||||
const [ref, isSticky] = result.current;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import React from 'react';
|
||||
import useCSSTextTruncation from './useCSSTextTruncation';
|
||||
|
||||
afterEach(() => {
|
||||
|
|
@ -37,7 +36,7 @@ test('should not truncate', () => {
|
|||
const ref = { current: document.createElement('p') };
|
||||
Object.defineProperty(ref.current, 'offsetWidth', { get: () => 100 });
|
||||
Object.defineProperty(ref.current, 'scrollWidth', { get: () => 50 });
|
||||
jest.spyOn(React, 'useRef').mockReturnValue({ current: ref.current });
|
||||
jest.spyOn(global.React, 'useRef').mockReturnValue({ current: ref.current });
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
useCSSTextTruncation<HTMLParagraphElement>(),
|
||||
|
|
@ -51,7 +50,7 @@ test('should truncate', () => {
|
|||
const ref = { current: document.createElement('p') };
|
||||
Object.defineProperty(ref.current, 'offsetWidth', { get: () => 50 });
|
||||
Object.defineProperty(ref.current, 'scrollWidth', { get: () => 100 });
|
||||
jest.spyOn(React, 'useRef').mockReturnValue({ current: ref.current });
|
||||
jest.spyOn(global.React, 'useRef').mockReturnValue({ current: ref.current });
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
useCSSTextTruncation<HTMLParagraphElement>(),
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { css } from '@emotion/react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { useEffect, useRef, useState, RefObject } from 'react';
|
||||
|
||||
/**
|
||||
* Importable CSS that enables text truncation on fixed-width block
|
||||
|
|
@ -37,7 +37,7 @@ export const truncationCSS = css`
|
|||
* element and a boolean for whether that element is currently truncated.
|
||||
*/
|
||||
const useCSSTextTruncation = <T extends HTMLElement>(): [
|
||||
React.RefObject<T>,
|
||||
RefObject<T>,
|
||||
boolean,
|
||||
] => {
|
||||
const [isTruncated, setIsTruncated] = useState(true);
|
||||
|
|
|
|||
|
|
@ -16,14 +16,19 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { ReactNode, MouseEventHandler } from 'react';
|
||||
import {
|
||||
ReactNode,
|
||||
MouseEventHandler,
|
||||
ReactElement,
|
||||
ComponentType,
|
||||
} from 'react';
|
||||
import type { Editor } from 'brace';
|
||||
|
||||
/**
|
||||
* A function which returns text (or marked-up text)
|
||||
* If what you want is a react component, don't use this. Use React.ComponentType instead.
|
||||
*/
|
||||
type ReturningDisplayable<P = void> = (props: P) => string | React.ReactElement;
|
||||
type ReturningDisplayable<P = void> = (props: P) => string | ReactElement;
|
||||
|
||||
/**
|
||||
* This type defines all available extensions of Superset's default UI.
|
||||
|
|
@ -82,15 +87,15 @@ export interface DatabaseConnectionExtension {
|
|||
/**
|
||||
* url or dataURI (recommended) of a logo to use in place of a title. title is fallback display if no logo is provided
|
||||
*/
|
||||
logo?: React.ComponentType<any>;
|
||||
logo?: ComponentType<any>;
|
||||
/**
|
||||
* Descriptive text displayed under the logo or title to provide user with more context about the configuration section
|
||||
*/
|
||||
description: React.ComponentType<any>;
|
||||
description: ComponentType<any>;
|
||||
/**
|
||||
* React component to render for display in the database connection configuration
|
||||
*/
|
||||
component: React.ComponentType<any>;
|
||||
component: ComponentType<any>;
|
||||
/**
|
||||
* Is the database extension enabled?
|
||||
*/
|
||||
|
|
@ -187,28 +192,28 @@ export interface CustomAutocomplete extends AutocompleteItem {
|
|||
}
|
||||
|
||||
export type Extensions = Partial<{
|
||||
'alertsreports.header.icon': React.ComponentType;
|
||||
'embedded.documentation.configuration_details': React.ComponentType<ConfigDetailsProps>;
|
||||
'alertsreports.header.icon': ComponentType;
|
||||
'embedded.documentation.configuration_details': ComponentType<ConfigDetailsProps>;
|
||||
'embedded.documentation.description': ReturningDisplayable;
|
||||
'embedded.documentation.url': string;
|
||||
'embedded.modal': React.ComponentType<DashboardEmbedModalExtensions>;
|
||||
'dashboard.nav.right': React.ComponentType;
|
||||
'home.submenu': React.ComponentType<SubMenuProps>;
|
||||
'navbar.right-menu.item.icon': React.ComponentType<RightMenuItemIconProps>;
|
||||
'navbar.right': React.ComponentType;
|
||||
'report-modal.dropdown.item.icon': React.ComponentType;
|
||||
'root.context.provider': React.ComponentType;
|
||||
'welcome.message': React.ComponentType;
|
||||
'welcome.banner': React.ComponentType;
|
||||
'welcome.main.replacement': React.ComponentType;
|
||||
'ssh_tunnel.form.switch': React.ComponentType<SwitchProps>;
|
||||
'embedded.modal': ComponentType<DashboardEmbedModalExtensions>;
|
||||
'dashboard.nav.right': ComponentType;
|
||||
'home.submenu': ComponentType<SubMenuProps>;
|
||||
'navbar.right-menu.item.icon': ComponentType<RightMenuItemIconProps>;
|
||||
'navbar.right': ComponentType;
|
||||
'report-modal.dropdown.item.icon': ComponentType;
|
||||
'root.context.provider': ComponentType;
|
||||
'welcome.message': ComponentType;
|
||||
'welcome.banner': ComponentType;
|
||||
'welcome.main.replacement': ComponentType;
|
||||
'ssh_tunnel.form.switch': ComponentType<SwitchProps>;
|
||||
'databaseconnection.extraOption': DatabaseConnectionExtension;
|
||||
/* Custom components to show in the database and dataset delete modals */
|
||||
'database.delete.related': React.ComponentType<DatabaseDeleteRelatedExtensionProps>;
|
||||
'dataset.delete.related': React.ComponentType<DatasetDeleteRelatedExtensionProps>;
|
||||
'sqleditor.extension.form': React.ComponentType<SQLFormExtensionProps>;
|
||||
'sqleditor.extension.resultTable': React.ComponentType<SQLResultTableExtentionProps>;
|
||||
'dashboard.slice.header': React.ComponentType<SliceHeaderExtension>;
|
||||
'database.delete.related': ComponentType<DatabaseDeleteRelatedExtensionProps>;
|
||||
'dataset.delete.related': ComponentType<DatasetDeleteRelatedExtensionProps>;
|
||||
'sqleditor.extension.form': ComponentType<SQLFormExtensionProps>;
|
||||
'sqleditor.extension.resultTable': ComponentType<SQLResultTableExtentionProps>;
|
||||
'dashboard.slice.header': ComponentType<SliceHeaderExtension>;
|
||||
'sqleditor.extension.customAutocomplete': (
|
||||
args: CustomAutoCompleteArgs,
|
||||
) => CustomAutocomplete[] | undefined;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import {
|
||||
sanitizeHtml,
|
||||
isProbablyHTML,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { FilterXSS, getDefaultWhiteList } from 'xss';
|
||||
|
||||
const xssFilter = new FilterXSS({
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { ChartFrame } from '@superset-ui/core';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import { triggerResizeObserver } from 'resize-observer-polyfill';
|
||||
import { promiseTimeout, WithLegend } from '@superset-ui/core';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { TooltipFrame } from '@superset-ui/core';
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { TooltipTable } from '@superset-ui/core';
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import ChartClient from '../../../src/chart/clients/ChartClient';
|
||||
import ChartDataProvider, {
|
||||
|
|
@ -210,7 +210,7 @@ describe('ChartDataProvider', () => {
|
|||
|
||||
describe('children', () => {
|
||||
it('calls children({ loading: true }) when loading', () => {
|
||||
const children = jest.fn<React.ReactNode, unknown[]>();
|
||||
const children = jest.fn<ReactNode, unknown[]>();
|
||||
setup({ children });
|
||||
|
||||
// during the first tick (before more promises resolve) loading is true
|
||||
|
|
@ -221,7 +221,7 @@ describe('ChartDataProvider', () => {
|
|||
it('calls children({ payload }) when loaded', () =>
|
||||
new Promise(done => {
|
||||
expect.assertions(2);
|
||||
const children = jest.fn<React.ReactNode, unknown[]>();
|
||||
const children = jest.fn<ReactNode, unknown[]>();
|
||||
setup({ children, loadDatasource: true });
|
||||
|
||||
setTimeout(() => {
|
||||
|
|
@ -240,7 +240,7 @@ describe('ChartDataProvider', () => {
|
|||
it('calls children({ error }) upon request error', () =>
|
||||
new Promise(done => {
|
||||
expect.assertions(2);
|
||||
const children = jest.fn<React.ReactNode, unknown[]>();
|
||||
const children = jest.fn<ReactNode, unknown[]>();
|
||||
mockLoadFormData = jest.fn(() => Promise.reject(new Error('error')));
|
||||
|
||||
setup({ children });
|
||||
|
|
@ -257,7 +257,7 @@ describe('ChartDataProvider', () => {
|
|||
it('calls children({ error }) upon JS error', () =>
|
||||
new Promise(done => {
|
||||
expect.assertions(2);
|
||||
const children = jest.fn<React.ReactNode, unknown[]>();
|
||||
const children = jest.fn<ReactNode, unknown[]>();
|
||||
|
||||
mockLoadFormData = jest.fn(() => {
|
||||
throw new Error('non-async error');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { FallbackProps } from 'react-error-boundary';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable max-classes-per-file */
|
||||
import React from 'react';
|
||||
import {
|
||||
QueryFormData,
|
||||
ChartMetadata,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { ThemeProvider, supersetTheme } from '../../../src/style';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { ReactElement } from 'react';
|
||||
import { ReactElement } from 'react';
|
||||
import mockConsole, { RestoreConsole } from 'jest-mock-console';
|
||||
import { triggerResizeObserver } from 'resize-observer-polyfill';
|
||||
import ErrorBoundary from 'react-error-boundary';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { ReactElement, ReactNode } from 'react';
|
||||
import { ReactElement, ReactNode } from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import mockConsole, { RestoreConsole } from 'jest-mock-console';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { ComponentType } from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import mockConsole, { RestoreConsole } from 'jest-mock-console';
|
||||
import createLoadableRenderer, {
|
||||
|
|
@ -29,7 +29,7 @@ describe('createLoadableRenderer', () => {
|
|||
return <div className="test-component">test</div>;
|
||||
}
|
||||
let loadChartSuccess = jest.fn(() => Promise.resolve(TestComponent));
|
||||
let render: (loaded: { Chart: React.ComponentType }) => JSX.Element;
|
||||
let render: (loaded: { Chart: ComponentType }) => JSX.Element;
|
||||
let loading: () => JSX.Element;
|
||||
let LoadableRenderer: LoadableRendererType<{}>;
|
||||
let restoreConsole: RestoreConsole;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import { PureComponent } from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { reactify } from '@superset-ui/core';
|
||||
import { RenderFuncType } from '../../../src/chart/components/reactify';
|
||||
|
|
@ -51,7 +51,7 @@ describe('reactify(renderFn)', () => {
|
|||
componentWillUnmount: willUnmountCb,
|
||||
});
|
||||
|
||||
class TestComponent extends React.PureComponent<{}, { content: string }> {
|
||||
class TestComponent extends PureComponent<{}, { content: string }> {
|
||||
constructor(props = {}) {
|
||||
super(props);
|
||||
this.state = { content: 'abc' };
|
||||
|
|
@ -70,7 +70,7 @@ describe('reactify(renderFn)', () => {
|
|||
}
|
||||
}
|
||||
|
||||
class AnotherTestComponent extends React.PureComponent<{}, {}> {
|
||||
class AnotherTestComponent extends PureComponent<{}, {}> {
|
||||
render() {
|
||||
return <TheChartWithWillUnmountHook id="another_test" />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
ChartPlugin,
|
||||
ChartMetadata,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import {
|
||||
styled,
|
||||
|
|
|
|||
|
|
@ -57,10 +57,6 @@ describe('logging', () => {
|
|||
Object.assign(window, { console: undefined });
|
||||
const { logging } = require('@superset-ui/core');
|
||||
|
||||
afterAll(() => {
|
||||
Object.assign(window, { console });
|
||||
});
|
||||
|
||||
expect(() => {
|
||||
logging.debug();
|
||||
logging.log();
|
||||
|
|
@ -73,5 +69,6 @@ describe('logging', () => {
|
|||
[3, 4],
|
||||
]);
|
||||
}).not.toThrow();
|
||||
Object.assign(window, { console });
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// themeDecorator.js
|
||||
import React from 'react';
|
||||
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
||||
|
||||
const ThemeDecorator = Story => (
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
export type Props = {
|
||||
error: Error;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { ReactNode } from 'react';
|
||||
import { Component, ReactNode } from 'react';
|
||||
|
||||
export type Props = {
|
||||
children: ReactNode;
|
||||
|
|
@ -28,7 +28,7 @@ type State = {
|
|||
open: boolean;
|
||||
};
|
||||
|
||||
export default class Expandable extends React.Component<Props, State> {
|
||||
export default class Expandable extends Component<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = { open: false };
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { useState, ReactNode } from 'react';
|
||||
import { useState, ReactNode } from 'react';
|
||||
import { styled } from '@superset-ui/core';
|
||||
import type { DecoratorFunction } from '@storybook/types';
|
||||
import ResizablePanel, { Size } from './ResizablePanel';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { PropsWithChildren, ReactNode } from 'react';
|
||||
import { PropsWithChildren, ReactNode } from 'react';
|
||||
import {
|
||||
ResizableBox,
|
||||
ResizableBoxProps,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { ReactNode } from 'react';
|
||||
import { Component, ReactNode } from 'react';
|
||||
import {
|
||||
SupersetClient,
|
||||
Method,
|
||||
|
|
@ -53,7 +53,7 @@ export const renderError = (error: Error) => (
|
|||
</div>
|
||||
);
|
||||
|
||||
export default class VerifyCORS extends React.Component<Props, State> {
|
||||
export default class VerifyCORS extends Component<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = { didVerify: false };
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
SuperChart,
|
||||
ChartDataProvider,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import CalendarChartPlugin from '@superset-ui/legacy-plugin-chart-calendar';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import ChordChartPlugin from '@superset-ui/legacy-plugin-chart-chord';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import {
|
||||
JsonObject,
|
||||
seed,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import sampleEvents from '@data-ui/event-flow/build/sampleEvents';
|
||||
import EventFlowChartPlugin from '@superset-ui/legacy-plugin-chart-event-flow';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import HeatmapChartPlugin from '@superset-ui/legacy-plugin-chart-heatmap';
|
||||
import ResizableChartDemo from '../../../shared/components/ResizableChartDemo';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import HistogramChartPlugin from '@superset-ui/legacy-plugin-chart-histogram';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import HorizonChartPlugin from '@superset-ui/legacy-plugin-chart-horizon';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart, useTheme } from '@superset-ui/core';
|
||||
import MapBoxChartPlugin from '@superset-ui/legacy-plugin-chart-map-box';
|
||||
import { generateData } from './data';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import PairedTTestChartPlugin from '@superset-ui/legacy-plugin-chart-paired-t-test';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import ParallelCoordinatesChartPlugin from '@superset-ui/legacy-plugin-chart-parallel-coordinates';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import PartitionChartPlugin from '@superset-ui/legacy-plugin-chart-partition';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers, sort-keys */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import RoseChartPlugin from '@superset-ui/legacy-plugin-chart-rose';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import SankeyLoopChartPlugin from '@superset-ui/legacy-plugin-chart-sankey-loop';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import SankeyChartPlugin from '@superset-ui/legacy-plugin-chart-sankey';
|
||||
import ResizableChartDemo from '../../../shared/components/ResizableChartDemo';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable no-magic-numbers, sort-keys */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import WorldMapChartPlugin from '@superset-ui/legacy-plugin-chart-world-map';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { BigNumberChartPlugin } from '@superset-ui/plugin-chart-echarts';
|
||||
import testData from './data';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { BigNumberTotalChartPlugin } from '@superset-ui/plugin-chart-echarts';
|
||||
import data from './data';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { ArcChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
|
||||
import payload from './payload';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { GridChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
|
||||
import payload from './payload';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { HexChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
|
||||
import payload from './payload';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart, useTheme } from '@superset-ui/core';
|
||||
import { PathChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
|
||||
import { payload } from './payload';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { PolygonChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
|
||||
import payload from './payload';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { ScatterChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
|
||||
import payload from './payload';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
/* eslint-disable sort-keys */
|
||||
/* eslint-disable no-magic-numbers */
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import { ScreengridChartPlugin } from '@superset-ui/legacy-preset-chart-deckgl';
|
||||
import payload from './payload';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { SuperChart } from '@superset-ui/core';
|
||||
import dummyDatasource from '../../../../../shared/dummyDatasource';
|
||||
import data from '../data';
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue