@@ -17,10 +17,16 @@ import CodeIcon from "components/img/CodeIcon";
1717import RelationBidirectionalIcon from "components/img/RelationBidirectionalIcon" ;
1818import RollupIcon from "components/img/RollupIcon" ;
1919import { AddColumnModal } from "components/modals/newColumn/addColumnModal" ;
20+ import {
21+ BaseFilter ,
22+ BooleanFilter ,
23+ DateRangeFilter ,
24+ NumberFilter ,
25+ TextFilter ,
26+ } from "components/reducers/ColumnFilters" ;
2027import { InputType , MetadataColumns } from "helpers/Constants" ;
2128import { LOGGER } from "services/Logger" ;
2229import { DatabaseHeaderProps , TableColumn } from "cdm/FolderModel" ;
23- import ReactDOM from "react-dom" ;
2430import { c } from "helpers/StylesHelper" ;
2531import { AddColumnModalProps } from "cdm/ModalsModel" ;
2632
@@ -40,6 +46,10 @@ export default function DefaultHeader(headerProps: DatabaseHeaderProps) {
4046 state . actions ,
4147 ] ) ;
4248
49+ const areColumnsFilterable = tableState . configState (
50+ ( state ) => state . ephimeral . enable_columns_filter
51+ ) ;
52+
4353 const configInfo = tableState . configState ( ( state ) => state . info ) ;
4454
4555 /** Column values */
@@ -50,9 +60,11 @@ export default function DefaultHeader(headerProps: DatabaseHeaderProps) {
5060 const [ labelState , setLabelState ] = useState ( label ) ;
5161
5262 let propertyIcon : JSX . Element ;
63+ let columnSearch = < TextFilter { ...headerProps } /> ;
5364 switch ( input ) {
5465 case InputType . NUMBER :
5566 propertyIcon = < HashIcon /> ;
67+ columnSearch = < NumberFilter { ...headerProps } /> ;
5668 break ;
5769 case InputType . TEXT :
5870 propertyIcon = < TextIcon /> ;
@@ -62,38 +74,48 @@ export default function DefaultHeader(headerProps: DatabaseHeaderProps) {
6274 break ;
6375 case InputType . CALENDAR :
6476 propertyIcon = < CalendarIcon /> ;
77+ columnSearch = < DateRangeFilter { ...headerProps } /> ;
6578 break ;
6679 case InputType . CALENDAR_TIME :
6780 case InputType . METATADA_TIME :
6881 propertyIcon = < CalendarTimeIcon /> ;
82+ columnSearch = < DateRangeFilter { ...headerProps } /> ;
6983 break ;
7084 case InputType . MARKDOWN :
7185 propertyIcon = < MarkdownObsidian /> ;
86+ columnSearch = < BaseFilter { ...headerProps } /> ;
7287 break ;
7388 case InputType . TAGS :
7489 propertyIcon = < TagsIcon /> ;
7590 break ;
7691 case InputType . INLINKS :
7792 propertyIcon = < IncomingLinkIcon /> ;
93+ columnSearch = < BaseFilter { ...headerProps } /> ;
7894 break ;
7995 case InputType . OUTLINKS :
8096 propertyIcon = < OutlinkIcon /> ;
97+ columnSearch = < BaseFilter { ...headerProps } /> ;
8198 break ;
8299 case InputType . TASK :
100+ propertyIcon = < TaskIcon /> ;
101+ columnSearch = < BaseFilter { ...headerProps } /> ;
102+ break ;
83103 case InputType . CHECKBOX :
84104 propertyIcon = < TaskIcon /> ;
105+ columnSearch = < BooleanFilter { ...headerProps } /> ;
85106 break ;
86107 case InputType . FORMULA :
87108 propertyIcon = < CodeIcon /> ;
88109 break ;
89110 case InputType . RELATION :
90111 propertyIcon = < RelationBidirectionalIcon /> ;
112+ columnSearch = < BaseFilter { ...headerProps } /> ;
91113 break ;
92114 case InputType . ROLLUP :
93115 propertyIcon = < RollupIcon /> ;
94116 break ;
95117 default :
96- break ;
118+ // Do nothing
97119 }
98120
99121 function handlerAddColumnToLeft ( ) {
@@ -141,6 +163,9 @@ export default function DefaultHeader(headerProps: DatabaseHeaderProps) {
141163 </ span >
142164 ) }
143165 </ div >
166+ { /** Header Filter */ }
167+ { areColumnsFilterable && columnSearch }
168+ { /** Header Menu Popper */ }
144169 < HeaderMenu
145170 headerProps = { headerProps }
146171 propertyIcon = { propertyIcon }
0 commit comments