Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.147/FieldSet/FieldSet.es",["module","exports","require","./FieldSet.scss","data-engine-js-components-web","liferay!frontend-js-react-web$react","../FieldBase/ReactFieldBase.es","./Panel.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,r("./FieldSet.scss");var a=r("data-engine-js-components-web"),n=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=a?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(r,n,l):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),l=r("../FieldBase/ReactFieldBase.es"),o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r("./Panel.es"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}function _objectWithoutProperties(e,t){if(null==e)return{};var r,a,n=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,a,n={},l=Object.keys(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const getRowsArray=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return[]}return e},getRows=(e,t)=>getRowsArray(e).map((e=>_objectSpread(_objectSpread({},e),{},{columns:e.columns.map((e=>_objectSpread(_objectSpread({},e),{},{fields:t.map(((e,t)=>_objectSpread(_objectSpread({},e),{},{nestedFieldIndex:t}))).filter((t=>e.fields.includes(t.fieldName)))})))})));var _default=e=>{let{collapsible:t,ddmStructureId:r,itemPath:i,label:d,name:c,nestedFields:s=[],readOnly:u,repeatable:f,rows:p,showLabel:b,type:y}=e,m=_objectWithoutProperties(e,["collapsible","ddmStructureId","itemPath","label","name","nestedFields","readOnly","repeatable","rows","showLabel","type"]),O=!1,j=null;const w="fieldset"===y&&!r,{editable:h,page:P}=(0,a.usePage)(),_=(0,n.useMemo)((()=>(0,a.getRepeatedIndex)(c)),[c]),findFieldInsidePage=e=>null==e?void 0:e.find((e=>(O||(O=!!e.ddmStructureId),e.name===c?e:findFieldInsidePage(e.nestedFields))));return w&&P.rows.forEach((e=>{e.columns.forEach((e=>{j||(O=!1,j=findFieldInsidePage(e.fields))}))})),n.default.createElement(l.FieldBase,_extends({},m,{itemPath:i,label:d,name:c,readOnly:u,repeatable:!t&&f,required:!1,showLabel:!1,tip:null,type:y}),n.default.createElement("div",{className:"ddm-field-types-fieldset__nested"},b&&!t&&n.default.createElement(n.default.Fragment,null,n.default.createElement("label",{className:"text-uppercase"},d),n.default.createElement("div",{className:"ddm-field-types-fieldset__nested-separator"},n.default.createElement("hr",{className:"mt-1 separator"}))),t?n.default.createElement(o.default,{name:c,readOnly:u,repeatable:f,showRepeatableRemoveButton:f&&_>0,title:d},n.default.createElement(a.Layout,{editable:h?w&&!O:h,itemPath:i,rows:getRows(p,s)})):n.default.createElement(a.Layout,{editable:h?w&&!O:h,itemPath:i,rows:getRows(p,s)})))};t.default=_default}}));
//# sourceMappingURL=FieldSet.es.js.map