Skip to content

Commit

Permalink
Merge branch 'master' into feat/add-filter-description
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ajay committed Oct 27, 2021
2 parents bb60d88 + 4316fe6 commit 7594453
Show file tree
Hide file tree
Showing 25 changed files with 760 additions and 484 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def get_git_sha() -> str:
"crate": ["crate[sqlalchemy]>=0.26.0, <0.27"],
"databricks": ["databricks-dbapi[sqlalchemy]>=0.5.0, <0.6"],
"db2": ["ibm-db-sa>=0.3.5, <0.4"],
"dremio": ["sqlalchemy-dremio>=1.1.5, <1.2"],
"dremio": ["sqlalchemy-dremio>=1.1.5, <1.3"],
"drill": ["sqlalchemy-drill==0.1.dev"],
"druid": ["pydruid>=0.6.1,<0.7"],
"solr": ["sqlalchemy-solr >= 0.2.0"],
Expand Down
638 changes: 315 additions & 323 deletions superset-frontend/package-lock.json

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,35 @@
"@emotion/cache": "^11.4.0",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@superset-ui/chart-controls": "^0.18.14",
"@superset-ui/core": "^0.18.14",
"@superset-ui/legacy-plugin-chart-calendar": "^0.18.14",
"@superset-ui/legacy-plugin-chart-chord": "^0.18.14",
"@superset-ui/legacy-plugin-chart-country-map": "^0.18.14",
"@superset-ui/legacy-plugin-chart-event-flow": "^0.18.14",
"@superset-ui/legacy-plugin-chart-force-directed": "^0.18.14",
"@superset-ui/legacy-plugin-chart-heatmap": "^0.18.14",
"@superset-ui/legacy-plugin-chart-histogram": "^0.18.14",
"@superset-ui/legacy-plugin-chart-horizon": "^0.18.14",
"@superset-ui/legacy-plugin-chart-map-box": "^0.18.14",
"@superset-ui/legacy-plugin-chart-paired-t-test": "^0.18.14",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.18.14",
"@superset-ui/legacy-plugin-chart-partition": "^0.18.14",
"@superset-ui/legacy-plugin-chart-pivot-table": "^0.18.14",
"@superset-ui/legacy-plugin-chart-rose": "^0.18.14",
"@superset-ui/legacy-plugin-chart-sankey": "^0.18.14",
"@superset-ui/legacy-plugin-chart-sankey-loop": "^0.18.14",
"@superset-ui/legacy-plugin-chart-sunburst": "^0.18.14",
"@superset-ui/legacy-plugin-chart-treemap": "^0.18.14",
"@superset-ui/legacy-plugin-chart-world-map": "^0.18.14",
"@superset-ui/legacy-preset-chart-big-number": "^0.18.14",
"@superset-ui/chart-controls": "^0.18.15",
"@superset-ui/core": "^0.18.15",
"@superset-ui/legacy-plugin-chart-calendar": "^0.18.15",
"@superset-ui/legacy-plugin-chart-chord": "^0.18.15",
"@superset-ui/legacy-plugin-chart-country-map": "^0.18.15",
"@superset-ui/legacy-plugin-chart-event-flow": "^0.18.15",
"@superset-ui/legacy-plugin-chart-force-directed": "^0.18.15",
"@superset-ui/legacy-plugin-chart-heatmap": "^0.18.15",
"@superset-ui/legacy-plugin-chart-histogram": "^0.18.15",
"@superset-ui/legacy-plugin-chart-horizon": "^0.18.15",
"@superset-ui/legacy-plugin-chart-map-box": "^0.18.15",
"@superset-ui/legacy-plugin-chart-paired-t-test": "^0.18.15",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.18.15",
"@superset-ui/legacy-plugin-chart-partition": "^0.18.15",
"@superset-ui/legacy-plugin-chart-pivot-table": "^0.18.15",
"@superset-ui/legacy-plugin-chart-rose": "^0.18.15",
"@superset-ui/legacy-plugin-chart-sankey": "^0.18.15",
"@superset-ui/legacy-plugin-chart-sankey-loop": "^0.18.15",
"@superset-ui/legacy-plugin-chart-sunburst": "^0.18.15",
"@superset-ui/legacy-plugin-chart-treemap": "^0.18.15",
"@superset-ui/legacy-plugin-chart-world-map": "^0.18.15",
"@superset-ui/legacy-preset-chart-big-number": "^0.18.15",
"@superset-ui/legacy-preset-chart-deckgl": "^0.4.12",
"@superset-ui/legacy-preset-chart-nvd3": "^0.18.14",
"@superset-ui/plugin-chart-echarts": "^0.18.14",
"@superset-ui/plugin-chart-pivot-table": "^0.18.14",
"@superset-ui/plugin-chart-table": "^0.18.14",
"@superset-ui/plugin-chart-word-cloud": "^0.18.14",
"@superset-ui/preset-chart-xy": "^0.18.14",
"@superset-ui/legacy-preset-chart-nvd3": "^0.18.15",
"@superset-ui/plugin-chart-echarts": "^0.18.15",
"@superset-ui/plugin-chart-pivot-table": "^0.18.15",
"@superset-ui/plugin-chart-table": "^0.18.15",
"@superset-ui/plugin-chart-word-cloud": "^0.18.15",
"@superset-ui/preset-chart-xy": "^0.18.15",
"@vx/responsive": "^0.0.195",
"abortcontroller-polyfill": "^1.1.9",
"antd": "^4.9.4",
Expand Down
44 changes: 0 additions & 44 deletions superset-frontend/src/components/ChartIcon/index.tsx

This file was deleted.

49 changes: 37 additions & 12 deletions superset-frontend/src/components/Select/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ const selectPositions = [
const ARG_TYPES = {
options: {
defaultValue: options,
table: {
disable: true,
},
description: `It defines the options of the Select.
The options can be static, an array of options.
The options can also be async, a promise that returns an array of options.
`,
},
ariaLabel: {
table: {
disable: true,
},
description: `It adds the aria-label tag for accessibility standards.
Must be plain English and localized.
`,
},
labelInValue: {
defaultValue: true,
Expand All @@ -101,12 +102,34 @@ const ARG_TYPES = {
},
},
mode: {
description: `It defines whether the Select should allow for
the selection of multiple options or single. Single by default.
`,
defaultValue: 'single',
control: {
type: 'inline-radio',
options: ['single', 'multiple'],
},
},
allowNewOptions: {
description: `It enables the user to create new options.
Can be used with standard or async select types.
Can be used with any mode, single or multiple. False by default.
`,
},
invertSelection: {
description: `It shows a stop-outlined icon at the far right of a selected
option instead of the default checkmark.
Useful to better indicate to the user that by clicking on a selected
option it will be de-selected. False by default.
`,
},
optionFilterProps: {
description: `It allows to define which properties of the option object
should be looked for when searching.
By default label and value.
`,
},
};

const mountHeader = (type: String) => {
Expand Down Expand Up @@ -149,17 +172,19 @@ InteractiveSelect.argTypes = {
...ARG_TYPES,
header: {
defaultValue: 'none',
description: `It adds a header on top of the Select. Can be any ReactNode.`,
control: { type: 'inline-radio', options: ['none', 'text', 'control'] },
},
pageSize: {
table: {
disable: true,
},
description: `It defines how many results should be included in the query response.
Works in async mode only (See the options property).
`,
},
fetchOnlyOnSearch: {
table: {
disable: true,
},
description: `It fires a request against the server only after searching.
Works in async mode only (See the options property).
Undefined by default.
`,
},
};

Expand Down
77 changes: 77 additions & 0 deletions superset-frontend/src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,80 @@ export type OptionsPagePromise = (
) => Promise<OptionsTypePage>;

export interface SelectProps extends PickedSelectProps {
/**
* It enables the user to create new options.
* Can be used with standard or async select types.
* Can be used with any mode, single or multiple.
* False by default.
* */
allowNewOptions?: boolean;
/**
* It adds the aria-label tag for accessibility standards.
* Must be plain English and localized.
*/
ariaLabel: string;
/**
* It adds a header on top of the Select.
* Can be any ReactNode.
*/
header?: ReactNode;
/**
* It fires a request against the server after
* the first interaction and not on render.
* Works in async mode only (See the options property).
* True by default.
*/
lazyLoading?: boolean;
/**
* It defines whether the Select should allow for the
* selection of multiple options or single.
* Single by default.
*/
mode?: 'single' | 'multiple';
/**
* Deprecated.
* Prefer ariaLabel instead.
*/
name?: string; // discourage usage
/**
* It allows to define which properties of the option object
* should be looked for when searching.
* By default label and value.
*/
optionFilterProps?: string[];
/**
* It defines the options of the Select.
* The options can be static, an array of options.
* The options can also be async, a promise that returns
* an array of options.
*/
options: OptionsType | OptionsPagePromise;
/**
* It defines how many results should be included
* in the query response.
* Works in async mode only (See the options property).
*/
pageSize?: number;
/**
* It shows a stop-outlined icon at the far right of a selected
* option instead of the default checkmark.
* Useful to better indicate to the user that by clicking on a selected
* option it will be de-selected.
* False by default.
*/
invertSelection?: boolean;
/**
* It fires a request against the server only after
* searching.
* Works in async mode only (See the options property).
* Undefined by default.
*/
fetchOnlyOnSearch?: boolean;
/**
* It provides a callback function when an error
* is generated after a request is fired.
* Works in async mode only (See the options property).
*/
onError?: (error: string) => void;
sortComparator?: (a: AntdLabeledValue, b: AntdLabeledValue) => number;
}
Expand Down Expand Up @@ -193,6 +256,20 @@ export const propertyComparator = (property: string) => (
return (a[property] as number) - (b[property] as number);
};

/**
* This component is a customized version of the Antdesign 4.X Select component
* https://ant.design/components/select/.
* The aim of the component was to combine all the instances of select components throughout the
* project under one and to remove the react-select component entirely.
* This Select component provides an API that is tested against all the different use cases of Superset.
* It limits and overrides the existing Antdesign API in order to keep their usage to the minimum
* and to enforce simplification and standardization.
* It is divided into two macro categories, Static and Async.
* The Static type accepts a static array of options.
* The Async type accepts a promise that will return the options.
* Each of the categories come with different abilities. For a comprehensive guide please refer to
* the storybook in src/components/Select/Select.stories.tsx.
*/
const Select = ({
allowNewOptions = false,
ariaLabel,
Expand Down
Loading

0 comments on commit 7594453

Please sign in to comment.