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