Liferay.Loader.define("data-engine-taglib@3.3.26/data_layout_builder/js/components/rules/RuleItem",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/label","@frontend-taglib-clay$clayui/panel","liferay!frontend-js-react-web$classnames","data-engine-js-components-web","liferay!frontend-js-react-web$react","../../utils/dataDefinition.es","../../utils/lang.es","../drop-down/DropDown.es"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.default=function({loc:a,onDeleteRule:t,onEditRule:r,rule:g}){const{actions:p,conditions:m,logicalOperator:L,name:b}=g,{dataDefinition:w}=(0,o.useFormState)({schema:["dataDefinition"]}),E=(0,s.getLocalizedValue)(w.defaultLanguageId,b),D=[{action:()=>r(a),name:Liferay.Language.get("edit")},{action:()=>{confirm(Liferay.Language.get("are-you-sure-you-want-to-delete-this"))&&t(a)},name:Liferay.Language.get("delete")}];return u.default.createElement("div",{className:"rule-list__panel"},u.default.createElement(i.default,{className:"collapsable-panel panel-unstyled",collapsable:!0,collapseClassNames:"panel-body",displayTitle:E,displayType:"secondary"},u.default.createElement(l.default,{displayType:"unstyled",onClick:()=>r(a)},u.default.createElement(y,{capitalize:!0},Liferay.Language.get("if")),m.map((({operands:e,operator:a},t)=>{const[l,i]=e,r=null==i?void 0:i.value;return u.default.createElement(u.default.Fragment,{key:t},u.default.createElement(y,{lowercase:!0},Liferay.Language.get("field")),u.default.createElement(n.default,{displayType:"success"},(0,d.getFieldLabel)(w,l.value)),u.default.createElement(n.default,{displayType:"secondary"},f[a]||a),r&&u.default.createElement(n.default,{displayType:"info"},(()=>{if((0,d.getDataDefinitionField)(w,r))return(0,d.getFieldLabel)(w,r);const e=(0,d.getDataDefinitionField)(w,l.value);if(e){var a;return(0,d.getOptionLabel)(null===(a=e.customProperties)||void 0===a?void 0:a.options,r,w.defaultLanguageId)||r}return r})()),t+1!==m.length&&u.default.createElement(n.default,{displayType:"warning"},L))})),p.map((({action:a,expression:t,target:l},i)=>u.default.createElement(u.default.Fragment,{key:i},u.default.createElement(y,{lowercase:!0},e[a]||a),t&&u.default.createElement(u.default.Fragment,null,u.default.createElement(n.default,{displayType:"secondary"},(e=>((0,d.forEachDataDefinitionField)(w,(({name:a})=>{e=e.replace(new RegExp("\\[".concat(a,"\\]"),"g"),(0,d.getFieldLabel)(w,a))})),e))(t)),u.default.createElement(y,{lowercase:!0},Liferay.Language.get("into"))),u.default.createElement(n.default,{displayType:"success"},(0,d.getFieldLabel)(w,l)),i+1!==p.length&&u.default.createElement(n.default,{displayType:"warning"},Liferay.Language.get("and"))))))),u.default.createElement(c.default,{actions:D,className:"rule-list__options"}))};var l=g(t("@frontend-taglib-clay$clayui/button")),n=g(t("@frontend-taglib-clay$clayui/label")),i=g(t("@frontend-taglib-clay$clayui/panel")),r=g(t("liferay!frontend-js-react-web$classnames")),o=t("data-engine-js-components-web"),u=g(t("liferay!frontend-js-react-web$react")),d=t("../../utils/dataDefinition.es"),s=t("../../utils/lang.es"),c=g(t("../drop-down/DropDown.es"));function g(e){return e&&e.__esModule?e:{default:e}}const e={autofill:Liferay.Language.get("autofill"),calculate:Liferay.Language.get("calculate"),enable:Liferay.Language.get("enable"),require:Liferay.Language.get("require"),show:Liferay.Language.get("show")},f={"belongs-to":Liferay.Language.get("belongs-to"),contains:Liferay.Language.get("contains"),"does-not-contain":Liferay.Language.get("does-not-contain"),"equals-to":Liferay.Language.get("equals-to"),"is-empty":Liferay.Language.get("is-empty"),"not-equals-to":Liferay.Language.get("not-equals-to"),"not-is-empty":Liferay.Language.get("not-is-empty")},y=({capitalize:e=!1,children:a="",lowercase:t=!1})=>u.default.createElement("span",{className:(0,r.default)("pr-1",{"text-capitalize":e,"text-lowercase":t})},a)}}));
//# sourceMappingURL=RuleItem.js.map