Liferay.Loader.define("@liferay/frontend-data-set-web@1.0.31/views/table/TableInlineAddingRow",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/loading-indicator","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$react","../../FrontendDataSetContext","../../utils/dataRenderers","./dnd_table/index"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=s(a("@frontend-taglib-clay$clayui/button")),n=c(a("@frontend-taglib-clay$clayui/loading-indicator")),r=a("@liferay/frontend-js-react-web"),i=s(a("liferay!frontend-js-react-web$react")),d=c(a("../../FrontendDataSetContext")),u=a("../../utils/dataRenderers"),o=c(a("./dnd_table/index"));function c(e){return e&&e.__esModule?e:{default:e}}function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function s(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=f();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}var m=function({fields:e,selectable:t}){const{createInlineItem:a,itemsChanges:c,toggleItemInlineEdit:f,updateItem:s}=(0,i.useContext)(d.default),m=(0,r.useIsMounted)(),[y,b]=(0,i.useState)(!1),p=c[0]&&!!Object.keys(c[0]).length;return i.default.createElement(o.default.Row,null,t&&i.default.createElement(o.default.Cell,{className:"item-selector",columnName:"item-selector"}),e.map((e=>{var t;let a=null;(null===(t=e.inlineEditSettings)||void 0===t?void 0:t.type)&&(a=(0,u.getInputRendererById)(e.inlineEditSettings.type));const l=Array.isArray(e.fieldName)?e.fieldName.map((e=>"LANG"===e?Liferay.ThemeDisplay.getDefaultLanguageId():e)):[e.fieldName],n=l[0],r=c[0]||{};return i.default.createElement(o.default.Cell,{columnName:String(e.fieldName),key:e.fieldName},a?i.default.createElement(a,{updateItem:e=>{s(0,n,l,e)},value:r[n]&&r[n].value,valuePath:n}):null)})),i.default.createElement(o.default.Cell,{className:"item-actions",columnName:"item-actions"},i.default.createElement("div",{className:"d-flex ml-auto"},i.default.createElement(l.ClayButtonWithIcon,{className:"mr-1",disabled:!p,displayType:"secondary",onClick:()=>{f(0)},small:!0,symbol:"times-small"}),y?i.default.createElement(l.default,{disabled:!0,monospaced:!0,small:!0},i.default.createElement(n.default,{small:!0})):i.default.createElement(l.ClayButtonWithIcon,{disabled:y||!p,onClick:()=>{b(!0),a().finally((()=>{m()&&b(!1)}))},small:!0,symbol:"check"}))))};t.default=m}}));
//# sourceMappingURL=TableInlineAddingRow.js.map