Liferay.Loader.define("@liferay/frontend-data-set-web@1.0.31/management_bar/components/filters/RadioFilter",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.getOdataString=t.getSelectedItemsLabel=void 0;var l=u(a("@frontend-taglib-clay$clayui/button")),n=u(a("@frontend-taglib-clay$clayui/drop-down")),r=a("@frontend-taglib-clay$clayui/form"),d=(u(a("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")));function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}function u(e){return e&&e.__esModule?e:{default:e}}const e=({items:e,selectedData:t})=>{const{exclude:a,itemValue:l}=t;return(a?"(".concat(Liferay.Language.get("exclude"),") "):"")+e.find((e=>e.value===l)).label};t.getSelectedItemsLabel=e;const o=({id:e,selectedData:t})=>{const{exclude:a,itemValue:l}=t;return"".concat(e," ").concat(a?"ne":"eq"," ").concat("string"==typeof l?"'".concat(l,"'"):l)};t.getOdataString=o;var i=function({id:t,items:a,selectedData:c,setFilter:u}){const[i,f]=(0,d.useState)(null==c?void 0:c.itemValue),[s,m]=(0,d.useState)(!!(null==c?void 0:c.exclude)),g=c?"edit":"add";let y=!0;return(!c&&void 0!==i||c&&c.itemValue!==i||c&&void 0!==i&&c.exclude!==s)&&(y=!1),d.default.createElement(d.default.Fragment,null,d.default.createElement(n.default.Caption,{className:"pb-0"},d.default.createElement("div",{className:"row"},d.default.createElement("div",{className:"col"},d.default.createElement("label",{htmlFor:"autocomplete-exclude-".concat(t)},Liferay.Language.get("exclude"))),d.default.createElement("div",{className:"col-auto"},d.default.createElement(r.ClayToggle,{id:"autocomplete-exclude-".concat(t),onToggle:()=>m(!s),toggled:s})))),d.default.createElement(n.default.Divider,null),d.default.createElement(n.default.Caption,null,d.default.createElement("div",{className:"inline-scroller mb-n2 mx-n2 px-2"},d.default.createElement(r.ClayRadioGroup,{onChange:f,value:null!=i?i:""},a.map((e=>d.default.createElement(r.ClayRadio,{key:e.value,label:e.label,value:e.value})))))),d.default.createElement(n.default.Divider,null),d.default.createElement(n.default.Caption,null,d.default.createElement(l.default,{disabled:y,onClick:()=>{if("delete"===g)u({active:!1,id:t});else{const l={exclude:s,itemValue:i};u({id:t,odataFilterString:o({id:t,selectedData:l}),selectedData:l,selectedItemsLabel:e({items:a,selectedData:l})})}},small:!0},"add"===g&&Liferay.Language.get("add-filter"),"edit"===g&&Liferay.Language.get("edit-filter"))))};t.default=i}}));
//# sourceMappingURL=RadioFilter.js.map