Liferay.Loader.define("@liferay/notification-web@1.0.35/js/components/ContentContainer/DefinitionOfTerms",["module","exports","require","@frontend-taglib-clay$clayui/panel","@liferay/frontend-data-set-web","@liferay/object-js-components-web","frontend-js-web","liferay!frontend-js-react-web$react","../../util/constants"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.DefinitionOfTerms=function DefinitionOfTerms({baseResourceURL:e,objectDefinitions:t}){const[a,c]=(0,o.useState)(),[u,d]=(0,o.useState)(""),[s,y]=(0,o.useState)([]),m=(0,o.useMemo)((()=>{if(t)return(0,i.filterArrayByQuery)({array:t,query:u,str:"label"})}),[t,u]),copyObjectFieldTerm=({itemData:e})=>{navigator.clipboard.writeText(e.term)};return(0,o.useEffect)((()=>(Liferay.on("copyObjectFieldTerm",copyObjectFieldTerm),()=>{Liferay.detach("copyObjectFieldTerm")})),[]),o.default.createElement(n.default,{collapsable:!0,defaultExpanded:!0,displayTitle:Liferay.Language.get("definition-of-terms"),displayType:"secondary",showCollapseIcon:!0},o.default.createElement(n.default.Body,null,o.default.createElement(i.AutoComplete,{emptyStateMessage:Liferay.Language.get("no-entities-were-found"),items:null!=m?m:[],label:Liferay.Language.get("entity"),onChangeQuery:d,onSelectItem:t=>{(async t=>{const a=await(0,l.fetch)((0,l.createResourceURL)(e,{objectDefinitionId:t.id,p_p_resource_id:"/notification_templates/notification_template_terms"}).toString()),n=await a.json();y(n)})(t),c(t)},query:u,value:null==a?void 0:a.label[f.defaultLanguageId]},(({label:e,name:t})=>{var a;return o.default.createElement("div",{className:"d-flex justify-content-between"},o.default.createElement("div",null,null!==(a=e[f.defaultLanguageId])&&void 0!==a?a:t))})),o.default.createElement("div",{id:"lfr-notification-web__definition-of-terms-table"},o.default.createElement(r.FrontendDataSet,{id:"DefinitionOfTermsTable",items:s,itemsActions:[{href:"copyObjectFieldTerm",id:"copyObjectFieldTerm",label:Liferay.Language.get("copy"),target:"event"}],onActionDropdownItemClick:i.onActionDropdownItemClick,selectedItemsKey:"id",showManagementBar:!1,showPagination:!1,showSearch:!1,views:[{contentRenderer:"table",label:"Table",name:"table",schema:{fields:[{fieldName:"name",label:Liferay.Language.get("name")},{fieldName:"term",label:Liferay.Language.get("term")}]},thumbnail:"table"}]}))))};var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(a("@frontend-taglib-clay$clayui/panel")),r=a("@liferay/frontend-data-set-web"),i=a("@liferay/object-js-components-web"),l=a("frontend-js-web"),o=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=n?Object.getOwnPropertyDescriptor(e,r):null;i&&(i.get||i.set)?Object.defineProperty(a,r,i):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),f=a("../../util/constants");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}}}));
//# sourceMappingURL=DefinitionOfTerms.js.map