diff --git a/packages/superset-ui-core/src/chart/models/ChartMetadata.ts b/packages/superset-ui-core/src/chart/models/ChartMetadata.ts index 4562b454ba..99ff5a9aad 100644 --- a/packages/superset-ui-core/src/chart/models/ChartMetadata.ts +++ b/packages/superset-ui-core/src/chart/models/ChartMetadata.ts @@ -1,3 +1,5 @@ +import { Behavior } from '../types/Base'; + interface LookupTable { [key: string]: boolean; } @@ -7,11 +9,12 @@ export interface ChartMetadataConfig { canBeAnnotationTypes?: string[]; credits?: string[]; description?: string; + datasourceCount?: number; show?: boolean; supportedAnnotationTypes?: string[]; thumbnail: string; useLegacyApi?: boolean; - isNativeFilter?: boolean; + behaviors?: Behavior[]; } export default class ChartMetadata { @@ -33,7 +36,9 @@ export default class ChartMetadata { useLegacyApi: boolean; - isNativeFilter: boolean; + behaviors: Behavior[]; + + datasourceCount: number; constructor(config: ChartMetadataConfig) { const { @@ -45,7 +50,8 @@ export default class ChartMetadata { supportedAnnotationTypes = [], thumbnail, useLegacyApi = false, - isNativeFilter = false, + behaviors = [], + datasourceCount = 1, } = config; this.name = name; @@ -65,7 +71,8 @@ export default class ChartMetadata { this.supportedAnnotationTypes = supportedAnnotationTypes; this.thumbnail = thumbnail; this.useLegacyApi = useLegacyApi; - this.isNativeFilter = isNativeFilter; + this.behaviors = behaviors; + this.datasourceCount = datasourceCount; } canBeAnnotationType(type: string): boolean { @@ -82,7 +89,8 @@ export default class ChartMetadata { supportedAnnotationTypes: this.supportedAnnotationTypes, thumbnail: this.thumbnail, useLegacyApi: this.useLegacyApi, - isNativeFilter: this.isNativeFilter, + behaviors: this.behaviors, + datasourceCount: this.datasourceCount, }); } } diff --git a/packages/superset-ui-core/src/chart/types/Base.ts b/packages/superset-ui-core/src/chart/types/Base.ts index f206aec5cb..e37323a2a9 100644 --- a/packages/superset-ui-core/src/chart/types/Base.ts +++ b/packages/superset-ui-core/src/chart/types/Base.ts @@ -2,8 +2,19 @@ import { ExtraFormData } from '../../query'; export type HandlerFunction = (...args: unknown[]) => void; +export enum Behavior { + CROSS_FILTER = 'CROSS_FILTER', + NATIVE_FILTER = 'NATIVE_FILTER', +} + export type SetExtraFormDataHook = { - (extraFormData: ExtraFormData): void; + ({ + extraFormData, + currentState: { value }, + }: { + extraFormData: ExtraFormData; + currentState: { value: any; [key: string]: any }; + }): void; }; export interface PlainObject { diff --git a/packages/superset-ui-demo/storybook/stories/plugins/plugin-filter-antd/Select/Stories.tsx b/packages/superset-ui-demo/storybook/stories/plugins/plugin-filter-antd/Select/Stories.tsx deleted file mode 100644 index c4dbeab5dc..0000000000 --- a/packages/superset-ui-demo/storybook/stories/plugins/plugin-filter-antd/Select/Stories.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react'; -import { action } from '@storybook/addon-actions'; -import { boolean, withKnobs } from '@storybook/addon-knobs'; -import { SuperChart, getChartTransformPropsRegistry } from '@superset-ui/core'; -import { AntdSelectFilterPlugin } from '@superset-ui/plugin-filter-antd'; -import transformProps from '@superset-ui/plugin-filter-antd/lib/Select/transformProps'; -import data from './data'; -import { withResizableChartDemo } from '../../../../shared/components/ResizableChartDemo'; -import 'antd/dist/antd.css'; - -new AntdSelectFilterPlugin().configure({ key: 'filter_select' }).register(); - -getChartTransformPropsRegistry().registerValue('filter_select', transformProps); - -export default { - title: 'Filter Plugins|plugin-filter-antd/Select', - decorators: [withKnobs, withResizableChartDemo], -}; - -export const Select = ({ width, height }) => { - return ( - - ); -}; diff --git a/packages/superset-ui-demo/storybook/stories/plugins/plugin-filter-antd/Select/data.ts b/packages/superset-ui-demo/storybook/stories/plugins/plugin-filter-antd/Select/data.ts deleted file mode 100644 index c2e5fa0708..0000000000 --- a/packages/superset-ui-demo/storybook/stories/plugins/plugin-filter-antd/Select/data.ts +++ /dev/null @@ -1,216 +0,0 @@ -export default [ - { country_name: 'Afghanistan', 'SUM(SP_POP_TOTL)': 887557752 }, - { country_name: 'Albania', 'SUM(SP_POP_TOTL)': 148154320 }, - { country_name: 'Algeria', 'SUM(SP_POP_TOTL)': 1317290647 }, - { country_name: 'American Samoa', 'SUM(SP_POP_TOTL)': 2294886 }, - { country_name: 'Andorra', 'SUM(SP_POP_TOTL)': 2704725 }, - { country_name: 'Angola', 'SUM(SP_POP_TOTL)': 641906296 }, - { country_name: 'Antigua and Barbuda', 'SUM(SP_POP_TOTL)': 3887170 }, - { country_name: 'Argentina', 'SUM(SP_POP_TOTL)': 1728332290 }, - { country_name: 'Armenia', 'SUM(SP_POP_TOTL)': 160782905 }, - { country_name: 'Aruba', 'SUM(SP_POP_TOTL)': 4048374 }, - { country_name: 'Australia', 'SUM(SP_POP_TOTL)': 903260509 }, - { country_name: 'Austria', 'SUM(SP_POP_TOTL)': 426785647 }, - { country_name: 'Azerbaijan', 'SUM(SP_POP_TOTL)': 374210660 }, - { country_name: 'Bahamas, The', 'SUM(SP_POP_TOTL)': 13446111 }, - { country_name: 'Bahrain', 'SUM(SP_POP_TOTL)': 29724096 }, - { country_name: 'Bangladesh', 'SUM(SP_POP_TOTL)': 5549261462 }, - { country_name: 'Barbados', 'SUM(SP_POP_TOTL)': 14146501 }, - { country_name: 'Belarus', 'SUM(SP_POP_TOTL)': 524490000 }, - { country_name: 'Belgium', 'SUM(SP_POP_TOTL)': 551921585 }, - { country_name: 'Belize', 'SUM(SP_POP_TOTL)': 10571460 }, - { country_name: 'Benin', 'SUM(SP_POP_TOTL)': 290736360 }, - { country_name: 'Bermuda', 'SUM(SP_POP_TOTL)': 3159267 }, - { country_name: 'Bhutan', 'SUM(SP_POP_TOTL)': 25987074 }, - { country_name: 'Bolivia', 'SUM(SP_POP_TOTL)': 368308373 }, - { country_name: 'Bosnia and Herzegovina', 'SUM(SP_POP_TOTL)': 215521543 }, - { country_name: 'Botswana', 'SUM(SP_POP_TOTL)': 70510085 }, - { country_name: 'Brazil', 'SUM(SP_POP_TOTL)': 7752058955 }, - { country_name: 'Brunei Darussalam', 'SUM(SP_POP_TOTL)': 13322318 }, - { country_name: 'Bulgaria', 'SUM(SP_POP_TOTL)': 456247765 }, - { country_name: 'Burkina Faso', 'SUM(SP_POP_TOTL)': 505122912 }, - { country_name: 'Burundi', 'SUM(SP_POP_TOTL)': 305731834 }, - { country_name: 'Cabo Verde', 'SUM(SP_POP_TOTL)': 19178461 }, - { country_name: 'Cambodia', 'SUM(SP_POP_TOTL)': 523555378 }, - { country_name: 'Cameroon', 'SUM(SP_POP_TOTL)': 664127790 }, - { country_name: 'Canada', 'SUM(SP_POP_TOTL)': 1470276931 }, - { country_name: 'Cayman Islands', 'SUM(SP_POP_TOTL)': 1480956 }, - { country_name: 'Central African Republic', 'SUM(SP_POP_TOTL)': 158650217 }, - { country_name: 'Chad', 'SUM(SP_POP_TOTL)': 355875809 }, - { country_name: 'Channel Islands', 'SUM(SP_POP_TOTL)': 7515697 }, - { country_name: 'Chile', 'SUM(SP_POP_TOTL)': 696739897 }, - { country_name: 'China', 'SUM(SP_POP_TOTL)': 58345455000 }, - { country_name: 'Colombia', 'SUM(SP_POP_TOTL)': 1776189608 }, - { country_name: 'Comoros', 'SUM(SP_POP_TOTL)': 22692936 }, - { country_name: 'Congo, Dem. Rep.', 'SUM(SP_POP_TOTL)': 2015439254 }, - { country_name: 'Congo, Rep.', 'SUM(SP_POP_TOTL)': 130701144 }, - { country_name: 'Costa Rica', 'SUM(SP_POP_TOTL)': 163515714 }, - { country_name: "Cote d'Ivoire", 'SUM(SP_POP_TOTL)': 634194484 }, - { country_name: 'Croatia', 'SUM(SP_POP_TOTL)': 246197511 }, - { country_name: 'Cuba', 'SUM(SP_POP_TOTL)': 550461345 }, - { country_name: 'Curacao', 'SUM(SP_POP_TOTL)': 7898637 }, - { country_name: 'Cyprus', 'SUM(SP_POP_TOTL)': 43711039 }, - { country_name: 'Czech Republic', 'SUM(SP_POP_TOTL)': 559416359 }, - { country_name: 'Denmark', 'SUM(SP_POP_TOTL)': 283435789 }, - { country_name: 'Djibouti', 'SUM(SP_POP_TOTL)': 26324244 }, - { country_name: 'Dominica', 'SUM(SP_POP_TOTL)': 3881071 }, - { country_name: 'Dominican Republic', 'SUM(SP_POP_TOTL)': 373939753 }, - { country_name: 'Ecuador', 'SUM(SP_POP_TOTL)': 537148542 }, - { country_name: 'Egypt, Arab Rep.', 'SUM(SP_POP_TOTL)': 2967887581 }, - { country_name: 'El Salvador', 'SUM(SP_POP_TOTL)': 266413287 }, - { country_name: 'Equatorial Guinea', 'SUM(SP_POP_TOTL)': 22627794 }, - { country_name: 'Eritrea', 'SUM(SP_POP_TOTL)': 161125877 }, - { country_name: 'Estonia', 'SUM(SP_POP_TOTL)': 77119567 }, - { country_name: 'Ethiopia', 'SUM(SP_POP_TOTL)': 2750952916 }, - { country_name: 'Faeroe Islands', 'SUM(SP_POP_TOTL)': 2399439 }, - { country_name: 'Fiji', 'SUM(SP_POP_TOTL)': 37505227 }, - { country_name: 'Finland', 'SUM(SP_POP_TOTL)': 271585488 }, - { country_name: 'France', 'SUM(SP_POP_TOTL)': 3151638853 }, - { country_name: 'French Polynesia', 'SUM(SP_POP_TOTL)': 9974982 }, - { country_name: 'Gabon', 'SUM(SP_POP_TOTL)': 52489952 }, - { country_name: 'Gambia, The', 'SUM(SP_POP_TOTL)': 50232086 }, - { country_name: 'Georgia', 'SUM(SP_POP_TOTL)': 241070850 }, - { country_name: 'Germany', 'SUM(SP_POP_TOTL)': 4361793335 }, - { country_name: 'Ghana', 'SUM(SP_POP_TOTL)': 801844889 }, - { country_name: 'Greece', 'SUM(SP_POP_TOTL)': 547065293 }, - { country_name: 'Greenland', 'SUM(SP_POP_TOTL)': 2807533 }, - { country_name: 'Grenada', 'SUM(SP_POP_TOTL)': 5366107 }, - { country_name: 'Guam', 'SUM(SP_POP_TOTL)': 6647797 }, - { country_name: 'Guatemala', 'SUM(SP_POP_TOTL)': 498361800 }, - { country_name: 'Guinea', 'SUM(SP_POP_TOTL)': 362469063 }, - { country_name: 'Guinea-Bissau', 'SUM(SP_POP_TOTL)': 58400669 }, - { country_name: 'Guyana', 'SUM(SP_POP_TOTL)': 39868752 }, - { country_name: 'Haiti', 'SUM(SP_POP_TOTL)': 377521290 }, - { country_name: 'Honduras', 'SUM(SP_POP_TOTL)': 257791863 }, - { country_name: 'Hong Kong SAR, China', 'SUM(SP_POP_TOTL)': 298353905 }, - { country_name: 'Hungary', 'SUM(SP_POP_TOTL)': 566995908 }, - { country_name: 'Iceland', 'SUM(SP_POP_TOTL)': 13716537 }, - { country_name: 'India', 'SUM(SP_POP_TOTL)': 46023037597 }, - { country_name: 'Indonesia', 'SUM(SP_POP_TOTL)': 9357861231 }, - { country_name: 'Iran, Islamic Rep.', 'SUM(SP_POP_TOTL)': 2717528355 }, - { country_name: 'Iraq', 'SUM(SP_POP_TOTL)': 983604177 }, - { country_name: 'Ireland', 'SUM(SP_POP_TOTL)': 196019322 }, - { country_name: 'Isle of Man', 'SUM(SP_POP_TOTL)': 3728525 }, - { country_name: 'Israel', 'SUM(SP_POP_TOTL)': 263866720 }, - { country_name: 'Italy', 'SUM(SP_POP_TOTL)': 3082869665 }, - { country_name: 'Jamaica', 'SUM(SP_POP_TOTL)': 124779119 }, - { country_name: 'Japan', 'SUM(SP_POP_TOTL)': 6454620759 }, - { country_name: 'Jordan', 'SUM(SP_POP_TOTL)': 180850641 }, - { country_name: 'Kazakhstan', 'SUM(SP_POP_TOTL)': 797168043 }, - { country_name: 'Kenya', 'SUM(SP_POP_TOTL)': 1253201109 }, - { country_name: 'Kiribati', 'SUM(SP_POP_TOTL)': 3874990 }, - { country_name: 'Korea, Dem. Rep.', 'SUM(SP_POP_TOTL)': 1047335229 }, - { country_name: 'Korea, Rep.', 'SUM(SP_POP_TOTL)': 2216456927 }, - { country_name: 'Kosovo', 'SUM(SP_POP_TOTL)': 86627232 }, - { country_name: 'Kuwait', 'SUM(SP_POP_TOTL)': 84737006 }, - { country_name: 'Kyrgyz Republic', 'SUM(SP_POP_TOTL)': 222809200 }, - { country_name: 'Lao PDR', 'SUM(SP_POP_TOTL)': 227340983 }, - { country_name: 'Latvia', 'SUM(SP_POP_TOTL)': 130544986 }, - { country_name: 'Lebanon', 'SUM(SP_POP_TOTL)': 162031498 }, - { country_name: 'Lesotho', 'SUM(SP_POP_TOTL)': 81971241 }, - { country_name: 'Liberia', 'SUM(SP_POP_TOTL)': 125666085 }, - { country_name: 'Libya', 'SUM(SP_POP_TOTL)': 217716251 }, - { country_name: 'Liechtenstein', 'SUM(SP_POP_TOTL)': 1527171 }, - { country_name: 'Lithuania', 'SUM(SP_POP_TOTL)': 182416949 }, - { country_name: 'Luxembourg', 'SUM(SP_POP_TOTL)': 21852156 }, - { country_name: 'Macao SAR, China', 'SUM(SP_POP_TOTL)': 18882494 }, - { country_name: 'Macedonia, FYR', 'SUM(SP_POP_TOTL)': 104100695 }, - { country_name: 'Madagascar', 'SUM(SP_POP_TOTL)': 656478313 }, - { country_name: 'Malawi', 'SUM(SP_POP_TOTL)': 470725354 }, - { country_name: 'Malaysia', 'SUM(SP_POP_TOTL)': 978122682 }, - { country_name: 'Maldives', 'SUM(SP_POP_TOTL)': 11478624 }, - { country_name: 'Mali', 'SUM(SP_POP_TOTL)': 500758830 }, - { country_name: 'Malta', 'SUM(SP_POP_TOTL)': 19363458 }, - { country_name: 'Marshall Islands', 'SUM(SP_POP_TOTL)': 2086174 }, - { country_name: 'Mauritania', 'SUM(SP_POP_TOTL)': 113489314 }, - { country_name: 'Mauritius', 'SUM(SP_POP_TOTL)': 56066051 }, - { country_name: 'Mexico', 'SUM(SP_POP_TOTL)': 4444653964 }, - { country_name: 'Micronesia, Fed. Sts.', 'SUM(SP_POP_TOTL)': 4627492 }, - { country_name: 'Moldova', 'SUM(SP_POP_TOTL)': 186156257 }, - { country_name: 'Monaco', 'SUM(SP_POP_TOTL)': 1595554 }, - { country_name: 'Mongolia', 'SUM(SP_POP_TOTL)': 106717826 }, - { country_name: 'Montenegro', 'SUM(SP_POP_TOTL)': 31652512 }, - { country_name: 'Morocco', 'SUM(SP_POP_TOTL)': 1277441301 }, - { country_name: 'Mozambique', 'SUM(SP_POP_TOTL)': 807229371 }, - { country_name: 'Myanmar', 'SUM(SP_POP_TOTL)': 2126848982 }, - { country_name: 'Namibia', 'SUM(SP_POP_TOTL)': 75238033 }, - { country_name: 'Nepal', 'SUM(SP_POP_TOTL)': 1007162709 }, - { country_name: 'Netherlands', 'SUM(SP_POP_TOTL)': 803013980 }, - { country_name: 'New Caledonia', 'SUM(SP_POP_TOTL)': 9225822 }, - { country_name: 'New Zealand', 'SUM(SP_POP_TOTL)': 187593600 }, - { country_name: 'Nicaragua', 'SUM(SP_POP_TOTL)': 213048662 }, - { country_name: 'Niger', 'SUM(SP_POP_TOTL)': 471910464 }, - { country_name: 'Nigeria', 'SUM(SP_POP_TOTL)': 5259800493 }, - { country_name: 'Northern Mariana Islands', 'SUM(SP_POP_TOTL)': 2015842 }, - { country_name: 'Norway', 'SUM(SP_POP_TOTL)': 233337059 }, - { country_name: 'Oman', 'SUM(SP_POP_TOTL)': 93132249 }, - { country_name: 'Pakistan', 'SUM(SP_POP_TOTL)': 5696041480 }, - { country_name: 'Palau', 'SUM(SP_POP_TOTL)': 833299 }, - { country_name: 'Panama', 'SUM(SP_POP_TOTL)': 130974461 }, - { country_name: 'Papua New Guinea', 'SUM(SP_POP_TOTL)': 228299012 }, - { country_name: 'Paraguay', 'SUM(SP_POP_TOTL)': 221768661 }, - { country_name: 'Peru', 'SUM(SP_POP_TOTL)': 1121937313 }, - { country_name: 'Philippines', 'SUM(SP_POP_TOTL)': 3272015554 }, - { country_name: 'Poland', 'SUM(SP_POP_TOTL)': 1976772515 }, - { country_name: 'Portugal', 'SUM(SP_POP_TOTL)': 536945679 }, - { country_name: 'Puerto Rico', 'SUM(SP_POP_TOTL)': 181515497 }, - { country_name: 'Qatar', 'SUM(SP_POP_TOTL)': 30075210 }, - { country_name: 'Romania', 'SUM(SP_POP_TOTL)': 1171333228 }, - { country_name: 'Russian Federation', 'SUM(SP_POP_TOTL)': 7667188460 }, - { country_name: 'Rwanda', 'SUM(SP_POP_TOTL)': 347121852 }, - { country_name: 'Samoa', 'SUM(SP_POP_TOTL)': 8770470 }, - { country_name: 'San Marino', 'SUM(SP_POP_TOTL)': 1298411 }, - { country_name: 'Sao Tome and Principe', 'SUM(SP_POP_TOTL)': 6169644 }, - { country_name: 'Saudi Arabia', 'SUM(SP_POP_TOTL)': 828451525 }, - { country_name: 'Senegal', 'SUM(SP_POP_TOTL)': 414475224 }, - { country_name: 'Serbia', 'SUM(SP_POP_TOTL)': 186596480 }, - { country_name: 'Seychelles', 'SUM(SP_POP_TOTL)': 3761184 }, - { country_name: 'Sierra Leone', 'SUM(SP_POP_TOTL)': 203443826 }, - { country_name: 'Singapore', 'SUM(SP_POP_TOTL)': 173168000 }, - { country_name: 'Sint Maarten (Dutch part)', 'SUM(SP_POP_TOTL)': 597781 }, - { country_name: 'Slovak Republic', 'SUM(SP_POP_TOTL)': 276228375 }, - { country_name: 'Slovenia', 'SUM(SP_POP_TOTL)': 104119695 }, - { country_name: 'Solomon Islands', 'SUM(SP_POP_TOTL)': 16859526 }, - { country_name: 'Somalia', 'SUM(SP_POP_TOTL)': 332677926 }, - { country_name: 'South Africa', 'SUM(SP_POP_TOTL)': 1871083248 }, - { country_name: 'South Sudan', 'SUM(SP_POP_TOTL)': 319024522 }, - { country_name: 'Spain', 'SUM(SP_POP_TOTL)': 2115316751 }, - { country_name: 'Sri Lanka', 'SUM(SP_POP_TOTL)': 881137000 }, - { country_name: 'St. Kitts and Nevis', 'SUM(SP_POP_TOTL)': 2535482 }, - { country_name: 'St. Lucia', 'SUM(SP_POP_TOTL)': 7336842 }, - { country_name: 'St. Martin (French part)', 'SUM(SP_POP_TOTL)': 1020457 }, - { country_name: 'St. Vincent and the Grenadines', 'SUM(SP_POP_TOTL)': 5557117 }, - { country_name: 'Sudan', 'SUM(SP_POP_TOTL)': 1118903636 }, - { country_name: 'Suriname', 'SUM(SP_POP_TOTL)': 22687861 }, - { country_name: 'Swaziland', 'SUM(SP_POP_TOTL)': 42858935 }, - { country_name: 'Sweden', 'SUM(SP_POP_TOTL)': 468210684 }, - { country_name: 'Switzerland', 'SUM(SP_POP_TOTL)': 369360744 }, - { country_name: 'Syrian Arab Republic', 'SUM(SP_POP_TOTL)': 663924524 }, - { country_name: 'Tajikistan', 'SUM(SP_POP_TOTL)': 267603756 }, - { country_name: 'Tanzania', 'SUM(SP_POP_TOTL)': 1413734053 }, - { country_name: 'Thailand', 'SUM(SP_POP_TOTL)': 2827157965 }, - { country_name: 'Timor-Leste', 'SUM(SP_POP_TOTL)': 41694123 }, - { country_name: 'Togo', 'SUM(SP_POP_TOTL)': 204624027 }, - { country_name: 'Tonga', 'SUM(SP_POP_TOTL)': 5038574 }, - { country_name: 'Trinidad and Tobago', 'SUM(SP_POP_TOTL)': 62771502 }, - { country_name: 'Tunisia', 'SUM(SP_POP_TOTL)': 415992799 }, - { country_name: 'Turkey', 'SUM(SP_POP_TOTL)': 2805220683 }, - { country_name: 'Turkmenistan', 'SUM(SP_POP_TOTL)': 189687365 }, - { country_name: 'Turks and Caicos Islands', 'SUM(SP_POP_TOTL)': 775185 }, - { country_name: 'Tuvalu', 'SUM(SP_POP_TOTL)': 466709 }, - { country_name: 'Uganda', 'SUM(SP_POP_TOTL)': 987376102 }, - { country_name: 'Ukraine', 'SUM(SP_POP_TOTL)': 2657782543 }, - { country_name: 'United Arab Emirates', 'SUM(SP_POP_TOTL)': 134952923 }, - { country_name: 'United Kingdom', 'SUM(SP_POP_TOTL)': 3169118137 }, - { country_name: 'United States', 'SUM(SP_POP_TOTL)': 13604468357 }, - { country_name: 'Uruguay', 'SUM(SP_POP_TOTL)': 167612670 }, - { country_name: 'Uzbekistan', 'SUM(SP_POP_TOTL)': 1053380227 }, - { country_name: 'Vanuatu', 'SUM(SP_POP_TOTL)': 7966814 }, - { country_name: 'Venezuela, RB', 'SUM(SP_POP_TOTL)': 1036057583 }, - { country_name: 'Vietnam', 'SUM(SP_POP_TOTL)': 3420037000 }, - { country_name: 'Virgin Islands (U.S.)', 'SUM(SP_POP_TOTL)': 5006756 }, - { country_name: 'West Bank and Gaza', 'SUM(SP_POP_TOTL)': 77390117 }, - { country_name: 'Yemen, Rep.', 'SUM(SP_POP_TOTL)': 695646128 }, - { country_name: 'Zambia', 'SUM(SP_POP_TOTL)': 438847085 }, - { country_name: 'Zimbabwe', 'SUM(SP_POP_TOTL)': 509866860 }, -]; diff --git a/plugins/plugin-filter-antd/README.md b/plugins/plugin-filter-antd/README.md deleted file mode 100644 index 7de162f36a..0000000000 --- a/plugins/plugin-filter-antd/README.md +++ /dev/null @@ -1,34 +0,0 @@ -## @superset-ui/plugin-filter-antd - -[![Version](https://img.shields.io/npm/v/@superset-ui/plugin-filter-antd.svg?style=flat-square)](https://www.npmjs.com/package/@superset-ui/plugin-filter-antd) - -This plugin provides native filter plugins based on AntD. - -### Usage - -Configure `key`, which can be any `string`, and register the plugin. This `key` will be used to -lookup this chart throughout the app. - -Below is an example of how to use the Select filter plugin. - -```js -import { AntdFilterSelectPlugin } from '@superset-ui/plugin-filter-antd'; - -new AntdFilterSelectPlugin().configure({ key: 'plugin-filter-select' }).register(); -``` - -Then use it via `SuperChart`. - -```js - console.log(extraFormData) }, - }]} -/> -``` diff --git a/plugins/plugin-filter-antd/package.json b/plugins/plugin-filter-antd/package.json deleted file mode 100644 index 3390febb06..0000000000 --- a/plugins/plugin-filter-antd/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@superset-ui/plugin-filter-antd", - "version": "0.17.5", - "description": "Superset Filter - Plugin Filter AntD", - "sideEffects": false, - "main": "lib/index.js", - "module": "esm/index.js", - "files": [ - "esm", - "lib" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/apache-superset/superset-ui.git" - }, - "keywords": [ - "superset" - ], - "author": "Superset", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/apache-superset/superset-ui/issues" - }, - "homepage": "https://github.com/apache-superset/superset-ui#readme", - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@superset-ui/chart-controls": "0.17.5", - "@superset-ui/core": "0.17.5", - "antd": "^4.9.1" - }, - "peerDependencies": { - "react": "^16.13.1" - }, - "devDependencies": { - "@types/jest": "^26.0.0", - "jest": "^26.0.1" - } -} diff --git a/plugins/plugin-filter-antd/src/Range/AntdRangeFilter.tsx b/plugins/plugin-filter-antd/src/Range/AntdRangeFilter.tsx deleted file mode 100644 index 62cf2810e5..0000000000 --- a/plugins/plugin-filter-antd/src/Range/AntdRangeFilter.tsx +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { QueryObjectFilterClause, styled } from '@superset-ui/core'; -import React from 'react'; -import { Slider } from 'antd'; -import { AntdPluginFilterRangeProps } from './types'; -import { AntdPluginFilterStylesProps } from '../types'; - -const Styles = styled.div` - height: ${({ height }) => height}; - width: ${({ width }) => width}; -`; - -export default function AntdRangeFilter(props: AntdPluginFilterRangeProps) { - const { data, formData, height, width, setExtraFormData } = props; - const [row] = data; - // @ts-ignore - const { min, max }: { min: number; max: number } = row; - const { groupby } = formData; - const [col] = groupby || []; - - const handleChange = (value: [number, number]) => { - const [lower, upper] = value; - const filters: QueryObjectFilterClause[] = []; - if (lower !== undefined && lower !== null) filters.push({ col, op: '>=', val: lower }); - if (upper !== undefined && upper !== null) filters.push({ col, op: '>=', val: upper }); - setExtraFormData({ - append_form_data: { - filters, - }, - }); - }; - - return ( - - - - ); -} diff --git a/plugins/plugin-filter-antd/src/Range/buildQuery.ts b/plugins/plugin-filter-antd/src/Range/buildQuery.ts deleted file mode 100644 index 9c0d0202dc..0000000000 --- a/plugins/plugin-filter-antd/src/Range/buildQuery.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { buildQueryContext, ColumnType, QueryFormData } from '@superset-ui/core'; - -/** - * The buildQuery function is used to create an instance of QueryContext that's - * sent to the chart data endpoint. In addition to containing information of which - * datasource to use, it specifies the type (e.g. full payload, samples, query) and - * format (e.g. CSV or JSON) of the result and whether or not to force refresh the data from - * the datasource as opposed to using a cached copy of the data, if available. - * - * More importantly though, QueryContext contains a property `queries`, which is an array of - * QueryObjects specifying individual data requests to be made. A QueryObject specifies which - * columns, metrics and filters, among others, to use during the query. Usually it will be enough - * to specify just one query based on the baseQueryObject, but for some more advanced use cases - * it is possible to define post processing operations in the QueryObject, or multiple queries - * if a viz needs multiple different result sets. - */ -export default function buildQuery(formData: QueryFormData) { - const { groupby } = formData; - const [column] = groupby || []; - return buildQueryContext(formData, baseQueryObject => [ - { - ...baseQueryObject, - groupby: [], - metrics: [ - { - aggregate: 'MIN', - column: { - columnName: column, - id: 1, - type: ColumnType.FLOAT, - }, - expressionType: 'SIMPLE', - hasCustomLabel: true, - label: 'min', - }, - { - aggregate: 'MAX', - column: { - columnName: column, - id: 2, - type: ColumnType.FLOAT, - }, - expressionType: 'SIMPLE', - hasCustomLabel: true, - label: 'max', - }, - ], - }, - ]); -} diff --git a/plugins/plugin-filter-antd/src/Range/controlPanel.ts b/plugins/plugin-filter-antd/src/Range/controlPanel.ts deleted file mode 100644 index 73feec8b29..0000000000 --- a/plugins/plugin-filter-antd/src/Range/controlPanel.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { t, validateNonEmpty } from '@superset-ui/core'; -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; - -const config: ControlPanelConfig = { - // For control input types, see: superset-frontend/src/explore/components/controls/index.js - controlPanelSections: [ - sections.legacyRegularTime, - { - label: t('Query'), - expanded: true, - controlSetRows: [['groupby'], ['adhoc_filters']], - }, - ], - controlOverrides: { - groupby: { - validators: [validateNonEmpty], - clearable: false, - }, - row_limit: { - default: 100, - }, - }, -}; - -export default config; diff --git a/plugins/plugin-filter-antd/src/Range/images/thumbnail.png b/plugins/plugin-filter-antd/src/Range/images/thumbnail.png deleted file mode 100644 index 7afef30bd4..0000000000 Binary files a/plugins/plugin-filter-antd/src/Range/images/thumbnail.png and /dev/null differ diff --git a/plugins/plugin-filter-antd/src/Range/index.ts b/plugins/plugin-filter-antd/src/Range/index.ts deleted file mode 100644 index 4a77fbb97c..0000000000 --- a/plugins/plugin-filter-antd/src/Range/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { t, ChartMetadata, ChartPlugin } from '@superset-ui/core'; -import buildQuery from './buildQuery'; -import controlPanel from './controlPanel'; -import transformProps from './transformProps'; -import thumbnail from './images/thumbnail.png'; - -export default class AntdRangeFilterPlugin extends ChartPlugin { - constructor() { - const metadata = new ChartMetadata({ - name: t('Range Filter Plugin'), - description: 'Range Filter Plugin using AntD', - isNativeFilter: true, - thumbnail, - }); - - super({ - buildQuery, - controlPanel, - loadChart: () => import('./AntdRangeFilter'), - metadata, - transformProps, - }); - } -} diff --git a/plugins/plugin-filter-antd/src/Range/transformProps.ts b/plugins/plugin-filter-antd/src/Range/transformProps.ts deleted file mode 100644 index 20b81b58ac..0000000000 --- a/plugins/plugin-filter-antd/src/Range/transformProps.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { ChartProps, DataRecord } from '@superset-ui/core'; - -export default function transformProps(chartProps: ChartProps) { - const { formData, height, hooks, queriesData, width } = chartProps; - const { setExtraFormData } = hooks; - const data = queriesData[0].data as DataRecord[]; - - return { - data, - formData, - height, - setExtraFormData, - width, - }; -} diff --git a/plugins/plugin-filter-antd/src/Range/types.ts b/plugins/plugin-filter-antd/src/Range/types.ts deleted file mode 100644 index e095c364b2..0000000000 --- a/plugins/plugin-filter-antd/src/Range/types.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { DataRecord, QueryFormData, SetExtraFormDataHook } from '@superset-ui/core'; -import { AntdPluginFilterStylesProps } from '../types'; - -interface AntdPluginFilterSelectCustomizeProps { - max?: number; - min?: number; -} - -export type PluginFilterRangeQueryFormData = QueryFormData & - AntdPluginFilterStylesProps & - AntdPluginFilterSelectCustomizeProps; - -export type AntdPluginFilterRangeProps = AntdPluginFilterStylesProps & { - data: DataRecord[]; - formData: PluginFilterRangeQueryFormData; - setExtraFormData: SetExtraFormDataHook; -}; diff --git a/plugins/plugin-filter-antd/src/Select/AntdSelectFilter.tsx b/plugins/plugin-filter-antd/src/Select/AntdSelectFilter.tsx deleted file mode 100644 index 4df3a1ff97..0000000000 --- a/plugins/plugin-filter-antd/src/Select/AntdSelectFilter.tsx +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { styled } from '@superset-ui/core'; -import React, { useEffect, useState } from 'react'; -import { Select } from 'antd'; -import { DEFAULT_FORM_DATA, AntdPluginFilterSelectProps } from './types'; -import { AntdPluginFilterStylesProps } from '../types'; - -const Styles = styled.div` - height: ${({ height }) => height}; - width: ${({ width }) => width}; -`; - -const { Option } = Select; - -export default function AntdPluginFilterSelect(props: AntdPluginFilterSelectProps) { - const [values, setValues] = useState<(string | number)[]>([]); - const DELIMITER = '!^&@%#*!@'; - const { data, formData, height, width, setExtraFormData } = props; - const { defaultValues, enableEmptyFilter, multiSelect, showSearch, inverseSelection } = { - ...DEFAULT_FORM_DATA, - ...formData, - }; - - useEffect(() => { - setValues(defaultValues || []); - }, [defaultValues]); - - let { groupby = [] } = formData; - groupby = Array.isArray(groupby) ? groupby : [groupby]; - - function handleChange(value?: number[] | string[] | null) { - setValues(value || []); - const [col] = groupby; - const emptyFilter = - enableEmptyFilter && - !inverseSelection && - (value === undefined || value === null || value.length === 0); - setExtraFormData({ - append_form_data: emptyFilter - ? { - extras: { - where: '1 = 0', - }, - } - : { - filters: - value === undefined || value === null || value.length === 0 - ? [] - : [ - { - col, - op: inverseSelection ? 'NOT IN' : 'IN', - val: value, - }, - ], - }, - }); - } - const placeholderText = - (data || []).length === 0 ? 'No data' : `${data.length} option${data.length > 1 ? 's' : 0}`; - return ( - - - - ); -} diff --git a/plugins/plugin-filter-antd/src/Select/buildQuery.ts b/plugins/plugin-filter-antd/src/Select/buildQuery.ts deleted file mode 100644 index ba82222b91..0000000000 --- a/plugins/plugin-filter-antd/src/Select/buildQuery.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { buildQueryContext, QueryFormData } from '@superset-ui/core'; - -/** - * The buildQuery function is used to create an instance of QueryContext that's - * sent to the chart data endpoint. In addition to containing information of which - * datasource to use, it specifies the type (e.g. full payload, samples, query) and - * format (e.g. CSV or JSON) of the result and whether or not to force refresh the data from - * the datasource as opposed to using a cached copy of the data, if available. - * - * More importantly though, QueryContext contains a property `queries`, which is an array of - * QueryObjects specifying individual data requests to be made. A QueryObject specifies which - * columns, metrics and filters, among others, to use during the query. Usually it will be enough - * to specify just one query based on the baseQueryObject, but for some more advanced use cases - * it is possible to define post processing operations in the QueryObject, or multiple queries - * if a viz needs multiple different result sets. - */ -export default function buildQuery(formData: QueryFormData) { - return buildQueryContext(formData, baseQueryObject => [ - { - ...baseQueryObject, - }, - ]); -} diff --git a/plugins/plugin-filter-antd/src/Select/controlPanel.ts b/plugins/plugin-filter-antd/src/Select/controlPanel.ts deleted file mode 100644 index b3ca6cc836..0000000000 --- a/plugins/plugin-filter-antd/src/Select/controlPanel.ts +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { t, validateNonEmpty } from '@superset-ui/core'; -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; -import { DEFAULT_FORM_DATA } from './types'; - -const { - enableEmptyFilter, - fetchPredicate, - inverseSelection, - multiSelect, - showSearch, -} = DEFAULT_FORM_DATA; - -const config: ControlPanelConfig = { - controlPanelSections: [ - sections.legacyRegularTime, - { - label: t('Query'), - expanded: true, - controlSetRows: [ - ['groupby'], - ['metrics'], - ['adhoc_filters'], - [ - { - name: 'multiSelect', - config: { - type: 'CheckboxControl', - label: t('Multiple Select'), - default: multiSelect, - description: t('Allow selecting multiple values'), - }, - }, - ], - [ - { - name: 'enableEmptyFilter', - config: { - type: 'CheckboxControl', - label: t('Enable Empty Filter'), - default: enableEmptyFilter, - description: t( - 'When selection is empty, should an always false filter event be emitted', - ), - }, - }, - ], - [ - { - name: 'inverseSelection', - config: { - type: 'CheckboxControl', - label: t('Inverse Selection'), - default: inverseSelection, - description: t('Exclude selected values'), - }, - }, - ], - [ - { - name: 'showSearch', - config: { - type: 'CheckboxControl', - label: t('Search Field'), - default: showSearch, - description: t('Allow typing search terms'), - }, - }, - ], - [ - { - name: 'fetchPredicate', - config: { - type: 'TextControl', - label: t('Fetch predicate'), - default: fetchPredicate, - description: t( - 'Predicate applied when fetching distinct value to populate the filter control component.', - ), - }, - }, - null, - ], - ['row_limit', null], - ], - }, - ], - controlOverrides: { - groupby: { - multi: false, - validators: [validateNonEmpty], - }, - }, -}; - -export default config; diff --git a/plugins/plugin-filter-antd/src/Select/images/thumbnail.png b/plugins/plugin-filter-antd/src/Select/images/thumbnail.png deleted file mode 100644 index 7afef30bd4..0000000000 Binary files a/plugins/plugin-filter-antd/src/Select/images/thumbnail.png and /dev/null differ diff --git a/plugins/plugin-filter-antd/src/Select/index.ts b/plugins/plugin-filter-antd/src/Select/index.ts deleted file mode 100644 index f0d05c3739..0000000000 --- a/plugins/plugin-filter-antd/src/Select/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { t, ChartMetadata, ChartPlugin } from '@superset-ui/core'; -import buildQuery from './buildQuery'; -import controlPanel from './controlPanel'; -import transformProps from './transformProps'; -import thumbnail from './images/thumbnail.png'; - -export default class AntdFilterSelectPlugin extends ChartPlugin { - constructor() { - const metadata = new ChartMetadata({ - name: t('Select Filter Plugin'), - description: 'Select Filter Plugin using AntD', - isNativeFilter: true, - thumbnail, - }); - - super({ - buildQuery, - controlPanel, - loadChart: () => import('./AntdSelectFilter'), - metadata, - transformProps, - }); - } -} diff --git a/plugins/plugin-filter-antd/src/Select/transformProps.ts b/plugins/plugin-filter-antd/src/Select/transformProps.ts deleted file mode 100644 index 935f49f2dc..0000000000 --- a/plugins/plugin-filter-antd/src/Select/transformProps.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { ChartProps, DataRecord } from '@superset-ui/core'; -import { DEFAULT_FORM_DATA } from './types'; - -export default function transformProps(chartProps: ChartProps) { - const { formData, height, hooks, queriesData, width } = chartProps; - const newFormData = { ...DEFAULT_FORM_DATA, ...formData }; - const { setExtraFormData = () => {} } = hooks; - const data = queriesData[0].data as DataRecord[]; - - return { - width, - height, - data, - formData: newFormData, - setExtraFormData, - }; -} diff --git a/plugins/plugin-filter-antd/src/Select/types.ts b/plugins/plugin-filter-antd/src/Select/types.ts deleted file mode 100644 index f485685f95..0000000000 --- a/plugins/plugin-filter-antd/src/Select/types.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { QueryFormData, DataRecord, SetExtraFormDataHook } from '@superset-ui/core'; -import { AntdPluginFilterStylesProps } from '../types'; - -interface AntdPluginFilterSelectCustomizeProps { - defaultValues?: (string | number)[]; - enableEmptyFilter: boolean; - fetchPredicate?: string; - inverseSelection: boolean; - multiSelect: boolean; - showSearch: boolean; -} - -export type AntdPluginFilterSelectQueryFormData = QueryFormData & - AntdPluginFilterStylesProps & - AntdPluginFilterSelectCustomizeProps; - -export type AntdPluginFilterSelectProps = AntdPluginFilterStylesProps & { - data: DataRecord[]; - setExtraFormData: SetExtraFormDataHook; - formData: AntdPluginFilterSelectQueryFormData; -}; - -export const DEFAULT_FORM_DATA: AntdPluginFilterSelectCustomizeProps = { - defaultValues: [], - enableEmptyFilter: false, - fetchPredicate: '', - inverseSelection: false, - multiSelect: true, - showSearch: true, -}; diff --git a/plugins/plugin-filter-antd/src/index.ts b/plugins/plugin-filter-antd/src/index.ts deleted file mode 100644 index fadaf1cdec..0000000000 --- a/plugins/plugin-filter-antd/src/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * 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. - */ -export { default as AntdSelectFilterPlugin } from './Select'; -export { default as AntdRangeFilterPlugin } from './Range'; diff --git a/plugins/plugin-filter-antd/src/types.ts b/plugins/plugin-filter-antd/src/types.ts deleted file mode 100644 index 869dc79e32..0000000000 --- a/plugins/plugin-filter-antd/src/types.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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. - */ -export interface AntdPluginFilterStylesProps { - height: number; - width: number; -} diff --git a/plugins/plugin-filter-antd/test/index.test.ts b/plugins/plugin-filter-antd/test/index.test.ts deleted file mode 100644 index 72fcfba903..0000000000 --- a/plugins/plugin-filter-antd/test/index.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { AntdSelectFilterPlugin, AntdRangeFilterPlugin } from '../src'; - -/** - * The example tests in this file act as a starting point, and - * we encourage you to build more. These tests check that the - * plugin loads properly, and focus on `transformProps` - * to ake sure that data, controls, and props are all - * treated correctly (e.g. formData from plugin controls - * properly transform the data and/or any resulting props). - */ -describe('@superset-ui/plugin-filter-antd', () => { - it('exists', () => { - expect(AntdSelectFilterPlugin).toBeDefined(); - expect(AntdRangeFilterPlugin).toBeDefined(); - }); -}); diff --git a/plugins/plugin-filter-antd/tsconfig.json b/plugins/plugin-filter-antd/tsconfig.json deleted file mode 100644 index f164c58060..0000000000 --- a/plugins/plugin-filter-antd/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "declarationDir": "lib", - "outDir": "lib", - "rootDir": "src" - }, - "exclude": [ - "lib", - "test" - ], - "extends": "../../tsconfig.options.json", - "include": [ - "src/**/*", - "types/**/*", - "../../types/**/*" - ], - "references": [ - { - "path": "../../packages/superset-ui-chart-controls" - }, - { - "path": "../../packages/superset-ui-core" - } - ] -} diff --git a/plugins/plugin-filter-antd/types/external.d.ts b/plugins/plugin-filter-antd/types/external.d.ts deleted file mode 100644 index 0935dbbd80..0000000000 --- a/plugins/plugin-filter-antd/types/external.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*.png' { - const value: any; - export default value; -}