{"size": 1188, "ext": "js", "max_stars_repo_path": "web/client/components/data/featuregrid/filterRenderers/index.js", "max_stars_repo_name": "msrecec/infokarta-backend-spring", "max_stars_repo_stars_event_min_datetime": "2015-08-07T18:07:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T13:41:23.000Z", "max_issues_repo_path": "web/client/components/data/featuregrid/filterRenderers/index.js", "max_issues_repo_name": "msrecec/infokarta-backend-spring", "max_issues_repo_issues_event_min_datetime": "2015-07-27T15:28:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T11:05:12.000Z", "max_forks_repo_path": "web/client/components/data/featuregrid/filterRenderers/index.js", "max_forks_repo_name": "msrecec/infokarta-backend-spring", "max_forks_repo_forks_event_min_datetime": "2015-07-28T09:36:34.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-26T02:41:05.000Z"}
{"max_stars_count": 349, "max_issues_count": 7114, "max_forks_count": 335, "avg_line_length": 31.2631578947, "max_line_length": 124, "alphanum_fraction": 0.6599326599}
/**
  * Copyright 2017, GeoSolutions Sas.
  * All rights reserved.
  *
  * This source code is licensed under the BSD-style license found in the
  * LICENSE file in the root directory of this source tree.
  */

import { withProps } from 'recompose';

import DateTimeFilter from './DateTimeFilter';
import DefaultFilter from './DefaultFilter';
import GeometryFilter from './GeometryFilter';
import NumberFilter from './NumberFilter';
import StringFilter from './StringFilter';

const types = {
    "defaultFilter": (type) => withProps(() =>({type: type}))(DefaultFilter),
    "string": () => StringFilter,
    "number": () => NumberFilter,
    "int": () => NumberFilter,
    "date": () => withProps(() =>({type: "date"}))(DateTimeFilter),
    "time": () => withProps(() =>({type: "time"}))(DateTimeFilter),
    "date-time": () => withProps(() =>({type: "date-time"}))(DateTimeFilter),
    "geometry": () => GeometryFilter
};

export const getFilterRenderer = (type, props) => types[type] ? types[type](type, props) : types.defaultFilter(type, props);

export default {
    getFilterRenderer,
    DefaultFilter,
    StringFilter,
    NumberFilter,
    DateTimeFilter,
    GeometryFilter
};
