Merge pull request #7205 from ainhoaL/deprecate-checkboxtree

Deprecate checkboxtree
This commit is contained in:
Fredrik Adelöw
2021-09-16 12:40:50 +02:00
committed by GitHub
5 changed files with 20 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-components': patch
---
Deprecated CheckboxTree component. Deprecated the filter type `'checkbox-tree'` from the `TableFilter` types.
+1 -1
View File
@@ -1889,7 +1889,7 @@ export interface TableColumn<T extends object = {}> extends Column<T> {
// @public (undocumented)
export type TableFilter = {
column: string;
type: 'select' | 'multiple-select' | 'checkbox-tree';
type: 'select' | 'multiple-select' | /** @deprecated */ 'checkbox-tree';
};
// Warning: (ae-missing-release-tag) "TableProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -225,6 +225,10 @@ const indexer = (
};
}, {});
/**
*
* @deprecated CheckboxTree is no longer used in Table filters
*/
export function CheckboxTree(props: CheckboxTreeProps) {
const { subCategories, label, selected, onChange, triggerReset } = props;
const classes = useStyles();
@@ -53,7 +53,7 @@ const useSubvalueCellStyles = makeStyles<BackstageTheme>(theme => ({
export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
export type Filter = {
type: 'select' | 'checkbox-tree' | 'multiple-select';
type: 'select' | /** @deprecated */ 'checkbox-tree' | 'multiple-select';
element:
| Without<CheckboxTreeProps, 'onChange'>
| Without<SelectProps, 'onChange'>;
@@ -191,7 +191,7 @@ export interface TableColumn<T extends object = {}> extends Column<T> {
export type TableFilter = {
column: string;
type: 'select' | 'multiple-select' | 'checkbox-tree';
type: 'select' | 'multiple-select' | /** @deprecated */ 'checkbox-tree';
};
export type TableState = {
@@ -365,6 +365,14 @@ export function Table<T extends object = {}>(props: TableProps<T>) {
setSelectedFiltersLength(selectedFiltersArray.flat().length);
}, [data, selectedFilters, getFieldByTitle]);
// Check for deprecated checkbox-tree filter
useEffect(() => {
if (filters?.some(filter => filter.type === 'checkbox-tree')) {
// eslint-disable-next-line no-console
console.warn('"checkbox-tree" filter type is deprecated');
}
}, [filters]);
const constructFilters = (
filterConfig: TableFilter[],
dataValue: any[] | undefined,