tabulator-tables
Advanced tools
Comparing version 4.6.1 to 4.6.2
{ | ||
"name": "tabulator", | ||
"main": "dist/js/tabulator.js", | ||
"version": "4.6.1", | ||
"version": "4.6.2", | ||
"description": "Interactive table generation JavaScript library", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ /* |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","tabulator","jquery-ui"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery"),require("tabulator"),require("jquery-ui")):e(jQuery,Tabulator)}(function(e,t){e.widget("ui.tabulator",{_create:function(){var e=Object.assign({},this.options);delete e.create,delete e.disabled,this.table=new t(this.element[0],e);for(var o in t.prototype)"function"==typeof t.prototype[o]&&"_"!==o.charAt(0)&&(this[o]=this.table[o].bind(this.table))},_setOption:function(e,t){console.error("Tabulator jQuery wrapper does not support setting options after the table has been instantiated")},_destroy:function(e,t){this.table.destroy()}})}); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Accessor = function Accessor(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},Accessor=function(o){this.table=o,this.allowedTypes=["","data","download","clipboard","print","htmlOutput"]};Accessor.prototype.initializeColumn=function(o){var e=this,s=!1,r={};this.allowedTypes.forEach(function(t){var c,a="accessor"+(t.charAt(0).toUpperCase()+t.slice(1));o.definition[a]&&(c=e.lookupAccessor(o.definition[a]))&&(s=!0,r[a]={accessor:c,params:o.definition[a+"Params"]||{}})}),s&&(o.modules.accessor=r)},Accessor.prototype.lookupAccessor=function(o){var e=!1;switch(void 0===o?"undefined":_typeof(o)){case"string":this.accessors[o]?e=this.accessors[o]:console.warn("Accessor Error - No such accessor found, ignoring: ",o);break;case"function":e=o}return e},Accessor.prototype.transformRow=function(o,e){var s=this,r="accessor"+(e.charAt(0).toUpperCase()+e.slice(1)),t=Tabulator.prototype.helpers.deepClone(o||{});return s.table.columnManager.traverse(function(o){var s,c,a,n;o.modules.accessor&&(c=o.modules.accessor[r]||o.modules.accessor.accessor||!1)&&"undefined"!=(s=o.getFieldValue(t))&&(n=o.getComponent(),a="function"==typeof c.params?c.params(s,t,e,n):c.params,o.setFieldValue(t,c.accessor(s,t,e,a,n)))}),t},Accessor.prototype.accessors={},Tabulator.prototype.registerModule("accessor",Accessor); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Ajax = function Ajax(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ajax=function(e){this.table=e,this.config=!1,this.url="",this.urlGenerator=!1,this.params=!1,this.loaderElement=this.createLoaderElement(),this.msgElement=this.createMsgElement(),this.loadingElement=!1,this.errorElement=!1,this.loaderPromise=!1,this.progressiveLoad=!1,this.loading=!1,this.requestOrder=0};Ajax.prototype.initialize=function(){var e;this.loaderElement.appendChild(this.msgElement),this.table.options.ajaxLoaderLoading&&("string"==typeof this.table.options.ajaxLoaderLoading?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderLoading.trim(),this.loadingElement=e.content.firstChild):this.loadingElement=this.table.options.ajaxLoaderLoading),this.loaderPromise=this.table.options.ajaxRequestFunc||this.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||this.defaultURLGenerator,this.table.options.ajaxLoaderError&&("string"==typeof this.table.options.ajaxLoaderError?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderError.trim(),this.errorElement=e.content.firstChild):this.errorElement=this.table.options.ajaxLoaderError),this.table.options.ajaxParams&&this.setParams(this.table.options.ajaxParams),this.table.options.ajaxConfig&&this.setConfig(this.table.options.ajaxConfig),this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.table.options.ajaxProgressiveLoad&&(this.table.options.pagination?(this.progressiveLoad=!1,console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time")):this.table.modExists("page")?(this.progressiveLoad=this.table.options.ajaxProgressiveLoad,this.table.modules.page.initializeProgressive(this.progressiveLoad)):console.error("Pagination plugin is required for progressive ajax loading"))},Ajax.prototype.createLoaderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader"),e},Ajax.prototype.createMsgElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader-msg"),e.setAttribute("role","alert"),e},Ajax.prototype.setParams=function(e,t){if(t){this.params=this.params||{};for(var o in e)this.params[o]=e[o]}else this.params=e},Ajax.prototype.getParams=function(){return this.params||{}},Ajax.prototype.setConfig=function(e){if(this._loadDefaultConfig(),"string"==typeof e)this.config.method=e;else for(var t in e)this.config[t]=e[t]},Ajax.prototype._loadDefaultConfig=function(e){var t=this;if(!t.config||e){t.config={};for(var o in t.defaultConfig)t.config[o]=t.defaultConfig[o]}},Ajax.prototype.setUrl=function(e){this.url=e},Ajax.prototype.getUrl=function(){return this.url},Ajax.prototype.loadData=function(e,t){return this.progressiveLoad?this._loadDataProgressive():this._loadDataStandard(e,t)},Ajax.prototype.nextPage=function(e){var t;this.loading||(t=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.getElement().clientHeight,e<t&&this.table.modules.page.nextPage().then(function(){}).catch(function(){}))},Ajax.prototype.blockActiveRequest=function(){this.requestOrder++},Ajax.prototype._loadDataProgressive=function(){return this.table.rowManager.setData([]),this.table.modules.page.setPage(1)},Ajax.prototype._loadDataStandard=function(e,t){var o=this;return new Promise(function(a,r){o.sendRequest(e).then(function(i){o.table.rowManager.setData(i,e,t).then(function(){a()}).catch(function(e){r(e)})}).catch(function(e){r(e)})})},Ajax.prototype.generateParamsList=function(e,t){var o=this,a=[];if(t=t||"",Array.isArray(e))e.forEach(function(e,r){a=a.concat(o.generateParamsList(e,t?t+"["+r+"]":r))});else if("object"===(void 0===e?"undefined":_typeof(e)))for(var r in e)a=a.concat(o.generateParamsList(e[r],t?t+"["+r+"]":r));else a.push({key:t,value:e});return a},Ajax.prototype.serializeParams=function(e){var t=this.generateParamsList(e),o=[];return t.forEach(function(e){o.push(encodeURIComponent(e.key)+"="+encodeURIComponent(e.value))}),o.join("&")},Ajax.prototype.sendRequest=function(e){var t,o=this,a=this,r=a.url;return a.requestOrder++,t=a.requestOrder,a._loadDefaultConfig(),new Promise(function(i,n){!1!==a.table.options.ajaxRequesting.call(o.table,a.url,a.params)?(a.loading=!0,e||a.showLoader(),o.loaderPromise(r,a.config,a.params).then(function(e){t===a.requestOrder?(a.table.options.ajaxResponse&&(e=a.table.options.ajaxResponse.call(a.table,a.url,a.params,e)),i(e),a.hideLoader(),a.loading=!1):console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made")}).catch(function(e){console.error("Ajax Load Error: ",e),a.table.options.ajaxError.call(a.table,e),a.showError(),setTimeout(function(){a.hideLoader()},3e3),a.loading=!1,n()})):n()})},Ajax.prototype.showLoader=function(){if("function"==typeof this.table.options.ajaxLoader?this.table.options.ajaxLoader():this.table.options.ajaxLoader){for(this.hideLoader();this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.remove("tabulator-error"),this.msgElement.classList.add("tabulator-loading"),this.loadingElement?this.msgElement.appendChild(this.loadingElement):this.msgElement.innerHTML=this.table.modules.localize.getText("ajax|loading"),this.table.element.appendChild(this.loaderElement)}},Ajax.prototype.showError=function(){for(this.hideLoader();this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.remove("tabulator-loading"),this.msgElement.classList.add("tabulator-error"),this.errorElement?this.msgElement.appendChild(this.errorElement):this.msgElement.innerHTML=this.table.modules.localize.getText("ajax|error"),this.table.element.appendChild(this.loaderElement)},Ajax.prototype.hideLoader=function(){this.loaderElement.parentNode&&this.loaderElement.parentNode.removeChild(this.loaderElement)},Ajax.prototype.defaultConfig={method:"GET"},Ajax.prototype.defaultURLGenerator=function(e,t,o){return e&&o&&Object.keys(o).length&&(t.method&&"get"!=t.method.toLowerCase()||(t.method="get",e+=(e.includes("?")?"&":"?")+this.serializeParams(o))),e},Ajax.prototype.defaultLoaderPromise=function(e,t,o){var a,r=this;return new Promise(function(i,n){if(e=r.urlGenerator(e,t,o),"GET"!=t.method.toUpperCase())if(a="object"===_typeof(r.table.options.ajaxContentType)?r.table.options.ajaxContentType:r.contentTypeFormatters[r.table.options.ajaxContentType]){for(var s in a.headers)t.headers||(t.headers={}),void 0===t.headers[s]&&(t.headers[s]=a.headers[s]);t.body=a.body.call(r,e,t,o)}else console.warn("Ajax Error - Invalid ajaxContentType value:",r.table.options.ajaxContentType);e?(void 0===t.headers&&(t.headers={}),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),void 0===t.headers["X-Requested-With"]&&(t.headers["X-Requested-With"]="XMLHttpRequest"),void 0===t.mode&&(t.mode="cors"),"cors"==t.mode?(void 0===t.headers["Access-Control-Allow-Origin"]&&(t.headers["Access-Control-Allow-Origin"]=window.location.origin),void 0===t.credentials&&(t.credentials="same-origin")):void 0===t.credentials&&(t.credentials="include"),fetch(e,t).then(function(e){e.ok?e.json().then(function(e){i(e)}).catch(function(e){n(e),console.warn("Ajax Load Error - Invalid JSON returned",e)}):(console.error("Ajax Load Error - Connection Error: "+e.status,e.statusText),n(e))}).catch(function(e){console.error("Ajax Load Error - Connection Error: ",e),n(e)})):(console.warn("Ajax Load Error - No URL Set"),i([]))})},Ajax.prototype.contentTypeFormatters={json:{headers:{"Content-Type":"application/json"},body:function(e,t,o){return JSON.stringify(o)}},form:{headers:{},body:function(e,t,o){var a=this.generateParamsList(o),r=new FormData;return a.forEach(function(e){r.append(e.key,e.value)}),r}}},Tabulator.prototype.registerModule("ajax",Ajax); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var ColumnCalcs = function ColumnCalcs(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ColumnCalcs=function(t){this.table=t,this.topCalcs=[],this.botCalcs=[],this.genColumn=!1,this.topElement=this.createElement(),this.botElement=this.createElement(),this.topRow=!1,this.botRow=!1,this.topInitialized=!1,this.botInitialized=!1,this.initialize()};ColumnCalcs.prototype.createElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-calcs-holder"),t},ColumnCalcs.prototype.initialize=function(){this.genColumn=new Column({field:"value"},this)},ColumnCalcs.prototype.registerColumnField=function(){},ColumnCalcs.prototype.initializeColumn=function(t){var o=t.definition,e={topCalcParams:o.topCalcParams||{},botCalcParams:o.bottomCalcParams||{}};if(o.topCalc){switch(_typeof(o.topCalc)){case"string":this.calculations[o.topCalc]?e.topCalc=this.calculations[o.topCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",o.topCalc);break;case"function":e.topCalc=o.topCalc}e.topCalc&&(t.modules.columnCalcs=e,this.topCalcs.push(t),"group"!=this.table.options.columnCalcs&&this.initializeTopRow())}if(o.bottomCalc){switch(_typeof(o.bottomCalc)){case"string":this.calculations[o.bottomCalc]?e.botCalc=this.calculations[o.bottomCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",o.bottomCalc);break;case"function":e.botCalc=o.bottomCalc}e.botCalc&&(t.modules.columnCalcs=e,this.botCalcs.push(t),"group"!=this.table.options.columnCalcs&&this.initializeBottomRow())}},ColumnCalcs.prototype.removeCalcs=function(){var t=!1;this.topInitialized&&(this.topInitialized=!1,this.topElement.parentNode.removeChild(this.topElement),t=!0),this.botInitialized&&(this.botInitialized=!1,this.table.footerManager.remove(this.botElement),t=!0),t&&this.table.rowManager.adjustTableSize()},ColumnCalcs.prototype.initializeTopRow=function(){this.topInitialized||(this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling),this.topInitialized=!0)},ColumnCalcs.prototype.initializeBottomRow=function(){this.botInitialized||(this.table.footerManager.prepend(this.botElement),this.botInitialized=!0)},ColumnCalcs.prototype.scrollHorizontal=function(t){this.table.columnManager.getElement().scrollWidth,this.table.element.clientWidth;this.botInitialized&&(this.botRow.getElement().style.marginLeft=-t+"px")},ColumnCalcs.prototype.recalc=function(t){var o;if(this.topInitialized||this.botInitialized){if(this.rowsToData(t),this.topInitialized){for(this.topRow&&this.topRow.deleteCells(),o=this.generateRow("top",this.rowsToData(t)),this.topRow=o;this.topElement.firstChild;)this.topElement.removeChild(this.topElement.firstChild);this.topElement.appendChild(o.getElement()),o.initialize(!0)}if(this.botInitialized){for(this.botRow&&this.botRow.deleteCells(),o=this.generateRow("bottom",this.rowsToData(t)),this.botRow=o;this.botElement.firstChild;)this.botElement.removeChild(this.botElement.firstChild);this.botElement.appendChild(o.getElement()),o.initialize(!0)}this.table.rowManager.adjustTableSize(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()}},ColumnCalcs.prototype.recalcRowGroup=function(t){this.recalcGroup(this.table.modules.groupRows.getRowGroup(t))},ColumnCalcs.prototype.recalcAll=function(){var t=this;if((this.topCalcs.length||this.botCalcs.length)&&("group"!==this.table.options.columnCalcs&&this.recalc(this.table.rowManager.activeRows),this.table.options.groupBy&&"table"!==this.table.options.columnCalcs)){table.modules.groupRows.getChildGroups().forEach(function(o){t.recalcGroup(o)})}},ColumnCalcs.prototype.recalcGroup=function(t){var o,e;t&&t.calcs&&(t.calcs.bottom&&(o=this.rowsToData(t.rows),e=this.generateRowData("bottom",o),t.calcs.bottom.updateData(e),t.calcs.bottom.reinitialize()),t.calcs.top&&(o=this.rowsToData(t.rows),e=this.generateRowData("top",o),t.calcs.top.updateData(e),t.calcs.top.reinitialize()))},ColumnCalcs.prototype.generateTopRow=function(t){return this.generateRow("top",this.rowsToData(t))},ColumnCalcs.prototype.generateBottomRow=function(t){return this.generateRow("bottom",this.rowsToData(t))},ColumnCalcs.prototype.rowsToData=function(t){var o=this,e=[];return t.forEach(function(t){if(e.push(t.getData()),o.table.options.dataTree&&o.table.options.dataTreeChildColumnCalcs&&t.modules.dataTree.open){var l=o.rowsToData(o.table.modules.dataTree.getFilteredTreeChildren(t));e=e.concat(l)}}),e},ColumnCalcs.prototype.generateRow=function(t,o){var e,l=this,i=this.generateRowData(t,o);return l.table.modExists("mutator")&&l.table.modules.mutator.disable(),e=new Row(i,this,"calc"),l.table.modExists("mutator")&&l.table.modules.mutator.enable(),e.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+t),e.generateCells=function(){var o=[];l.table.columnManager.columnsByIndex.forEach(function(i){l.genColumn.setField(i.getField()),l.genColumn.hozAlign=i.hozAlign,i.definition[t+"CalcFormatter"]&&l.table.modExists("format")?l.genColumn.modules.format={formatter:l.table.modules.format.getFormatter(i.definition[t+"CalcFormatter"]),params:i.definition[t+"CalcFormatterParams"]}:l.genColumn.modules.format={formatter:l.table.modules.format.getFormatter("plaintext"),params:{}},l.genColumn.definition.cssClass=i.definition.cssClass;var a=new Cell(l.genColumn,e);a.column=i,a.setWidth(),i.cells.push(a),o.push(a),i.visible||a.hide()}),this.cells=o},e},ColumnCalcs.prototype.generateRowData=function(t,o){var e,l,i={},a="top"==t?this.topCalcs:this.botCalcs,n="top"==t?"topCalc":"botCalc";return a.forEach(function(t){var a=[];t.modules.columnCalcs&&t.modules.columnCalcs[n]&&(o.forEach(function(o){a.push(t.getFieldValue(o))}),l=n+"Params",e="function"==typeof t.modules.columnCalcs[l]?t.modules.columnCalcs[l](a,o):t.modules.columnCalcs[l],t.setFieldValue(i,t.modules.columnCalcs[n](a,o,e)))}),i},ColumnCalcs.prototype.hasTopCalcs=function(){return!!this.topCalcs.length},ColumnCalcs.prototype.hasBottomCalcs=function(){return!!this.botCalcs.length},ColumnCalcs.prototype.redraw=function(){this.topRow&&this.topRow.normalizeHeight(!0),this.botRow&&this.botRow.normalizeHeight(!0)},ColumnCalcs.prototype.getResults=function(){var t,o=this,e={};return this.table.options.groupBy&&this.table.modExists("groupRows")?(t=this.table.modules.groupRows.getGroups(!0),t.forEach(function(t){e[t.getKey()]=o.getGroupResults(t)})):e={top:this.topRow?this.topRow.getData():{},bottom:this.botRow?this.botRow.getData():{}},e},ColumnCalcs.prototype.getGroupResults=function(t){var o=this,e=t._getSelf(),l=t.getSubGroups(),i={};return l.forEach(function(t){i[t.getKey()]=o.getGroupResults(t)}),{top:e.calcs.top?e.calcs.top.getData():{},bottom:e.calcs.bottom?e.calcs.bottom.getData():{},groups:i}},ColumnCalcs.prototype.calculations={avg:function(t,o,e){var l=0,i=void 0!==e.precision?e.precision:2;return t.length&&(l=t.reduce(function(t,o){return o=Number(o),t+o}),l/=t.length,l=!1!==i?l.toFixed(i):l),parseFloat(l).toString()},max:function(t,o,e){var l=null,i=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))>l||null===l)&&(l=t)}),null!==l?!1!==i?l.toFixed(i):l:""},min:function(t,o,e){var l=null,i=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))<l||null===l)&&(l=t)}),null!==l?!1!==i?l.toFixed(i):l:""},sum:function(t,o,e){var l=0,i=void 0!==e.precision&&e.precision;return t.length&&t.forEach(function(t){t=Number(t),l+=isNaN(t)?0:Number(t)}),!1!==i?l.toFixed(i):l},concat:function(t,o,e){var l=0;return t.length&&(l=t.reduce(function(t,o){return String(t)+String(o)})),l},count:function(t,o,e){var l=0;return t.length&&t.forEach(function(t){t&&l++}),l}},Tabulator.prototype.registerModule("columnCalcs",ColumnCalcs); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Clipboard = function Clipboard(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Clipboard=function(t){this.table=t,this.mode=!0,this.pasteParser=function(){},this.pasteAction=function(){},this.customSelection=!1,this.rowRange=!1,this.blocked=!0};Clipboard.prototype.initialize=function(){var t=this;this.mode=this.table.options.clipboard,this.rowRange=this.table.options.clipboardCopyRowRange,!0!==this.mode&&"copy"!==this.mode||this.table.element.addEventListener("copy",function(e){var a,o;t.blocked||(e.preventDefault(),t.customSelection?(a=t.customSelection,t.table.options.clipboardCopyFormatter&&(a=t.table.options.clipboardCopyFormatter("plain",a))):(o=t.table.modules.export.getHtml(t.rowRange,t.table.options.clipboardCopyStyled,t.table.options.clipboardCopyConfig,"clipboard"),a=o?t.generatePlainContent(o):"",t.table.options.clipboardCopyFormatter&&(a=t.table.options.clipboardCopyFormatter("plain",a),o=t.table.options.clipboardCopyFormatter("html",o))),window.clipboardData&&window.clipboardData.setData?window.clipboardData.setData("Text",a):e.clipboardData&&e.clipboardData.setData?(e.clipboardData.setData("text/plain",a),o&&e.clipboardData.setData("text/html",o)):e.originalEvent&&e.originalEvent.clipboardData.setData&&(e.originalEvent.clipboardData.setData("text/plain",a),o&&e.originalEvent.clipboardData.setData("text/html",o)),t.table.options.clipboardCopied.call(t.table,a,o),t.reset())}),!0!==this.mode&&"paste"!==this.mode||this.table.element.addEventListener("paste",function(e){t.paste(e)}),this.setPasteParser(this.table.options.clipboardPasteParser),this.setPasteAction(this.table.options.clipboardPasteAction)},Clipboard.prototype.reset=function(){this.blocked=!1,this.originalSelectionText=""},Clipboard.prototype.generatePlainContent=function(t){var e=[],a=document.createElement("div");a.innerHTML=t;var o=a.getElementsByTagName("table")[0];return Array.prototype.slice.call(o.getElementsByTagName("tr")).forEach(function(t){var a=[],o=Array.prototype.slice.call(t.getElementsByTagName("th")),i=Array.prototype.slice.call(t.getElementsByTagName("td"));i=i.concat(o),i.forEach(function(t){var e=t.innerHTML;e=" "==e?"":e,a.push(e)}),e.push(a.join("\t"))}),e.join("\n")},Clipboard.prototype.copy=function(t,e){var t,a,o;this.blocked=!1,this.customSelection=!1,!0!==this.mode&&"copy"!==this.mode||(this.rowRange=t||this.table.options.clipboardCopyRowRange,void 0!==window.getSelection&&void 0!==document.createRange?(t=document.createRange(),t.selectNodeContents(this.table.element),a=window.getSelection(),a.toString()&&e&&(this.customSelection=a.toString()),a.removeAllRanges(),a.addRange(t)):void 0!==document.selection&&void 0!==document.body.createTextRange&&(o=document.body.createTextRange(),o.moveToElementText(this.table.element),o.select()),document.execCommand("copy"),a&&a.removeAllRanges())},Clipboard.prototype.setPasteAction=function(t){switch(void 0===t?"undefined":_typeof(t)){case"string":this.pasteAction=this.pasteActions[t],this.pasteAction||console.warn("Clipboard Error - No such paste action found:",t);break;case"function":this.pasteAction=t}},Clipboard.prototype.setPasteParser=function(t){switch(void 0===t?"undefined":_typeof(t)){case"string":this.pasteParser=this.pasteParsers[t],this.pasteParser||console.warn("Clipboard Error - No such paste parser found:",t);break;case"function":this.pasteParser=t}},Clipboard.prototype.paste=function(t){var e,a,o;this.checkPaseOrigin(t)&&(e=this.getPasteData(t),a=this.pasteParser.call(this,e),a?(t.preventDefault(),this.table.modExists("mutator")&&(a=this.mutateData(a)),o=this.pasteAction.call(this,a),this.table.options.clipboardPasted.call(this.table,e,a,o)):this.table.options.clipboardPasteError.call(this.table,e))},Clipboard.prototype.mutateData=function(t){var e=this,a=[];return Array.isArray(t)?t.forEach(function(t){a.push(e.table.modules.mutator.transformRow(t,"clipboard"))}):a=t,a},Clipboard.prototype.checkPaseOrigin=function(t){var e=!0;return("DIV"!=t.target.tagName||this.table.modules.edit.currentCell)&&(e=!1),e},Clipboard.prototype.getPasteData=function(t){var e;return window.clipboardData&&window.clipboardData.getData?e=window.clipboardData.getData("Text"):t.clipboardData&&t.clipboardData.getData?e=t.clipboardData.getData("text/plain"):t.originalEvent&&t.originalEvent.clipboardData.getData&&(e=t.originalEvent.clipboardData.getData("text/plain")),e},Clipboard.prototype.pasteParsers={table:function(t){var e=[],a=!0,o=this.table.columnManager.columns,i=[],n=[];return t=t.split("\n"),t.forEach(function(t){e.push(t.split("\t"))}),!(!e.length||1===e.length&&e[0].length<2)&&(!0,e[0].forEach(function(t){var e=o.find(function(e){return t&&e.definition.title&&t.trim()&&e.definition.title.trim()===t.trim()});e?i.push(e):a=!1}),a||(a=!0,i=[],e[0].forEach(function(t){var e=o.find(function(e){return t&&e.field&&t.trim()&&e.field.trim()===t.trim()});e?i.push(e):a=!1}),a||(i=this.table.columnManager.columnsByIndex)),a&&e.shift(),e.forEach(function(t){var e={};t.forEach(function(t,a){i[a]&&(e[i[a].field]=t)}),n.push(e)}),n)}},Clipboard.prototype.pasteActions={replace:function(t){return this.table.setData(t)},update:function(t){return this.table.updateOrAddData(t)},insert:function(t){return this.table.addData(t)}},Tabulator.prototype.registerModule("clipboard",Clipboard); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var DataTree = function DataTree(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},DataTree=function(e){this.table=e,this.indent=10,this.field="",this.collapseEl=null,this.expandEl=null,this.branchEl=null,this.elementField=!1,this.startOpen=function(){},this.displayIndex=0};DataTree.prototype.initialize=function(){var e=null,t=this.table.columnManager.getFirstVisibileColumn(),a=this.table.options;switch(this.field=a.dataTreeChildField,this.indent=a.dataTreeChildIndent,this.elementField=a.dataTreeElementColumn||!!t&&t.field,a.dataTreeBranchElement&&(!0===a.dataTreeBranchElement?(this.branchEl=document.createElement("div"),this.branchEl.classList.add("tabulator-data-tree-branch")):"string"==typeof a.dataTreeBranchElement?(e=document.createElement("div"),e.innerHTML=a.dataTreeBranchElement,this.branchEl=e.firstChild):this.branchEl=a.dataTreeBranchElement),a.dataTreeCollapseElement?"string"==typeof a.dataTreeCollapseElement?(e=document.createElement("div"),e.innerHTML=a.dataTreeCollapseElement,this.collapseEl=e.firstChild):this.collapseEl=a.dataTreeCollapseElement:(this.collapseEl=document.createElement("div"),this.collapseEl.classList.add("tabulator-data-tree-control"),this.collapseEl.tabIndex=0,this.collapseEl.innerHTML="<div class='tabulator-data-tree-control-collapse'></div>"),a.dataTreeExpandElement?"string"==typeof a.dataTreeExpandElement?(e=document.createElement("div"),e.innerHTML=a.dataTreeExpandElement,this.expandEl=e.firstChild):this.expandEl=a.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.tabIndex=0,this.expandEl.innerHTML="<div class='tabulator-data-tree-control-expand'></div>"),_typeof(a.dataTreeStartExpanded)){case"boolean":this.startOpen=function(e,t){return a.dataTreeStartExpanded};break;case"function":this.startOpen=a.dataTreeStartExpanded;break;default:this.startOpen=function(e,t){return a.dataTreeStartExpanded[t]}}},DataTree.prototype.initializeRow=function(e){var t=e.getData()[this.field],a=Array.isArray(t),r=a||!a&&"object"===(void 0===t?"undefined":_typeof(t))&&null!==t;!r&&e.modules.dataTree&&e.modules.dataTree.branchEl&&e.modules.dataTree.branchEl.parentNode.removeChild(e.modules.dataTree.branchEl),!r&&e.modules.dataTree&&e.modules.dataTree.controlEl&&e.modules.dataTree.controlEl.parentNode.removeChild(e.modules.dataTree.controlEl),e.modules.dataTree={index:0,open:!!r&&(e.modules.dataTree?e.modules.dataTree.open:this.startOpen(e.getComponent(),0)),controlEl:!(!e.modules.dataTree||!r)&&e.modules.dataTree.controlEl,branchEl:!(!e.modules.dataTree||!r)&&e.modules.dataTree.branchEl,parent:!1,children:r}},DataTree.prototype.layoutRow=function(e){var t=this.elementField?e.getCell(this.elementField):e.getCells()[0],a=t.getElement(),r=e.modules.dataTree;r.branchEl&&(r.branchEl.parentNode.removeChild(r.branchEl),r.branchEl=!1),r.controlEl&&(r.controlEl.parentNode.removeChild(r.controlEl),r.controlEl=!1),this.generateControlElement(e,a),e.element.classList.add("tabulator-tree-level-"+r.index),r.index&&(this.branchEl?(r.branchEl=this.branchEl.cloneNode(!0),a.insertBefore(r.branchEl,a.firstChild),r.branchEl.style.marginLeft=(r.branchEl.offsetWidth+r.branchEl.style.marginRight)*(r.index-1)+r.index*this.indent+"px"):a.style.paddingLeft=parseInt(window.getComputedStyle(a,null).getPropertyValue("padding-left"))+r.index*this.indent+"px")},DataTree.prototype.generateControlElement=function(e,t){var a=this,r=e.modules.dataTree,t=t||e.getCells()[0].getElement(),n=r.controlEl;!1!==r.children&&(r.open?(r.controlEl=this.collapseEl.cloneNode(!0),r.controlEl.addEventListener("click",function(t){t.stopPropagation(),a.collapseRow(e)})):(r.controlEl=this.expandEl.cloneNode(!0),r.controlEl.addEventListener("click",function(t){t.stopPropagation(),a.expandRow(e)})),r.controlEl.addEventListener("mousedown",function(e){e.stopPropagation()}),n&&n.parentNode===t?n.parentNode.replaceChild(r.controlEl,n):t.insertBefore(r.controlEl,t.firstChild))},DataTree.prototype.setDisplayIndex=function(e){this.displayIndex=e},DataTree.prototype.getDisplayIndex=function(){return this.displayIndex},DataTree.prototype.getRows=function(e){var t=this,a=[];return e.forEach(function(e,r){var n,l;a.push(e),e instanceof Row&&(n=e.modules.dataTree.children,n.index||!1===n.children||(l=t.getChildren(e),l.forEach(function(e){a.push(e)})))}),a},DataTree.prototype.getChildren=function(e){var t=this,a=e.modules.dataTree,r=[],n=[];return!1!==a.children&&a.open&&(Array.isArray(a.children)||(a.children=this.generateChildren(e)),r=this.table.modExists("filter")?this.table.modules.filter.filter(a.children):a.children,this.table.modExists("sort")&&this.table.modules.sort.sort(r),r.forEach(function(e){n.push(e),t.getChildren(e).forEach(function(e){n.push(e)})})),n},DataTree.prototype.generateChildren=function(e){var t=this,a=[],r=e.getData()[this.field];return Array.isArray(r)||(r=[r]),r.forEach(function(r){var n=new Row(r||{},t.table.rowManager);n.modules.dataTree.index=e.modules.dataTree.index+1,n.modules.dataTree.parent=e,n.modules.dataTree.children&&(n.modules.dataTree.open=t.startOpen(n.getComponent(),n.modules.dataTree.index)),a.push(n)}),a},DataTree.prototype.expandRow=function(e,t){var a=e.modules.dataTree;!1!==a.children&&(a.open=!0,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowExpanded(e.getComponent(),e.modules.dataTree.index))},DataTree.prototype.collapseRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open=!1,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowCollapsed(e.getComponent(),e.modules.dataTree.index))},DataTree.prototype.toggleRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open?this.collapseRow(e):this.expandRow(e))},DataTree.prototype.getTreeParent=function(e){return!!e.modules.dataTree.parent&&e.modules.dataTree.parent.getComponent()},DataTree.prototype.getFilteredTreeChildren=function(e){var t,a=e.modules.dataTree,r=[];return a.children&&(Array.isArray(a.children)||(a.children=this.generateChildren(e)),t=this.table.modExists("filter")?this.table.modules.filter.filter(a.children):a.children,t.forEach(function(e){e instanceof Row&&r.push(e)})),r},DataTree.prototype.getTreeChildren=function(e){var t=e.modules.dataTree,a=[];return t.children&&(Array.isArray(t.children)||(t.children=this.generateChildren(e)),t.children.forEach(function(e){e instanceof Row&&a.push(e.getComponent())})),a},DataTree.prototype.checkForRestyle=function(e){e.row.cells.indexOf(e)||!1!==e.row.modules.dataTree.children&&e.row.reinitialize()},DataTree.prototype.getChildField=function(){return this.field},DataTree.prototype.redrawNeeded=function(e){return!!this.field&&void 0!==e[this.field]||!!this.elementField&&void 0!==e[this.elementField]},Tabulator.prototype.registerModule("dataTree",DataTree); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Download = function Download(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},Download=function(o){this.table=o,this.fields={},this.columnsByIndex=[],this.columnsByField={},this.config={},this.active=!1};Download.prototype.download=function(o,t,n,e,i){function s(n,e){i?!0===i?a.triggerDownload(n,e,o,t,!0):i(n):a.triggerDownload(n,e,o,t)}var a=this,r=!1;this.processConfig(),this.active=e,"function"==typeof o?r=o:a.downloaders[o]?r=a.downloaders[o]:console.warn("Download Error - No such download type found: ",o),this.processColumns(),r&&r.call(this,a.processDefinitions(),a.processData(e||"active"),n||{},s,this.config)},Download.prototype.processConfig=function(){var o={columnGroups:!0,rowGroups:!0,columnCalcs:!0,dataTree:!0};if(this.table.options.downloadConfig)for(var t in this.table.options.downloadConfig)o[t]=this.table.options.downloadConfig[t];this.config.rowGroups=o.rowGroups&&this.table.options.groupBy&&this.table.modExists("groupRows"),o.columnGroups&&this.table.columnManager.columns.length!=this.table.columnManager.columnsByIndex.length&&(this.config.columnGroups=!0),o.columnCalcs&&this.table.modExists("columnCalcs")&&(this.config.columnCalcs=!0),o.dataTree&&this.table.options.dataTree&&this.table.modExists("dataTree")&&(this.config.dataTree=!0)},Download.prototype.processColumns=function(){var o=this;o.columnsByIndex=[],o.columnsByField={},o.table.columnManager.columnsByIndex.forEach(function(t){t.field&&!1!==t.definition.download&&(t.visible||!t.visible&&t.definition.download)&&(o.columnsByIndex.push(t),o.columnsByField[t.field]=t)})},Download.prototype.processDefinitions=function(){var o=this,t=[];return this.config.columnGroups?o.table.columnManager.columns.forEach(function(n){var e=o.processColumnGroup(n);e&&t.push(e)}):o.columnsByIndex.forEach(function(n){!1!==n.download&&t.push(o.processDefinition(n))}),t},Download.prototype.processColumnGroup=function(o){var t=this,n=o.columns,e=0,i=this.processDefinition(o),s={type:"group",title:i.title,depth:1};if(n.length){if(s.subGroups=[],s.width=0,n.forEach(function(o){var n=t.processColumnGroup(o);n.depth>e&&(e=n.depth),n&&(s.width+=n.width,s.subGroups.push(n))}),s.depth+=e,!s.width)return!1}else{if(!o.field||!1===o.definition.download||!(o.visible||!o.visible&&o.definition.download))return!1;s.width=1,s.definition=i}return s},Download.prototype.processDefinition=function(o){var t={};for(var n in o.definition)t[n]=o.definition[n];return void 0!==o.definition.downloadTitle&&(t.title=o.definition.downloadTitle),t},Download.prototype.processData=function(o){var t=this,n=this,e=[],i=[],s=!1,a={};return this.config.rowGroups?("visible"==o?(s=n.table.rowManager.getRows(o),s.forEach(function(o){if("row"==o.type){var t=o.getGroup();-1===i.indexOf(t)&&i.push(t)}})):i=this.table.modules.groupRows.getGroups(),i.forEach(function(o){e.push(t.processGroupData(o,s))})):(this.config.dataTree&&(o=o="display"),e=n.table.rowManager.getData(o,"download")),this.config.columnCalcs&&(a=this.table.getCalcResults(),e={calcs:a,data:e}),"function"==typeof n.table.options.downloadDataFormatter&&(e=n.table.options.downloadDataFormatter(e)),e},Download.prototype.processGroupData=function(o,t){var n=this,e=o.getSubGroups(),i={type:"group",key:o.key};return e.length?(i.subGroups=[],e.forEach(function(o){i.subGroups.push(n.processGroupData(o,t))})):t?(i.rows=[],o.rows.forEach(function(o){t.indexOf(o)>-1&&i.rows.push(o.getData("download"))})):i.rows=o.getData(!0,"download"),i},Download.prototype.triggerDownload=function(o,t,n,e,i){var s=document.createElement("a"),a=new Blob([o],{type:t}),e=e||"Tabulator."+("function"==typeof n?"txt":n);(a=this.table.options.downloadReady.call(this.table,o,a))&&(i?window.open(window.URL.createObjectURL(a)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(a,e):(s.setAttribute("href",window.URL.createObjectURL(a)),s.setAttribute("download",e),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)),this.table.options.downloadComplete&&this.table.options.downloadComplete())},Download.prototype.getFieldValue=function(o,t){var n=this.columnsByField[o];return!!n&&n.getFieldValue(t)},Download.prototype.commsReceived=function(o,t,n){switch(t){case"intercept":this.download(n.type,"",n.options,n.active,n.intercept)}},Download.prototype.downloaders={csv:function(o,t,n,e,i){function s(o,t){o.subGroups?o.subGroups.forEach(function(o){s(o,t+1)}):(f.push('"'+String(o.title).split('"').join('""')+'"'),p.push(o.definition.field))}function a(o){o.forEach(function(o){var t=[];p.forEach(function(n){var e=c.getFieldValue(n,o);switch(void 0===e?"undefined":_typeof(e)){case"object":e=JSON.stringify(e);break;case"undefined":case"null":e="";break;default:e=e}t.push('"'+String(e).split('"').join('""')+'"')}),u.push(t.join(d))})}function r(o){o.subGroups?o.subGroups.forEach(function(o){r(o)}):a(o.rows)}var u,l,c=this,f=[],p=[],d=n&&n.delimiter?n.delimiter:",";i.columnGroups?(console.warn("Download Warning - CSV downloader cannot process column groups"),o.forEach(function(o){s(o,0)})):function(){o.forEach(function(o){f.push('"'+String(o.title).split('"').join('""')+'"'),p.push(o.field)})}(),u=[f.join(d)],i.columnCalcs&&(console.warn("Download Warning - CSV downloader cannot process column calculations"),t=t.data),i.rowGroups?(console.warn("Download Warning - CSV downloader cannot process row groups"),t.forEach(function(o){r(o)})):a(t),l=u.join("\n"),n.bom&&(l="\ufeff"+l),e(l,"text/csv")},json:function(o,t,n,e,i){var s;i.columnCalcs&&(console.warn("Download Warning - CSV downloader cannot process column calculations"),t=t.data),s=JSON.stringify(t,null,"\t"),e(s,"application/json")},pdf:function(o,t,n,e,i){function s(o,t){var n=o.width,e=1,i={content:o.title||""};if(o.subGroups?(o.subGroups.forEach(function(o){s(o,t+1)}),e=1):(p.push(o.definition.field),e=m-t),i.rowSpan=e,d[t].push(i),n--,e>1)for(var a=t+1;a<m;a++)d[a].push("");for(var a=0;a<n;a++)d[t].push("")}function a(o){switch(void 0===o?"undefined":_typeof(o)){case"object":o=JSON.stringify(o);break;case"undefined":case"null":o="";break;default:o=o}return o}function r(o){o.forEach(function(o){h.push(u(o))})}function u(o,t){var n=[];return p.forEach(function(e){var i=f.getFieldValue(e,o);i=a(i),t?n.push({content:i,styles:t}):n.push(i)}),n}function l(o,t){var n=[];n.push({content:a(o.key),colSpan:p.length,styles:y}),h.push(n),o.subGroups?o.subGroups.forEach(function(n){l(n,t[o.key]?t[o.key].groups||{}:{})}):(i.columnCalcs&&c(t,o.key,"top"),r(o.rows),i.columnCalcs&&c(t,o.key,"bottom"))}function c(o,t,n){var e=o[t];e&&(n&&(e=e[n]),Object.keys(e).length&&h.push(u(e,b)))}var f=this,p=[],d=[],h=[],w={},m=1,g={},y=n.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},b=n.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},v=n.jsPDF||{},E=n&&n.title?n.title:"";if(i.columnCalcs&&(w=t.calcs,t=t.data),v.orientation||(v.orientation=n.orientation||"landscape"),v.unit||(v.unit="pt"),i.columnGroups){o.forEach(function(o){o.depth>m&&(m=o.depth)});for(var S=0;S<m;S++)d.push([]);o.forEach(function(o){s(o,0)})}else!function(){o.forEach(function(o){o.field&&(d.push(o.title||""),p.push(o.field))}),d=[d]}();i.rowGroups?t.forEach(function(o){l(o,w)}):(i.columnCalcs&&c(w,"top"),r(t),i.columnCalcs&&c(w,"bottom"));var C=new jsPDF(v);n&&n.autoTable&&(g="function"==typeof n.autoTable?n.autoTable(C)||{}:n.autoTable),E&&(g.addPageContent=function(o){C.text(E,40,30)}),g.head=d,g.body=h,C.autoTable(g),n&&n.documentProcessing&&n.documentProcessing(C),e(C.output("arraybuffer"),"application/pdf")},xlsx:function(o,t,n,e,i){function s(){function n(o,t){void 0===w[t]&&(w[t]=[]),void 0===p[t]&&(p[t]=[]),o.width>1&&p[t].push({type:"hoz",start:w[t].length,end:w[t].length+o.width-1}),w[t].push(o.title),o.subGroups?o.subGroups.forEach(function(o){n(o,t+1)}):(m.push(o.definition.field),e(m.length),p[t].push({type:"vert",start:m.length-1}))}function e(){var o=0;w.forEach(function(t){var n=t.length;n>o&&(o=n)}),w.forEach(function(t){var n=t.length;if(n<o)for(var e=n;e<o;e++)t.push("")})}function s(){var o=[];return f.forEach(function(t){o.push({s:{r:t,c:0},e:{r:t,c:m.length-1}})}),p.forEach(function(t,n){t.forEach(function(t){"hoz"===t.type?o.push({s:{r:n,c:t.start},e:{r:n,c:t.end}}):n!=w.length-1&&o.push({s:{r:n,c:t.start},e:{r:w.length-1,c:t.start}})})}),o}function a(o){o.forEach(function(o){g.push(u(o))})}function u(o){var t=[];return m.forEach(function(n){var e=r.getFieldValue(n,o);t.push(e instanceof Date||"object"!==(void 0===e?"undefined":_typeof(e))?e:JSON.stringify(e))}),t}function l(o,t,n){var e=o[t];e&&(n&&(e=e[n]),Object.keys(e).length&&(d.push(g.length),g.push(u(e))))}function h(o,t){var n=[];n.push(o.key),f.push(g.length),g.push(n),o.subGroups?o.subGroups.forEach(function(n){h(n,t[o.key]?t[o.key].groups||{}:{})}):(i.columnCalcs&&l(t,o.key,"top"),a(o.rows),i.columnCalcs&&l(t,o.key,"bottom"))}var w=[],m=[],g=[];return i.columnGroups?(o.forEach(function(o){n(o,0)}),w.forEach(function(o){g.push(o)})):function(){o.forEach(function(o){w.push(o.title),m.push(o.field)}),g.push(w)}(),i.rowGroups?t.forEach(function(o){h(o,c)}):(i.columnCalcs&&l(c,"top"),a(t),i.columnCalcs&&l(c,"bottom")),function(){var o={},t={s:{c:0,r:0},e:{c:m.length,r:g.length}};XLSX.utils.sheet_add_aoa(o,g),o["!ref"]=XLSX.utils.encode_range(t);var n=s();return n.length&&(o["!merges"]=n),o}()}var a,r=this,u=n.sheetName||"Sheet1",l=XLSX.utils.book_new(),c={},f=[],p=[],d=[];if(l.SheetNames=[],l.Sheets={},i.columnCalcs&&(c=t.calcs,t=t.data),n.sheetOnly)return void e(s());if(n.sheets)for(var h in n.sheets)!0===n.sheets[h]?(l.SheetNames.push(h),l.Sheets[h]=s()):(l.SheetNames.push(h),this.table.modules.comms.send(n.sheets[h],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},active:r.active,intercept:function(o){l.Sheets[h]=o}}));else l.SheetNames.push(u),l.Sheets[u]=s();n.documentProcessing&&(l=n.documentProcessing(l)),a=XLSX.write(l,{bookType:"xlsx",bookSST:!0,type:"binary"}),e(function(o){for(var t=new ArrayBuffer(o.length),n=new Uint8Array(t),e=0;e!=o.length;++e)n[e]=255&o.charCodeAt(e);return t}(a),"application/octet-stream")},html:function(o,t,n,e,i){this.table.modExists("export",!0)&&e(this.table.modules.export.getHtml(!0,n.style,i),"text/html")}},Tabulator.prototype.registerModule("download",Download); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -101,2 +101,3 @@ var Edit = function Edit(table) { | ||
cell.setValueActual(cell.getValue()); | ||
cell.cellRendered(); | ||
@@ -120,3 +121,3 @@ if (cell.column.cellEvents.cellEditCancelled) { | ||
if (!element.classList.contains("tabulator-editing")) { | ||
element.focus(); | ||
element.focus({ preventScroll: true }); | ||
} | ||
@@ -139,3 +140,3 @@ }); | ||
if (!(block && this.table.browser === "ie")) { | ||
cell.getElement().focus(); | ||
cell.getElement().focus({ preventScroll: true }); | ||
} | ||
@@ -150,2 +151,19 @@ this.recursionBlock = false; | ||
Edit.prototype.focusScrollAdjust = function (cell) { | ||
if (this.table.rowManager.getRenderMode() == "virtual") { | ||
var topEdge = this.table.rowManager.element.scrollTop, | ||
bottomEdge = this.table.rowManager.element.clientHeight + this.table.rowManager.element.scrollTop, | ||
rowEl = cell.row.getElement(), | ||
offset = rowEl.offsetTop; | ||
if (rowEl.offsetTop < topEdge) { | ||
this.table.rowManager.element.scrollTop -= topEdge - rowEl.offsetTop; | ||
} else { | ||
if (rowEl.offsetTop + rowEl.offsetHeight > bottomEdge) { | ||
this.table.rowManager.element.scrollTop += rowEl.offsetTop + rowEl.offsetHeight - bottomEdge; | ||
} | ||
} | ||
} | ||
}; | ||
Edit.prototype.edit = function (cell, e, forceEdit) { | ||
@@ -238,2 +256,4 @@ var self = this, | ||
this.focusScrollAdjust(cell); | ||
component = cell.getComponent(); | ||
@@ -414,3 +434,3 @@ | ||
onRendered(function () { | ||
input.focus(); | ||
input.focus({ preventScroll: true }); | ||
input.style.height = "100%"; | ||
@@ -421,3 +441,2 @@ }); | ||
if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { | ||
if (success(input.value)) { | ||
@@ -489,3 +508,3 @@ cellValue = input.value; //persist value if successfully validated incase editor is used as header filter | ||
onRendered(function () { | ||
input.focus(); | ||
input.focus({ preventScroll: true }); | ||
input.style.height = "100%"; | ||
@@ -608,3 +627,3 @@ }); | ||
input.focus(); | ||
input.focus({ preventScroll: true }); | ||
input.style.height = "100%"; | ||
@@ -701,3 +720,3 @@ | ||
onRendered(function () { | ||
input.focus(); | ||
input.focus({ preventScroll: true }); | ||
input.style.height = "100%"; | ||
@@ -977,2 +996,11 @@ }); | ||
listEl.style.left = offset.left + "px"; | ||
listEl.addEventListener("mousedown", function (e) { | ||
blurable = false; | ||
setTimeout(function () { | ||
blurable = true; | ||
}, 10); | ||
}); | ||
document.body.appendChild(listEl); | ||
@@ -1099,3 +1127,3 @@ } | ||
input.style.height = "100%"; | ||
input.focus(); | ||
input.focus({ preventScroll: true }); | ||
}); | ||
@@ -1144,2 +1172,10 @@ | ||
listEl.addEventListener("mousedown", function (e) { | ||
blurable = false; | ||
setTimeout(function () { | ||
blurable = true; | ||
}, 10); | ||
}); | ||
function getUniqueColumnValues(field) { | ||
@@ -1309,3 +1345,3 @@ var output = {}, | ||
el.addEventListener("click", function () { | ||
el.addEventListener("click", function (e) { | ||
setCurrentItem(item); | ||
@@ -1315,3 +1351,3 @@ chooseItem(); | ||
el.addEventListener("mousedown", function () { | ||
el.addEventListener("mousedown", function (e) { | ||
blurable = false; | ||
@@ -1521,3 +1557,3 @@ | ||
input.style.height = "100%"; | ||
input.focus(); | ||
input.focus({ preventScroll: true }); | ||
}); | ||
@@ -1780,2 +1816,3 @@ | ||
//right arrow | ||
e.preventDefault(); | ||
bar.style.width = bar.clientWidth + element.clientWidth / 100 + "px"; | ||
@@ -1786,5 +1823,7 @@ break; | ||
//left arrow | ||
e.preventDefault(); | ||
bar.style.width = bar.clientWidth - element.clientWidth / 100 + "px"; | ||
break; | ||
case 9: //tab | ||
case 13: | ||
@@ -1843,3 +1882,3 @@ //enter | ||
onRendered(function () { | ||
input.focus(); | ||
input.focus({ preventScroll: true }); | ||
}); | ||
@@ -1846,0 +1885,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Edit=function(e){this.table=e,this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1};Edit.prototype.initializeColumn=function(e){var t=this,i={editor:!1,blocked:!1,check:e.definition.editable,params:e.definition.editorParams||{}};switch(_typeof(e.definition.editor)){case"string":"tick"===e.definition.editor&&(e.definition.editor="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.editor]?i.editor=t.editors[e.definition.editor]:console.warn("Editor Error - No such editor found: ",e.definition.editor);break;case"function":i.editor=e.definition.editor;break;case"boolean":!0===e.definition.editor&&("function"!=typeof e.definition.formatter?("tick"===e.definition.formatter&&(e.definition.formatter="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.formatter]?i.editor=t.editors[e.definition.formatter]:i.editor=t.editors.input):console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",e.definition.formatter))}i.editor&&(e.modules.edit=i)},Edit.prototype.getCurrentCell=function(){return!!this.currentCell&&this.currentCell.getComponent()},Edit.prototype.clearEditor=function(){var e,t=this.currentCell;if(this.invalidEdit=!1,t){for(this.currentCell=!1,e=t.getElement(),e.classList.remove("tabulator-validation-fail"),e.classList.remove("tabulator-editing");e.firstChild;)e.removeChild(e.firstChild);t.row.getElement().classList.remove("tabulator-row-editing")}},Edit.prototype.cancelEdit=function(){if(this.currentCell){var e=this.currentCell,t=this.currentCell.getComponent();this.clearEditor(),e.setValueActual(e.getValue()),e.column.cellEvents.cellEditCancelled&&e.column.cellEvents.cellEditCancelled.call(this.table,t),this.table.options.cellEditCancelled.call(this.table,t)}},Edit.prototype.bindEditor=function(e){var t=this,i=e.getElement();i.setAttribute("tabindex",0),i.addEventListener("click",function(e){i.classList.contains("tabulator-editing")||i.focus()}),i.addEventListener("mousedown",function(e){t.mouseClick=!0}),i.addEventListener("focus",function(i){t.recursionBlock||t.edit(e,i,!1)})},Edit.prototype.focusCellNoEvent=function(e,t){this.recursionBlock=!0,t&&"ie"===this.table.browser||e.getElement().focus(),this.recursionBlock=!1},Edit.prototype.editCell=function(e,t){this.focusCellNoEvent(e),this.edit(e,!1,t)},Edit.prototype.edit=function(e,t,i){function n(t){if(u.currentCell===e){var i=!0;return e.column.modules.validate&&u.table.modExists("validate")&&(i=u.table.modules.validate.validate(e.column.modules.validate,e.getComponent(),t)),!0===i?(u.clearEditor(),e.setValue(t,!0),u.table.options.dataTree&&u.table.modExists("dataTree")&&u.table.modules.dataTree.checkForRestyle(e),!0):(u.invalidEdit=!0,m.classList.add("tabulator-validation-fail"),u.focusCellNoEvent(e,!0),c(),u.table.options.validationFailed.call(u.table,e.getComponent(),t,i),!1)}}function a(){u.currentCell===e&&(u.cancelEdit(),u.table.options.dataTree&&u.table.modExists("dataTree")&&u.table.modules.dataTree.checkForRestyle(e))}function o(e){c=e}var r,l,s,u=this,d=!0,c=function(){},m=e.getElement();if(this.currentCell)return void(this.invalidEdit||this.cancelEdit());if(e.column.modules.edit.blocked)return this.mouseClick=!1,m.blur(),!1;switch(t&&t.stopPropagation(),_typeof(e.column.modules.edit.check)){case"function":d=e.column.modules.edit.check(e.getComponent());break;case"boolean":d=e.column.modules.edit.check}if(d||i){if(u.cancelEdit(),u.currentCell=e,l=e.getComponent(),this.mouseClick&&(this.mouseClick=!1,e.column.cellEvents.cellClick&&e.column.cellEvents.cellClick.call(this.table,t,l)),e.column.cellEvents.cellEditing&&e.column.cellEvents.cellEditing.call(this.table,l),u.table.options.cellEditing.call(this.table,l),s="function"==typeof e.column.modules.edit.params?e.column.modules.edit.params(l):e.column.modules.edit.params,!1===(r=e.column.modules.edit.editor.call(u,l,o,n,a,s)))return m.blur(),!1;if(!(r instanceof Node))return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",r),m.blur(),!1;for(m.classList.add("tabulator-editing"),e.row.getElement().classList.add("tabulator-row-editing");m.firstChild;)m.removeChild(m.firstChild);m.appendChild(r),c();for(var f=m.children,p=0;p<f.length;p++)f[p].addEventListener("click",function(e){e.stopPropagation()});return!0}return this.mouseClick=!1,m.blur(),!1},Edit.prototype.maskInput=function(e,t){function i(t){var l=n[t];void 0!==l&&l!==r&&l!==a&&l!==o&&(e.value=e.value+""+l,i(t+1))}var n=t.mask,a=void 0!==t.maskLetterChar?t.maskLetterChar:"A",o=void 0!==t.maskNumberChar?t.maskNumberChar:"9",r=void 0!==t.maskWildcardChar?t.maskWildcardChar:"*",l=!1;e.addEventListener("keydown",function(t){var i=e.value.length,s=t.key;if(t.keyCode>46){if(i>=n.length)return t.preventDefault(),t.stopPropagation(),l=!1,!1;switch(n[i]){case a:if(s.toUpperCase()==s.toLowerCase())return t.preventDefault(),t.stopPropagation(),l=!1,!1;break;case o:if(isNaN(s))return t.preventDefault(),t.stopPropagation(),l=!1,!1;break;case r:break;default:if(s!==n[i])return t.preventDefault(),t.stopPropagation(),l=!1,!1}l=!0}}),e.addEventListener("keyup",function(n){n.keyCode>46&&t.maskAutoFill&&i(e.value.length)}),e.placeholder||(e.placeholder=n),t.maskAutoFill&&i(e.value.length)},Edit.prototype.editors={input:function(e,t,i,n,a){function o(e){(null===r||void 0===r)&&""!==l.value||l.value!==r?i(l.value)&&(r=l.value):n()}var r=e.getValue(),l=document.createElement("input");if(l.setAttribute("type",a.search?"search":"text"),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var s in a.elementAttributes)"+"==s.charAt(0)?(s=s.slice(1),l.setAttribute(s,l.getAttribute(s)+a.elementAttributes["+"+s])):l.setAttribute(s,a.elementAttributes[s]);return l.value=void 0!==r?r:"",t(function(){l.focus(),l.style.height="100%"}),l.addEventListener("change",o),l.addEventListener("blur",o),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:o(e);break;case 27:n()}}),a.mask&&this.table.modules.edit.maskInput(l,a),l},textarea:function(e,t,i,n,a){function o(t){(null===r||void 0===r)&&""!==u.value||u.value!==r?(i(u.value)&&(r=u.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):n()}var r=e.getValue(),l=a.verticalNavigation||"hybrid",s=String(null!==r&&void 0!==r?r:""),u=(s.match(/(?:\r\n|\r|\n)/g),document.createElement("textarea")),d=0;if(u.style.display="block",u.style.padding="2px",u.style.height="100%",u.style.width="100%",u.style.boxSizing="border-box",u.style.whiteSpace="pre-wrap",u.style.resize="none",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var c in a.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),u.setAttribute(c,u.getAttribute(c)+a.elementAttributes["+"+c])):u.setAttribute(c,a.elementAttributes[c]);return u.value=s,t(function(){u.focus(),u.style.height="100%"}),u.addEventListener("change",o),u.addEventListener("blur",o),u.addEventListener("keyup",function(){u.style.height="";var t=u.scrollHeight;u.style.height=t+"px",t!=d&&(d=t,e.getRow().normalizeHeight())}),u.addEventListener("keydown",function(e){switch(e.keyCode){case 27:n();break;case 38:("editor"==l||"hybrid"==l&&u.selectionStart)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 40:("editor"==l||"hybrid"==l&&u.selectionStart!==u.value.length)&&(e.stopImmediatePropagation(),e.stopPropagation())}}),a.mask&&this.table.modules.edit.maskInput(u,a),u},number:function(e,t,i,n,a){function o(){var e=s.value;isNaN(e)||""===e||(e=Number(e)),e!==r?i(e)&&(r=e):n()}var r=e.getValue(),l=a.verticalNavigation||"editor",s=document.createElement("input");if(s.setAttribute("type","number"),void 0!==a.max&&s.setAttribute("max",a.max),void 0!==a.min&&s.setAttribute("min",a.min),void 0!==a.step&&s.setAttribute("step",a.step),s.style.padding="4px",s.style.width="100%",s.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var u in a.elementAttributes)"+"==u.charAt(0)?(u=u.slice(1),s.setAttribute(u,s.getAttribute(u)+a.elementAttributes["+"+u])):s.setAttribute(u,a.elementAttributes[u]);s.value=r;var d=function(e){o()};return t(function(){s.removeEventListener("blur",d),s.focus(),s.style.height="100%",s.addEventListener("blur",d)}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 13:o();break;case 27:n();break;case 38:case 40:"editor"==l&&(e.stopImmediatePropagation(),e.stopPropagation())}}),a.mask&&this.table.modules.edit.maskInput(s,a),s},range:function(e,t,i,n,a){function o(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!=r?i(e)&&(r=e):n()}var r=e.getValue(),l=document.createElement("input");if(l.setAttribute("type","range"),void 0!==a.max&&l.setAttribute("max",a.max),void 0!==a.min&&l.setAttribute("min",a.min),void 0!==a.step&&l.setAttribute("step",a.step),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var s in a.elementAttributes)"+"==s.charAt(0)?(s=s.slice(1),l.setAttribute(s,l.getAttribute(s)+a.elementAttributes["+"+s])):l.setAttribute(s,a.elementAttributes[s]);return l.value=r,t(function(){l.focus(),l.style.height="100%"}),l.addEventListener("blur",function(e){o()}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:case 9:o();break;case 27:n()}}),l},select:function(e,t,i,n,a){function o(t){var i,n={},o=p.table.getData();return i=t?p.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),i?(o.forEach(function(e){var t=i.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(n[t]=!0)}),n=a.sortValuesList?"asc"==a.sortValuesList?Object.keys(n).sort():Object.keys(n).sort().reverse():Object.keys(n)):console.warn("unable to find matching column to create select lookup list:",t),n}function r(t,i){function n(e){var e={label:a.listItemFormatter?a.listItemFormatter(e.value,e.label):e.label,value:e.value,element:!1};return e.value!==i&&(isNaN(parseFloat(e.value))||isNaN(parseFloat(e.value))||parseFloat(e.value)!==parseFloat(i))||s(e),o.push(e),r.push(e),e}var o=[],r=[];if("function"==typeof t&&(t=t(e)),Array.isArray(t))t.forEach(function(e){var t;"object"===(void 0===e?"undefined":_typeof(e))?e.options?(t={label:e.label,group:!0,element:!1},r.push(t),e.options.forEach(function(e){n(e)})):n(e):(t={label:a.listItemFormatter?a.listItemFormatter(e,e):e,value:e,element:!1},t.value!==i&&(isNaN(parseFloat(t.value))||isNaN(parseFloat(t.value))||parseFloat(t.value)!==parseFloat(i))||s(t),o.push(t),r.push(t))});else for(var u in t){var d={label:a.listItemFormatter?a.listItemFormatter(u,t[u]):t[u],value:u,element:!1};d.value!==i&&(isNaN(parseFloat(d.value))||isNaN(parseFloat(d.value))||parseFloat(d.value)!==parseFloat(i))||s(d),o.push(d),r.push(d)}k=o,A=r,l()}function l(){for(;E.firstChild;)E.removeChild(E.firstChild);A.forEach(function(e){var t=e.element;t||(e.group?(t=document.createElement("div"),t.classList.add("tabulator-edit-select-list-group"),t.tabIndex=0,t.innerHTML=""===e.label?" ":e.label):(t=document.createElement("div"),t.classList.add("tabulator-edit-select-list-item"),t.tabIndex=0,t.innerHTML=""===e.label?" ":e.label,t.addEventListener("click",function(){s(e),u()}),e===C&&t.classList.add("active")),t.addEventListener("mousedown",function(){L=!1,setTimeout(function(){L=!0},10)}),e.element=t),E.appendChild(t)})}function s(e){C&&C.element&&C.element.classList.remove("active"),C=e,y.value=" "===e.label?"":e.label,e.element&&e.element.classList.add("active")}function u(){m(),b!==C.value?(b=C.value,i(C.value)):n()}function d(){m(),n()}function c(){if(!E.parentNode){!0===a.values?r(o(),g):"string"==typeof a.values?r(o(a.values),g):r(a.values||[],g);var e=Tabulator.prototype.helpers.elOffset(v);E.style.minWidth=v.offsetWidth+"px",E.style.top=e.top+v.offsetHeight+"px",E.style.left=e.left+"px",document.body.appendChild(E)}}function m(){E.parentNode&&E.parentNode.removeChild(E),f()}function f(){p.table.rowManager.element.removeEventListener("scroll",d)}var p=this,v=e.getElement(),b=e.getValue(),h=a.verticalNavigation||"editor",g=void 0!==b||null===b?b:void 0!==a.defaultValue?a.defaultValue:"",y=document.createElement("input"),E=document.createElement("div"),k=[],A=[],C={},L=!0;if(this.table.rowManager.element.addEventListener("scroll",d),(Array.isArray(a)||!Array.isArray(a)&&"object"===(void 0===a?"undefined":_typeof(a))&&!a.values)&&(console.warn("DEPRECATION WANRING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"),a={values:a}),y.setAttribute("type","text"),y.style.padding="4px",y.style.width="100%",y.style.boxSizing="border-box",y.style.cursor="default",y.readOnly=0!=this.currentCell,a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var w in a.elementAttributes)"+"==w.charAt(0)?(w=w.slice(1),y.setAttribute(w,y.getAttribute(w)+a.elementAttributes["+"+w])):y.setAttribute(w,a.elementAttributes[w]);return y.value=void 0!==b||null===b?b:"",y.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=k.indexOf(C),("editor"==h||"hybrid"==h&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t>0&&s(k[t-1]));break;case 40:t=k.indexOf(C),("editor"==h||"hybrid"==h&&t<k.length-1)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t<k.length-1&&s(-1==t?k[0]:k[t+1]));break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:u();break;case 27:d()}}),y.addEventListener("blur",function(e){L&&d()}),y.addEventListener("focus",function(e){c()}),E=document.createElement("div"),E.classList.add("tabulator-edit-select-list"),t(function(){y.style.height="100%",y.focus()}),y},autocomplete:function(e,t,i,n,a){function o(t){var i,n={},o=g.table.getData();return i=t?g.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),i?(o.forEach(function(e){var t=i.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(n[t]=!0)}),n=a.sortValuesList?"asc"==a.sortValuesList?Object.keys(n).sort():Object.keys(n).sort().reverse():Object.keys(n)):console.warn("unable to find matching column to create autocomplete lookup list:",t),n}function r(e,t){var i,n,r=[];i=!0===a.values?o():"string"==typeof a.values?o(a.values):a.values||[],a.searchFunc?(r=a.searchFunc(e,i),r instanceof Promise?(l(void 0!==a.searchingPlaceholder?a.searchingPlaceholder:"Searching..."),r.then(function(e){d(s(e),t)}).catch(function(e){console.err("error in autocomplete search promise:",e)})):d(s(r),t)):(n=s(i),""===e?a.showListOnEmpty&&(r=n):n.forEach(function(t){null===t.value&&void 0===t.value||(String(t.value).toLowerCase().indexOf(String(e).toLowerCase())>-1||String(t.title).toLowerCase().indexOf(String(e).toLowerCase())>-1)&&r.push(t)}),d(r,t))}function l(e){var t=document.createElement("div");u(),!1!==e&&(t.classList.add("tabulator-edit-select-list-notice"),t.tabIndex=0,e instanceof Node?t.appendChild(e):t.innerHTML=e,L.appendChild(t))}function s(e){var t=[];if(Array.isArray(e))e.forEach(function(e){var i={title:a.listItemFormatter?a.listItemFormatter(e,e):e,value:e};t.push(i)});else for(var i in e){var n={title:a.listItemFormatter?a.listItemFormatter(i,e[i]):e[i],value:i};t.push(n)}return t}function u(){for(;L.firstChild;)L.removeChild(L.firstChild)}function d(e,t){e.length?c(e,t):a.emptyPlaceholder&&l(a.emptyPlaceholder)}function c(e,t){var i=!1;u(),w=e,w.forEach(function(e){var n=e.element;n||(n=document.createElement("div"),n.classList.add("tabulator-edit-select-list-item"),n.tabIndex=0,n.innerHTML=e.title,n.addEventListener("click",function(){p(e),m()}),n.addEventListener("mousedown",function(){N=!1,setTimeout(function(){N=!0},10)}),e.element=n,t&&e.value==E&&(C.value=e.title,e.element.classList.add("active"),i=!0),e===x&&(e.element.classList.add("active"),i=!0)),L.appendChild(n)}),i||p(!1)}function m(){v(),x?E!==x.value?(E=x.value,C.value=x.title,i(x.value)):n():a.freetext?(E=C.value,i(C.value)):a.allowEmpty&&""===C.value?(E=C.value,i(C.value)):n()}function f(){if(!L.parentNode){for(;L.firstChild;)L.removeChild(L.firstChild);var e=Tabulator.prototype.helpers.elOffset(y);L.style.minWidth=y.offsetWidth+"px",L.style.top=e.top+y.offsetHeight+"px",L.style.left=e.left+"px",document.body.appendChild(L)}}function p(e,t){x&&x.element&&x.element.classList.remove("active"),x=e,e&&e.element&&e.element.classList.add("active")}function v(){L.parentNode&&L.parentNode.removeChild(L),h()}function b(){v(),n()}function h(){g.table.rowManager.element.removeEventListener("scroll",b)}var g=this,y=e.getElement(),E=e.getValue(),k=a.verticalNavigation||"editor",A=void 0!==E||null===E?E:void 0!==a.defaultValue?a.defaultValue:"",C=document.createElement("input"),L=document.createElement("div"),w=[],x=!1,N=!0;if(this.table.rowManager.element.addEventListener("scroll",b),C.setAttribute("type","search"),C.style.padding="4px",C.style.width="100%",C.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var P in a.elementAttributes)"+"==P.charAt(0)?(P=P.slice(1),C.setAttribute(P,C.getAttribute(P)+a.elementAttributes["+"+P])):C.setAttribute(P,a.elementAttributes[P]);return L.classList.add("tabulator-edit-select-list"),C.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=w.indexOf(x),("editor"==k||"hybrid"==k&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),p(t>0?w[t-1]:!1));break;case 40:t=w.indexOf(x),("editor"==k||"hybrid"==k&&t<w.length-1)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t<w.length-1&&p(-1==t?w[0]:w[t+1]));break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:m();break;case 27:b();break;case 36:case 35:e.stopImmediatePropagation()}}),C.addEventListener("keyup",function(e){switch(e.keyCode){case 38:case 37:case 39:case 40:case 13:case 27:break;default:r(C.value)}}),C.addEventListener("search",function(e){r(C.value)}),C.addEventListener("blur",function(e){N&&m()}),C.addEventListener("focus",function(e){var t=A;f(),C.value=t,r(t,!0)}),t(function(){C.style.height="100%",C.focus()}),a.mask&&this.table.modules.edit.maskInput(C,a),C},star:function(e,t,i,n,a){function o(e){m.forEach(function(t,i){i<e?("ie"==l.table.browser?t.setAttribute("class","tabulator-star-active"):t.classList.replace("tabulator-star-inactive","tabulator-star-active"),t.innerHTML='<polygon fill="#488CE9" stroke="#014AAE" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>'):("ie"==l.table.browser?t.setAttribute("class","tabulator-star-inactive"):t.classList.replace("tabulator-star-active","tabulator-star-inactive"),t.innerHTML='<polygon fill="#010155" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>')})}function r(e){u=e,o(e)}var l=this,s=e.getElement(),u=e.getValue(),d=s.getElementsByTagName("svg").length||5,c=s.getElementsByTagName("svg")[0]?s.getElementsByTagName("svg")[0].getAttribute("width"):14,m=[],f=document.createElement("div"),p=document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",f.style.verticalAlign="middle",f.style.display="inline-block",f.style.padding="4px",p.setAttribute("width",c),p.setAttribute("height",c),p.setAttribute("viewBox","0 0 512 512"),p.setAttribute("xml:space","preserve"),p.style.padding="0 1px",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var v in a.elementAttributes)"+"==v.charAt(0)?(v=v.slice(1),f.setAttribute(v,f.getAttribute(v)+a.elementAttributes["+"+v])):f.setAttribute(v,a.elementAttributes[v]);for(var b=1;b<=d;b++)!function(e){var t=document.createElement("span"),n=p.cloneNode(!0);m.push(n),t.addEventListener("mouseenter",function(t){t.stopPropagation(),t.stopImmediatePropagation(),o(e)}),t.addEventListener("mousemove",function(e){e.stopPropagation(),e.stopImmediatePropagation()}),t.addEventListener("click",function(t){t.stopPropagation(),t.stopImmediatePropagation(),i(e)}),t.appendChild(n),f.appendChild(t)}(b);return u=Math.min(parseInt(u),d),o(u),f.addEventListener("mousemove",function(e){o(0)}),f.addEventListener("click",function(e){i(0)}),s.addEventListener("blur",function(e){n()}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:r(u+1);break;case 37:r(u-1);break;case 13:i(u);break;case 27:n()}}),f},progress:function(e,t,i,n,a){function o(){var e=c*Math.round(p.offsetWidth/(s.clientWidth/100))+d;i(e),s.setAttribute("aria-valuenow",e),s.setAttribute("aria-label",m)}var r,l,s=e.getElement(),u=void 0===a.max?s.getElementsByTagName("div")[0].getAttribute("max")||100:a.max,d=void 0===a.min?s.getElementsByTagName("div")[0].getAttribute("min")||0:a.min,c=(u-d)/100,m=e.getValue()||0,f=document.createElement("div"),p=document.createElement("div");if(f.style.position="absolute",f.style.right="0",f.style.top="0",f.style.bottom="0",f.style.width="5px",f.classList.add("tabulator-progress-handle"),p.style.display="inline-block",p.style.position="relative",p.style.height="100%",p.style.backgroundColor="#488CE9",p.style.maxWidth="100%",p.style.minWidth="0%",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var v in a.elementAttributes)"+"==v.charAt(0)?(v=v.slice(1),p.setAttribute(v,p.getAttribute(v)+a.elementAttributes["+"+v])):p.setAttribute(v,a.elementAttributes[v]);return s.style.padding="4px 4px",m=Math.min(parseFloat(m),u),m=Math.max(parseFloat(m),d),m=Math.round((m-d)/c),p.style.width=m+"%",s.setAttribute("aria-valuemin",d),s.setAttribute("aria-valuemax",u),p.appendChild(f),f.addEventListener("mousedown",function(e){r=e.screenX,l=p.offsetWidth}),f.addEventListener("mouseover",function(){f.style.cursor="ew-resize"}),s.addEventListener("mousemove",function(e){r&&(p.style.width=l+e.screenX-r+"px")}),s.addEventListener("mouseup",function(e){r&&(e.stopPropagation(),e.stopImmediatePropagation(),r=!1,l=!1,o())}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:p.style.width=p.clientWidth+s.clientWidth/100+"px";break;case 37:p.style.width=p.clientWidth-s.clientWidth/100+"px";break;case 13:o();break;case 27:n()}}),s.addEventListener("blur",function(){n()}),p},tickCross:function(e,t,i,n,a){function o(e){return s?e?d?u:l.checked:l.checked&&!d?(l.checked=!1,l.indeterminate=!0,d=!0,u):(d=!1,l.checked):l.checked}var r=e.getValue(),l=document.createElement("input"),s=a.tristate,u=void 0===a.indeterminateValue?null:a.indeterminateValue,d=!1;if(l.setAttribute("type","checkbox"),l.style.marginTop="5px",l.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var c in a.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),l.setAttribute(c,l.getAttribute(c)+a.elementAttributes["+"+c])):l.setAttribute(c,a.elementAttributes[c]);return l.value=r,!s||void 0!==r&&r!==u&&""!==r||(d=!0,l.indeterminate=!0),"firefox"!=this.table.browser&&t(function(){l.focus()}),l.checked=!0===r||"true"===r||"True"===r||1===r,l.addEventListener("change",function(e){i(o())}),l.addEventListener("blur",function(e){i(o(!0))}),l.addEventListener("keydown",function(e){13==e.keyCode&&i(o()),27==e.keyCode&&n()}),l}},Tabulator.prototype.registerModule("edit",Edit); | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Edit=function(e){this.table=e,this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1};Edit.prototype.initializeColumn=function(e){var t=this,i={editor:!1,blocked:!1,check:e.definition.editable,params:e.definition.editorParams||{}};switch(_typeof(e.definition.editor)){case"string":"tick"===e.definition.editor&&(e.definition.editor="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.editor]?i.editor=t.editors[e.definition.editor]:console.warn("Editor Error - No such editor found: ",e.definition.editor);break;case"function":i.editor=e.definition.editor;break;case"boolean":!0===e.definition.editor&&("function"!=typeof e.definition.formatter?("tick"===e.definition.formatter&&(e.definition.formatter="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.formatter]?i.editor=t.editors[e.definition.formatter]:i.editor=t.editors.input):console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",e.definition.formatter))}i.editor&&(e.modules.edit=i)},Edit.prototype.getCurrentCell=function(){return!!this.currentCell&&this.currentCell.getComponent()},Edit.prototype.clearEditor=function(){var e,t=this.currentCell;if(this.invalidEdit=!1,t){for(this.currentCell=!1,e=t.getElement(),e.classList.remove("tabulator-validation-fail"),e.classList.remove("tabulator-editing");e.firstChild;)e.removeChild(e.firstChild);t.row.getElement().classList.remove("tabulator-row-editing")}},Edit.prototype.cancelEdit=function(){if(this.currentCell){var e=this.currentCell,t=this.currentCell.getComponent();this.clearEditor(),e.setValueActual(e.getValue()),e.cellRendered(),e.column.cellEvents.cellEditCancelled&&e.column.cellEvents.cellEditCancelled.call(this.table,t),this.table.options.cellEditCancelled.call(this.table,t)}},Edit.prototype.bindEditor=function(e){var t=this,i=e.getElement();i.setAttribute("tabindex",0),i.addEventListener("click",function(e){i.classList.contains("tabulator-editing")||i.focus({preventScroll:!0})}),i.addEventListener("mousedown",function(e){t.mouseClick=!0}),i.addEventListener("focus",function(i){t.recursionBlock||t.edit(e,i,!1)})},Edit.prototype.focusCellNoEvent=function(e,t){this.recursionBlock=!0,t&&"ie"===this.table.browser||e.getElement().focus({preventScroll:!0}),this.recursionBlock=!1},Edit.prototype.editCell=function(e,t){this.focusCellNoEvent(e),this.edit(e,!1,t)},Edit.prototype.focusScrollAdjust=function(e){if("virtual"==this.table.rowManager.getRenderMode()){var t=this.table.rowManager.element.scrollTop,i=this.table.rowManager.element.clientHeight+this.table.rowManager.element.scrollTop,n=e.row.getElement();n.offsetTop;n.offsetTop<t?this.table.rowManager.element.scrollTop-=t-n.offsetTop:n.offsetTop+n.offsetHeight>i&&(this.table.rowManager.element.scrollTop+=n.offsetTop+n.offsetHeight-i)}},Edit.prototype.edit=function(e,t,i){function n(t){if(u.currentCell===e){var i=!0;return e.column.modules.validate&&u.table.modExists("validate")&&(i=u.table.modules.validate.validate(e.column.modules.validate,e.getComponent(),t)),!0===i?(u.clearEditor(),e.setValue(t,!0),u.table.options.dataTree&&u.table.modExists("dataTree")&&u.table.modules.dataTree.checkForRestyle(e),!0):(u.invalidEdit=!0,m.classList.add("tabulator-validation-fail"),u.focusCellNoEvent(e,!0),c(),u.table.options.validationFailed.call(u.table,e.getComponent(),t,i),!1)}}function a(){u.currentCell===e&&(u.cancelEdit(),u.table.options.dataTree&&u.table.modExists("dataTree")&&u.table.modules.dataTree.checkForRestyle(e))}function o(e){c=e}var r,l,s,u=this,d=!0,c=function(){},m=e.getElement();if(this.currentCell)return void(this.invalidEdit||this.cancelEdit());if(e.column.modules.edit.blocked)return this.mouseClick=!1,m.blur(),!1;switch(t&&t.stopPropagation(),_typeof(e.column.modules.edit.check)){case"function":d=e.column.modules.edit.check(e.getComponent());break;case"boolean":d=e.column.modules.edit.check}if(d||i){if(u.cancelEdit(),u.currentCell=e,this.focusScrollAdjust(e),l=e.getComponent(),this.mouseClick&&(this.mouseClick=!1,e.column.cellEvents.cellClick&&e.column.cellEvents.cellClick.call(this.table,t,l)),e.column.cellEvents.cellEditing&&e.column.cellEvents.cellEditing.call(this.table,l),u.table.options.cellEditing.call(this.table,l),s="function"==typeof e.column.modules.edit.params?e.column.modules.edit.params(l):e.column.modules.edit.params,!1===(r=e.column.modules.edit.editor.call(u,l,o,n,a,s)))return m.blur(),!1;if(!(r instanceof Node))return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",r),m.blur(),!1;for(m.classList.add("tabulator-editing"),e.row.getElement().classList.add("tabulator-row-editing");m.firstChild;)m.removeChild(m.firstChild);m.appendChild(r),c();for(var f=m.children,p=0;p<f.length;p++)f[p].addEventListener("click",function(e){e.stopPropagation()});return!0}return this.mouseClick=!1,m.blur(),!1},Edit.prototype.maskInput=function(e,t){function i(t){var l=n[t];void 0!==l&&l!==r&&l!==a&&l!==o&&(e.value=e.value+""+l,i(t+1))}var n=t.mask,a=void 0!==t.maskLetterChar?t.maskLetterChar:"A",o=void 0!==t.maskNumberChar?t.maskNumberChar:"9",r=void 0!==t.maskWildcardChar?t.maskWildcardChar:"*",l=!1;e.addEventListener("keydown",function(t){var i=e.value.length,s=t.key;if(t.keyCode>46){if(i>=n.length)return t.preventDefault(),t.stopPropagation(),l=!1,!1;switch(n[i]){case a:if(s.toUpperCase()==s.toLowerCase())return t.preventDefault(),t.stopPropagation(),l=!1,!1;break;case o:if(isNaN(s))return t.preventDefault(),t.stopPropagation(),l=!1,!1;break;case r:break;default:if(s!==n[i])return t.preventDefault(),t.stopPropagation(),l=!1,!1}l=!0}}),e.addEventListener("keyup",function(n){n.keyCode>46&&t.maskAutoFill&&i(e.value.length)}),e.placeholder||(e.placeholder=n),t.maskAutoFill&&i(e.value.length)},Edit.prototype.editors={input:function(e,t,i,n,a){function o(e){(null===r||void 0===r)&&""!==l.value||l.value!==r?i(l.value)&&(r=l.value):n()}var r=e.getValue(),l=document.createElement("input");if(l.setAttribute("type",a.search?"search":"text"),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var s in a.elementAttributes)"+"==s.charAt(0)?(s=s.slice(1),l.setAttribute(s,l.getAttribute(s)+a.elementAttributes["+"+s])):l.setAttribute(s,a.elementAttributes[s]);return l.value=void 0!==r?r:"",t(function(){l.focus({preventScroll:!0}),l.style.height="100%"}),l.addEventListener("change",o),l.addEventListener("blur",o),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:o(e);break;case 27:n()}}),a.mask&&this.table.modules.edit.maskInput(l,a),l},textarea:function(e,t,i,n,a){function o(t){(null===r||void 0===r)&&""!==u.value||u.value!==r?(i(u.value)&&(r=u.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):n()}var r=e.getValue(),l=a.verticalNavigation||"hybrid",s=String(null!==r&&void 0!==r?r:""),u=(s.match(/(?:\r\n|\r|\n)/g),document.createElement("textarea")),d=0;if(u.style.display="block",u.style.padding="2px",u.style.height="100%",u.style.width="100%",u.style.boxSizing="border-box",u.style.whiteSpace="pre-wrap",u.style.resize="none",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var c in a.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),u.setAttribute(c,u.getAttribute(c)+a.elementAttributes["+"+c])):u.setAttribute(c,a.elementAttributes[c]);return u.value=s,t(function(){u.focus({preventScroll:!0}),u.style.height="100%"}),u.addEventListener("change",o),u.addEventListener("blur",o),u.addEventListener("keyup",function(){u.style.height="";var t=u.scrollHeight;u.style.height=t+"px",t!=d&&(d=t,e.getRow().normalizeHeight())}),u.addEventListener("keydown",function(e){switch(e.keyCode){case 27:n();break;case 38:("editor"==l||"hybrid"==l&&u.selectionStart)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 40:("editor"==l||"hybrid"==l&&u.selectionStart!==u.value.length)&&(e.stopImmediatePropagation(),e.stopPropagation())}}),a.mask&&this.table.modules.edit.maskInput(u,a),u},number:function(e,t,i,n,a){function o(){var e=s.value;isNaN(e)||""===e||(e=Number(e)),e!==r?i(e)&&(r=e):n()}var r=e.getValue(),l=a.verticalNavigation||"editor",s=document.createElement("input");if(s.setAttribute("type","number"),void 0!==a.max&&s.setAttribute("max",a.max),void 0!==a.min&&s.setAttribute("min",a.min),void 0!==a.step&&s.setAttribute("step",a.step),s.style.padding="4px",s.style.width="100%",s.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var u in a.elementAttributes)"+"==u.charAt(0)?(u=u.slice(1),s.setAttribute(u,s.getAttribute(u)+a.elementAttributes["+"+u])):s.setAttribute(u,a.elementAttributes[u]);s.value=r;var d=function(e){o()};return t(function(){s.removeEventListener("blur",d),s.focus({preventScroll:!0}),s.style.height="100%",s.addEventListener("blur",d)}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 13:o();break;case 27:n();break;case 38:case 40:"editor"==l&&(e.stopImmediatePropagation(),e.stopPropagation())}}),a.mask&&this.table.modules.edit.maskInput(s,a),s},range:function(e,t,i,n,a){function o(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!=r?i(e)&&(r=e):n()}var r=e.getValue(),l=document.createElement("input");if(l.setAttribute("type","range"),void 0!==a.max&&l.setAttribute("max",a.max),void 0!==a.min&&l.setAttribute("min",a.min),void 0!==a.step&&l.setAttribute("step",a.step),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var s in a.elementAttributes)"+"==s.charAt(0)?(s=s.slice(1),l.setAttribute(s,l.getAttribute(s)+a.elementAttributes["+"+s])):l.setAttribute(s,a.elementAttributes[s]);return l.value=r,t(function(){l.focus({preventScroll:!0}),l.style.height="100%"}),l.addEventListener("blur",function(e){o()}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:case 9:o();break;case 27:n()}}),l},select:function(e,t,i,n,a){function o(t){var i,n={},o=p.table.getData();return i=t?p.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),i?(o.forEach(function(e){var t=i.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(n[t]=!0)}),n=a.sortValuesList?"asc"==a.sortValuesList?Object.keys(n).sort():Object.keys(n).sort().reverse():Object.keys(n)):console.warn("unable to find matching column to create select lookup list:",t),n}function r(t,i){function n(e){var e={label:a.listItemFormatter?a.listItemFormatter(e.value,e.label):e.label,value:e.value,element:!1};return e.value!==i&&(isNaN(parseFloat(e.value))||isNaN(parseFloat(e.value))||parseFloat(e.value)!==parseFloat(i))||s(e),o.push(e),r.push(e),e}var o=[],r=[];if("function"==typeof t&&(t=t(e)),Array.isArray(t))t.forEach(function(e){var t;"object"===(void 0===e?"undefined":_typeof(e))?e.options?(t={label:e.label,group:!0,element:!1},r.push(t),e.options.forEach(function(e){n(e)})):n(e):(t={label:a.listItemFormatter?a.listItemFormatter(e,e):e,value:e,element:!1},t.value!==i&&(isNaN(parseFloat(t.value))||isNaN(parseFloat(t.value))||parseFloat(t.value)!==parseFloat(i))||s(t),o.push(t),r.push(t))});else for(var u in t){var d={label:a.listItemFormatter?a.listItemFormatter(u,t[u]):t[u],value:u,element:!1};d.value!==i&&(isNaN(parseFloat(d.value))||isNaN(parseFloat(d.value))||parseFloat(d.value)!==parseFloat(i))||s(d),o.push(d),r.push(d)}k=o,A=r,l()}function l(){for(;E.firstChild;)E.removeChild(E.firstChild);A.forEach(function(e){var t=e.element;t||(e.group?(t=document.createElement("div"),t.classList.add("tabulator-edit-select-list-group"),t.tabIndex=0,t.innerHTML=""===e.label?" ":e.label):(t=document.createElement("div"),t.classList.add("tabulator-edit-select-list-item"),t.tabIndex=0,t.innerHTML=""===e.label?" ":e.label,t.addEventListener("click",function(){s(e),u()}),e===C&&t.classList.add("active")),t.addEventListener("mousedown",function(){w=!1,setTimeout(function(){w=!0},10)}),e.element=t),E.appendChild(t)})}function s(e){C&&C.element&&C.element.classList.remove("active"),C=e,y.value=" "===e.label?"":e.label,e.element&&e.element.classList.add("active")}function u(){m(),b!==C.value?(b=C.value,i(C.value)):n()}function d(){m(),n()}function c(){if(!E.parentNode){!0===a.values?r(o(),g):"string"==typeof a.values?r(o(a.values),g):r(a.values||[],g);var e=Tabulator.prototype.helpers.elOffset(v);E.style.minWidth=v.offsetWidth+"px",E.style.top=e.top+v.offsetHeight+"px",E.style.left=e.left+"px",E.addEventListener("mousedown",function(e){w=!1,setTimeout(function(){w=!0},10)}),document.body.appendChild(E)}}function m(){E.parentNode&&E.parentNode.removeChild(E),f()}function f(){p.table.rowManager.element.removeEventListener("scroll",d)}var p=this,v=e.getElement(),b=e.getValue(),h=a.verticalNavigation||"editor",g=void 0!==b||null===b?b:void 0!==a.defaultValue?a.defaultValue:"",y=document.createElement("input"),E=document.createElement("div"),k=[],A=[],C={},w=!0;if(this.table.rowManager.element.addEventListener("scroll",d),(Array.isArray(a)||!Array.isArray(a)&&"object"===(void 0===a?"undefined":_typeof(a))&&!a.values)&&(console.warn("DEPRECATION WANRING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"),a={values:a}),y.setAttribute("type","text"),y.style.padding="4px",y.style.width="100%",y.style.boxSizing="border-box",y.style.cursor="default",y.readOnly=0!=this.currentCell,a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var L in a.elementAttributes)"+"==L.charAt(0)?(L=L.slice(1),y.setAttribute(L,y.getAttribute(L)+a.elementAttributes["+"+L])):y.setAttribute(L,a.elementAttributes[L]);return y.value=void 0!==b||null===b?b:"",y.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=k.indexOf(C),("editor"==h||"hybrid"==h&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t>0&&s(k[t-1]));break;case 40:t=k.indexOf(C),("editor"==h||"hybrid"==h&&t<k.length-1)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t<k.length-1&&s(-1==t?k[0]:k[t+1]));break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:u();break;case 27:d()}}),y.addEventListener("blur",function(e){w&&d()}),y.addEventListener("focus",function(e){c()}),E=document.createElement("div"),E.classList.add("tabulator-edit-select-list"),t(function(){y.style.height="100%",y.focus({preventScroll:!0})}),y},autocomplete:function(e,t,i,n,a){function o(t){var i,n={},o=g.table.getData();return i=t?g.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),i?(o.forEach(function(e){var t=i.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(n[t]=!0)}),n=a.sortValuesList?"asc"==a.sortValuesList?Object.keys(n).sort():Object.keys(n).sort().reverse():Object.keys(n)):console.warn("unable to find matching column to create autocomplete lookup list:",t),n}function r(e,t){var i,n,r=[];i=!0===a.values?o():"string"==typeof a.values?o(a.values):a.values||[],a.searchFunc?(r=a.searchFunc(e,i),r instanceof Promise?(l(void 0!==a.searchingPlaceholder?a.searchingPlaceholder:"Searching..."),r.then(function(e){d(s(e),t)}).catch(function(e){console.err("error in autocomplete search promise:",e)})):d(s(r),t)):(n=s(i),""===e?a.showListOnEmpty&&(r=n):n.forEach(function(t){null===t.value&&void 0===t.value||(String(t.value).toLowerCase().indexOf(String(e).toLowerCase())>-1||String(t.title).toLowerCase().indexOf(String(e).toLowerCase())>-1)&&r.push(t)}),d(r,t))}function l(e){var t=document.createElement("div");u(),!1!==e&&(t.classList.add("tabulator-edit-select-list-notice"),t.tabIndex=0,e instanceof Node?t.appendChild(e):t.innerHTML=e,w.appendChild(t))}function s(e){var t=[];if(Array.isArray(e))e.forEach(function(e){var i={title:a.listItemFormatter?a.listItemFormatter(e,e):e,value:e};t.push(i)});else for(var i in e){var n={title:a.listItemFormatter?a.listItemFormatter(i,e[i]):e[i],value:i};t.push(n)}return t}function u(){for(;w.firstChild;)w.removeChild(w.firstChild)}function d(e,t){e.length?c(e,t):a.emptyPlaceholder&&l(a.emptyPlaceholder)}function c(e,t){var i=!1;u(),L=e,L.forEach(function(e){var n=e.element;n||(n=document.createElement("div"),n.classList.add("tabulator-edit-select-list-item"),n.tabIndex=0,n.innerHTML=e.title,n.addEventListener("click",function(t){p(e),m()}),n.addEventListener("mousedown",function(e){N=!1,setTimeout(function(){N=!0},10)}),e.element=n,t&&e.value==E&&(C.value=e.title,e.element.classList.add("active"),i=!0),e===x&&(e.element.classList.add("active"),i=!0)),w.appendChild(n)}),i||p(!1)}function m(){v(),x?E!==x.value?(E=x.value,C.value=x.title,i(x.value)):n():a.freetext?(E=C.value,i(C.value)):a.allowEmpty&&""===C.value?(E=C.value,i(C.value)):n()}function f(){if(!w.parentNode){for(;w.firstChild;)w.removeChild(w.firstChild);var e=Tabulator.prototype.helpers.elOffset(y);w.style.minWidth=y.offsetWidth+"px",w.style.top=e.top+y.offsetHeight+"px",w.style.left=e.left+"px",document.body.appendChild(w)}}function p(e,t){x&&x.element&&x.element.classList.remove("active"),x=e,e&&e.element&&e.element.classList.add("active")}function v(){w.parentNode&&w.parentNode.removeChild(w),h()}function b(){v(),n()}function h(){g.table.rowManager.element.removeEventListener("scroll",b)}var g=this,y=e.getElement(),E=e.getValue(),k=a.verticalNavigation||"editor",A=void 0!==E||null===E?E:void 0!==a.defaultValue?a.defaultValue:"",C=document.createElement("input"),w=document.createElement("div"),L=[],x=!1,N=!0;if(this.table.rowManager.element.addEventListener("scroll",b),C.setAttribute("type","search"),C.style.padding="4px",C.style.width="100%",C.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var P in a.elementAttributes)"+"==P.charAt(0)?(P=P.slice(1),C.setAttribute(P,C.getAttribute(P)+a.elementAttributes["+"+P])):C.setAttribute(P,a.elementAttributes[P]);return w.classList.add("tabulator-edit-select-list"),w.addEventListener("mousedown",function(e){N=!1,setTimeout(function(){N=!0},10)}),C.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=L.indexOf(x),("editor"==k||"hybrid"==k&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),p(t>0?L[t-1]:!1));break;case 40:t=L.indexOf(x),("editor"==k||"hybrid"==k&&t<L.length-1)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t<L.length-1&&p(-1==t?L[0]:L[t+1]));break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:m();break;case 27:b();break;case 36:case 35:e.stopImmediatePropagation()}}),C.addEventListener("keyup",function(e){switch(e.keyCode){case 38:case 37:case 39:case 40:case 13:case 27:break;default:r(C.value)}}),C.addEventListener("search",function(e){r(C.value)}),C.addEventListener("blur",function(e){N&&m()}),C.addEventListener("focus",function(e){var t=A;f(),C.value=t,r(t,!0)}),t(function(){C.style.height="100%",C.focus({preventScroll:!0})}),a.mask&&this.table.modules.edit.maskInput(C,a),C},star:function(e,t,i,n,a){function o(e){m.forEach(function(t,i){i<e?("ie"==l.table.browser?t.setAttribute("class","tabulator-star-active"):t.classList.replace("tabulator-star-inactive","tabulator-star-active"),t.innerHTML='<polygon fill="#488CE9" stroke="#014AAE" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>'):("ie"==l.table.browser?t.setAttribute("class","tabulator-star-inactive"):t.classList.replace("tabulator-star-active","tabulator-star-inactive"),t.innerHTML='<polygon fill="#010155" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>')})}function r(e){u=e,o(e)}var l=this,s=e.getElement(),u=e.getValue(),d=s.getElementsByTagName("svg").length||5,c=s.getElementsByTagName("svg")[0]?s.getElementsByTagName("svg")[0].getAttribute("width"):14,m=[],f=document.createElement("div"),p=document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",f.style.verticalAlign="middle",f.style.display="inline-block",f.style.padding="4px",p.setAttribute("width",c),p.setAttribute("height",c),p.setAttribute("viewBox","0 0 512 512"),p.setAttribute("xml:space","preserve"),p.style.padding="0 1px",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var v in a.elementAttributes)"+"==v.charAt(0)?(v=v.slice(1),f.setAttribute(v,f.getAttribute(v)+a.elementAttributes["+"+v])):f.setAttribute(v,a.elementAttributes[v]);for(var b=1;b<=d;b++)!function(e){var t=document.createElement("span"),n=p.cloneNode(!0);m.push(n),t.addEventListener("mouseenter",function(t){t.stopPropagation(),t.stopImmediatePropagation(),o(e)}),t.addEventListener("mousemove",function(e){e.stopPropagation(),e.stopImmediatePropagation()}),t.addEventListener("click",function(t){t.stopPropagation(),t.stopImmediatePropagation(),i(e)}),t.appendChild(n),f.appendChild(t)}(b);return u=Math.min(parseInt(u),d),o(u),f.addEventListener("mousemove",function(e){o(0)}),f.addEventListener("click",function(e){i(0)}),s.addEventListener("blur",function(e){n()}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:r(u+1);break;case 37:r(u-1);break;case 13:i(u);break;case 27:n()}}),f},progress:function(e,t,i,n,a){function o(){var e=c*Math.round(p.offsetWidth/(s.clientWidth/100))+d;i(e),s.setAttribute("aria-valuenow",e),s.setAttribute("aria-label",m)}var r,l,s=e.getElement(),u=void 0===a.max?s.getElementsByTagName("div")[0].getAttribute("max")||100:a.max,d=void 0===a.min?s.getElementsByTagName("div")[0].getAttribute("min")||0:a.min,c=(u-d)/100,m=e.getValue()||0,f=document.createElement("div"),p=document.createElement("div");if(f.style.position="absolute",f.style.right="0",f.style.top="0",f.style.bottom="0",f.style.width="5px",f.classList.add("tabulator-progress-handle"),p.style.display="inline-block",p.style.position="relative",p.style.height="100%",p.style.backgroundColor="#488CE9",p.style.maxWidth="100%",p.style.minWidth="0%",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var v in a.elementAttributes)"+"==v.charAt(0)?(v=v.slice(1),p.setAttribute(v,p.getAttribute(v)+a.elementAttributes["+"+v])):p.setAttribute(v,a.elementAttributes[v]);return s.style.padding="4px 4px",m=Math.min(parseFloat(m),u),m=Math.max(parseFloat(m),d),m=Math.round((m-d)/c),p.style.width=m+"%",s.setAttribute("aria-valuemin",d),s.setAttribute("aria-valuemax",u),p.appendChild(f),f.addEventListener("mousedown",function(e){r=e.screenX,l=p.offsetWidth}),f.addEventListener("mouseover",function(){f.style.cursor="ew-resize"}),s.addEventListener("mousemove",function(e){r&&(p.style.width=l+e.screenX-r+"px")}),s.addEventListener("mouseup",function(e){r&&(e.stopPropagation(),e.stopImmediatePropagation(),r=!1,l=!1,o())}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:e.preventDefault(),p.style.width=p.clientWidth+s.clientWidth/100+"px";break;case 37:e.preventDefault(),p.style.width=p.clientWidth-s.clientWidth/100+"px";break;case 9:case 13:o();break;case 27:n()}}),s.addEventListener("blur",function(){n()}),p},tickCross:function(e,t,i,n,a){function o(e){return s?e?d?u:l.checked:l.checked&&!d?(l.checked=!1,l.indeterminate=!0,d=!0,u):(d=!1,l.checked):l.checked}var r=e.getValue(),l=document.createElement("input"),s=a.tristate,u=void 0===a.indeterminateValue?null:a.indeterminateValue,d=!1;if(l.setAttribute("type","checkbox"),l.style.marginTop="5px",l.style.boxSizing="border-box",a.elementAttributes&&"object"==_typeof(a.elementAttributes))for(var c in a.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),l.setAttribute(c,l.getAttribute(c)+a.elementAttributes["+"+c])):l.setAttribute(c,a.elementAttributes[c]);return l.value=r,!s||void 0!==r&&r!==u&&""!==r||(d=!0,l.indeterminate=!0),"firefox"!=this.table.browser&&t(function(){l.focus({preventScroll:!0})}),l.checked=!0===r||"true"===r||"True"===r||1===r,l.addEventListener("change",function(e){i(o())}),l.addEventListener("blur",function(e){i(o(!0))}),l.addEventListener("keydown",function(e){13==e.keyCode&&i(o()),27==e.keyCode&&n()}),l}},Tabulator.prototype.registerModule("edit",Edit); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Export = function Export(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Export=function(t){this.table=t,this.config={},this.cloneTableStyle=!0,this.colVisProp=""};Export.prototype.genereateTable=function(t,e,o,n){this.cloneTableStyle=e,this.config=t||{},this.colVisProp=n;var r=document.createElement("table");return r.classList.add("tabulator-print-table"),!1!==this.config.columnHeaders&&r.appendChild(this.generateHeaderElements()),r.appendChild(this.generateBodyElements(this.rowLookup(o))),this.mapElementStyles(this.table.element,r,["border-top","border-left","border-right","border-bottom"]),r},Export.prototype.rowLookup=function(t){var e=this,o=[];if("function"==typeof t)t.call(this.table).forEach(function(t){(t=e.table.rowManager.findRow(t))&&o.push(t)});else switch(t){case!0:case"visible":o=this.table.rowManager.getVisibleRows(!0);break;case"all":o=this.table.rowManager.rows;break;case"selected":o=this.modules.selectRow.selectedRows;break;case"active":default:o=this.table.rowManager.getDisplayRows()}return Object.assign([],o)},Export.prototype.generateColumnGroupHeaders=function(){var t=this,e=[];return(!1!==this.config.columnGroups?this.table.columnManager.columns:this.table.columnManager.columnsByIndex).forEach(function(o){var n=t.processColumnGroup(o);n&&e.push(n)}),e},Export.prototype.processColumnGroup=function(t){var e=this,o=t.columns,n=0,r={title:t.definition.title,column:t,depth:1};if(o.length){if(r.subGroups=[],r.width=0,o.forEach(function(t){var o=e.processColumnGroup(t);o&&(r.width+=o.width,r.subGroups.push(o),o.depth>n&&(n=o.depth))}),r.depth+=n,!r.width)return!1}else{if(!this.columnVisCheck(t))return!1;r.width=1}return r},Export.prototype.groupHeadersToRows=function(t){function e(t,r){var l=n-r;void 0===o[r]&&(o[r]=[]),t.height=t.subGroups?1:l-t.depth+1,o[r].push(t),t.subGroups&&t.subGroups.forEach(function(t){e(t,r+1)})}var o=[],n=0;return t.forEach(function(t){t.depth>n&&(n=t.depth)}),t.forEach(function(t){e(t,0)}),o},Export.prototype.generateHeaderElements=function(){var t=this,e=document.createElement("thead");return this.groupHeadersToRows(this.generateColumnGroupHeaders()).forEach(function(o){var n=document.createElement("tr");t.mapElementStyles(t.table.columnManager.getHeadersElement(),e,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),o.forEach(function(e){var o=document.createElement("th"),r=e.column.definition.cssClass?e.column.definition.cssClass.split(" "):[];o.colSpan=e.width,o.rowSpan=e.height,o.innerHTML=e.column.definition.title,t.cloneTableStyle&&(o.style.boxSizing="border-box"),r.forEach(function(t){o.classList.add(t)}),t.mapElementStyles(e.column.getElement(),o,["text-align","border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),t.mapElementStyles(e.column.contentElement,o,["padding-top","padding-left","padding-right","padding-bottom"]),e.column.visible?t.mapElementStyles(e.column.getElement(),o,["width"]):e.column.definition.width&&(o.style.width=e.column.definition.width+"px"),e.column.parent&&t.mapElementStyles(e.column.parent.groupElement,o,["border-top"]),n.appendChild(o)}),e.appendChild(n)}),e},Export.prototype.generateBodyElements=function(t){},Export.prototype.generateBodyElements=function(t){var e,o,n,r,l,a,i,s,d,c,u=this;c=this.table.options["rowFormatter"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],c=null!==c?c:this.table.options.rowFormatter,this.cloneTableStyle&&window.getComputedStyle&&(e=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),o=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),n=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),r=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),a=this.table.element.getElementsByClassName("tabulator-group")[0],r&&(i=r.getElementsByClassName("tabulator-cell"),l=i[0],i[i.length-1]));var p=document.createElement("tbody"),m=[];return!1!==this.config.columnCalcs&&this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&t.unshift(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&t.push(this.table.modules.columnCalcs.botRow)),this.table.columnManager.columnsByIndex.forEach(function(t){u.columnVisCheck(t)&&m.push(t)}),this.table.options.dataTree&&!1!==this.config.dataTree&&this.table.modExists("columnCalcs")&&(d=this.table.modules.dataTree.elementField),t=t.filter(function(t){switch(t.type){case"group":return!1!==u.config.rowGroups;case"calc":return!1!==u.config.columnCalcs}return!0}),t.length>1e3&&console.warn("It may take a long time to render an HTML table with more than 1000 rows"),t.forEach(function(t,r){var i=t.getData(u.colVisProp),f=document.createElement("tr");switch(f.classList.add("tabulator-print-table-row"),t.type){case"group":var h=document.createElement("td");h.colSpan=m.length,h.innerHTML=t.key,f.classList.add("tabulator-print-table-group"),u.mapElementStyles(a,f,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),u.mapElementStyles(a,h,["padding-top","padding-left","padding-right","padding-bottom"]),f.appendChild(h);break;case"calc":f.classList.add("tabulator-print-table-calcs");case"row":if(u.table.options.dataTree&&!1===u.config.dataTree&&t.modules.dataTree.parent)return;if(m.forEach(function(e,o){var n=document.createElement("td"),r=e.getFieldValue(i),a={modules:{},getValue:function(){return r},getField:function(){return e.definition.field},getElement:function(){return n},getColumn:function(){return e.getComponent()},getData:function(){return i},getRow:function(){return t.getComponent()},getComponent:function(){return a},column:e};if((e.definition.cssClass?e.definition.cssClass.split(" "):[]).forEach(function(t){n.classList.add(t)}),u.table.modExists("format")&&!1!==u.config.formatCells)r=u.table.modules.format.formatExportValue(a,u.colVisProp);else switch(void 0===r?"undefined":_typeof(r)){case"object":r=JSON.stringify(r);break;case"undefined":case"null":r="";break;default:r=r}r instanceof Node?n.appendChild(r):n.innerHTML=r,l&&(u.mapElementStyles(l,n,["padding-top","padding-left","padding-right","padding-bottom","border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),e.definition.align&&(n.style.textAlign=e.definition.align)),u.table.options.dataTree&&!1!==u.config.dataTree&&(d&&d==e.field||!d&&0==o)&&(t.modules.dataTree.controlEl&&n.insertBefore(t.modules.dataTree.controlEl.cloneNode(!0),n.firstChild),t.modules.dataTree.branchEl&&n.insertBefore(t.modules.dataTree.branchEl.cloneNode(!0),n.firstChild)),f.appendChild(n),a.modules.format&&a.modules.format.renderedCallback&&a.modules.format.renderedCallback()}),s="calc"==t.type?n:r%2&&o?o:e,u.mapElementStyles(s,f,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),c&&!1!==u.config.formatCells){var b=t.getComponent();b.getElement=function(){return f},c(b)}}p.appendChild(f)}),p},Export.prototype.columnVisCheck=function(t){return!1!==t.definition[this.colVisProp]&&(t.visible||!t.visible&&t.definition[this.colVisProp])},Export.prototype.getHtml=function(t,e,o,n){var r=document.createElement("div");return r.appendChild(this.genereateTable(o||this.table.options.htmlOutputConfig,e,t,n||"htmlOutput")),r.innerHTML},Export.prototype.mapElementStyles=function(t,e,o){if(this.cloneTableStyle&&t&&e){var n={"background-color":"backgroundColor",color:"fontColor",width:"width","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","text-align":"textAlign","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom","padding-top":"paddingTop","padding-left":"paddingLeft","padding-right":"paddingRight","padding-bottom":"paddingBottom"};if(window.getComputedStyle){var r=window.getComputedStyle(t);o.forEach(function(t){e.style[n[t]]=r.getPropertyValue(t)})}}},Tabulator.prototype.registerModule("export",Export); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Filter = function Filter(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Filter=function(e){this.table=e,this.filterList=[],this.headerFilters={},this.headerFilterColumns=[],this.prevHeaderFilterChangeCheck="",this.prevHeaderFilterChangeCheck="{}",this.changed=!1};Filter.prototype.initializeColumn=function(e,t){function r(t){var r,l="input"==e.modules.filter.tagType&&"text"==e.modules.filter.attrType||"textarea"==e.modules.filter.tagType?"partial":"match",o="",a="";if(void 0===e.modules.filter.prevSuccess||e.modules.filter.prevSuccess!==t){if(e.modules.filter.prevSuccess=t,e.modules.filter.emptyFunc(t))delete i.headerFilters[n];else{switch(e.modules.filter.value=t,_typeof(e.definition.headerFilterFunc)){case"string":i.filters[e.definition.headerFilterFunc]?(o=e.definition.headerFilterFunc,r=function(r){var n=e.definition.headerFilterFuncParams||{},l=e.getFieldValue(r);return n="function"==typeof n?n(t,l,r):n,i.filters[e.definition.headerFilterFunc](t,l,r,n)}):console.warn("Header Filter Error - Matching filter function not found: ",e.definition.headerFilterFunc);break;case"function":r=function(r){var i=e.definition.headerFilterFuncParams||{},n=e.getFieldValue(r);return i="function"==typeof i?i(t,n,r):i,e.definition.headerFilterFunc(t,n,r,i)},o=r}if(!r)switch(l){case"partial":r=function(r){var i=e.getFieldValue(r);return void 0!==i&&null!==i&&String(i).toLowerCase().indexOf(String(t).toLowerCase())>-1},o="like";break;default:r=function(r){return e.getFieldValue(r)==t},o="="}i.headerFilters[n]={value:t,func:r,type:o}}a=JSON.stringify(i.headerFilters),i.prevHeaderFilterChangeCheck!==a&&(i.prevHeaderFilterChangeCheck=a,i.changed=!0,i.table.rowManager.filterRefresh())}return!0}var i=this,n=e.getField();e.modules.filter={success:r,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)},Filter.prototype.generateHeaderFilterElement=function(e,t,r){function i(){}var n,l,o,a,s,d,u,f=this,c=this,h=e.modules.filter.success,p=e.getField();if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode&&e.contentElement.removeChild(e.modules.filter.headerElement.parentNode),p){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(e){return!e&&"0"!==e},n=document.createElement("div"),n.classList.add("tabulator-header-filter"),_typeof(e.definition.headerFilter)){case"string":c.table.modules.edit.editors[e.definition.headerFilter]?(l=c.table.modules.edit.editors[e.definition.headerFilter],"tick"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):console.warn("Filter Error - Cannot build header filter, No such editor found: ",e.definition.editor);break;case"function":l=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?l=e.modules.edit.editor:e.definition.formatter&&c.table.modules.edit.editors[e.definition.formatter]?(l=c.table.modules.edit.editors[e.definition.formatter],"tick"!==e.definition.formatter&&"tickCross"!==e.definition.formatter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):l=c.table.modules.edit.editors.input}if(l){if(a={getValue:function(){return void 0!==t?t:""},getField:function(){return e.definition.field},getElement:function(){return n},getColumn:function(){return e.getComponent()},getRow:function(){return{normalizeHeight:function(){}}}},u=e.definition.headerFilterParams||{},u="function"==typeof u?u.call(c.table):u,!(o=l.call(this.table.modules.edit,a,function(){},h,i,u)))return void console.warn("Filter Error - Cannot add filter to "+p+" column, editor returned a value of false");if(!(o instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+p+" column, editor should return an instance of Node, the editor returned:",o);p?c.table.modules.localize.bind("headerFilters|columns|"+e.definition.field,function(e){o.setAttribute("placeholder",void 0!==e&&e?e:c.table.modules.localize.getText("headerFilters|default"))}):c.table.modules.localize.bind("headerFilters|default",function(e){o.setAttribute("placeholder",void 0!==c.column.definition.headerFilterPlaceholder&&c.column.definition.headerFilterPlaceholder?c.column.definition.headerFilterPlaceholder:e)}),o.addEventListener("click",function(e){e.stopPropagation(),o.focus()}),o.addEventListener("focus",function(e){var t=f.table.columnManager.element.scrollLeft;t!==f.table.rowManager.element.scrollLeft&&(f.table.rowManager.scrollHorizontal(t),f.table.columnManager.scrollHorizontal(t))}),s=!1,d=function(e){s&&clearTimeout(s),s=setTimeout(function(){h(o.value)},c.table.options.headerFilterLiveFilterDelay)},e.modules.filter.headerElement=o,e.modules.filter.attrType=o.hasAttribute("type")?o.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=o.tagName.toLowerCase(),!1!==e.definition.headerFilterLiveFilter&&("autocomplete"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter&&("autocomplete"!==e.definition.editor&&"tickCross"!==e.definition.editor||!0!==e.definition.headerFilter)&&(o.addEventListener("keyup",d),o.addEventListener("search",d),"number"==e.modules.filter.attrType&&o.addEventListener("change",function(e){h(o.value)}),"text"==e.modules.filter.attrType&&"ie"!==this.table.browser&&o.setAttribute("type","search")),"input"!=e.modules.filter.tagType&&"select"!=e.modules.filter.tagType&&"textarea"!=e.modules.filter.tagType||o.addEventListener("mousedown",function(e){e.stopPropagation()})),n.appendChild(o),e.contentElement.appendChild(n),r||c.headerFilterColumns.push(e)}}else console.warn("Filter Error - Cannot add header filter, column has no field set:",e.definition.title)},Filter.prototype.hideHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="none")})},Filter.prototype.showHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="")})},Filter.prototype.setHeaderFilterFocus=function(e){e.modules.filter&&e.modules.filter.headerElement?e.modules.filter.headerElement.focus():console.warn("Column Filter Focus Error - No header filter set on column:",e.getField())},Filter.prototype.getHeaderFilterValue=function(e){if(e.modules.filter&&e.modules.filter.headerElement)return e.modules.filter.headerElement.value;console.warn("Column Filter Error - No header filter set on column:",e.getField())},Filter.prototype.setHeaderFilterValue=function(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t,!0),e.modules.filter.success(t)):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},Filter.prototype.reloadHeaderFilter=function(e){e&&(e.modules.filter&&e.modules.filter.headerElement?this.generateHeaderFilterElement(e,e.modules.filter.value,!0):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},Filter.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},Filter.prototype.setFilter=function(e,t,r){var i=this;i.filterList=[],Array.isArray(e)||(e=[{field:e,type:t,value:r}]),i.addFilter(e)},Filter.prototype.addFilter=function(e,t,r){var i=this;Array.isArray(e)||(e=[{field:e,type:t,value:r}]),e.forEach(function(e){(e=i.findFilter(e))&&(i.filterList.push(e),i.changed=!0)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.findFilter=function(e){var t,r=this;if(Array.isArray(e))return this.findSubFilters(e);var i=!1;return"function"==typeof e.field?i=function(t){return e.field(t,e.type||{})}:r.filters[e.type]?(t=r.table.columnManager.getColumnByField(e.field),i=t?function(i){return r.filters[e.type](e.value,t.getFieldValue(i))}:function(t){return r.filters[e.type](e.value,t[e.field])}):console.warn("Filter Error - No such filter type found, ignoring: ",e.type),e.func=i,!!e.func&&e},Filter.prototype.findSubFilters=function(e){var t=this,r=[];return e.forEach(function(e){(e=t.findFilter(e))&&r.push(e)}),!!r.length&&r},Filter.prototype.getFilters=function(e,t){var r=[];return e&&(r=this.getHeaderFilters()),t&&r.forEach(function(e){"function"==typeof e.type&&(e.type="function")}),r=r.concat(this.filtersToArray(this.filterList,t))},Filter.prototype.filtersToArray=function(e,t){var r=this,i=[];return e.forEach(function(e){var n;Array.isArray(e)?i.push(r.filtersToArray(e,t)):(n={field:e.field,type:e.type,value:e.value},t&&"function"==typeof n.type&&(n.type="function"),i.push(n))}),i},Filter.prototype.getHeaderFilters=function(){var e=[];for(var t in this.headerFilters)e.push({field:t,type:this.headerFilters[t].type,value:this.headerFilters[t].value});return e},Filter.prototype.removeFilter=function(e,t,r){var i=this;Array.isArray(e)||(e=[{field:e,type:t,value:r}]),e.forEach(function(e){var t=-1;t="object"==_typeof(e.field)?i.filterList.findIndex(function(t){return e===t}):i.filterList.findIndex(function(t){return e.field===t.field&&e.type===t.type&&e.value===t.value}),t>-1?(i.filterList.splice(t,1),i.changed=!0):console.warn("Filter Error - No matching filter type found, ignoring: ",e.type)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.clearFilter=function(e){this.filterList=[],e&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.clearHeaderFilter=function(){var e=this;this.headerFilters={},e.prevHeaderFilterChangeCheck="{}",this.headerFilterColumns.forEach(function(t){t.modules.filter.value=null,t.modules.filter.prevSuccess=void 0,e.reloadHeaderFilter(t)}),this.changed=!0},Filter.prototype.search=function(e,t,r,i){var n=this,l=[],o=[];return Array.isArray(t)||(t=[{field:t,type:r,value:i}]),t.forEach(function(e){(e=n.findFilter(e))&&o.push(e)}),this.table.rowManager.rows.forEach(function(t){var r=!0;o.forEach(function(e){n.filterRecurse(e,t.getData())||(r=!1)}),r&&l.push("data"===e?t.getData("data"):t.getComponent())}),l},Filter.prototype.filter=function(e,t){var r=this,i=[],n=[];return r.table.options.dataFiltering&&r.table.options.dataFiltering.call(r.table,r.getFilters()),r.table.options.ajaxFiltering||!r.filterList.length&&!Object.keys(r.headerFilters).length?i=e.slice(0):e.forEach(function(e){r.filterRow(e)&&i.push(e)}),r.table.options.dataFiltered&&(i.forEach(function(e){n.push(e.getComponent())}),r.table.options.dataFiltered.call(r.table,r.getFilters(),n)),i},Filter.prototype.filterRow=function(e,t){var r=this,i=!0,n=e.getData();r.filterList.forEach(function(e){r.filterRecurse(e,n)||(i=!1)});for(var l in r.headerFilters)r.headerFilters[l].func(n)||(i=!1);return i},Filter.prototype.filterRecurse=function(e,t){var r=this,i=!1;return Array.isArray(e)?e.forEach(function(e){r.filterRecurse(e,t)&&(i=!0)}):i=e.func(t),i},Filter.prototype.filters={"=":function(e,t,r,i){return t==e},"<":function(e,t,r,i){return t<e},"<=":function(e,t,r,i){return t<=e},">":function(e,t,r,i){return t>e},">=":function(e,t,r,i){return t>=e},"!=":function(e,t,r,i){return t!=e},regex:function(e,t,r,i){return"string"==typeof e&&(e=new RegExp(e)),e.test(t)},like:function(e,t,r,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().indexOf(e.toLowerCase())>-1},in:function(e,t,r,i){return Array.isArray(e)?e.indexOf(t)>-1:(console.warn("Filter Error - filter value is not an array:",e),!1)}},Tabulator.prototype.registerModule("filter",Filter); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Format = function Format(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Format=function(e){this.table=e};Format.prototype.initializeColumn=function(e){e.modules.format=this.lookupFormatter(e,""),void 0!==e.definition.formatterPrint&&(e.modules.format.print=this.lookupFormatter(e,"Print")),void 0!==e.definition.formatterClipboard&&(e.modules.format.clipboard=this.lookupFormatter(e,"Clipboard")),void 0!==e.definition.formatterHtmlOutput&&(e.modules.format.htmlOutput=this.lookupFormatter(e,"HtmlOutput"))},Format.prototype.lookupFormatter=function(e,t){var o={params:e.definition["formatter"+t+"Params"]||{}},r=e.definition["formatter"+t];switch(void 0===r?"undefined":_typeof(r)){case"string":"tick"===r&&(r="tickCross",void 0===o.params.crossElement&&(o.params.crossElement=!1),console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false")),this.formatters[r]?o.formatter=this.formatters[r]:(console.warn("Formatter Error - No such formatter found: ",r),o.formatter=this.formatters.plaintext);break;case"function":o.formatter=r;break;default:o.formatter=this.formatters.plaintext}return o},Format.prototype.cellRendered=function(e){e.modules.format&&e.modules.format.renderedCallback&&e.modules.format.renderedCallback()},Format.prototype.formatValue=function(e){function t(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t}var o=e.getComponent(),r="function"==typeof e.column.modules.format.params?e.column.modules.format.params(o):e.column.modules.format.params;return e.column.modules.format.formatter.call(this,o,r,t)},Format.prototype.formatExportValue=function(e,t){var o,r=e.column.modules.format[t];if(r){var a=function(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t};return o="function"==typeof r.params?r.params(component):r.params,r.formatter.call(this,e.getComponent(),o,a)}return this.formatValue(e)},Format.prototype.sanitizeHTML=function(e){if(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(e).replace(/[&<>"'`=\/]/g,function(e){return t[e]})}return e},Format.prototype.emptyToSpace=function(e){return null===e||void 0===e?" ":e},Format.prototype.getFormatter=function(e){var e;switch(void 0===e?"undefined":_typeof(e)){case"string":this.formatters[e]?e=this.formatters[e]:(console.warn("Formatter Error - No such formatter found: ",e),e=this.formatters.plaintext);break;case"function":e=e;break;default:e=this.formatters.plaintext}return e},Format.prototype.formatters={plaintext:function(e,t,o){return this.emptyToSpace(this.sanitizeHTML(e.getValue()))},html:function(e,t,o){return e.getValue()},textarea:function(e,t,o){return e.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(e.getValue()))},money:function(e,t,o){var r,a,l,n,i=parseFloat(e.getValue()),s=t.decimal||".",c=t.thousand||",",u=t.symbol||"",d=!!t.symbolAfter,m=void 0!==t.precision?t.precision:2;if(isNaN(i))return this.emptyToSpace(this.sanitizeHTML(e.getValue()));for(r=!1!==m?i.toFixed(m):i,r=String(r).split("."),a=r[0],l=r.length>1?s+r[1]:"",n=/(\d+)(\d{3})/;n.test(a);)a=a.replace(n,"$1"+c+"$2");return d?a+l+u:u+a+l},link:function(e,t,o){var r,a=e.getValue(),l=t.urlPrefix||"",n=t.download,i=a,s=document.createElement("a");if(t.labelField&&(r=e.getData(),i=r[t.labelField]),t.label)switch(_typeof(t.label)){case"string":i=t.label;break;case"function":i=t.label(e)}if(i){if(t.urlField&&(r=e.getData(),a=r[t.urlField]),t.url)switch(_typeof(t.url)){case"string":a=t.url;break;case"function":a=t.url(e)}return s.setAttribute("href",l+a),t.target&&s.setAttribute("target",t.target),t.download&&(n="function"==typeof n?n(e):!0===n?"":n,s.setAttribute("download",n)),s.innerHTML=this.emptyToSpace(this.sanitizeHTML(i)),s}return" "},image:function(e,t,o){var r=document.createElement("img");switch(r.setAttribute("src",e.getValue()),_typeof(t.height)){case"number":r.style.height=t.height+"px";break;case"string":r.style.height=t.height}switch(_typeof(t.width)){case"number":r.style.width=t.width+"px";break;case"string":r.style.width=t.width}return r.addEventListener("load",function(){e.getRow().normalizeHeight()}),r},tickCross:function(e,t,o){var r=e.getValue(),a=e.getElement(),l=t.allowEmpty,n=t.allowTruthy,i=void 0!==t.tickElement?t.tickElement:'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34 c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351 l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07 l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"/></svg>',s=void 0!==t.crossElement?t.crossElement:'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272 c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0 l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269 c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73 L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"/></svg>';return n&&r||!0===r||"true"===r||"True"===r||1===r||"1"===r?(a.setAttribute("aria-checked",!0),i||""):!l||"null"!==r&&""!==r&&null!==r&&void 0!==r?(a.setAttribute("aria-checked",!1),s||""):(a.setAttribute("aria-checked","mixed"),"")},datetime:function(e,t,o){var r=t.inputFormat||"YYYY-MM-DD hh:mm:ss",a=t.outputFormat||"DD/MM/YYYY hh:mm:ss",l=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",n=e.getValue(),i=moment(n,r);return i.isValid()?i.format(a):!0===l?n:"function"==typeof l?l(n):l},datetimediff:function(e,t,o){var r=t.inputFormat||"YYYY-MM-DD hh:mm:ss",a=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",l=void 0!==t.suffix&&t.suffix,n=void 0!==t.unit?t.unit:void 0,i=void 0!==t.humanize&&t.humanize,s=void 0!==t.date?t.date:moment(),c=e.getValue(),u=moment(c,r);return u.isValid()?i?moment.duration(u.diff(s)).humanize(l):u.diff(s,n)+(l?" "+l:""):!0===a?c:"function"==typeof a?a(c):a},lookup:function(e,t,o){var r=e.getValue();return void 0===t[r]?(console.warn("Missing display value for "+r),r):t[r]},star:function(e,t,o){var r=e.getValue(),a=e.getElement(),l=t&&t.stars?t.stars:5,n=document.createElement("span"),i=document.createElementNS("http://www.w3.org/2000/svg","svg");n.style.verticalAlign="middle",i.setAttribute("width","14"),i.setAttribute("height","14"),i.setAttribute("viewBox","0 0 512 512"),i.setAttribute("xml:space","preserve"),i.style.padding="0 1px",r=r&&!isNaN(r)?parseInt(r):0,r=Math.max(0,Math.min(r,l));for(var s=1;s<=l;s++){var c=i.cloneNode(!0);c.innerHTML=s<=r?'<polygon fill="#FFEA00" stroke="#C1AB60" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>':'<polygon fill="#D2D2D2" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>',n.appendChild(c)}return a.style.whiteSpace="nowrap",a.style.overflow="hidden",a.style.textOverflow="ellipsis",a.setAttribute("aria-label",r),n},traffic:function(e,t,o){var r,a,l=this.sanitizeHTML(e.getValue())||0,n=document.createElement("span"),i=t&&t.max?t.max:100,s=t&&t.min?t.min:0,c=t&&void 0!==t.color?t.color:["red","orange","green"],u="#666666";if(!isNaN(l)&&void 0!==e.getValue()){switch(n.classList.add("tabulator-traffic-light"),a=parseFloat(l)<=i?parseFloat(l):i,a=parseFloat(a)>=s?parseFloat(a):s,r=(i-s)/100,a=Math.round((a-s)/r),void 0===c?"undefined":_typeof(c)){case"string":u=c;break;case"function":u=c(l);break;case"object":if(Array.isArray(c)){var d=100/c.length,m=Math.floor(a/d);m=Math.min(m,c.length-1),m=Math.max(m,0),u=c[m];break}}return n.style.backgroundColor=u,n}},progress:function(e,t,o){var r,a,l,n,i,s=this.sanitizeHTML(e.getValue())||0,c=e.getElement(),u=t&&t.max?t.max:100,d=t&&t.min?t.min:0,m=t&&t.legendAlign?t.legendAlign:"center";switch(a=parseFloat(s)<=u?parseFloat(s):u,a=parseFloat(a)>=d?parseFloat(a):d,r=(u-d)/100,a=Math.round((a-d)/r),_typeof(t.color)){case"string":l=t.color;break;case"function":l=t.color(s);break;case"object":if(Array.isArray(t.color)){var p=100/t.color.length,f=Math.floor(a/p);f=Math.min(f,t.color.length-1),f=Math.max(f,0),l=t.color[f];break}default:l="#2DC214"}switch(_typeof(t.legend)){case"string":n=t.legend;break;case"function":n=t.legend(s);break;case"boolean":n=s;break;default:n=!1}switch(_typeof(t.legendColor)){case"string":i=t.legendColor;break;case"function":i=t.legendColor(s);break;case"object":if(Array.isArray(t.legendColor)){var p=100/t.legendColor.length,f=Math.floor(a/p);f=Math.min(f,t.legendColor.length-1),f=Math.max(f,0),i=t.legendColor[f]}break;default:i="#000"}c.style.minWidth="30px",c.style.position="relative",c.setAttribute("aria-label",a);var h=document.createElement("div");if(h.style.display="inline-block",h.style.position="relative",h.style.width=a+"%",h.style.backgroundColor=l,h.style.height="100%",h.setAttribute("data-max",u),h.setAttribute("data-min",d),n){var g=document.createElement("div");g.style.position="absolute",g.style.top="4px",g.style.left=0,g.style.textAlign=m,g.style.width="100%",g.style.color=i,g.innerHTML=n}return o(function(){if(!(e instanceof CellComponent)){var t=document.createElement("div");t.style.position="absolute",t.style.top="4px",t.style.bottom="4px",t.style.left="4px",t.style.right="4px",c.appendChild(t),c=t}c.appendChild(h),n&&c.appendChild(g)}),""},color:function(e,t,o){return e.getElement().style.backgroundColor=this.sanitizeHTML(e.getValue()),""},buttonTick:function(e,t,o){return'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34 c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351 l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07 l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"/></svg>'},buttonCross:function(e,t,o){return'<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272 c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0 l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269 c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73 L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"/></svg>'},rownum:function(e,t,o){return this.table.rowManager.activeRows.indexOf(e.getRow()._getSelf())+1},handle:function(e,t,o){return e.getElement().classList.add("tabulator-row-handle"),"<div class='tabulator-row-handle-box'><div class='tabulator-row-handle-bar'></div><div class='tabulator-row-handle-bar'></div><div class='tabulator-row-handle-bar'></div></div>"},responsiveCollapse:function(e,t,o){function r(e){var t=l.element;l.open=e,t&&(l.open?(a.classList.add("open"),t.style.display=""):(a.classList.remove("open"),t.style.display="none"))}var a=document.createElement("div"),l=e.getRow()._row.modules.responsiveLayout;return a.classList.add("tabulator-responsive-collapse-toggle"),a.innerHTML="<span class='tabulator-responsive-collapse-toggle-open'>+</span><span class='tabulator-responsive-collapse-toggle-close'>-</span>",e.getElement().classList.add("tabulator-row-handle"),a.addEventListener("click",function(e){e.stopImmediatePropagation(),r(!l.open)}),r(l.open),a},rowSelection:function(e){var t=this,o=document.createElement("input");if(o.type="checkbox",this.table.modExists("selectRow",!0))if(o.addEventListener("click",function(e){e.stopPropagation()}),"function"==typeof e.getRow){var r=e.getRow();o.addEventListener("change",function(e){r.toggleSelect()}),o.checked=r.isSelected(),this.table.modules.selectRow.registerRowSelectCheckbox(r,o)}else o.addEventListener("change",function(e){t.table.modules.selectRow.selectedRows.length?t.table.deselectRow():t.table.selectRow()}),this.table.modules.selectRow.registerHeaderSelectCheckbox(o);return o}},Tabulator.prototype.registerModule("format",Format); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var FrozenColumns = function FrozenColumns(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var FrozenColumns=function(t){this.table=t,this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightPadding=0,this.initializationMode="left",this.active=!1,this.scrollEndTimer=!1};FrozenColumns.prototype.reset=function(){this.initializationMode="left",this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightMargin=0,this.active=!1,this.table.columnManager.headersElement.style.marginLeft=0,this.table.columnManager.element.style.paddingRight=0},FrozenColumns.prototype.initializeColumn=function(t){var e={margin:0,edge:!1};t.isGroup||(this.frozenCheck(t)?(e.position=this.initializationMode,"left"==this.initializationMode?this.leftColumns.push(t):this.rightColumns.unshift(t),this.active=!0,t.modules.frozen=e):this.initializationMode="right")},FrozenColumns.prototype.frozenCheck=function(t){return t.parent.isGroup&&t.definition.frozen&&console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"),t.parent.isGroup?this.frozenCheck(t.parent):t.definition.frozen},FrozenColumns.prototype.scrollHorizontal=function(){var t,e=this;this.active&&(clearTimeout(this.scrollEndTimer),this.scrollEndTimer=setTimeout(function(){e.layout()},100),t=this.table.rowManager.getVisibleRows(),this.calcMargins(),this.layoutColumnPosition(),this.layoutCalcRows(),t.forEach(function(t){"row"===t.type&&e.layoutRow(t)}),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},FrozenColumns.prototype.calcMargins=function(){this.leftMargin=this._calcSpace(this.leftColumns,this.leftColumns.length)+"px",this.table.columnManager.headersElement.style.marginLeft=this.leftMargin,this.rightMargin=this._calcSpace(this.rightColumns,this.rightColumns.length)+"px",this.table.columnManager.element.style.paddingRight=this.rightMargin,this.rightPadding=this.table.rowManager.element.clientWidth+this.table.columnManager.scrollLeft},FrozenColumns.prototype.layoutCalcRows=function(){this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&this.table.modules.columnCalcs.topRow&&this.layoutRow(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&this.table.modules.columnCalcs.botRow&&this.layoutRow(this.table.modules.columnCalcs.botRow))},FrozenColumns.prototype.layoutColumnPosition=function(t){var e=this,o=[];this.leftColumns.forEach(function(n,l){if(n.modules.frozen.margin=e._calcSpace(e.leftColumns,l)+e.table.columnManager.scrollLeft+"px",l==e.leftColumns.length-1?n.modules.frozen.edge=!0:n.modules.frozen.edge=!1,n.parent.isGroup){var i=e.getColGroupParentElement(n);o.includes(i)||(e.layoutElement(i,n),o.push(i)),n.modules.frozen.edge&&i.classList.add("tabulator-frozen-"+n.modules.frozen.position)}else e.layoutElement(n.getElement(),n);t&&n.cells.forEach(function(t){e.layoutElement(t.getElement(),n)})}),this.rightColumns.forEach(function(o,n){o.modules.frozen.margin=e.rightPadding-e._calcSpace(e.rightColumns,n+1)+"px",n==e.rightColumns.length-1?o.modules.frozen.edge=!0:o.modules.frozen.edge=!1,o.parent.isGroup?e.layoutElement(e.getColGroupParentElement(o),o):e.layoutElement(o.getElement(),o),t&&o.cells.forEach(function(t){e.layoutElement(t.getElement(),o)})})},FrozenColumns.prototype.getColGroupParentElement=function(t){return t.parent.isGroup?this.getColGroupParentElement(t.parent):t.getElement()},FrozenColumns.prototype.layout=function(){var t=this;t.active&&(this.calcMargins(),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&t.layoutRow(e)}),this.layoutCalcRows(),this.layoutColumnPosition(!0),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},FrozenColumns.prototype.layoutRow=function(t){var e=this;t.getElement().style.paddingLeft=this.leftMargin,this.leftColumns.forEach(function(o){var n=t.getCell(o);n&&e.layoutElement(n.getElement(),o)}),this.rightColumns.forEach(function(o){var n=t.getCell(o);n&&e.layoutElement(n.getElement(),o)})},FrozenColumns.prototype.layoutElement=function(t,e){e.modules.frozen&&(t.style.position="absolute",t.style.left=e.modules.frozen.margin,t.classList.add("tabulator-frozen"),e.modules.frozen.edge&&t.classList.add("tabulator-frozen-"+e.modules.frozen.position))},FrozenColumns.prototype._calcSpace=function(t,e){for(var o=0,n=0;n<e;n++)t[n].visible&&(o+=t[n].getWidth());return o},Tabulator.prototype.registerModule("frozenColumns",FrozenColumns); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var FrozenRows = function FrozenRows(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var FrozenRows=function(e){this.table=e,this.topElement=document.createElement("div"),this.rows=[],this.displayIndex=0};FrozenRows.prototype.initialize=function(){this.rows=[],this.topElement.classList.add("tabulator-frozen-rows-holder"),this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling)},FrozenRows.prototype.setDisplayIndex=function(e){this.displayIndex=e},FrozenRows.prototype.getDisplayIndex=function(){return this.displayIndex},FrozenRows.prototype.isFrozen=function(){return!!this.rows.length},FrozenRows.prototype.getRows=function(e){var o=e.slice(0);return this.rows.forEach(function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)}),o},FrozenRows.prototype.freezeRow=function(e){e.modules.frozen?console.warn("Freeze Error - Row is already frozen"):(e.modules.frozen=!0,this.topElement.appendChild(e.getElement()),e.initialize(),e.normalizeHeight(),this.table.rowManager.adjustTableSize(),this.rows.push(e),this.table.rowManager.refreshActiveData("display"),this.styleRows())},FrozenRows.prototype.unfreezeRow=function(e){var o=this.rows.indexOf(e);if(e.modules.frozen){e.modules.frozen=!1;var t=e.getElement();t.parentNode.removeChild(t),this.table.rowManager.adjustTableSize(),this.rows.splice(o,1),this.table.rowManager.refreshActiveData("display"),this.rows.length&&this.styleRows()}else console.warn("Freeze Error - Row is already unfrozen")},FrozenRows.prototype.styleRows=function(e){var o=this;this.rows.forEach(function(e,t){o.table.rowManager.styleRow(e,t)})},Tabulator.prototype.registerModule("frozenRows",FrozenRows); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ //public group object |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var GroupComponent=function(t){this._group=t,this.type="GroupComponent"};GroupComponent.prototype.getKey=function(){return this._group.key},GroupComponent.prototype.getField=function(){return this._group.field},GroupComponent.prototype.getElement=function(){return this._group.element},GroupComponent.prototype.getRows=function(){return this._group.getRows(!0)},GroupComponent.prototype.getSubGroups=function(){return this._group.getSubGroups(!0)},GroupComponent.prototype.getParentGroup=function(){return!!this._group.parent&&this._group.parent.getComponent()},GroupComponent.prototype.getVisibility=function(){return this._group.visible},GroupComponent.prototype.show=function(){this._group.show()},GroupComponent.prototype.hide=function(){this._group.hide()},GroupComponent.prototype.toggle=function(){this._group.toggleVisibility()},GroupComponent.prototype._getSelf=function(){return this._group},GroupComponent.prototype.getTable=function(){return this._group.groupManager.table};var Group=function(t,o,e,r,i,s,n){this.groupManager=t,this.parent=o,this.key=r,this.level=e,this.field=i,this.hasSubGroups=e<t.groupIDLookups.length-1,this.addRow=this.hasSubGroups?this._addRowToGroup:this._addRow,this.type="group",this.old=n,this.rows=[],this.groups=[],this.groupList=[],this.generator=s,this.elementContents=!1,this.height=0,this.outerHeight=0,this.initialized=!1,this.calcs={},this.initialized=!1,this.modules={},this.arrowElement=!1,this.visible=n?n.visible:void 0!==t.startOpen[e]?t.startOpen[e]:t.startOpen[0],this.createElements(),this.addBindings(),this.createValueGroups()};Group.prototype.wipe=function(){this.groupList.length?this.groupList.forEach(function(t){t.wipe()}):(this.element=!1,this.arrowElement=!1,this.elementContents=!1)},Group.prototype.createElements=function(){var t=document.createElement("div");t.classList.add("tabulator-arrow"),this.element=document.createElement("div"),this.element.classList.add("tabulator-row"),this.element.classList.add("tabulator-group"),this.element.classList.add("tabulator-group-level-"+this.level),this.element.setAttribute("role","rowgroup"),this.arrowElement=document.createElement("div"),this.arrowElement.classList.add("tabulator-group-toggle"),this.arrowElement.appendChild(t),!1!==this.groupManager.table.options.movableRows&&this.groupManager.table.modExists("moveRow")&&this.groupManager.table.modules.moveRow.initializeGroupHeader(this)},Group.prototype.createValueGroups=function(){var t=this,o=this.level+1;this.groupManager.allowedValues&&this.groupManager.allowedValues[o]&&this.groupManager.allowedValues[o].forEach(function(e){t._createGroup(e,o)})},Group.prototype.addBindings=function(){var t,o,e,r,i=this;i.groupManager.table.options.groupClick&&i.element.addEventListener("click",function(t){i.groupManager.table.options.groupClick.call(i.groupManager.table,t,i.getComponent())}),i.groupManager.table.options.groupDblClick&&i.element.addEventListener("dblclick",function(t){i.groupManager.table.options.groupDblClick.call(i.groupManager.table,t,i.getComponent())}),i.groupManager.table.options.groupContext&&i.element.addEventListener("contextmenu",function(t){i.groupManager.table.options.groupContext.call(i.groupManager.table,t,i.getComponent())}),i.groupManager.table.options.groupTap&&(e=!1,i.element.addEventListener("touchstart",function(t){e=!0},{passive:!0}),i.element.addEventListener("touchend",function(t){e&&i.groupManager.table.options.groupTap(t,i.getComponent()),e=!1})),i.groupManager.table.options.groupDblTap&&(t=null,i.element.addEventListener("touchend",function(o){t?(clearTimeout(t),t=null,i.groupManager.table.options.groupDblTap(o,i.getComponent())):t=setTimeout(function(){clearTimeout(t),t=null},300)})),i.groupManager.table.options.groupTapHold&&(o=null,i.element.addEventListener("touchstart",function(t){clearTimeout(o),o=setTimeout(function(){clearTimeout(o),o=null,e=!1,i.groupManager.table.options.groupTapHold(t,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(t){clearTimeout(o),o=null})),i.groupManager.table.options.groupToggleElement&&(r="arrow"==i.groupManager.table.options.groupToggleElement?i.arrowElement:i.element,r.addEventListener("click",function(t){t.stopPropagation(),t.stopImmediatePropagation(),i.toggleVisibility()}))},Group.prototype._createGroup=function(t,o){var e=o+"_"+t,r=new Group(this.groupManager,this,o,t,this.groupManager.groupIDLookups[o].field,this.groupManager.headerGenerator[o]||this.groupManager.headerGenerator[0],!!this.old&&this.old.groups[e]);this.groups[e]=r,this.groupList.push(r)},Group.prototype._addRowToGroup=function(t){var o=this.level+1;if(this.hasSubGroups){var e=this.groupManager.groupIDLookups[o].func(t.getData()),r=o+"_"+e;this.groupManager.allowedValues&&this.groupManager.allowedValues[o]?this.groups[r]&&this.groups[r].addRow(t):(this.groups[r]||this._createGroup(e,o),this.groups[r].addRow(t))}},Group.prototype._addRow=function(t){this.rows.push(t),t.modules.group=this},Group.prototype.insertRow=function(t,o,e){var r=this.conformRowData({});t.updateData(r);var i=this.rows.indexOf(o);i>-1?e?this.rows.splice(i+1,0,t):this.rows.splice(i,0,t):e?this.rows.push(t):this.rows.unshift(t),t.modules.group=this,this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this),this.groupManager.updateGroupRows(!0)},Group.prototype.scrollHeader=function(t){this.arrowElement.style.marginLeft=t,this.groupList.forEach(function(o){o.scrollHeader(t)})},Group.prototype.getRowIndex=function(t){},Group.prototype.conformRowData=function(t){return this.field?t[this.field]=this.key:console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"),this.parent&&(t=this.parent.conformRowData(t)),t},Group.prototype.removeRow=function(t){var o=this.rows.indexOf(t),e=t.getElement();o>-1&&this.rows.splice(o,1),this.groupManager.table.options.groupValues||this.rows.length?(e.parentNode&&e.parentNode.removeChild(e),this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this)):(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this),this.groupManager.updateGroupRows(!0))},Group.prototype.removeGroup=function(t){var o,e=t.level+"_"+t.key;this.groups[e]&&(delete this.groups[e],o=this.groupList.indexOf(t),o>-1&&this.groupList.splice(o,1),this.groupList.length||(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this)))},Group.prototype.getHeadersAndRows=function(t){var o=[];return o.push(this),this._visSet(),this.visible?this.groupList.length?this.groupList.forEach(function(e){o=o.concat(e.getHeadersAndRows(t))}):(!t&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),o.push(this.calcs.top)),o=o.concat(this.rows),!t&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),o.push(this.calcs.bottom))):this.groupList.length||"table"==this.groupManager.table.options.columnCalcs||this.groupManager.table.modExists("columnCalcs")&&(!t&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),o.push(this.calcs.top))),!t&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),o.push(this.calcs.bottom)))),o},Group.prototype.getData=function(t,o){var e=[];return this._visSet(),(!t||t&&this.visible)&&this.rows.forEach(function(t){e.push(t.getData(o||"data"))}),e},Group.prototype.getRowCount=function(){var t=0;return this.groupList.length?this.groupList.forEach(function(o){t+=o.getRowCount()}):t=this.rows.length,t},Group.prototype.toggleVisibility=function(){this.visible?this.hide():this.show()},Group.prototype.hide=function(){this.visible=!1,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination?this.groupManager.updateGroupRows(!0):(this.element.classList.remove("tabulator-group-visible"),this.groupList.length?this.groupList.forEach(function(t){t.getHeadersAndRows().forEach(function(t){t.detachElement()})}):this.rows.forEach(function(t){var o=t.getElement();o.parentNode.removeChild(o)}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()),this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!1)},Group.prototype.show=function(){var t=this;if(t.visible=!0,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination)this.groupManager.updateGroupRows(!0);else{this.element.classList.add("tabulator-group-visible");var o=t.getElement();this.groupList.length?this.groupList.forEach(function(t){t.getHeadersAndRows().forEach(function(t){var e=t.getElement();o.parentNode.insertBefore(e,o.nextSibling),t.initialize(),o=e})}):t.rows.forEach(function(t){var e=t.getElement();o.parentNode.insertBefore(e,o.nextSibling),t.initialize(),o=e}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()}this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!0)},Group.prototype._visSet=function(){var t=[];"function"==typeof this.visible&&(this.rows.forEach(function(o){t.push(o.getData())}),this.visible=this.visible(this.key,this.getRowCount(),t,this.getComponent()))},Group.prototype.getRowGroup=function(t){var o=!1;return this.groupList.length?this.groupList.forEach(function(e){var r=e.getRowGroup(t);r&&(o=r)}):this.rows.find(function(o){return o===t})&&(o=this),o},Group.prototype.getSubGroups=function(t){var o=[];return this.groupList.forEach(function(e){o.push(t?e.getComponent():e)}),o},Group.prototype.getRows=function(t){var o=[];return this.rows.forEach(function(e){o.push(t?e.getComponent():e)}),o},Group.prototype.generateGroupHeaderContents=function(){var t=[];for(this.rows.forEach(function(o){t.push(o.getData())}),this.elementContents=this.generator(this.key,this.getRowCount(),t,this.getComponent());this.element.firstChild;)this.element.removeChild(this.element.firstChild);"string"==typeof this.elementContents?this.element.innerHTML=this.elementContents:this.element.appendChild(this.elementContents),this.element.insertBefore(this.arrowElement,this.element.firstChild)},Group.prototype.getElement=function(){this.addBindingsd=!1,this._visSet(),this.visible?this.element.classList.add("tabulator-group-visible"):this.element.classList.remove("tabulator-group-visible");for(var t=0;t<this.element.childNodes.length;++t)this.element.childNodes[t].parentNode.removeChild(this.element.childNodes[t]);return this.generateGroupHeaderContents(),this.element},Group.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},Group.prototype.normalizeHeight=function(){this.setHeight(this.element.clientHeight)},Group.prototype.initialize=function(t){this.initialized&&!t||(this.normalizeHeight(),this.initialized=!0)},Group.prototype.reinitialize=function(){this.initialized=!1,this.height=0,Tabulator.prototype.helpers.elVisible(this.element)&&this.initialize(!0)},Group.prototype.setHeight=function(t){this.height!=t&&(this.height=t,this.outerHeight=this.element.offsetHeight)},Group.prototype.getHeight=function(){return this.outerHeight},Group.prototype.getGroup=function(){return this},Group.prototype.reinitializeHeight=function(){},Group.prototype.calcHeight=function(){},Group.prototype.setCellHeight=function(){},Group.prototype.clearCellHeight=function(){},Group.prototype.getComponent=function(){return new GroupComponent(this)};var GroupRows=function(t){this.table=t,this.groupIDLookups=!1,this.startOpen=[function(){return!1}],this.headerGenerator=[function(){return""}],this.groupList=[],this.allowedValues=!1,this.groups={},this.displayIndex=0};GroupRows.prototype.initialize=function(){var t=this,o=t.table.options.groupBy,e=t.table.options.groupStartOpen,r=t.table.options.groupHeader;if(this.allowedValues=t.table.options.groupValues,Array.isArray(o)&&Array.isArray(r)&&o.length>r.length&&console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"),t.headerGenerator=[function(){return""}],this.startOpen=[function(){return!1}],t.table.modules.localize.bind("groups|item",function(o,e){t.headerGenerator[0]=function(t,r,i){return(void 0===t?"":t)+"<span>("+r+" "+(1===r?o:e.groups.items)+")</span>"}}),this.groupIDLookups=[],Array.isArray(o)||o)this.table.modExists("columnCalcs")&&"table"!=this.table.options.columnCalcs&&"both"!=this.table.options.columnCalcs&&this.table.modules.columnCalcs.removeCalcs();else if(this.table.modExists("columnCalcs")&&"group"!=this.table.options.columnCalcs){var i=this.table.columnManager.getRealColumns();i.forEach(function(o){o.definition.topCalc&&t.table.modules.columnCalcs.initializeTopRow(),o.definition.bottomCalc&&t.table.modules.columnCalcs.initializeBottomRow()})}Array.isArray(o)||(o=[o]),o.forEach(function(o,e){var r,i;"function"==typeof o?r=o:(i=t.table.columnManager.getColumnByField(o),r=i?function(t){return i.getFieldValue(t)}:function(t){return t[o]}),t.groupIDLookups.push({field:"function"!=typeof o&&o,func:r,values:!!t.allowedValues&&t.allowedValues[e]})}),e&&(Array.isArray(e)||(e=[e]),e.forEach(function(t){t="function"==typeof t?t:function(){return!0}}),t.startOpen=e),r&&(t.headerGenerator=Array.isArray(r)?r:[r]),this.initialized=!0},GroupRows.prototype.setDisplayIndex=function(t){this.displayIndex=t},GroupRows.prototype.getDisplayIndex=function(){return this.displayIndex},GroupRows.prototype.getRows=function(t){return this.groupIDLookups.length?(this.table.options.dataGrouping.call(this.table),this.generateGroups(t),this.table.options.dataGrouped&&this.table.options.dataGrouped.call(this.table,this.getGroups(!0)),this.updateGroupRows()):t.slice(0)},GroupRows.prototype.getGroups=function(t){var o=[];return this.groupList.forEach(function(e){o.push(t?e.getComponent():e)}),o},GroupRows.prototype.getChildGroups=function(t){var o=this,e=[];return t||(t=this),t.groupList.forEach(function(t){t.groupList.length?e=e.concat(o.getChildGroups(t)):e.push(t)}),e},GroupRows.prototype.wipe=function(){this.groupList.forEach(function(t){t.wipe()})},GroupRows.prototype.pullGroupListData=function(t){var o=this,e=[];return t.forEach(function(t){var r={};r.level=0,r.rowCount=0,r.headerContent="";var i=[];t.hasSubGroups?(i=o.pullGroupListData(t.groupList),r.level=t.level,r.rowCount=i.length-t.groupList.length,r.headerContent=t.generator(t.key,r.rowCount,t.rows,t),e.push(r),e=e.concat(i)):(r.level=t.level,r.headerContent=t.generator(t.key,t.rows.length,t.rows,t),r.rowCount=t.getRows().length,e.push(r),t.getRows().forEach(function(t){e.push(t.getData("data"))}))}),e},GroupRows.prototype.getGroupedData=function(){return this.pullGroupListData(this.groupList)},GroupRows.prototype.getRowGroup=function(t){var o=!1;return this.groupList.forEach(function(e){var r=e.getRowGroup(t);r&&(o=r)}),o},GroupRows.prototype.countGroups=function(){return this.groupList.length},GroupRows.prototype.generateGroups=function(t){var o=this,e=o.groups;o.groups={},o.groupList=[],this.allowedValues&&this.allowedValues[0]?(this.allowedValues[0].forEach(function(t){o.createGroup(t,0,e)}),t.forEach(function(t){o.assignRowToExistingGroup(t,e)})):t.forEach(function(t){o.assignRowToGroup(t,e)})},GroupRows.prototype.createGroup=function(t,o,e){var r,i=o+"_"+t;e=e||[],r=new Group(this,!1,o,t,this.groupIDLookups[0].field,this.headerGenerator[0],e[i]),this.groups[i]=r,this.groupList.push(r)},GroupRows.prototype.assignRowToExistingGroup=function(t,o){var e=this.groupIDLookups[0].func(t.getData()),r="0_"+e;this.groups[r]&&this.groups[r].addRow(t)},GroupRows.prototype.assignRowToGroup=function(t,o){var e=this.groupIDLookups[0].func(t.getData()),r=!this.groups["0_"+e];return r&&this.createGroup(e,0,o),this.groups["0_"+e].addRow(t),!r},GroupRows.prototype.updateGroupRows=function(t){var o=this,e=[];if(o.groupList.forEach(function(t){e=e.concat(t.getHeadersAndRows())}),t){var r=o.table.rowManager.setDisplayRows(e,this.getDisplayIndex());!0!==r&&this.setDisplayIndex(r),o.table.rowManager.refreshActiveData("group",!0,!0)}return e},GroupRows.prototype.scrollHeaders=function(t){t+="px",this.groupList.forEach(function(o){o.scrollHeader(t)})},GroupRows.prototype.removeGroup=function(t){var o,e=t.level+"_"+t.key;this.groups[e]&&(delete this.groups[e],(o=this.groupList.indexOf(t))>-1&&this.groupList.splice(o,1))},Tabulator.prototype.registerModule("groupRows",GroupRows); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var History = function History(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var History=function(t){this.table=t,this.history=[],this.index=-1};History.prototype.clear=function(){this.history=[],this.index=-1},History.prototype.action=function(t,o,e){this.history=this.history.slice(0,this.index+1),this.history.push({type:t,component:o,data:e}),this.index++},History.prototype.getHistoryUndoSize=function(){return this.index+1},History.prototype.getHistoryRedoSize=function(){return this.history.length-(this.index+1)},History.prototype.undo=function(){if(this.index>-1){var t=this.history[this.index];return this.undoers[t.type].call(this,t),this.index--,this.table.options.historyUndo.call(this.table,t.type,t.component.getComponent(),t.data),!0}return console.warn("History Undo Error - No more history to undo"),!1},History.prototype.redo=function(){if(this.history.length-1>this.index){this.index++;var t=this.history[this.index];return this.redoers[t.type].call(this,t),this.table.options.historyRedo.call(this.table,t.type,t.component.getComponent(),t.data),!0}return console.warn("History Redo Error - No more history to redo"),!1},History.prototype.undoers={cellEdit:function(t){t.component.setValueProcessData(t.data.oldValue)},rowAdd:function(t){t.component.deleteActual()},rowDelete:function(t){var o=this.table.rowManager.addRowActual(t.data.data,t.data.pos,t.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(t.component,o)},rowMove:function(t){this.table.rowManager.moveRowActual(t.component,this.table.rowManager.rows[t.data.posFrom],!t.data.after),this.table.rowManager.redraw()}},History.prototype.redoers={cellEdit:function(t){t.component.setValueProcessData(t.data.newValue)},rowAdd:function(t){var o=this.table.rowManager.addRowActual(t.data.data,t.data.pos,t.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(t.component,o)},rowDelete:function(t){t.component.deleteActual()},rowMove:function(t){this.table.rowManager.moveRowActual(t.component,this.table.rowManager.rows[t.data.posTo],t.data.after),this.table.rowManager.redraw()}},History.prototype._rebindRow=function(t,o){this.history.forEach(function(e){if(e.component instanceof Row)e.component===t&&(e.component=o);else if(e.component instanceof Cell&&e.component.row===t){var i=e.component.column.getField();i&&(e.component=o.getCell(i))}})},Tabulator.prototype.registerModule("history",History); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var HtmlTableImport = function HtmlTableImport(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},HtmlTableImport=function(t){this.table=t,this.fieldIndex=[],this.hasIndex=!1};HtmlTableImport.prototype.parseTable=function(){var t=this,e=t.table.element,o=t.table.options,a=(o.columns,e.getElementsByTagName("th")),n=e.getElementsByTagName("tbody")[0],l=[];t.hasIndex=!1,t.table.options.htmlImporting.call(this.table),n=n?n.getElementsByTagName("tr"):[],t._extractOptions(e,o),a.length?t._extractHeaders(a,n):t._generateBlankHeaders(a,n);for(var r=0;r<n.length;r++){var i=n[r],s=i.getElementsByTagName("td"),p={};t.hasIndex||(p[o.index]=r);for(var m=0;m<s.length;m++){var d=s[m];void 0!==this.fieldIndex[m]&&(p[this.fieldIndex[m]]=d.innerHTML)}l.push(p)}var f=document.createElement("div"),b=e.attributes;for(var m in b)"object"==_typeof(b[m])&&f.setAttribute(b[m].name,b[m].value);e.parentNode.replaceChild(f,e),o.data=l,t.table.options.htmlImported.call(this.table),this.table.element=f},HtmlTableImport.prototype._extractOptions=function(t,e,o){var a=t.attributes,n=o?Object.assign([],o):Object.keys(e),l={};n.forEach(function(t){l[t.toLowerCase()]=t});for(var r in a){var i,s=a[r];s&&"object"==(void 0===s?"undefined":_typeof(s))&&s.name&&0===s.name.indexOf("tabulator-")&&(i=s.name.replace("tabulator-",""),void 0!==l[i]&&(e[l[i]]=this._attribValue(s.value)))}},HtmlTableImport.prototype._attribValue=function(t){return"true"===t||"false"!==t&&t},HtmlTableImport.prototype._findCol=function(t){return this.table.options.columns.find(function(e){return e.title===t})||!1},HtmlTableImport.prototype._extractHeaders=function(t,e){for(var o=0;o<t.length;o++){var a,n=t[o],l=!1,r=this._findCol(n.textContent);r?l=!0:r={title:n.textContent.trim()},r.field||(r.field=n.textContent.trim().toLowerCase().replace(" ","_")),a=n.getAttribute("width"),a&&!r.width&&(r.width=a),n.attributes,this._extractOptions(n,r,Column.prototype.defaultOptionList),this.fieldIndex[o]=r.field,r.field==this.table.options.index&&(this.hasIndex=!0),l||this.table.options.columns.push(r)}},HtmlTableImport.prototype._generateBlankHeaders=function(t,e){for(var o=0;o<t.length;o++){var a=t[o],n={title:"",field:"col"+o};this.fieldIndex[o]=n.field;var l=a.getAttribute("width");l&&(n.width=l),this.table.options.columns.push(n)}},Tabulator.prototype.registerModule("htmlTableImport",HtmlTableImport); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Keybindings = function Keybindings(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Keybindings=function(t){this.table=t,this.watchKeys=null,this.pressedKeys=null,this.keyupBinding=!1,this.keydownBinding=!1};Keybindings.prototype.initialize=function(){var t=this.table.options.keybindings,e={};if(this.watchKeys={},this.pressedKeys=[],!1!==t){for(var i in this.bindings)e[i]=this.bindings[i];if(Object.keys(t).length)for(var n in t)e[n]=t[n];this.mapBindings(e),this.bindEvents()}},Keybindings.prototype.mapBindings=function(t){var e=this,i=this;for(var n in t)!function(n){e.actions[n]?t[n]&&("object"!==_typeof(t[n])&&(t[n]=[t[n]]),t[n].forEach(function(t){i.mapBinding(n,t)})):console.warn("Key Binding Error - no such action:",n)}(n)},Keybindings.prototype.mapBinding=function(t,e){var i=this,n={action:this.actions[t],keys:[],ctrl:!1,shift:!1,meta:!1};e.toString().toLowerCase().split(" ").join("").split("+").forEach(function(t){switch(t){case"ctrl":n.ctrl=!0;break;case"shift":n.shift=!0;break;case"meta":n.meta=!0;break;default:t=parseInt(t),n.keys.push(t),i.watchKeys[t]||(i.watchKeys[t]=[]),i.watchKeys[t].push(n)}})},Keybindings.prototype.bindEvents=function(){var t=this;this.keyupBinding=function(e){var i=e.keyCode,n=t.watchKeys[i];n&&(t.pressedKeys.push(i),n.forEach(function(i){t.checkBinding(e,i)}))},this.keydownBinding=function(e){var i=e.keyCode;if(t.watchKeys[i]){var n=t.pressedKeys.indexOf(i);n>-1&&t.pressedKeys.splice(n,1)}},this.table.element.addEventListener("keydown",this.keyupBinding),this.table.element.addEventListener("keyup",this.keydownBinding)},Keybindings.prototype.clearBindings=function(){this.keyupBinding&&this.table.element.removeEventListener("keydown",this.keyupBinding),this.keydownBinding&&this.table.element.removeEventListener("keyup",this.keydownBinding)},Keybindings.prototype.checkBinding=function(t,e){var i=this,n=!0;return t.ctrlKey==e.ctrl&&t.shiftKey==e.shift&&t.metaKey==e.meta&&(e.keys.forEach(function(t){-1==i.pressedKeys.indexOf(t)&&(n=!1)}),n&&e.action.call(i,t),!0)},Keybindings.prototype.bindings={navPrev:"shift + 9",navNext:9,navUp:38,navDown:40,scrollPageUp:33,scrollPageDown:34,scrollToStart:36,scrollToEnd:35,undo:"ctrl + 90",redo:"ctrl + 89",copyToClipboard:"ctrl + 67"},Keybindings.prototype.actions={keyBlock:function(t){t.stopPropagation(),t.preventDefault()},scrollPageUp:function(t){var e=this.table.rowManager,i=e.scrollTop-e.height;e.element.scrollHeight;t.preventDefault(),e.displayRowsCount&&(i>=0?e.element.scrollTop=i:e.scrollToRow(e.getDisplayRows()[0])),this.table.element.focus()},scrollPageDown:function(t){var e=this.table.rowManager,i=e.scrollTop+e.height,n=e.element.scrollHeight;t.preventDefault(),e.displayRowsCount&&(i<=n?e.element.scrollTop=i:e.scrollToRow(e.getDisplayRows()[e.displayRowsCount-1])),this.table.element.focus()},scrollToStart:function(t){var e=this.table.rowManager;t.preventDefault(),e.displayRowsCount&&e.scrollToRow(e.getDisplayRows()[0]),this.table.element.focus()},scrollToEnd:function(t){var e=this.table.rowManager;t.preventDefault(),e.displayRowsCount&&e.scrollToRow(e.getDisplayRows()[e.displayRowsCount-1]),this.table.element.focus()},navPrev:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().prev())},navNext:function(t){var e,i=!1,n=this.table.options.tabEndNewRow;this.table.modExists("edit")&&(i=this.table.modules.edit.currentCell)&&(t.preventDefault(),e=i.nav(),e.next()||n&&(i.getElement().firstChild.blur(),n=!0===n?this.table.addRow({}):"function"==typeof n?this.table.addRow(n(i.row.getComponent())):this.table.addRow(n),n.then(function(){setTimeout(function(){e.next()})})))},navLeft:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().left())},navRight:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().right())},navUp:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().up())},navDown:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().down())},undo:function(t){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(t.preventDefault(),this.table.modules.history.undo()))},redo:function(t){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(t.preventDefault(),this.table.modules.history.redo()))},copyToClipboard:function(t){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(!1,!0)}},Tabulator.prototype.registerModule("keybindings",Keybindings); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -69,3 +69,3 @@ var Menu = function Menu(table) { | ||
var docHeight = document.body.offsetHeight; | ||
var docHeight = Math.max(document.body.offsetHeight, window.innerHeight); | ||
@@ -72,0 +72,0 @@ //abort if no menu set |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
var Menu=function(e){this.table=e,this.menuEl=!1,this.blurEvent=this.hideMenu.bind(this)};Menu.prototype.initializeColumnHeader=function(e){var t,n=this;e.definition.headerContextMenu&&e.getElement().addEventListener("contextmenu",function(t){var i="function"==typeof e.definition.headerContextMenu?e.definition.headerContextMenu():e.definition.headerContextMenu;t.preventDefault(),n.loadMenu(t,e,i)}),e.definition.headerMenu&&(t=document.createElement("span"),t.classList.add("tabulator-header-menu-button"),t.innerHTML="⋮",t.addEventListener("click",function(t){var i="function"==typeof e.definition.headerMenu?e.definition.headerMenu():e.definition.headerMenu;t.stopPropagation(),t.preventDefault(),n.loadMenu(t,e,i)}),e.titleElement.insertBefore(t,e.titleElement.firstChild))},Menu.prototype.initializeCell=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(n){var i="function"==typeof e.column.definition.contextMenu?e.column.definition.contextMenu():e.column.definition.contextMenu;n.preventDefault(),t.loadMenu(n,e,i)})},Menu.prototype.initializeRow=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(n){var i="function"==typeof t.table.options.rowContextMenu?t.table.options.rowContextMenu():t.table.options.rowContextMenu;n.preventDefault(),t.loadMenu(n,e,i)})},Menu.prototype.loadMenu=function(e,t,n){var i=this,o=document.body.offsetHeight;n&&n.length&&(this.hideMenu(),this.menuEl=document.createElement("div"),this.menuEl.classList.add("tabulator-menu"),n.forEach(function(e){var n=document.createElement("div"),o=e.label,u=e.disabled;e.separator?n.classList.add("tabulator-menu-separator"):(n.classList.add("tabulator-menu-item"),"function"==typeof o&&(o=o(t.getComponent())),o instanceof Node?n.appendChild(o):n.innerHTML=o,"function"==typeof u&&(u=u(t.getComponent())),u?(n.classList.add("tabulator-menu-item-disabled"),n.addEventListener("click",function(e){e.stopPropagation()})):n.addEventListener("click",function(n){i.hideMenu(),e.action(n,t.getComponent())})),i.menuEl.appendChild(n)}),this.menuEl.style.top=e.pageY+"px",this.menuEl.style.left=e.pageX+"px",document.body.addEventListener("click",this.blurEvent),this.table.rowManager.element.addEventListener("scroll",this.blurEvent),setTimeout(function(){document.body.addEventListener("contextmenu",i.blurEvent)},100),document.body.appendChild(this.menuEl),e.pageX+this.menuEl.offsetWidth>=document.body.offsetWidth&&(this.menuEl.style.left="",this.menuEl.style.right=document.body.offsetWidth-e.pageX+"px"),e.pageY+this.menuEl.offsetHeight>=o&&(this.menuEl.style.top="",this.menuEl.style.bottom=o-e.pageY+"px"))},Menu.prototype.hideMenu=function(){this.menuEl.parentNode&&this.menuEl.parentNode.removeChild(this.menuEl),this.blurEvent&&(document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent))},Menu.prototype.menus={},Tabulator.prototype.registerModule("menu",Menu); | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var Menu=function(e){this.table=e,this.menuEl=!1,this.blurEvent=this.hideMenu.bind(this)};Menu.prototype.initializeColumnHeader=function(e){var t,n=this;e.definition.headerContextMenu&&e.getElement().addEventListener("contextmenu",function(t){var i="function"==typeof e.definition.headerContextMenu?e.definition.headerContextMenu():e.definition.headerContextMenu;t.preventDefault(),n.loadMenu(t,e,i)}),e.definition.headerMenu&&(t=document.createElement("span"),t.classList.add("tabulator-header-menu-button"),t.innerHTML="⋮",t.addEventListener("click",function(t){var i="function"==typeof e.definition.headerMenu?e.definition.headerMenu():e.definition.headerMenu;t.stopPropagation(),t.preventDefault(),n.loadMenu(t,e,i)}),e.titleElement.insertBefore(t,e.titleElement.firstChild))},Menu.prototype.initializeCell=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(n){var i="function"==typeof e.column.definition.contextMenu?e.column.definition.contextMenu():e.column.definition.contextMenu;n.preventDefault(),t.loadMenu(n,e,i)})},Menu.prototype.initializeRow=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(n){var i="function"==typeof t.table.options.rowContextMenu?t.table.options.rowContextMenu():t.table.options.rowContextMenu;n.preventDefault(),t.loadMenu(n,e,i)})},Menu.prototype.loadMenu=function(e,t,n){var i=this,o=Math.max(document.body.offsetHeight,window.innerHeight);n&&n.length&&(this.hideMenu(),this.menuEl=document.createElement("div"),this.menuEl.classList.add("tabulator-menu"),n.forEach(function(e){var n=document.createElement("div"),o=e.label,u=e.disabled;e.separator?n.classList.add("tabulator-menu-separator"):(n.classList.add("tabulator-menu-item"),"function"==typeof o&&(o=o(t.getComponent())),o instanceof Node?n.appendChild(o):n.innerHTML=o,"function"==typeof u&&(u=u(t.getComponent())),u?(n.classList.add("tabulator-menu-item-disabled"),n.addEventListener("click",function(e){e.stopPropagation()})):n.addEventListener("click",function(n){i.hideMenu(),e.action(n,t.getComponent())})),i.menuEl.appendChild(n)}),this.menuEl.style.top=e.pageY+"px",this.menuEl.style.left=e.pageX+"px",document.body.addEventListener("click",this.blurEvent),this.table.rowManager.element.addEventListener("scroll",this.blurEvent),setTimeout(function(){document.body.addEventListener("contextmenu",i.blurEvent)},100),document.body.appendChild(this.menuEl),e.pageX+this.menuEl.offsetWidth>=document.body.offsetWidth&&(this.menuEl.style.left="",this.menuEl.style.right=document.body.offsetWidth-e.pageX+"px"),e.pageY+this.menuEl.offsetHeight>=o&&(this.menuEl.style.top="",this.menuEl.style.bottom=o-e.pageY+"px"))},Menu.prototype.hideMenu=function(){this.menuEl.parentNode&&this.menuEl.parentNode.removeChild(this.menuEl),this.blurEvent&&(document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent))},Menu.prototype.menus={},Tabulator.prototype.registerModule("menu",Menu); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var MoveColumns = function MoveColumns(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var MoveColumns=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=250,this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.startX=0,this.autoScrollMargin=40,this.autoScrollStep=5,this.autoScrollTimeout=!1,this.touchMove=!1,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this)};MoveColumns.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.classList.add("tabulator-col-placeholder"),e},MoveColumns.prototype.initializeColumn=function(e){var t,o=this,n={};e.modules.frozen||(t=e.getElement(),n.mousemove=function(n){e.parent===o.moving.parent&&((o.touchMove?n.touches[0].pageX:n.pageX)-Tabulator.prototype.helpers.elOffset(t).left+o.table.columnManager.element.scrollLeft>e.getWidth()/2?o.toCol===e&&o.toColAfter||(t.parentNode.insertBefore(o.placeholderElement,t.nextSibling),o.moveColumn(e,!0)):(o.toCol!==e||o.toColAfter)&&(t.parentNode.insertBefore(o.placeholderElement,t),o.moveColumn(e,!1)))}.bind(o),t.addEventListener("mousedown",function(t){o.touchMove=!1,1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),o.bindTouchEvents(e)),e.modules.moveColumn=n},MoveColumns.prototype.bindTouchEvents=function(e){var t,o,n,l,i,s,m,r=this,u=e.getElement(),h=!1;u.addEventListener("touchstart",function(u){r.checkTimeout=setTimeout(function(){r.touchMove=!0,t=e,o=e.nextColumn(),l=o?o.getWidth()/2:0,n=e.prevColumn(),i=n?n.getWidth()/2:0,s=0,m=0,h=!1,r.startMove(u,e)},r.checkPeriod)},{passive:!0}),u.addEventListener("touchmove",function(u){var a,c;r.moving&&(r.moveHover(u),h||(h=u.touches[0].pageX),a=u.touches[0].pageX-h,a>0?o&&a-s>l&&(c=o)!==e&&(h=u.touches[0].pageX,c.getElement().parentNode.insertBefore(r.placeholderElement,c.getElement().nextSibling),r.moveColumn(c,!0)):n&&-a-m>i&&(c=n)!==e&&(h=u.touches[0].pageX,c.getElement().parentNode.insertBefore(r.placeholderElement,c.getElement()),r.moveColumn(c,!1)),c&&(t=c,o=c.nextColumn(),s=l,l=o?o.getWidth()/2:0,n=c.prevColumn(),m=i,i=n?n.getWidth()/2:0))},{passive:!0}),u.addEventListener("touchend",function(e){r.checkTimeout&&clearTimeout(r.checkTimeout),r.moving&&r.endMove(e)})},MoveColumns.prototype.startMove=function(e,t){var o=t.getElement();this.moving=t,this.startX=(this.touchMove?e.touches[0].pageX:e.pageX)-Tabulator.prototype.helpers.elOffset(o).left,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.table.columnManager.getElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.bottom="0",this.touchMove||(this._bindMouseMove(),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove)),this.moveHover(e)},MoveColumns.prototype._bindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().addEventListener("mousemove",e.modules.moveColumn.mousemove)})},MoveColumns.prototype._unbindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().removeEventListener("mousemove",e.modules.moveColumn.mousemove)})},MoveColumns.prototype.moveColumn=function(e,t){var o=this.moving.getCells();this.toCol=e,this.toColAfter=t,t?e.getCells().forEach(function(e,t){var n=e.getElement();n.parentNode.insertBefore(o[t].getElement(),n.nextSibling)}):e.getCells().forEach(function(e,t){var n=e.getElement();n.parentNode.insertBefore(o[t].getElement(),n)})},MoveColumns.prototype.endMove=function(e){(1===e.which||this.touchMove)&&(this._unbindMouseMove(),this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toCol&&this.table.columnManager.moveColumnActual(this.moving,this.toCol,this.toColAfter),this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.touchMove||(document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove)))},MoveColumns.prototype.moveHover=function(e){var t,o=this,n=o.table.columnManager.getElement(),l=n.scrollLeft,i=(o.touchMove?e.touches[0].pageX:e.pageX)-Tabulator.prototype.helpers.elOffset(n).left+l;o.hoverElement.style.left=i-o.startX+"px",i-l<o.autoScrollMargin&&(o.autoScrollTimeout||(o.autoScrollTimeout=setTimeout(function(){t=Math.max(0,l-5),o.table.rowManager.getElement().scrollLeft=t,o.autoScrollTimeout=!1},1))),l+n.clientWidth-i<o.autoScrollMargin&&(o.autoScrollTimeout||(o.autoScrollTimeout=setTimeout(function(){t=Math.min(n.clientWidth,l+5),o.table.rowManager.getElement().scrollLeft=t,o.autoScrollTimeout=!1},1)))},Tabulator.prototype.registerModule("moveColumn",MoveColumns); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var MoveRows = function MoveRows(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},MoveRows=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=150,this.moving=!1,this.toRow=!1,this.toRowAfter=!1,this.hasHandle=!1,this.startY=0,this.startX=0,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this),this.tableRowDropEvent=!1,this.touchMove=!1,this.connection=!1,this.connections=[],this.connectedTable=!1,this.connectedRow=!1};MoveRows.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-row"),e.classList.add("tabulator-row-placeholder"),e},MoveRows.prototype.initialize=function(e){this.connection=this.table.options.movableRowsConnectedTables},MoveRows.prototype.setHandle=function(e){this.hasHandle=e},MoveRows.prototype.initializeGroupHeader=function(e){var t=this,o={};o.mouseup=function(e){t.tableRowDrop(e,row)}.bind(t),o.mousemove=function(o){if(o.pageY-Tabulator.prototype.helpers.elOffset(e.element).top+t.table.rowManager.element.scrollTop>e.getHeight()/2){if(t.toRow!==e||!t.toRowAfter){var n=e.getElement();n.parentNode.insertBefore(t.placeholderElement,n.nextSibling),t.moveRow(e,!0)}}else if(t.toRow!==e||t.toRowAfter){var n=e.getElement();n.previousSibling&&(n.parentNode.insertBefore(t.placeholderElement,n),t.moveRow(e,!1))}}.bind(t),e.modules.moveRow=o},MoveRows.prototype.initializeRow=function(e){var t,o=this,n={};n.mouseup=function(t){o.tableRowDrop(t,e)}.bind(o),n.mousemove=function(t){if(t.pageY-Tabulator.prototype.helpers.elOffset(e.element).top+o.table.rowManager.element.scrollTop>e.getHeight()/2){if(o.toRow!==e||!o.toRowAfter){var n=e.getElement();n.parentNode.insertBefore(o.placeholderElement,n.nextSibling),o.moveRow(e,!0)}}else if(o.toRow!==e||o.toRowAfter){var n=e.getElement();n.parentNode.insertBefore(o.placeholderElement,n),o.moveRow(e,!1)}}.bind(o),this.hasHandle||(t=e.getElement(),t.addEventListener("mousedown",function(t){1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),this.bindTouchEvents(e,e.getElement())),e.modules.moveRow=n},MoveRows.prototype.initializeCell=function(e){var t=this,o=e.getElement();o.addEventListener("mousedown",function(o){1===o.which&&(t.checkTimeout=setTimeout(function(){t.startMove(o,e.row)},t.checkPeriod))}),o.addEventListener("mouseup",function(e){1===e.which&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),this.bindTouchEvents(e.row,e.getElement())},MoveRows.prototype.bindTouchEvents=function(e,t){var o,n,i,s,l,r,a,c=this,h=!1;t.addEventListener("touchstart",function(t){c.checkTimeout=setTimeout(function(){c.touchMove=!0,o=e,n=e.nextRow(),s=n?n.getHeight()/2:0,i=e.prevRow(),l=i?i.getHeight()/2:0,r=0,a=0,h=!1,c.startMove(t,e)},c.checkPeriod)},{passive:!0}),this.moving,this.toRow,this.toRowAfter,t.addEventListener("touchmove",function(t){var m,v;c.moving&&(t.preventDefault(),c.moveHover(t),h||(h=t.touches[0].pageY),m=t.touches[0].pageY-h,m>0?n&&m-r>s&&(v=n)!==e&&(h=t.touches[0].pageY,v.getElement().parentNode.insertBefore(c.placeholderElement,v.getElement().nextSibling),c.moveRow(v,!0)):i&&-m-a>l&&(v=i)!==e&&(h=t.touches[0].pageY,v.getElement().parentNode.insertBefore(c.placeholderElement,v.getElement()),c.moveRow(v,!1)),v&&(o=v,n=v.nextRow(),r=s,s=n?n.getHeight()/2:0,i=v.prevRow(),a=l,l=i?i.getHeight()/2:0))}),t.addEventListener("touchend",function(e){c.checkTimeout&&clearTimeout(c.checkTimeout),c.moving&&(c.endMove(e),c.touchMove=!1)})},MoveRows.prototype._bindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().addEventListener("mousemove",e.modules.moveRow.mousemove)})},MoveRows.prototype._unbindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().removeEventListener("mousemove",e.modules.moveRow.mousemove)})},MoveRows.prototype.startMove=function(e,t){var o=t.getElement();this.setStartPosition(e,t),this.moving=t,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",this.connection?(this.table.element.classList.add("tabulator-movingrow-sending"),this.connectToTables(t)):(o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o)),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.connection?(document.body.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this.hoverElement.style.width=this.table.element.clientWidth+"px",this.hoverElement.style.whiteSpace="nowrap",this.hoverElement.style.overflow="hidden",this.hoverElement.style.pointerEvents="none"):(this.table.rowManager.getTableElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this._bindMouseMove()),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove),this.moveHover(e)},MoveRows.prototype.setStartPosition=function(e,t){var o,n,i=this.touchMove?e.touches[0].pageX:e.pageX,s=this.touchMove?e.touches[0].pageY:e.pageY;o=t.getElement(),this.connection?(n=o.getBoundingClientRect(),this.startX=n.left-i+window.pageXOffset,this.startY=n.top-s+window.pageYOffset):this.startY=s-o.getBoundingClientRect().top},MoveRows.prototype.endMove=function(e){e&&1!==e.which&&!this.touchMove||(this._unbindMouseMove(),this.connection||(this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement)),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toRow&&this.table.rowManager.moveRow(this.moving,this.toRow,this.toRowAfter),this.moving=!1,this.toRow=!1,this.toRowAfter=!1,document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove),this.connection&&(this.table.element.classList.remove("tabulator-movingrow-sending"),this.disconnectFromTables()))},MoveRows.prototype.moveRow=function(e,t){this.toRow=e,this.toRowAfter=t},MoveRows.prototype.moveHover=function(e){this.connection?this.moveHoverConnections.call(this,e):this.moveHoverTable.call(this,e)},MoveRows.prototype.moveHoverTable=function(e){var t=this.table.rowManager.getElement(),o=t.scrollTop,n=(this.touchMove?e.touches[0].pageY:e.pageY)-t.getBoundingClientRect().top+o;this.hoverElement.style.top=n-this.startY+"px"},MoveRows.prototype.moveHoverConnections=function(e){this.hoverElement.style.left=this.startX+(this.touchMove?e.touches[0].pageX:e.pageX)+"px",this.hoverElement.style.top=this.startY+(this.touchMove?e.touches[0].pageY:e.pageY)+"px"},MoveRows.prototype.connectToTables=function(e){var t=this.table.modules.comms.getConnections(this.connection);this.table.options.movableRowsSendingStart.call(this.table,t),this.table.modules.comms.send(this.connection,"moveRow","connect",{row:e})},MoveRows.prototype.disconnectFromTables=function(){var e=this.table.modules.comms.getConnections(this.connection);this.table.options.movableRowsSendingStop.call(this.table,e),this.table.modules.comms.send(this.connection,"moveRow","disconnect")},MoveRows.prototype.connect=function(e,t){var o=this;return this.connectedTable?(console.warn("Move Row Error - Table cannot accept connection, already connected to table:",this.connectedTable),!1):(this.connectedTable=e,this.connectedRow=t,this.table.element.classList.add("tabulator-movingrow-receiving"),o.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().addEventListener("mouseup",e.modules.moveRow.mouseup)}),o.tableRowDropEvent=o.tableRowDrop.bind(o),o.table.element.addEventListener("mouseup",o.tableRowDropEvent),this.table.options.movableRowsReceivingStart.call(this.table,t,e),!0)},MoveRows.prototype.disconnect=function(e){var t=this;e===this.connectedTable?(this.connectedTable=!1,this.connectedRow=!1,this.table.element.classList.remove("tabulator-movingrow-receiving"),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().removeEventListener("mouseup",e.modules.moveRow.mouseup)}),t.table.element.removeEventListener("mouseup",t.tableRowDropEvent),this.table.options.movableRowsReceivingStop.call(this.table,e)):console.warn("Move Row Error - trying to disconnect from non connected table")},MoveRows.prototype.dropComplete=function(e,t,o){var n=!1;if(o){switch(_typeof(this.table.options.movableRowsSender)){case"string":n=this.senders[this.table.options.movableRowsSender];break;case"function":n=this.table.options.movableRowsSender}n?n.call(this,this.moving.getComponent(),t?t.getComponent():void 0,e):this.table.options.movableRowsSender&&console.warn("Mover Row Error - no matching sender found:",this.table.options.movableRowsSender),this.table.options.movableRowsSent.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e)}else this.table.options.movableRowsSentFailed.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e);this.endMove()},MoveRows.prototype.tableRowDrop=function(e,t){var o=!1,n=!1;switch(e.stopImmediatePropagation(),_typeof(this.table.options.movableRowsReceiver)){case"string":o=this.receivers[this.table.options.movableRowsReceiver];break;case"function":o=this.table.options.movableRowsReceiver}o?n=o.call(this,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):console.warn("Mover Row Error - no matching receiver found:",this.table.options.movableRowsReceiver),n?this.table.options.movableRowsReceived.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):this.table.options.movableRowsReceivedFailed.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable),this.table.modules.comms.send(this.connectedTable,"moveRow","dropcomplete",{row:t,success:n})},MoveRows.prototype.receivers={insert:function(e,t,o){return this.table.addRow(e.getData(),void 0,t),!0},add:function(e,t,o){return this.table.addRow(e.getData()),!0},update:function(e,t,o){return!!t&&(t.update(e.getData()),!0)},replace:function(e,t,o){return!!t&&(this.table.addRow(e.getData(),void 0,t),t.delete(),!0)}},MoveRows.prototype.senders={delete:function(e,t,o){e.delete()}},MoveRows.prototype.commsReceived=function(e,t,o){switch(t){case"connect":return this.connect(e,o.row);case"disconnect":return this.disconnect(e);case"dropcomplete":return this.dropComplete(e,o.row,o.success)}},Tabulator.prototype.registerModule("moveRow",MoveRows); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Mutator = function Mutator(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mutator=function(t){this.table=t,this.allowedTypes=["","data","edit","clipboard"],this.enabled=!0};Mutator.prototype.initializeColumn=function(t){var o=this,e=!1,a={};this.allowedTypes.forEach(function(r){var u,n="mutator"+(r.charAt(0).toUpperCase()+r.slice(1));t.definition[n]&&(u=o.lookupMutator(t.definition[n]))&&(e=!0,a[n]={mutator:u,params:t.definition[n+"Params"]||{}})}),e&&(t.modules.mutate=a)},Mutator.prototype.lookupMutator=function(t){var o=!1;switch(void 0===t?"undefined":_typeof(t)){case"string":this.mutators[t]?o=this.mutators[t]:console.warn("Mutator Error - No such mutator found, ignoring: ",t);break;case"function":o=t}return o},Mutator.prototype.transformRow=function(t,o,e){var a,r=this,u="mutator"+(o.charAt(0).toUpperCase()+o.slice(1));return this.enabled&&r.table.columnManager.traverse(function(r){var n,i,s;r.modules.mutate&&(n=r.modules.mutate[u]||r.modules.mutate.mutator||!1)&&(a=r.getFieldValue(void 0!==e?e:t),"data"!=o&&void 0===a||(s=r.getComponent(),i="function"==typeof n.params?n.params(a,t,o,s):n.params,r.setFieldValue(t,n.mutator(a,t,o,i,s))))}),t},Mutator.prototype.transformCell=function(t,o){var e=t.column.modules.mutate.mutatorEdit||t.column.modules.mutate.mutator||!1,a={};return e?(a=Object.assign(a,t.row.getData()),t.column.setFieldValue(a,o),e.mutator(o,a,"edit",e.params,t.getComponent())):o},Mutator.prototype.enable=function(){this.enabled=!0},Mutator.prototype.disable=function(){this.enabled=!1},Mutator.prototype.mutators={},Tabulator.prototype.registerModule("mutator",Mutator); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -21,2 +21,5 @@ var Page = function Page(table) { | ||
this.dataReceivedNames = {}; | ||
this.dataSentNames = {}; | ||
this.createElements(); | ||
@@ -106,12 +109,12 @@ }; | ||
var self = this, | ||
pageSelectLabel; | ||
pageSelectLabel, | ||
testElRow, | ||
testElCell; | ||
//update param names | ||
for (var key in self.table.options.paginationDataSent) { | ||
self.paginationDataSentNames[key] = self.table.options.paginationDataSent[key]; | ||
} | ||
this.dataSentNames = Object.assign({}, this.paginationDataSentNames); | ||
this.dataSentNames = Object.assign(this.dataSentNames, this.table.options.paginationDataSent); | ||
for (var _key in self.table.options.paginationDataReceived) { | ||
self.paginationDataReceivedNames[_key] = self.table.options.paginationDataReceived[_key]; | ||
} | ||
this.dataReceivedNames = Object.assign({}, this.paginationDataReceivedNames); | ||
this.dataReceivedNames = Object.assign(this.dataReceivedNames, this.table.options.paginationDataReceived); | ||
@@ -210,3 +213,22 @@ //build pagination element | ||
self.size = self.table.options.paginationSize || Math.floor(self.table.rowManager.getElement().clientHeight / 24); | ||
if (self.table.options.paginationSize) { | ||
self.size = self.table.options.paginationSize; | ||
} else { | ||
testElRow = document.createElement("div"); | ||
testElRow.classList.add("tabulator-row"); | ||
testElRow.style.visibility = hidden; | ||
testElCell = document.createElement("div"); | ||
testElCell.classList.add("tabulator-cell"); | ||
testElCell.innerHTML = "Page Row Test"; | ||
testElRow.appendChild(testElCell); | ||
self.table.rowManager.getTableElement().appendChild(testElRow); | ||
self.size = Math.floor(self.table.rowManager.getElement().clientHeight / testElRow.offsetHeight); | ||
self.table.rowManager.getTableElement().removeChild(testElRow); | ||
} | ||
// self.page = self.table.options.paginationInitialPage || 1; | ||
@@ -544,7 +566,7 @@ self.count = self.table.options.paginationButtonCount; | ||
//configure request params | ||
pageParams[_this7.paginationDataSentNames.page] = self.page; | ||
pageParams[_this7.dataSentNames.page] = self.page; | ||
//set page size if defined | ||
if (_this7.size) { | ||
pageParams[_this7.paginationDataSentNames.size] = _this7.size; | ||
pageParams[_this7.dataSentNames.size] = _this7.size; | ||
} | ||
@@ -560,3 +582,3 @@ | ||
pageParams[_this7.paginationDataSentNames.sorters] = sorters; | ||
pageParams[_this7.dataSentNames.sorters] = sorters; | ||
} | ||
@@ -567,3 +589,3 @@ | ||
var filters = self.table.modules.filter.getFilters(true, true); | ||
pageParams[_this7.paginationDataSentNames.filters] = filters; | ||
pageParams[_this7.dataSentNames.filters] = filters; | ||
} | ||
@@ -590,8 +612,8 @@ | ||
if (typeof data[this.paginationDataReceivedNames.last_page] === "undefined") { | ||
console.warn("Remote Pagination Error - Server response missing '" + this.paginationDataReceivedNames.last_page + "' property"); | ||
if (typeof data[this.dataReceivedNames.last_page] === "undefined") { | ||
console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.last_page + "' property"); | ||
} | ||
if (data[this.paginationDataReceivedNames.data]) { | ||
this.max = parseInt(data[this.paginationDataReceivedNames.last_page]) || 1; | ||
if (data[this.dataReceivedNames.data]) { | ||
this.max = parseInt(data[this.dataReceivedNames.last_page]) || 1; | ||
@@ -603,5 +625,5 @@ if (this.progressiveLoad) { | ||
if (this.page == 1) { | ||
this.table.rowManager.setData(data[this.paginationDataReceivedNames.data], false, this.initialLoad && this.page == 1); | ||
this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); | ||
} else { | ||
this.table.rowManager.addRows(data[this.paginationDataReceivedNames.data]); | ||
this.table.rowManager.addRows(data[this.dataReceivedNames.data]); | ||
} | ||
@@ -617,3 +639,3 @@ | ||
case "progressive_scroll": | ||
data = this.table.rowManager.getData().concat(data[this.paginationDataReceivedNames.data]); | ||
data = this.table.rowManager.getData().concat(data[this.dataReceivedNames.data]); | ||
@@ -632,3 +654,3 @@ this.table.rowManager.setData(data, true, this.initialLoad && this.page == 1); | ||
this.table.rowManager.setData(data[this.paginationDataReceivedNames.data], false, this.initialLoad && this.page == 1); | ||
this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); | ||
@@ -644,3 +666,3 @@ this.table.rowManager.scrollHorizontal(left); | ||
} else { | ||
console.warn("Remote Pagination Error - Server response missing '" + this.paginationDataReceivedNames.data + "' property"); | ||
console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.data + "' property"); | ||
} | ||
@@ -647,0 +669,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
var Page=function(e){this.table=e,this.mode="local",this.progressiveLoad=!1,this.size=0,this.page=1,this.count=5,this.max=1,this.displayIndex=0,this.initialLoad=!0,this.pageSizes=[],this.createElements()};Page.prototype.createElements=function(){var e;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),e=document.createElement("button"),e.classList.add("tabulator-page"),e.setAttribute("type","button"),e.setAttribute("role","button"),e.setAttribute("aria-label",""),e.setAttribute("title",""),this.firstBut=e.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=e.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=e.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=e.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))},Page.prototype.generatePageSizeSelectList=function(){var e=this,t=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))t=this.table.options.paginationSizeSelector,this.pageSizes=t,-1==this.pageSizes.indexOf(this.size)&&t.unshift(this.size);else if(-1==this.pageSizes.indexOf(this.size)){t=[];for(var a=1;a<5;a++)t.push(this.size*a);this.pageSizes=t}else t=this.pageSizes;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);t.forEach(function(t){var a=document.createElement("option");a.value=t,a.innerHTML=t,e.pageSizeSelect.appendChild(a)}),this.pageSizeSelect.value=this.size}},Page.prototype.initialize=function(e){var t,a=this;for(var i in a.table.options.paginationDataSent)a.paginationDataSentNames[i]=a.table.options.paginationDataSent[i];for(var s in a.table.options.paginationDataReceived)a.paginationDataReceivedNames[s]=a.table.options.paginationDataReceived[s];a.table.modules.localize.bind("pagination|first",function(e){a.firstBut.innerHTML=e}),a.table.modules.localize.bind("pagination|first_title",function(e){a.firstBut.setAttribute("aria-label",e),a.firstBut.setAttribute("title",e)}),a.table.modules.localize.bind("pagination|prev",function(e){a.prevBut.innerHTML=e}),a.table.modules.localize.bind("pagination|prev_title",function(e){a.prevBut.setAttribute("aria-label",e),a.prevBut.setAttribute("title",e)}),a.table.modules.localize.bind("pagination|next",function(e){a.nextBut.innerHTML=e}),a.table.modules.localize.bind("pagination|next_title",function(e){a.nextBut.setAttribute("aria-label",e),a.nextBut.setAttribute("title",e)}),a.table.modules.localize.bind("pagination|last",function(e){a.lastBut.innerHTML=e}),a.table.modules.localize.bind("pagination|last_title",function(e){a.lastBut.setAttribute("aria-label",e),a.lastBut.setAttribute("title",e)}),a.firstBut.addEventListener("click",function(){a.setPage(1)}),a.prevBut.addEventListener("click",function(){a.previousPage()}),a.nextBut.addEventListener("click",function(){a.nextPage().then(function(){}).catch(function(){})}),a.lastBut.addEventListener("click",function(){a.setPage(a.max)}),a.table.options.paginationElement&&(a.element=a.table.options.paginationElement),this.pageSizeSelect&&(t=document.createElement("label"),a.table.modules.localize.bind("pagination|page_size",function(e){a.pageSizeSelect.setAttribute("aria-label",e),a.pageSizeSelect.setAttribute("title",e),t.innerHTML=e}),a.element.appendChild(t),a.element.appendChild(a.pageSizeSelect),a.pageSizeSelect.addEventListener("change",function(e){a.setPageSize(a.pageSizeSelect.value),a.setPage(1).then(function(){}).catch(function(){})})),a.element.appendChild(a.firstBut),a.element.appendChild(a.prevBut),a.element.appendChild(a.pagesElement),a.element.appendChild(a.nextBut),a.element.appendChild(a.lastBut),a.table.options.paginationElement||e||a.table.footerManager.append(a.element,a),a.mode=a.table.options.pagination,a.size=a.table.options.paginationSize||Math.floor(a.table.rowManager.getElement().clientHeight/24),a.count=a.table.options.paginationButtonCount,a.generatePageSizeSelectList()},Page.prototype.initializeProgressive=function(e){this.initialize(!0),this.mode="progressive_"+e,this.progressiveLoad=!0},Page.prototype.setDisplayIndex=function(e){this.displayIndex=e},Page.prototype.getDisplayIndex=function(){return this.displayIndex},Page.prototype.setMaxRows=function(e){this.max=e?Math.ceil(e/this.size):1,this.page>this.max&&(this.page=this.max)},Page.prototype.reset=function(e,t){return("local"==this.mode||e)&&(this.page=1),t&&(this.initialLoad=!0),!0},Page.prototype.setMaxPage=function(e){e=parseInt(e),this.max=e||1,this.page>this.max&&(this.page=this.max,this.trigger())},Page.prototype.setPage=function(e){var t=this,a=this;return new Promise(function(i,s){e=parseInt(e),e>0&&e<=t.max?(t.page=e,t.trigger().then(function(){i()}).catch(function(){s()}),a.table.options.persistence&&a.table.modExists("persistence",!0)&&a.table.modules.persistence.config.page&&a.table.modules.persistence.save("page")):(console.warn("Pagination Error - Requested page is out of range of 1 - "+t.max+":",e),s())})},Page.prototype.setPageToRow=function(e){var t=this;return new Promise(function(a,i){var s=t.table.rowManager.getDisplayRows(t.displayIndex-1),n=s.indexOf(e);if(n>-1){var o=Math.ceil((n+1)/t.size);t.setPage(o).then(function(){a()}).catch(function(){i()})}else console.warn("Pagination Error - Requested row is not visible"),i()})},Page.prototype.setPageSize=function(e){e=parseInt(e),e>0&&(this.size=e),this.pageSizeSelect&&this.generatePageSizeSelectList(),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.page&&this.table.modules.persistence.save("page")},Page.prototype._setPageButtons=function(){for(var e=this,t=Math.floor((this.count-1)/2),a=Math.ceil((this.count-1)/2),i=this.max-this.page+t+1<this.count?this.max-this.count+1:Math.max(this.page-t,1),s=this.page<=a?Math.min(this.count,this.max):Math.min(this.page+a,this.max);e.pagesElement.firstChild;)e.pagesElement.removeChild(e.pagesElement.firstChild);1==e.page?(e.firstBut.disabled=!0,e.prevBut.disabled=!0):(e.firstBut.disabled=!1,e.prevBut.disabled=!1),e.page==e.max?(e.lastBut.disabled=!0,e.nextBut.disabled=!0):(e.lastBut.disabled=!1,e.nextBut.disabled=!1);for(var n=i;n<=s;n++)n>0&&n<=e.max&&e.pagesElement.appendChild(e._generatePageButton(n));this.footerRedraw()},Page.prototype._generatePageButton=function(e){var t=this,a=document.createElement("button");return a.classList.add("tabulator-page"),e==t.page&&a.classList.add("active"),a.setAttribute("type","button"),a.setAttribute("role","button"),a.setAttribute("aria-label","Show Page "+e),a.setAttribute("title","Show Page "+e),a.setAttribute("data-page",e),a.textContent=e,a.addEventListener("click",function(a){t.setPage(e)}),a},Page.prototype.previousPage=function(){var e=this;return new Promise(function(t,a){e.page>1?(e.page--,e.trigger().then(function(){t()}).catch(function(){a()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(console.warn("Pagination Error - Previous page would be less than page 1:",0),a())})},Page.prototype.nextPage=function(){var e=this;return new Promise(function(t,a){e.page<e.max?(e.page++,e.trigger().then(function(){t()}).catch(function(){a()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(e.progressiveLoad||console.warn("Pagination Error - Next page would be greater than maximum page of "+e.max+":",e.max+1),a())})},Page.prototype.getPage=function(){return this.page},Page.prototype.getPageMax=function(){return this.max},Page.prototype.getPageSize=function(e){return this.size},Page.prototype.getMode=function(){return this.mode},Page.prototype.getRows=function(e){var t,a,i;if("local"==this.mode){t=[],a=this.size*(this.page-1),i=a+parseInt(this.size),this._setPageButtons();for(var s=a;s<i;s++)e[s]&&t.push(e[s]);return t}return this._setPageButtons(),e.slice(0)},Page.prototype.trigger=function(){var e,t=this;return new Promise(function(a,i){switch(t.mode){case"local":e=t.table.rowManager.scrollLeft,t.table.rowManager.refreshActiveData("page"),t.table.rowManager.scrollHorizontal(e),t.table.options.pageLoaded.call(t.table,t.getPage()),a();break;case"remote":case"progressive_load":case"progressive_scroll":t.table.modules.ajax.blockActiveRequest(),t._getRemotePage().then(function(){a()}).catch(function(){i()});break;default:console.warn("Pagination Error - no such pagination mode:",t.mode),i()}})},Page.prototype._getRemotePage=function(){var e,t,a=this,i=this;return new Promise(function(s,n){if(i.table.modExists("ajax",!0)||n(),e=Tabulator.prototype.helpers.deepClone(i.table.modules.ajax.getParams()||{}),t=i.table.modules.ajax.getParams(),t[a.paginationDataSentNames.page]=i.page,a.size&&(t[a.paginationDataSentNames.size]=a.size),a.table.options.ajaxSorting&&a.table.modExists("sort")){var o=i.table.modules.sort.getSort();o.forEach(function(e){delete e.column}),t[a.paginationDataSentNames.sorters]=o}if(a.table.options.ajaxFiltering&&a.table.modExists("filter")){var r=i.table.modules.filter.getFilters(!0,!0);t[a.paginationDataSentNames.filters]=r}i.table.modules.ajax.setParams(t),i.table.modules.ajax.sendRequest(a.progressiveLoad).then(function(e){i._parseRemoteData(e),s()}).catch(function(e){n()}),i.table.modules.ajax.setParams(e)})},Page.prototype._parseRemoteData=function(e){var t,e,a,i=this;if(void 0===e[this.paginationDataReceivedNames.last_page]&&console.warn("Remote Pagination Error - Server response missing '"+this.paginationDataReceivedNames.last_page+"' property"),e[this.paginationDataReceivedNames.data]){if(this.max=parseInt(e[this.paginationDataReceivedNames.last_page])||1,this.progressiveLoad)switch(this.mode){case"progressive_load":1==this.page?this.table.rowManager.setData(e[this.paginationDataReceivedNames.data],!1,this.initialLoad&&1==this.page):this.table.rowManager.addRows(e[this.paginationDataReceivedNames.data]),this.page<this.max&&setTimeout(function(){i.nextPage().then(function(){}).catch(function(){})},i.table.options.ajaxProgressiveLoadDelay);break;case"progressive_scroll":e=this.table.rowManager.getData().concat(e[this.paginationDataReceivedNames.data]),this.table.rowManager.setData(e,!0,this.initialLoad&&1==this.page),a=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.element.clientHeight,i.table.rowManager.element.scrollHeight<=i.table.rowManager.element.clientHeight+a&&i.nextPage().then(function(){}).catch(function(){})}else t=this.table.rowManager.scrollLeft,this.table.rowManager.setData(e[this.paginationDataReceivedNames.data],!1,this.initialLoad&&1==this.page),this.table.rowManager.scrollHorizontal(t),this.table.columnManager.scrollHorizontal(t),this.table.options.pageLoaded.call(this.table,this.getPage());this.initialLoad=!1}else console.warn("Remote Pagination Error - Server response missing '"+this.paginationDataReceivedNames.data+"' property")},Page.prototype.footerRedraw=function(){var e=this.table.footerManager.element;Math.ceil(e.clientWidth)-e.scrollWidth<0?this.pagesElement.style.display="none":(this.pagesElement.style.display="",Math.ceil(e.clientWidth)-e.scrollWidth<0&&(this.pagesElement.style.display="none"))},Page.prototype.paginationDataSentNames={page:"page",size:"size",sorters:"sorters",filters:"filters"},Page.prototype.paginationDataReceivedNames={current_page:"current_page",last_page:"last_page",data:"data"},Tabulator.prototype.registerModule("page",Page); | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var Page=function(e){this.table=e,this.mode="local",this.progressiveLoad=!1,this.size=0,this.page=1,this.count=5,this.max=1,this.displayIndex=0,this.initialLoad=!0,this.pageSizes=[],this.dataReceivedNames={},this.dataSentNames={},this.createElements()};Page.prototype.createElements=function(){var e;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),e=document.createElement("button"),e.classList.add("tabulator-page"),e.setAttribute("type","button"),e.setAttribute("role","button"),e.setAttribute("aria-label",""),e.setAttribute("title",""),this.firstBut=e.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=e.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=e.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=e.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))},Page.prototype.generatePageSizeSelectList=function(){var e=this,t=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))t=this.table.options.paginationSizeSelector,this.pageSizes=t,-1==this.pageSizes.indexOf(this.size)&&t.unshift(this.size);else if(-1==this.pageSizes.indexOf(this.size)){t=[];for(var a=1;a<5;a++)t.push(this.size*a);this.pageSizes=t}else t=this.pageSizes;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);t.forEach(function(t){var a=document.createElement("option");a.value=t,a.innerHTML=t,e.pageSizeSelect.appendChild(a)}),this.pageSizeSelect.value=this.size}},Page.prototype.initialize=function(e){var t,a,i,s=this;this.dataSentNames=Object.assign({},this.paginationDataSentNames),this.dataSentNames=Object.assign(this.dataSentNames,this.table.options.paginationDataSent),this.dataReceivedNames=Object.assign({},this.paginationDataReceivedNames),this.dataReceivedNames=Object.assign(this.dataReceivedNames,this.table.options.paginationDataReceived),s.table.modules.localize.bind("pagination|first",function(e){s.firstBut.innerHTML=e}),s.table.modules.localize.bind("pagination|first_title",function(e){s.firstBut.setAttribute("aria-label",e),s.firstBut.setAttribute("title",e)}),s.table.modules.localize.bind("pagination|prev",function(e){s.prevBut.innerHTML=e}),s.table.modules.localize.bind("pagination|prev_title",function(e){s.prevBut.setAttribute("aria-label",e),s.prevBut.setAttribute("title",e)}),s.table.modules.localize.bind("pagination|next",function(e){s.nextBut.innerHTML=e}),s.table.modules.localize.bind("pagination|next_title",function(e){s.nextBut.setAttribute("aria-label",e),s.nextBut.setAttribute("title",e)}),s.table.modules.localize.bind("pagination|last",function(e){s.lastBut.innerHTML=e}),s.table.modules.localize.bind("pagination|last_title",function(e){s.lastBut.setAttribute("aria-label",e),s.lastBut.setAttribute("title",e)}),s.firstBut.addEventListener("click",function(){s.setPage(1)}),s.prevBut.addEventListener("click",function(){s.previousPage()}),s.nextBut.addEventListener("click",function(){s.nextPage().then(function(){}).catch(function(){})}),s.lastBut.addEventListener("click",function(){s.setPage(s.max)}),s.table.options.paginationElement&&(s.element=s.table.options.paginationElement),this.pageSizeSelect&&(t=document.createElement("label"),s.table.modules.localize.bind("pagination|page_size",function(e){s.pageSizeSelect.setAttribute("aria-label",e),s.pageSizeSelect.setAttribute("title",e),t.innerHTML=e}),s.element.appendChild(t),s.element.appendChild(s.pageSizeSelect),s.pageSizeSelect.addEventListener("change",function(e){s.setPageSize(s.pageSizeSelect.value),s.setPage(1).then(function(){}).catch(function(){})})),s.element.appendChild(s.firstBut),s.element.appendChild(s.prevBut),s.element.appendChild(s.pagesElement),s.element.appendChild(s.nextBut),s.element.appendChild(s.lastBut),s.table.options.paginationElement||e||s.table.footerManager.append(s.element,s),s.mode=s.table.options.pagination,s.table.options.paginationSize?s.size=s.table.options.paginationSize:(a=document.createElement("div"),a.classList.add("tabulator-row"),a.style.visibility=e,i=document.createElement("div"),i.classList.add("tabulator-cell"),i.innerHTML="Page Row Test",a.appendChild(i),s.table.rowManager.getTableElement().appendChild(a),s.size=Math.floor(s.table.rowManager.getElement().clientHeight/a.offsetHeight),s.table.rowManager.getTableElement().removeChild(a)),s.count=s.table.options.paginationButtonCount,s.generatePageSizeSelectList()},Page.prototype.initializeProgressive=function(e){this.initialize(!0),this.mode="progressive_"+e,this.progressiveLoad=!0},Page.prototype.setDisplayIndex=function(e){this.displayIndex=e},Page.prototype.getDisplayIndex=function(){return this.displayIndex},Page.prototype.setMaxRows=function(e){this.max=e?Math.ceil(e/this.size):1,this.page>this.max&&(this.page=this.max)},Page.prototype.reset=function(e,t){return("local"==this.mode||e)&&(this.page=1),t&&(this.initialLoad=!0),!0},Page.prototype.setMaxPage=function(e){e=parseInt(e),this.max=e||1,this.page>this.max&&(this.page=this.max,this.trigger())},Page.prototype.setPage=function(e){var t=this,a=this;return new Promise(function(i,s){e=parseInt(e),e>0&&e<=t.max?(t.page=e,t.trigger().then(function(){i()}).catch(function(){s()}),a.table.options.persistence&&a.table.modExists("persistence",!0)&&a.table.modules.persistence.config.page&&a.table.modules.persistence.save("page")):(console.warn("Pagination Error - Requested page is out of range of 1 - "+t.max+":",e),s())})},Page.prototype.setPageToRow=function(e){var t=this;return new Promise(function(a,i){var s=t.table.rowManager.getDisplayRows(t.displayIndex-1),n=s.indexOf(e);if(n>-1){var o=Math.ceil((n+1)/t.size);t.setPage(o).then(function(){a()}).catch(function(){i()})}else console.warn("Pagination Error - Requested row is not visible"),i()})},Page.prototype.setPageSize=function(e){e=parseInt(e),e>0&&(this.size=e),this.pageSizeSelect&&this.generatePageSizeSelectList(),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.page&&this.table.modules.persistence.save("page")},Page.prototype._setPageButtons=function(){for(var e=this,t=Math.floor((this.count-1)/2),a=Math.ceil((this.count-1)/2),i=this.max-this.page+t+1<this.count?this.max-this.count+1:Math.max(this.page-t,1),s=this.page<=a?Math.min(this.count,this.max):Math.min(this.page+a,this.max);e.pagesElement.firstChild;)e.pagesElement.removeChild(e.pagesElement.firstChild);1==e.page?(e.firstBut.disabled=!0,e.prevBut.disabled=!0):(e.firstBut.disabled=!1,e.prevBut.disabled=!1),e.page==e.max?(e.lastBut.disabled=!0,e.nextBut.disabled=!0):(e.lastBut.disabled=!1,e.nextBut.disabled=!1);for(var n=i;n<=s;n++)n>0&&n<=e.max&&e.pagesElement.appendChild(e._generatePageButton(n));this.footerRedraw()},Page.prototype._generatePageButton=function(e){var t=this,a=document.createElement("button");return a.classList.add("tabulator-page"),e==t.page&&a.classList.add("active"),a.setAttribute("type","button"),a.setAttribute("role","button"),a.setAttribute("aria-label","Show Page "+e),a.setAttribute("title","Show Page "+e),a.setAttribute("data-page",e),a.textContent=e,a.addEventListener("click",function(a){t.setPage(e)}),a},Page.prototype.previousPage=function(){var e=this;return new Promise(function(t,a){e.page>1?(e.page--,e.trigger().then(function(){t()}).catch(function(){a()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(console.warn("Pagination Error - Previous page would be less than page 1:",0),a())})},Page.prototype.nextPage=function(){var e=this;return new Promise(function(t,a){e.page<e.max?(e.page++,e.trigger().then(function(){t()}).catch(function(){a()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(e.progressiveLoad||console.warn("Pagination Error - Next page would be greater than maximum page of "+e.max+":",e.max+1),a())})},Page.prototype.getPage=function(){return this.page},Page.prototype.getPageMax=function(){return this.max},Page.prototype.getPageSize=function(e){return this.size},Page.prototype.getMode=function(){return this.mode},Page.prototype.getRows=function(e){var t,a,i;if("local"==this.mode){t=[],a=this.size*(this.page-1),i=a+parseInt(this.size),this._setPageButtons();for(var s=a;s<i;s++)e[s]&&t.push(e[s]);return t}return this._setPageButtons(),e.slice(0)},Page.prototype.trigger=function(){var e,t=this;return new Promise(function(a,i){switch(t.mode){case"local":e=t.table.rowManager.scrollLeft,t.table.rowManager.refreshActiveData("page"),t.table.rowManager.scrollHorizontal(e),t.table.options.pageLoaded.call(t.table,t.getPage()),a();break;case"remote":case"progressive_load":case"progressive_scroll":t.table.modules.ajax.blockActiveRequest(),t._getRemotePage().then(function(){a()}).catch(function(){i()});break;default:console.warn("Pagination Error - no such pagination mode:",t.mode),i()}})},Page.prototype._getRemotePage=function(){var e,t,a=this,i=this;return new Promise(function(s,n){if(i.table.modExists("ajax",!0)||n(),e=Tabulator.prototype.helpers.deepClone(i.table.modules.ajax.getParams()||{}),t=i.table.modules.ajax.getParams(),t[a.dataSentNames.page]=i.page,a.size&&(t[a.dataSentNames.size]=a.size),a.table.options.ajaxSorting&&a.table.modExists("sort")){var o=i.table.modules.sort.getSort();o.forEach(function(e){delete e.column}),t[a.dataSentNames.sorters]=o}if(a.table.options.ajaxFiltering&&a.table.modExists("filter")){var r=i.table.modules.filter.getFilters(!0,!0);t[a.dataSentNames.filters]=r}i.table.modules.ajax.setParams(t),i.table.modules.ajax.sendRequest(a.progressiveLoad).then(function(e){i._parseRemoteData(e),s()}).catch(function(e){n()}),i.table.modules.ajax.setParams(e)})},Page.prototype._parseRemoteData=function(e){var t,e,a,i=this;if(void 0===e[this.dataReceivedNames.last_page]&&console.warn("Remote Pagination Error - Server response missing '"+this.dataReceivedNames.last_page+"' property"),e[this.dataReceivedNames.data]){if(this.max=parseInt(e[this.dataReceivedNames.last_page])||1,this.progressiveLoad)switch(this.mode){case"progressive_load":1==this.page?this.table.rowManager.setData(e[this.dataReceivedNames.data],!1,this.initialLoad&&1==this.page):this.table.rowManager.addRows(e[this.dataReceivedNames.data]),this.page<this.max&&setTimeout(function(){i.nextPage().then(function(){}).catch(function(){})},i.table.options.ajaxProgressiveLoadDelay);break;case"progressive_scroll":e=this.table.rowManager.getData().concat(e[this.dataReceivedNames.data]),this.table.rowManager.setData(e,!0,this.initialLoad&&1==this.page),a=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.element.clientHeight,i.table.rowManager.element.scrollHeight<=i.table.rowManager.element.clientHeight+a&&i.nextPage().then(function(){}).catch(function(){})}else t=this.table.rowManager.scrollLeft,this.table.rowManager.setData(e[this.dataReceivedNames.data],!1,this.initialLoad&&1==this.page),this.table.rowManager.scrollHorizontal(t),this.table.columnManager.scrollHorizontal(t),this.table.options.pageLoaded.call(this.table,this.getPage());this.initialLoad=!1}else console.warn("Remote Pagination Error - Server response missing '"+this.dataReceivedNames.data+"' property")},Page.prototype.footerRedraw=function(){var e=this.table.footerManager.element;Math.ceil(e.clientWidth)-e.scrollWidth<0?this.pagesElement.style.display="none":(this.pagesElement.style.display="",Math.ceil(e.clientWidth)-e.scrollWidth<0&&(this.pagesElement.style.display="none"))},Page.prototype.paginationDataSentNames={page:"page",size:"size",sorters:"sorters",filters:"filters"},Page.prototype.paginationDataReceivedNames={current_page:"current_page",last_page:"last_page",data:"data"},Tabulator.prototype.registerModule("page",Page); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var Persistence = function Persistence(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var Persistence=function(e){this.table=e,this.mode="",this.id="",this.defWatcherBlock=!1,this.config={},this.readFunc=!1,this.writeFunc=!1};Persistence.prototype.localStorageTest=function(){var e="_tabulator_test";try{return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}},Persistence.prototype.initialize=function(){var e,t=this.table.options.persistenceMode,i=this.table.options.persistenceID;this.mode=!0!==t?t:this.localStorageTest()?"local":"cookie",this.table.options.persistenceReaderFunc?"function"==typeof this.table.options.persistenceReaderFunc?this.readFunc=this.table.options.persistenceReaderFunc:this.readers[this.table.options.persistenceReaderFunc]?this.readFunc=this.readers[this.table.options.persistenceReaderFunc]:console.warn("Persistence Read Error - invalid reader set",this.table.options.persistenceReaderFunc):this.readers[this.mode]?this.readFunc=this.readers[this.mode]:console.warn("Persistence Read Error - invalid reader set",this.mode),this.table.options.persistenceWriterFunc?"function"==typeof this.table.options.persistenceWriterFunc?this.writeFunc=this.table.options.persistenceWriterFunc:this.readers[this.table.options.persistenceWriterFunc]?this.writeFunc=this.readers[this.table.options.persistenceWriterFunc]:console.warn("Persistence Write Error - invalid reader set",this.table.options.persistenceWriterFunc):this.writers[this.mode]?this.writeFunc=this.writers[this.mode]:console.warn("Persistence Write Error - invalid writer set",this.mode),this.id="tabulator-"+(i||this.table.element.getAttribute("id")||""),this.config={sort:!0===this.table.options.persistence||this.table.options.persistence.sort,filter:!0===this.table.options.persistence||this.table.options.persistence.filter,group:!0===this.table.options.persistence||this.table.options.persistence.group,page:!0===this.table.options.persistence||this.table.options.persistence.page,columns:!0===this.table.options.persistence?["title","width","visible"]:this.table.options.persistence.columns},this.config.page&&(e=this.retreiveData("page"))&&(void 0===e.paginationSize||!0!==this.config.page&&!this.config.page.size||(this.table.options.paginationSize=e.paginationSize),void 0===e.paginationInitialPage||!0!==this.config.page&&!this.config.page.page||(this.table.options.paginationInitialPage=e.paginationInitialPage)),this.config.group&&(e=this.retreiveData("group"))&&(void 0===e.groupBy||!0!==this.config.group&&!this.config.group.groupBy||(this.table.options.groupBy=e.groupBy),void 0===e.groupStartOpen||!0!==this.config.group&&!this.config.group.groupStartOpen||(this.table.options.groupStartOpen=e.groupStartOpen),void 0===e.groupHeader||!0!==this.config.group&&!this.config.group.groupHeader||(this.table.options.groupHeader=e.groupHeader))},Persistence.prototype.initializeColumn=function(e){var t,i,s=this;this.config.columns&&(this.defWatcherBlock=!0,t=e.getDefinition(),i=!0===this.config.columns?Object.keys(t):this.config.columns,i.forEach(function(e){var i=Object.getOwnPropertyDescriptor(t,e),o=t[e];i&&Object.defineProperty(t,e,{set:function(e){o=e,s.defWatcherBlock||s.save("columns"),i.set&&i.set(e)},get:function(){return i.get&&i.get(),o}})}),this.defWatcherBlock=!1)},Persistence.prototype.load=function(e,t){var i=this.retreiveData(e);return t&&(i=i?this.mergeDefinition(t,i):t),i},Persistence.prototype.retreiveData=function(e){return!!this.readFunc&&this.readFunc(this.id,e)},Persistence.prototype.mergeDefinition=function(e,t){var i=this,s=[];return t=t||[],t.forEach(function(t,o){var n,r=i._findColumn(e,t);r&&(!0===i.config.columns||void 0==i.config.columns?(n=Object.keys(r),n.push("width")):n=i.config.columns,n.forEach(function(e){void 0!==t[e]&&(r[e]=t[e])}),r.columns&&(r.columns=i.mergeDefinition(r.columns,t.columns)),s.push(r))}),e.forEach(function(e,o){i._findColumn(t,e)||(s.length>o?s.splice(o,0,e):s.push(e))}),s},Persistence.prototype._findColumn=function(e,t){var i=t.columns?"group":t.field?"field":"object";return e.find(function(e){switch(i){case"group":return e.title===t.title&&e.columns.length===t.columns.length;case"field":return e.field===t.field;case"object":return e===t}})},Persistence.prototype.save=function(e){var t={};switch(e){case"columns":t=this.parseColumns(this.table.columnManager.getColumns());break;case"filter":t=this.table.modules.filter.getFilters();break;case"sort":t=this.validateSorters(this.table.modules.sort.getSort());break;case"group":t=this.getGroupConfig();break;case"page":t=this.getPageConfig()}this.writeFunc&&this.writeFunc(this.id,e,t)},Persistence.prototype.validateSorters=function(e){return e.forEach(function(e){e.column=e.field,delete e.field}),e},Persistence.prototype.getGroupConfig=function(){return this.config.group&&((!0===this.config.group||this.config.group.groupBy)&&(data.groupBy=this.table.options.groupBy),(!0===this.config.group||this.config.group.groupStartOpen)&&(data.groupStartOpen=this.table.options.groupStartOpen),(!0===this.config.group||this.config.group.groupHeader)&&(data.groupHeader=this.table.options.groupHeader)),data},Persistence.prototype.getPageConfig=function(){var e={};return this.config.page&&((!0===this.config.page||this.config.page.size)&&(e.paginationSize=this.table.modules.page.getPageSize()),(!0===this.config.page||this.config.page.page)&&(e.paginationInitialPage=this.table.modules.page.getPage())),e},Persistence.prototype.parseColumns=function(e){var t=this,i=[];return e.forEach(function(e){var s,o={},n=e.getDefinition();e.isGroup?(o.title=n.title,o.columns=t.parseColumns(e.getColumns())):(o.field=e.getField(),!0===t.config.columns||void 0==t.config.columns?(s=Object.keys(n),s.push("width")):s=t.config.columns,s.forEach(function(t){switch(t){case"width":o.width=e.getWidth();break;case"visible":o.visible=e.visible;break;default:o[t]=n[t]}})),i.push(o)}),i},Persistence.prototype.readers={local:function(e,t){var i=localStorage.getItem(e+"-"+t);return!!i&&JSON.parse(i)},cookie:function(e,t){var i,s,o=document.cookie,n=e+"-"+t,r=o.indexOf(n+"=");return r>-1&&(o=o.substr(r),i=o.indexOf(";"),i>-1&&(o=o.substr(0,i)),s=o.replace(n+"=","")),!!s&&JSON.parse(s)}},Persistence.prototype.writers={local:function(e,t,i){localStorage.setItem(e+"-"+t,JSON.stringify(i))},cookie:function(e,t,i){var s=new Date;s.setDate(s.getDate()+1e4),document.cookie=e+"-"+t+"="+JSON.stringify(i)+"; expires="+s.toUTCString()}},Tabulator.prototype.registerModule("persistence",Persistence); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var Print = function Print(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var Print=function(t){this.table=t,this.element=!1,this.manualBlock=!1};Print.prototype.initialize=function(){window.addEventListener("beforeprint",this.replaceTable.bind(this)),window.addEventListener("afterprint",this.cleanup.bind(this))},Print.prototype.replaceTable=function(){this.manualBlock||(this.element=document.createElement("div"),this.element.classList.add("tabulator-print-table"),this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig,this.table.options.printStyled,this.table.options.printRowRange,"print")),this.table.element.style.display="none",this.table.element.parentNode.insertBefore(this.element,this.table.element))},Print.prototype.cleanup=function(){document.body.classList.remove("tabulator-print-fullscreen-hide"),this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),this.table.element.style.display="")},Print.prototype.printFullscreen=function(t,e,i){var n,l,o=window.scrollX,a=window.scrollY,s=document.createElement("div"),r=document.createElement("div"),p=this.table.modules.export.genereateTable(void 0!==i?i:this.table.options.printConfig,void 0!==e?e:this.table.options.printStyled,t,"print");this.manualBlock=!0,this.element=document.createElement("div"),this.element.classList.add("tabulator-print-fullscreen"),this.table.options.printHeader&&(s.classList.add("tabulator-print-header"),n="function"==typeof this.table.options.printHeader?this.table.options.printHeader.call(this.table):this.table.options.printHeader,"string"==typeof n?s.innerHTML=n:s.appendChild(n),this.element.appendChild(s)),this.element.appendChild(p),this.table.options.printFooter&&(r.classList.add("tabulator-print-footer"),l="function"==typeof this.table.options.printFooter?this.table.options.printFooter.call(this.table):this.table.options.printFooter,"string"==typeof l?r.innerHTML=l:r.appendChild(l),this.element.appendChild(r)),document.body.classList.add("tabulator-print-fullscreen-hide"),document.body.appendChild(this.element),this.table.options.printFormatter&&this.table.options.printFormatter(this.element,p),window.print(),this.cleanup(),window.scrollTo(o,a),this.manualBlock=!1},Tabulator.prototype.registerModule("print",Print); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var ReactiveData = function ReactiveData(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var ReactiveData=function(e){this.table=e,this.data=!1,this.blocked=!1,this.origFuncs={},this.currentVersion=0};ReactiveData.prototype.watchData=function(e){var t,a=this;this.currentVersion++,t=this.currentVersion,a.unwatchData(),a.data=e,a.origFuncs.push=e.push,Object.defineProperty(a.data,"push",{enumerable:!1,configurable:!0,value:function(){var r=Array.from(arguments);return a.blocked||t!==a.currentVersion||r.forEach(function(e){a.table.rowManager.addRowActual(e,!1)}),a.origFuncs.push.apply(e,arguments)}}),a.origFuncs.unshift=e.unshift,Object.defineProperty(a.data,"unshift",{enumerable:!1,configurable:!0,value:function(){var r=Array.from(arguments);return a.blocked||t!==a.currentVersion||r.forEach(function(e){a.table.rowManager.addRowActual(e,!0)}),a.origFuncs.unshift.apply(e,arguments)}}),a.origFuncs.shift=e.shift,Object.defineProperty(a.data,"shift",{enumerable:!1,configurable:!0,value:function(){var r;return a.blocked||t!==a.currentVersion||a.data.length&&(r=a.table.rowManager.getRowFromDataObject(a.data[0]))&&r.deleteActual(),a.origFuncs.shift.call(e)}}),a.origFuncs.pop=e.pop,Object.defineProperty(a.data,"pop",{enumerable:!1,configurable:!0,value:function(){var r;return a.blocked||t!==a.currentVersion||a.data.length&&(r=a.table.rowManager.getRowFromDataObject(a.data[a.data.length-1]))&&r.deleteActual(),a.origFuncs.pop.call(e)}}),a.origFuncs.splice=e.splice,Object.defineProperty(a.data,"splice",{enumerable:!1,configurable:!0,value:function(){var r,o=Array.from(arguments),n=o[0]<0?e.length+o[0]:o[0],c=o[1],i=!!o[2]&&o.slice(2);if(!a.blocked&&t===a.currentVersion){if(i&&(r=!!e[n]&&a.table.rowManager.getRowFromDataObject(e[n]),r?i.forEach(function(e){a.table.rowManager.addRowActual(e,!0,r,!0)}):(i=i.slice().reverse(),i.forEach(function(e){a.table.rowManager.addRowActual(e,!0,!1,!0)}))),0!==c){var u=e.slice(n,void 0===o[1]?o[1]:n+c);u.forEach(function(e,t){var r=a.table.rowManager.getRowFromDataObject(e);r&&r.deleteActual(t!==u.length-1)})}(i||0!==c)&&a.table.rowManager.reRenderInPosition()}return a.origFuncs.splice.apply(e,arguments)}})},ReactiveData.prototype.unwatchData=function(){if(!1!==this.data)for(var e in this.origFuncs)Object.defineProperty(this.data,e,{enumerable:!0,configurable:!0,writable:!0,value:this.origFuncs.key})},ReactiveData.prototype.watchRow=function(e){var t=e.getData();this.blocked=!0;for(var a in t)this.watchKey(e,t,a);this.blocked=!1},ReactiveData.prototype.watchKey=function(e,t,a){var r=this,o=Object.getOwnPropertyDescriptor(t,a),n=t[a],c=this.currentVersion;Object.defineProperty(t,a,{set:function(t){if(n=t,!r.blocked&&c===r.currentVersion){var i={};i[a]=t,e.updateData(i)}o.set&&o.set(t)},get:function(){return o.get&&o.get(),n}})},ReactiveData.prototype.unwatchRow=function(e){var t=e.getData();for(var a in t)Object.defineProperty(t,a,{value:t[a]})},ReactiveData.prototype.block=function(){this.blocked=!0},ReactiveData.prototype.unblock=function(){this.blocked=!1},Tabulator.prototype.registerModule("reactiveData",ReactiveData); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var ResizeColumns = function ResizeColumns(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var ResizeColumns=function(e){this.table=e,this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.handle=null,this.prevHandle=null};ResizeColumns.prototype.initializeColumn=function(e,t,n){var o=this,i=!1,s=this.table.options.resizableColumns;if("header"===e&&(i="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:i}),!0===s||s==e){var a=document.createElement("div");a.className="tabulator-col-resize-handle";var l=document.createElement("div");l.className="tabulator-col-resize-handle prev",a.addEventListener("click",function(e){e.stopPropagation()});var r=function(e){var n=t.getLastColumn();n&&o._checkResizability(n)&&(o.startColumn=t,o._mouseDown(e,n,a))};a.addEventListener("mousedown",r),a.addEventListener("touchstart",r,{passive:!0}),a.addEventListener("dblclick",function(e){var n=t.getLastColumn();n&&o._checkResizability(n)&&(e.stopPropagation(),n.reinitializeWidth(!0))}),l.addEventListener("click",function(e){e.stopPropagation()});var d=function(e){var n,i,s;(n=t.getFirstColumn())&&(i=o.table.columnManager.findColumnIndex(n),(s=i>0&&o.table.columnManager.getColumnByIndex(i-1))&&o._checkResizability(s)&&(o.startColumn=t,o._mouseDown(e,s,l)))};l.addEventListener("mousedown",d),l.addEventListener("touchstart",d,{passive:!0}),l.addEventListener("dblclick",function(e){var n,i,s;(n=t.getFirstColumn())&&(i=o.table.columnManager.findColumnIndex(n),(s=i>0&&o.table.columnManager.getColumnByIndex(i-1))&&o._checkResizability(s)&&(e.stopPropagation(),s.reinitializeWidth(!0)))}),n.appendChild(a),n.appendChild(l)}},ResizeColumns.prototype._checkResizability=function(e){return void 0!==e.definition.resizable?e.definition.resizable:this.table.options.resizableColumns},ResizeColumns.prototype._mouseDown=function(e,t,n){function o(e){t.setWidth(s.startWidth+((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)),!s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights()}function i(e){s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!1),s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights(),document.body.removeEventListener("mouseup",i),document.body.removeEventListener("mousemove",o),n.removeEventListener("touchmove",o),n.removeEventListener("touchend",i),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistence&&s.table.modExists("persistence",!0)&&s.table.modules.persistence.config.columns&&s.table.modules.persistence.save("columns"),s.table.options.columnResized.call(s.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!0),s.startX=void 0===e.screenX?e.touches[0].screenX:e.screenX,s.startWidth=t.getWidth(),document.body.addEventListener("mousemove",o),document.body.addEventListener("mouseup",i),n.addEventListener("touchmove",o,{passive:!0}),n.addEventListener("touchend",i)},Tabulator.prototype.registerModule("resizeColumns",ResizeColumns); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var ResizeRows = function ResizeRows(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var ResizeRows=function(e){this.table=e,this.startColumn=!1,this.startY=!1,this.startHeight=!1,this.handle=null,this.prevHandle=null};ResizeRows.prototype.initializeRow=function(e){var t=this,o=e.getElement(),s=document.createElement("div");s.className="tabulator-row-resize-handle";var n=document.createElement("div");n.className="tabulator-row-resize-handle prev",s.addEventListener("click",function(e){e.stopPropagation()});var a=function(o){t.startRow=e,t._mouseDown(o,e,s)};s.addEventListener("mousedown",a),s.addEventListener("touchstart",a,{passive:!0}),n.addEventListener("click",function(e){e.stopPropagation()});var r=function(o){var s=t.table.rowManager.prevDisplayRow(e);s&&(t.startRow=s,t._mouseDown(o,s,n))};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r,{passive:!0}),o.appendChild(s),o.appendChild(n)},ResizeRows.prototype._mouseDown=function(e,t,o){function s(e){t.setHeight(a.startHeight+((void 0===e.screenY?e.touches[0].screenY:e.screenY)-a.startY))}function n(e){document.body.removeEventListener("mouseup",s),document.body.removeEventListener("mousemove",s),o.removeEventListener("touchmove",s),o.removeEventListener("touchend",n),a.table.element.classList.remove("tabulator-block-select"),a.table.options.rowResized.call(this.table,t.getComponent())}var a=this;a.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),a.startY=void 0===e.screenY?e.touches[0].screenY:e.screenY,a.startHeight=t.getHeight(),document.body.addEventListener("mousemove",s),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",s,{passive:!0}),o.addEventListener("touchend",n)},Tabulator.prototype.registerModule("resizeRows",ResizeRows); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var ResizeTable = function ResizeTable(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var ResizeTable=function(e){this.table=e,this.binding=!1,this.observer=!1,this.containerObserver=!1,this.tableHeight=0,this.tableWidth=0,this.containerHeight=0,this.containerWidth=0,this.autoResize=!1};ResizeTable.prototype.initialize=function(e){var t,i=this,n=this.table;this.tableHeight=n.element.clientHeight,this.tableWidth=n.element.clientWidth,n.element.parentNode&&(this.containerHeight=n.element.parentNode.clientHeight,this.containerWidth=n.element.parentNode.clientWidth),"undefined"!=typeof ResizeObserver&&"virtual"===n.rowManager.getRenderMode()?(this.autoResize=!0,this.observer=new ResizeObserver(function(e){if(!n.browserMobile||n.browserMobile&&!n.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),r=Math.floor(e[0].contentRect.width);i.tableHeight==t&&i.tableWidth==r||(i.tableHeight=t,i.tableWidth=r,n.element.parentNode&&(i.containerHeight=n.element.parentNode.clientHeight,i.containerWidth=n.element.parentNode.clientWidth),n.redraw())}}),this.observer.observe(n.element),t=window.getComputedStyle(n.element),this.table.element.parentNode&&!this.table.rowManager.fixedHeight&&(t.getPropertyValue("max-height")||t.getPropertyValue("min-height"))&&(this.containerObserver=new ResizeObserver(function(e){if(!n.browserMobile||n.browserMobile&&!n.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),r=Math.floor(e[0].contentRect.width);i.containerHeight==t&&i.containerWidth==r||(i.containerHeight=t,i.containerWidth=r,i.tableHeight=n.element.clientHeight,i.tableWidth=n.element.clientWidth,n.redraw()),n.redraw()}}),this.containerObserver.observe(this.table.element.parentNode))):(this.binding=function(){(!n.browserMobile||n.browserMobile&&!n.modules.edit.currentCell)&&n.redraw()},window.addEventListener("resize",this.binding))},ResizeTable.prototype.clearBindings=function(e){this.binding&&window.removeEventListener("resize",this.binding),this.observer&&this.observer.unobserve(this.table.element),this.containerObserver&&this.containerObserver.unobserve(this.table.element.parentNode)},Tabulator.prototype.registerModule("resizeTable",ResizeTable); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var ResponsiveLayout = function ResponsiveLayout(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var ResponsiveLayout=function(e){this.table=e,this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0,this.collapseHandleColumn=!1};ResponsiveLayout.prototype.initialize=function(){var e=this,t=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.table.columnManager.columnsByIndex.forEach(function(o,n){o.modules.responsive&&o.modules.responsive.order&&o.modules.responsive.visible&&(o.modules.responsive.index=n,t.push(o),o.visible||"collapse"!==e.mode||e.hiddenColumns.push(o))}),t=t.reverse(),t=t.sort(function(e,t){return t.modules.responsive.order-e.modules.responsive.order||t.modules.responsive.index-e.modules.responsive.index}),this.columns=t,"collapse"===this.mode&&this.generateCollapsedContent();for(var o=this.table.columnManager.columnsByIndex,n=Array.isArray(o),s=0,o=n?o:o[Symbol.iterator]();;){var i;if(n){if(s>=o.length)break;i=o[s++]}else{if(s=o.next(),s.done)break;i=s.value}var l=i;if("responsiveCollapse"==l.definition.formatter){this.collapseHandleColumn=l;break}}this.collapseHandleColumn&&(this.hiddenColumns.length?this.collapseHandleColumn.show():this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.initializeColumn=function(e){var t=e.getDefinition();e.modules.responsive={order:void 0===t.responsive?1:t.responsive,visible:!1!==t.visible}},ResponsiveLayout.prototype.initializeRow=function(e){var t;"calc"!==e.type&&(t=document.createElement("div"),t.classList.add("tabulator-responsive-collapse"),e.modules.responsiveLayout={element:t,open:this.collapseStartOpen},this.collapseStartOpen||(t.style.display="none"))},ResponsiveLayout.prototype.layoutRow=function(e){var t=e.getElement();e.modules.responsiveLayout&&(t.appendChild(e.modules.responsiveLayout.element),this.generateCollapsedRowContent(e))},ResponsiveLayout.prototype.updateColumnVisibility=function(e,t){e.modules.responsive&&(e.modules.responsive.visible=t,this.initialize())},ResponsiveLayout.prototype.hideColumn=function(e){var t=this.hiddenColumns.length;e.hide(!1,!0),"collapse"===this.mode&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent(),this.collapseHandleColumn&&!t&&this.collapseHandleColumn.show())},ResponsiveLayout.prototype.showColumn=function(e){var t;e.show(!1,!0),e.setWidth(e.getWidth()),"collapse"===this.mode&&(t=this.hiddenColumns.indexOf(e),t>-1&&this.hiddenColumns.splice(t,1),this.generateCollapsedContent(),this.collapseHandleColumn&&!this.hiddenColumns.length&&this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.update=function(){for(var e=this,t=!0;t;){var o="fitColumns"==e.table.modules.layout.getMode()?e.table.columnManager.getFlexBaseWidth():e.table.columnManager.getWidth(),n=(e.table.options.headerVisible?e.table.columnManager.element.clientWidth:e.table.element.clientWidth)-o;if(n<0){var s=e.columns[e.index];s?(e.hideColumn(s),e.index++):t=!1}else{var i=e.columns[e.index-1];i&&n>0&&n>=i.getWidth()?(e.showColumn(i),e.index--):t=!1}e.table.rowManager.activeRowsCount||e.table.rowManager.renderEmptyScroll()}},ResponsiveLayout.prototype.generateCollapsedContent=function(){var e=this;this.table.rowManager.getDisplayRows().forEach(function(t){e.generateCollapsedRowContent(t)})},ResponsiveLayout.prototype.generateCollapsedRowContent=function(e){var t,o;if(e.modules.responsiveLayout){for(t=e.modules.responsiveLayout.element;t.firstChild;)t.removeChild(t.firstChild);o=this.collapseFormatter(this.generateCollapsedRowData(e)),o&&t.appendChild(o)}},ResponsiveLayout.prototype.generateCollapsedRowData=function(e){var t,o=this,n=e.getData(),s=[];return this.hiddenColumns.forEach(function(i){var l=i.getFieldValue(n);i.definition.title&&i.field&&(i.modules.format&&o.table.options.responsiveLayoutCollapseUseFormatters?(t={value:!1,data:{},getValue:function(){return l},getData:function(){return n},getElement:function(){return document.createElement("div")},getRow:function(){return e.getComponent()},getColumn:function(){return i.getComponent()}},s.push({title:i.definition.title,value:i.modules.format.formatter.call(o.table.modules.format,t,i.modules.format.params)})):s.push({title:i.definition.title,value:l}))}),s},ResponsiveLayout.prototype.formatCollapsedData=function(e){var t=document.createElement("table"),o="";return e.forEach(function(e){var t=document.createElement("div");e.value instanceof Node&&(t.appendChild(e.value),e.value=t.innerHTML),o+="<tr><td><strong>"+e.title+"</strong></td><td>"+e.value+"</td></tr>"}),t.innerHTML=o,Object.keys(e).length?t:""},Tabulator.prototype.registerModule("responsiveLayout",ResponsiveLayout); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var SelectRow = function SelectRow(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},SelectRow=function(e){this.table=e,this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],this.headerCheckboxElement=null};SelectRow.prototype.clearSelectionData=function(e){this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],e||this._rowSelectionChanged()},SelectRow.prototype.initializeRow=function(e){var t=this,o=e.getElement(),l=function e(){setTimeout(function(){t.selecting=!1},50),document.body.removeEventListener("mouseup",e)};e.modules.select={selected:!1},t.table.options.selectableCheck.call(this.table,e.getComponent())?(o.classList.add("tabulator-selectable"),o.classList.remove("tabulator-unselectable"),t.table.options.selectable&&"highlight"!=t.table.options.selectable&&("click"===t.table.options.selectableRangeMode?o.addEventListener("click",function(o){if(o.shiftKey){t.table._clearSelection(),t.lastClickedRow=t.lastClickedRow||e;var l=t.table.rowManager.getDisplayRowIndex(t.lastClickedRow),s=t.table.rowManager.getDisplayRowIndex(e),c=l<=s?l:s,i=l>=s?l:s,n=t.table.rowManager.getDisplayRows().slice(0),a=n.splice(c,i-c+1);o.ctrlKey||o.metaKey?(a.forEach(function(o){o!==t.lastClickedRow&&(!0===t.table.options.selectable||t.isRowSelected(e)?t.toggleRow(o):t.selectedRows.length<t.table.options.selectable&&t.toggleRow(o))}),t.lastClickedRow=e):(t.deselectRows(void 0,!0),!0!==t.table.options.selectable&&a.length>t.table.options.selectable&&(a=a.slice(0,t.table.options.selectable)),t.selectRows(a)),t.table._clearSelection()}else o.ctrlKey||o.metaKey?(t.toggleRow(e),t.lastClickedRow=e):(t.deselectRows(void 0,!0),t.selectRows(e),t.lastClickedRow=e)}):(o.addEventListener("click",function(o){t.table.modExists("edit")&&t.table.modules.edit.getCurrentCell()||t.table._clearSelection(),t.selecting||t.toggleRow(e)}),o.addEventListener("mousedown",function(o){if(o.shiftKey)return t.table._clearSelection(),t.selecting=!0,t.selectPrev=[],document.body.addEventListener("mouseup",l),document.body.addEventListener("keyup",l),t.toggleRow(e),!1}),o.addEventListener("mouseenter",function(o){t.selecting&&(t.table._clearSelection(),t.toggleRow(e),t.selectPrev[1]==e&&t.toggleRow(t.selectPrev[0]))}),o.addEventListener("mouseout",function(o){t.selecting&&(t.table._clearSelection(),t.selectPrev.unshift(e))})))):(o.classList.add("tabulator-unselectable"),o.classList.remove("tabulator-selectable"))},SelectRow.prototype.toggleRow=function(e){this.table.options.selectableCheck.call(this.table,e.getComponent())&&(e.modules.select&&e.modules.select.selected?this._deselectRow(e):this._selectRow(e))},SelectRow.prototype.selectRows=function(e){var t,o=this;switch(void 0===e?"undefined":_typeof(e)){case"undefined":this.table.rowManager.rows.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;case"string":t=this.table.rowManager.findRow(e),t?this._selectRow(t,!0,!0):this.table.rowManager.getRows(e).forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;default:Array.isArray(e)?(e.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged()):this._selectRow(e,!1,!0)}},SelectRow.prototype._selectRow=function(e,t,o){if(!isNaN(this.table.options.selectable)&&!0!==this.table.options.selectable&&!o&&this.selectedRows.length>=this.table.options.selectable){if(!this.table.options.selectableRollingSelection)return!1;this._deselectRow(this.selectedRows[0])}var l=this.table.rowManager.findRow(e);l?-1==this.selectedRows.indexOf(l)&&(l.modules.select||(l.modules.select={}),l.modules.select.selected=!0,l.modules.select.checkboxEl&&(l.modules.select.checkboxEl.checked=!0),l.getElement().classList.add("tabulator-selected"),this.selectedRows.push(l),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(l,!0),t||this.table.options.rowSelected.call(this.table,l.getComponent()),this._rowSelectionChanged(t)):t||console.warn("Selection Error - No such row found, ignoring selection:"+e)},SelectRow.prototype.isRowSelected=function(e){return-1!==this.selectedRows.indexOf(e)},SelectRow.prototype.deselectRows=function(e,t){var o,l=this;if(void 0===e){o=l.selectedRows.length;for(var s=0;s<o;s++)l._deselectRow(l.selectedRows[0],!0);l._rowSelectionChanged(t)}else Array.isArray(e)?(e.forEach(function(e){l._deselectRow(e,!0)}),l._rowSelectionChanged(t)):l._deselectRow(e,t)},SelectRow.prototype._deselectRow=function(e,t){var o,l=this,s=l.table.rowManager.findRow(e);s?(o=l.selectedRows.findIndex(function(e){return e==s}))>-1&&(s.modules.select||(s.modules.select={}),s.modules.select.selected=!1,s.modules.select.checkboxEl&&(s.modules.select.checkboxEl.checked=!1),s.getElement().classList.remove("tabulator-selected"),l.selectedRows.splice(o,1),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(s,!1),t||l.table.options.rowDeselected.call(this.table,s.getComponent()),l._rowSelectionChanged(t)):t||console.warn("Deselection Error - No such row found, ignoring selection:"+e)},SelectRow.prototype.getSelectedData=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getData())}),e},SelectRow.prototype.getSelectedRows=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getComponent())}),e},SelectRow.prototype._rowSelectionChanged=function(e){this.headerCheckboxElement&&(0===this.selectedRows.length?(this.headerCheckboxElement.checked=!1,this.headerCheckboxElement.indeterminate=!1):this.table.rowManager.rows.length===this.selectedRows.length?(this.headerCheckboxElement.checked=!0,this.headerCheckboxElement.indeterminate=!1):(this.headerCheckboxElement.indeterminate=!0,this.headerCheckboxElement.checked=!1)),e||this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},SelectRow.prototype.registerRowSelectCheckbox=function(e,t){e._row.modules.select||(e._row.modules.select={}),e._row.modules.select.checkboxEl=t},SelectRow.prototype.registerHeaderSelectCheckbox=function(e){this.headerCheckboxElement=e},SelectRow.prototype.childRowSelection=function(e,t){var o=this.table.modules.dataTree.getChildren(e);if(t)for(var l=o,s=Array.isArray(l),c=0,l=s?l:l[Symbol.iterator]();;){var i;if(s){if(c>=l.length)break;i=l[c++]}else{if(c=l.next(),c.done)break;i=c.value}var n=i;this._selectRow(n,!0)}else for(var a=o,r=Array.isArray(a),d=0,a=r?a:a[Symbol.iterator]();;){var h;if(r){if(d>=a.length)break;h=a[d++]}else{if(d=a.next(),d.done)break;h=d.value}var w=h;this._deselectRow(w,!0)}},Tabulator.prototype.registerModule("selectRow",SelectRow); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -220,7 +220,6 @@ var Sort = function Sort(table) { | ||
var self = this, | ||
lastSort, | ||
sortList; | ||
sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList, | ||
sortListActual = [], | ||
lastSort; | ||
sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList; | ||
if (self.table.options.dataSorting) { | ||
@@ -234,12 +233,16 @@ self.table.options.dataSorting.call(self.table, self.getSort()); | ||
//build list of valid sorters and trigger column specific callbacks before sort begins | ||
sortList.forEach(function (item, i) { | ||
var sortObj = item.column.modules.sort; | ||
if (item.column && item.column.modules.sort) { | ||
if (item.column && sortObj) { | ||
//if no sorter has been defined, take a guess | ||
if (!item.column.modules.sort.sorter) { | ||
item.column.modules.sort.sorter = self.findSorter(item.column); | ||
if (!sortObj.sorter) { | ||
sortObj.sorter = self.findSorter(item.column); | ||
} | ||
self._sortItem(data, item.column, item.dir, sortList, i); | ||
item.params = typeof sortObj.params === "function" ? sortObj.params(item.column.getComponent(), item.dir) : sortObj.params; | ||
sortListActual.push(item); | ||
} | ||
@@ -249,2 +252,7 @@ | ||
}); | ||
//sort data | ||
if (sortListActual.length) { | ||
self._sortItems(data, sortListActual); | ||
} | ||
} else { | ||
@@ -278,19 +286,17 @@ sortList.forEach(function (item, i) { | ||
//sort each item in sort list | ||
Sort.prototype._sortItem = function (data, column, dir, sortList, i) { | ||
var self = this; | ||
Sort.prototype._sortItems = function (data, sortList) { | ||
var _this = this; | ||
var params = typeof column.modules.sort.params === "function" ? column.modules.sort.params(column.getComponent(), dir) : column.modules.sort.params; | ||
var sorterCount = sortList.length - 1; | ||
data.sort(function (a, b) { | ||
var result; | ||
var result = self._sortRow(a, b, column, dir, params); | ||
for (var i = sorterCount; i >= 0; i--) { | ||
var sortItem = sortList[i]; | ||
//if results match recurse through previous searchs to be sure | ||
if (result === 0 && i) { | ||
for (var j = i - 1; j >= 0; j--) { | ||
result = self._sortRow(a, b, sortList[j].column, sortList[j].dir, params); | ||
result = _this._sortRow(a, b, sortItem.column, sortItem.dir, sortItem.params); | ||
if (result !== 0) { | ||
break; | ||
} | ||
if (result !== 0) { | ||
break; | ||
} | ||
@@ -297,0 +303,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sort=function(t){this.table=t,this.sortList=[],this.changed=!1};Sort.prototype.initializeColumn=function(t,e){var o,r,n=this,i=!1;switch(_typeof(t.definition.sorter)){case"string":n.sorters[t.definition.sorter]?i=n.sorters[t.definition.sorter]:console.warn("Sort Error - No such sorter found: ",t.definition.sorter);break;case"function":i=t.definition.sorter}t.modules.sort={sorter:i,dir:"none",params:t.definition.sorterParams||{},startingDir:t.definition.headerSortStartingDir||"asc",tristate:void 0!==t.definition.headerSortTristate?t.definition.headerSortTristate:this.table.options.headerSortTristate},(void 0===t.definition.headerSort?!1!==this.table.options.headerSort:!1!==t.definition.headerSort)&&(o=t.getElement(),o.classList.add("tabulator-sortable"),r=document.createElement("div"),r.classList.add("tabulator-arrow"),e.appendChild(r),o.addEventListener("click",function(e){var o="",r=[],i=!1;if(t.modules.sort){if(t.modules.sort.tristate)o="none"==t.modules.sort.dir?t.modules.sort.startingDir:t.modules.sort.dir==t.modules.sort.startingDir?"asc"==t.modules.sort.dir?"desc":"asc":"none";else switch(t.modules.sort.dir){case"asc":o="desc";break;case"desc":o="asc";break;default:o=t.modules.sort.startingDir}n.table.options.columnHeaderSortMulti&&(e.shiftKey||e.ctrlKey)?(r=n.getSort(),i=r.findIndex(function(e){return e.field===t.getField()}),i>-1?(r[i].dir=o,i!=r.length-1&&(i=r.splice(i,1)[0],"none"!=o&&r.push(i))):"none"!=o&&r.push({column:t,dir:o}),n.setSort(r)):"none"==o?n.clear():n.setSort(t,o),n.table.rowManager.sorterRefresh(!n.sortList.length)}}))},Sort.prototype.hasChanged=function(){var t=this.changed;return this.changed=!1,t},Sort.prototype.getSort=function(){var t=this,e=[];return t.sortList.forEach(function(t){t.column&&e.push({column:t.column.getComponent(),field:t.column.getField(),dir:t.dir})}),e},Sort.prototype.setSort=function(t,e){var o=this,r=[];Array.isArray(t)||(t=[{column:t,dir:e}]),t.forEach(function(t){var e;e=o.table.columnManager.findColumn(t.column),e?(t.column=e,r.push(t),o.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",t.column)}),o.sortList=r,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.sort&&this.table.modules.persistence.save("sort")},Sort.prototype.clear=function(){this.setSort([])},Sort.prototype.findSorter=function(t){var e,o=this.table.rowManager.activeRows[0],r="string";if(o&&(o=o.getData(),t.getField()))switch(e=t.getFieldValue(o),void 0===e?"undefined":_typeof(e)){case"undefined":r="string";break;case"boolean":r="boolean";break;default:isNaN(e)||""===e?e.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(r="alphanum"):r="number"}return this.sorters[r]},Sort.prototype.sort=function(t){var e,o=this;e=this.table.options.sortOrderReverse?o.sortList.slice().reverse():o.sortList,o.table.options.dataSorting&&o.table.options.dataSorting.call(o.table,o.getSort()),o.clearColumnHeaders(),o.table.options.ajaxSorting?e.forEach(function(t,e){o.setColumnHeader(t.column,t.dir)}):e.forEach(function(r,n){r.column&&r.column.modules.sort&&(r.column.modules.sort.sorter||(r.column.modules.sort.sorter=o.findSorter(r.column)),o._sortItem(t,r.column,r.dir,e,n)),o.setColumnHeader(r.column,r.dir)}),o.table.options.dataSorted&&o.table.options.dataSorted.call(o.table,o.getSort(),o.table.rowManager.getComponents("active"))},Sort.prototype.clearColumnHeaders=function(){this.table.columnManager.getRealColumns().forEach(function(t){t.modules.sort&&(t.modules.sort.dir="none",t.getElement().setAttribute("aria-sort","none"))})},Sort.prototype.setColumnHeader=function(t,e){t.modules.sort.dir=e,t.getElement().setAttribute("aria-sort",e)},Sort.prototype._sortItem=function(t,e,o,r,n){var i=this,s="function"==typeof e.modules.sort.params?e.modules.sort.params(e.getComponent(),o):e.modules.sort.params;t.sort(function(t,a){var l=i._sortRow(t,a,e,o,s);if(0===l&&n)for(var u=n-1;u>=0&&0===(l=i._sortRow(t,a,r[u].column,r[u].dir,s));u--);return l})},Sort.prototype._sortRow=function(t,e,o,r,n){var i,s,a="asc"==r?t:e,l="asc"==r?e:t;return t=o.getFieldValue(a.getData()),e=o.getFieldValue(l.getData()),t=void 0!==t?t:"",e=void 0!==e?e:"",i=a.getComponent(),s=l.getComponent(),o.modules.sort.sorter.call(this,t,e,i,s,o.getComponent(),r,n)},Sort.prototype.sorters={number:function(t,e,o,r,n,i,s){var a=s.alignEmptyValues,l=s.decimalSeparator||".",u=s.thousandSeparator||",",c=0;if(t=parseFloat(String(t).split(u).join("").split(l).join(".")),e=parseFloat(String(e).split(u).join("").split(l).join(".")),isNaN(t))c=isNaN(e)?0:-1;else{if(!isNaN(e))return t-e;c=1}return("top"===a&&"desc"===i||"bottom"===a&&"asc"===i)&&(c*=-1),c},string:function(t,e,o,r,n,i,s){var a,l=s.alignEmptyValues,u=0;if(t){if(e){switch(_typeof(s.locale)){case"boolean":s.locale&&(a=this.table.modules.localize.getLocale());break;case"string":a=s.locale}return String(t).toLowerCase().localeCompare(String(e).toLowerCase(),a)}u=1}else u=e?-1:0;return("top"===l&&"desc"===i||"bottom"===l&&"asc"===i)&&(u*=-1),u},date:function(t,e,o,r,n,i,s){return s.format||(s.format="DD/MM/YYYY"),this.sorters.datetime.call(this,t,e,o,r,n,i,s)},time:function(t,e,o,r,n,i,s){return s.format||(s.format="hh:mm"),this.sorters.datetime.call(this,t,e,o,r,n,i,s)},datetime:function(t,e,o,r,n,i,s){var a=s.format||"DD/MM/YYYY hh:mm:ss",l=s.alignEmptyValues,u=0;if("undefined"!=typeof moment){if(t=moment(t,a),e=moment(e,a),t.isValid()){if(e.isValid())return t-e;u=1}else u=e.isValid()?-1:0;return("top"===l&&"desc"===i||"bottom"===l&&"asc"===i)&&(u*=-1),u}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function(t,e,o,r,n,i,s){return(!0===t||"true"===t||"True"===t||1===t?1:0)-(!0===e||"true"===e||"True"===e||1===e?1:0)},array:function(t,e,o,r,n,i,s){function a(t){switch(c){case"length":return t.length;case"sum":return t.reduce(function(t,e){return t+e});case"max":return Math.max.apply(null,t);case"min":return Math.min.apply(null,t);case"avg":return t.reduce(function(t,e){return t+e})/t.length}}var l=0,u=0,c=s.type||"length",d=s.alignEmptyValues,m=0;if(Array.isArray(t)){if(Array.isArray(e))return l=t?a(t):0,u=e?a(e):0,l-u;d=1}else d=Array.isArray(e)?-1:0;return("top"===d&&"desc"===i||"bottom"===d&&"asc"===i)&&(m*=-1),m},exists:function(t,e,o,r,n,i,s){return(void 0===t?0:1)-(void 0===e?0:1)},alphanum:function(t,e,o,r,n,i,s){var a,l,u,c,d,m=0,f=/(\d+)|(\D+)/g,p=/\d/,h=s.alignEmptyValues,g=0;if(t||0===t){if(e||0===e){if(isFinite(t)&&isFinite(e))return t-e;if(a=String(t).toLowerCase(),l=String(e).toLowerCase(),a===l)return 0;if(!p.test(a)||!p.test(l))return a>l?1:-1;for(a=a.match(f),l=l.match(f),d=a.length>l.length?l.length:a.length;m<d;)if(u=a[m],c=l[m++],u!==c)return isFinite(u)&&isFinite(c)?("0"===u.charAt(0)&&(u="."+u),"0"===c.charAt(0)&&(c="."+c),u-c):u>c?1:-1;return a.length>l.length}g=1}else g=e||0===e?-1:0;return("top"===h&&"desc"===i||"bottom"===h&&"asc"===i)&&(g*=-1),g}},Tabulator.prototype.registerModule("sort",Sort); | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sort=function(t){this.table=t,this.sortList=[],this.changed=!1};Sort.prototype.initializeColumn=function(t,e){var r,o,n=this,i=!1;switch(_typeof(t.definition.sorter)){case"string":n.sorters[t.definition.sorter]?i=n.sorters[t.definition.sorter]:console.warn("Sort Error - No such sorter found: ",t.definition.sorter);break;case"function":i=t.definition.sorter}t.modules.sort={sorter:i,dir:"none",params:t.definition.sorterParams||{},startingDir:t.definition.headerSortStartingDir||"asc",tristate:void 0!==t.definition.headerSortTristate?t.definition.headerSortTristate:this.table.options.headerSortTristate},(void 0===t.definition.headerSort?!1!==this.table.options.headerSort:!1!==t.definition.headerSort)&&(r=t.getElement(),r.classList.add("tabulator-sortable"),o=document.createElement("div"),o.classList.add("tabulator-arrow"),e.appendChild(o),r.addEventListener("click",function(e){var r="",o=[],i=!1;if(t.modules.sort){if(t.modules.sort.tristate)r="none"==t.modules.sort.dir?t.modules.sort.startingDir:t.modules.sort.dir==t.modules.sort.startingDir?"asc"==t.modules.sort.dir?"desc":"asc":"none";else switch(t.modules.sort.dir){case"asc":r="desc";break;case"desc":r="asc";break;default:r=t.modules.sort.startingDir}n.table.options.columnHeaderSortMulti&&(e.shiftKey||e.ctrlKey)?(o=n.getSort(),i=o.findIndex(function(e){return e.field===t.getField()}),i>-1?(o[i].dir=r,i!=o.length-1&&(i=o.splice(i,1)[0],"none"!=r&&o.push(i))):"none"!=r&&o.push({column:t,dir:r}),n.setSort(o)):"none"==r?n.clear():n.setSort(t,r),n.table.rowManager.sorterRefresh(!n.sortList.length)}}))},Sort.prototype.hasChanged=function(){var t=this.changed;return this.changed=!1,t},Sort.prototype.getSort=function(){var t=this,e=[];return t.sortList.forEach(function(t){t.column&&e.push({column:t.column.getComponent(),field:t.column.getField(),dir:t.dir})}),e},Sort.prototype.setSort=function(t,e){var r=this,o=[];Array.isArray(t)||(t=[{column:t,dir:e}]),t.forEach(function(t){var e;e=r.table.columnManager.findColumn(t.column),e?(t.column=e,o.push(t),r.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",t.column)}),r.sortList=o,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.sort&&this.table.modules.persistence.save("sort")},Sort.prototype.clear=function(){this.setSort([])},Sort.prototype.findSorter=function(t){var e,r=this.table.rowManager.activeRows[0],o="string";if(r&&(r=r.getData(),t.getField()))switch(e=t.getFieldValue(r),void 0===e?"undefined":_typeof(e)){case"undefined":o="string";break;case"boolean":o="boolean";break;default:isNaN(e)||""===e?e.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(o="alphanum"):o="number"}return this.sorters[o]},Sort.prototype.sort=function(t){var e=this,r=this.table.options.sortOrderReverse?e.sortList.slice().reverse():e.sortList,o=[];e.table.options.dataSorting&&e.table.options.dataSorting.call(e.table,e.getSort()),e.clearColumnHeaders(),e.table.options.ajaxSorting?r.forEach(function(t,r){e.setColumnHeader(t.column,t.dir)}):(r.forEach(function(t,r){var n=t.column.modules.sort;t.column&&n&&(n.sorter||(n.sorter=e.findSorter(t.column)),t.params="function"==typeof n.params?n.params(t.column.getComponent(),t.dir):n.params,o.push(t)),e.setColumnHeader(t.column,t.dir)}),o.length&&e._sortItems(t,o)),e.table.options.dataSorted&&e.table.options.dataSorted.call(e.table,e.getSort(),e.table.rowManager.getComponents("active"))},Sort.prototype.clearColumnHeaders=function(){this.table.columnManager.getRealColumns().forEach(function(t){t.modules.sort&&(t.modules.sort.dir="none",t.getElement().setAttribute("aria-sort","none"))})},Sort.prototype.setColumnHeader=function(t,e){t.modules.sort.dir=e,t.getElement().setAttribute("aria-sort",e)},Sort.prototype._sortItems=function(t,e){var r=this,o=e.length-1;t.sort(function(t,n){for(var i,s=o;s>=0;s--){var a=e[s];if(0!==(i=r._sortRow(t,n,a.column,a.dir,a.params)))break}return i})},Sort.prototype._sortRow=function(t,e,r,o,n){var i,s,a="asc"==o?t:e,l="asc"==o?e:t;return t=r.getFieldValue(a.getData()),e=r.getFieldValue(l.getData()),t=void 0!==t?t:"",e=void 0!==e?e:"",i=a.getComponent(),s=l.getComponent(),r.modules.sort.sorter.call(this,t,e,i,s,r.getComponent(),o,n)},Sort.prototype.sorters={number:function(t,e,r,o,n,i,s){var a=s.alignEmptyValues,l=s.decimalSeparator||".",u=s.thousandSeparator||",",c=0;if(t=parseFloat(String(t).split(u).join("").split(l).join(".")),e=parseFloat(String(e).split(u).join("").split(l).join(".")),isNaN(t))c=isNaN(e)?0:-1;else{if(!isNaN(e))return t-e;c=1}return("top"===a&&"desc"===i||"bottom"===a&&"asc"===i)&&(c*=-1),c},string:function(t,e,r,o,n,i,s){var a,l=s.alignEmptyValues,u=0;if(t){if(e){switch(_typeof(s.locale)){case"boolean":s.locale&&(a=this.table.modules.localize.getLocale());break;case"string":a=s.locale}return String(t).toLowerCase().localeCompare(String(e).toLowerCase(),a)}u=1}else u=e?-1:0;return("top"===l&&"desc"===i||"bottom"===l&&"asc"===i)&&(u*=-1),u},date:function(t,e,r,o,n,i,s){return s.format||(s.format="DD/MM/YYYY"),this.sorters.datetime.call(this,t,e,r,o,n,i,s)},time:function(t,e,r,o,n,i,s){return s.format||(s.format="hh:mm"),this.sorters.datetime.call(this,t,e,r,o,n,i,s)},datetime:function(t,e,r,o,n,i,s){var a=s.format||"DD/MM/YYYY hh:mm:ss",l=s.alignEmptyValues,u=0;if("undefined"!=typeof moment){if(t=moment(t,a),e=moment(e,a),t.isValid()){if(e.isValid())return t-e;u=1}else u=e.isValid()?-1:0;return("top"===l&&"desc"===i||"bottom"===l&&"asc"===i)&&(u*=-1),u}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function(t,e,r,o,n,i,s){return(!0===t||"true"===t||"True"===t||1===t?1:0)-(!0===e||"true"===e||"True"===e||1===e?1:0)},array:function(t,e,r,o,n,i,s){function a(t){switch(c){case"length":return t.length;case"sum":return t.reduce(function(t,e){return t+e});case"max":return Math.max.apply(null,t);case"min":return Math.min.apply(null,t);case"avg":return t.reduce(function(t,e){return t+e})/t.length}}var l=0,u=0,c=s.type||"length",d=s.alignEmptyValues,m=0;if(Array.isArray(t)){if(Array.isArray(e))return l=t?a(t):0,u=e?a(e):0,l-u;d=1}else d=Array.isArray(e)?-1:0;return("top"===d&&"desc"===i||"bottom"===d&&"asc"===i)&&(m*=-1),m},exists:function(t,e,r,o,n,i,s){return(void 0===t?0:1)-(void 0===e?0:1)},alphanum:function(t,e,r,o,n,i,s){var a,l,u,c,d,m=0,f=/(\d+)|(\D+)/g,p=/\d/,h=s.alignEmptyValues,g=0;if(t||0===t){if(e||0===e){if(isFinite(t)&&isFinite(e))return t-e;if(a=String(t).toLowerCase(),l=String(e).toLowerCase(),a===l)return 0;if(!p.test(a)||!p.test(l))return a>l?1:-1;for(a=a.match(f),l=l.match(f),d=a.length>l.length?l.length:a.length;m<d;)if(u=a[m],c=l[m++],u!==c)return isFinite(u)&&isFinite(c)?("0"===u.charAt(0)&&(u="."+u),"0"===c.charAt(0)&&(c="."+c),u-c):u>c?1:-1;return a.length>l.length}g=1}else g=e||0===e?-1:0;return("top"===h&&"desc"===i||"bottom"===h&&"asc"===i)&&(g*=-1),g}},Tabulator.prototype.registerModule("sort",Sort); |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Validate = function Validate(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.6.1 (c) Oliver Folkerd */ | ||
/* Tabulator v4.6.2 (c) Oliver Folkerd */ | ||
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Validate=function(t){this.table=t};Validate.prototype.initializeColumn=function(t){var n,i=this,r=[];t.definition.validator&&(Array.isArray(t.definition.validator)?t.definition.validator.forEach(function(t){(n=i._extractValidator(t))&&r.push(n)}):(n=this._extractValidator(t.definition.validator))&&r.push(n),t.modules.validate=!!r.length&&r)},Validate.prototype._extractValidator=function(t){var n,i,r;switch(void 0===t?"undefined":_typeof(t)){case"string":return r=t.indexOf(":"),r>-1?(n=t.substring(0,r),i=t.substring(r+1)):n=t,this._buildValidator(n,i);case"function":return this._buildValidator(t);case"object":return this._buildValidator(t.type,t.parameters)}},Validate.prototype._buildValidator=function(t,n){var i="function"==typeof t?t:this.validators[t];return i?{type:"function"==typeof t?"function":t,func:i,params:n}:(console.warn("Validator Setup Error - No matching validator found:",t),!1)},Validate.prototype.validate=function(t,n,i){var r=this,o=[];return t&&t.forEach(function(t){t.func.call(r,n,i,t.params)||o.push({type:t.type,parameters:t.params})}),!o.length||o},Validate.prototype.validators={integer:function(t,n,i){return""===n||null===n||void 0===n||"number"==typeof(n=Number(n))&&isFinite(n)&&Math.floor(n)===n},float:function(t,n,i){return""===n||null===n||void 0===n||"number"==typeof(n=Number(n))&&isFinite(n)&&n%1!=0},numeric:function(t,n,i){return""===n||null===n||void 0===n||!isNaN(n)},string:function(t,n,i){return""===n||null===n||void 0===n||isNaN(n)},max:function(t,n,i){return""===n||null===n||void 0===n||parseFloat(n)<=i},min:function(t,n,i){return""===n||null===n||void 0===n||parseFloat(n)>=i},minLength:function(t,n,i){return""===n||null===n||void 0===n||String(n).length>=i},maxLength:function(t,n,i){return""===n||null===n||void 0===n||String(n).length<=i},in:function(t,n,i){return""===n||null===n||void 0===n||("string"==typeof i&&(i=i.split("|")),""===n||i.indexOf(n)>-1)},regex:function(t,n,i){return""===n||null===n||void 0===n||new RegExp(i).test(n)},unique:function(t,n,i){if(""===n||null===n||void 0===n)return!0;var r=!0,o=t.getData(),e=t.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(t){var i=t.getData();i!==o&&n==e.getFieldValue(i)&&(r=!1)}),r},required:function(t,n,i){return""!==n&&null!==n&&void 0!==n}},Tabulator.prototype.registerModule("validate",Validate); |
@@ -22,3 +22,3 @@ var gulp = require('gulp'), | ||
var version_no = "4.6.1", | ||
var version_no = "4.6.2", | ||
@@ -25,0 +25,0 @@ version = "/* Tabulator v" + version_no + " (c) Oliver Folkerd */\n"; |
{ | ||
"name": "tabulator-tables", | ||
"version": "4.6.1", | ||
"version": "4.6.2", | ||
"description": "Interactive table generation JavaScript library", | ||
@@ -5,0 +5,0 @@ "main": "dist/js/tabulator.js", |
@@ -62,4 +62,4 @@ ![Tabulator Table](http://olifolkerd.github.io/tabulator/images/tabulator.png) | ||
```html | ||
<link href="https://unpkg.com/tabulator-tables@10/dist/css/tabulator.min.css" rel="stylesheet"> | ||
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.6.1/dist/js/tabulator.min.js"></script> | ||
<link href="https://unpkg.com/tabulator-tables@4.6.2/dist/css/tabulator.min.css" rel="stylesheet"> | ||
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.6.2/dist/js/tabulator.min.js"></script> | ||
``` |
@@ -510,2 +510,4 @@ | ||
this.cellRendered(); | ||
this.table.options.cellEdited.call(this.table, component); | ||
@@ -512,0 +514,0 @@ |
@@ -98,2 +98,3 @@ var Edit = function(table){ | ||
cell.setValueActual(cell.getValue()); | ||
cell.cellRendered(); | ||
@@ -117,3 +118,3 @@ if(cell.column.cellEvents.cellEditCancelled){ | ||
if(!element.classList.contains("tabulator-editing")){ | ||
element.focus(); | ||
element.focus({preventScroll: true}); | ||
} | ||
@@ -136,3 +137,3 @@ }); | ||
if(!(block && this.table.browser === "ie")){ | ||
cell.getElement().focus(); | ||
cell.getElement().focus({preventScroll: true}); | ||
} | ||
@@ -147,2 +148,21 @@ this.recursionBlock = false; | ||
Edit.prototype.focusScrollAdjust = function(cell){ | ||
if(this.table.rowManager.getRenderMode() == "virtual"){ | ||
var topEdge = this.table.rowManager.element.scrollTop, | ||
bottomEdge = this.table.rowManager.element.clientHeight + this.table.rowManager.element.scrollTop, | ||
rowEl = cell.row.getElement(), | ||
offset = rowEl.offsetTop; | ||
if(rowEl.offsetTop < topEdge){ | ||
this.table.rowManager.element.scrollTop -= (topEdge - rowEl.offsetTop); | ||
}else{ | ||
if(rowEl.offsetTop + rowEl.offsetHeight > bottomEdge){ | ||
this.table.rowManager.element.scrollTop += (rowEl.offsetTop + rowEl.offsetHeight - bottomEdge); | ||
} | ||
} | ||
} | ||
}; | ||
Edit.prototype.edit = function(cell, e, forceEdit){ | ||
@@ -233,2 +253,4 @@ var self = this, | ||
this.focusScrollAdjust(cell); | ||
component = cell.getComponent(); | ||
@@ -410,3 +432,3 @@ | ||
onRendered(function(){ | ||
input.focus(); | ||
input.focus({preventScroll: true}); | ||
input.style.height = "100%"; | ||
@@ -417,3 +439,2 @@ }); | ||
if(((cellValue === null || typeof cellValue === "undefined") && input.value !== "") || input.value !== cellValue){ | ||
if(success(input.value)){ | ||
@@ -485,3 +506,3 @@ cellValue = input.value; //persist value if successfully validated incase editor is used as header filter | ||
onRendered(function(){ | ||
input.focus(); | ||
input.focus({preventScroll: true}); | ||
input.style.height = "100%"; | ||
@@ -602,3 +623,3 @@ }); | ||
input.focus(); | ||
input.focus({preventScroll: true}); | ||
input.style.height = "100%"; | ||
@@ -694,3 +715,3 @@ | ||
onRendered(function () { | ||
input.focus(); | ||
input.focus({preventScroll: true}); | ||
input.style.height = "100%"; | ||
@@ -977,2 +998,12 @@ }); | ||
listEl.style.left = offset.left + "px"; | ||
listEl.addEventListener("mousedown", function(e){ | ||
blurable = false; | ||
setTimeout(function(){ | ||
blurable = true; | ||
}, 10); | ||
}); | ||
document.body.appendChild(listEl); | ||
@@ -1094,3 +1125,3 @@ } | ||
input.style.height = "100%"; | ||
input.focus(); | ||
input.focus({preventScroll: true}); | ||
}); | ||
@@ -1140,2 +1171,10 @@ | ||
listEl.addEventListener("mousedown", function(e){ | ||
blurable = false; | ||
setTimeout(function(){ | ||
blurable = true; | ||
}, 10); | ||
}); | ||
function getUniqueColumnValues(field){ | ||
@@ -1303,3 +1342,3 @@ var output = {}, | ||
el.addEventListener("click", function(){ | ||
el.addEventListener("click", function(e){ | ||
setCurrentItem(item); | ||
@@ -1309,3 +1348,3 @@ chooseItem(); | ||
el.addEventListener("mousedown", function(){ | ||
el.addEventListener("mousedown", function(e){ | ||
blurable = false; | ||
@@ -1512,3 +1551,3 @@ | ||
input.style.height = "100%"; | ||
input.focus(); | ||
input.focus({preventScroll: true}); | ||
}); | ||
@@ -1767,2 +1806,3 @@ | ||
case 39: //right arrow | ||
e.preventDefault(); | ||
bar.style.width = (bar.clientWidth + element.clientWidth/100) + "px"; | ||
@@ -1772,5 +1812,7 @@ break; | ||
case 37: //left arrow | ||
e.preventDefault(); | ||
bar.style.width = (bar.clientWidth - element.clientWidth/100) + "px"; | ||
break; | ||
case 9: //tab | ||
case 13: //enter | ||
@@ -1826,3 +1868,3 @@ updateValue(); | ||
onRendered(function(){ | ||
input.focus(); | ||
input.focus({preventScroll: true}); | ||
}); | ||
@@ -1829,0 +1871,0 @@ } |
@@ -61,3 +61,3 @@ var Menu = function(table){ | ||
var docHeight = document.body.offsetHeight; | ||
var docHeight = Math.max(document.body.offsetHeight, window.innerHeight); | ||
@@ -64,0 +64,0 @@ //abort if no menu set |
@@ -19,2 +19,5 @@ var Page = function(table){ | ||
this.dataReceivedNames = {}; | ||
this.dataSentNames = {}; | ||
this.createElements(); | ||
@@ -103,12 +106,10 @@ }; | ||
var self = this, | ||
pageSelectLabel; | ||
pageSelectLabel, testElRow, testElCell; | ||
//update param names | ||
for(let key in self.table.options.paginationDataSent){ | ||
self.paginationDataSentNames[key] = self.table.options.paginationDataSent[key]; | ||
} | ||
this.dataSentNames = Object.assign({}, this.paginationDataSentNames); | ||
this.dataSentNames = Object.assign(this.dataSentNames, this.table.options.paginationDataSent); | ||
for(let key in self.table.options.paginationDataReceived){ | ||
self.paginationDataReceivedNames[key] = self.table.options.paginationDataReceived[key]; | ||
} | ||
this.dataReceivedNames = Object.assign({}, this.paginationDataReceivedNames); | ||
this.dataReceivedNames = Object.assign(this.dataReceivedNames, this.table.options.paginationDataReceived); | ||
@@ -207,3 +208,22 @@ //build pagination element | ||
self.size = self.table.options.paginationSize || Math.floor(self.table.rowManager.getElement().clientHeight / 24); | ||
if(self.table.options.paginationSize){ | ||
self.size = self.table.options.paginationSize; | ||
}else{ | ||
testElRow = document.createElement("div"); | ||
testElRow.classList.add("tabulator-row"); | ||
testElRow.style.visibility = hidden; | ||
testElCell = document.createElement("div"); | ||
testElCell.classList.add("tabulator-cell"); | ||
testElCell.innerHTML = "Page Row Test"; | ||
testElRow.appendChild(testElCell); | ||
self.table.rowManager.getTableElement().appendChild(testElRow); | ||
self.size = Math.floor(self.table.rowManager.getElement().clientHeight / testElRow.offsetHeight); | ||
self.table.rowManager.getTableElement().removeChild(testElRow); | ||
} | ||
// self.page = self.table.options.paginationInitialPage || 1; | ||
@@ -546,7 +566,7 @@ self.count = self.table.options.paginationButtonCount; | ||
//configure request params | ||
pageParams[this.paginationDataSentNames.page] = self.page; | ||
pageParams[this.dataSentNames.page] = self.page; | ||
//set page size if defined | ||
if(this.size){ | ||
pageParams[this.paginationDataSentNames.size] = this.size; | ||
pageParams[this.dataSentNames.size] = this.size; | ||
} | ||
@@ -562,3 +582,3 @@ | ||
pageParams[this.paginationDataSentNames.sorters] = sorters; | ||
pageParams[this.dataSentNames.sorters] = sorters; | ||
} | ||
@@ -569,3 +589,3 @@ | ||
let filters = self.table.modules.filter.getFilters(true, true); | ||
pageParams[this.paginationDataSentNames.filters] = filters; | ||
pageParams[this.dataSentNames.filters] = filters; | ||
} | ||
@@ -592,8 +612,8 @@ | ||
if(typeof data[this.paginationDataReceivedNames.last_page] === "undefined"){ | ||
console.warn("Remote Pagination Error - Server response missing '" + this.paginationDataReceivedNames.last_page + "' property"); | ||
if(typeof data[this.dataReceivedNames.last_page] === "undefined"){ | ||
console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.last_page + "' property"); | ||
} | ||
if(data[this.paginationDataReceivedNames.data]){ | ||
this.max = parseInt(data[this.paginationDataReceivedNames.last_page]) || 1; | ||
if(data[this.dataReceivedNames.data]){ | ||
this.max = parseInt(data[this.dataReceivedNames.last_page]) || 1; | ||
@@ -605,5 +625,5 @@ if(this.progressiveLoad){ | ||
if(this.page == 1){ | ||
this.table.rowManager.setData(data[this.paginationDataReceivedNames.data], false, this.initialLoad && this.page == 1) | ||
this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1) | ||
}else{ | ||
this.table.rowManager.addRows(data[this.paginationDataReceivedNames.data]); | ||
this.table.rowManager.addRows(data[this.dataReceivedNames.data]); | ||
} | ||
@@ -619,3 +639,3 @@ | ||
case "progressive_scroll": | ||
data = this.table.rowManager.getData().concat(data[this.paginationDataReceivedNames.data]); | ||
data = this.table.rowManager.getData().concat(data[this.dataReceivedNames.data]); | ||
@@ -634,3 +654,3 @@ this.table.rowManager.setData(data, true, this.initialLoad && this.page == 1); | ||
this.table.rowManager.setData(data[this.paginationDataReceivedNames.data], false, this.initialLoad && this.page == 1); | ||
this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); | ||
@@ -647,3 +667,3 @@ this.table.rowManager.scrollHorizontal(left); | ||
}else{ | ||
console.warn("Remote Pagination Error - Server response missing '" + this.paginationDataReceivedNames.data + "' property"); | ||
console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.data + "' property"); | ||
} | ||
@@ -650,0 +670,0 @@ |
@@ -219,6 +219,7 @@ var Sort = function(table){ | ||
Sort.prototype.sort = function(data){ | ||
var self = this, lastSort, sortList; | ||
var self = this, | ||
sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList, | ||
sortListActual = [], | ||
lastSort; | ||
sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList; | ||
if(self.table.options.dataSorting){ | ||
@@ -232,12 +233,16 @@ self.table.options.dataSorting.call(self.table, self.getSort()); | ||
//build list of valid sorters and trigger column specific callbacks before sort begins | ||
sortList.forEach(function(item, i){ | ||
var sortObj = item.column.modules.sort; | ||
if(item.column && item.column.modules.sort){ | ||
if(item.column && sortObj){ | ||
//if no sorter has been defined, take a guess | ||
if(!item.column.modules.sort.sorter){ | ||
item.column.modules.sort.sorter = self.findSorter(item.column); | ||
if(!sortObj.sorter){ | ||
sortObj.sorter = self.findSorter(item.column); | ||
} | ||
self._sortItem(data, item.column, item.dir, sortList, i); | ||
item.params = typeof sortObj.params === "function" ? sortObj.params(item.column.getComponent(), item.dir) : sortObj.params; | ||
sortListActual.push(item); | ||
} | ||
@@ -247,2 +252,8 @@ | ||
}); | ||
//sort data | ||
if (sortListActual.length) { | ||
self._sortItems(data, sortListActual); | ||
} | ||
}else{ | ||
@@ -277,19 +288,15 @@ sortList.forEach(function(item, i){ | ||
//sort each item in sort list | ||
Sort.prototype._sortItem = function(data, column, dir, sortList, i){ | ||
var self = this; | ||
Sort.prototype._sortItems = function(data, sortList){ | ||
var sorterCount = sortList.length - 1; | ||
var params = typeof column.modules.sort.params === "function" ? column.modules.sort.params(column.getComponent(), dir) : column.modules.sort.params; | ||
data.sort((a, b) => { | ||
var result; | ||
data.sort(function(a, b){ | ||
for(var i = sorterCount; i>= 0; i--){ | ||
let sortItem = sortList[i]; | ||
var result = self._sortRow(a, b, column, dir, params); | ||
result = this._sortRow(a, b, sortItem.column, sortItem.dir, sortItem.params); | ||
//if results match recurse through previous searchs to be sure | ||
if(result === 0 && i){ | ||
for(var j = i-1; j>= 0; j--){ | ||
result = self._sortRow(a, b, sortList[j].column, sortList[j].dir, params); | ||
if(result !== 0){ | ||
break; | ||
} | ||
if(result !== 0){ | ||
break; | ||
} | ||
@@ -296,0 +303,0 @@ } |
@@ -1527,2 +1527,3 @@ var RowManager = function(table){ | ||
if(topDiff < 0){ | ||
this._addTopRow(-topDiff); | ||
@@ -1536,2 +1537,4 @@ } | ||
this._removeBottomRow(-bottomDiff); | ||
}else{ | ||
this.vDomScrollPosBottom = this.scrollTop; | ||
} | ||
@@ -1545,3 +1548,6 @@ } | ||
if(this.scrollTop > this.vDomWindowBuffer){ | ||
this._removeTopRow(topDiff); | ||
}else{ | ||
this.vDomScrollPosTop = this.scrollTop; | ||
} | ||
@@ -1551,2 +1557,3 @@ } | ||
if(bottomDiff >= 0){ | ||
this._addBottomRow(bottomDiff); | ||
@@ -1553,0 +1560,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3507992
61754