Liferay.Loader.define("segments-web@3.0.77/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=_interopRequireDefault(a("@frontend-taglib-clay$clayui/badge")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),n=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),s=_interopRequireDefault(a("segments-web$date-fns")),i=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(a("liferay!frontend-js-react-web$react"))),o=a("../../utils/constants.es"),u=(a("../../utils/types.es"),a("../../utils/utils.es")),c=_interopRequireDefault(a("./CriteriaSidebarItem.es"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const e="YYYY-MM-DD";var _default=({onCollapseClick:t,propertyGroups:a,propertyKey:f,searchValue:d})=>{const _handleClick=(e,a)=>()=>t(e,a);return i.default.createElement("ul",{className:"sidebar-collapse-groups"},a.map((t=>{const a=t.propertyKey,p=a===f,y=t?t.properties:[],m=d?function filterProperties(e,t){return e.filter((e=>-1!==e.label.toLowerCase().indexOf(t.toLowerCase())))}(y,d):y,E=(0,n.default)({active:p}),b=(0,n.default)("sidebar-collapse-item","sidebar-collapse-".concat(t.propertyKey),E);return i.default.createElement("li",{className:b,key:a},i.default.createElement("a",{className:"sidebar-collapse-header",onClick:_handleClick(a,p),tabIndex:"0"},t.name,d&&i.default.createElement(l.default,{displayType:"secondary",label:m.length}),i.default.createElement("span",null,i.default.createElement(r.default,{className:E,symbol:"angle-right"}))),p&&i.default.createElement("div",{className:"flex-grow-1 sidebar-collapse-body"},i.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")),i.default.createElement("ul",{className:"pl-0"},!m.length&&i.default.createElement("li",{className:"empty-message"},Liferay.Language.get("no-results-were-found")),!!m.length&&m.map((({label:t,name:l,options:r,type:n})=>{const f=function getDefaultValue(t){const{options:a,type:l}=t;let r="";if(l===o.PROPERTY_TYPES.STRING&&a&&a.length)r=a[0].value;else if(l===o.PROPERTY_TYPES.DATE)r=(0,u.jsDatetoYYYYMMDD)(new Date);else if(l===o.PROPERTY_TYPES.DATE_TIME){const t=(0,u.jsDatetoYYYYMMDD)(new Date);r=s.default.parse(t,e).toISOString()}else l===o.PROPERTY_TYPES.BOOLEAN?r="true":l===o.PROPERTY_TYPES.INTEGER&&a&&a.length?r=a[0].value:l===o.PROPERTY_TYPES.INTEGER?r=0:l===o.PROPERTY_TYPES.DOUBLE&&a&&a.length?r=a[0].value:l===o.PROPERTY_TYPES.DOUBLE&&(r="0.00");return r}({label:t,name:l,options:r,type:n});return i.default.createElement(c.default,{className:"color--".concat(a),defaultValue:f,key:l,label:t,name:l,propertyKey:a,type:n})})))))})))};t.default=_default}}));
//# sourceMappingURL=CriteriaSidebarCollapse.es.js.map