@progress/kendo-react-sortable 11.4.0-develop.6 → 11.4.0-develop.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Sortable.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),g=require("prop-types"),m=require("@progress/kendo-react-common"),P=require("./events/SortableOnDragStartEvent.js"),M=require("./events/SortableOnDragOverEvent.js"),U=require("./events/SortableOnDragEndEvent.js"),F=require("./events/SortableOnNavigateEvent.js"),T=require("@progress/kendo-react-intl"),R=require("./messages/index.js"),v=require("./utils/utils.js"),k=require("./package-metadata.js");function B(b){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(b){for(const t in b)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(b,t);Object.defineProperty(c,t,e.get?e:{enumerable:!0,get:()=>b[t]})}}return c.default=b,Object.freeze(c)}const f=B(N),x=200,D="data-sortable-id",O="data-sortable-component",A="[data-sortable-id]:not(.k-disabled)",q={[O]:!0},E=class E extends f.Component{constructor(c){super(c),this.state={clientX:0,clientY:0,isDragging:!1,activeId:"",dragCueWidth:0,dragCueHeight:0},this.isRtl=!1,this.itemRefsMap={},this.oldSizesMap={},this.animatingItemMap={},this.draggableRef=null,this.isUnmounted=!1,this.focusActiveId=!1,this.isKeyboardNavigated=!1,this.isDragPrevented=!1,this.showLicenseWatermark=!1,this.windowTimeout=t=>{window.setTimeout(()=>this.animatingItemMap[t]=!1,x)},this.swapItems=(t,e,i)=>{const s=t[e];return t[e]=t[i],t[i]=s,e=i,e},this.generateNewState=(t,e)=>{const{data:i}=this.props,s=[...i];if(t>e)for(let n=t-1;n>=e;n--){const o=i[n];this.isItemDisabled(o)||(t=this.swapItems(s,t,n))}else for(let n=t+1;n<=e;n++){const o=i[n];this.isItemDisabled(o)||(t=this.swapItems(s,t,n))}return s},this.closestSortableItem=t=>{let e=t;for(;e;){const i=e.getAttribute(D);if(i&&this.itemRefsMap[i]===e)return{id:i,element:e};e=e.parentElement}return{id:"",element:null}},this.isSortable=t=>!!t.hasAttribute(O),this.closestSortable=t=>{let e=t;for(;e;){if(this.isSortable(e))return e;e=e.parentElement}return null},this.isSameSortable=t=>this.closestSortable(t)===this.container,this.idComparer=(t,e)=>t+""==e+"",this.findItem=t=>{const{data:e,idField:i}=this.props;if(!(t+""))return;const s=m.getter(i);return v.find(e,a=>this.idComparer(s(a),t))},this.findIndex=t=>{const{data:e,idField:i}=this.props;return t+""?v.findIndex(e,s=>this.idComparer(s[i],t)):-1},this.isItemDisabled=t=>t&&t[this.props.disabledField||""]===!0,this.shouldResetActive=()=>{const t=m.getActiveElement(document);return t instanceof HTMLElement?!this.closestSortableItem(t).element:!1},this.widgetTarget=t=>{const e=v.closest(t,i=>v.hasClasses(i,"k-widget")||this.isSortable(i));return e&&!this.isSortable(e)},this.allowDrag=t=>t.hasAttribute(D)||!(v.isFocusable(t)||this.widgetTarget(t)),this.onDragStart=t=>{const{event:e}=t,{onDragStart:i}=this.props,s=document.elementFromPoint(e.clientX,e.clientY),{id:a,element:n}=this.closestSortableItem(s),o=this.findItem(a);if(!a||o&&this.isItemDisabled(o)||!this.allowDrag(s)||!this.isSameSortable(s)){this.isDragPrevented=!0;return}e.isTouch&&e.originalEvent.preventDefault();const r=new P.SortableOnDragStartEvent(this,this.findIndex(a),s);i&&i.call(void 0,r),this.isDragPrevented=r.isDefaultPrevented(),this.isDragPrevented?e.originalEvent.preventDefault():(this.offsetParent=v.relativeContextElement(this.container),this.setState({activeId:a,dragCueWidth:n&&n.clientWidth||0,dragCueHeight:n&&n.clientHeight||0}))},this.onDragOver=t=>{const{event:e}=t,{onDragOver:i,data:s}=this.props;if(this.isDragPrevented)return;e.originalEvent.preventDefault();const a=this.findIndex(this.state.activeId);if(a===-1){this.resetState();return}const n=document.elementFromPoint(e.clientX,e.clientY),o=this.closestSortableItem(n),r=this.findIndex(o.id),l=s[r];if(i&&r>-1&&a!==r&&!this.isItemDisabled(l)&&!this.animatingItemMap[o.id]&&this.shouldReorder(o.element,e.clientX,e.clientY)){const h=new M.SortableOnDragOverEvent(this,a,r,this.generateNewState(a,r));i.call(void 0,h)}const d=this.parentOffset();this.setState({clientX:e.clientX-d.left,clientY:e.clientY-d.top,isDragging:!0})},this.onDragEnd=t=>{const{event:e}=t,i=this.shouldResetActive();if(this.isDragPrevented)return;const{onDragEnd:s,data:a}=this.props,n=document.elementFromPoint(e.clientX,e.clientY),o=this.closestSortableItem(n);let r=this.findIndex(o.id),l=this.findIndex(this.state.activeId);const d=this.isItemDisabled(a[r]);if((r===-1||d)&&(r=l),s){let h=this.generateNewState(l,r);if(!d){const u=this.thresholdRect(o.element);if(u&&(e.clientX<u.left||e.clientX>u.right||e.clientY<u.top||e.clientY>u.bottom)){const I=l;l=r,r=I,h=this.props.data.slice()}}const p=new U.SortableOnDragEndEvent(this,l,r,h);s.call(void 0,p)}this.resetState(i)},this.shouldReorder=(t,e,i)=>{const s=this.thresholdRect(t);return s&&e>s.left&&e<s.right&&i>s.top&&i<s.bottom},this.thresholdRect=t=>{const e=this.state.activeId,i=this.container,a=(i?Array.from(i.childNodes):[]).find(u=>u instanceof HTMLElement&&u.getAttribute(D)===e);if(!t||!a)return null;const{width:n,height:o}=a.getBoundingClientRect(),r=t.getBoundingClientRect(),l=r.top+r.height/2-o/2,d=r.left+r.width/2-n/2,h=l+o,p=d+n;return{top:l,left:d,bottom:h,right:p}},this.onItemBlur=()=>{window.setTimeout(()=>{this.isUnmounted||this.shouldResetActive()&&!this.state.isDragging&&this.setState({activeId:""})})},this.onItemFocus=t=>{const{id:e,element:i}=this.closestSortableItem(t.currentTarget);!this.idComparer(e,this.state.activeId)&&this.isSameSortable(t.target)&&i===t.target&&this.setState({activeId:e})},this.resetState=t=>{this.isDragPrevented=!1,this.setState({clientX:0,clientY:0,isDragging:!1,dragCueWidth:0,dragCueHeight:0,activeId:t?"":this.state.activeId})},this.renderData=()=>{const{data:t,itemUI:e,idField:i,tabIndex:s,navigatable:a}=this.props;return t.map(n=>{const r=m.getter(i)(n),l=this.isItemDisabled(n),d=this.idComparer(this.state.activeId,r),h=a?d?0:-1:s;return f.createElement(e,{key:r,forwardRef:p=>this.refAssign(p,r),dataItem:n,isDisabled:l,isActive:d,isDragged:d&&this.state.isDragging,isDragCue:!1,attributes:{[D]:r,"aria-disabled":l,"aria-grabbed":d&&this.state.isDragging&&!this.isDragPrevented,"aria-dropeffect":l?"none":"move",tabIndex:m.getTabIndex(h,l),onFocus:this.onItemFocus,onBlur:this.onItemBlur},style:{cursor:l?"auto":"move",MozUserSelect:"none",msUserSelect:"none",WebkitUserSelect:"none",userSelect:"none"}})})},this.renderNoData=()=>{const{emptyItemUI:t}=this.props,i=T.provideLocalizationService(this).toLanguageString(R.noData,R.messages[R.noData]);if(t)return f.createElement(t,{message:i})},this.renderDragCue=()=>{const{itemUI:t}=this.props,{isDragging:e,activeId:i,clientX:s,clientY:a}=this.state,n=this.findItem(i);if(!(!e||!n))return f.createElement(t,{dataItem:n,isDisabled:!1,isActive:!0,isDragged:!0,isDragCue:!0,style:{position:"fixed",top:a+10,left:s+10,width:this.state.dragCueWidth,height:this.state.dragCueHeight},attributes:{}})},this.refAssign=(t,e)=>{t?this.itemRefsMap[e]=t:delete this.itemRefsMap[e]},this.draggableRefAssign=t=>{this.draggableRef=t},this.onKeyDown=t=>{var r,l,d;const{data:e,idField:i}=this.props,{activeId:s}=this.state,a=e.filter(h=>!this.isItemDisabled(h)),n=v.findIndex(a,h=>this.idComparer(h[i],s)),o=n<0?0:n;t.key===m.KEYS.tab&&m.getActiveElement(document)!==((r=this.draggableRef)==null?void 0:r.element)&&(t.preventDefault(),t.stopPropagation()),this.navigation&&((l=this.draggableRef)!=null&&l.element)&&this.navigation.triggerKeyboardEvent({target:(d=this.draggableRef)==null?void 0:d.element.querySelectorAll(A)[o],key:t.key,nativeEvent:{type:t.type},originalEvent:t})},this.handleNext=(t,e,i)=>{var s;m.getActiveElement(document)!==((s=this.draggableRef)==null?void 0:s.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"next"):e.focusNext(t))},this.handlePrev=(t,e,i)=>{var s;m.getActiveElement(document)!==((s=this.draggableRef)==null?void 0:s.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"prev"):e.focusPrevious(t))},this.moveItem=(t,e,i,s)=>{var a;if(m.getActiveElement(document)!==((a=this.draggableRef)==null?void 0:a.element)){const{onNavigate:n,data:o,idField:r}=this.props,l=this.findIndex(this.state.activeId);if(n){let d,h;s==="next"?(d=o[l+1],h=d&&d.disabled?o[l+2]:o[l+1]):(d=o[l-1],h=d&&d.disabled?o[l-2]:o[l-1]);const p=h&&h[r],u=o[l],I=u?u[r]:"",w=this.findIndex(I),y=this.findIndex(p||I),C=new F.SortableOnNavigateEvent(this,w,y,this.generateNewState(w,y));this.isKeyboardNavigated=!0,n.call(void 0,C)}}},this.showLicenseWatermark=!m.validatePackage(k.packageMetadata,{component:"Sortable"}),this.onKeyDown=this.onKeyDown.bind(this)}get container(){return this.draggableRef&&this.draggableRef.element}getSnapshotBeforeUpdate(){const{idField:c,animation:t}=this.props;return this.oldSizesMap={},t&&this.props.data.forEach(e=>{const i=e[c],s=this.itemRefsMap[i];s&&(this.oldSizesMap[i]=s.getBoundingClientRect())}),null}componentDidUpdate(c){const{idField:t,animation:e}=this.props;this.focusActiveId&&(this.focusActiveId=!1,this.itemRefsMap[this.state.activeId].focus()),!(!e||!this.state.isDragging&&!this.isKeyboardNavigated)&&(this.isKeyboardNavigated=!1,c.data.forEach(i=>{const s=i[t],a=this.itemRefsMap[s];if(!a)return;const n=a.getBoundingClientRect(),o=this.oldSizesMap[s],r=o.left-n.left,l=o.top-n.top;r===0&&l===0||requestAnimationFrame(()=>{this.animatingItemMap[s]=!0,a.style.transform=`translate(${r}px, ${l}px)`,a.style.transition="transform 0s",requestAnimationFrame(()=>{a.style.transform="",a.style.transition=`transform ${x}ms cubic-bezier(0.2, 0, 0, 1) 0s`,this.windowTimeout(s)})})}))}componentDidMount(){var c,t;(c=this.draggableRef)!=null&&c.element&&(this.navigation=new m.Navigation({tabIndex:0,root:{current:(t=this.draggableRef)==null?void 0:t.element},rovingTabIndex:!0,selectors:[A],keyboardEvents:{keydown:{ArrowDown:this.handleNext,ArrowRight:this.handleNext,ArrowUp:this.handlePrev,ArrowLeft:this.handlePrev,Enter:(e,i,s)=>{i.focusElement(i.first,e)},Escape:(e,i,s)=>{var a,n;e.setAttribute("tabindex","-1"),(n=(a=this.draggableRef)==null?void 0:a.element)==null||n.focus(),this.setState({activeId:""})}}}})),this.isRtl=this.container&&getComputedStyle(this.container).direction==="rtl"||!1}componentWillUnmount(){this.isUnmounted=!0}parentOffset(){const c=this.offsetParent;if(c&&c.ownerDocument&&c!==c.ownerDocument.body){const t=c.getBoundingClientRect();return{left:t.left-c.scrollLeft,top:t.top-c.scrollTop}}return{left:0,top:0}}render(){const{data:c,style:t,className:e,itemsWrapUI:i,tabIndex:s,navigatable:a}=this.props,n=i||"div";return f.createElement(m.Draggable,{onDragStart:this.onDragStart,onDrag:this.onDragOver,onDragEnd:this.onDragEnd,ref:this.draggableRefAssign},f.createElement(n,{onKeyDown:o=>a&&this.onKeyDown(o),...q,className:e,style:{position:"relative",touchAction:"none",...t},tabIndex:a?s||0:void 0},c&&c.length?this.renderData():this.renderNoData(),this.renderDragCue(),this.showLicenseWatermark&&f.createElement(m.WatermarkOverlay,null)))}};E.defaultProps={navigation:!0,animation:!0,emptyItemUI:c=>f.createElement("div",null,c.message)},E.propTypes={idField:g.string.isRequired,disabledField:g.string,data:g.array.isRequired,tabIndex:g.number,navigation:g.bool,animation:g.bool,itemsWrapUI:g.any,itemUI:g.func.isRequired,emptyItemUI:g.func,style:g.object,className:g.string,onDragStart:g.func,onDragOver:g.func,onDragEnd:g.func,onNavigate:g.func};let S=E;T.registerForLocalization(S);exports.Sortable=S;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),g=require("prop-types"),m=require("@progress/kendo-react-common"),P=require("./events/SortableOnDragStartEvent.js"),U=require("./events/SortableOnDragOverEvent.js"),k=require("./events/SortableOnDragEndEvent.js"),F=require("./events/SortableOnNavigateEvent.js"),O=require("@progress/kendo-react-intl"),R=require("./messages/index.js"),v=require("./utils/utils.js"),x=require("./package-metadata.js");function B(b){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(b){for(const t in b)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(b,t);Object.defineProperty(c,t,e.get?e:{enumerable:!0,get:()=>b[t]})}}return c.default=b,Object.freeze(c)}const f=B(M),A=200,D="data-sortable-id",C="data-sortable-component",T="[data-sortable-id]:not(.k-disabled)",q={[C]:!0},E=class E extends f.Component{constructor(c){super(c),this.state={clientX:0,clientY:0,isDragging:!1,activeId:"",dragCueWidth:0,dragCueHeight:0},this.isRtl=!1,this.itemRefsMap={},this.oldSizesMap={},this.animatingItemMap={},this.draggableRef=null,this.isUnmounted=!1,this.focusActiveId=!1,this.isKeyboardNavigated=!1,this.isDragPrevented=!1,this.showLicenseWatermark=!1,this.windowTimeout=t=>{window.setTimeout(()=>this.animatingItemMap[t]=!1,A)},this.swapItems=(t,e,i)=>{const s=t[e];return t[e]=t[i],t[i]=s,e=i,e},this.generateNewState=(t,e)=>{const{data:i}=this.props,s=[...i];if(t>e)for(let n=t-1;n>=e;n--){const o=i[n];this.isItemDisabled(o)||(t=this.swapItems(s,t,n))}else for(let n=t+1;n<=e;n++){const o=i[n];this.isItemDisabled(o)||(t=this.swapItems(s,t,n))}return s},this.closestSortableItem=t=>{let e=t;for(;e;){const i=e.getAttribute(D);if(i&&this.itemRefsMap[i]===e)return{id:i,element:e};e=e.parentElement}return{id:"",element:null}},this.isSortable=t=>!!t.hasAttribute(C),this.closestSortable=t=>{let e=t;for(;e;){if(this.isSortable(e))return e;e=e.parentElement}return null},this.isSameSortable=t=>this.closestSortable(t)===this.container,this.idComparer=(t,e)=>t+""==e+"",this.findItem=t=>{const{data:e,idField:i}=this.props;if(!(t+""))return;const s=m.getter(i);return v.find(e,a=>this.idComparer(s(a),t))},this.findIndex=t=>{const{data:e,idField:i}=this.props;return t+""?v.findIndex(e,s=>this.idComparer(s[i],t)):-1},this.isItemDisabled=t=>t&&t[this.props.disabledField||""]===!0,this.shouldResetActive=()=>{const t=m.getActiveElement(document);return t instanceof HTMLElement?!this.closestSortableItem(t).element:!1},this.widgetTarget=t=>{const e=v.closest(t,i=>v.hasClasses(i,"k-widget")||this.isSortable(i));return e&&!this.isSortable(e)},this.allowDrag=t=>t.hasAttribute(D)||!(v.isFocusable(t)||this.widgetTarget(t)),this.onDragStart=t=>{const{event:e}=t,{onDragStart:i}=this.props,s=document.elementFromPoint(e.clientX,e.clientY),{id:a,element:n}=this.closestSortableItem(s),o=this.findItem(a);if(!a||o&&this.isItemDisabled(o)||!this.allowDrag(s)||!this.isSameSortable(s)){this.isDragPrevented=!0;return}e.isTouch&&e.originalEvent.preventDefault();const r=new P.SortableOnDragStartEvent(this,this.findIndex(a),s);i&&i.call(void 0,r),this.isDragPrevented=r.isDefaultPrevented(),this.isDragPrevented?e.originalEvent.preventDefault():(this.offsetParent=v.relativeContextElement(this.container),this.setState({activeId:a,dragCueWidth:n&&n.clientWidth||0,dragCueHeight:n&&n.clientHeight||0}))},this.onDragOver=t=>{const{event:e}=t,{onDragOver:i,data:s}=this.props;if(this.isDragPrevented)return;e.originalEvent.preventDefault();const a=this.findIndex(this.state.activeId);if(a===-1){this.resetState();return}const n=document.elementFromPoint(e.clientX,e.clientY),o=this.closestSortableItem(n),r=this.findIndex(o.id),l=s[r];if(i&&r>-1&&a!==r&&!this.isItemDisabled(l)&&!this.animatingItemMap[o.id]&&this.shouldReorder(o.element,e.clientX,e.clientY)){const h=new U.SortableOnDragOverEvent(this,a,r,this.generateNewState(a,r));i.call(void 0,h)}const d=this.parentOffset();this.setState({clientX:e.clientX-d.left,clientY:e.clientY-d.top,isDragging:!0})},this.onDragEnd=t=>{const{event:e}=t,i=this.shouldResetActive();if(this.isDragPrevented)return;const{onDragEnd:s,data:a}=this.props,n=document.elementFromPoint(e.clientX,e.clientY),o=this.closestSortableItem(n);let r=this.findIndex(o.id),l=this.findIndex(this.state.activeId);const d=this.isItemDisabled(a[r]);if((r===-1||d)&&(r=l),s){let h=this.generateNewState(l,r);if(!d){const u=this.thresholdRect(o.element);if(u&&(e.clientX<u.left||e.clientX>u.right||e.clientY<u.top||e.clientY>u.bottom)){const I=l;l=r,r=I,h=this.props.data.slice()}}const p=new k.SortableOnDragEndEvent(this,l,r,h);s.call(void 0,p)}this.resetState(i)},this.shouldReorder=(t,e,i)=>{const s=this.thresholdRect(t);return s&&e>s.left&&e<s.right&&i>s.top&&i<s.bottom},this.thresholdRect=t=>{const e=this.state.activeId,i=this.container,a=(i?Array.from(i.childNodes):[]).find(u=>u instanceof HTMLElement&&u.getAttribute(D)===e);if(!t||!a)return null;const{width:n,height:o}=a.getBoundingClientRect(),r=t.getBoundingClientRect(),l=r.top+r.height/2-o/2,d=r.left+r.width/2-n/2,h=l+o,p=d+n;return{top:l,left:d,bottom:h,right:p}},this.onItemBlur=()=>{window.setTimeout(()=>{this.isUnmounted||this.shouldResetActive()&&!this.state.isDragging&&this.setState({activeId:""})})},this.onItemFocus=t=>{const{id:e,element:i}=this.closestSortableItem(t.currentTarget);!this.idComparer(e,this.state.activeId)&&this.isSameSortable(t.target)&&i===t.target&&this.setState({activeId:e})},this.resetState=t=>{this.isDragPrevented=!1,this.setState({clientX:0,clientY:0,isDragging:!1,dragCueWidth:0,dragCueHeight:0,activeId:t?"":this.state.activeId})},this.renderData=()=>{const{data:t,itemUI:e,idField:i,tabIndex:s,navigatable:a}=this.props;return t.map(n=>{const r=m.getter(i)(n),l=this.isItemDisabled(n),d=this.idComparer(this.state.activeId,r),h=a?d?0:-1:s;return f.createElement(e,{key:r,forwardRef:p=>this.refAssign(p,r),dataItem:n,isDisabled:l,isActive:d,isDragged:d&&this.state.isDragging,isDragCue:!1,attributes:{[D]:r,"aria-disabled":l,"aria-grabbed":d&&this.state.isDragging&&!this.isDragPrevented,"aria-dropeffect":l?"none":"move",tabIndex:m.getTabIndex(h,l),onFocus:this.onItemFocus,onBlur:this.onItemBlur},style:{cursor:l?"auto":"move",MozUserSelect:"none",msUserSelect:"none",WebkitUserSelect:"none",userSelect:"none"}})})},this.renderNoData=()=>{const{emptyItemUI:t}=this.props,i=O.provideLocalizationService(this).toLanguageString(R.noData,R.messages[R.noData]);if(t)return f.createElement(t,{message:i})},this.renderDragCue=()=>{const{itemUI:t}=this.props,{isDragging:e,activeId:i,clientX:s,clientY:a}=this.state,n=this.findItem(i);if(!(!e||!n))return f.createElement(t,{dataItem:n,isDisabled:!1,isActive:!0,isDragged:!0,isDragCue:!0,style:{position:"fixed",top:a+10,left:s+10,width:this.state.dragCueWidth,height:this.state.dragCueHeight},attributes:{}})},this.refAssign=(t,e)=>{t?this.itemRefsMap[e]=t:delete this.itemRefsMap[e]},this.draggableRefAssign=t=>{this.draggableRef=t},this.onKeyDown=t=>{var r,l,d;const{data:e,idField:i}=this.props,{activeId:s}=this.state,a=e.filter(h=>!this.isItemDisabled(h)),n=v.findIndex(a,h=>this.idComparer(h[i],s)),o=n<0?0:n;t.key===m.KEYS.tab&&m.getActiveElement(document)!==((r=this.draggableRef)==null?void 0:r.element)&&(t.preventDefault(),t.stopPropagation()),this.navigation&&((l=this.draggableRef)!=null&&l.element)&&this.navigation.triggerKeyboardEvent({target:(d=this.draggableRef)==null?void 0:d.element.querySelectorAll(T)[o],key:t.key,nativeEvent:{type:t.type},originalEvent:t})},this.handleNext=(t,e,i)=>{var s;m.getActiveElement(document)!==((s=this.draggableRef)==null?void 0:s.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"next"):e.focusNext(t))},this.handlePrev=(t,e,i)=>{var s;m.getActiveElement(document)!==((s=this.draggableRef)==null?void 0:s.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"prev"):e.focusPrevious(t))},this.moveItem=(t,e,i,s)=>{var a;if(m.getActiveElement(document)!==((a=this.draggableRef)==null?void 0:a.element)){const{onNavigate:n,data:o,idField:r}=this.props,l=this.findIndex(this.state.activeId);if(n){let d,h;s==="next"?(d=o[l+1],h=d&&d.disabled?o[l+2]:o[l+1]):(d=o[l-1],h=d&&d.disabled?o[l-2]:o[l-1]);const p=h&&h[r],u=o[l],I=u?u[r]:"",w=this.findIndex(I),y=this.findIndex(p||I),N=new F.SortableOnNavigateEvent(this,w,y,this.generateNewState(w,y));this.isKeyboardNavigated=!0,n.call(void 0,N)}}},this.showLicenseWatermark=!m.validatePackage(x.packageMetadata,{component:"Sortable"}),this.licenseMessage=m.getLicenseMessage(x.packageMetadata),this.onKeyDown=this.onKeyDown.bind(this)}get container(){return this.draggableRef&&this.draggableRef.element}getSnapshotBeforeUpdate(){const{idField:c,animation:t}=this.props;return this.oldSizesMap={},t&&this.props.data.forEach(e=>{const i=e[c],s=this.itemRefsMap[i];s&&(this.oldSizesMap[i]=s.getBoundingClientRect())}),null}componentDidUpdate(c){const{idField:t,animation:e}=this.props;this.focusActiveId&&(this.focusActiveId=!1,this.itemRefsMap[this.state.activeId].focus()),!(!e||!this.state.isDragging&&!this.isKeyboardNavigated)&&(this.isKeyboardNavigated=!1,c.data.forEach(i=>{const s=i[t],a=this.itemRefsMap[s];if(!a)return;const n=a.getBoundingClientRect(),o=this.oldSizesMap[s],r=o.left-n.left,l=o.top-n.top;r===0&&l===0||requestAnimationFrame(()=>{this.animatingItemMap[s]=!0,a.style.transform=`translate(${r}px, ${l}px)`,a.style.transition="transform 0s",requestAnimationFrame(()=>{a.style.transform="",a.style.transition=`transform ${A}ms cubic-bezier(0.2, 0, 0, 1) 0s`,this.windowTimeout(s)})})}))}componentDidMount(){var c,t;(c=this.draggableRef)!=null&&c.element&&(this.navigation=new m.Navigation({tabIndex:0,root:{current:(t=this.draggableRef)==null?void 0:t.element},rovingTabIndex:!0,selectors:[T],keyboardEvents:{keydown:{ArrowDown:this.handleNext,ArrowRight:this.handleNext,ArrowUp:this.handlePrev,ArrowLeft:this.handlePrev,Enter:(e,i,s)=>{i.focusElement(i.first,e)},Escape:(e,i,s)=>{var a,n;e.setAttribute("tabindex","-1"),(n=(a=this.draggableRef)==null?void 0:a.element)==null||n.focus(),this.setState({activeId:""})}}}})),this.isRtl=this.container&&getComputedStyle(this.container).direction==="rtl"||!1}componentWillUnmount(){this.isUnmounted=!0}parentOffset(){const c=this.offsetParent;if(c&&c.ownerDocument&&c!==c.ownerDocument.body){const t=c.getBoundingClientRect();return{left:t.left-c.scrollLeft,top:t.top-c.scrollTop}}return{left:0,top:0}}render(){const{data:c,style:t,className:e,itemsWrapUI:i,tabIndex:s,navigatable:a}=this.props,n=i||"div";return f.createElement(m.Draggable,{onDragStart:this.onDragStart,onDrag:this.onDragOver,onDragEnd:this.onDragEnd,ref:this.draggableRefAssign},f.createElement(n,{onKeyDown:o=>a&&this.onKeyDown(o),...q,className:e,style:{position:"relative",touchAction:"none",...t},tabIndex:a?s||0:void 0},c&&c.length?this.renderData():this.renderNoData(),this.renderDragCue(),this.showLicenseWatermark&&f.createElement(m.WatermarkOverlay,{message:this.licenseMessage})))}};E.defaultProps={navigation:!0,animation:!0,emptyItemUI:c=>f.createElement("div",null,c.message)},E.propTypes={idField:g.string.isRequired,disabledField:g.string,data:g.array.isRequired,tabIndex:g.number,navigation:g.bool,animation:g.bool,itemsWrapUI:g.any,itemUI:g.func.isRequired,emptyItemUI:g.func,style:g.object,className:g.string,onDragStart:g.func,onDragOver:g.func,onDragEnd:g.func,onNavigate:g.func};let S=E;O.registerForLocalization(S);exports.Sortable=S;
package/Sortable.mjs CHANGED
@@ -7,16 +7,16 @@
7
7
  */
8
8
  import * as f from "react";
9
9
  import m from "prop-types";
10
- import { getter as R, getActiveElement as p, getTabIndex as N, KEYS as P, validatePackage as U, Navigation as M, Draggable as O, WatermarkOverlay as F } from "@progress/kendo-react-common";
11
- import { SortableOnDragStartEvent as B } from "./events/SortableOnDragStartEvent.mjs";
12
- import { SortableOnDragOverEvent as k } from "./events/SortableOnDragOverEvent.mjs";
13
- import { SortableOnDragEndEvent as L } from "./events/SortableOnDragEndEvent.mjs";
14
- import { SortableOnNavigateEvent as W } from "./events/SortableOnNavigateEvent.mjs";
15
- import { provideLocalizationService as K, registerForLocalization as Y } from "@progress/kendo-react-intl";
16
- import { noData as w, messages as X } from "./messages/index.mjs";
17
- import { find as z, findIndex as x, closest as H, isFocusable as _, relativeContextElement as q, hasClasses as G } from "./utils/utils.mjs";
18
- import { packageMetadata as $ } from "./package-metadata.mjs";
19
- const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data-sortable-id]:not(.k-disabled)", j = { [T]: !0 }, b = class b extends f.Component {
10
+ import { getter as R, getActiveElement as p, getTabIndex as M, KEYS as P, validatePackage as U, getLicenseMessage as O, Navigation as F, Draggable as B, WatermarkOverlay as k } from "@progress/kendo-react-common";
11
+ import { SortableOnDragStartEvent as L } from "./events/SortableOnDragStartEvent.mjs";
12
+ import { SortableOnDragOverEvent as W } from "./events/SortableOnDragOverEvent.mjs";
13
+ import { SortableOnDragEndEvent as K } from "./events/SortableOnDragEndEvent.mjs";
14
+ import { SortableOnNavigateEvent as Y } from "./events/SortableOnNavigateEvent.mjs";
15
+ import { provideLocalizationService as X, registerForLocalization as z } from "@progress/kendo-react-intl";
16
+ import { noData as w, messages as H } from "./messages/index.mjs";
17
+ import { find as _, findIndex as x, closest as q, isFocusable as G, relativeContextElement as $, hasClasses as j } from "./utils/utils.mjs";
18
+ import { packageMetadata as y } from "./package-metadata.mjs";
19
+ const A = 200, I = "data-sortable-id", C = "data-sortable-component", T = "[data-sortable-id]:not(.k-disabled)", V = { [C]: !0 }, b = class b extends f.Component {
20
20
  constructor(c) {
21
21
  super(c), this.state = {
22
22
  clientX: 0,
@@ -26,7 +26,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
26
26
  dragCueWidth: 0,
27
27
  dragCueHeight: 0
28
28
  }, this.isRtl = !1, this.itemRefsMap = {}, this.oldSizesMap = {}, this.animatingItemMap = {}, this.draggableRef = null, this.isUnmounted = !1, this.focusActiveId = !1, this.isKeyboardNavigated = !1, this.isDragPrevented = !1, this.showLicenseWatermark = !1, this.windowTimeout = (t) => {
29
- window.setTimeout(() => this.animatingItemMap[t] = !1, y);
29
+ window.setTimeout(() => this.animatingItemMap[t] = !1, A);
30
30
  }, this.swapItems = (t, e, i) => {
31
31
  const s = t[e];
32
32
  return t[e] = t[i], t[i] = s, e = i, e;
@@ -58,7 +58,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
58
58
  id: "",
59
59
  element: null
60
60
  };
61
- }, this.isSortable = (t) => !!t.hasAttribute(T), this.closestSortable = (t) => {
61
+ }, this.isSortable = (t) => !!t.hasAttribute(C), this.closestSortable = (t) => {
62
62
  let e = t;
63
63
  for (; e; ) {
64
64
  if (this.isSortable(e))
@@ -71,7 +71,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
71
71
  if (!(t + ""))
72
72
  return;
73
73
  const s = R(i);
74
- return z(e, (a) => this.idComparer(s(a), t));
74
+ return _(e, (a) => this.idComparer(s(a), t));
75
75
  }, this.findIndex = (t) => {
76
76
  const { data: e, idField: i } = this.props;
77
77
  return t + "" ? x(e, (s) => this.idComparer(s[i], t)) : -1;
@@ -79,17 +79,17 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
79
79
  const t = p(document);
80
80
  return t instanceof HTMLElement ? !this.closestSortableItem(t).element : !1;
81
81
  }, this.widgetTarget = (t) => {
82
- const e = H(t, (i) => G(i, "k-widget") || this.isSortable(i));
82
+ const e = q(t, (i) => j(i, "k-widget") || this.isSortable(i));
83
83
  return e && !this.isSortable(e);
84
- }, this.allowDrag = (t) => t.hasAttribute(I) || !(_(t) || this.widgetTarget(t)), this.onDragStart = (t) => {
84
+ }, this.allowDrag = (t) => t.hasAttribute(I) || !(G(t) || this.widgetTarget(t)), this.onDragStart = (t) => {
85
85
  const { event: e } = t, { onDragStart: i } = this.props, s = document.elementFromPoint(e.clientX, e.clientY), { id: a, element: n } = this.closestSortableItem(s), o = this.findItem(a);
86
86
  if (!a || o && this.isItemDisabled(o) || !this.allowDrag(s) || !this.isSameSortable(s)) {
87
87
  this.isDragPrevented = !0;
88
88
  return;
89
89
  }
90
90
  e.isTouch && e.originalEvent.preventDefault();
91
- const r = new B(this, this.findIndex(a), s);
92
- i && i.call(void 0, r), this.isDragPrevented = r.isDefaultPrevented(), this.isDragPrevented ? e.originalEvent.preventDefault() : (this.offsetParent = q(this.container), this.setState({
91
+ const r = new L(this, this.findIndex(a), s);
92
+ i && i.call(void 0, r), this.isDragPrevented = r.isDefaultPrevented(), this.isDragPrevented ? e.originalEvent.preventDefault() : (this.offsetParent = $(this.container), this.setState({
93
93
  activeId: a,
94
94
  dragCueWidth: n && n.clientWidth || 0,
95
95
  dragCueHeight: n && n.clientHeight || 0
@@ -106,7 +106,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
106
106
  }
107
107
  const n = document.elementFromPoint(e.clientX, e.clientY), o = this.closestSortableItem(n), r = this.findIndex(o.id), l = s[r];
108
108
  if (i && r > -1 && a !== r && !this.isItemDisabled(l) && !this.animatingItemMap[o.id] && this.shouldReorder(o.element, e.clientX, e.clientY)) {
109
- const h = new k(
109
+ const h = new W(
110
110
  this,
111
111
  a,
112
112
  r,
@@ -136,7 +136,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
136
136
  l = r, r = v, h = this.props.data.slice();
137
137
  }
138
138
  }
139
- const u = new L(this, l, r, h);
139
+ const u = new K(this, l, r, h);
140
140
  s.call(void 0, u);
141
141
  }
142
142
  this.resetState(i);
@@ -191,7 +191,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
191
191
  "aria-disabled": l,
192
192
  "aria-grabbed": d && this.state.isDragging && !this.isDragPrevented,
193
193
  "aria-dropeffect": l ? "none" : "move",
194
- tabIndex: N(h, l),
194
+ tabIndex: M(h, l),
195
195
  onFocus: this.onItemFocus,
196
196
  onBlur: this.onItemBlur
197
197
  },
@@ -206,7 +206,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
206
206
  );
207
207
  });
208
208
  }, this.renderNoData = () => {
209
- const { emptyItemUI: t } = this.props, i = K(this).toLanguageString(w, X[w]);
209
+ const { emptyItemUI: t } = this.props, i = X(this).toLanguageString(w, H[w]);
210
210
  if (t)
211
211
  return /* @__PURE__ */ f.createElement(t, { message: i });
212
212
  }, this.renderDragCue = () => {
@@ -238,7 +238,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
238
238
  var r, l, d;
239
239
  const { data: e, idField: i } = this.props, { activeId: s } = this.state, a = e.filter((h) => !this.isItemDisabled(h)), n = x(a, (h) => this.idComparer(h[i], s)), o = n < 0 ? 0 : n;
240
240
  t.key === P.tab && p(document) !== ((r = this.draggableRef) == null ? void 0 : r.element) && (t.preventDefault(), t.stopPropagation()), this.navigation && ((l = this.draggableRef) != null && l.element) && this.navigation.triggerKeyboardEvent({
241
- target: (d = this.draggableRef) == null ? void 0 : d.element.querySelectorAll(A)[o],
241
+ target: (d = this.draggableRef) == null ? void 0 : d.element.querySelectorAll(T)[o],
242
242
  key: t.key,
243
243
  nativeEvent: { type: t.type },
244
244
  originalEvent: t
@@ -256,16 +256,16 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
256
256
  if (n) {
257
257
  let d, h;
258
258
  s === "next" ? (d = o[l + 1], h = d && d.disabled ? o[l + 2] : o[l + 1]) : (d = o[l - 1], h = d && d.disabled ? o[l - 2] : o[l - 1]);
259
- const u = h && h[r], g = o[l], v = g ? g[r] : "", S = this.findIndex(v), E = this.findIndex(u || v), C = new W(
259
+ const u = h && h[r], g = o[l], v = g ? g[r] : "", S = this.findIndex(v), E = this.findIndex(u || v), N = new Y(
260
260
  this,
261
261
  S,
262
262
  E,
263
263
  this.generateNewState(S, E)
264
264
  );
265
- this.isKeyboardNavigated = !0, n.call(void 0, C);
265
+ this.isKeyboardNavigated = !0, n.call(void 0, N);
266
266
  }
267
267
  }
268
- }, this.showLicenseWatermark = !U($, { component: "Sortable" }), this.onKeyDown = this.onKeyDown.bind(this);
268
+ }, this.showLicenseWatermark = !U(y, { component: "Sortable" }), this.licenseMessage = O(y), this.onKeyDown = this.onKeyDown.bind(this);
269
269
  }
270
270
  get container() {
271
271
  return this.draggableRef && this.draggableRef.element;
@@ -292,7 +292,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
292
292
  const n = a.getBoundingClientRect(), o = this.oldSizesMap[s], r = o.left - n.left, l = o.top - n.top;
293
293
  r === 0 && l === 0 || requestAnimationFrame(() => {
294
294
  this.animatingItemMap[s] = !0, a.style.transform = `translate(${r}px, ${l}px)`, a.style.transition = "transform 0s", requestAnimationFrame(() => {
295
- a.style.transform = "", a.style.transition = `transform ${y}ms cubic-bezier(0.2, 0, 0, 1) 0s`, this.windowTimeout(s);
295
+ a.style.transform = "", a.style.transition = `transform ${A}ms cubic-bezier(0.2, 0, 0, 1) 0s`, this.windowTimeout(s);
296
296
  });
297
297
  });
298
298
  }));
@@ -302,11 +302,11 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
302
302
  */
303
303
  componentDidMount() {
304
304
  var c, t;
305
- (c = this.draggableRef) != null && c.element && (this.navigation = new M({
305
+ (c = this.draggableRef) != null && c.element && (this.navigation = new F({
306
306
  tabIndex: 0,
307
307
  root: { current: (t = this.draggableRef) == null ? void 0 : t.element },
308
308
  rovingTabIndex: !0,
309
- selectors: [A],
309
+ selectors: [T],
310
310
  keyboardEvents: {
311
311
  keydown: {
312
312
  ArrowDown: this.handleNext,
@@ -347,7 +347,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
347
347
  render() {
348
348
  const { data: c, style: t, className: e, itemsWrapUI: i, tabIndex: s, navigatable: a } = this.props, n = i || "div";
349
349
  return /* @__PURE__ */ f.createElement(
350
- O,
350
+ B,
351
351
  {
352
352
  onDragStart: this.onDragStart,
353
353
  onDrag: this.onDragOver,
@@ -358,7 +358,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
358
358
  n,
359
359
  {
360
360
  onKeyDown: (o) => a && this.onKeyDown(o),
361
- ...j,
361
+ ...V,
362
362
  className: e,
363
363
  style: {
364
364
  position: "relative",
@@ -369,7 +369,7 @@ const y = 200, I = "data-sortable-id", T = "data-sortable-component", A = "[data
369
369
  },
370
370
  c && c.length ? this.renderData() : this.renderNoData(),
371
371
  this.renderDragCue(),
372
- this.showLicenseWatermark && /* @__PURE__ */ f.createElement(F, null)
372
+ this.showLicenseWatermark && /* @__PURE__ */ f.createElement(k, { message: this.licenseMessage })
373
373
  )
374
374
  );
375
375
  }
@@ -396,7 +396,7 @@ b.defaultProps = {
396
396
  onNavigate: m.func
397
397
  };
398
398
  let D = b;
399
- Y(D);
399
+ z(D);
400
400
  export {
401
401
  D as Sortable
402
402
  };
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
14
  */
15
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-intl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactSortable={},t.React,t.PropTypes,t.KendoReactCommon,t.KendoReactIntl)}(this,(function(t,e,i,s,n){"use strict";function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var a=r(e);class o{constructor(){this.prevented=!1}preventDefault(){this.prevented=!0}isDefaultPrevented(){return this.prevented}}let l=class extends o{constructor(t,e,i){super(),this.target=t,this.prevIndex=e,this.element=i}},d=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}},h=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}},c=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}};const g="sortable.noData",m={[g]:"No Data"},u=(t,e)=>{for(let i=0;i<t.length;i++)if(e(t[i]))return i;return-1},p=t=>String(t).trim().split(" "),f=/^(?:a|input|select|option|textarea|button|object)$/i,v=s.hasRelativeStackingContext(),b={name:"@progress/kendo-react-sortable",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"11.4.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},I="data-sortable-id",D="data-sortable-component",S="[data-sortable-id]:not(.k-disabled)",w={[D]:!0},y=class extends a.Component{constructor(t){super(t),this.state={clientX:0,clientY:0,isDragging:!1,activeId:"",dragCueWidth:0,dragCueHeight:0},this.isRtl=!1,this.itemRefsMap={},this.oldSizesMap={},this.animatingItemMap={},this.draggableRef=null,this.isUnmounted=!1,this.focusActiveId=!1,this.isKeyboardNavigated=!1,this.isDragPrevented=!1,this.showLicenseWatermark=!1,this.windowTimeout=t=>{window.setTimeout((()=>this.animatingItemMap[t]=!1),200)},this.swapItems=(t,e,i)=>{const s=t[e];return t[e]=t[i],t[i]=s,e=i},this.generateNewState=(t,e)=>{const{data:i}=this.props,s=[...i];if(t>e)for(let n=t-1;n>=e;n--){const e=i[n];this.isItemDisabled(e)||(t=this.swapItems(s,t,n))}else for(let n=t+1;n<=e;n++){const e=i[n];this.isItemDisabled(e)||(t=this.swapItems(s,t,n))}return s},this.closestSortableItem=t=>{let e=t;for(;e;){const t=e.getAttribute(I);if(t&&this.itemRefsMap[t]===e)return{id:t,element:e};e=e.parentElement}return{id:"",element:null}},this.isSortable=t=>!!t.hasAttribute(D),this.closestSortable=t=>{let e=t;for(;e;){if(this.isSortable(e))return e;e=e.parentElement}return null},this.isSameSortable=t=>this.closestSortable(t)===this.container,this.idComparer=(t,e)=>t+""==e+"",this.findItem=t=>{const{data:e,idField:i}=this.props;if(!(t+""))return;const n=s.getter(i);return((t,e)=>{for(let i=0;i<t.length;i++)if(e(t[i]))return t[i]})(e,(e=>this.idComparer(n(e),t)))},this.findIndex=t=>{const{data:e,idField:i}=this.props;return t+""?u(e,(e=>this.idComparer(e[i],t))):-1},this.isItemDisabled=t=>t&&!0===t[this.props.disabledField||""],this.shouldResetActive=()=>{const t=s.getActiveElement(document);return t instanceof HTMLElement&&!this.closestSortableItem(t).element},this.widgetTarget=t=>{const e=((t,e)=>{for(;t&&!e(t);)t=t.parentNode;return t})(t,(t=>((t,e)=>{const i=p(e);return!!p(t.className).find((t=>i.indexOf(t)>=0))})(t,"k-widget")||this.isSortable(t)));return e&&!this.isSortable(e)},this.allowDrag=t=>t.hasAttribute(I)||!((t=>{if(t.tagName){const e=t.tagName.toLowerCase(),i=t.getAttribute("tabIndex"),s="-1"===i;let n=null!==i&&!s;return f.test(e)&&(n=!t.disabled&&!s),n}return!1})(t)||this.widgetTarget(t)),this.onDragStart=t=>{const{event:e}=t,{onDragStart:i}=this.props,s=document.elementFromPoint(e.clientX,e.clientY),{id:n,element:r}=this.closestSortableItem(s),a=this.findItem(n);if(!n||a&&this.isItemDisabled(a)||!this.allowDrag(s)||!this.isSameSortable(s))return void(this.isDragPrevented=!0);e.isTouch&&e.originalEvent.preventDefault();const o=new l(this,this.findIndex(n),s);i&&i.call(void 0,o),this.isDragPrevented=o.isDefaultPrevented(),this.isDragPrevented?e.originalEvent.preventDefault():(this.offsetParent=(t=>{if(!t||!v)return null;let e=t.parentElement;for(;e;){if("none"!==window.getComputedStyle(e).transform)return e;e=e.parentElement}})(this.container),this.setState({activeId:n,dragCueWidth:r&&r.clientWidth||0,dragCueHeight:r&&r.clientHeight||0}))},this.onDragOver=t=>{const{event:e}=t,{onDragOver:i,data:s}=this.props;if(this.isDragPrevented)return;e.originalEvent.preventDefault();const n=this.findIndex(this.state.activeId);if(-1===n)return void this.resetState();const r=document.elementFromPoint(e.clientX,e.clientY),a=this.closestSortableItem(r),o=this.findIndex(a.id),l=s[o];if(i&&o>-1&&n!==o&&!this.isItemDisabled(l)&&!this.animatingItemMap[a.id]&&this.shouldReorder(a.element,e.clientX,e.clientY)){const t=new d(this,n,o,this.generateNewState(n,o));i.call(void 0,t)}const h=this.parentOffset();this.setState({clientX:e.clientX-h.left,clientY:e.clientY-h.top,isDragging:!0})},this.onDragEnd=t=>{const{event:e}=t,i=this.shouldResetActive();if(this.isDragPrevented)return;const{onDragEnd:s,data:n}=this.props,r=document.elementFromPoint(e.clientX,e.clientY),a=this.closestSortableItem(r);let o=this.findIndex(a.id),l=this.findIndex(this.state.activeId);const d=this.isItemDisabled(n[o]);if((-1===o||d)&&(o=l),s){let t=this.generateNewState(l,o);if(!d){const i=this.thresholdRect(a.element);if(i&&(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)){const e=l;l=o,o=e,t=this.props.data.slice()}}const i=new h(this,l,o,t);s.call(void 0,i)}this.resetState(i)},this.shouldReorder=(t,e,i)=>{const s=this.thresholdRect(t);return s&&e>s.left&&e<s.right&&i>s.top&&i<s.bottom},this.thresholdRect=t=>{const e=this.state.activeId,i=this.container,s=(i?Array.from(i.childNodes):[]).find((t=>t instanceof HTMLElement&&t.getAttribute(I)===e));if(!t||!s)return null;const{width:n,height:r}=s.getBoundingClientRect(),a=t.getBoundingClientRect(),o=a.top+a.height/2-r/2,l=a.left+a.width/2-n/2;return{top:o,left:l,bottom:o+r,right:l+n}},this.onItemBlur=()=>{window.setTimeout((()=>{this.isUnmounted||this.shouldResetActive()&&!this.state.isDragging&&this.setState({activeId:""})}))},this.onItemFocus=t=>{const{id:e,element:i}=this.closestSortableItem(t.currentTarget);!this.idComparer(e,this.state.activeId)&&this.isSameSortable(t.target)&&i===t.target&&this.setState({activeId:e})},this.resetState=t=>{this.isDragPrevented=!1,this.setState({clientX:0,clientY:0,isDragging:!1,dragCueWidth:0,dragCueHeight:0,activeId:t?"":this.state.activeId})},this.renderData=()=>{const{data:t,itemUI:e,idField:i,tabIndex:n,navigatable:r}=this.props;return t.map((t=>{const o=s.getter(i)(t),l=this.isItemDisabled(t),d=this.idComparer(this.state.activeId,o),h=r?d?0:-1:n;return a.createElement(e,{key:o,forwardRef:t=>this.refAssign(t,o),dataItem:t,isDisabled:l,isActive:d,isDragged:d&&this.state.isDragging,isDragCue:!1,attributes:{[I]:o,"aria-disabled":l,"aria-grabbed":d&&this.state.isDragging&&!this.isDragPrevented,"aria-dropeffect":l?"none":"move",tabIndex:s.getTabIndex(h,l),onFocus:this.onItemFocus,onBlur:this.onItemBlur},style:{cursor:l?"auto":"move",MozUserSelect:"none",msUserSelect:"none",WebkitUserSelect:"none",userSelect:"none"}})}))},this.renderNoData=()=>{const{emptyItemUI:t}=this.props,e=n.provideLocalizationService(this).toLanguageString(g,m[g]);if(t)return a.createElement(t,{message:e})},this.renderDragCue=()=>{const{itemUI:t}=this.props,{isDragging:e,activeId:i,clientX:s,clientY:n}=this.state,r=this.findItem(i);if(e&&r)return a.createElement(t,{dataItem:r,isDisabled:!1,isActive:!0,isDragged:!0,isDragCue:!0,style:{position:"fixed",top:n+10,left:s+10,width:this.state.dragCueWidth,height:this.state.dragCueHeight},attributes:{}})},this.refAssign=(t,e)=>{t?this.itemRefsMap[e]=t:delete this.itemRefsMap[e]},this.draggableRefAssign=t=>{this.draggableRef=t},this.onKeyDown=t=>{var e,i,n;const{data:r,idField:a}=this.props,{activeId:o}=this.state,l=r.filter((t=>!this.isItemDisabled(t))),d=u(l,(t=>this.idComparer(t[a],o))),h=d<0?0:d;t.key===s.KEYS.tab&&s.getActiveElement(document)!==(null==(e=this.draggableRef)?void 0:e.element)&&(t.preventDefault(),t.stopPropagation()),this.navigation&&null!=(i=this.draggableRef)&&i.element&&this.navigation.triggerKeyboardEvent({target:null==(n=this.draggableRef)?void 0:n.element.querySelectorAll(S)[h],key:t.key,nativeEvent:{type:t.type},originalEvent:t})},this.handleNext=(t,e,i)=>{var n;s.getActiveElement(document)!==(null==(n=this.draggableRef)?void 0:n.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"next"):e.focusNext(t))},this.handlePrev=(t,e,i)=>{var n;s.getActiveElement(document)!==(null==(n=this.draggableRef)?void 0:n.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"prev"):e.focusPrevious(t))},this.moveItem=(t,e,i,n)=>{var r;if(s.getActiveElement(document)!==(null==(r=this.draggableRef)?void 0:r.element)){const{onNavigate:t,data:e,idField:i}=this.props,s=this.findIndex(this.state.activeId);if(t){let r,a;"next"===n?(r=e[s+1],a=r&&r.disabled?e[s+2]:e[s+1]):(r=e[s-1],a=r&&r.disabled?e[s-2]:e[s-1]);const o=a&&a[i],l=e[s],d=l?l[i]:"",h=this.findIndex(d),g=this.findIndex(o||d),m=new c(this,h,g,this.generateNewState(h,g));this.isKeyboardNavigated=!0,t.call(void 0,m)}}},this.showLicenseWatermark=!s.validatePackage(b,{component:"Sortable"}),this.onKeyDown=this.onKeyDown.bind(this)}get container(){return this.draggableRef&&this.draggableRef.element}getSnapshotBeforeUpdate(){const{idField:t,animation:e}=this.props;return this.oldSizesMap={},e&&this.props.data.forEach((e=>{const i=e[t],s=this.itemRefsMap[i];s&&(this.oldSizesMap[i]=s.getBoundingClientRect())})),null}componentDidUpdate(t){const{idField:e,animation:i}=this.props;this.focusActiveId&&(this.focusActiveId=!1,this.itemRefsMap[this.state.activeId].focus()),i&&(this.state.isDragging||this.isKeyboardNavigated)&&(this.isKeyboardNavigated=!1,t.data.forEach((t=>{const i=t[e],s=this.itemRefsMap[i];if(!s)return;const n=s.getBoundingClientRect(),r=this.oldSizesMap[i],a=r.left-n.left,o=r.top-n.top;0===a&&0===o||requestAnimationFrame((()=>{this.animatingItemMap[i]=!0,s.style.transform=`translate(${a}px, ${o}px)`,s.style.transition="transform 0s",requestAnimationFrame((()=>{s.style.transform="",s.style.transition="transform 200ms cubic-bezier(0.2, 0, 0, 1) 0s",this.windowTimeout(i)}))}))})))}componentDidMount(){var t,e;null!=(t=this.draggableRef)&&t.element&&(this.navigation=new s.Navigation({tabIndex:0,root:{current:null==(e=this.draggableRef)?void 0:e.element},rovingTabIndex:!0,selectors:[S],keyboardEvents:{keydown:{ArrowDown:this.handleNext,ArrowRight:this.handleNext,ArrowUp:this.handlePrev,ArrowLeft:this.handlePrev,Enter:(t,e,i)=>{e.focusElement(e.first,t)},Escape:(t,e,i)=>{var s,n;t.setAttribute("tabindex","-1"),null==(n=null==(s=this.draggableRef)?void 0:s.element)||n.focus(),this.setState({activeId:""})}}}})),this.isRtl=this.container&&"rtl"===getComputedStyle(this.container).direction||!1}componentWillUnmount(){this.isUnmounted=!0}parentOffset(){const t=this.offsetParent;if(t&&t.ownerDocument&&t!==t.ownerDocument.body){const e=t.getBoundingClientRect();return{left:e.left-t.scrollLeft,top:e.top-t.scrollTop}}return{left:0,top:0}}render(){const{data:t,style:e,className:i,itemsWrapUI:n,tabIndex:r,navigatable:o}=this.props,l=n||"div";return a.createElement(s.Draggable,{onDragStart:this.onDragStart,onDrag:this.onDragOver,onDragEnd:this.onDragEnd,ref:this.draggableRefAssign},a.createElement(l,{onKeyDown:t=>o&&this.onKeyDown(t),...w,className:i,style:{position:"relative",touchAction:"none",...e},tabIndex:o?r||0:void 0},t&&t.length?this.renderData():this.renderNoData(),this.renderDragCue(),this.showLicenseWatermark&&a.createElement(s.WatermarkOverlay,null)))}};y.defaultProps={navigation:!0,animation:!0,emptyItemUI:t=>a.createElement("div",null,t.message)},y.propTypes={idField:i.string.isRequired,disabledField:i.string,data:i.array.isRequired,tabIndex:i.number,navigation:i.bool,animation:i.bool,itemsWrapUI:i.any,itemUI:i.func.isRequired,emptyItemUI:i.func,style:i.object,className:i.string,onDragStart:i.func,onDragOver:i.func,onDragEnd:i.func,onNavigate:i.func};let R=y;n.registerForLocalization(R),t.Sortable=R,t.SortableOnDragEndEvent=h,t.SortableOnDragOverEvent=d,t.SortableOnDragStartEvent=l,t.SortableOnNavigateEvent=c}));
15
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-intl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactSortable={},t.React,t.PropTypes,t.KendoReactCommon,t.KendoReactIntl)}(this,(function(t,e,i,s,n){"use strict";function a(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var r=a(e);class o{constructor(){this.prevented=!1}preventDefault(){this.prevented=!0}isDefaultPrevented(){return this.prevented}}let l=class extends o{constructor(t,e,i){super(),this.target=t,this.prevIndex=e,this.element=i}},d=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}},h=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}},c=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}};const g="sortable.noData",m={[g]:"No Data"},u=(t,e)=>{for(let i=0;i<t.length;i++)if(e(t[i]))return i;return-1},p=t=>String(t).trim().split(" "),f=/^(?:a|input|select|option|textarea|button|object)$/i,v=s.hasRelativeStackingContext(),b={name:"@progress/kendo-react-sortable",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"11.4.0-develop.8",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},I="data-sortable-id",D="data-sortable-component",S="[data-sortable-id]:not(.k-disabled)",w={[D]:!0},y=class extends r.Component{constructor(t){super(t),this.state={clientX:0,clientY:0,isDragging:!1,activeId:"",dragCueWidth:0,dragCueHeight:0},this.isRtl=!1,this.itemRefsMap={},this.oldSizesMap={},this.animatingItemMap={},this.draggableRef=null,this.isUnmounted=!1,this.focusActiveId=!1,this.isKeyboardNavigated=!1,this.isDragPrevented=!1,this.showLicenseWatermark=!1,this.windowTimeout=t=>{window.setTimeout((()=>this.animatingItemMap[t]=!1),200)},this.swapItems=(t,e,i)=>{const s=t[e];return t[e]=t[i],t[i]=s,e=i},this.generateNewState=(t,e)=>{const{data:i}=this.props,s=[...i];if(t>e)for(let n=t-1;n>=e;n--){const e=i[n];this.isItemDisabled(e)||(t=this.swapItems(s,t,n))}else for(let n=t+1;n<=e;n++){const e=i[n];this.isItemDisabled(e)||(t=this.swapItems(s,t,n))}return s},this.closestSortableItem=t=>{let e=t;for(;e;){const t=e.getAttribute(I);if(t&&this.itemRefsMap[t]===e)return{id:t,element:e};e=e.parentElement}return{id:"",element:null}},this.isSortable=t=>!!t.hasAttribute(D),this.closestSortable=t=>{let e=t;for(;e;){if(this.isSortable(e))return e;e=e.parentElement}return null},this.isSameSortable=t=>this.closestSortable(t)===this.container,this.idComparer=(t,e)=>t+""==e+"",this.findItem=t=>{const{data:e,idField:i}=this.props;if(!(t+""))return;const n=s.getter(i);return((t,e)=>{for(let i=0;i<t.length;i++)if(e(t[i]))return t[i]})(e,(e=>this.idComparer(n(e),t)))},this.findIndex=t=>{const{data:e,idField:i}=this.props;return t+""?u(e,(e=>this.idComparer(e[i],t))):-1},this.isItemDisabled=t=>t&&!0===t[this.props.disabledField||""],this.shouldResetActive=()=>{const t=s.getActiveElement(document);return t instanceof HTMLElement&&!this.closestSortableItem(t).element},this.widgetTarget=t=>{const e=((t,e)=>{for(;t&&!e(t);)t=t.parentNode;return t})(t,(t=>((t,e)=>{const i=p(e);return!!p(t.className).find((t=>i.indexOf(t)>=0))})(t,"k-widget")||this.isSortable(t)));return e&&!this.isSortable(e)},this.allowDrag=t=>t.hasAttribute(I)||!((t=>{if(t.tagName){const e=t.tagName.toLowerCase(),i=t.getAttribute("tabIndex"),s="-1"===i;let n=null!==i&&!s;return f.test(e)&&(n=!t.disabled&&!s),n}return!1})(t)||this.widgetTarget(t)),this.onDragStart=t=>{const{event:e}=t,{onDragStart:i}=this.props,s=document.elementFromPoint(e.clientX,e.clientY),{id:n,element:a}=this.closestSortableItem(s),r=this.findItem(n);if(!n||r&&this.isItemDisabled(r)||!this.allowDrag(s)||!this.isSameSortable(s))return void(this.isDragPrevented=!0);e.isTouch&&e.originalEvent.preventDefault();const o=new l(this,this.findIndex(n),s);i&&i.call(void 0,o),this.isDragPrevented=o.isDefaultPrevented(),this.isDragPrevented?e.originalEvent.preventDefault():(this.offsetParent=(t=>{if(!t||!v)return null;let e=t.parentElement;for(;e;){if("none"!==window.getComputedStyle(e).transform)return e;e=e.parentElement}})(this.container),this.setState({activeId:n,dragCueWidth:a&&a.clientWidth||0,dragCueHeight:a&&a.clientHeight||0}))},this.onDragOver=t=>{const{event:e}=t,{onDragOver:i,data:s}=this.props;if(this.isDragPrevented)return;e.originalEvent.preventDefault();const n=this.findIndex(this.state.activeId);if(-1===n)return void this.resetState();const a=document.elementFromPoint(e.clientX,e.clientY),r=this.closestSortableItem(a),o=this.findIndex(r.id),l=s[o];if(i&&o>-1&&n!==o&&!this.isItemDisabled(l)&&!this.animatingItemMap[r.id]&&this.shouldReorder(r.element,e.clientX,e.clientY)){const t=new d(this,n,o,this.generateNewState(n,o));i.call(void 0,t)}const h=this.parentOffset();this.setState({clientX:e.clientX-h.left,clientY:e.clientY-h.top,isDragging:!0})},this.onDragEnd=t=>{const{event:e}=t,i=this.shouldResetActive();if(this.isDragPrevented)return;const{onDragEnd:s,data:n}=this.props,a=document.elementFromPoint(e.clientX,e.clientY),r=this.closestSortableItem(a);let o=this.findIndex(r.id),l=this.findIndex(this.state.activeId);const d=this.isItemDisabled(n[o]);if((-1===o||d)&&(o=l),s){let t=this.generateNewState(l,o);if(!d){const i=this.thresholdRect(r.element);if(i&&(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)){const e=l;l=o,o=e,t=this.props.data.slice()}}const i=new h(this,l,o,t);s.call(void 0,i)}this.resetState(i)},this.shouldReorder=(t,e,i)=>{const s=this.thresholdRect(t);return s&&e>s.left&&e<s.right&&i>s.top&&i<s.bottom},this.thresholdRect=t=>{const e=this.state.activeId,i=this.container,s=(i?Array.from(i.childNodes):[]).find((t=>t instanceof HTMLElement&&t.getAttribute(I)===e));if(!t||!s)return null;const{width:n,height:a}=s.getBoundingClientRect(),r=t.getBoundingClientRect(),o=r.top+r.height/2-a/2,l=r.left+r.width/2-n/2;return{top:o,left:l,bottom:o+a,right:l+n}},this.onItemBlur=()=>{window.setTimeout((()=>{this.isUnmounted||this.shouldResetActive()&&!this.state.isDragging&&this.setState({activeId:""})}))},this.onItemFocus=t=>{const{id:e,element:i}=this.closestSortableItem(t.currentTarget);!this.idComparer(e,this.state.activeId)&&this.isSameSortable(t.target)&&i===t.target&&this.setState({activeId:e})},this.resetState=t=>{this.isDragPrevented=!1,this.setState({clientX:0,clientY:0,isDragging:!1,dragCueWidth:0,dragCueHeight:0,activeId:t?"":this.state.activeId})},this.renderData=()=>{const{data:t,itemUI:e,idField:i,tabIndex:n,navigatable:a}=this.props;return t.map((t=>{const o=s.getter(i)(t),l=this.isItemDisabled(t),d=this.idComparer(this.state.activeId,o),h=a?d?0:-1:n;return r.createElement(e,{key:o,forwardRef:t=>this.refAssign(t,o),dataItem:t,isDisabled:l,isActive:d,isDragged:d&&this.state.isDragging,isDragCue:!1,attributes:{[I]:o,"aria-disabled":l,"aria-grabbed":d&&this.state.isDragging&&!this.isDragPrevented,"aria-dropeffect":l?"none":"move",tabIndex:s.getTabIndex(h,l),onFocus:this.onItemFocus,onBlur:this.onItemBlur},style:{cursor:l?"auto":"move",MozUserSelect:"none",msUserSelect:"none",WebkitUserSelect:"none",userSelect:"none"}})}))},this.renderNoData=()=>{const{emptyItemUI:t}=this.props,e=n.provideLocalizationService(this).toLanguageString(g,m[g]);if(t)return r.createElement(t,{message:e})},this.renderDragCue=()=>{const{itemUI:t}=this.props,{isDragging:e,activeId:i,clientX:s,clientY:n}=this.state,a=this.findItem(i);if(e&&a)return r.createElement(t,{dataItem:a,isDisabled:!1,isActive:!0,isDragged:!0,isDragCue:!0,style:{position:"fixed",top:n+10,left:s+10,width:this.state.dragCueWidth,height:this.state.dragCueHeight},attributes:{}})},this.refAssign=(t,e)=>{t?this.itemRefsMap[e]=t:delete this.itemRefsMap[e]},this.draggableRefAssign=t=>{this.draggableRef=t},this.onKeyDown=t=>{var e,i,n;const{data:a,idField:r}=this.props,{activeId:o}=this.state,l=a.filter((t=>!this.isItemDisabled(t))),d=u(l,(t=>this.idComparer(t[r],o))),h=d<0?0:d;t.key===s.KEYS.tab&&s.getActiveElement(document)!==(null==(e=this.draggableRef)?void 0:e.element)&&(t.preventDefault(),t.stopPropagation()),this.navigation&&null!=(i=this.draggableRef)&&i.element&&this.navigation.triggerKeyboardEvent({target:null==(n=this.draggableRef)?void 0:n.element.querySelectorAll(S)[h],key:t.key,nativeEvent:{type:t.type},originalEvent:t})},this.handleNext=(t,e,i)=>{var n;s.getActiveElement(document)!==(null==(n=this.draggableRef)?void 0:n.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"next"):e.focusNext(t))},this.handlePrev=(t,e,i)=>{var n;s.getActiveElement(document)!==(null==(n=this.draggableRef)?void 0:n.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"prev"):e.focusPrevious(t))},this.moveItem=(t,e,i,n)=>{var a;if(s.getActiveElement(document)!==(null==(a=this.draggableRef)?void 0:a.element)){const{onNavigate:t,data:e,idField:i}=this.props,s=this.findIndex(this.state.activeId);if(t){let a,r;"next"===n?(a=e[s+1],r=a&&a.disabled?e[s+2]:e[s+1]):(a=e[s-1],r=a&&a.disabled?e[s-2]:e[s-1]);const o=r&&r[i],l=e[s],d=l?l[i]:"",h=this.findIndex(d),g=this.findIndex(o||d),m=new c(this,h,g,this.generateNewState(h,g));this.isKeyboardNavigated=!0,t.call(void 0,m)}}},this.showLicenseWatermark=!s.validatePackage(b,{component:"Sortable"}),this.licenseMessage=s.getLicenseMessage(b),this.onKeyDown=this.onKeyDown.bind(this)}get container(){return this.draggableRef&&this.draggableRef.element}getSnapshotBeforeUpdate(){const{idField:t,animation:e}=this.props;return this.oldSizesMap={},e&&this.props.data.forEach((e=>{const i=e[t],s=this.itemRefsMap[i];s&&(this.oldSizesMap[i]=s.getBoundingClientRect())})),null}componentDidUpdate(t){const{idField:e,animation:i}=this.props;this.focusActiveId&&(this.focusActiveId=!1,this.itemRefsMap[this.state.activeId].focus()),i&&(this.state.isDragging||this.isKeyboardNavigated)&&(this.isKeyboardNavigated=!1,t.data.forEach((t=>{const i=t[e],s=this.itemRefsMap[i];if(!s)return;const n=s.getBoundingClientRect(),a=this.oldSizesMap[i],r=a.left-n.left,o=a.top-n.top;0===r&&0===o||requestAnimationFrame((()=>{this.animatingItemMap[i]=!0,s.style.transform=`translate(${r}px, ${o}px)`,s.style.transition="transform 0s",requestAnimationFrame((()=>{s.style.transform="",s.style.transition="transform 200ms cubic-bezier(0.2, 0, 0, 1) 0s",this.windowTimeout(i)}))}))})))}componentDidMount(){var t,e;null!=(t=this.draggableRef)&&t.element&&(this.navigation=new s.Navigation({tabIndex:0,root:{current:null==(e=this.draggableRef)?void 0:e.element},rovingTabIndex:!0,selectors:[S],keyboardEvents:{keydown:{ArrowDown:this.handleNext,ArrowRight:this.handleNext,ArrowUp:this.handlePrev,ArrowLeft:this.handlePrev,Enter:(t,e,i)=>{e.focusElement(e.first,t)},Escape:(t,e,i)=>{var s,n;t.setAttribute("tabindex","-1"),null==(n=null==(s=this.draggableRef)?void 0:s.element)||n.focus(),this.setState({activeId:""})}}}})),this.isRtl=this.container&&"rtl"===getComputedStyle(this.container).direction||!1}componentWillUnmount(){this.isUnmounted=!0}parentOffset(){const t=this.offsetParent;if(t&&t.ownerDocument&&t!==t.ownerDocument.body){const e=t.getBoundingClientRect();return{left:e.left-t.scrollLeft,top:e.top-t.scrollTop}}return{left:0,top:0}}render(){const{data:t,style:e,className:i,itemsWrapUI:n,tabIndex:a,navigatable:o}=this.props,l=n||"div";return r.createElement(s.Draggable,{onDragStart:this.onDragStart,onDrag:this.onDragOver,onDragEnd:this.onDragEnd,ref:this.draggableRefAssign},r.createElement(l,{onKeyDown:t=>o&&this.onKeyDown(t),...w,className:i,style:{position:"relative",touchAction:"none",...e},tabIndex:o?a||0:void 0},t&&t.length?this.renderData():this.renderNoData(),this.renderDragCue(),this.showLicenseWatermark&&r.createElement(s.WatermarkOverlay,{message:this.licenseMessage})))}};y.defaultProps={navigation:!0,animation:!0,emptyItemUI:t=>r.createElement("div",null,t.message)},y.propTypes={idField:i.string.isRequired,disabledField:i.string,data:i.array.isRequired,tabIndex:i.number,navigation:i.bool,animation:i.bool,itemsWrapUI:i.any,itemUI:i.func.isRequired,emptyItemUI:i.func,style:i.object,className:i.string,onDragStart:i.func,onDragOver:i.func,onDragEnd:i.func,onNavigate:i.func};let R=y;n.registerForLocalization(R),t.Sortable=R,t.SortableOnDragEndEvent=h,t.SortableOnDragOverEvent=d,t.SortableOnDragStartEvent=l,t.SortableOnNavigateEvent=c}));
package/index.d.mts CHANGED
@@ -91,6 +91,7 @@ export declare class Sortable extends React_2.Component<SortableProps, SortableS
91
91
  private isDragPrevented;
92
92
  private navigation?;
93
93
  private readonly showLicenseWatermark;
94
+ private readonly licenseMessage?;
94
95
  constructor(props: SortableProps);
95
96
  /**
96
97
  * @hidden
package/index.d.ts CHANGED
@@ -91,6 +91,7 @@ export declare class Sortable extends React_2.Component<SortableProps, SortableS
91
91
  private isDragPrevented;
92
92
  private navigation?;
93
93
  private readonly showLicenseWatermark;
94
+ private readonly licenseMessage?;
94
95
  constructor(props: SortableProps);
95
96
  /**
96
97
  * @hidden
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-sortable",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1754381683,version:"11.4.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-sortable",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1754642791,version:"11.4.0-develop.8",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
@@ -10,8 +10,8 @@ const e = {
10
10
  productName: "KendoReact",
11
11
  productCode: "KENDOUIREACT",
12
12
  productCodes: ["KENDOUIREACT"],
13
- publishDate: 1754381683,
14
- version: "11.4.0-develop.6",
13
+ publishDate: 1754642791,
14
+ version: "11.4.0-develop.8",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
16
16
  };
17
17
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-sortable",
3
- "version": "11.4.0-develop.6",
3
+ "version": "11.4.0-develop.8",
4
4
  "description": "React Sortable provides a sortable drag-and-drop functionality to elements within a list. KendoReact Sortable package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "sideEffects": false,
27
27
  "peerDependencies": {
28
- "@progress/kendo-licensing": "^1.6.0",
29
- "@progress/kendo-react-common": "11.4.0-develop.6",
30
- "@progress/kendo-react-intl": "11.4.0-develop.6",
28
+ "@progress/kendo-licensing": "^1.7.0",
29
+ "@progress/kendo-react-common": "11.4.0-develop.8",
30
+ "@progress/kendo-react-intl": "11.4.0-develop.8",
31
31
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
32
32
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
33
33
  },
@@ -52,7 +52,7 @@
52
52
  "package": {
53
53
  "productName": "KendoReact",
54
54
  "productCode": "KENDOUIREACT",
55
- "publishDate": 1754381683,
55
+ "publishDate": 1754642791,
56
56
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
57
57
  }
58
58
  },