1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /*!
- Copyright 2010-2020 SpryMedia Ltd.
- This source file is free software, available under the following license:
- MIT license - http://datatables.net/license/mit
- This source file is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
- For details please refer to: http://www.datatables.net
- AutoFill 2.3.5
- ©2008-2020 SpryMedia Ltd - datatables.net/license
- */
- var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(b){var f=0;return function(){return f<b.length?{done:!1,value:b[f++]}:{done:!0}}};$jscomp.arrayIterator=function(b){return{next:$jscomp.arrayIteratorImpl(b)}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
- $jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,f,e){b!=Array.prototype&&b!=Object.prototype&&(b[f]=e.value)};$jscomp.getGlobal=function(b){b=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global,b];for(var f=0;f<b.length;++f){var e=b[f];if(e&&e.Math==Math)return e}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
- $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.SymbolClass=function(b,f){this.$jscomp$symbol$id_=b;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:f})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};
- $jscomp.Symbol=function(){function b(e){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(e||"")+"_"+f++,e)}var f=0;return b}();
- $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.iterator;b||(b=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[b]&&$jscomp.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
- $jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.asyncIterator;b||(b=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(b){$jscomp.initSymbolIterator();b={next:b};b[$jscomp.global.Symbol.iterator]=function(){return this};return b};
- $jscomp.iteratorFromArray=function(b,f){$jscomp.initSymbolIterator();b instanceof String&&(b+="");var e=0,m={next:function(){if(e<b.length){var k=e++;return{value:f(k,b[k]),done:!1}}m.next=function(){return{done:!0,value:void 0}};return m.next()}};m[Symbol.iterator]=function(){return m};return m};
- $jscomp.polyfill=function(b,f,e,m){if(f){e=$jscomp.global;b=b.split(".");for(m=0;m<b.length-1;m++){var k=b[m];k in e||(e[k]={});e=e[k]}b=b[b.length-1];m=e[b];f=f(m);f!=m&&null!=f&&$jscomp.defineProperty(e,b,{configurable:!0,writable:!0,value:f})}};$jscomp.polyfill("Array.prototype.keys",function(b){return b?b:function(){return $jscomp.iteratorFromArray(this,function(b){return b})}},"es6","es3");
- (function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(f){return b(f,window,document)}):"object"===typeof exports?module.exports=function(f,e){f||(f=window);e&&e.fn.dataTable||(e=require("datatables.net")(f,e).$);return b(e,f,f.document)}:b(jQuery,window,document)})(function(b,f,e,m){var k=b.fn.dataTable,x=0,l=function(a,d){if(!k.versionCheck||!k.versionCheck("1.10.8"))throw"Warning: AutoFill requires DataTables 1.10.8 or greater";this.c=b.extend(!0,{},k.defaults.autoFill,
- l.defaults,d);this.s={dt:new k.Api(a),namespace:".autoFill"+x++,scroll:{},scrollInterval:null,handle:{height:0,width:0},enabled:!1};this.dom={handle:b('<div class="dt-autofill-handle"/>'),select:{top:b('<div class="dt-autofill-select top"/>'),right:b('<div class="dt-autofill-select right"/>'),bottom:b('<div class="dt-autofill-select bottom"/>'),left:b('<div class="dt-autofill-select left"/>')},background:b('<div class="dt-autofill-background"/>'),list:b('<div class="dt-autofill-list">'+this.s.dt.i18n("autoFill.info",
- "")+"<ul/></div>"),dtScroll:null,offsetParent:null};this._constructor()};b.extend(l.prototype,{enabled:function(){return this.s.enabled},enable:function(a){var d=this;if(!1===a)return this.disable();this.s.enabled=!0;this._focusListener();this.dom.handle.on("mousedown",function(a){d._mousedown(a);return!1});return this},disable:function(){this.s.enabled=!1;this._focusListenerRemove();return this},_constructor:function(){var a=this,d=this.s.dt,c=b("div.dataTables_scrollBody",this.s.dt.table().container());
- d.settings()[0].autoFill=this;c.length&&(this.dom.dtScroll=c,"static"===c.css("position")&&c.css("position","relative"));!1!==this.c.enable&&this.enable();d.on("destroy.autoFill",function(){a._focusListenerRemove()})},_attach:function(a){var d=this.s.dt,c=d.cell(a).index(),g=this.dom.handle,h=this.s.handle;c&&-1!==d.columns(this.c.columns).indexes().indexOf(c.column)?(this.dom.offsetParent||(this.dom.offsetParent=b(d.table().node()).offsetParent()),h.height&&h.width||(g.appendTo("body"),h.height=
- g.outerHeight(),h.width=g.outerWidth()),d=this._getPosition(a,this.dom.offsetParent),this.dom.attachedTo=a,g.css({top:d.top+a.offsetHeight-h.height,left:d.left+a.offsetWidth-h.width}).appendTo(this.dom.offsetParent)):this._detach()},_actionSelector:function(a){var d=this,c=this.s.dt,g=l.actions,h=[];b.each(g,function(d,b){b.available(c,a)&&h.push(d)});if(1===h.length&&!1===this.c.alwaysAsk){var e=g[h[0]].execute(c,a);this._update(e,a)}else if(1<h.length){var f=this.dom.list.children("ul").empty();
- h.push("cancel");b.each(h,function(h,e){f.append(b("<li/>").append('<div class="dt-autofill-question">'+g[e].option(c,a)+"<div>").append(b('<div class="dt-autofill-button">').append(b('<button class="'+l.classes.btn+'">'+c.i18n("autoFill.button",">")+"</button>").on("click",function(){var h=g[e].execute(c,a,b(this).closest("li"));d._update(h,a);d.dom.background.remove();d.dom.list.remove()}))))});this.dom.background.appendTo("body");this.dom.list.appendTo("body");this.dom.list.css("margin-top",
- this.dom.list.outerHeight()/2*-1)}},_detach:function(){this.dom.attachedTo=null;this.dom.handle.detach()},_drawSelection:function(a,d){var c=this.s.dt;d=this.s.start;var g=b(this.dom.start),h={row:this.c.vertical?c.rows({page:"current"}).nodes().indexOf(a.parentNode):d.row,column:this.c.horizontal?b(a).index():d.column};a=c.column.index("toData",h.column);var e=c.row(":eq("+h.row+")",{page:"current"});e=b(c.cell(e.index(),a).node());if(c.cell(e).any()&&-1!==c.columns(this.c.columns).indexes().indexOf(a)){this.s.end=
- h;c=d.row<h.row?g:e;var f=d.row<h.row?e:g;a=d.column<h.column?g:e;g=d.column<h.column?e:g;c=this._getPosition(c.get(0)).top;a=this._getPosition(a.get(0)).left;d=this._getPosition(f.get(0)).top+f.outerHeight()-c;g=this._getPosition(g.get(0)).left+g.outerWidth()-a;h=this.dom.select;h.top.css({top:c,left:a,width:g});h.left.css({top:c,left:a,height:d});h.bottom.css({top:c+d,left:a,width:g});h.right.css({top:c,left:a+g,height:d})}},_editor:function(a){var d=this.s.dt,c=this.c.editor;if(c){for(var b={},
- h=[],e=c.fields(),f=0,k=a.length;f<k;f++)for(var l=0,p=a[f].length;l<p;l++){var q=a[f][l],n=d.settings()[0].aoColumns[q.index.column],r=n.editField;if(r===m){n=n.mData;for(var u=0,y=e.length;u<y;u++){var w=c.field(e[u]);if(w.dataSrc()===n){r=w.name();break}}}if(!r)throw"Could not automatically determine field data. Please see https://datatables.net/tn/11";b[r]||(b[r]={});n=d.row(q.index.row).id();b[r][n]=q.set;h.push(q.index)}c.bubble(h,!1).multiSet(b).submit()}},_emitEvent:function(a,d){this.s.dt.iterator("table",
- function(c,g){b(c.nTable).triggerHandler(a+".dt",d)})},_focusListener:function(){var a=this,d=this.s.dt,c=this.s.namespace,g=null!==this.c.focus?this.c.focus:d.init().keys||d.settings()[0].keytable?"focus":"hover";if("focus"===g)d.on("key-focus.autoFill",function(c,b,d){a._attach(d.node())}).on("key-blur.autoFill",function(c,b,d){a._detach()});else if("click"===g)b(d.table().body()).on("click"+c,"td, th",function(c){a._attach(this)}),b(e.body).on("click"+c,function(c){b(c.target).parents().filter(d.table().body()).length||
- a._detach()});else b(d.table().body()).on("mouseenter"+c,"td, th",function(c){a._attach(this)}).on("mouseleave"+c,function(c){b(c.relatedTarget).hasClass("dt-autofill-handle")||a._detach()})},_focusListenerRemove:function(){var a=this.s.dt;a.off(".autoFill");b(a.table().body()).off(this.s.namespace);b(e.body).off(this.s.namespace)},_getPosition:function(a,d){var c=0,g=0;d||(d=b(b(this.s.dt.table().node())[0].offsetParent));do{var h=a.offsetTop,e=a.offsetLeft;var f=b(a.offsetParent);c+=h+1*parseInt(f.css("border-top-width"));
- g+=e+1*parseInt(f.css("border-left-width"));if("body"===a.nodeName.toLowerCase())break;a=f.get(0)}while(f.get(0)!==d.get(0));return{top:c,left:g}},_mousedown:function(a){var d=this,c=this.s.dt;this.dom.start=this.dom.attachedTo;this.s.start={row:c.rows({page:"current"}).nodes().indexOf(b(this.dom.start).parent()[0]),column:b(this.dom.start).index()};b(e.body).on("mousemove.autoFill",function(a){d._mousemove(a)}).on("mouseup.autoFill",function(a){d._mouseup(a)});var g=this.dom.select;c=b(c.table().node()).offsetParent();
- g.top.appendTo(c);g.left.appendTo(c);g.right.appendTo(c);g.bottom.appendTo(c);this._drawSelection(this.dom.start,a);this.dom.handle.css("display","none");a=this.dom.dtScroll;this.s.scroll={windowHeight:b(f).height(),windowWidth:b(f).width(),dtTop:a?a.offset().top:null,dtLeft:a?a.offset().left:null,dtHeight:a?a.outerHeight():null,dtWidth:a?a.outerWidth():null}},_mousemove:function(a){var b=a.target.nodeName.toLowerCase();if("td"===b||"th"===b)this._drawSelection(a.target,a),this._shiftScroll(a)},_mouseup:function(a){b(e.body).off(".autoFill");
- var d=this,c=this.s.dt,g=this.dom.select;g.top.remove();g.left.remove();g.right.remove();g.bottom.remove();this.dom.handle.css("display","block");g=this.s.start;var h=this.s.end;if(g.row!==h.row||g.column!==h.column){var f=c.cell(":eq("+g.row+")",g.column+":visible",{page:"current"});if(b("div.DTE",f.node()).length){var k=c.editor();k.on("submitSuccess.dtaf close.dtaf",function(){k.off(".dtaf");setTimeout(function(){d._mouseup(a)},100)}).on("submitComplete.dtaf preSubmitCancelled.dtaf close.dtaf",
- function(){k.off(".dtaf")});k.submit()}else{var l=this._range(g.row,h.row);g=this._range(g.column,h.column);h=[];for(var v=c.settings()[0],p=v.aoColumns,q=c.columns(this.c.columns).indexes(),n=0;n<l.length;n++)h.push(b.map(g,function(a){var b=c.row(":eq("+l[n]+")",{page:"current"});a=c.cell(b.index(),a+":visible");b=a.data();var d=a.index(),g=p[d.column].editField;g!==m&&(b=v.oApi._fnGetObjectDataFn(g)(c.row(d.row).data()));if(-1!==q.indexOf(d.column))return{cell:a,data:b,label:a.data(),index:d}}));
- this._actionSelector(h);clearInterval(this.s.scrollInterval);this.s.scrollInterval=null}}},_range:function(a,b){var c=[];if(a<=b)for(;a<=b;a++)c.push(a);else for(;a>=b;a--)c.push(a);return c},_shiftScroll:function(a){var b=this,c=this.s.scroll,g=!1,h=a.pageY-e.body.scrollTop,f=a.pageX-e.body.scrollLeft,k,l,m,p;65>h?k=-5:h>c.windowHeight-65&&(k=5);65>f?l=-5:f>c.windowWidth-65&&(l=5);null!==c.dtTop&&a.pageY<c.dtTop+65?m=-5:null!==c.dtTop&&a.pageY>c.dtTop+c.dtHeight-65&&(m=5);null!==c.dtLeft&&a.pageX<
- c.dtLeft+65?p=-5:null!==c.dtLeft&&a.pageX>c.dtLeft+c.dtWidth-65&&(p=5);k||l||m||p?(c.windowVert=k,c.windowHoriz=l,c.dtVert=m,c.dtHoriz=p,g=!0):this.s.scrollInterval&&(clearInterval(this.s.scrollInterval),this.s.scrollInterval=null);!this.s.scrollInterval&&g&&(this.s.scrollInterval=setInterval(function(){c.windowVert&&(e.body.scrollTop+=c.windowVert);c.windowHoriz&&(e.body.scrollLeft+=c.windowHoriz);if(c.dtVert||c.dtHoriz){var a=b.dom.dtScroll[0];c.dtVert&&(a.scrollTop+=c.dtVert);c.dtHoriz&&(a.scrollLeft+=
- c.dtHoriz)}},20))},_update:function(a,b){if(!1!==a){a=this.s.dt;var c=a.columns(this.c.columns).indexes();this._emitEvent("preAutoFill",[a,b]);this._editor(b);if(null!==this.c.update?this.c.update:!this.c.editor){for(var d=0,h=b.length;d<h;d++)for(var e=0,f=b[d].length;e<f;e++){var k=b[d][e];-1!==c.indexOf(k.index.column)&&k.cell.data(k.set)}a.draw(!1)}this._emitEvent("autoFill",[a,b])}}});l.actions={increment:{available:function(a,b){a=b[0][0].label;return!isNaN(a-parseFloat(a))},option:function(a,
- b){return a.i18n("autoFill.increment",'Increment / decrement each cell by: <input type="number" value="1">')},execute:function(a,d,c){a=1*d[0][0].data;c=1*b("input",c).val();for(var g=0,e=d.length;g<e;g++)for(var f=0,k=d[g].length;f<k;f++)d[g][f].set=a,a+=c}},fill:{available:function(a,b){return!0},option:function(a,b){return a.i18n("autoFill.fill","Fill all cells with <i>"+b[0][0].label+"</i>")},execute:function(a,b,c){a=b[0][0].data;c=0;for(var d=b.length;c<d;c++)for(var e=0,f=b[c].length;e<f;e++)b[c][e].set=
- a}},fillHorizontal:{available:function(a,b){return 1<b.length&&1<b[0].length},option:function(a,b){return a.i18n("autoFill.fillHorizontal","Fill cells horizontally")},execute:function(a,b,c){a=0;for(c=b.length;a<c;a++)for(var d=0,e=b[a].length;d<e;d++)b[a][d].set=b[a][0].data}},fillVertical:{available:function(a,b){return 1<b.length},option:function(a,b){return a.i18n("autoFill.fillVertical","Fill cells vertically")},execute:function(a,b,c){a=0;for(c=b.length;a<c;a++)for(var d=0,e=b[a].length;d<e;d++)b[a][d].set=
- b[0][d].data}},cancel:{available:function(){return!1},option:function(a){return a.i18n("autoFill.cancel","Cancel")},execute:function(){return!1}}};l.version="2.3.5";l.defaults={alwaysAsk:!1,focus:null,columns:"",enable:!0,update:null,editor:null,vertical:!0,horizontal:!0};l.classes={btn:"btn"};var t=b.fn.dataTable.Api;t.register("autoFill()",function(){return this});t.register("autoFill().enabled()",function(){var a=this.context[0];return a.autoFill?a.autoFill.enabled():!1});t.register("autoFill().enable()",
- function(a){return this.iterator("table",function(b){b.autoFill&&b.autoFill.enable(a)})});t.register("autoFill().disable()",function(){return this.iterator("table",function(a){a.autoFill&&a.autoFill.disable()})});b(e).on("preInit.dt.autofill",function(a,d,c){"dt"===a.namespace&&(a=d.oInit.autoFill,c=k.defaults.autoFill,a||c)&&(c=b.extend({},a,c),!1!==a&&new l(d,c))});k.AutoFill=l;return k.AutoFill=l});
|