"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/toConsumableArray"),t=require("react"),s=require("classnames"),a=require("prop-types"),i=require("@material-ui/core"),l=require("@material-ui/icons/Add"),u=require("@material-ui/icons/Delete");require("../shared/CancelButton.js"),require("../shared/ExpandCollapseButton.js"),require("../shared/FormatedNumber.js");var n=require("../shared/InputText.js");require("../shared/MoreButton.js"),require("../shared/SaveButton.js"),require("../shared/SelectField.js");var o=require("../shared/StaticField.js");require("../shared/SharedEditorElements.js"),require("../shared/ConfirmationPopup.js");var d=require("../sharedStyles.js"),c=require("../../../../../utils/mobileDetect.js"),f=require("react/jsx-runtime");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=p(e),m=p(r),j=p(s),h=p(a),g=p(l),x=p(u);function y(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,s)}return t}function q(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?y(Object(t),!0).forEach((function(r){b.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):y(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function v(e){var r,s=e.data,a=e.title,l=e.errors,u=e.isEditing,p=e.onChange,h=d.useStyles({isMobile:c.isMobileDetected,isEditing:u}),y=l||[],v=function(e){return function(){p([].concat(m.default(s.slice(0,e)),m.default(s.slice(e+1))))}},w=function(e){return function(r,t){var a=s.map((function(s,a){return a===e?q(q({},s),{},b.default({},r,t)):s}));p(a)}};return 0!==s.length||u?f.jsxs("div",{className:h.subGroup,children:[f.jsxs("div",{className:j.default(h.subTitle,b.default({},h.subTitleEditing,u)),children:[a,u&&f.jsx(i.IconButton,{"data-not-migrated-muiiconbutton":!0,className:h.addButton,onClick:function(){p([].concat(m.default(s),[{flow_rate:null,pressure_loss:null}]))},children:f.jsx(g.default,{className:h.addIcon,color:"primary"})})]}),f.jsx(i.Grid,{container:!0,spacing:2,className:j.default(h.detailedView,(r={},b.default(r,h.detailedViewMobile,c.isMobileDetected),b.default(r,h.eidtorNozzleView,u),r)),children:s.map((function(e,r){return f.jsxs(t.Fragment,{children:[u?f.jsx(n.InputText,{type:"flow_rate",label:"Flow Rate",unit:"volumeFlowRate",value:e.flow_rate,error:y[r]&&y[r].flow_rate,xs:c.isMobileDetected?5:4,onChangeField:w(r)}):f.jsx(o.StaticField,{label:"Flow Rate",unit:"volumeFlowRate",value:e.flow_rate,xs:6}),u?f.jsx(n.InputText,{type:"pressure_loss",label:"Pressure Loss",unit:"pressure",value:e.pressure_loss,error:y[r]&&y[r].pressure_loss,xs:c.isMobileDetected?5:4,onChangeField:w(r)}):f.jsx(o.StaticField,{label:"Pressure Loss",unit:"pressure",value:e.pressure_loss,xs:6}),u&&f.jsx(i.Grid,{item:!0,xs:c.isMobileDetected?2:4,className:b.default({},h.cellInnerMobile,c.isMobileDetected),children:f.jsx(i.IconButton,{"data-not-migrated-muiiconbutton":!0,className:h.addButton,onClick:v(r),children:f.jsx(x.default,{className:h.addIcon})})})]},r)}))})]}):null}v.propTypes={isEditing:h.default.bool.isRequired,title:h.default.string,data:h.default.arrayOf(h.default.shape({flow_rate:h.default.number,pressure_loss:h.default.number})),errors:h.default.arrayOf(h.default.shape({flow_rate:h.default.string,pressure_loss:h.default.string})),onChange:h.default.func},v.defaultProps={title:"Pressure Loss",data:[],errors:[],onChange:null};var w=t.memo(v);module.exports=w;
//# sourceMappingURL=index.js.map
