Liferay.Loader.define("segments-web@3.0.68/js/components/criteria_sidebar/CriteriaSidebarCollapse.es",["module","exports","require","@frontend-taglib-clay$clayui/badge","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","segments-web$date-fns","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../utils/constants.es","../../utils/types.es","../../utils/utils.es","./CriteriaSidebarItem.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=d(a("@frontend-taglib-clay$clayui/badge")),s=d(a("@frontend-taglib-clay$clayui/icon")),r=d(a("liferay!frontend-js-react-web$classnames")),n=d(a("segments-web$date-fns")),o=(d(a("liferay!frontend-js-react-web$prop-types")),d(a("liferay!frontend-js-react-web$react"))),i=a("../../utils/constants.es"),c=(a("../../utils/types.es"),a("../../utils/utils.es")),u=d(a("./CriteriaSidebarItem.es"));function d(e){return e&&e.__esModule?e:{default:e}}const e="YYYY-MM-DD";var f=({onCollapseClick:t,propertyGroups:a,propertyKey:d,searchValue:f})=>{const p=(e,a)=>()=>t(e,a);return o.default.createElement("ul",{className:"sidebar-collapse-groups"},a.map((t=>{const a=t.propertyKey,y=a===d,m=t?t.properties:[],E=f?function(e,t){return e.filter((e=>-1!==e.label.toLowerCase().indexOf(t.toLowerCase())))}(m,f):m,b=(0,r.default)({active:y}),g=(0,r.default)("sidebar-collapse-item","sidebar-collapse-".concat(t.propertyKey),b);return o.default.createElement("li",{className:g,key:a},o.default.createElement("a",{className:"sidebar-collapse-header",onClick:p(a,y)},t.name,f&&o.default.createElement(l.default,{displayType:"secondary",label:E.length}),o.default.createElement("span",null,o.default.createElement(s.default,{className:b,symbol:"angle-right"}))),y&&o.default.createElement("div",{className:"flex-grow-1 sidebar-collapse-body"},o.default.createElement("p",{className:"pt-3 px-4 text-secondary"},Liferay.Language.get("inherited-attributes-are-not-taken-into-account-to-include-members-in-segments")),o.default.createElement("ul",{className:"pl-0"},!E.length&&o.default.createElement("li",{className:"empty-message"},Liferay.Language.get("no-results-were-found")),!!E.length&&E.map((({label:t,name:l,options:s,type:r})=>{const d=function(t){const{options:a,type:l}=t;let s="";if(l===i.PROPERTY_TYPES.STRING&&a&&a.length)s=a[0].value;else if(l===i.PROPERTY_TYPES.DATE)s=(0,c.jsDatetoYYYYMMDD)(new Date);else if(l===i.PROPERTY_TYPES.DATE_TIME){const t=(0,c.jsDatetoYYYYMMDD)(new Date);s=n.default.parse(t,e).toISOString()}else l===i.PROPERTY_TYPES.BOOLEAN?s="true":l===i.PROPERTY_TYPES.INTEGER&&a&&a.length?s=a[0].value:l===i.PROPERTY_TYPES.INTEGER?s=0:l===i.PROPERTY_TYPES.DOUBLE&&a&&a.length?s=a[0].value:l===i.PROPERTY_TYPES.DOUBLE&&(s="0.00");return s}({label:t,name:l,options:s,type:r});return o.default.createElement(u.default,{className:"color--".concat(a),defaultValue:d,key:l,label:t,name:l,propertyKey:a,type:r})})))))})))};t.default=f}}));
//# sourceMappingURL=CriteriaSidebarCollapse.es.js.map