Liferay.Loader.define("data-engine-taglib@3.3.26/data_layout_builder/js/components/field-types/FieldTypeList.es",["module","exports","require","liferay!frontend-js-react-web$classnames","data-engine-js-components-web","liferay!frontend-js-react-web$react","../../utils/search.es","../collapsable-panel/CollapsablePanel.es","../empty-state/EmptyState.es","./FieldType.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=c(a("liferay!frontend-js-react-web$classnames")),l=a("data-engine-js-components-web"),r=c(a("liferay!frontend-js-react-web$react")),i=a("../../utils/search.es"),s=c(a("../collapsable-panel/CollapsablePanel.es")),o=c(a("../empty-state/EmptyState.es")),d=c(a("./FieldType.es"));function c(e){return e&&e.__esModule?e:{default:e}}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}function f(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function y(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?f(Object(a),!0).forEach((function(t){u(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):f(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function u(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function b(e,t){if(null==e)return{};var a,n,l=function(e,t){if(null==e)return{};var a,n,l={},r=Object.keys(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}const e=e=>{let{expanded:t,fieldType:a,fieldTypes:n,showArrows:i}=e,s=b(e,["expanded","fieldType","fieldTypes","showArrows"]);const o=(0,l.useForm)(),{activePage:c,pages:f}=(0,l.useFormState)();return r.default.createElement(d.default,p({},s,a,{icon:i?t?"angle-down":"angle-right":a.icon,onDoubleClick:({name:e})=>{o({payload:{fieldType:y(y({},n.find((({name:t})=>t===e))),{},{editable:!0}),indexes:{columnIndex:0,pageIndex:c,rowIndex:f[c].rows.length}},type:l.EVENT_TYPES.FIELD.ADD})}}))},g=({dataDefinition:t,deleteLabel:a,emptyState:d,keywords:c,onClick:p,onDelete:f,showEmptyState:u=!0})=>{const{fieldTypes:b}=(0,l.useConfig)(),m=(0,i.getSearchRegex)(c),g=b.filter((({description:e,label:t,system:a})=>!a&&(!c||(m.test(e)||m.test(t))))).sort((({displayOrder:e},{displayOrder:t})=>e-t));return u&&!g.length?r.default.createElement(o.default,{emptyState:d,keywords:c,small:!0}):g.map(((l,i)=>{const{isFieldSet:o,nestedDataDefinitionFields:d=[]}=l,c=e=>{!l.disabled&&p&&p(e)};return d.length?r.default.createElement("div",{className:"field-type-list",key:i},r.default.createElement(s.default,{Header:({expanded:n,setExpanded:i})=>r.default.createElement(e,{dataDefinition:t,deleteLabel:a,expanded:n,fieldType:y(y({},l),{},{className:"".concat(l.className," field-type-header")}),fieldTypes:g,onClick:e=>{i(!n),c(e)},onDelete:f,setExpanded:i,showArrows:!0}),className:(0,n.default)({"field-type-fieldgroup":!o,"field-type-fieldset":o})},r.default.createElement("div",{className:"field-type-item position-relative"},d.map((a=>r.default.createElement(e,{dataDefinition:t,draggable:!1,fieldType:y(y({},a),{},{disabled:l.disabled}),fieldTypes:g,key:"".concat(a.name,"_").concat(i)})))))):r.default.createElement(e,{dataDefinition:t,deleteLabel:a,fieldType:l,fieldTypes:g,key:i,onClick:c,onDelete:f})}))};g.displayName="FieldTypeList";var m=g;t.default=m}}));
//# sourceMappingURL=FieldTypeList.es.js.map