src/myams/resources/js/ext/jquery-dataTables-rowReordering.min.js
changeset 5 c9c69b13d884
parent 0 f05d7aea098a
--- a/src/myams/resources/js/ext/jquery-dataTables-rowReordering.min.js	Wed Jul 15 15:04:38 2020 +0200
+++ b/src/myams/resources/js/ext/jquery-dataTables-rowReordering.min.js	Wed Jul 15 15:39:56 2020 +0200
@@ -1,1 +1,1 @@
-(function(a){a.fn.rowReordering=function(n){function c(o){if(o.fnSettings().oFeatures.bProcessing){a(".dataTables_processing").css("visibility","visible")}}function e(o){if(o.fnSettings().oFeatures.bProcessing){a(".dataTables_processing").css("visibility","hidden")}}function j(p,q){var o=1000000;a(q,p).each(function(){var r=parseInt(p.fnGetData(this,k.iIndexColumn));if(r<o){o=r}});return o}function h(o,p,r,s,q){p.sortable("cancel");if(s<=r.iLogLevel){if(q!=undefined){r.fnAlert(q,"")}else{r.fnAlert("Row cannot be moved","")}}r.fnEndProcessingMode(o)}function d(u,t,p){var s=a("#"+p,u);var w=u.fnGetData(s[0],k.iIndexColumn);var v=-1;var o;var q=s.prev(t);if(q.length>0){v=parseInt(u.fnGetData(q[0],k.iIndexColumn));if(v<w){v=v+1}}else{var r=s.next(t);if(r.length>0){v=parseInt(u.fnGetData(r[0],k.iIndexColumn));if(v>w){v=v-1}}}if(v<w){o="back"}else{o="forward"}return{sDirection:o,iCurrentPosition:w,iNewPosition:v}}function m(u,s,w,v,o,p,x){var q=w;var y=v;if(o=="back"){q=v;y=w}a(u.fnGetNodes()).each(function(){if(x!=""&&a(this).attr("data-group")!=x){return}var A=this;var z=parseInt(u.fnGetData(A,k.iIndexColumn));if(q<=z&&z<=y){if(A.id==p){u.fnUpdate(v,u.fnGetPosition(A),k.iIndexColumn,false)}else{if(o=="back"){u.fnUpdate(z+1,u.fnGetPosition(A),k.iIndexColumn,false)}else{u.fnUpdate(z-1,u.fnGetPosition(A),k.iIndexColumn,false)}}}});var r=u.fnSettings();if(r.oFeatures.bServerSide===false){var t=r._iDisplayStart;r.oApi._fnReDraw(r);r._iDisplayStart=t;r.oApi._fnCalculateEnd(r)}r.oApi._fnDraw(r)}function g(p,o){alert(p)}var f={iIndexColumn:0,iStartPosition:1,sURL:null,sRequestType:"POST",iGroupingLevel:0,fnAlert:g,fnSuccess:jQuery.noop,iLogLevel:1,sDataGroupAttribute:"data-group",fnStartProcessingMode:c,fnEndProcessingMode:e,fnUpdateAjaxRequest:jQuery.noop};var k=a.extend(f,n);var b,l;var i=function(q,o){var p=o.children();var r=o.clone();r.children().each(function(s){a(this).width(p.eq(s).width())});return r};return this.each(function(){var o=a(this).dataTable();var q=(o.fnSettings().aaSortingFixed==null?new Array():o.fnSettings().aaSortingFixed);q.push([k.iIndexColumn,"asc"]);o.fnSettings().aaSortingFixed=q;for(var p=0;p<o.fnSettings().aoColumns.length;p++){o.fnSettings().aoColumns[p].bSortable=false}o.fnDraw();a("tbody",o).disableSelection().sortable({cursor:"move",helper:i,update:function(w,x){var v=o;var u=a(this);var y="tbody tr";var r="";if(k.bGroupingUsed){r=a(x.item).attr(k.sDataGroupAttribute);if(r==null||r==undefined){h(v,u,k,3,"Grouping row cannot be moved");return}y="tbody tr["+k.sDataGroupAttribute+" ='"+r+"']"}var t=d(v,y,x.item.context.id);if(t.iNewPosition==-1){h(v,u,k,2);return}if(k.sURL!=null){k.fnStartProcessingMode(v);var s={url:k.sURL,type:k.sRequestType,data:{id:x.item.context.id,fromPosition:t.iCurrentPosition,toPosition:t.iNewPosition,direction:t.sDirection,group:r},success:function(z){k.fnSuccess(z);m(v,y,t.iCurrentPosition,t.iNewPosition,t.sDirection,x.item.context.id,r);k.fnEndProcessingMode(v)},error:function(z){h(v,u,k,1,z.statusText)}};k.fnUpdateAjaxRequest(s,k,v);a.ajax(s)}else{m(v,y,t.iCurrentPosition,t.iNewPosition,t.sDirection,x.item.context.id,r)}}})})}})(jQuery);
\ No newline at end of file
+!function(n){"use strict";n.fn.rowReordering=function(t){function e(n,t,e,i,o){t.sortable("cancel"),i<=e.iLogLevel&&(null!=o?e.fnAlert(o,""):e.fnAlert("Row cannot be moved","")),e.fnEndProcessingMode(n)}function i(t,e,i,o,s,a,u){var f=i,c=o;"back"==s&&(f=o,c=i),n(t.fnGetNodes()).each((function(){if(""==u||n(this).attr("data-group")==u){var e=this,i=parseInt(t.fnGetData(e,r.iIndexColumn));f<=i&&i<=c&&(e.id==a?t.fnUpdate(o,t.fnGetPosition(e),r.iIndexColumn,!1):"back"==s?t.fnUpdate(i+1,t.fnGetPosition(e),r.iIndexColumn,!1):t.fnUpdate(i-1,t.fnGetPosition(e),r.iIndexColumn,!1))}}));var d=t.fnSettings();if(!1===d.oFeatures.bServerSide){var l=d._iDisplayStart;d.oApi._fnReDraw(d),d._iDisplayStart=l,d.oApi._fnCalculateEnd(d)}d.oApi._fnDraw(d)}var o={iIndexColumn:0,iStartPosition:1,sURL:null,sRequestType:"POST",iGroupingLevel:0,fnAlert:function(n,t){alert(n)},fnSuccess:jQuery.noop,iLogLevel:1,sDataGroupAttribute:"data-group",fnStartProcessingMode:function(t){t.fnSettings().oFeatures.bProcessing&&n(".dataTables_processing").css("visibility","visible")},fnEndProcessingMode:function(t){t.fnSettings().oFeatures.bProcessing&&n(".dataTables_processing").css("visibility","hidden")},fnUpdateAjaxRequest:jQuery.noop},r=n.extend(o,t),s=function(t,e){var i=e.children(),o=e.clone();return o.children().each((function(t){n(this).width(i.eq(t).width())})),o};return this.each((function(){var t=n(this).dataTable(),o=null==t.fnSettings().aaSortingFixed?new Array:t.fnSettings().aaSortingFixed;o.push([r.iIndexColumn,"asc"]),t.fnSettings().aaSortingFixed=o;for(var a=0;a<t.fnSettings().aoColumns.length;a++)t.fnSettings().aoColumns[a].bSortable=!1;t.fnDraw(),n("tbody",t).disableSelection().sortable({cursor:"move",helper:s,update:function(o,s){var a=t,u=n(this),f="tbody tr",c="";if(r.bGroupingUsed){if(null==(c=n(s.item).attr(r.sDataGroupAttribute))||null==c)return void e(a,u,r,3,"Grouping row cannot be moved");f="tbody tr["+r.sDataGroupAttribute+" ='"+c+"']"}var d=function(t,e,i){var o=n("#"+i,t),s=t.fnGetData(o[0],r.iIndexColumn),a=-1,u=o.prev(e);if(u.length>0)(a=parseInt(t.fnGetData(u[0],r.iIndexColumn)))<s&&(a+=1);else{var f=o.next(e);f.length>0&&(a=parseInt(t.fnGetData(f[0],r.iIndexColumn)))>s&&(a-=1)}return{sDirection:a<s?"back":"forward",iCurrentPosition:s,iNewPosition:a}}(a,f,s.item.context.id);if(-1!=d.iNewPosition)if(null!=r.sURL){r.fnStartProcessingMode(a);var l={url:r.sURL,type:r.sRequestType,data:{id:s.item.context.id,fromPosition:d.iCurrentPosition,toPosition:d.iNewPosition,direction:d.sDirection,group:c},success:function(n){r.fnSuccess(n),i(a,0,d.iCurrentPosition,d.iNewPosition,d.sDirection,s.item.context.id,c),r.fnEndProcessingMode(a)},error:function(n){e(a,u,r,1,n.statusText)}};r.fnUpdateAjaxRequest(l,r,a),n.ajax(l)}else i(a,0,d.iCurrentPosition,d.iNewPosition,d.sDirection,s.item.context.id,c);else e(a,u,r,2)}})}))}}(jQuery);