tethys/public/js/dataTable.js

2 lines
158 KiB
JavaScript
Raw Normal View History

2022-08-05 08:11:17 +00:00
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],(function(e){return t(e,window,document)})):"object"==typeof exports?module.exports=function(e,n){return e||(e=window),n||(n="undefined"!=typeof window?require("jquery"):require("jquery")(e)),t(n,e,e.document)}:window.DataTable=t(jQuery,window,document)}((function(t,e,n,r){"use strict";var a,o,l,i,s=function(e,n){if(this instanceof s)return t(e).DataTable(n);n=e,this.$=function(t,e){return this.api(!0).$(t,e)},this._=function(t,e){return this.api(!0).rows(t,e).data()},this.api=function(t){return new o(t?se(this[a.iApiIndex]):this)},this.fnAddData=function(e,n){var a=this.api(!0),o=Array.isArray(e)&&(Array.isArray(e[0])||t.isPlainObject(e[0]))?a.rows.add(e):a.row.add(e);return(n===r||n)&&a.draw(),o.flatten().toArray()},this.fnAdjustColumnSizing=function(t){var e=this.api(!0).columns.adjust(),n=e.settings()[0],a=n.oScroll;t===r||t?e.draw(!1):""===a.sX&&""===a.sY||Ut(n)},this.fnClearTable=function(t){var e=this.api(!0).clear();(t===r||t)&&e.draw()},this.fnClose=function(t){this.api(!0).row(t).child.hide()},this.fnDeleteRow=function(t,e,n){var a=this.api(!0),o=a.rows(t),l=o.settings()[0],i=l.aoData[o[0][0]];return o.remove(),e&&e.call(this,l,i),(n===r||n)&&a.draw(),i},this.fnDestroy=function(t){this.api(!0).destroy(t)},this.fnDraw=function(t){this.api(!0).draw(t)},this.fnFilter=function(t,e,n,a,o,l){var i=this.api(!0);null===e||e===r?i.search(t,n,a,l):i.column(e).search(t,n,a,l),i.draw()},this.fnGetData=function(t,e){var n=this.api(!0);if(t!==r){var a=t.nodeName?t.nodeName.toLowerCase():"";return e!==r||"td"==a||"th"==a?n.cell(t,e).data():n.row(t).data()||null}return n.data().toArray()},this.fnGetNodes=function(t){var e=this.api(!0);return t!==r?e.row(t).node():e.rows().nodes().flatten().toArray()},this.fnGetPosition=function(t){var e=this.api(!0),n=t.nodeName.toUpperCase();if("TR"==n)return e.row(t).index();if("TD"==n||"TH"==n){var r=e.cell(t).index();return[r.row,r.columnVisible,r.column]}return null},this.fnIsOpen=function(t){return this.api(!0).row(t).child.isShown()},this.fnOpen=function(t,e,n){return this.api(!0).row(t).child(e,n).show().child()[0]},this.fnPageChange=function(t,e){var n=this.api(!0).page(t);(e===r||e)&&n.draw(!1)},this.fnSetColumnVis=function(t,e,n){var a=this.api(!0).column(t).visible(e);(n===r||n)&&a.columns.adjust().draw()},this.fnSettings=function(){return se(this[a.iApiIndex])},this.fnSort=function(t){this.api(!0).order(t).draw()},this.fnSortListener=function(t,e,n){this.api(!0).order.listener(t,e,n)},this.fnUpdate=function(t,e,n,a,o){var l=this.api(!0);return n===r||null===n?l.row(e).data(t):l.cell(e,n).data(t),(o===r||o)&&l.columns.adjust(),(a===r||a)&&l.draw(),0},this.fnVersionCheck=a.fnVersionCheck;var l=this,i=n===r,d=this.length;for(var u in i&&(n={}),this.oApi=this.internal=a.internal,s.ext.internal)u&&(this[u]=qe(u));return this.each((function(){var e,a=d>1?ce({},n,!0):n,o=0,u=this.getAttribute("id"),c=!1,f=s.defaults,p=t(this);if("table"==this.nodeName.toLowerCase()){N(f),L(f.column),A(f,f,!0),A(f.column,f.column,!0),A(f,t.extend(a,p.data()),!0);var h=s.settings;for(o=0,e=h.length;o<e;o++){var m=h[o];if(m.nTable==this||m.nTHead&&m.nTHead.parentNode==this||m.nTFoot&&m.nTFoot.parentNode==this){var b=a.bRetrieve!==r?a.bRetrieve:f.bRetrieve,g=a.bDestroy!==r?a.bDestroy:f.bDestroy;if(i||b)return m.oInstance;if(g){m.oInstance.fnDestroy();break}return void de(m,0,"Cannot reinitialise DataTable",3)}if(m.sTableId==this.id){h.splice(o,1);break}}null!==u&&""!==u||(u="DataTables_Table_"+s.ext._unique++,this.id=u);var y=t.extend(!0,{},s.models.oSettings,{sDestroyWidth:p[0].style.width,sInstance:u,sTableId:u});y.nTable=this,y.oApi=l.internal,y.oInit=a,h.push(y),y.oInstance=1===l.length?l:p.dataTable(),N(a),B(a.oLanguage),a.aLengthMenu&&!a.iDisplayLength&&(a.iDisplayLength=Array.isArray(a.aLengthMenu[0])?a.aLengthMenu[0][0]:a.aLengthMenu[0]),a=ce(t.extend(!0,{},f),a),ue(y.oFeatures,a,["bPaginate","bLengthChange","bFilter","bSort","bSortMulti","bInfo","bProcessing","bAutoWidth","bSortClasses","bServerSide","bDeferRender"]),