Liferay.Loader.define("@liferay/frontend-data-set-web@1.0.31/management_bar/components/filters/Filter",["module","exports","require","@frontend-taglib-clay$clayui/loading-indicator","liferay!frontend-js-react-web$react","../../../FrontendDataSetContext","../../../utils/modules","./AutocompleteFilter","./CheckboxesFilter","./DateRangeFilter","./RadioFilter"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.getOdataFilterString=t.getFilterSelectedItemsLabel=void 0;var n=p(r("@frontend-taglib-clay$clayui/loading-indicator")),a=s(r("liferay!frontend-js-react-web$react")),o=p(r("../../../FrontendDataSetContext")),l=r("../../../utils/modules"),i=s(r("./AutocompleteFilter")),c=s(r("./CheckboxesFilter")),u=s(r("./DateRangeFilter")),f=s(r("./RadioFilter"));function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function s(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}return r.default=e,t&&t.set(e,r),r}function p(e){return e&&e.__esModule?e:{default:e}}function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}const e={autocomplete:i.default,checkbox:c.default,dateRange:u.default,radio:f.default},w=e=>{switch(e.type){case"autocomplete":return(0,i.getSelectedItemsLabel)(e);case"checkbox":return(0,c.getSelectedItemsLabel)(e);case"dateRange":return(0,u.getSelectedItemsLabel)(e);case"radio":return(0,f.getSelectedItemsLabel)(e);default:return""}};t.getFilterSelectedItemsLabel=w;const v=e=>{switch(e.type){case"autocomplete":return(0,i.getOdataString)(e);case"checkbox":return(0,c.getOdataString)(e);case"dateRange":return(0,u.getOdataString)(e);case"radio":return(0,f.getOdataString)(e);default:return""}};t.getOdataFilterString=v;var j=t=>{let{moduleURL:r,type:i}=t,c=m(t,["moduleURL","type"]);const{setFilters:u}=(0,a.useContext)(o.default),[f,d]=(0,a.useState)((()=>{if(r)return null;{const t=e[i];if(!t)throw new Error("Filter type '".concat(i,"' not found."));return t}}));return(0,a.useEffect)((()=>{r&&(0,l.getComponentByModuleURL)(r).then((e=>d((()=>e))))}),[r]),f?a.default.createElement("div",{className:"data-set-filter"},a.default.createElement(f,b({setFilter:e=>{let{id:t}=e,r=m(e,["id"]);u((e=>e.map((e=>y(y({},e),e.id===t?y({},r):{})))))}},c))):a.default.createElement(n.default,{small:!0})};t.default=j}}));
//# sourceMappingURL=Filter.js.map