Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/page_editor/plugins/browser/components/page_structure/components/item_configuration_panels/FieldSet",["module","exports","require","@frontend-taglib-clay$clayui/panel","@liferay/layout-js-components-web","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../../../../app/components/fragment_configuration_fields/index","../../../../../../app/config/constants/containerWidthTypes","../../../../../../app/config/constants/fragmentEntryTypes","../../../../../../app/config/constants/layoutDataItemTypes","../../../../../../app/config/constants/viewportSizes","../../../../../../app/utils/getEditableLocalizedValue","../../../../../../common/components/CurrentLanguageFlag","../../../../../../prop_types/index"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.fieldIsDisabled=fieldIsDisabled,t.FieldSet=function FieldSet({description:e,fragmentEntryLinks:t,selectedViewportSize:a,isCustomStylesFieldSet:l=!1,fields:i,item:o={},label:r,languageId:f,onValueSelect:p,values:m}){const g=function getAvailableFields(e,t,a,n){if(!a&&!n)return t;let l=t;n!==c.VIEWPORT_SIZES.desktop&&(l=t.filter((e=>e.responsive||"backgroundImage"===e.name)));if(e.type!==u.LAYOUT_DATA_ITEM_TYPES.fragment)return l;a[e.config.fragmentEntryLinkId].fragmentEntryType===d.FRAGMENT_ENTRY_TYPES.input&&(l=l.filter((e=>"display"!==e.name)));return l}(o,i,t,a);return g.length&&r?s.default.createElement(n.default,{collapsable:!0,defaultExpanded:!0,displayTitle:r,displayType:"unstyled",showCollapseIcon:!0},s.default.createElement(n.default.Body,null,s.default.createElement(FieldSetContent,{description:e,fields:g,isCustomStylesFieldSet:l,item:o,languageId:f,onValueSelect:p,values:m}))):s.default.createElement(FieldSetContent,{description:e,fields:g,isCustomStylesFieldSet:l,item:o,languageId:f,onValueSelect:p,values:m})};var n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/panel")),l=a("@liferay/layout-js-components-web"),i=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),s=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(a("liferay!frontend-js-react-web$react"))),o=a("../../../../../../app/components/fragment_configuration_fields/index"),r=a("../../../../../../app/config/constants/containerWidthTypes"),d=a("../../../../../../app/config/constants/fragmentEntryTypes"),u=a("../../../../../../app/config/constants/layoutDataItemTypes"),c=a("../../../../../../app/config/constants/viewportSizes"),f=a("../../../../../../app/utils/getEditableLocalizedValue"),p=_interopRequireDefault(a("../../../../../../common/components/CurrentLanguageFlag"));a("../../../../../../prop_types/index");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const e={small:"small"};function fieldIsDisabled(e,t){var a;return!!t.disabled||e.type===u.LAYOUT_DATA_ITEM_TYPES.container&&(null===(a=e.config)||void 0===a?void 0:a.widthType)===r.CONTAINER_WIDTH_TYPES.fixed&&("marginRight"===t.name||"marginLeft"===t.name)}function FieldSetContent({description:t,fields:a,isCustomStylesFieldSet:n,item:l,languageId:r,onValueSelect:d,values:u}){return s.default.createElement("div",{className:"page-editor__sidebar__fieldset"},t&&s.default.createElement("p",{className:"text-secondary"},t),a.filter((e=>{var t;return!(null===(t=e.typeOptions)||void 0===t?void 0:t.dependency)||Object.entries(e.typeOptions.dependency).every((([e,t])=>u[e]===t))})).map(((t,a)=>{const c=t.type&&o.FRAGMENT_CONFIGURATION_FIELDS[t.type];return s.default.createElement("div",{className:(0,i.default)(t.cssClass,"autofit-row page-editor__sidebar__fieldset__field align-items-end",{"page-editor__sidebar__fieldset__field-small":t.displaySize===e.small}),key:a},s.default.createElement("div",{className:"autofit-col autofit-col-expand"},s.default.createElement(c,{disabled:fieldIsDisabled(l,t),field:t,isCustomStyle:n,item:l,onValueSelect:d,value:getFieldValue({field:t,languageId:r,values:u})})),t.localizable&&s.default.createElement(p.default,{className:"ml-2"}))})))}function getFieldValue({field:e,languageId:t,values:a}){if(""===e.name)return a;const n=a[e.name];return(0,l.isNullOrUndefined)(n)?e.defaultValue:e.localizable&&"object"==typeof n?(0,f.getEditableLocalizedValue)(n,t,e.defaultValue):n}}}));
//# sourceMappingURL=FieldSet.js.map