Liferay.Loader.define("@liferay/content-dashboard-web@2.0.83/js/transformers/ActionsComponentPropsTransformer",["module","exports","require","@liferay/frontend-js-react-web","../components/SidebarPanel","../components/SidebarPanelInfoView/SidebarPanelInfoView","../components/SidebarPanelMetricsView","../utils/constants","./panelStateHandler"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function propsTransformer(e){let{additionalProps:t,items:n,portletNamespace:o}=e,r=function _objectWithoutProperties(e,t){if(null==e)return{};var n,o,r=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["additionalProps","items","portletNamespace"]);const{panelState:a,selectedItemRowId:c,singlePageApplicationEnabled:i}=t;i&&(0,l.handlePanelStateFromSession)(t);return _objectSpread(_objectSpread({},r),{},{items:n.map((e=>_objectSpread(_objectSpread({},e),{},{onClick(t){var n;const r=null===(n=e.data)||void 0===n?void 0:n.action;r&&(t.preventDefault(),s[r]({fetchURL:e.data.fetchURL,panelState:a,portletNamespace:o,rowId:e.data.classPK,selectedItemRowId:c,singlePageApplicationEnabled:i}))}})))})},t.showSidebar=t.selectRow=void 0;var o=n("@liferay/frontend-js-react-web"),r=_interopRequireDefault(n("../components/SidebarPanel")),a=_interopRequireDefault(n("../components/SidebarPanelInfoView/SidebarPanelInfoView")),c=_interopRequireDefault(n("../components/SidebarPanelMetricsView")),i=n("../utils/constants"),l=n("./panelStateHandler");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const e="table-active",deselectAllRows=t=>{document.querySelectorAll("#".concat(t,"contentSearchContainer tr.").concat(e)).forEach((t=>t.classList.remove(e)))},getRow=(e,t)=>document.querySelector("#".concat(e,'contentSearchContainer [data-rowid="').concat(t,'"]')),selectRow=(t,n)=>{deselectAllRows(t);const o=getRow(t,n);o&&o.classList.add(e)};t.selectRow=selectRow;const showSidebar=({View:e,fetchURL:t,portletNamespace:n,singlePageApplicationEnabled:a})=>{const c="".concat(n,"sidebar"),i=Liferay.component(c);if(i)i.open(t,e);else{const i=document.body.appendChild(document.createElement("div"));(0,o.render)(r.default,{fetchURL:t,onClose:()=>{Liferay.component(c).close(),deselectAllRows(n)},ref:e=>{Liferay.component(c,e)},singlePageApplicationEnabled:a,viewComponent:e},i)}};t.showSidebar=showSidebar;const s={showInfo({fetchURL:e,panelState:t,portletNamespace:n,rowId:o,selectedItemRowId:r,singlePageApplicationEnabled:c}){selectRow(n,o),c&&((0,l.handleSessionOnSidebarOpen)({fetchURL:e,panelState:t,rowId:o,selectedItemRowId:r}),Liferay.Util.Session.set(i.TABS_STATE_SESSION_KEY,i.DEFAULT_ACTIVE_PANEL_TAB)),showSidebar({View:a.default,fetchURL:e,portletNamespace:n,singlePageApplicationEnabled:c})},showMetrics({fetchURL:e,portletNamespace:t,rowId:n}){selectRow(t,n),showSidebar({View:c.default,fetchURL:e,portletNamespace:t})}}}}));
//# sourceMappingURL=ActionsComponentPropsTransformer.js.map