Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/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/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({description:e,fragmentEntryLinks:t,selectedViewportSize:a,isCustomStylesFieldSet:n=!1,fields:i,item:s={},label:u,languageId:p,onValueSelect:c,values:m}){const g=function getAvailableFields(e,t,a,n){if(!a&&!n)return t;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===o.FRAGMENT_ENTRY_TYPES.input&&(l=l.filter((e=>"display"!==e.name)));return l}(s,i,t,a);return g.length&&u?l.default.createElement(f.default,{label:u,open:!0},l.default.createElement(FieldSetContent,{description:e,fields:g,isCustomStylesFieldSet:n,item:s,languageId:p,onValueSelect:c,values:m})):l.default.createElement(FieldSetContent,{description:e,fields:g,isCustomStylesFieldSet:n,item:s,languageId:p,onValueSelect:c,values:m})};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"),s=a("../../../../../../app/config/constants/containerWidthTypes"),o=a("../../../../../../app/config/constants/fragmentEntryTypes"),r=a("../../../../../../app/config/constants/layoutDataItemTypes"),d=a("../../../../../../app/config/constants/viewportSizes"),u=a("../../../../../../app/utils/getEditableLocalizedValue"),p=_interopRequireDefault(a("../../../../../../app/utils/isNullOrUndefined")),f=_interopRequireDefault(a("../../../../../../common/components/Collapse")),c=_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)===s.CONTAINER_WIDTH_TYPES.fixed&&("marginRight"===t.name||"marginLeft"===t.name)}function FieldSetContent({description:t,fields:a,isCustomStylesFieldSet:s,item:o,languageId:r,onValueSelect:d,values:u}){return l.default.createElement("div",{className:"page-editor__sidebar__fieldset"},t&&l.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 p=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:a},l.default.createElement("div",{className:"autofit-col autofit-col-expand"},l.default.createElement(p,{disabled:fieldIsDisabled(o,t),field:t,isCustomStyle:s,item:o,onValueSelect:d,value:getFieldValue({field:t,languageId:r,values:u})})),t.localizable&&l.default.createElement(c.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,u.getEditableLocalizedValue)(n,t,e.defaultValue):n}}}));
//# sourceMappingURL=FieldSet.js.map