Skip to content

Commit

Permalink
Merge pull request #1553 from finos/filter-typeahead
Browse files Browse the repository at this point in the history
ensure when columnDescriptors have labels, filter
  • Loading branch information
heswell authored Dec 4, 2024
2 parents aac1906 + 58d3808 commit 4236412
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export const ColumnPicker = forwardRef(function ColumnPicker(
name.toLowerCase().includes(comboProps.value.toLowerCase()),
)
.map(({ name, label = name }) => (
<Option value={label} key={name} />
<Option value={name} key={name}>
{label}
</Option>
))}
</ExpandoCombobox>
);
Expand Down
3 changes: 3 additions & 0 deletions vuu-ui/packages/vuu-theme/css/components/split-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
border-radius: var(--trigger-border-radius);
}

&.vuuFocusVisible {
--vuuButton-borderColor: transparent;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import {
useRef,
useState,
} from "react";
import type { DataSourceFilter } from "@finos/vuu-data-types";
import type { DataSourceFilter, SchemaColumn } from "@finos/vuu-data-types";
import { Input, ToggleButton, ToggleButtonGroup } from "@salt-ds/core";
import { LocalDataSourceProvider, getSchema } from "@finos/vuu-data-test";
import { ColumnDescriptor } from "@finos/vuu-table-types";

const lastUpdatedColumn = {
name: "lastUpdated",
Expand Down Expand Up @@ -51,6 +52,7 @@ const FilterContainer = ({

const DefaultFilterBarCore = ({
QuickFilterProps,
columnDescriptors,
filterState,
onApplyFilter,
onFilterDeleted,
Expand All @@ -61,8 +63,8 @@ const DefaultFilterBarCore = ({
const [filterStruct, setFilterStruct] = useState<Filter | null>(null);
const tableSchema = useMemo(() => getSchema("instruments"), []);
const columns = useMemo(
() => [...tableSchema.columns, lastUpdatedColumn],
[tableSchema],
() => columnDescriptors ?? [...tableSchema.columns, lastUpdatedColumn],
[columnDescriptors, tableSchema.columns],
);

const handleApplyFilter = useCallback(
Expand Down Expand Up @@ -105,7 +107,7 @@ const DefaultFilterBarCore = ({
onFilterDeleted={handleFilterDeleted}
onFilterRenamed={handleFilterRenamed}
onFilterStateChanged={handleFilterStateChange}
tableSchema={{ ...tableSchema, columns }}
tableSchema={{ ...tableSchema, columns: columns as SchemaColumn[] }}
variant={variant}
/>
</FilterContainer>
Expand Down Expand Up @@ -160,6 +162,30 @@ export const DefaultFilterBar = (props: Partial<FilterBarProps>) => (
</LocalDataSourceProvider>
);

export const DefaultFilterBarColumnLabels = (
props: Partial<FilterBarProps>,
) => {
const columnDescriptors: ColumnDescriptor[] = [
{ label: "BBG", name: "bbg", serverDataType: "string" },
{ label: "Currency", name: "currency", serverDataType: "string" },
{ label: "Description", name: "description", serverDataType: "string" },
{ label: "Exchange", name: "exchange", serverDataType: "string" },
{ label: "ISIN", name: "isin", serverDataType: "string" },
{ label: "Lot size", name: "lotSize", serverDataType: "int" },
{ label: "RIC", name: "ric", serverDataType: "string" },
{ label: "Supported", name: "supported", serverDataType: "boolean" },
{ label: "Wish list", name: "wishlist", serverDataType: "boolean" },
{ label: "Last Updated", name: "lastUpdated", serverDataType: "long" },
{ label: "Price", name: "price", serverDataType: "double" },
{ label: "Date", name: "date", serverDataType: "long" },
];
return (
<LocalDataSourceProvider modules={["SIMUL"]}>
<FilterBarTemplate {...props} columnDescriptors={columnDescriptors} />
</LocalDataSourceProvider>
);
};

export const FilterBarOneSimpleFilter = () => {
return (
<LocalDataSourceProvider modules={["SIMUL"]}>
Expand Down

0 comments on commit 4236412

Please sign in to comment.