Liferay.Loader.define("data-engine-js-components-web@1.0.75/js/custom/form/FormFieldSettings.es",["module","exports","require","liferay!frontend-js-react-web$react","../../core/actions/eventTypes.es","../../core/config/initialConfigState.es","../../core/config/initialState.es","../../core/hooks/useConfig.es","../../core/hooks/useForm.es","../../core/reducers/index.es","../../utils/parseProps.es","./eventTypes","./reducers/index.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.FormFieldSettings=b;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=p();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),o=r("../../core/actions/eventTypes.es"),i=r("../../core/config/initialConfigState.es"),c=r("../../core/config/initialState.es"),a=r("../../core/hooks/useConfig.es"),u=r("../../core/hooks/useForm.es"),s=r("../../core/reducers/index.es"),f=r("../../utils/parseProps.es"),l=r("./eventTypes"),d=r("./reducers/index.es");function p(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return p=function(){return e},e}function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){E(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}const e=({defaultLanguageId:e,editingLanguageId:t,focusedField:r,formBuilder:i,objectFields:c,pages:a,rules:s})=>{const f=(0,u.useForm)();return(0,n.useEffect)((()=>{f({payload:s,type:l.EVENT_TYPES.RULES.UPDATE})}),[f,s]),(0,n.useEffect)((()=>{f({payload:a,type:o.EVENT_TYPES.PAGE.UPDATE})}),[f,a]),(0,n.useEffect)((()=>{f({payload:{defaultLanguageId:e,editingLanguageId:t},type:o.EVENT_TYPES.LANGUAGE.CHANGE})}),[f,e,t]),(0,n.useEffect)((()=>{f({payload:{objectFields:c},type:l.EVENT_TYPES.OBJECT.FIELDS_CHANGE})}),[f,c]),(0,n.useEffect)((()=>{f({payload:{focusedField:r},type:l.EVENT_TYPES.FORM_BUILDER.FOCUSED_FIELD.CHANGE})}),[f,r]),(0,n.useEffect)((()=>{f({payload:i,type:l.EVENT_TYPES.FORM_BUILDER.PAGES.UPDATE})}),[f,i]),null};function b(t){let{children:r,onAction:o}=t,l=O(t,["children","onAction"]);const{config:p,state:g}=(0,f.parseProps)(l);return n.default.createElement(a.ConfigProvider,{config:p,initialConfig:i.INITIAL_CONFIG_STATE},n.default.createElement(u.FormProvider,{initialState:y(y({},c.INITIAL_STATE),{},{formBuilder:{focusedField:{},pages:[]}}),onAction:o,reducers:[s.activePageReducer,s.fieldReducer,d.formBuilderReducer,s.languageReducer,d.objectFieldsReducer,s.pagesStructureReducer,s.pageValidationReducer,d.paginationReducer,d.rulesReducer],value:g},n.default.createElement(e,g),r))}b.displayName="FormFieldSettings"}}));
//# sourceMappingURL=FormFieldSettings.es.js.map