mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
chore: moving reusable components from src/components to packages/superset-ui-core/src/components (#33593)
This commit is contained in:
committed by
GitHub
parent
58435e3e28
commit
28db9ad7fc
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"d3": "^3.5.17",
|
||||
"d3v3": "npm:d3@3.5.17",
|
||||
"prop-types": "^15.8.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
/* eslint-disable react/sort-prop-types */
|
||||
import d3 from 'd3';
|
||||
import * as d3 from 'd3v3';
|
||||
import PropTypes from 'prop-types';
|
||||
import { getSequentialSchemeRegistry } from '@superset-ui/core';
|
||||
|
||||
|
||||
@@ -1,26 +1,20 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"outDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"allowJs": false
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
"outDir": "lib",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"d3v3": ["./types/d3v3"]
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
22
superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/types/d3-parcoords.d.ts
vendored
Normal file
22
superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/types/d3-parcoords.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
declare module 'src/vendor/parcoords/d3.parcoords' {
|
||||
const parcoords: any;
|
||||
export default parcoords;
|
||||
}
|
||||
22
superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/types/d3.d.ts
vendored
Normal file
22
superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/types/d3.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
declare module 'd3' {
|
||||
const d3: any;
|
||||
export = d3;
|
||||
}
|
||||
@@ -19,10 +19,8 @@
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import {
|
||||
ColumnMeta,
|
||||
InfoTooltipWithTrigger,
|
||||
} from '@superset-ui/chart-controls';
|
||||
import { ColumnMeta } from '@superset-ui/chart-controls';
|
||||
import { InfoTooltip } from '@superset-ui/core/components';
|
||||
|
||||
const propTypes = {
|
||||
option: PropTypes.object.isRequired,
|
||||
@@ -38,7 +36,7 @@ export default function OptionDescription({ option }: { option: ColumnMeta }) {
|
||||
{option.label}
|
||||
</span>
|
||||
{option.description && (
|
||||
<InfoTooltipWithTrigger
|
||||
<InfoTooltip
|
||||
type="question"
|
||||
tooltip={option.description}
|
||||
label={`descr-${option.label}`}
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('OptionDescription', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('renders an InfoTooltipWithTrigger', () => {
|
||||
it('renders an InfoTooltip', () => {
|
||||
const tooltipTrigger = screen.getByLabelText('Show info tooltip');
|
||||
expect(tooltipTrigger).toBeInTheDocument();
|
||||
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@superset-ui/core/components": ["../../packages/superset-ui-core/src/components"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"test/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
},
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import { AnnotationType, Behavior, t } from '@superset-ui/core';
|
||||
import {
|
||||
EchartsTimeseriesChartProps,
|
||||
EchartsTimeseriesFormData,
|
||||
} from '@superset-ui/plugin-chart-echarts';
|
||||
import { EchartsTimeseriesChartProps, EchartsTimeseriesFormData } from '../..';
|
||||
import buildQuery from '../buildQuery';
|
||||
import controlPanel from './controlPanel';
|
||||
import transformProps from '../transformProps';
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
LegendOrientation,
|
||||
LegendType,
|
||||
EchartsTimeseriesSeriesType,
|
||||
} from '@superset-ui/plugin-chart-echarts';
|
||||
} from '../../src';
|
||||
import transformProps from '../../src/MixedTimeseries/transformProps';
|
||||
import {
|
||||
EchartsMixedTimeseriesFormData,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import { CategoricalColorScale } from '@superset-ui/core';
|
||||
import { EchartsTimeseriesSeriesType } from '@superset-ui/plugin-chart-echarts';
|
||||
import { EchartsTimeseriesSeriesType } from '../../src';
|
||||
import { transformSeries } from '../../src/Timeseries/transformers';
|
||||
|
||||
// Mock the colorScale function
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
TimeseriesAnnotationLayer,
|
||||
TimeseriesDataRecord,
|
||||
} from '@superset-ui/core';
|
||||
import { OrientationType } from '@superset-ui/plugin-chart-echarts';
|
||||
import { OrientationType } from '../../src';
|
||||
import {
|
||||
transformEventAnnotation,
|
||||
transformFormulaAnnotation,
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { SafeMarkdown, styled, t } from '@superset-ui/core';
|
||||
import { styled, t } from '@superset-ui/core';
|
||||
import { SafeMarkdown } from '@superset-ui/core/components';
|
||||
import Handlebars from 'handlebars';
|
||||
import dayjs from 'dayjs';
|
||||
import { useMemo, useState } from 'react';
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
*/
|
||||
import { debounce } from 'lodash';
|
||||
import { formatSelectOptions } from '@superset-ui/chart-controls';
|
||||
import { SLOW_DEBOUNCE, t } from '@superset-ui/core';
|
||||
import { Constants } from '@superset-ui/core/components';
|
||||
import { t } from '@superset-ui/core';
|
||||
|
||||
export const PAGE_SIZE_OPTIONS = formatSelectOptions<number>([
|
||||
[0, t('page_size.all')],
|
||||
@@ -36,5 +37,5 @@ export const PAGE_SIZE_OPTIONS = formatSelectOptions<number>([
|
||||
|
||||
export const debounceFunc = debounce(
|
||||
(func: (val: string) => void, source: string) => func(source),
|
||||
SLOW_DEBOUNCE,
|
||||
Constants.SLOW_DEBOUNCE,
|
||||
);
|
||||
|
||||
@@ -20,9 +20,9 @@ import {
|
||||
ControlSetItem,
|
||||
CustomControlConfig,
|
||||
sharedControls,
|
||||
InfoTooltipWithTrigger,
|
||||
} from '@superset-ui/chart-controls';
|
||||
import { t, validateNonEmpty, useTheme, SafeMarkdown } from '@superset-ui/core';
|
||||
import { t, validateNonEmpty, useTheme } from '@superset-ui/core';
|
||||
import { InfoTooltip, SafeMarkdown } from '@superset-ui/core/components';
|
||||
import { CodeEditor } from '../../components/CodeEditor/CodeEditor';
|
||||
import { ControlHeader } from '../../components/ControlHeader/controlHeader';
|
||||
import { debounceFunc } from '../../consts';
|
||||
@@ -70,7 +70,7 @@ ${helperDescriptions
|
||||
<ControlHeader>
|
||||
<div>
|
||||
{props.label}
|
||||
<InfoTooltipWithTrigger
|
||||
<InfoTooltip
|
||||
iconStyle={{ marginLeft: theme.sizeUnit }}
|
||||
tooltip={<SafeMarkdown source={helpersTooltipContent} />}
|
||||
/>
|
||||
|
||||
@@ -20,9 +20,9 @@ import {
|
||||
ControlSetItem,
|
||||
CustomControlConfig,
|
||||
sharedControls,
|
||||
InfoTooltipWithTrigger,
|
||||
} from '@superset-ui/chart-controls';
|
||||
import { t, useTheme } from '@superset-ui/core';
|
||||
import { InfoTooltip } from '@superset-ui/core/components';
|
||||
import { CodeEditor } from '../../components/CodeEditor/CodeEditor';
|
||||
import { ControlHeader } from '../../components/ControlHeader/controlHeader';
|
||||
import { debounceFunc } from '../../consts';
|
||||
@@ -47,7 +47,7 @@ const StyleControl = (props: CustomControlConfig<StyleCustomControlProps>) => {
|
||||
<ControlHeader>
|
||||
<div>
|
||||
{props.label}
|
||||
<InfoTooltipWithTrigger
|
||||
<InfoTooltip
|
||||
iconStyle={{ marginLeft: theme.sizeUnit }}
|
||||
tooltip={t('You need to configure HTML sanitization to use CSS')}
|
||||
/>
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@superset-ui/core/components": ["../../packages/superset-ui-core/src/components"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ant-design/icons": "^5.2.6",
|
||||
"antd": "^5.24.6",
|
||||
"@superset-ui/chart-controls": "*",
|
||||
"@superset-ui/core": "*",
|
||||
"@testing-library/dom": "^8.20.1",
|
||||
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
} from 'react-table';
|
||||
import { matchSorter, rankings } from 'match-sorter';
|
||||
import { isEqual } from 'lodash';
|
||||
import { Space } from 'antd';
|
||||
import { Space } from '@superset-ui/core/components';
|
||||
import GlobalFilter, { GlobalFilterProps } from './components/GlobalFilter';
|
||||
import SelectPageSize, {
|
||||
SelectPageSizeProps,
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
Ref,
|
||||
} from 'react';
|
||||
import { Row, FilterValue } from 'react-table';
|
||||
import { Input, type InputRef, Space } from 'antd';
|
||||
import { Input, type InputRef, Space } from '@superset-ui/core/components';
|
||||
import useAsyncState from '../utils/useAsyncState';
|
||||
|
||||
export interface SearchInputProps {
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import { styled } from '@superset-ui/core';
|
||||
import { Select } from 'antd';
|
||||
import { RawAntdSelect } from '@superset-ui/core/components';
|
||||
import { SearchOption } from '../../types';
|
||||
|
||||
const StyledSelect = styled(Select)`
|
||||
const StyledSelect = styled(RawAntdSelect)`
|
||||
width: 120px;
|
||||
margin-right: 8px;
|
||||
`;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
import { memo } from 'react';
|
||||
import { css, t } from '@superset-ui/core';
|
||||
import { formatSelectOptions } from '@superset-ui/chart-controls';
|
||||
import { Select } from 'antd';
|
||||
import { RawAntdSelect } from '@superset-ui/core/components';
|
||||
|
||||
export type SizeOption = [number, string];
|
||||
|
||||
@@ -34,12 +34,12 @@ function DefaultSelectRenderer({
|
||||
options,
|
||||
onChange,
|
||||
}: SelectPageSizeRendererProps) {
|
||||
const { Option } = Select;
|
||||
const { Option } = RawAntdSelect;
|
||||
|
||||
return (
|
||||
<span className="dt-select-page-size form-inline">
|
||||
{t('Show')}{' '}
|
||||
<Select<number>
|
||||
<RawAntdSelect<number>
|
||||
value={current}
|
||||
onChange={value => onChange(value)}
|
||||
size="small"
|
||||
@@ -62,7 +62,7 @@ function DefaultSelectRenderer({
|
||||
</Option>
|
||||
);
|
||||
})}
|
||||
</Select>{' '}
|
||||
</RawAntdSelect>{' '}
|
||||
{t('entries')}
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -54,7 +54,14 @@ import {
|
||||
useTheme,
|
||||
SupersetTheme,
|
||||
} from '@superset-ui/core';
|
||||
import { Dropdown, Menu, Tooltip } from '@superset-ui/chart-controls';
|
||||
import {
|
||||
Input,
|
||||
Space,
|
||||
RawAntdSelect as Select,
|
||||
Dropdown,
|
||||
Menu,
|
||||
Tooltip,
|
||||
} from '@superset-ui/core/components';
|
||||
import {
|
||||
CheckOutlined,
|
||||
InfoCircleOutlined,
|
||||
@@ -64,7 +71,6 @@ import {
|
||||
TableOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { isEmpty, debounce, isEqual } from 'lodash';
|
||||
import { Input, Space, Select } from 'antd';
|
||||
import {
|
||||
ColorSchemeEnum,
|
||||
DataColumnMeta,
|
||||
|
||||
@@ -18,17 +18,18 @@
|
||||
*/
|
||||
import {
|
||||
AdhocColumn,
|
||||
BuildQuery,
|
||||
PostProcessingRule,
|
||||
QueryFormOrderBy,
|
||||
QueryMode,
|
||||
QueryObject,
|
||||
buildQueryContext,
|
||||
ensureIsArray,
|
||||
getMetricLabel,
|
||||
isPhysicalColumn,
|
||||
QueryFormOrderBy,
|
||||
QueryMode,
|
||||
QueryObject,
|
||||
removeDuplicates,
|
||||
} from '@superset-ui/core';
|
||||
import { PostProcessingRule } from '@superset-ui/core/src/query/types/PostProcessing';
|
||||
import { BuildQuery } from '@superset-ui/core/src/chart/registries/ChartBuildQueryRegistrySingleton';
|
||||
|
||||
import {
|
||||
isTimeComparison,
|
||||
timeCompareOperator,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import '@testing-library/jest-dom';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { render, screen } from '@superset-ui/core/spec';
|
||||
import { ThemeProvider, supersetTheme } from '@superset-ui/core';
|
||||
import TableChart from '../src/TableChart';
|
||||
import transformProps from '../src/transformProps';
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"exclude": ["lib", "test"],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src/**/*", "types/**/*", "../../types/**/*"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@superset-ui/core/components": ["../../packages/superset-ui-core/src/components"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { PureComponent } from 'react';
|
||||
import cloudLayout, { Word } from 'd3-cloud';
|
||||
import cloudLayout from 'd3-cloud';
|
||||
import {
|
||||
PlainObject,
|
||||
createEncoderFactory,
|
||||
@@ -34,9 +33,20 @@ import {
|
||||
import { isEqual } from 'lodash';
|
||||
|
||||
const seedRandom = seed('superset-ui');
|
||||
|
||||
// Polyfill Word type since it's not exported from 'd3-cloud'
|
||||
export type Word = {
|
||||
text: string;
|
||||
size: number;
|
||||
x?: number;
|
||||
y?: number;
|
||||
rotate?: number;
|
||||
font?: string;
|
||||
weight?: string | number;
|
||||
};
|
||||
|
||||
export const ROTATION = {
|
||||
flat: () => 0,
|
||||
// this calculates a random rotation between -90 and 90 degrees.
|
||||
random: () => Math.floor(seedRandom() * 6 - 3) * 30,
|
||||
square: () => Math.floor(seedRandom() * 2) * 90,
|
||||
};
|
||||
@@ -53,9 +63,6 @@ type WordCloudEncodingConfig = {
|
||||
text: ['Text', string];
|
||||
};
|
||||
|
||||
/**
|
||||
* These props should be stored when saving the chart.
|
||||
*/
|
||||
export interface WordCloudVisualProps {
|
||||
encoding?: Partial<WordCloudEncoding>;
|
||||
rotation?: RotationType;
|
||||
@@ -84,15 +91,10 @@ type FullWordCloudProps = WordCloudProps &
|
||||
|
||||
const SCALE_FACTOR_STEP = 0.5;
|
||||
const MAX_SCALE_FACTOR = 3;
|
||||
// Percentage of top results that will always be displayed.
|
||||
// Needed to avoid clutter when shrinking a chart with many records.
|
||||
const TOP_RESULTS_PERCENTAGE = 0.1;
|
||||
|
||||
class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
static defaultProps = defaultProps;
|
||||
|
||||
// Cannot name it isMounted because of conflict
|
||||
// with React's component function name
|
||||
isComponentMounted = false;
|
||||
|
||||
wordCloudEncoderFactory = createEncoderFactory<WordCloudEncodingConfig>({
|
||||
@@ -112,11 +114,15 @@ class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
},
|
||||
});
|
||||
|
||||
createEncoder = (encoding?: Partial<WordCloudEncoding>) => {
|
||||
const selector = this.wordCloudEncoderFactory.createSelector();
|
||||
createEncoder = (
|
||||
encoding?: Partial<WordCloudEncoding>,
|
||||
): Encoder<WordCloudEncodingConfig> => {
|
||||
const selector: (
|
||||
e: Partial<WordCloudEncoding>,
|
||||
) => Encoder<WordCloudEncodingConfig> =
|
||||
this.wordCloudEncoderFactory.createSelector();
|
||||
|
||||
// @ts-ignore
|
||||
return selector(encoding as any);
|
||||
return selector(encoding ?? {});
|
||||
};
|
||||
|
||||
constructor(props: FullWordCloudProps) {
|
||||
@@ -135,7 +141,6 @@ class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
|
||||
componentDidUpdate(prevProps: WordCloudProps) {
|
||||
const { data, encoding, width, height, rotation } = this.props;
|
||||
|
||||
if (
|
||||
!isEqual(prevProps.data, data) ||
|
||||
!isEqual(prevProps.encoding, encoding) ||
|
||||
@@ -160,8 +165,7 @@ class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
update() {
|
||||
const { data, encoding } = this.props;
|
||||
|
||||
const encoder: Encoder<WordCloudEncodingConfig> =
|
||||
this.createEncoder(encoding);
|
||||
const encoder = this.createEncoder(encoding);
|
||||
encoder.setDomainFromDataset(data);
|
||||
|
||||
const sortedData = [...data].sort(
|
||||
@@ -175,7 +179,6 @@ class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
);
|
||||
const topResults = sortedData.slice(0, topResultsCount);
|
||||
|
||||
// Ensure top results are always included in the final word cloud by scaling chart down if needed
|
||||
this.generateCloud(encoder, 1, (words: Word[]) =>
|
||||
topResults.every((d: PlainObject) =>
|
||||
words.find(
|
||||
@@ -194,7 +197,6 @@ class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
|
||||
cloudLayout()
|
||||
.size([width * scaleFactor, height * scaleFactor])
|
||||
// clone the data because cloudLayout mutates input
|
||||
.words(data.map((d: Word) => ({ ...d })))
|
||||
.padding(5)
|
||||
.rotate(ROTATION[rotation] || ROTATION.flat)
|
||||
@@ -208,9 +210,7 @@ class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
.fontSize((d: PlainObject) => encoder.channels.fontSize.encodeDatum(d, 0))
|
||||
.on('end', (words: Word[]) => {
|
||||
if (isValid(words) || scaleFactor > MAX_SCALE_FACTOR) {
|
||||
if (this.isComponentMounted) {
|
||||
this.setState({ words, scaleFactor });
|
||||
}
|
||||
this.setWords(words);
|
||||
} else {
|
||||
this.generateCloud(encoder, scaleFactor + SCALE_FACTOR_STEP, isValid);
|
||||
}
|
||||
@@ -219,17 +219,13 @@ class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { scaleFactor } = this.state;
|
||||
const { scaleFactor, words } = this.state;
|
||||
const { width, height, encoding, sliceId, colorScheme } = this.props;
|
||||
const { words } = this.state;
|
||||
|
||||
// @ts-ignore
|
||||
const encoder = this.createEncoder(encoding);
|
||||
encoder.channels.color.setDomainFromDataset(words);
|
||||
|
||||
const { getValueFromDatum } = encoder.channels.color;
|
||||
const colorFn = CategoricalColorNamespace.getScale(colorScheme);
|
||||
|
||||
const viewBoxWidth = width * scaleFactor;
|
||||
const viewBoxHeight = height * scaleFactor;
|
||||
|
||||
@@ -237,9 +233,7 @@ class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
<svg
|
||||
width={width}
|
||||
height={height}
|
||||
viewBox={`-${viewBoxWidth / 2} -${
|
||||
viewBoxHeight / 2
|
||||
} ${viewBoxWidth} ${viewBoxHeight}`}
|
||||
viewBox={`-${viewBoxWidth / 2} -${viewBoxHeight / 2} ${viewBoxWidth} ${viewBoxHeight}`}
|
||||
>
|
||||
<g>
|
||||
{words.map(w => (
|
||||
@@ -248,7 +242,10 @@ class WordCloud extends PureComponent<FullWordCloudProps, WordCloudState> {
|
||||
fontSize={`${w.size}px`}
|
||||
fontWeight={w.weight}
|
||||
fontFamily={w.font}
|
||||
fill={colorFn(getValueFromDatum(w) as string, sliceId)}
|
||||
fill={colorFn(
|
||||
encoder.channels.color.getValueFromDatum(w) as string,
|
||||
sliceId,
|
||||
)}
|
||||
textAnchor="middle"
|
||||
transform={`translate(${w.x}, ${w.y}) rotate(${w.rotate})`}
|
||||
>
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declarationDir": "lib",
|
||||
"composite": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"types/**/*",
|
||||
"../../types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "types/**/*"],
|
||||
"exclude": ["lib", "test"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../packages/superset-ui-chart-controls"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/superset-ui-core"
|
||||
}
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
{ "path": "../../packages/superset-ui-chart-controls" }
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user