Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.141/page_editor/plugins/browser/components/page-structure/components/item-configuration-panels/FieldSet",["module","exports","require","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/contexts/StoreContext","../../../../../../app/utils/getEditableLocalizedValue","../../../../../../app/utils/isNullOrUndefined","../../../../../../common/components/Collapse","../../../../../../common/components/CurrentLanguageFlag","../../../../../../prop-types/index"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.fieldIsDisabled=fieldIsDisabled,t.FieldSet=function FieldSet({isCustomStylesFieldSet:e=!1,fields:t,item:a={},label:n,languageId:i,onValueSelect:o,values:f}){const p=(0,u.useSelector)((e=>e)),{fragmentEntryLinks:m,selectedViewportSize:g}=p,y=function getAvailableFields(e,t,a,n){let l=t;n!==d.VIEWPORT_SIZES.desktop&&(l=t.filter((e=>e.responsive||"backgroundImage"===e.name)));if(e.type!==r.LAYOUT_DATA_ITEM_TYPES.fragment)return l;a[e.config.fragmentEntryLinkId].fragmentEntryType===s.FRAGMENT_ENTRY_TYPES.input&&(l=l.filter((e=>"display"!==e.name)));return l}(a,t,m,g);return y.length&&n?l.default.createElement(c.default,{label:n,open:!0},l.default.createElement(FieldSetContent,{fields:y,isCustomStylesFieldSet:e,item:a,languageId:i,onValueSelect:o,values:f})):l.default.createElement(FieldSetContent,{fields:y,isCustomStylesFieldSet:e,item:a,languageId:i,onValueSelect:o,values:f})};var n=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),l=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(a("liferay!frontend-js-react-web$react"))),i=a("../../../../../../app/components/fragment-configuration-fields/index"),o=a("../../../../../../app/config/constants/containerWidthTypes"),s=a("../../../../../../app/config/constants/fragmentEntryTypes"),r=a("../../../../../../app/config/constants/layoutDataItemTypes"),d=a("../../../../../../app/config/constants/viewportSizes"),u=a("../../../../../../app/contexts/StoreContext"),f=a("../../../../../../app/utils/getEditableLocalizedValue"),p=_interopRequireDefault(a("../../../../../../app/utils/isNullOrUndefined")),c=_interopRequireDefault(a("../../../../../../common/components/Collapse")),m=_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===r.LAYOUT_DATA_ITEM_TYPES.container&&(null===(a=e.config)||void 0===a?void 0:a.widthType)===o.CONTAINER_WIDTH_TYPES.fixed&&("marginRight"===t.name||"marginLeft"===t.name)}function FieldSetContent({fields:t,isCustomStylesFieldSet:a,item:o,languageId:s,onValueSelect:r,values:d}){return l.default.createElement("div",{className:"page-editor__sidebar__fieldset"},t.map(((t,u)=>{const f=t.type&&i.FRAGMENT_CONFIGURATION_FIELDS[t.type];return l.default.createElement("div",{className:(0,n.default)(t.cssClass,"autofit-row page-editor__sidebar__fieldset__field align-items-end",{"page-editor__sidebar__fieldset__field-small":t.displaySize===e.small}),key:u},l.default.createElement("div",{className:"autofit-col autofit-col-expand"},l.default.createElement(f,{disabled:fieldIsDisabled(o,t),field:t,isCustomStyle:a,item:o,onValueSelect:r,value:getFieldValue({field:t,languageId:s,values:d})})),t.localizable&&l.default.createElement(m.default,{className:"ml-2"}))})))}function getFieldValue({field:e,languageId:t,values:a}){if(""===e.name)return a;const n=a[e.name];return(0,p.default)(n)?e.defaultValue:e.localizable&&"object"==typeof n?(0,f.getEditableLocalizedValue)(n,t,e.defaultValue):n}}}));
//# sourceMappingURL=FieldSet.js.map