"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.buildCustomFieldFilterElement = void 0;
var _bexCore = require("@wix/bex-core");
var _react = _interopRequireDefault(require("react"));
var _DateCustomFieldFilter = require("./DateCustomFieldFilter");
var _DateTimeCustomFieldFilter = require("./DateTimeCustomFieldFilter");
var _CheckboxCustomFieldFilter = require("./CheckboxCustomFieldFilter");
var _NumberRangeFilter = require("../NumberRangeFilter");
var _OperatorFilterPicker = require("../OperatorFilterPicker");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CustomFieldFilters/buildCustomFieldFilterElement.tsx";
const buildCustomFieldFilterElement = (state, customField) => {
  const customFieldFilterComponents = {
    date: _DateCustomFieldFilter.DateCustomFieldFilter,
    dateTime: _DateTimeCustomFieldFilter.DateTimeCustomFieldFilter,
    checkbox: _CheckboxCustomFieldFilter.CheckboxCustomFieldFilter,
    integer: _NumberRangeFilter.NumberRangeFilter,
    decimal: ({
      filter
    }) => /*#__PURE__*/_react.default.createElement(_NumberRangeFilter.NumberRangeFilter, {
      filter: filter,
      decimal: true,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 27,
        columnNumber: 30
      }
    }),
    shortText: ({
      filter
    }) => /*#__PURE__*/_react.default.createElement(_OperatorFilterPicker.OperatorFilterPicker, {
      filter: filter,
      allowedOperators: _bexCore.STRING_OPERATORS,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 29,
        columnNumber: 7
      }
    }),
    url: ({
      filter
    }) => /*#__PURE__*/_react.default.createElement(_OperatorFilterPicker.OperatorFilterPicker, {
      filter: filter,
      allowedOperators: _bexCore.STRING_OPERATORS,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 35,
        columnNumber: 7
      }
    }),
    longText: ({
      filter
    }) => /*#__PURE__*/_react.default.createElement(_OperatorFilterPicker.OperatorFilterPicker, {
      filter: filter,
      allowedOperators: _bexCore.STRING_OPERATORS,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 41,
        columnNumber: 7
      }
    })
  };
  const CustomFieldFilterComponent = customFieldFilterComponents[customField.type];
  if (!CustomFieldFilterComponent) {
    return null;
  }
  const label = customField.label || customField.id;
  return /*#__PURE__*/_react.default.createElement(CustomFieldFilterComponent, {
    key: customField.id,
    filter: state.collection.filters[customField.id],
    accordionItemProps: {
      label
    },
    toolbarItemProps: {
      label
    },
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 58,
      columnNumber: 5
    }
  });
};
exports.buildCustomFieldFilterElement = buildCustomFieldFilterElement;
//# sourceMappingURL=buildCustomFieldFilterElement.js.map