Liferay.Loader.define("@liferay/object-web@1.0.181/js/components/ObjectDetails/useObjectDetailsForm",["module","exports","require","@liferay/object-js-components-web","../../utils/string"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.useObjectDetailsForm=function useObjectDetailsForm({initialValues:a,onSubmit:t}){const{errors:n,handleChange:r,handleSubmit:l,handleValidate:s,setValues:c,values:u}=(0,i.useForm)({initialValues:a,onSubmit:t,validate:a=>{const t={};return a.system||((0,i.invalidateLocalizableLabelRequired)(a.label)&&(t.label=e),(0,i.invalidateLocalizableLabelRequired)(a.pluralLabel)&&(t.pluralLabel=e)),a.accountEntryRestricted&&!a.accountEntryRestrictedObjectFieldName&&(t.accountEntryRestrictedObjectFieldName=Liferay.Language.get("if-activated-the-account-restriction-field-must-be-selected")),getNameErrors(t,a.name),t}});return{errors:n,handleChange:r,handleSubmit:l,handleValidate:s,setValues:c,values:u}};var i=t("@liferay/object-js-components-web"),n=t("../../utils/string");const e=Liferay.Language.get("required"),getNameErrors=(a,t)=>{(0,i.invalidateRequired)(t)?a.name=e:(0,n.specialCharactersInString)(t)?a.name=Liferay.Language.get("name-must-only-contain-letters-and-digits"):t.length>41?a.name=Liferay.Language.get("only-41-characters-are-allowed"):(0,n.checkIfFirstLetterIsUppercase)(t)||(a.name=Liferay.Language.get("the-first-character-of-a-name-must-be-an-upper-case-letter"))}}}));
//# sourceMappingURL=useObjectDetailsForm.js.map