Liferay.Loader.define("data-engine-js-components-web@1.0.55/js/core/components/ResizableColumn.es",["module","exports","require","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","../actions/eventTypes.es","../hooks/useForm.es","./Field/ParentFieldContext.es"],(function(e,t,r){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r("@liferay/frontend-js-react-web"),a=(n=r("liferay!frontend-js-react-web$classnames"))&&n.__esModule?n:{default:n},i=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),l=r("../actions/eventTypes.es"),c=r("../hooks/useForm.es"),u=r("./Field/ParentFieldContext.es");function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},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 f(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){p(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 p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e={LEFT:"left",RIGHT:"right"},y=12,m=({children:t,currentLoc:r,disabled:n,instanceId:s,onResizing:d,resizeInfoRef:p,rowRef:b})=>{const{loc:m=[]}=(0,i.useContext)(u.ParentFieldContext),v=(0,c.useForm)(),j=(e,t)=>{e.preventDefault(),e.stopPropagation(),p.current=f(f({},p.current),{},{direction:t,instanceId:s}),d(!0)},O=(0,i.useCallback)((e=>{if(p.current&&p.current.instanceId===s){var t,n;let o=Math.floor((e.clientX-(null===(t=b.current)||void 0===t?void 0:t.getBoundingClientRect().left))*(10*y)/(null===(n=b.current)||void 0===n?void 0:n.clientWidth)/10);o>y-1&&(o=y-1),o>=0&&o!==p.current.lastColumnValue&&(p.current=f(f({},p.current),{},{lastColumnValue:o}),v({payload:{column:o,direction:p.current.direction,loc:[...m,r]},type:l.EVENT_TYPES.DND.RESIZE}))}}),[r,v,s,m,p,b]),w=(0,i.useCallback)((()=>{d(!1),p.current=null}),[d,p]);return(0,o.useEventListener)("mousemove",O,!1,document.body),(0,o.useEventListener)("mouseup",w,{passive:!0},document.body),i.default.createElement(i.default.Fragment,null,i.default.createElement("div",{className:(0,a.default)("ddm-resize-handle ddm-resize-handle-left",{hide:n}),onMouseDown:t=>j(t,e.LEFT)}),t,i.default.createElement("div",{className:(0,a.default)("ddm-resize-handle ddm-resize-handle-right",{hide:n}),onMouseDown:t=>j(t,e.RIGHT)}))};m.displayName="ResizableColumn";var b=m;t.default=b}}));
//# sourceMappingURL=ResizableColumn.es.js.map