datatables.net-colreorder
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -1,2 +0,2 @@ | ||
/*! ColReorder 2.0.3 | ||
/*! ColReorder 2.0.4 | ||
* © SpryMedia Ltd - datatables.net/license | ||
@@ -848,7 +848,7 @@ */ | ||
}; | ||
ColReorder.version = '2.0.3'; | ||
ColReorder.version = '2.0.4'; | ||
return ColReorder; | ||
}()); | ||
/*! ColReorder 2.0.3 | ||
/*! ColReorder 2.0.4 | ||
* © SpryMedia Ltd - datatables.net/license | ||
@@ -859,3 +859,3 @@ */ | ||
* @description Provide the ability to reorder columns in a DataTable | ||
* @version 2.0.3 | ||
* @version 2.0.4 | ||
* @author SpryMedia Ltd | ||
@@ -962,13 +962,15 @@ * @contact datatables.net | ||
// column indexes need to be updated for where those columns | ||
// currently are. | ||
var map = invertKeyValues(state.colReorder); | ||
// currently are. Any properties which refer to column indexes | ||
// would need to be updated here. | ||
// State's ordering indexes | ||
orderingIndexes(map, state.order); | ||
orderingIndexes(state.colReorder, state.order); | ||
// State's columns array - sort by restore index | ||
for (var i = 0; i < state.columns.length; i++) { | ||
state.columns[i]._cr_sort = state.colReorder[i]; | ||
if (state.columns) { | ||
for (var i = 0; i < state.columns.length; i++) { | ||
state.columns[i]._cr_sort = state.colReorder[i]; | ||
} | ||
state.columns.sort(function (a, b) { | ||
return a._cr_sort - b._cr_sort; | ||
}); | ||
} | ||
state.columns.sort(function (a, b) { | ||
return a._cr_sort - b._cr_sort; | ||
}); | ||
} | ||
@@ -975,0 +977,0 @@ } |
@@ -1,7 +0,7 @@ | ||
/*! ColReorder 2.0.3 | ||
/*! ColReorder 2.0.4 | ||
* © SpryMedia Ltd - datatables.net/license | ||
*/ | ||
!function(r){var o,n;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return r(t,window,document)}):"object"==typeof exports?(o=require("jquery"),n=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||o(t),n(t,e),r(e,0,t.document)}:(n(window,o),module.exports=r(o,window,window.document))):r(jQuery,window,document)}(function(u,t,h){"use strict";var n=u.fn.dataTable;function f(t,e,r,o){var n=t.splice(e,r);n.unshift(0),n.unshift(o<e?o:o-r+1),t.splice.apply(t,n)}function l(t){t.rows().invalidate("data"),t.column(0).visible(t.column(0).visible()),t.columns.adjust();var e=t.colReorder.order();t.trigger("columns-reordered",[{order:e,mapping:g(e)}])}function s(t){return t.settings()[0].aoColumns.map(function(t){return t._crOriginalIdx})}function p(t,e,r,o){for(var n=[],s=0;s<t.length;s++){var i=t[s];f(i,r[0],r.length,o);for(var l=0;l<i.length;l++){var a,d=i[l].cell;n.includes(d)||(a=d.getAttribute("data-dt-column").split(",").map(function(t){return e[t]}).join(","),d.setAttribute("data-dt-column",a),n.push(d))}}}function i(t){t.columns().iterator("column",function(t,e){t=t.aoColumns;void 0===t[e]._crOriginalIdx&&(t[e]._crOriginalIdx=e)})}function g(t){for(var e=[],r=0;r<t.length;r++)e[t[r]]=r;return e}function a(t,e,r){var o,n=t.settings()[0],s=n.aoColumns,i=s.map(function(t,e){return e});if(!e.includes(r)){f(i,e[0],e.length,r);var l=g(i);for(f(s,e[0],e.length,r),o=0;o<n.aoData.length;o++){var a=n.aoData[o];if(a){var d=a.anCells;if(d)for(f(d,e[0],e.length,r),u=0;u<d.length;u++)a.nTr&&d[u]&&s[u].bVisible&&a.nTr.appendChild(d[u]),d[u]&&d[u]._DT_CellIndex&&(d[u]._DT_CellIndex.column=u)}}for(o=0;o<s.length;o++){for(var c=s[o],u=0;u<c.aDataSort.length;u++)c.aDataSort[u]=l[c.aDataSort[u]];c.idx=l[c.idx],c.bVisible&&n.colgroup.append(c.colEl)}p(n.aoHeader,l,e,r),p(n.aoFooter,l,e,r),f(n.aoPreSearchCols,e[0],e.length,r),m(l,n.aaSorting),Array.isArray(n.aaSortingFixed)?m(l,n.aaSortingFixed):(n.aaSortingFixed.pre||n.aaSortingFixed.post)&&m(l,n.aaSortingFixed.pre),n.aLastSort.forEach(function(t){t.src=l[t.src]}),t.trigger("column-reorder",[t.settings()[0],{from:e,to:r,mapping:l}])}}function m(t,e){if(e)for(var r=0;r<e.length;r++){var o=e[r];"number"==typeof o?e[r]=t[o]:u.isPlainObject(o)&&void 0!==o.idx?o.idx=t[o.idx]:Array.isArray(o)&&"number"==typeof o[0]&&(o[0]=t[o[0]])}}function d(t,e,r){var o=!1;if(e.length!==t.columns().count())t.error("ColReorder - column count mismatch");else{for(var n=g(e=r?c(t,e,"toCurrent"):e),s=0;s<n.length;s++){var i=n.indexOf(s);s!==i&&(f(n,i,1,s),a(t,[i],s),o=!0)}o&&l(t)}}function c(t,e,r){var o=t.colReorder.order(),n=t.settings()[0].aoColumns;return"toCurrent"===r||"fromOriginal"===r?Array.isArray(e)?e.map(function(t){return o.indexOf(t)}):o.indexOf(e):Array.isArray(e)?e.map(function(t){return n[t]._crOriginalIdx}):n[e]._crOriginalIdx}function v(t,e,r){var o=t.columns().count();return!(e[0]<r&&r<e[e.length]||e[0]<0&&e[e.length-1]>o||r<0&&o<r||!e.includes(r)&&(!y(t.table().header.structure(),e,r)||!y(t.table().footer.structure(),e,r)))}function y(t,e,r){for(var o=function(t){for(var e=[],r=0;r<t.length;r++){e.push([]);for(var o=0;o<t[r].length;o++){var n=t[r][o];if(n)for(var s=0;s<n.rowspan;s++){e[r+s]||(e[r+s]=[]);for(var i=0;i<n.colspan;i++)e[r+s][o+i]=n.cell}}}return e}(t),n=0;n<o.length;n++)f(o[n],e[0],e.length,r);for(n=0;n<o.length;n++)for(var s=[],i=0;i<o[n].length;i++){var l=o[n][i];if(s.includes(l)){if(s[s.length-1]!==l)return}else s.push(l)}return 1}_.prototype.disable=function(){return this.c.enable=!1,this},_.prototype.enable=function(t){return!1===(t=void 0===t?!0:t)?this.disable():(this.c.enable=!0,this)},_.prototype._addListener=function(t){var e=this;u(t).on("selectstart.colReorder",function(){return!1}).on("mousedown.colReorder touchstart.colReorder",function(t){"mousedown"===t.type&&1!==t.which||e.c.enable&&e._mouseDown(t,this)})},_.prototype._createDragNode=function(){var t=this.s.mouse.target,e=t.parent(),r=e.parent(),o=r.parent(),n=t.clone();this.dom.drag=u(o[0].cloneNode(!1)).addClass("dtcr-cloned").append(u(r[0].cloneNode(!1)).append(u(e[0].cloneNode(!1)).append(n[0]))).css({position:"absolute",top:0,left:0,width:u(t).outerWidth(),height:u(t).outerHeight()}).appendTo("body")},_.prototype._cursorPosition=function(t,e){return(-1!==t.type.indexOf("touch")?t.originalEvent.touches[0]:t)[e]},_.prototype._mouseDown=function(t,e){for(var r=this,o=u(t.target).closest("th, td"),n=o.offset(),s=this.dt.columns(this.c.columns).indexes().toArray(),i=u(e).attr("data-dt-column").split(",").map(function(t){return parseInt(t,10)}),l=0;l<i.length;l++)if(!s.includes(i[l]))return!1;this.s.mouse.start.x=this._cursorPosition(t,"pageX"),this.s.mouse.start.y=this._cursorPosition(t,"pageY"),this.s.mouse.offset.x=this._cursorPosition(t,"pageX")-n.left,this.s.mouse.offset.y=this._cursorPosition(t,"pageY")-n.top,this.s.mouse.target=o,this.s.mouse.targets=i;for(var a=0;a<i.length;a++){var d=this.dt.cells(null,i[a],{page:"current"}).nodes().to$(),c="dtcr-moving";0===a&&(c+=" dtcr-moving-first"),a===i.length-1&&(c+=" dtcr-moving-last"),d.addClass(c)}this._regions(i),this._scrollRegions(),u(h).on("mousemove.colReorder touchmove.colReorder",function(t){r._mouseMove(t)}).on("mouseup.colReorder touchend.colReorder",function(t){r._mouseUp(t)})},_.prototype._mouseMove=function(t){if(null===this.dom.drag){if(Math.pow(Math.pow(this._cursorPosition(t,"pageX")-this.s.mouse.start.x,2)+Math.pow(this._cursorPosition(t,"pageY")-this.s.mouse.start.y,2),.5)<5)return;u(h.body).addClass("dtcr-dragging"),this._createDragNode()}this.dom.drag.css({left:this._cursorPosition(t,"pageX")-this.s.mouse.offset.x,top:this._cursorPosition(t,"pageY")-this.s.mouse.offset.y});var e=u(this.dt.table().node()).offset().left,r=this._cursorPosition(t,"pageX")-e,e=this.s.dropZones.find(function(t){return t.left<=r&&r<=t.left+t.width});this.s.mouse.absLeft=this._cursorPosition(t,"pageX"),e&&!e.self&&this._move(e,r)},_.prototype._mouseUp=function(t){u(h).off(".colReorder"),u(h.body).removeClass("dtcr-dragging"),this.dom.drag&&(this.dom.drag.remove(),this.dom.drag=null),this.s.scrollInterval&&clearInterval(this.s.scrollInterval),this.dt.cells(".dtcr-moving").nodes().to$().removeClass("dtcr-moving dtcr-moving-first dtcr-moving-last")},_.prototype._move=function(t,e){var r,o,n=this,s=(this.dt.colReorder.move(this.s.mouse.targets,t.colIdx),this.s.mouse.targets=u(this.s.mouse.target).attr("data-dt-column").split(",").map(function(t){return parseInt(t,10)}),this._regions(this.s.mouse.targets),this.s.mouse.targets.filter(function(t){return n.dt.column(t).visible()})),t=this.s.dropZones.find(function(t){return t.colIdx===s[0]}),i=this.s.dropZones.indexOf(t);t.left>e&&(o=t.left-e,r=this.s.dropZones[i-1],t.left-=o,t.width+=o,r)&&(r.width-=o),(t=this.s.dropZones.find(function(t){return t.colIdx===s[s.length-1]})).left+t.width<e&&(r=e-(t.left+t.width),o=this.s.dropZones[i+1],t.width+=r,o)&&(o.left+=r,o.width-=r)},_.prototype._regions=function(n){var s=this,i=[],l=0,a=0,d=this.dt.columns(this.c.columns).indexes().toArray(),c=this.dt.columns().widths();this.dt.columns().every(function(t,e,r){var o;this.visible()&&(o=c[t],d.includes(t)&&(v(s.dt,n,t)?i.push({colIdx:t,left:l-a,self:n[0]<=t&&t<=n[n.length-1],width:o+a}):t<n[0]?i.length&&(i[i.length-1].width+=o):t>n[n.length-1]&&(a+=o)),l+=o)}),this.s.dropZones=i},_.prototype._isScrolling=function(){return this.dt.table().body().parentNode!==this.dt.table().header().parentNode},_.prototype._scrollRegions=function(){var e,r,o,n;this._isScrolling()&&(r=u((e=this).dt.table().container()).position().left,o=u(this.dt.table().container()).outerWidth(),n=this.dt.table().body().parentElement.parentElement,this.s.scrollInterval=setInterval(function(){var t=e.s.mouse.absLeft;t<r+75&&n.scrollLeft?n.scrollLeft-=5:r+o-75<t&&n.scrollLeft<n.scrollWidth&&(n.scrollLeft+=5)},25))},_.defaults={columns:"",enable:!0,order:null},_.version="2.0.3"; | ||
/*! ColReorder 2.0.3 | ||
!function(o){var r,n;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return o(t,window,document)}):"object"==typeof exports?(r=require("jquery"),n=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||r(t),n(t,e),o(e,0,t.document)}:(n(window,r),module.exports=o(r,window,window.document))):o(jQuery,window,document)}(function(u,t,f){"use strict";var n=u.fn.dataTable;function h(t,e,o,r){var n=t.splice(e,o);n.unshift(0),n.unshift(r<e?r:r-o+1),t.splice.apply(t,n)}function l(t){t.rows().invalidate("data"),t.column(0).visible(t.column(0).visible()),t.columns.adjust();var e=t.colReorder.order();t.trigger("columns-reordered",[{order:e,mapping:g(e)}])}function s(t){return t.settings()[0].aoColumns.map(function(t){return t._crOriginalIdx})}function p(t,e,o,r){for(var n=[],s=0;s<t.length;s++){var i=t[s];h(i,o[0],o.length,r);for(var l=0;l<i.length;l++){var a,c=i[l].cell;n.includes(c)||(a=c.getAttribute("data-dt-column").split(",").map(function(t){return e[t]}).join(","),c.setAttribute("data-dt-column",a),n.push(c))}}}function i(t){t.columns().iterator("column",function(t,e){t=t.aoColumns;void 0===t[e]._crOriginalIdx&&(t[e]._crOriginalIdx=e)})}function g(t){for(var e=[],o=0;o<t.length;o++)e[t[o]]=o;return e}function a(t,e,o){var r,n=t.settings()[0],s=n.aoColumns,i=s.map(function(t,e){return e});if(!e.includes(o)){h(i,e[0],e.length,o);var l=g(i);for(h(s,e[0],e.length,o),r=0;r<n.aoData.length;r++){var a=n.aoData[r];if(a){var c=a.anCells;if(c)for(h(c,e[0],e.length,o),u=0;u<c.length;u++)a.nTr&&c[u]&&s[u].bVisible&&a.nTr.appendChild(c[u]),c[u]&&c[u]._DT_CellIndex&&(c[u]._DT_CellIndex.column=u)}}for(r=0;r<s.length;r++){for(var d=s[r],u=0;u<d.aDataSort.length;u++)d.aDataSort[u]=l[d.aDataSort[u]];d.idx=l[d.idx],d.bVisible&&n.colgroup.append(d.colEl)}p(n.aoHeader,l,e,o),p(n.aoFooter,l,e,o),h(n.aoPreSearchCols,e[0],e.length,o),m(l,n.aaSorting),Array.isArray(n.aaSortingFixed)?m(l,n.aaSortingFixed):(n.aaSortingFixed.pre||n.aaSortingFixed.post)&&m(l,n.aaSortingFixed.pre),n.aLastSort.forEach(function(t){t.src=l[t.src]}),t.trigger("column-reorder",[t.settings()[0],{from:e,to:o,mapping:l}])}}function m(t,e){if(e)for(var o=0;o<e.length;o++){var r=e[o];"number"==typeof r?e[o]=t[r]:u.isPlainObject(r)&&void 0!==r.idx?r.idx=t[r.idx]:Array.isArray(r)&&"number"==typeof r[0]&&(r[0]=t[r[0]])}}function c(t,e,o){var r=!1;if(e.length!==t.columns().count())t.error("ColReorder - column count mismatch");else{for(var n=g(e=o?d(t,e,"toCurrent"):e),s=0;s<n.length;s++){var i=n.indexOf(s);s!==i&&(h(n,i,1,s),a(t,[i],s),r=!0)}r&&l(t)}}function d(t,e,o){var r=t.colReorder.order(),n=t.settings()[0].aoColumns;return"toCurrent"===o||"fromOriginal"===o?Array.isArray(e)?e.map(function(t){return r.indexOf(t)}):r.indexOf(e):Array.isArray(e)?e.map(function(t){return n[t]._crOriginalIdx}):n[e]._crOriginalIdx}function v(t,e,o){var r=t.columns().count();return!(e[0]<o&&o<e[e.length]||e[0]<0&&e[e.length-1]>r||o<0&&r<o||!e.includes(o)&&(!y(t.table().header.structure(),e,o)||!y(t.table().footer.structure(),e,o)))}function y(t,e,o){for(var r=function(t){for(var e=[],o=0;o<t.length;o++){e.push([]);for(var r=0;r<t[o].length;r++){var n=t[o][r];if(n)for(var s=0;s<n.rowspan;s++){e[o+s]||(e[o+s]=[]);for(var i=0;i<n.colspan;i++)e[o+s][r+i]=n.cell}}}return e}(t),n=0;n<r.length;n++)h(r[n],e[0],e.length,o);for(n=0;n<r.length;n++)for(var s=[],i=0;i<r[n].length;i++){var l=r[n][i];if(s.includes(l)){if(s[s.length-1]!==l)return}else s.push(l)}return 1}_.prototype.disable=function(){return this.c.enable=!1,this},_.prototype.enable=function(t){return!1===(t=void 0===t?!0:t)?this.disable():(this.c.enable=!0,this)},_.prototype._addListener=function(t){var e=this;u(t).on("selectstart.colReorder",function(){return!1}).on("mousedown.colReorder touchstart.colReorder",function(t){"mousedown"===t.type&&1!==t.which||e.c.enable&&e._mouseDown(t,this)})},_.prototype._createDragNode=function(){var t=this.s.mouse.target,e=t.parent(),o=e.parent(),r=o.parent(),n=t.clone();this.dom.drag=u(r[0].cloneNode(!1)).addClass("dtcr-cloned").append(u(o[0].cloneNode(!1)).append(u(e[0].cloneNode(!1)).append(n[0]))).css({position:"absolute",top:0,left:0,width:u(t).outerWidth(),height:u(t).outerHeight()}).appendTo("body")},_.prototype._cursorPosition=function(t,e){return(-1!==t.type.indexOf("touch")?t.originalEvent.touches[0]:t)[e]},_.prototype._mouseDown=function(t,e){for(var o=this,r=u(t.target).closest("th, td"),n=r.offset(),s=this.dt.columns(this.c.columns).indexes().toArray(),i=u(e).attr("data-dt-column").split(",").map(function(t){return parseInt(t,10)}),l=0;l<i.length;l++)if(!s.includes(i[l]))return!1;this.s.mouse.start.x=this._cursorPosition(t,"pageX"),this.s.mouse.start.y=this._cursorPosition(t,"pageY"),this.s.mouse.offset.x=this._cursorPosition(t,"pageX")-n.left,this.s.mouse.offset.y=this._cursorPosition(t,"pageY")-n.top,this.s.mouse.target=r,this.s.mouse.targets=i;for(var a=0;a<i.length;a++){var c=this.dt.cells(null,i[a],{page:"current"}).nodes().to$(),d="dtcr-moving";0===a&&(d+=" dtcr-moving-first"),a===i.length-1&&(d+=" dtcr-moving-last"),c.addClass(d)}this._regions(i),this._scrollRegions(),u(f).on("mousemove.colReorder touchmove.colReorder",function(t){o._mouseMove(t)}).on("mouseup.colReorder touchend.colReorder",function(t){o._mouseUp(t)})},_.prototype._mouseMove=function(t){if(null===this.dom.drag){if(Math.pow(Math.pow(this._cursorPosition(t,"pageX")-this.s.mouse.start.x,2)+Math.pow(this._cursorPosition(t,"pageY")-this.s.mouse.start.y,2),.5)<5)return;u(f.body).addClass("dtcr-dragging"),this._createDragNode()}this.dom.drag.css({left:this._cursorPosition(t,"pageX")-this.s.mouse.offset.x,top:this._cursorPosition(t,"pageY")-this.s.mouse.offset.y});var e=u(this.dt.table().node()).offset().left,o=this._cursorPosition(t,"pageX")-e,e=this.s.dropZones.find(function(t){return t.left<=o&&o<=t.left+t.width});this.s.mouse.absLeft=this._cursorPosition(t,"pageX"),e&&!e.self&&this._move(e,o)},_.prototype._mouseUp=function(t){u(f).off(".colReorder"),u(f.body).removeClass("dtcr-dragging"),this.dom.drag&&(this.dom.drag.remove(),this.dom.drag=null),this.s.scrollInterval&&clearInterval(this.s.scrollInterval),this.dt.cells(".dtcr-moving").nodes().to$().removeClass("dtcr-moving dtcr-moving-first dtcr-moving-last")},_.prototype._move=function(t,e){var o,r,n=this,s=(this.dt.colReorder.move(this.s.mouse.targets,t.colIdx),this.s.mouse.targets=u(this.s.mouse.target).attr("data-dt-column").split(",").map(function(t){return parseInt(t,10)}),this._regions(this.s.mouse.targets),this.s.mouse.targets.filter(function(t){return n.dt.column(t).visible()})),t=this.s.dropZones.find(function(t){return t.colIdx===s[0]}),i=this.s.dropZones.indexOf(t);t.left>e&&(r=t.left-e,o=this.s.dropZones[i-1],t.left-=r,t.width+=r,o)&&(o.width-=r),(t=this.s.dropZones.find(function(t){return t.colIdx===s[s.length-1]})).left+t.width<e&&(o=e-(t.left+t.width),r=this.s.dropZones[i+1],t.width+=o,r)&&(r.left+=o,r.width-=o)},_.prototype._regions=function(n){var s=this,i=[],l=0,a=0,c=this.dt.columns(this.c.columns).indexes().toArray(),d=this.dt.columns().widths();this.dt.columns().every(function(t,e,o){var r;this.visible()&&(r=d[t],c.includes(t)&&(v(s.dt,n,t)?i.push({colIdx:t,left:l-a,self:n[0]<=t&&t<=n[n.length-1],width:r+a}):t<n[0]?i.length&&(i[i.length-1].width+=r):t>n[n.length-1]&&(a+=r)),l+=r)}),this.s.dropZones=i},_.prototype._isScrolling=function(){return this.dt.table().body().parentNode!==this.dt.table().header().parentNode},_.prototype._scrollRegions=function(){var e,o,r,n;this._isScrolling()&&(o=u((e=this).dt.table().container()).position().left,r=u(this.dt.table().container()).outerWidth(),n=this.dt.table().body().parentElement.parentElement,this.s.scrollInterval=setInterval(function(){var t=e.s.mouse.absLeft;t<o+75&&n.scrollLeft?n.scrollLeft-=5:o+r-75<t&&n.scrollLeft<n.scrollWidth&&(n.scrollLeft+=5)},25))},_.defaults={columns:"",enable:!0,order:null},_.version="2.0.4"; | ||
/*! ColReorder 2.0.4 | ||
* © SpryMedia Ltd - datatables.net/license | ||
*/var b=_;function _(o,t){this.dom={drag:null},this.c={columns:null,enable:null,order:null},this.s={dropZones:[],mouse:{absLeft:-1,offset:{x:-1,y:-1},start:{x:-1,y:-1},target:null,targets:[]},scrollInterval:null};var e,r=this;o.settings()[0]._colReorder||((o.settings()[0]._colReorder=this).dt=o,u.extend(this.c,_.defaults,t),i(o),o.on("stateSaveParams",function(t,e,r){r.colReorder=s(o)}),o.on("destroy",function(){o.off(".colReorder"),o.colReorder.reset()}),t=o.state.loaded(),e=this.c.order,(e=t&&t.colReorder?t.colReorder:e)&&o.ready(function(){d(o,e,!0)}),o.table().header.structure().forEach(function(t){for(var e=0;e<t.length;e++)t[e]&&t[e].cell&&r._addListener(t[e].cell)}))}return n.Api.register("colReorder.enable()",function(e){return this.iterator("table",function(t){t._colReorder&&t._colReorder.enable(e)})}),n.Api.register("colReorder.disable()",function(){return this.iterator("table",function(t){t._colReorder&&t._colReorder.disable()})}),n.Api.register("colReorder.move()",function(t,e){return i(this),v(this,t=Array.isArray(t)?t:[t],e)?this.tables().every(function(){a(this,t,e),l(this)}):(this.error("ColReorder - invalid move"),this)}),n.Api.register("colReorder.order()",function(t,e){return i(this),t?this.tables().every(function(){d(this,t,e)}):this.context.length?s(this):null}),n.Api.register("colReorder.reset()",function(){return i(this),this.tables().every(function(){var t=this.columns().every(function(t){return t}).flatten().toArray();d(this,t,!0)})}),n.Api.register("colReorder.transpose()",function(t,e){return i(this),c(this,t,e=e||"toCurrent")}),n.ColReorder=b,u(h).on("stateLoadInit.dt",function(t,e,r){if("dt"===t.namespace){t=new n.Api(e);if(r.colReorder)if(t.ready())d(t,r.colReorder,!0);else{m(g(r.colReorder),r.order);for(var o=0;o<r.columns.length;o++)r.columns[o]._cr_sort=r.colReorder[o];r.columns.sort(function(t,e){return t._cr_sort-e._cr_sort})}}}),u(h).on("preInit.dt",function(t,e){var r,o;"dt"===t.namespace&&(t=e.oInit.colReorder,o=n.defaults.colReorder,t||o)&&(r=u.extend({},o,t),!1!==t)&&(o=new n.Api(e),new b(o,r))}),n}); | ||
*/var b=_;function _(r,t){this.dom={drag:null},this.c={columns:null,enable:null,order:null},this.s={dropZones:[],mouse:{absLeft:-1,offset:{x:-1,y:-1},start:{x:-1,y:-1},target:null,targets:[]},scrollInterval:null};var e,o=this;r.settings()[0]._colReorder||((r.settings()[0]._colReorder=this).dt=r,u.extend(this.c,_.defaults,t),i(r),r.on("stateSaveParams",function(t,e,o){o.colReorder=s(r)}),r.on("destroy",function(){r.off(".colReorder"),r.colReorder.reset()}),t=r.state.loaded(),e=this.c.order,(e=t&&t.colReorder?t.colReorder:e)&&r.ready(function(){c(r,e,!0)}),r.table().header.structure().forEach(function(t){for(var e=0;e<t.length;e++)t[e]&&t[e].cell&&o._addListener(t[e].cell)}))}return n.Api.register("colReorder.enable()",function(e){return this.iterator("table",function(t){t._colReorder&&t._colReorder.enable(e)})}),n.Api.register("colReorder.disable()",function(){return this.iterator("table",function(t){t._colReorder&&t._colReorder.disable()})}),n.Api.register("colReorder.move()",function(t,e){return i(this),v(this,t=Array.isArray(t)?t:[t],e)?this.tables().every(function(){a(this,t,e),l(this)}):(this.error("ColReorder - invalid move"),this)}),n.Api.register("colReorder.order()",function(t,e){return i(this),t?this.tables().every(function(){c(this,t,e)}):this.context.length?s(this):null}),n.Api.register("colReorder.reset()",function(){return i(this),this.tables().every(function(){var t=this.columns().every(function(t){return t}).flatten().toArray();c(this,t,!0)})}),n.Api.register("colReorder.transpose()",function(t,e){return i(this),d(this,t,e=e||"toCurrent")}),n.ColReorder=b,u(f).on("stateLoadInit.dt",function(t,e,o){if("dt"===t.namespace){t=new n.Api(e);if(o.colReorder)if(t.ready())c(t,o.colReorder,!0);else if(m(o.colReorder,o.order),o.columns){for(var r=0;r<o.columns.length;r++)o.columns[r]._cr_sort=o.colReorder[r];o.columns.sort(function(t,e){return t._cr_sort-e._cr_sort})}}}),u(f).on("preInit.dt",function(t,e){var o,r;"dt"===t.namespace&&(t=e.oInit.colReorder,r=n.defaults.colReorder,t||r)&&(o=u.extend({},r,t),!1!==t)&&(r=new n.Api(e),new b(r,o))}),n}); |
@@ -7,3 +7,3 @@ { | ||
"types": "./types/types.d.ts", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"files": [ | ||
@@ -10,0 +10,0 @@ "js/**/*.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96657
2123