datatables.net-autofill 2.3.9 → 2.4.0

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.
@@ -163,11 +163,40 @@ $.extend( AutoFill.prototype, {
163
163
 
164
164
  this._focusListener();
165
165
 
166
- this.dom.handle.on( 'mousedown', function (e) {
166
+ this.dom.handle.on( 'mousedown touchstart', function (e) {
167
167
  that._mousedown( e );
168
168
  return false;
169
169
  } );
170
170
 
171
+ $(window).on('resize', function() {
172
+ var handle = $('div.dt-autofill-handle');
173
+ if(handle.length > 0 && that.dom.attachedTo !== undefined) {
174
+ that._attach(that.dom.attachedTo)
175
+ }
176
+ })
177
+
178
+ let orientationReset = function() {
179
+ that.s.handle = {
180
+ height: false,
181
+ width: false
182
+ };
183
+ $(that.dom.handle).css({
184
+ 'height': '',
185
+ 'width': ''
186
+ })
187
+ if(that.dom.attachedTo !== undefined) {
188
+ that._attach(that.dom.attachedTo)
189
+ }
190
+ }
191
+
192
+ $(window)
193
+ .on('orientationchange', function() {
194
+ setTimeout(function() {
195
+ orientationReset();
196
+ setTimeout(orientationReset, 150);
197
+ }, 50);
198
+ });
199
+
171
200
  return this;
172
201
  },
173
202
 
@@ -256,7 +285,7 @@ $.extend( AutoFill.prototype, {
256
285
 
257
286
  // Might need to go through multiple offset parents
258
287
  var offset = this._getPosition( node, this.dom.offsetParent );
259
-
288
+
260
289
  this.dom.attachedTo = node;
261
290
  handle
262
291
  .css( {
@@ -325,6 +354,10 @@ $.extend( AutoFill.prototype, {
325
354
  } );
326
355
 
327
356
  this.dom.background.appendTo( 'body' );
357
+ this.dom.background.one('click', () => {
358
+ this.dom.background.remove();
359
+ this.dom.list.remove();
360
+ })
328
361
  this.dom.list.appendTo( 'body' );
329
362
 
330
363
  this.dom.list.css( 'margin-top', this.dom.list.outerHeight()/2 * -1 );
@@ -376,7 +409,7 @@ $.extend( AutoFill.prototype, {
376
409
  }
377
410
 
378
411
  // if target is not in the columns available - do nothing
379
- if ( dt.columns( this.c.columns ).indexes().indexOf( colIndx ) === -1 ) {
412
+ if ( dt.columns( this.c.columns ).indexes().indexOf( colIndx ) === -1 || end.row === -1) {
380
413
  return;
381
414
  }
382
415
 
@@ -550,16 +583,18 @@ $.extend( AutoFill.prototype, {
550
583
  }
551
584
  else {
552
585
  $(dt.table().body())
553
- .on( 'mouseenter'+namespace, 'td, th', function (e) {
586
+ .on( 'mouseenter'+namespace+' touchstart'+namespace, 'td, th', function (e) {
554
587
  that._attach( this );
555
588
  } )
556
- .on( 'mouseleave'+namespace, function (e) {
589
+ .on( 'mouseleave'+namespace+'touchend'+namespace, function (e) {
557
590
  if ( $(e.relatedTarget).hasClass('dt-autofill-handle') ) {
558
591
  return;
559
592
  }
560
593
 
561
594
  that._detach();
562
595
  } );
596
+
597
+
563
598
  }
564
599
  },
565
600
 
@@ -640,10 +675,16 @@ $.extend( AutoFill.prototype, {
640
675
  };
641
676
 
642
677
  $(document.body)
643
- .on( 'mousemove.autoFill', function (e) {
678
+ .on( 'mousemove.autoFill touchmove.autoFill', function (e) {
644
679
  that._mousemove( e );
680
+ // If it is a touch event then when the touch ends we need to remove the handle
681
+ if(e.type === 'touchmove') {
682
+ $(document.body).one('touchend.autoFill', function() {
683
+ that._detach();
684
+ })
685
+ }
645
686
  } )
646
- .on( 'mouseup.autoFill', function (e) {
687
+ .on( 'mouseup.autoFill touchend.autoFill', function (e) {
647
688
  that._mouseup( e );
648
689
  } );
649
690
 
@@ -684,12 +725,13 @@ $.extend( AutoFill.prototype, {
684
725
  {
685
726
  var that = this;
686
727
  var dt = this.s.dt;
687
- var name = e.target.nodeName.toLowerCase();
728
+ var target = !e.type.includes('touch') ? e.target : document.elementFromPoint(e.touches[0].clientX, e.touches[0].clientY);
729
+ var name = target.nodeName.toLowerCase();
688
730
  if ( name !== 'td' && name !== 'th' ) {
689
731
  return;
690
732
  }
691
733
 
692
- this._drawSelection( e.target, e );
734
+ this._drawSelection( target, e );
693
735
  this._shiftScroll( e );
694
736
  },
695
737
 
@@ -841,9 +883,13 @@ $.extend( AutoFill.prototype, {
841
883
  var runInterval = false;
842
884
  var scrollSpeed = 5;
843
885
  var buffer = 65;
886
+
887
+ // Different values if using a touchscreen
888
+ var pageX = !e.type.includes('touch') ? e.pageX - window.scrollX :e.touches[0].clientX;
889
+ var pageY = !e.type.includes('touch') ? e.pageY - window.scrollY :e.touches[0].clientY;
844
890
  var
845
- windowY = e.pageY - document.body.scrollTop,
846
- windowX = e.pageX - document.body.scrollLeft,
891
+ windowY = pageY,
892
+ windowX = pageX,
847
893
  windowVert, windowHoriz,
848
894
  dtVert, dtHoriz;
849
895
 
@@ -865,17 +911,17 @@ $.extend( AutoFill.prototype, {
865
911
 
866
912
  // DataTables scrolling calculations - based on the table's position in
867
913
  // the document and the mouse position on the page
868
- if ( scroll.dtTop !== null && e.pageY < scroll.dtTop + buffer ) {
914
+ if ( scroll.dtTop !== null && pageY < scroll.dtTop + buffer ) {
869
915
  dtVert = scrollSpeed * -1;
870
916
  }
871
- else if ( scroll.dtTop !== null && e.pageY > scroll.dtTop + scroll.dtHeight - buffer ) {
917
+ else if ( scroll.dtTop !== null && pageY > scroll.dtTop + scroll.dtHeight - buffer ) {
872
918
  dtVert = scrollSpeed;
873
919
  }
874
920
 
875
- if ( scroll.dtLeft !== null && e.pageX < scroll.dtLeft + buffer ) {
921
+ if ( scroll.dtLeft !== null && pageX < scroll.dtLeft + buffer ) {
876
922
  dtHoriz = scrollSpeed * -1;
877
923
  }
878
- else if ( scroll.dtLeft !== null && e.pageX > scroll.dtLeft + scroll.dtWidth - buffer ) {
924
+ else if ( scroll.dtLeft !== null && pageX > scroll.dtLeft + scroll.dtWidth - buffer ) {
879
925
  dtHoriz = scrollSpeed;
880
926
  }
881
927
 
@@ -906,12 +952,7 @@ $.extend( AutoFill.prototype, {
906
952
  this.s.scrollInterval = setInterval( function () {
907
953
  // Don't need to worry about setting scroll <0 or beyond the
908
954
  // scroll bound as the browser will just reject that.
909
- if ( scroll.windowVert ) {
910
- document.body.scrollTop += scroll.windowVert;
911
- }
912
- if ( scroll.windowHoriz ) {
913
- document.body.scrollLeft += scroll.windowHoriz;
914
- }
955
+ window.scrollTo(window.scrollX + (scroll.windowHoriz ? scroll.windowHoriz : 0), window.scrollY + (scroll.windowVert ? scroll.windowVert : 0))
915
956
 
916
957
  // DataTables scrolling
917
958
  if ( scroll.dtVert || scroll.dtHoriz ) {
@@ -12,35 +12,39 @@
12
12
  AutoFill 2.3.9
13
13
  ©2008-2021 SpryMedia Ltd - datatables.net/license
14
14
  */
15
- var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(c){var h=0;return function(){return h<c.length?{done:!1,value:c[h++]}:{done:!0}}};$jscomp.arrayIterator=function(c){return{next:$jscomp.arrayIteratorImpl(c)}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;
16
- $jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,h,g){if(c==Array.prototype||c==Object.prototype)return c;c[h]=g.value;return c};$jscomp.getGlobal=function(c){c=["object"==typeof globalThis&&globalThis,c,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var h=0;h<c.length;++h){var g=c[h];if(g&&g.Math==Math)return g}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
17
- $jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(c,h){var g=$jscomp.propertyToPolyfillSymbol[h];if(null==g)return c[h];g=c[g];return void 0!==g?g:c[h]};
18
- $jscomp.polyfill=function(c,h,g,k){h&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(c,h,g,k):$jscomp.polyfillUnisolated(c,h,g,k))};$jscomp.polyfillUnisolated=function(c,h,g,k){g=$jscomp.global;c=c.split(".");for(k=0;k<c.length-1;k++){var l=c[k];if(!(l in g))return;g=g[l]}c=c[c.length-1];k=g[c];h=h(k);h!=k&&null!=h&&$jscomp.defineProperty(g,c,{configurable:!0,writable:!0,value:h})};
19
- $jscomp.polyfillIsolated=function(c,h,g,k){var l=c.split(".");c=1===l.length;k=l[0];k=!c&&k in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var y=0;y<l.length-1;y++){var r=l[y];if(!(r in k))return;k=k[r]}l=l[l.length-1];g=$jscomp.IS_SYMBOL_NATIVE&&"es6"===g?k[l]:null;h=h(g);null!=h&&(c?$jscomp.defineProperty($jscomp.polyfills,l,{configurable:!0,writable:!0,value:h}):h!==g&&($jscomp.propertyToPolyfillSymbol[l]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(l):$jscomp.POLYFILL_PREFIX+l,l=
20
- $jscomp.propertyToPolyfillSymbol[l],$jscomp.defineProperty(k,l,{configurable:!0,writable:!0,value:h})))};$jscomp.initSymbol=function(){};
21
- $jscomp.polyfill("Symbol",function(c){if(c)return c;var h=function(l,y){this.$jscomp$symbol$id_=l;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:y})};h.prototype.toString=function(){return this.$jscomp$symbol$id_};var g=0,k=function(l){if(this instanceof k)throw new TypeError("Symbol is not a constructor");return new h("jscomp_symbol_"+(l||"")+"_"+g++,l)};return k},"es6","es3");$jscomp.initSymbolIterator=function(){};
22
- $jscomp.polyfill("Symbol.iterator",function(c){if(c)return c;c=Symbol("Symbol.iterator");for(var h="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),g=0;g<h.length;g++){var k=$jscomp.global[h[g]];"function"===typeof k&&"function"!=typeof k.prototype[c]&&$jscomp.defineProperty(k.prototype,c,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}})}return c},"es6",
23
- "es3");$jscomp.initSymbolAsyncIterator=function(){};$jscomp.iteratorPrototype=function(c){c={next:c};c[Symbol.iterator]=function(){return this};return c};$jscomp.iteratorFromArray=function(c,h){c instanceof String&&(c+="");var g=0,k={next:function(){if(g<c.length){var l=g++;return{value:h(l,c[l]),done:!1}}k.next=function(){return{done:!0,value:void 0}};return k.next()}};k[Symbol.iterator]=function(){return k};return k};
24
- $jscomp.polyfill("Array.prototype.keys",function(c){return c?c:function(){return $jscomp.iteratorFromArray(this,function(h){return h})}},"es6","es3");
25
- (function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(h){return c(h,window,document)}):"object"===typeof exports?module.exports=function(h,g){h||(h=window);g&&g.fn.dataTable||(g=require("datatables.net")(h,g).$);return c(g,h,h.document)}:c(jQuery,window,document)})(function(c,h,g,k){var l=c.fn.dataTable,y=0,r=function(a,d){if(!l.versionCheck||!l.versionCheck("1.10.8"))throw"Warning: AutoFill requires DataTables 1.10.8 or greater";this.c=c.extend(!0,{},l.defaults.autoFill,
26
- r.defaults,d);this.s={dt:new l.Api(a),namespace:".autoFill"+y++,scroll:{},scrollInterval:null,handle:{height:0,width:0},enabled:!1};this.dom={handle:c('<div class="dt-autofill-handle"/>'),select:{top:c('<div class="dt-autofill-select top"/>'),right:c('<div class="dt-autofill-select right"/>'),bottom:c('<div class="dt-autofill-select bottom"/>'),left:c('<div class="dt-autofill-select left"/>')},background:c('<div class="dt-autofill-background"/>'),list:c('<div class="dt-autofill-list">'+this.s.dt.i18n("autoFill.info",
27
- "")+"<ul/></div>"),dtScroll:null,offsetParent:null};this._constructor()};c.extend(r.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(b){d._mousedown(b);return!1});return this},disable:function(){this.s.enabled=!1;this._focusListenerRemove();return this},_constructor:function(){var a=this,d=this.s.dt,b=c("div.dataTables_scrollBody",this.s.dt.table().container());
28
- d.settings()[0].autoFill=this;b.length&&(this.dom.dtScroll=b,"static"===b.css("position")&&b.css("position","relative"));!1!==this.c.enable&&this.enable();d.on("destroy.autoFill",function(){a._focusListenerRemove()})},_attach:function(a){var d=this.s.dt,b=d.cell(a).index(),e=this.dom.handle,f=this.s.handle;b&&-1!==d.columns(this.c.columns).indexes().indexOf(b.column)?(this.dom.offsetParent||(this.dom.offsetParent=c(d.table().node()).offsetParent()),f.height&&f.width||(e.appendTo("body"),f.height=
29
- e.outerHeight(),f.width=e.outerWidth()),d=this._getPosition(a,this.dom.offsetParent),this.dom.attachedTo=a,e.css({top:d.top+a.offsetHeight-f.height,left:d.left+a.offsetWidth-f.width}).appendTo(this.dom.offsetParent)):this._detach()},_actionSelector:function(a){var d=this,b=this.s.dt,e=r.actions,f=[];c.each(e,function(p,q){q.available(b,a)&&f.push(p)});if(1===f.length&&!1===this.c.alwaysAsk){var m=e[f[0]].execute(b,a);this._update(m,a)}else if(1<f.length){var n=this.dom.list.children("ul").empty();
30
- f.push("cancel");c.each(f,function(p,q){n.append(c("<li/>").append('<div class="dt-autofill-question">'+e[q].option(b,a)+"<div>").append(c('<div class="dt-autofill-button">').append(c('<button class="'+r.classes.btn+'">'+b.i18n("autoFill.button","&gt;")+"</button>").on("click",function(){var v=e[q].execute(b,a,c(this).closest("li"));d._update(v,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",
31
- this.dom.list.outerHeight()/2*-1)}},_detach:function(){this.dom.attachedTo=null;this.dom.handle.detach()},_drawSelection:function(a,d){var b=this.s.dt;d=this.s.start;var e=c(this.dom.start),f={row:this.c.vertical?b.rows({page:"current"}).nodes().indexOf(a.parentNode):d.row,column:this.c.horizontal?c(a).index():d.column};a=b.column.index("toData",f.column);var m=b.row(":eq("+f.row+")",{page:"current"});m=c(b.cell(m.index(),a).node());if(b.cell(m).any()&&-1!==b.columns(this.c.columns).indexes().indexOf(a)){this.s.end=
32
- f;b=d.row<f.row?e:m;var n=d.row<f.row?m:e;a=d.column<f.column?e:m;e=d.column<f.column?m:e;b=this._getPosition(b.get(0)).top;a=this._getPosition(a.get(0)).left;d=this._getPosition(n.get(0)).top+n.outerHeight()-b;e=this._getPosition(e.get(0)).left+e.outerWidth()-a;f=this.dom.select;f.top.css({top:b,left:a,width:e});f.left.css({top:b,left:a,height:d});f.bottom.css({top:b+d,left:a,width:e});f.right.css({top:b,left:a+e,height:d})}},_editor:function(a){var d=this.s.dt,b=this.c.editor;if(b){for(var e={},
33
- f=[],m=b.fields(),n=0,p=a.length;n<p;n++)for(var q=0,v=a[n].length;q<v;q++){var u=a[n][q],w=d.settings()[0].aoColumns[u.index.column],t=w.editField;if(t===k){w=w.mData;for(var x=0,z=m.length;x<z;x++){var A=b.field(m[x]);if(A.dataSrc()===w){t=A.name();break}}}if(!t)throw"Could not automatically determine field data. Please see https://datatables.net/tn/11";e[t]||(e[t]={});w=d.row(u.index.row).id();e[t][w]=u.set;f.push(u.index)}b.bubble(f,!1).multiSet(e).submit()}},_emitEvent:function(a,d){this.s.dt.iterator("table",
34
- function(b,e){c(b.nTable).triggerHandler(a+".dt",d)})},_focusListener:function(){var a=this,d=this.s.dt,b=this.s.namespace,e=null!==this.c.focus?this.c.focus:d.init().keys||d.settings()[0].keytable?"focus":"hover";if("focus"===e)d.on("key-focus.autoFill",function(f,m,n){a._attach(n.node())}).on("key-blur.autoFill",function(f,m,n){a._detach()});else if("click"===e)c(d.table().body()).on("click"+b,"td, th",function(f){a._attach(this)}),c(g.body).on("click"+b,function(f){c(f.target).parents().filter(d.table().body()).length||
35
- a._detach()});else c(d.table().body()).on("mouseenter"+b,"td, th",function(f){a._attach(this)}).on("mouseleave"+b,function(f){c(f.relatedTarget).hasClass("dt-autofill-handle")||a._detach()})},_focusListenerRemove:function(){var a=this.s.dt;a.off(".autoFill");c(a.table().body()).off(this.s.namespace);c(g.body).off(this.s.namespace)},_getPosition:function(a,d){var b=0,e=0;d||(d=c(c(this.s.dt.table().node())[0].offsetParent));do{var f=a.offsetTop,m=a.offsetLeft;var n=c(a.offsetParent);b+=f+1*parseInt(n.css("border-top-width")||
36
- 0);e+=m+1*parseInt(n.css("border-left-width")||0);if("body"===a.nodeName.toLowerCase())break;a=n.get(0)}while(n.get(0)!==d.get(0));return{top:b,left:e}},_mousedown:function(a){var d=this,b=this.s.dt;this.dom.start=this.dom.attachedTo;this.s.start={row:b.rows({page:"current"}).nodes().indexOf(c(this.dom.start).parent()[0]),column:c(this.dom.start).index()};c(g.body).on("mousemove.autoFill",function(f){d._mousemove(f)}).on("mouseup.autoFill",function(f){d._mouseup(f)});var e=this.dom.select;b=c(b.table().node()).offsetParent();
37
- e.top.appendTo(b);e.left.appendTo(b);e.right.appendTo(b);e.bottom.appendTo(b);this._drawSelection(this.dom.start,a);this.dom.handle.css("display","none");a=this.dom.dtScroll;this.s.scroll={windowHeight:c(h).height(),windowWidth:c(h).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 d=a.target.nodeName.toLowerCase();if("td"===d||"th"===d)this._drawSelection(a.target,a),this._shiftScroll(a)},_mouseup:function(a){c(g.body).off(".autoFill");
38
- var d=this,b=this.s.dt,e=this.dom.select;e.top.remove();e.left.remove();e.right.remove();e.bottom.remove();this.dom.handle.css("display","block");e=this.s.start;var f=this.s.end;if(e.row!==f.row||e.column!==f.column){var m=b.cell(":eq("+e.row+")",e.column+":visible",{page:"current"});if(c("div.DTE",m.node()).length){var n=b.editor();n.on("submitSuccess.dtaf close.dtaf",function(){n.off(".dtaf");setTimeout(function(){d._mouseup(a)},100)}).on("submitComplete.dtaf preSubmitCancelled.dtaf close.dtaf",
39
- function(){n.off(".dtaf")});n.submit()}else{var p=this._range(e.row,f.row);e=this._range(e.column,f.column);f=[];for(var q=b.settings()[0],v=q.aoColumns,u=b.columns(this.c.columns).indexes(),w=0;w<p.length;w++)f.push(c.map(e,function(t){var x=b.row(":eq("+p[w]+")",{page:"current"});t=b.cell(x.index(),t+":visible");x=t.data();var z=t.index(),A=v[z.column].editField;A!==k&&(x=q.oApi._fnGetObjectDataFn(A)(b.row(z.row).data()));if(-1!==u.indexOf(z.column))return{cell:t,data:x,label:t.data(),index:z}}));
40
- this._actionSelector(f);clearInterval(this.s.scrollInterval);this.s.scrollInterval=null}}},_range:function(a,d){var b=[];if(a<=d)for(;a<=d;a++)b.push(a);else for(;a>=d;a--)b.push(a);return b},_shiftScroll:function(a){var d=this,b=this.s.scroll,e=!1,f=a.pageY-g.body.scrollTop,m=a.pageX-g.body.scrollLeft,n,p,q,v;65>f?n=-5:f>b.windowHeight-65&&(n=5);65>m?p=-5:m>b.windowWidth-65&&(p=5);null!==b.dtTop&&a.pageY<b.dtTop+65?q=-5:null!==b.dtTop&&a.pageY>b.dtTop+b.dtHeight-65&&(q=5);null!==b.dtLeft&&a.pageX<
41
- b.dtLeft+65?v=-5:null!==b.dtLeft&&a.pageX>b.dtLeft+b.dtWidth-65&&(v=5);n||p||q||v?(b.windowVert=n,b.windowHoriz=p,b.dtVert=q,b.dtHoriz=v,e=!0):this.s.scrollInterval&&(clearInterval(this.s.scrollInterval),this.s.scrollInterval=null);!this.s.scrollInterval&&e&&(this.s.scrollInterval=setInterval(function(){b.windowVert&&(g.body.scrollTop+=b.windowVert);b.windowHoriz&&(g.body.scrollLeft+=b.windowHoriz);if(b.dtVert||b.dtHoriz){var u=d.dom.dtScroll[0];b.dtVert&&(u.scrollTop+=b.dtVert);b.dtHoriz&&(u.scrollLeft+=
42
- b.dtHoriz)}},20))},_update:function(a,d){if(!1!==a){a=this.s.dt;var b=a.columns(this.c.columns).indexes();this._emitEvent("preAutoFill",[a,d]);this._editor(d);if(null!==this.c.update?this.c.update:!this.c.editor){for(var e=0,f=d.length;e<f;e++)for(var m=0,n=d[e].length;m<n;m++){var p=d[e][m];-1!==b.indexOf(p.index.column)&&p.cell.data(p.set)}a.draw(!1)}this._emitEvent("autoFill",[a,d])}}});r.actions={increment:{available:function(a,d){a=d[0][0].label;return!isNaN(a-parseFloat(a))},option:function(a,
43
- d){return a.i18n("autoFill.increment",'Increment / decrement each cell by: <input type="number" value="1">')},execute:function(a,d,b){a=1*d[0][0].data;b=1*c("input",b).val();for(var e=0,f=d.length;e<f;e++)for(var m=0,n=d[e].length;m<n;m++)d[e][m].set=a,a+=b}},fill:{available:function(a,d){return!0},option:function(a,d){return a.i18n("autoFill.fill","Fill all cells with <i>%d</i>",d[0][0].label)},execute:function(a,d,b){a=d[0][0].data;b=0;for(var e=d.length;b<e;b++)for(var f=0,m=d[b].length;f<m;f++)d[b][f].set=
44
- a}},fillHorizontal:{available:function(a,d){return 1<d.length&&1<d[0].length},option:function(a,d){return a.i18n("autoFill.fillHorizontal","Fill cells horizontally")},execute:function(a,d,b){a=0;for(b=d.length;a<b;a++)for(var e=0,f=d[a].length;e<f;e++)d[a][e].set=d[a][0].data}},fillVertical:{available:function(a,d){return 1<d.length},option:function(a,d){return a.i18n("autoFill.fillVertical","Fill cells vertically")},execute:function(a,d,b){a=0;for(b=d.length;a<b;a++)for(var e=0,f=d[a].length;e<f;e++)d[a][e].set=
45
- d[0][e].data}},cancel:{available:function(){return!1},option:function(a){return a.i18n("autoFill.cancel","Cancel")},execute:function(){return!1}}};r.version="2.3.9";r.defaults={alwaysAsk:!1,focus:null,columns:"",enable:!0,update:null,editor:null,vertical:!0,horizontal:!0};r.classes={btn:"btn"};var B=c.fn.dataTable.Api;B.register("autoFill()",function(){return this});B.register("autoFill().enabled()",function(){var a=this.context[0];return a.autoFill?a.autoFill.enabled():!1});B.register("autoFill().enable()",
46
- function(a){return this.iterator("table",function(d){d.autoFill&&d.autoFill.enable(a)})});B.register("autoFill().disable()",function(){return this.iterator("table",function(a){a.autoFill&&a.autoFill.disable()})});c(g).on("preInit.dt.autofill",function(a,d,b){"dt"===a.namespace&&(a=d.oInit.autoFill,b=l.defaults.autoFill,a||b)&&(b=c.extend({},a,b),!1!==a&&new r(d,b))});l.AutoFill=r;return l.AutoFill=r});
15
+ 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.ISOLATE_POLYFILLS=!1;
16
+ $jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,f,g){if(b==Array.prototype||b==Object.prototype)return b;b[f]=g.value;return b};$jscomp.getGlobal=function(b){b=["object"==typeof globalThis&&globalThis,b,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var f=0;f<b.length;++f){var g=b[f];if(g&&g.Math==Math)return g}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
17
+ $jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(b,f){var g=$jscomp.propertyToPolyfillSymbol[f];if(null==g)return b[f];g=b[g];return void 0!==g?g:b[f]};
18
+ $jscomp.polyfill=function(b,f,g,k){f&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(b,f,g,k):$jscomp.polyfillUnisolated(b,f,g,k))};$jscomp.polyfillUnisolated=function(b,f,g,k){g=$jscomp.global;b=b.split(".");for(k=0;k<b.length-1;k++){var m=b[k];if(!(m in g))return;g=g[m]}b=b[b.length-1];k=g[b];f=f(k);f!=k&&null!=f&&$jscomp.defineProperty(g,b,{configurable:!0,writable:!0,value:f})};
19
+ $jscomp.polyfillIsolated=function(b,f,g,k){var m=b.split(".");b=1===m.length;k=m[0];k=!b&&k in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var v=0;v<m.length-1;v++){var q=m[v];if(!(q in k))return;k=k[q]}m=m[m.length-1];g=$jscomp.IS_SYMBOL_NATIVE&&"es6"===g?k[m]:null;f=f(g);null!=f&&(b?$jscomp.defineProperty($jscomp.polyfills,m,{configurable:!0,writable:!0,value:f}):f!==g&&($jscomp.propertyToPolyfillSymbol[m]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(m):$jscomp.POLYFILL_PREFIX+m,m=
20
+ $jscomp.propertyToPolyfillSymbol[m],$jscomp.defineProperty(k,m,{configurable:!0,writable:!0,value:f})))};$jscomp.initSymbol=function(){};
21
+ $jscomp.polyfill("Symbol",function(b){if(b)return b;var f=function(m,v){this.$jscomp$symbol$id_=m;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:v})};f.prototype.toString=function(){return this.$jscomp$symbol$id_};var g=0,k=function(m){if(this instanceof k)throw new TypeError("Symbol is not a constructor");return new f("jscomp_symbol_"+(m||"")+"_"+g++,m)};return k},"es6","es3");$jscomp.initSymbolIterator=function(){};
22
+ $jscomp.polyfill("Symbol.iterator",function(b){if(b)return b;b=Symbol("Symbol.iterator");for(var f="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),g=0;g<f.length;g++){var k=$jscomp.global[f[g]];"function"===typeof k&&"function"!=typeof k.prototype[b]&&$jscomp.defineProperty(k.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}})}return b},"es6",
23
+ "es3");$jscomp.initSymbolAsyncIterator=function(){};$jscomp.iteratorPrototype=function(b){b={next:b};b[Symbol.iterator]=function(){return this};return b};$jscomp.iteratorFromArray=function(b,f){b instanceof String&&(b+="");var g=0,k={next:function(){if(g<b.length){var m=g++;return{value:f(m,b[m]),done:!1}}k.next=function(){return{done:!0,value:void 0}};return k.next()}};k[Symbol.iterator]=function(){return k};return k};
24
+ $jscomp.polyfill("Array.prototype.keys",function(b){return b?b:function(){return $jscomp.iteratorFromArray(this,function(f){return f})}},"es6","es3");$jscomp.polyfill("Object.is",function(b){return b?b:function(f,g){return f===g?0!==f||1/f===1/g:f!==f&&g!==g}},"es6","es3");
25
+ $jscomp.polyfill("Array.prototype.includes",function(b){return b?b:function(f,g){var k=this;k instanceof String&&(k=String(k));var m=k.length;g=g||0;for(0>g&&(g=Math.max(g+m,0));g<m;g++){var v=k[g];if(v===f||Object.is(v,f))return!0}return!1}},"es7","es3");
26
+ $jscomp.checkStringArgs=function(b,f,g){if(null==b)throw new TypeError("The 'this' value for String.prototype."+g+" must not be null or undefined");if(f instanceof RegExp)throw new TypeError("First argument to String.prototype."+g+" must not be a regular expression");return b+""};$jscomp.polyfill("String.prototype.includes",function(b){return b?b:function(f,g){return-1!==$jscomp.checkStringArgs(this,f,"includes").indexOf(f,g||0)}},"es6","es3");
27
+ (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,g){f||(f=window);g&&g.fn.dataTable||(g=require("datatables.net")(f,g).$);return b(g,f,f.document)}:b(jQuery,window,document)})(function(b,f,g,k){var m=b.fn.dataTable,v=0,q=function(a,d){if(!m.versionCheck||!m.versionCheck("1.10.8"))throw"Warning: AutoFill requires DataTables 1.10.8 or greater";this.c=b.extend(!0,{},m.defaults.autoFill,
28
+ q.defaults,d);this.s={dt:new m.Api(a),namespace:".autoFill"+v++,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",
29
+ "")+"<ul/></div>"),dtScroll:null,offsetParent:null};this._constructor()};b.extend(q.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 touchstart",function(e){d._mousedown(e);return!1});b(f).on("resize",function(){0<b("div.dt-autofill-handle").length&&d.dom.attachedTo!==k&&d._attach(d.dom.attachedTo)});var c=function(){d.s.handle={height:!1,width:!1};b(d.dom.handle).css({height:"",
30
+ width:""});d.dom.attachedTo!==k&&d._attach(d.dom.attachedTo)};b(f).on("orientationchange",function(){setTimeout(function(){c();setTimeout(c,150)},50)});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();
31
+ d.on("destroy.autoFill",function(){a._focusListenerRemove()})},_attach:function(a){var d=this.s.dt,c=d.cell(a).index(),e=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||(e.appendTo("body"),h.height=e.outerHeight(),h.width=e.outerWidth()),d=this._getPosition(a,this.dom.offsetParent),this.dom.attachedTo=a,e.css({top:d.top+a.offsetHeight-h.height,left:d.left+
32
+ a.offsetWidth-h.width}).appendTo(this.dom.offsetParent)):this._detach()},_actionSelector:function(a){var d=this,c=this,e=this.s.dt,h=q.actions,l=[];b.each(h,function(r,t){t.available(e,a)&&l.push(r)});if(1===l.length&&!1===this.c.alwaysAsk){var n=h[l[0]].execute(e,a);this._update(n,a)}else if(1<l.length){var p=this.dom.list.children("ul").empty();l.push("cancel");b.each(l,function(r,t){p.append(b("<li/>").append('<div class="dt-autofill-question">'+h[t].option(e,a)+"<div>").append(b('<div class="dt-autofill-button">').append(b('<button class="'+
33
+ q.classes.btn+'">'+e.i18n("autoFill.button","&gt;")+"</button>").on("click",function(){var x=h[t].execute(e,a,b(this).closest("li"));c._update(x,a);c.dom.background.remove();c.dom.list.remove()}))))});this.dom.background.appendTo("body");this.dom.background.one("click",function(){d.dom.background.remove();d.dom.list.remove()});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,
34
+ d){var c=this.s.dt;d=this.s.start;var e=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 l=c.row(":eq("+h.row+")",{page:"current"});l=b(c.cell(l.index(),a).node());if(c.cell(l).any()&&-1!==c.columns(this.c.columns).indexes().indexOf(a)&&-1!==h.row){this.s.end=h;c=d.row<h.row?e:l;var n=d.row<h.row?l:e;a=d.column<h.column?e:l;e=d.column<h.column?l:e;c=this._getPosition(c.get(0)).top;
35
+ a=this._getPosition(a.get(0)).left;d=this._getPosition(n.get(0)).top+n.outerHeight()-c;e=this._getPosition(e.get(0)).left+e.outerWidth()-a;h=this.dom.select;h.top.css({top:c,left:a,width:e});h.left.css({top:c,left:a,height:d});h.bottom.css({top:c+d,left:a,width:e});h.right.css({top:c,left:a+e,height:d})}},_editor:function(a){var d=this.s.dt,c=this.c.editor;if(c){for(var e={},h=[],l=c.fields(),n=0,p=a.length;n<p;n++)for(var r=0,t=a[n].length;r<t;r++){var x=a[n][r],w=d.settings()[0].aoColumns[x.index.column],
36
+ u=w.editField;if(u===k){w=w.mData;for(var y=0,z=l.length;y<z;y++){var A=c.field(l[y]);if(A.dataSrc()===w){u=A.name();break}}}if(!u)throw"Could not automatically determine field data. Please see https://datatables.net/tn/11";e[u]||(e[u]={});w=d.row(x.index.row).id();e[u][w]=x.set;h.push(x.index)}c.bubble(h,!1).multiSet(e).submit()}},_emitEvent:function(a,d){this.s.dt.iterator("table",function(c,e){b(c.nTable).triggerHandler(a+".dt",d)})},_focusListener:function(){var a=this,d=this.s.dt,c=this.s.namespace,
37
+ e=null!==this.c.focus?this.c.focus:d.init().keys||d.settings()[0].keytable?"focus":"hover";if("focus"===e)d.on("key-focus.autoFill",function(h,l,n){a._attach(n.node())}).on("key-blur.autoFill",function(h,l,n){a._detach()});else if("click"===e)b(d.table().body()).on("click"+c,"td, th",function(h){a._attach(this)}),b(g.body).on("click"+c,function(h){b(h.target).parents().filter(d.table().body()).length||a._detach()});else b(d.table().body()).on("mouseenter"+c+" touchstart"+c,"td, th",function(h){a._attach(this)}).on("mouseleave"+
38
+ c+"touchend"+c,function(h){b(h.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(g.body).off(this.s.namespace)},_getPosition:function(a,d){var c=0,e=0;d||(d=b(b(this.s.dt.table().node())[0].offsetParent));do{var h=a.offsetTop,l=a.offsetLeft;var n=b(a.offsetParent);c+=h+1*parseInt(n.css("border-top-width")||0);e+=l+1*parseInt(n.css("border-left-width")||0);if("body"===a.nodeName.toLowerCase())break;
39
+ a=n.get(0)}while(n.get(0)!==d.get(0));return{top:c,left:e}},_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(g.body).on("mousemove.autoFill touchmove.autoFill",function(h){d._mousemove(h);if("touchmove"===h.type)b(g.body).one("touchend.autoFill",function(){d._detach()})}).on("mouseup.autoFill touchend.autoFill",function(h){d._mouseup(h)});var e=
40
+ this.dom.select;c=b(c.table().node()).offsetParent();e.top.appendTo(c);e.left.appendTo(c);e.right.appendTo(c);e.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 d=a.type.includes("touch")?g.elementFromPoint(a.touches[0].clientX,
41
+ a.touches[0].clientY):a.target,c=d.nodeName.toLowerCase();if("td"===c||"th"===c)this._drawSelection(d,a),this._shiftScroll(a)},_mouseup:function(a){b(g.body).off(".autoFill");var d=this,c=this.s.dt,e=this.dom.select;e.top.remove();e.left.remove();e.right.remove();e.bottom.remove();this.dom.handle.css("display","block");e=this.s.start;var h=this.s.end;if(e.row!==h.row||e.column!==h.column){var l=c.cell(":eq("+e.row+")",e.column+":visible",{page:"current"});if(b("div.DTE",l.node()).length){var n=c.editor();
42
+ n.on("submitSuccess.dtaf close.dtaf",function(){n.off(".dtaf");setTimeout(function(){d._mouseup(a)},100)}).on("submitComplete.dtaf preSubmitCancelled.dtaf close.dtaf",function(){n.off(".dtaf")});n.submit()}else{var p=this._range(e.row,h.row);e=this._range(e.column,h.column);h=[];for(var r=c.settings()[0],t=r.aoColumns,x=c.columns(this.c.columns).indexes(),w=0;w<p.length;w++)h.push(b.map(e,function(u){var y=c.row(":eq("+p[w]+")",{page:"current"});u=c.cell(y.index(),u+":visible");y=u.data();var z=u.index(),
43
+ A=t[z.column].editField;A!==k&&(y=r.oApi._fnGetObjectDataFn(A)(c.row(z.row).data()));if(-1!==x.indexOf(z.column))return{cell:u,data:y,label:u.data(),index:z}}));this._actionSelector(h);clearInterval(this.s.scrollInterval);this.s.scrollInterval=null}}},_range:function(a,d){var c=[];if(a<=d)for(;a<=d;a++)c.push(a);else for(;a>=d;a--)c.push(a);return c},_shiftScroll:function(a){var d=this,c=this.s.scroll,e=!1,h=a.type.includes("touch")?a.touches[0].clientX:a.pageX-f.scrollX;a=a.type.includes("touch")?
44
+ a.touches[0].clientY:a.pageY-f.scrollY;var l,n,p,r;65>a?l=-5:a>c.windowHeight-65&&(l=5);65>h?n=-5:h>c.windowWidth-65&&(n=5);null!==c.dtTop&&a<c.dtTop+65?p=-5:null!==c.dtTop&&a>c.dtTop+c.dtHeight-65&&(p=5);null!==c.dtLeft&&h<c.dtLeft+65?r=-5:null!==c.dtLeft&&h>c.dtLeft+c.dtWidth-65&&(r=5);l||n||p||r?(c.windowVert=l,c.windowHoriz=n,c.dtVert=p,c.dtHoriz=r,e=!0):this.s.scrollInterval&&(clearInterval(this.s.scrollInterval),this.s.scrollInterval=null);!this.s.scrollInterval&&e&&(this.s.scrollInterval=setInterval(function(){f.scrollTo(f.scrollX+
45
+ (c.windowHoriz?c.windowHoriz:0),f.scrollY+(c.windowVert?c.windowVert:0));if(c.dtVert||c.dtHoriz){var t=d.dom.dtScroll[0];c.dtVert&&(t.scrollTop+=c.dtVert);c.dtHoriz&&(t.scrollLeft+=c.dtHoriz)}},20))},_update:function(a,d){if(!1!==a){a=this.s.dt;var c=a.columns(this.c.columns).indexes();this._emitEvent("preAutoFill",[a,d]);this._editor(d);if(null!==this.c.update?this.c.update:!this.c.editor){for(var e=0,h=d.length;e<h;e++)for(var l=0,n=d[e].length;l<n;l++){var p=d[e][l];-1!==c.indexOf(p.index.column)&&
46
+ p.cell.data(p.set)}a.draw(!1)}this._emitEvent("autoFill",[a,d])}}});q.actions={increment:{available:function(a,d){a=d[0][0].label;return!isNaN(a-parseFloat(a))},option:function(a,d){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 e=0,h=d.length;e<h;e++)for(var l=0,n=d[e].length;l<n;l++)d[e][l].set=a,a+=c}},fill:{available:function(a,d){return!0},option:function(a,d){return a.i18n("autoFill.fill",
47
+ "Fill all cells with <i>%d</i>",d[0][0].label)},execute:function(a,d,c){a=d[0][0].data;c=0;for(var e=d.length;c<e;c++)for(var h=0,l=d[c].length;h<l;h++)d[c][h].set=a}},fillHorizontal:{available:function(a,d){return 1<d.length&&1<d[0].length},option:function(a,d){return a.i18n("autoFill.fillHorizontal","Fill cells horizontally")},execute:function(a,d,c){a=0;for(c=d.length;a<c;a++)for(var e=0,h=d[a].length;e<h;e++)d[a][e].set=d[a][0].data}},fillVertical:{available:function(a,d){return 1<d.length},option:function(a,
48
+ d){return a.i18n("autoFill.fillVertical","Fill cells vertically")},execute:function(a,d,c){a=0;for(c=d.length;a<c;a++)for(var e=0,h=d[a].length;e<h;e++)d[a][e].set=d[0][e].data}},cancel:{available:function(){return!1},option:function(a){return a.i18n("autoFill.cancel","Cancel")},execute:function(){return!1}}};q.version="2.3.9";q.defaults={alwaysAsk:!1,focus:null,columns:"",enable:!0,update:null,editor:null,vertical:!0,horizontal:!0};q.classes={btn:"btn"};var B=b.fn.dataTable.Api;B.register("autoFill()",
49
+ function(){return this});B.register("autoFill().enabled()",function(){var a=this.context[0];return a.autoFill?a.autoFill.enabled():!1});B.register("autoFill().enable()",function(a){return this.iterator("table",function(d){d.autoFill&&d.autoFill.enable(a)})});B.register("autoFill().disable()",function(){return this.iterator("table",function(a){a.autoFill&&a.autoFill.disable()})});b(g).on("preInit.dt.autofill",function(a,d,c){"dt"===a.namespace&&(a=d.oInit.autoFill,c=m.defaults.autoFill,a||c)&&(c=b.extend({},
50
+ a,c),!1!==a&&new q(d,c))});m.AutoFill=q;return m.AutoFill=q});
package/package.json CHANGED
@@ -3,9 +3,10 @@
3
3
  "description": "AutoFill for DataTables",
4
4
  "main": "js/dataTables.autoFill.js",
5
5
  "types": "./types/types.d.ts",
6
- "version": "2.3.9",
6
+ "version": "2.4.0",
7
7
  "files": [
8
- "js/**/*.js"
8
+ "js/**/*.js",
9
+ "types/**/*.d.ts"
9
10
  ],
10
11
  "keywords": [
11
12
  "AutoFill",
@@ -17,7 +18,7 @@
17
18
  "sort"
18
19
  ],
19
20
  "dependencies": {
20
- "datatables.net": ">=1.10.25",
21
+ "datatables.net": ">=1.11.3",
21
22
  "jquery": ">=1.7"
22
23
  },
23
24
  "moduleType": [
@@ -0,0 +1,66 @@
1
+ // Type definitions for datatables.net-autofill 2.2
2
+ // Project: https://datatables.net
3
+ // Definitions by: Andy Ma <https://github.com/andy-maca>
4
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+ // TypeScript Version: 2.4
6
+
7
+ /// <reference types="jquery" />
8
+ /// <reference types="datatables.net"/>
9
+
10
+ declare namespace DataTables {
11
+ interface Settings {
12
+ /**
13
+ * autoFill extension options
14
+ */
15
+ autoFill?: boolean | AutoFillSettings;
16
+ }
17
+
18
+ interface Api {
19
+ /**
20
+ * Initialise AutoFill on the DataTable
21
+ *
22
+ * @returns Api for chaining with the additional autoFill methods
23
+ */
24
+ autoFill(): AutoFillFunctions | Api;
25
+ }
26
+
27
+ interface AutoFillFunctions {
28
+ /**
29
+ * Disable AutoFill. Please note that this disallows future interactions with the table (until re-enabled).
30
+ *
31
+ * @returns DataTables Api instance
32
+ */
33
+ disable(): Api;
34
+
35
+ /**
36
+ * Enable end user and API modification of the focused cells in the DataTable. Differing levels of enablement are available via the optional parameter.
37
+ *
38
+ * @param flag can be true or false to signify whether to enable or disable
39
+ * @returns DataTables Api instance
40
+ */
41
+ enable(flag?: string | boolean): Api;
42
+
43
+ /**
44
+ * This method will return a boolean value indicating if AutoFill is enabled or not on the selected table.
45
+ *
46
+ * @returns boolean signifying if autofill is enables
47
+ */
48
+ enabled(): boolean;
49
+ }
50
+
51
+ interface AutoFillSettings {
52
+ /**
53
+ * Always ask the end user if an action should be taken or not
54
+ */
55
+ alwaysAsk?: boolean;
56
+ /**
57
+ * Select the columns that can be auto filled
58
+ */
59
+ columns: string | number[];
60
+ /**
61
+ *
62
+ * Initial enablement state of AutoFill
63
+ */
64
+ enable?: boolean;
65
+ }
66
+ }