Liferay.Loader.define("@liferay/object-web@1.0.153/js/components/ObjectField/Tabs/Advanced/ReadOnlyContainer",["module","exports","require","@frontend-taglib-clay$clayui/form","@liferay/object-js-components-web","liferay!frontend-js-react-web$react"],(function(e,a,l){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.ReadOnlyContainer=function ReadOnlyContainer({disabled:e,objectFieldSettings:a,requiredField:l,setValues:r}){var o;const d=findObjectFieldSetting(a,"readOnly"),u=findObjectFieldSetting(a,"readOnlyScript"),setReadOnly=e=>{r({objectFieldSettings:[...null==a?void 0:a.filter((e=>"readOnly"!==e.name&&"readOnlyScript"!==e.name)),{name:"readOnly",value:e}],required:"true"!==e&&"conditional"!==e&&l})};return i.default.createElement(t.Card,{disabled:e,title:Liferay.Language.get("read-only")},i.default.createElement(n.ClayRadioGroup,{defaultValue:null==d?void 0:d.value},i.default.createElement(n.ClayRadio,{disabled:e,label:Liferay.Language.get("true"),onClick:()=>setReadOnly("true"),value:"true"}),i.default.createElement(n.ClayRadio,{disabled:e,label:Liferay.Language.get("false"),onClick:()=>setReadOnly("false"),value:"false"}),i.default.createElement(n.ClayRadio,{disabled:e,label:Liferay.Language.get("conditional"),onClick:()=>setReadOnly("conditional"),value:"conditional"})),"conditional"===(null==d?void 0:d.value)&&i.default.createElement(t.ExpressionBuilder,{feedbackMessage:Liferay.Language.get("use-expressions-to-create-a-condition"),label:Liferay.Language.get("expression-builder"),onChange:({target:{value:e}})=>{r({objectFieldSettings:updateReadOnlyScriptSetting(a,e)})},onOpenModal:()=>{var e;Liferay.Util.getOpener().Liferay.fire("openExpressionBuilderModal",{header:Liferay.Language.get("expression-builder"),onSave:e=>{r({objectFieldSettings:updateReadOnlyScriptSetting(a,e)})},placeholder:"<#-- ".concat(Liferay.Language.get("create-the-condition-of-the-read-only-state-using-expression-builder")," --\x3e"),required:!1,source:null!==(e=null==u?void 0:u.value)&&void 0!==e?e:"",validateExpressionURL:""})},placeholder:Liferay.Language.get("create-an-expression"),value:null!==(o=null==u?void 0:u.value)&&void 0!==o?o:""}))};var n=l("@frontend-taglib-clay$clayui/form"),t=l("@liferay/object-js-components-web"),i=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(l("liferay!frontend-js-react-web$react"));const updateReadOnlyScriptSetting=(e,a)=>[...null==e?void 0:e.filter((e=>"readOnlyScript"!==e.name)),{name:"readOnlyScript",value:a}],findObjectFieldSetting=(e,a)=>null==e?void 0:e.find((e=>e.name===a))}}));
//# sourceMappingURL=ReadOnlyContainer.js.map