@databiosphere/findable-ui 37.0.0 → 37.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "37.0.0"
2
+ ".": "37.1.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [37.1.0](https://github.com/DataBiosphere/findable-ui/compare/v37.0.0...v37.1.0) (2025-06-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * hide global filtering search bar when global filters are disabled ([#547](https://github.com/DataBiosphere/findable-ui/issues/547)) ([#548](https://github.com/DataBiosphere/findable-ui/issues/548)) ([1a392ba](https://github.com/DataBiosphere/findable-ui/commit/1a392bac3707451404365989dc3187f59c181998))
9
+
3
10
  ## [37.0.0](https://github.com/DataBiosphere/findable-ui/compare/v36.0.0...v37.0.0) (2025-06-19)
4
11
 
5
12
 
@@ -1,4 +1,4 @@
1
1
  import { RowData } from "@tanstack/react-table";
2
2
  import { Attribute } from "../../../../../../common/entities";
3
3
  import { ColumnFiltersProps } from "./types";
4
- export declare const ColumnFilters: <T extends RowData = Attribute>({ table, }: ColumnFiltersProps<T>) => JSX.Element;
4
+ export declare const ColumnFilters: <T extends RowData = Attribute>({ table, }: ColumnFiltersProps<T>) => JSX.Element | null;
@@ -5,5 +5,8 @@ import { ColumnFilter } from "../../../../../Table/components/TableFeatures/Colu
5
5
  export const ColumnFilters = ({ table, }) => {
6
6
  const columns = table.getAllColumns();
7
7
  const columnFilters = columns.filter((column) => column.getCanFilter());
8
+ const enableColumnFilters = table.options.enableColumnFilters;
9
+ if (!enableColumnFilters)
10
+ return null;
8
11
  return (React.createElement(ButtonGroup, { ...BUTTON_GROUP_PROPS.SECONDARY_OUTLINED }, columnFilters.map((column) => (React.createElement(ColumnFilter, { key: column.id, column: column })))));
9
12
  };
@@ -30,6 +30,7 @@ const DefaultStory = () => {
30
30
  const table = {
31
31
  getAllColumns: () => [DESCRIPTION, REQUIRED, BIONETWORK, EXAMPLE].map(makeColumn),
32
32
  getState: () => ({ globalFilter }),
33
+ options: { enableColumnFilters: true, enableGlobalFilter: true },
33
34
  setGlobalFilter,
34
35
  };
35
36
  return React.createElement(Filters, { table: table });
@@ -1,3 +1,3 @@
1
1
  import { RowData } from "@tanstack/react-table";
2
2
  import { GlobalFilterProps } from "./types";
3
- export declare const GlobalFilter: <T extends RowData>({ className, table, ...props }: GlobalFilterProps<T>) => JSX.Element;
3
+ export declare const GlobalFilter: <T extends RowData>({ className, table, ...props }: GlobalFilterProps<T>) => JSX.Element | null;
@@ -4,7 +4,10 @@ import { SearchInputAdornment } from "../../../../common/OutlinedInput/component
4
4
  import { StyledOutlinedInput } from "../../../../common/OutlinedInput/outlinedInput.styles";
5
5
  import { OUTLINED_INPUT_PROPS } from "./constants";
6
6
  export const GlobalFilter = ({ className, table, ...props /* MuiOutlinedInputProps */ }) => {
7
- const { getState, setGlobalFilter } = table;
7
+ const { getState, options, setGlobalFilter } = table;
8
8
  const { globalFilter } = getState();
9
+ const { enableGlobalFilter } = options;
10
+ if (!enableGlobalFilter)
11
+ return null;
9
12
  return (React.createElement(StyledOutlinedInput, { ...OUTLINED_INPUT_PROPS, className: className, endAdornment: React.createElement(ClearInputAdornment, { in: !!globalFilter, onClick: () => setGlobalFilter(undefined) }), hasValue: !!globalFilter, onChange: (e) => setGlobalFilter(e.target.value), startAdornment: React.createElement(SearchInputAdornment, null), value: globalFilter ?? "", ...props }));
10
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "37.0.0",
3
+ "version": "37.1.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -8,9 +8,13 @@ import { ColumnFiltersProps } from "./types";
8
8
 
9
9
  export const ColumnFilters = <T extends RowData = Attribute>({
10
10
  table,
11
- }: ColumnFiltersProps<T>): JSX.Element => {
11
+ }: ColumnFiltersProps<T>): JSX.Element | null => {
12
12
  const columns = table.getAllColumns();
13
13
  const columnFilters = columns.filter((column) => column.getCanFilter());
14
+ const enableColumnFilters = table.options.enableColumnFilters;
15
+
16
+ if (!enableColumnFilters) return null;
17
+
14
18
  return (
15
19
  <ButtonGroup {...BUTTON_GROUP_PROPS.SECONDARY_OUTLINED}>
16
20
  {columnFilters.map((column) => (
@@ -43,6 +43,7 @@ const DefaultStory = (): JSX.Element => {
43
43
  getAllColumns: () =>
44
44
  [DESCRIPTION, REQUIRED, BIONETWORK, EXAMPLE].map(makeColumn),
45
45
  getState: () => ({ globalFilter }),
46
+ options: { enableColumnFilters: true, enableGlobalFilter: true },
46
47
  setGlobalFilter,
47
48
  } as Table<unknown>;
48
49
 
@@ -10,9 +10,13 @@ export const GlobalFilter = <T extends RowData>({
10
10
  className,
11
11
  table,
12
12
  ...props /* MuiOutlinedInputProps */
13
- }: GlobalFilterProps<T>): JSX.Element => {
14
- const { getState, setGlobalFilter } = table;
13
+ }: GlobalFilterProps<T>): JSX.Element | null => {
14
+ const { getState, options, setGlobalFilter } = table;
15
15
  const { globalFilter } = getState();
16
+ const { enableGlobalFilter } = options;
17
+
18
+ if (!enableGlobalFilter) return null;
19
+
16
20
  return (
17
21
  <StyledOutlinedInput
18
22
  {...OUTLINED_INPUT_PROPS}