Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.85/designer/js/definition-builder/diagram-builder/components/sidebar/sections/assignments/CurrentAssignments",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/layout","@frontend-taglib-clay$clayui/link","liferay!frontend-js-react-web$react","../../../../../util/lang","../../../../DiagramBuilderContext","../utils","./select-assignment/SelectAssignment","./utils"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n("@frontend-taglib-clay$clayui/button"),a=y(n("@frontend-taglib-clay$clayui/layout")),s=y(n("@frontend-taglib-clay$clayui/link")),l=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=d();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 s=r?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),i=y(n("../../../../../util/lang")),o=n("../../../../DiagramBuilderContext"),u=n("../utils"),c=n("./select-assignment/SelectAssignment"),f=n("./utils");function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function y(e){return e&&e.__esModule?e:{default:e}}function g(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 m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach((function(t){b(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var p=({assignments:e,setContentName:t})=>{var n;const{setSelectedItem:d}=(0,l.useContext)(o.DiagramBuilderContext),y=(0,f.getAssignmentType)(e),[g,b]=(0,l.useState)(null);return(0,l.useEffect)((()=>{if("resourceActions"===y){const t=e.resourceAction.split(/(?:,| )+/);b({assignmentsCount:t.length,firstName:t[0]})}else"roleId"===y?b({assignmentsCount:1,firstName:e.sectionsData.name}):"user"===y&&((0,u.sortElements)(e.sectionsData,"name"),b({assignmentsCount:e.sectionsData.length,firstName:e.sectionsData[0].name.split(" ")[0]}))}),[y,e]),l.default.createElement(a.default.ContentCol,{className:"current-node-data-area",float:!0},l.default.createElement(a.default.Row,{className:"current-node-data-row",justify:"between"},l.default.createElement(s.default,{button:!1,displayType:"secondary",href:"#",onClick:()=>t("assignments")},l.default.createElement("div",{className:"d-flex"},null===(n=c.options.find((e=>e.assignmentType===y)))||void 0===n?void 0:n.label,"assetCreator"!==y&&":",(()=>{if("assetCreator"===y)return[""];if(g){const e=[g.firstName||""];return 1!==g.assignmentsCount&&e.push(" "+i.default.sub(Liferay.Language.get("and-x-more"),[g.assignmentsCount-1])),e}if("roleType"===y){const t=e.roleName,n=[t[0]];return t.length>1&&n.push(" "+i.default.sub(Liferay.Language.get("and-x-more"),[t.length-1])),n}return[e[Object.keys(e)[1]]]})().map(((e,t)=>l.default.createElement("div",{className:"ml-2 truncate-container",key:t},e))))),l.default.createElement(r.ClayButtonWithIcon,{className:"delete-button text-secondary trash-button",disabled:!0,displayType:"unstyled",onClick:()=>{d((e=>m(m({},e),{},{data:m(m({},e.data),{},{assignments:null})})))},symbol:"trash"})))};t.default=p}}));
//# sourceMappingURL=CurrentAssignments.js.map