Liferay.Loader.define("@liferay/frontend-data-set-web@1.0.31/views/table/TableHeadCell",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./dnd_table/Cell"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=u(r("@frontend-taglib-clay$clayui/button")),a=u(r("@frontend-taglib-clay$clayui/icon")),l=u(r("liferay!frontend-js-react-web$classnames")),o=u(r("liferay!frontend-js-react-web$prop-types")),i=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 r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var l=n?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(r,a,l):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),c=u(r("./dnd_table/Cell"));function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){b(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p({contentRenderer:e,expand:t,fieldName:r,hideColumnLabel:o,label:f,sortable:u,sorting:d,sortingKey:b,updateSorting:p}){const[y,g]=(0,i.useState)(null),[m,O]=(0,i.useState)(null);return(0,i.useEffect)((()=>{const e=b||(Array.isArray(r)?r[0]:r);g(e),O(d.find((t=>t.key===e)))}),[r,d,b]),i.default.createElement(c.default,{className:(0,l.default)({["content-renderer-".concat(e)]:e}),columnName:String(r),expand:t,heading:!0,resizable:!0},u?i.default.createElement(n.default,{className:"btn-sorting inline-item text-nowrap text-truncate-inline",displayType:"unstyled",onClick:function(e){e.preventDefault();const t=m?d.map((e=>e.key===y?s(s({},e),{},{direction:"asc"===e.direction?"desc":"asc"}):e)):[{direction:"asc",fieldName:r,key:y}];p(t)},small:!0},!o&&f,i.default.createElement("span",{className:"inline-item inline-item-after sorting-icons-wrapper"},i.default.createElement(a.default,{className:(0,l.default)("sorting-icon","asc"===(null==m?void 0:m.direction)&&"active"),draggable:!0,symbol:"order-arrow-up"}),i.default.createElement(a.default,{className:(0,l.default)("sorting-icon","desc"===(null==m?void 0:m.direction)&&"active"),draggable:!0,symbol:"order-arrow-down"}))):!o&&f)}p.proptypes={contentRenderer:o.default.string,expand:o.default.bool,expandableColumns:o.default.bool,fieldName:o.default.oneOfType([o.default.string,o.default.arrayOf(o.default.string)]),hideColumnLabel:o.default.bool,label:o.default.string,sortable:o.default.bool,sorting:o.default.arrayOf(o.default.shape({direction:o.default.oneOf(["asc","desc"]).isRequired,fieldName:o.default.oneOfType([o.default.string,o.default.array])})),sortingKey:o.default.string,updateSorting:o.default.func.isRequired};var y=p;t.default=y}}));
//# sourceMappingURL=TableHeadCell.js.map