|
1 | 1 | import { createElement, ReactElement } from "react";
|
2 | 2 | import { withPreloader } from "@mendix/widget-plugin-platform/hoc/withPreloader";
|
3 | 3 | import { DatagridDropdownFilterContainerProps } from "../typings/DatagridDropdownFilterProps";
|
4 |
| -import { StaticFilterContainer } from "./components/StaticFilterContainer"; |
5 |
| -import { withSelectFilterAPI, Select_FilterAPIv2 } from "./hocs/withSelectFilterAPI"; |
6 |
| -import { RefFilterContainer } from "./components/RefFilterContainer"; |
7 |
| - |
8 |
| -function Container(props: DatagridDropdownFilterContainerProps & Select_FilterAPIv2): React.ReactElement { |
9 |
| - const commonProps = { |
10 |
| - ariaLabel: props.ariaLabel?.value, |
11 |
| - className: props.class, |
12 |
| - tabIndex: props.tabIndex, |
13 |
| - styles: props.style, |
14 |
| - onChange: props.onChange, |
15 |
| - valueAttribute: props.valueAttribute, |
16 |
| - parentChannelName: props.parentChannelName, |
17 |
| - name: props.name, |
18 |
| - multiselect: props.multiSelect, |
19 |
| - emptyCaption: props.emptyOptionCaption?.value, |
20 |
| - defaultValue: props.defaultValue?.value, |
21 |
| - filterable: props.filterable, |
22 |
| - selectionMethod: props.selectionMethod, |
23 |
| - selectedItemsStyle: props.selectedItemsStyle, |
24 |
| - clearable: props.clearable |
25 |
| - }; |
26 |
| - |
27 |
| - if (props.filterStore.storeType === "refselect") { |
28 |
| - return <RefFilterContainer {...commonProps} filterStore={props.filterStore} />; |
29 |
| - } |
| 4 | +import { AttrFilter } from "./components/AttrFilter"; |
30 | 5 |
|
31 |
| - return ( |
32 |
| - <StaticFilterContainer {...commonProps} filterStore={props.filterStore} filterOptions={props.filterOptions} /> |
33 |
| - ); |
34 |
| -} |
| 6 | +// function Container(props: DatagridDropdownFilterContainerProps & Select_FilterAPIv2): React.ReactElement { |
| 7 | +// const commonProps = { |
| 8 | +// ariaLabel: props.ariaLabel?.value, |
| 9 | +// className: props.class, |
| 10 | +// tabIndex: props.tabIndex, |
| 11 | +// styles: props.style, |
| 12 | +// onChange: props.onChange, |
| 13 | +// valueAttribute: props.valueAttribute, |
| 14 | +// parentChannelName: props.parentChannelName, |
| 15 | +// name: props.name, |
| 16 | +// multiselect: props.multiSelect, |
| 17 | +// emptyCaption: props.emptyOptionCaption?.value, |
| 18 | +// defaultValue: props.defaultValue?.value, |
| 19 | +// filterable: props.filterable, |
| 20 | +// selectionMethod: props.selectionMethod, |
| 21 | +// selectedItemsStyle: props.selectedItemsStyle, |
| 22 | +// clearable: props.clearable |
| 23 | +// }; |
| 24 | + |
| 25 | +// if (props.filterStore.storeType === "refselect") { |
| 26 | +// return <RefFilterContainer {...commonProps} filterStore={props.filterStore} />; |
| 27 | +// } |
| 28 | + |
| 29 | +// return ( |
| 30 | +// <StaticFilterContainer {...commonProps} filterStore={props.filterStore} filterOptions={props.filterOptions} /> |
| 31 | +// ); |
| 32 | +// } |
35 | 33 |
|
36 |
| -const container = withPreloader(Container, props => props.defaultValue?.status === "loading"); |
| 34 | +const DatagridDropdownFilter = withPreloader(Container, props => props.defaultValue?.status === "loading"); |
37 | 35 |
|
38 |
| -const Widget = withSelectFilterAPI(container); |
| 36 | +export default DatagridDropdownFilter; |
| 37 | + |
| 38 | +function Container(props: DatagridDropdownFilterContainerProps): ReactElement { |
| 39 | + if (props.baseType === "attr") { |
| 40 | + return <AttrFilter {...props} />; |
| 41 | + } |
| 42 | + |
| 43 | + return <RefFilter {...props} />; |
| 44 | +} |
39 | 45 |
|
40 |
| -export default function DatagridDropdownFilter(props: DatagridDropdownFilterContainerProps): ReactElement { |
41 |
| - return <Widget {...props} />; |
| 46 | +function RefFilter(props: DatagridDropdownFilterContainerProps): ReactElement { |
| 47 | + return <div key={props.name} />; |
42 | 48 | }
|
0 commit comments