Liferay.Loader.define("@liferay/frontend-data-set-web@1.0.31/data_renderers/ActionLinkRenderer",["module","exports","require","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/link","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../FrontendDataSetContext","../utils/index","./DefaultRenderer"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=d(n("@frontend-taglib-clay$clayui/icon")),a=d(n("@frontend-taglib-clay$clayui/link")),o=n("frontend-js-web"),i=(d(n("liferay!frontend-js-react-web$prop-types")),function(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 n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=r?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react"))),l=d(n("../FrontendDataSetContext")),c=n("../utils/index"),u=d(n("./DefaultRenderer"));function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function d(e){return e&&e.__esModule?e:{default:e}}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b=function({actions:e,itemData:t,itemId:n,options:f,value:d}){var s;const{executeAsyncItemAction:y,highlightItems:b,openModal:g,openSidePanel:v}=(0,i.useContext)(l.default);if(!e||!e.length)return d?i.default.createElement(u.default,{value:d}):null;let m=(null==f?void 0:f.actionId)?e.find((e=>e.id===f.actionId)):e[0];if(!m)return null;if(null===(s=m.data)||void 0===s?void 0:s.permissionKey){if(!t.actions[m.data.permissionKey])return d?i.default.createElement(u.default,{value:d}):null;var O,j;"headless"===m.target&&(m=p(p(p({},m),t.actions[m.data.id]),{},{method:null!==(O=m.method)&&void 0!==O?O:null===(j=m.data)||void 0===j?void 0:j.method}))}const h=m.href&&(0,c.formatActionURL)(m.href,t);return i.default.createElement("div",{className:"table-list-title"},i.default.createElement(a.default,{"data-senna-off":!0,href:h||"#",onClick:Boolean(m.target&&"link"!==m.target||m.onClick)?function(e){m.data&&m.data.confirmationMessage&&!confirm(m.data.confirmationMessage)||("modal"===m.target?(e.preventDefault(),g({size:m.size||"lg",title:m.title,url:h})):"sidePanel"===m.target?(e.preventDefault(),b([n]),v({size:m.size||"lg",title:m.title,url:h})):"async"===m.target||"headless"===m.target?(e.preventDefault(),y(h,m.method).then((()=>{var e;(0,o.openToast)({message:(null===(e=m.data)||void 0===e?void 0:e.successMessage)||Liferay.Language.get("action-completed"),type:"success"})}))):m.onClick&&(e.preventDefault(),e.target.setAttribute("onClick",m.onClick),e.target.onclick(),e.target.removeAttribute("onClick")))}:e=>{var t;const n=null===(t=m.data)||void 0===t?void 0:t.confirmationMessage;n&&(e.preventDefault(),confirm(n)&&(0,o.navigate)(h))}},d||i.default.createElement(r.default,{symbol:m.icon})))};t.default=b}}));
//# sourceMappingURL=ActionLinkRenderer.js.map