tabulator-tables
Advanced tools
Comparing version 4.2.7 to 4.3.0
{ | ||
"name": "tabulator", | ||
"main": "dist/js/tabulator.js", | ||
"version": "4.2.7", | ||
"version": "4.3.0", | ||
"description": "Interactive table generation JavaScript library", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -19,9 +19,9 @@ /* | ||
if (typeof define === 'function' && define.amd) { | ||
define(['jquery'], factory); | ||
define(['jquery', 'jquery-ui', 'tabulator'], factory); | ||
} else if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = factory(require('jquery')); | ||
module.exports = factory(require('jquery'), require('jquery-ui'), require('tabulator')); | ||
} else { | ||
factory(jQuery); | ||
} | ||
})(function ($, undefined) { | ||
})(function ($, undefined, Tabulator) { | ||
$.widget("ui.tabulator", { | ||
@@ -28,0 +28,0 @@ _create: function _create() { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t,e){t.widget("ui.tabulator",{_create:function(){this.table=new Tabulator(this.element[0],this.options);for(var t in Tabulator.prototype)"function"==typeof Tabulator.prototype[t]&&"_"!==t.charAt(0)&&(this[t]=this.table[t].bind(this.table))},_setOption:function(t,e){console.error("Tabulator jQuery wrapper does not support setting options after the table has been instantiated")},_destroy:function(t,e){this.table.destroy()}})}); | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","jquery-ui","tabulator"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery"),require("jquery-ui"),require("tabulator")):e(jQuery)}(function(e,t,o){e.widget("ui.tabulator",{_create:function(){this.table=new o(this.element[0],this.options);for(var e in o.prototype)"function"==typeof o.prototype[e]&&"_"!==e.charAt(0)&&(this[e]=this.table[e].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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Accessor = function Accessor(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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"]};Accessor.prototype.initializeColumn=function(o){var e=this,s=!1,r={};this.allowedTypes.forEach(function(c){var t,a="accessor"+(c.charAt(0).toUpperCase()+c.slice(1));o.definition[a]&&(t=e.lookupAccessor(o.definition[a]))&&(s=!0,r[a]={accessor:t,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)),c=Tabulator.prototype.helpers.deepClone(o||{});return s.table.columnManager.traverse(function(o){var s,t,a,n;o.modules.accessor&&(t=o.modules.accessor[r]||o.modules.accessor.accessor||!1)&&"undefined"!=(s=o.getFieldValue(c))&&(n=o.getComponent(),a="function"==typeof t.params?t.params(s,c,e,n):t.params,o.setFieldValue(c,t.accessor(s,c,e,a,n)))}),c},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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Ajax = function Ajax(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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){return this.progressiveLoad?this._loadDataProgressive():this._loadDataStandard(e)},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){var t=this;return new Promise(function(o,a){t.sendRequest(e).then(function(r){t.table.rowManager.setData(r,e).then(function(){o()}).catch(function(e){a(e)})}).catch(function(e){a(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)):console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made"),a.hideLoader(),a.loading=!1}).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+="?"+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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -147,2 +147,6 @@ var ColumnCalcs = function ColumnCalcs(table) { | ||
if (this.topInitialized) { | ||
if (this.topRow) { | ||
this.topRow.deleteCells(); | ||
} | ||
row = this.generateRow("top", this.rowsToData(rows)); | ||
@@ -157,2 +161,6 @@ this.topRow = row; | ||
if (this.botInitialized) { | ||
if (this.botRow) { | ||
this.botRow.deleteCells(); | ||
} | ||
row = this.generateRow("bottom", this.rowsToData(rows)); | ||
@@ -303,3 +311,3 @@ this.botRow = row; | ||
paramKey = type + "Params"; | ||
params = typeof column.modules.columnCalcs[paramKey] === "function" ? column.modules.columnCalcs[paramKey](value, data) : column.modules.columnCalcs[paramKey]; | ||
params = typeof column.modules.columnCalcs[paramKey] === "function" ? column.modules.columnCalcs[paramKey](values, data) : column.modules.columnCalcs[paramKey]; | ||
@@ -306,0 +314,0 @@ column.setFieldValue(rowData, column.modules.columnCalcs[type](values, data, params)); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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(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(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.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=[];return t.forEach(function(t){o.push(t.getData())}),o},ColumnCalcs.prototype.generateRow=function(t,o){var e,i=this,l=this.generateRowData(t,o);return i.table.modExists("mutator")&&i.table.modules.mutator.disable(),e=new Row(l,this),i.table.modExists("mutator")&&i.table.modules.mutator.enable(),e.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+t),e.type="calc",e.generateCells=function(){var o=[];i.table.columnManager.columnsByIndex.forEach(function(l){i.genColumn.setField(l.getField()),i.genColumn.hozAlign=l.hozAlign,l.definition[t+"CalcFormatter"]&&i.table.modExists("format")?i.genColumn.modules.format={formatter:i.table.modules.format.getFormatter(l.definition[t+"CalcFormatter"]),params:l.definition[t+"CalcFormatterParams"]}:i.genColumn.modules.format={formatter:i.table.modules.format.getFormatter("plaintext"),params:{}},i.genColumn.definition.cssClass=l.definition.cssClass;var a=new Cell(i.genColumn,e);a.column=l,a.setWidth(),l.cells.push(a),o.push(a),l.visible||a.hide()}),this.cells=o},e},ColumnCalcs.prototype.generateRowData=function(t,o){var e,i,l={},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))}),i=n+"Params",e="function"==typeof t.modules.columnCalcs[i]?t.modules.columnCalcs[i](value,o):t.modules.columnCalcs[i],t.setFieldValue(l,t.modules.columnCalcs[n](a,o,e)))}),l},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(),i=t.getSubGroups(),l={};return i.forEach(function(t){l[t.getKey()]=o.getGroupResults(t)}),{top:e.calcs.top?e.calcs.top.getData():{},bottom:e.calcs.bottom?e.calcs.bottom.getData():{},groups:l}},ColumnCalcs.prototype.calculations={avg:function(t,o,e){var i=0,l=void 0!==e.precision?e.precision:2;return t.length&&(i=t.reduce(function(t,o){return o=Number(o),t+o}),i/=t.length,i=!1!==l?i.toFixed(l):i),parseFloat(i).toString()},max:function(t,o,e){var i=null,l=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))>i||null===i)&&(i=t)}),null!==i?!1!==l?i.toFixed(l):i:""},min:function(t,o,e){var i=null,l=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))<i||null===i)&&(i=t)}),null!==i?!1!==l?i.toFixed(l):i:""},sum:function(t,o,e){var i=0,l=void 0!==e.precision&&e.precision;return t.length&&t.forEach(function(t){t=Number(t),i+=isNaN(t)?0:Number(t)}),!1!==l?i.toFixed(l):i},concat:function(t,o,e){var i=0;return t.length&&(i=t.reduce(function(t,o){return String(t)+String(o)})),i},count:function(t,o,e){var i=0;return t.length&&t.forEach(function(t){t&&i++}),i}},Tabulator.prototype.registerModule("columnCalcs",ColumnCalcs); | ||
/* Tabulator v4.3.0 (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.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=[];return t.forEach(function(t){o.push(t.getData())}),o},ColumnCalcs.prototype.generateRow=function(t,o){var e,i=this,l=this.generateRowData(t,o);return i.table.modExists("mutator")&&i.table.modules.mutator.disable(),e=new Row(l,this),i.table.modExists("mutator")&&i.table.modules.mutator.enable(),e.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+t),e.type="calc",e.generateCells=function(){var o=[];i.table.columnManager.columnsByIndex.forEach(function(l){i.genColumn.setField(l.getField()),i.genColumn.hozAlign=l.hozAlign,l.definition[t+"CalcFormatter"]&&i.table.modExists("format")?i.genColumn.modules.format={formatter:i.table.modules.format.getFormatter(l.definition[t+"CalcFormatter"]),params:l.definition[t+"CalcFormatterParams"]}:i.genColumn.modules.format={formatter:i.table.modules.format.getFormatter("plaintext"),params:{}},i.genColumn.definition.cssClass=l.definition.cssClass;var a=new Cell(i.genColumn,e);a.column=l,a.setWidth(),l.cells.push(a),o.push(a),l.visible||a.hide()}),this.cells=o},e},ColumnCalcs.prototype.generateRowData=function(t,o){var e,i,l={},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))}),i=n+"Params",e="function"==typeof t.modules.columnCalcs[i]?t.modules.columnCalcs[i](a,o):t.modules.columnCalcs[i],t.setFieldValue(l,t.modules.columnCalcs[n](a,o,e)))}),l},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(),i=t.getSubGroups(),l={};return i.forEach(function(t){l[t.getKey()]=o.getGroupResults(t)}),{top:e.calcs.top?e.calcs.top.getData():{},bottom:e.calcs.bottom?e.calcs.bottom.getData():{},groups:l}},ColumnCalcs.prototype.calculations={avg:function(t,o,e){var i=0,l=void 0!==e.precision?e.precision:2;return t.length&&(i=t.reduce(function(t,o){return o=Number(o),t+o}),i/=t.length,i=!1!==l?i.toFixed(l):i),parseFloat(i).toString()},max:function(t,o,e){var i=null,l=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))>i||null===i)&&(i=t)}),null!==i?!1!==l?i.toFixed(l):i:""},min:function(t,o,e){var i=null,l=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))<i||null===i)&&(i=t)}),null!==i?!1!==l?i.toFixed(l):i:""},sum:function(t,o,e){var i=0,l=void 0!==e.precision&&e.precision;return t.length&&t.forEach(function(t){t=Number(t),i+=isNaN(t)?0:Number(t)}),!1!==l?i.toFixed(l):i},concat:function(t,o,e){var i=0;return t.length&&(i=t.reduce(function(t,o){return String(t)+String(o)})),i},count:function(t,o,e){var i=0;return t.length&&t.forEach(function(t){t&&i++}),i}},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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -206,3 +206,3 @@ var Clipboard = function Clipboard(table) { | ||
Clipboard.prototype.copy = function (selector, selectorParams, formatter, formatterParams, internal) { | ||
var range, sel; | ||
var range, sel, textRange; | ||
this.blocked = false; | ||
@@ -209,0 +209,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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.copySelector=!1,this.copySelectorParams={},this.copyFormatter=!1,this.copyFormatterParams={},this.pasteParser=function(){},this.pasteAction=function(){},this.htmlElement=!1,this.config={},this.blocked=!0};Clipboard.prototype.initialize=function(){var t=this;this.mode=this.table.options.clipboard,!0!==this.mode&&"copy"!==this.mode||this.table.element.addEventListener("copy",function(o){var e;t.processConfig(),t.blocked||(o.preventDefault(),e=t.generateContent(),window.clipboardData&&window.clipboardData.setData?window.clipboardData.setData("Text",e):o.clipboardData&&o.clipboardData.setData?(o.clipboardData.setData("text/plain",e),t.htmlElement&&o.clipboardData.setData("text/html",t.htmlElement.outerHTML)):o.originalEvent&&o.originalEvent.clipboardData.setData&&(o.originalEvent.clipboardData.setData("text/plain",e),t.htmlElement&&o.originalEvent.clipboardData.setData("text/html",t.htmlElement.outerHTML)),t.table.options.clipboardCopied.call(this.table,e),t.reset())}),!0!==this.mode&&"paste"!==this.mode||this.table.element.addEventListener("paste",function(o){t.paste(o)}),this.setPasteParser(this.table.options.clipboardPasteParser),this.setPasteAction(this.table.options.clipboardPasteAction)},Clipboard.prototype.processConfig=function(){var t={columnHeaders:"groups",rowGroups:!0,columnCalcs:!0};if(void 0!==this.table.options.clipboardCopyHeader&&(t.columnHeaders=this.table.options.clipboardCopyHeader,console.warn("DEPRECATION WANRING - clipboardCopyHeader option has been depricated, please use the columnHeaders property on the clipboardCopyConfig option")),this.table.options.clipboardCopyConfig)for(var o in this.table.options.clipboardCopyConfig)t[o]=this.table.options.clipboardCopyConfig[o];t.rowGroups&&this.table.options.groupBy&&this.table.modExists("groupRows")&&(this.config.rowGroups=!0),t.columnHeaders?"groups"!==t.columnHeaders&&!0!==t||this.table.columnManager.columns.length==this.table.columnManager.columnsByIndex.length?this.config.columnHeaders="columns":this.config.columnHeaders="groups":this.config.columnHeaders=!1,t.columnCalcs&&this.table.modExists("columnCalcs")&&(this.config.columnCalcs=!0)},Clipboard.prototype.reset=function(){this.blocked=!1,this.originalSelectionText=""},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 o,e,r;this.checkPaseOrigin(t)&&(o=this.getPasteData(t),e=this.pasteParser.call(this,o),e?(t.preventDefault(),this.table.modExists("mutator")&&(e=this.mutateData(e)),r=this.pasteAction.call(this,e),this.table.options.clipboardPasted.call(this.table,o,e,r)):this.table.options.clipboardPasteError.call(this.table,o))},Clipboard.prototype.mutateData=function(t){var o=this,e=[];return Array.isArray(t)?t.forEach(function(t){e.push(o.table.modules.mutator.transformRow(t,"clipboard"))}):e=t,e},Clipboard.prototype.checkPaseOrigin=function(t){var o=!0;return("DIV"!=t.target.tagName||this.table.modules.edit.currentCell)&&(o=!1),o},Clipboard.prototype.getPasteData=function(t){var o;return window.clipboardData&&window.clipboardData.getData?o=window.clipboardData.getData("Text"):t.clipboardData&&t.clipboardData.getData?o=t.clipboardData.getData("text/plain"):t.originalEvent&&t.originalEvent.clipboardData.getData&&(o=t.originalEvent.clipboardData.getData("text/plain")),o},Clipboard.prototype.copy=function(t,o,e,r,a){var n,i;this.blocked=!1,!0!==this.mode&&"copy"!==this.mode||(void 0!==window.getSelection&&void 0!==document.createRange?(n=document.createRange(),n.selectNodeContents(this.table.element),i=window.getSelection(),i.toString()&&a&&(t="userSelection",e="raw",o=i.toString()),i.removeAllRanges(),i.addRange(n)):void 0!==document.selection&&void 0!==document.body.createTextRange&&(textRange=document.body.createTextRange(),textRange.moveToElementText(this.table.element),textRange.select()),this.setSelector(t),this.copySelectorParams=void 0!==o&&null!=o?o:this.config.columnHeaders,this.setFormatter(e),this.copyFormatterParams=void 0!==r&&null!=r?r:{},document.execCommand("copy"),i&&i.removeAllRanges())},Clipboard.prototype.setSelector=function(t){switch(t=t||this.table.options.clipboardCopySelector,void 0===t?"undefined":_typeof(t)){case"string":this.copySelectors[t]?this.copySelector=this.copySelectors[t]:console.warn("Clipboard Error - No such selector found:",t);break;case"function":this.copySelector=t}},Clipboard.prototype.setFormatter=function(t){switch(t=t||this.table.options.clipboardCopyFormatter,void 0===t?"undefined":_typeof(t)){case"string":this.copyFormatters[t]?this.copyFormatter=this.copyFormatters[t]:console.warn("Clipboard Error - No such formatter found:",t);break;case"function":this.copyFormatter=t}},Clipboard.prototype.generateContent=function(){var t;return this.htmlElement=!1,t=this.copySelector.call(this,this.config,this.copySelectorParams),this.copyFormatter.call(this,t,this.config,this.copyFormatterParams)},Clipboard.prototype.generateSimpleHeaders=function(t){var o=[];return t.forEach(function(t){o.push(t.definition.title)}),o},Clipboard.prototype.generateColumnGroupHeaders=function(t){var o=this,e=[];return this.table.columnManager.columns.forEach(function(t){var r=o.processColumnGroup(t);r&&e.push(r)}),e},Clipboard.prototype.processColumnGroup=function(t){var o=this,e=t.columns,r={type:"group",title:t.definition.title,column:t};if(e.length){if(r.subGroups=[],r.width=0,e.forEach(function(t){var e=o.processColumnGroup(t);e&&(r.width+=e.width,r.subGroups.push(e))}),!r.width)return!1}else{if(!t.field||!t.visible)return!1;r.width=1}return r},Clipboard.prototype.groupHeadersToRows=function(t){function o(t,a){void 0===r[a]&&(r[a]=[]),r[a].push(t.title),t.subGroups?t.subGroups.forEach(function(t){o(t,a+1)}):e()}function e(){var t=0;r.forEach(function(o){var e=o.length;e>t&&(t=e)}),r.forEach(function(o){var e=o.length;if(e<t)for(var r=e;r<t;r++)o.push("")})}var r=[];return t.forEach(function(t){o(t,0)}),r},Clipboard.prototype.rowsToData=function(t,o,e){var r=this.table.columnManager.columnsByIndex,a=[];return t.forEach(function(t){var o=[],e=t instanceof RowComponent?t.getData("clipboard"):t;r.forEach(function(t){var r=t.getFieldValue(e);switch(void 0===r?"undefined":_typeof(r)){case"object":r=JSON.stringify(r);break;case"undefined":case"null":r="";break;default:r=r}o.push(r)}),a.push(o)}),a},Clipboard.prototype.buildComplexRows=function(t){var o=this,e=[];return this.table.modules.groupRows.getGroups().forEach(function(t){e.push(o.processGroupData(t))}),e},Clipboard.prototype.processGroupData=function(t){var o=this,e=t.getSubGroups(),r={type:"group",key:t.key};return e.length?(r.subGroups=[],e.forEach(function(t){r.subGroups.push(o.processGroupData(t))})):r.rows=t.getRows(!0),r},Clipboard.prototype.getCalcRow=function(t,o,e){var r=t[o];return r&&(e&&(r=r[e]),Object.keys(r).length)?this.rowsToData([r]):[]},Clipboard.prototype.buildOutput=function(t,o,e){var r,a=this,n=[],i=this.table.columnManager.columnsByIndex;return o.columnHeaders&&("groups"==o.columnHeaders?(i=this.generateColumnGroupHeaders(this.table.columnManager.columns),n=n.concat(this.groupHeadersToRows(i))):n.push(this.generateSimpleHeaders(i))),this.config.columnCalcs&&(r=this.table.getCalcResults()),this.table.options.clipboardCopyStyled&&this.generateHTML(t,i,r,o,e),o.rowGroups?t.forEach(function(t){n=n.concat(a.parseRowGroupData(t,o,e,r||{}))}):(o.columnCalcs&&(n=n.concat(this.getCalcRow(r,"top"))),n=n.concat(this.rowsToData(t,o,e)),o.columnCalcs&&(n=n.concat(this.getCalcRow(r,"bottom")))),n},Clipboard.prototype.parseRowGroupData=function(t,o,e,r){var a=this,n=[];return n.push([t.key]),t.subGroups?t.subGroups.forEach(function(i){n=n.concat(a.parseRowGroupData(i,o,e,r[t.key]?r[t.key].groups||{}:{}))}):(o.columnCalcs&&(n=n.concat(this.getCalcRow(r,t.key,"top"))),n=n.concat(this.rowsToData(t.rows,o,e)),o.columnCalcs&&(n=n.concat(this.getCalcRow(r,t.key,"bottom")))),n},Clipboard.prototype.generateHTML=function(t,o,e,r,a){function n(t,o){void 0===y[o]&&(y[o]=[]),y[o].push({title:t.title,width:t.width,height:1,children:!!t.subGroups,element:t.column.getElement()}),t.subGroups&&t.subGroups.forEach(function(t){n(t,o+1)})}function i(t,o,e){var r=t[o];r&&(e&&(r=r[e]),Object.keys(r).length&&l([r]))}function l(t){t.forEach(function(t,e){var r,a=document.createElement("tr"),n=h,i=!1;t instanceof RowComponent?r=t.getData("clipboard"):(r=t,i=!0),o.forEach(function(t,e){var n=document.createElement("td"),i=t.getFieldValue(r);switch(void 0===i?"undefined":_typeof(i)){case"object":i=JSON.stringify(i);break;case"undefined":case"null":i="";break;default:i=i}n.innerHTML=i,t.definition.align&&(n.style.textAlign=t.definition.align),o.length,b&&g.mapElementStyles(b,n,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),a.appendChild(n)}),i?n=d:(e%2||!p||(n=p),e%2&&u&&(n=u)),n&&g.mapElementStyles(n,a,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),c.appendChild(a)})}function s(t,e){var a=document.createElement("tr"),n=document.createElement("td");n.colSpan=o.length,n.innerHTML=t.key,a.appendChild(n),c.appendChild(a),g.mapElementStyles(f,a,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),t.subGroups?t.subGroups.forEach(function(o){s(o,e[t.key]?e[t.key].groups||{}:{})}):(r.columnCalcs&&i(e,t.key,"top"),l(t.rows),r.columnCalcs&&i(e,t.key,"bottom"))}var c,p,u,d,h,b,f,m,g=this,y=[];this.htmlElement=document.createElement("table"),g.mapElementStyles(this.table.element,this.htmlElement,["border-top","border-left","border-right","border-bottom"]),r.columnHeaders&&("groups"==r.columnHeaders?(o.forEach(function(t){n(t,0)}),function(){y.forEach(function(t,o){t.forEach(function(t){t.children||(t.height=y.length-o)})})}(),function(t){var o=document.createElement("thead");t.forEach(function(t){var e=document.createElement("tr");t.forEach(function(t){var o=document.createElement("th");t.width>1&&(o.colSpan=t.width),t.height>1&&(o.rowSpan=t.height),o.innerHTML=t.title,g.mapElementStyles(t.element,o,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),e.appendChild(o)}),g.mapElementStyles(g.table.columnManager.getHeadersElement(),e,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),o.appendChild(e)}),g.htmlElement.appendChild(o)}(y)):function(){var t=document.createElement("tr");o.forEach(function(o){var e=document.createElement("th");e.innerHTML=o.definition.title,g.mapElementStyles(o.getElement(),e,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),t.appendChild(e)}),g.mapElementStyles(g.table.columnManager.getHeadersElement(),t,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),g.htmlElement.appendChild(document.createElement("thead").appendChild(t))}()),o=this.table.columnManager.columnsByIndex,c=document.createElement("tbody"),window.getComputedStyle&&(p=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),u=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),d=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),h=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),f=this.table.element.getElementsByClassName("tabulator-group")[0],h&&(m=h.getElementsByClassName("tabulator-cell"),b=m[0],m[m.length-1])),r.rowGroups?t.forEach(function(t){s(t,e||{})}):(r.columnCalcs&&i(e,"top"),l(t),r.columnCalcs&&i(e,"bottom")),this.htmlElement.appendChild(c)},Clipboard.prototype.mapElementStyles=function(t,o,e){var r={"background-color":"backgroundColor",color:"fontColor","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom"};if(window.getComputedStyle){var a=window.getComputedStyle(t);e.forEach(function(t){o.style[r[t]]=a.getPropertyValue(t)})}},Clipboard.prototype.copySelectors={userSelection:function(t,o){return o},selected:function(t,o){var e=[];return this.table.modExists("selectRow",!0)&&(e=this.table.modules.selectRow.getSelectedRows()),t.rowGroups&&console.warn("Clipboard Warning - select coptSelector does not support row groups"),this.buildOutput(e,t,o)},table:function(t,o){return t.rowGroups&&console.warn("Clipboard Warning - table coptSelector does not support row groups"),this.buildOutput(this.table.rowManager.getComponents(),t,o)},active:function(t,o){var e;return e=t.rowGroups?this.buildComplexRows(t):this.table.rowManager.getComponents(!0),this.buildOutput(e,t,o)}},Clipboard.prototype.copyFormatters={raw:function(t,o){return t},table:function(t,o){var e=[];return t.forEach(function(t){t.forEach(function(t){void 0===t&&(t=""),t=void 0===t||null===t?"":t.toString(),t.match(/\r|\n/)&&(t=t.split('"').join('""'),t='"'+t+'"')}),e.push(t.join("\t"))}),e.join("\n")}},Clipboard.prototype.pasteParsers={table:function(t){var o=[],e=!0,r=this.table.columnManager.columns,a=[],n=[];return t=t.split("\n"),t.forEach(function(t){o.push(t.split("\t"))}),!(!o.length||1===o.length&&o[0].length<2)&&(!0,o[0].forEach(function(t){var o=r.find(function(o){return t&&o.definition.title&&t.trim()&&o.definition.title.trim()===t.trim()});o?a.push(o):e=!1}),e||(e=!0,a=[],o[0].forEach(function(t){var o=r.find(function(o){return t&&o.field&&t.trim()&&o.field.trim()===t.trim()});o?a.push(o):e=!1}),e||(a=this.table.columnManager.columnsByIndex)),e&&o.shift(),o.forEach(function(t){var o={};t.forEach(function(t,e){a[e]&&(o[a[e].field]=t)}),n.push(o)}),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); | ||
/* Tabulator v4.3.0 (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.copySelector=!1,this.copySelectorParams={},this.copyFormatter=!1,this.copyFormatterParams={},this.pasteParser=function(){},this.pasteAction=function(){},this.htmlElement=!1,this.config={},this.blocked=!0};Clipboard.prototype.initialize=function(){var t=this;this.mode=this.table.options.clipboard,!0!==this.mode&&"copy"!==this.mode||this.table.element.addEventListener("copy",function(o){var e;t.processConfig(),t.blocked||(o.preventDefault(),e=t.generateContent(),window.clipboardData&&window.clipboardData.setData?window.clipboardData.setData("Text",e):o.clipboardData&&o.clipboardData.setData?(o.clipboardData.setData("text/plain",e),t.htmlElement&&o.clipboardData.setData("text/html",t.htmlElement.outerHTML)):o.originalEvent&&o.originalEvent.clipboardData.setData&&(o.originalEvent.clipboardData.setData("text/plain",e),t.htmlElement&&o.originalEvent.clipboardData.setData("text/html",t.htmlElement.outerHTML)),t.table.options.clipboardCopied.call(this.table,e),t.reset())}),!0!==this.mode&&"paste"!==this.mode||this.table.element.addEventListener("paste",function(o){t.paste(o)}),this.setPasteParser(this.table.options.clipboardPasteParser),this.setPasteAction(this.table.options.clipboardPasteAction)},Clipboard.prototype.processConfig=function(){var t={columnHeaders:"groups",rowGroups:!0,columnCalcs:!0};if(void 0!==this.table.options.clipboardCopyHeader&&(t.columnHeaders=this.table.options.clipboardCopyHeader,console.warn("DEPRECATION WANRING - clipboardCopyHeader option has been depricated, please use the columnHeaders property on the clipboardCopyConfig option")),this.table.options.clipboardCopyConfig)for(var o in this.table.options.clipboardCopyConfig)t[o]=this.table.options.clipboardCopyConfig[o];t.rowGroups&&this.table.options.groupBy&&this.table.modExists("groupRows")&&(this.config.rowGroups=!0),t.columnHeaders?"groups"!==t.columnHeaders&&!0!==t||this.table.columnManager.columns.length==this.table.columnManager.columnsByIndex.length?this.config.columnHeaders="columns":this.config.columnHeaders="groups":this.config.columnHeaders=!1,t.columnCalcs&&this.table.modExists("columnCalcs")&&(this.config.columnCalcs=!0)},Clipboard.prototype.reset=function(){this.blocked=!1,this.originalSelectionText=""},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 o,e,r;this.checkPaseOrigin(t)&&(o=this.getPasteData(t),e=this.pasteParser.call(this,o),e?(t.preventDefault(),this.table.modExists("mutator")&&(e=this.mutateData(e)),r=this.pasteAction.call(this,e),this.table.options.clipboardPasted.call(this.table,o,e,r)):this.table.options.clipboardPasteError.call(this.table,o))},Clipboard.prototype.mutateData=function(t){var o=this,e=[];return Array.isArray(t)?t.forEach(function(t){e.push(o.table.modules.mutator.transformRow(t,"clipboard"))}):e=t,e},Clipboard.prototype.checkPaseOrigin=function(t){var o=!0;return("DIV"!=t.target.tagName||this.table.modules.edit.currentCell)&&(o=!1),o},Clipboard.prototype.getPasteData=function(t){var o;return window.clipboardData&&window.clipboardData.getData?o=window.clipboardData.getData("Text"):t.clipboardData&&t.clipboardData.getData?o=t.clipboardData.getData("text/plain"):t.originalEvent&&t.originalEvent.clipboardData.getData&&(o=t.originalEvent.clipboardData.getData("text/plain")),o},Clipboard.prototype.copy=function(t,o,e,r,a){var n,i,l;this.blocked=!1,!0!==this.mode&&"copy"!==this.mode||(void 0!==window.getSelection&&void 0!==document.createRange?(n=document.createRange(),n.selectNodeContents(this.table.element),i=window.getSelection(),i.toString()&&a&&(t="userSelection",e="raw",o=i.toString()),i.removeAllRanges(),i.addRange(n)):void 0!==document.selection&&void 0!==document.body.createTextRange&&(l=document.body.createTextRange(),l.moveToElementText(this.table.element),l.select()),this.setSelector(t),this.copySelectorParams=void 0!==o&&null!=o?o:this.config.columnHeaders,this.setFormatter(e),this.copyFormatterParams=void 0!==r&&null!=r?r:{},document.execCommand("copy"),i&&i.removeAllRanges())},Clipboard.prototype.setSelector=function(t){switch(t=t||this.table.options.clipboardCopySelector,void 0===t?"undefined":_typeof(t)){case"string":this.copySelectors[t]?this.copySelector=this.copySelectors[t]:console.warn("Clipboard Error - No such selector found:",t);break;case"function":this.copySelector=t}},Clipboard.prototype.setFormatter=function(t){switch(t=t||this.table.options.clipboardCopyFormatter,void 0===t?"undefined":_typeof(t)){case"string":this.copyFormatters[t]?this.copyFormatter=this.copyFormatters[t]:console.warn("Clipboard Error - No such formatter found:",t);break;case"function":this.copyFormatter=t}},Clipboard.prototype.generateContent=function(){var t;return this.htmlElement=!1,t=this.copySelector.call(this,this.config,this.copySelectorParams),this.copyFormatter.call(this,t,this.config,this.copyFormatterParams)},Clipboard.prototype.generateSimpleHeaders=function(t){var o=[];return t.forEach(function(t){o.push(t.definition.title)}),o},Clipboard.prototype.generateColumnGroupHeaders=function(t){var o=this,e=[];return this.table.columnManager.columns.forEach(function(t){var r=o.processColumnGroup(t);r&&e.push(r)}),e},Clipboard.prototype.processColumnGroup=function(t){var o=this,e=t.columns,r={type:"group",title:t.definition.title,column:t};if(e.length){if(r.subGroups=[],r.width=0,e.forEach(function(t){var e=o.processColumnGroup(t);e&&(r.width+=e.width,r.subGroups.push(e))}),!r.width)return!1}else{if(!t.field||!t.visible)return!1;r.width=1}return r},Clipboard.prototype.groupHeadersToRows=function(t){function o(t,a){void 0===r[a]&&(r[a]=[]),r[a].push(t.title),t.subGroups?t.subGroups.forEach(function(t){o(t,a+1)}):e()}function e(){var t=0;r.forEach(function(o){var e=o.length;e>t&&(t=e)}),r.forEach(function(o){var e=o.length;if(e<t)for(var r=e;r<t;r++)o.push("")})}var r=[];return t.forEach(function(t){o(t,0)}),r},Clipboard.prototype.rowsToData=function(t,o,e){var r=this.table.columnManager.columnsByIndex,a=[];return t.forEach(function(t){var o=[],e=t instanceof RowComponent?t.getData("clipboard"):t;r.forEach(function(t){var r=t.getFieldValue(e);switch(void 0===r?"undefined":_typeof(r)){case"object":r=JSON.stringify(r);break;case"undefined":case"null":r="";break;default:r=r}o.push(r)}),a.push(o)}),a},Clipboard.prototype.buildComplexRows=function(t){var o=this,e=[];return this.table.modules.groupRows.getGroups().forEach(function(t){e.push(o.processGroupData(t))}),e},Clipboard.prototype.processGroupData=function(t){var o=this,e=t.getSubGroups(),r={type:"group",key:t.key};return e.length?(r.subGroups=[],e.forEach(function(t){r.subGroups.push(o.processGroupData(t))})):r.rows=t.getRows(!0),r},Clipboard.prototype.getCalcRow=function(t,o,e){var r=t[o];return r&&(e&&(r=r[e]),Object.keys(r).length)?this.rowsToData([r]):[]},Clipboard.prototype.buildOutput=function(t,o,e){var r,a=this,n=[],i=this.table.columnManager.columnsByIndex;return o.columnHeaders&&("groups"==o.columnHeaders?(i=this.generateColumnGroupHeaders(this.table.columnManager.columns),n=n.concat(this.groupHeadersToRows(i))):n.push(this.generateSimpleHeaders(i))),this.config.columnCalcs&&(r=this.table.getCalcResults()),this.table.options.clipboardCopyStyled&&this.generateHTML(t,i,r,o,e),o.rowGroups?t.forEach(function(t){n=n.concat(a.parseRowGroupData(t,o,e,r||{}))}):(o.columnCalcs&&(n=n.concat(this.getCalcRow(r,"top"))),n=n.concat(this.rowsToData(t,o,e)),o.columnCalcs&&(n=n.concat(this.getCalcRow(r,"bottom")))),n},Clipboard.prototype.parseRowGroupData=function(t,o,e,r){var a=this,n=[];return n.push([t.key]),t.subGroups?t.subGroups.forEach(function(i){n=n.concat(a.parseRowGroupData(i,o,e,r[t.key]?r[t.key].groups||{}:{}))}):(o.columnCalcs&&(n=n.concat(this.getCalcRow(r,t.key,"top"))),n=n.concat(this.rowsToData(t.rows,o,e)),o.columnCalcs&&(n=n.concat(this.getCalcRow(r,t.key,"bottom")))),n},Clipboard.prototype.generateHTML=function(t,o,e,r,a){function n(t,o){void 0===y[o]&&(y[o]=[]),y[o].push({title:t.title,width:t.width,height:1,children:!!t.subGroups,element:t.column.getElement()}),t.subGroups&&t.subGroups.forEach(function(t){n(t,o+1)})}function i(t,o,e){var r=t[o];r&&(e&&(r=r[e]),Object.keys(r).length&&l([r]))}function l(t){t.forEach(function(t,e){var r,a=document.createElement("tr"),n=h,i=!1;t instanceof RowComponent?r=t.getData("clipboard"):(r=t,i=!0),o.forEach(function(t,e){var n=document.createElement("td"),i=t.getFieldValue(r);switch(void 0===i?"undefined":_typeof(i)){case"object":i=JSON.stringify(i);break;case"undefined":case"null":i="";break;default:i=i}n.innerHTML=i,t.definition.align&&(n.style.textAlign=t.definition.align),o.length,b&&g.mapElementStyles(b,n,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),a.appendChild(n)}),i?n=d:(e%2||!p||(n=p),e%2&&u&&(n=u)),n&&g.mapElementStyles(n,a,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),c.appendChild(a)})}function s(t,e){var a=document.createElement("tr"),n=document.createElement("td");n.colSpan=o.length,n.innerHTML=t.key,a.appendChild(n),c.appendChild(a),g.mapElementStyles(f,a,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),t.subGroups?t.subGroups.forEach(function(o){s(o,e[t.key]?e[t.key].groups||{}:{})}):(r.columnCalcs&&i(e,t.key,"top"),l(t.rows),r.columnCalcs&&i(e,t.key,"bottom"))}var c,p,u,d,h,b,f,m,g=this,y=[];this.htmlElement=document.createElement("table"),g.mapElementStyles(this.table.element,this.htmlElement,["border-top","border-left","border-right","border-bottom"]),r.columnHeaders&&("groups"==r.columnHeaders?(o.forEach(function(t){n(t,0)}),function(){y.forEach(function(t,o){t.forEach(function(t){t.children||(t.height=y.length-o)})})}(),function(t){var o=document.createElement("thead");t.forEach(function(t){var e=document.createElement("tr");t.forEach(function(t){var o=document.createElement("th");t.width>1&&(o.colSpan=t.width),t.height>1&&(o.rowSpan=t.height),o.innerHTML=t.title,g.mapElementStyles(t.element,o,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),e.appendChild(o)}),g.mapElementStyles(g.table.columnManager.getHeadersElement(),e,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),o.appendChild(e)}),g.htmlElement.appendChild(o)}(y)):function(){var t=document.createElement("tr");o.forEach(function(o){var e=document.createElement("th");e.innerHTML=o.definition.title,g.mapElementStyles(o.getElement(),e,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),t.appendChild(e)}),g.mapElementStyles(g.table.columnManager.getHeadersElement(),t,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),g.htmlElement.appendChild(document.createElement("thead").appendChild(t))}()),o=this.table.columnManager.columnsByIndex,c=document.createElement("tbody"),window.getComputedStyle&&(p=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),u=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),d=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),h=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),f=this.table.element.getElementsByClassName("tabulator-group")[0],h&&(m=h.getElementsByClassName("tabulator-cell"),b=m[0],m[m.length-1])),r.rowGroups?t.forEach(function(t){s(t,e||{})}):(r.columnCalcs&&i(e,"top"),l(t),r.columnCalcs&&i(e,"bottom")),this.htmlElement.appendChild(c)},Clipboard.prototype.mapElementStyles=function(t,o,e){var r={"background-color":"backgroundColor",color:"fontColor","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom"};if(window.getComputedStyle){var a=window.getComputedStyle(t);e.forEach(function(t){o.style[r[t]]=a.getPropertyValue(t)})}},Clipboard.prototype.copySelectors={userSelection:function(t,o){return o},selected:function(t,o){var e=[];return this.table.modExists("selectRow",!0)&&(e=this.table.modules.selectRow.getSelectedRows()),t.rowGroups&&console.warn("Clipboard Warning - select coptSelector does not support row groups"),this.buildOutput(e,t,o)},table:function(t,o){return t.rowGroups&&console.warn("Clipboard Warning - table coptSelector does not support row groups"),this.buildOutput(this.table.rowManager.getComponents(),t,o)},active:function(t,o){var e;return e=t.rowGroups?this.buildComplexRows(t):this.table.rowManager.getComponents(!0),this.buildOutput(e,t,o)}},Clipboard.prototype.copyFormatters={raw:function(t,o){return t},table:function(t,o){var e=[];return t.forEach(function(t){t.forEach(function(t){void 0===t&&(t=""),t=void 0===t||null===t?"":t.toString(),t.match(/\r|\n/)&&(t=t.split('"').join('""'),t='"'+t+'"')}),e.push(t.join("\t"))}),e.join("\n")}},Clipboard.prototype.pasteParsers={table:function(t){var o=[],e=!0,r=this.table.columnManager.columns,a=[],n=[];return t=t.split("\n"),t.forEach(function(t){o.push(t.split("\t"))}),!(!o.length||1===o.length&&o[0].length<2)&&(!0,o[0].forEach(function(t){var o=r.find(function(o){return t&&o.definition.title&&t.trim()&&o.definition.title.trim()===t.trim()});o?a.push(o):e=!1}),e||(e=!0,a=[],o[0].forEach(function(t){var o=r.find(function(o){return t&&o.field&&t.trim()&&o.field.trim()===t.trim()});o?a.push(o):e=!1}),e||(a=this.table.columnManager.columnsByIndex)),e&&o.shift(),o.forEach(function(t){var o={};t.forEach(function(t,e){a[e]&&(o[a[e].field]=t)}),n.push(o)}),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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var DataTree = function DataTree(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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.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.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),n=a||!a&&"object"===(void 0===t?"undefined":_typeof(t))&&null!==t;e.modules.dataTree={index:0,open:!!n&&this.startOpen(e.getComponent(),0),controlEl:!1,branchEl:!1,parent:!1,children:n}},DataTree.prototype.layoutRow=function(e){var t=this.elementField?e.getCell(this.elementField):e.getCells()[0],a=t.getElement(),n=e.modules.dataTree;n.branchEl&&n.branchEl.parentNode.removeChild(n.branchEl),this.generateControlElement(e,a),n.index&&(this.branchEl?(n.branchEl=this.branchEl.cloneNode(!0),a.insertBefore(n.branchEl,a.firstChild),n.branchEl.style.marginLeft=(n.branchEl.offsetWidth+n.branchEl.style.marginRight)*(n.index-1)+n.index*this.indent+"px"):a.style.paddingLeft=parseInt(window.getComputedStyle(a,null).getPropertyValue("padding-left"))+n.index*this.indent+"px")},DataTree.prototype.generateControlElement=function(e,t){var a=this,n=e.modules.dataTree,t=t||e.getCells()[0].getElement(),r=n.controlEl;!1!==n.children&&(n.open?(n.controlEl=this.collapseEl.cloneNode(!0),n.controlEl.addEventListener("click",function(t){t.stopPropagation(),a.collapseRow(e)})):(n.controlEl=this.expandEl.cloneNode(!0),n.controlEl.addEventListener("click",function(t){t.stopPropagation(),a.expandRow(e)})),n.controlEl.addEventListener("mousedown",function(e){e.stopPropagation()}),r&&r.parentNode===t?r.parentNode.replaceChild(n.controlEl,r):t.insertBefore(n.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,n){var r,l;a.push(e),e instanceof Row&&(r=e.modules.dataTree.children,r.index||!1===r.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,n=[],r=[];return!1!==a.children&&a.open&&(Array.isArray(a.children)||(a.children=this.generateChildren(e)),n=this.table.modExists("filter")?this.table.modules.filter.filter(a.children):a.children,this.table.modExists("sort")&&this.table.modules.sort.sort(n),n.forEach(function(e){r.push(e),t.getChildren(e).forEach(function(e){r.push(e)})})),r},DataTree.prototype.generateChildren=function(e){var t=this,a=[],n=e.getData()[this.field];return Array.isArray(n)||(n=[n]),n.forEach(function(n){var r=new Row(n||{},t.table.rowManager);r.modules.dataTree.index=e.modules.dataTree.index+1,r.modules.dataTree.parent=e,r.modules.dataTree.children&&(r.modules.dataTree.open=t.startOpen(r.getComponent(),r.modules.dataTree.index)),a.push(r)}),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.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},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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -118,6 +118,6 @@ var Download = function Download(table) { | ||
maxDepth = 0; | ||
var processedColumn = this.processDefinition(column); | ||
var groupData = { | ||
type: "group", | ||
title: column.definition.title, | ||
title: processedColumn.title, | ||
depth: 1 | ||
@@ -151,3 +151,3 @@ }; | ||
groupData.width = 1; | ||
groupData.definition = this.processDefinition(column); | ||
groupData.definition = processedColumn; | ||
} else { | ||
@@ -630,2 +630,6 @@ return false; | ||
if (options && options.documentProcessing) { | ||
options.documentProcessing(doc); | ||
} | ||
setFileContents(doc.output("arraybuffer"), "application/pdf"); | ||
@@ -632,0 +636,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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={}};Download.prototype.download=function(o,n,t,e){function i(t,i){e?!0===e?s.triggerDownload(t,i,o,n,!0):e(t):s.triggerDownload(t,i,o,n)}var s=this,r=!1;this.processConfig(),"function"==typeof o?r=o:s.downloaders[o]?r=s.downloaders[o]:console.warn("Download Error - No such download type found: ",o),this.processColumns(),r&&r.call(this,s.processDefinitions(),s.processData(),t||{},i,this.config)},Download.prototype.processConfig=function(){var o={columnGroups:!0,rowGroups:!0,columnCalcs:!0};if(this.table.options.downloadConfig)for(var n in this.table.options.downloadConfig)o[n]=this.table.options.downloadConfig[n];o.rowGroups&&this.table.options.groupBy&&this.table.modExists("groupRows")&&(this.config.rowGroups=!0),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)},Download.prototype.processColumns=function(){var o=this;o.columnsByIndex=[],o.columnsByField={},o.table.columnManager.columnsByIndex.forEach(function(n){n.field&&!1!==n.definition.download&&(n.visible||!n.visible&&n.definition.download)&&(o.columnsByIndex.push(n),o.columnsByField[n.field]=n)})},Download.prototype.processDefinitions=function(){var o=this,n=[];return this.config.columnGroups?o.table.columnManager.columns.forEach(function(t){var e=o.processColumnGroup(t);e&&n.push(e)}):o.columnsByIndex.forEach(function(t){!1!==t.download&&n.push(o.processDefinition(t))}),n},Download.prototype.processColumnGroup=function(o){var n=this,t=o.columns,e=0,i={type:"group",title:o.definition.title,depth:1};if(t.length){if(i.subGroups=[],i.width=0,t.forEach(function(o){var t=n.processColumnGroup(o);t.depth>e&&(e=t.depth),t&&(i.width+=t.width,i.subGroups.push(t))}),i.depth+=e,!i.width)return!1}else{if(!o.field||!1===o.definition.download||!(o.visible||!o.visible&&o.definition.download))return!1;i.width=1,i.definition=this.processDefinition(o)}return i},Download.prototype.processDefinition=function(o){var n={};for(var t in o.definition)n[t]=o.definition[t];return void 0!==o.definition.downloadTitle&&(n.title=o.definition.downloadTitle),n},Download.prototype.processData=function(){var o=this,n=this,t=[],e=[],i={};return this.config.rowGroups?(e=this.table.modules.groupRows.getGroups(),e.forEach(function(n){t.push(o.processGroupData(n))})):t=n.table.rowManager.getData(!0,"download"),this.config.columnCalcs&&(i=this.table.getCalcResults(),t={calcs:i,data:t}),"function"==typeof n.table.options.downloadDataFormatter&&(t=n.table.options.downloadDataFormatter(t)),t},Download.prototype.processGroupData=function(o){var n=this,t=o.getSubGroups(),e={type:"group",key:o.key};return t.length?(e.subGroups=[],t.forEach(function(o){e.subGroups.push(n.processGroupData(o))})):e.rows=o.getData(!0,"download"),e},Download.prototype.triggerDownload=function(o,n,t,e,i){var s=document.createElement("a"),r=new Blob([o],{type:n}),e=e||"Tabulator."+("function"==typeof t?"txt":t);(r=this.table.options.downloadReady.call(this.table,o,r))&&(i?window.open(window.URL.createObjectURL(r)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(r,e):(s.setAttribute("href",window.URL.createObjectURL(r)),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,n){var t=this.columnsByField[o];return!!t&&t.getFieldValue(n)},Download.prototype.commsReceived=function(o,n,t){switch(n){case"intercept":this.download(t.type,"",t.options,t.intercept)}},Download.prototype.downloaders={csv:function(o,n,t,e,i){function s(o,n){o.subGroups?o.subGroups.forEach(function(o){s(o,n+1)}):(f.push('"'+String(o.title).split('"').join('""')+'"'),p.push(o.definition.field))}function r(o){o.forEach(function(o){var n=[];p.forEach(function(t){var e=c.getFieldValue(t,o);switch(void 0===e?"undefined":_typeof(e)){case"object":e=JSON.stringify(e);break;case"undefined":case"null":e="";break;default:e=e}n.push('"'+String(e).split('"').join('""')+'"')}),u.push(n.join(d))})}function a(o){o.subGroups?o.subGroups.forEach(function(o){a(o)}):r(o.rows)}var u,l,c=this,f=[],p=[],d=t&&t.delimiter?t.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"),n=n.data),i.rowGroups?(console.warn("Download Warning - CSV downloader cannot process row groups"),n.forEach(function(o){a(o)})):r(n),l=u.join("\n"),t.bom&&(l="\ufeff"+l),e(l,"text/csv")},json:function(o,n,t,e,i){var s;i.columnCalcs&&(console.warn("Download Warning - CSV downloader cannot process column calculations"),n=n.data),s=JSON.stringify(n,null,"\t"),e(s,"application/json")},pdf:function(o,n,t,e,i){function s(o,n){var t=o.width,e=1,i={content:o.title||""};if(o.subGroups?(o.subGroups.forEach(function(o){s(o,n+1)}),e=1):(p.push(o.definition.field),e=y-n),i.rowSpan=e,d[n].push(i),t--,e>1)for(var r=n+1;r<y;r++)d[r].push("");for(var r=0;r<t;r++)d[n].push("")}function r(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 a(o){o.forEach(function(o){h.push(u(o))})}function u(o,n){var t=[];return p.forEach(function(e){var i=f.getFieldValue(e,o);i=r(i),n?t.push({content:i,styles:n}):t.push(i)}),t}function l(o,n){var t=[];t.push({content:r(o.key),colSpan:p.length,styles:b}),h.push(t),o.subGroups?o.subGroups.forEach(function(t){l(t,n[o.key]?n[o.key].groups||{}:{})}):(i.columnCalcs&&c(n,o.key,"top"),a(o.rows),i.columnCalcs&&c(n,o.key,"bottom"))}function c(o,n,t){var e=o[n];e&&(t&&(e=e[t]),Object.keys(e).length&&h.push(u(e,g)))}var f=this,p=[],d=[],h=[],w={},y=1,m={},b=t.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},g=t.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},v=t.jsPDF||{},C=t&&t.title?t.title:"";if(i.columnCalcs&&(w=n.calcs,n=n.data),v.orientation||(v.orientation=t.orientation||"landscape"),v.unit||(v.unit="pt"),i.columnGroups){o.forEach(function(o){o.depth>y&&(y=o.depth)});for(var S=0;S<y;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?n.forEach(function(o){l(o,w)}):(i.columnCalcs&&c(w,"top"),a(n),i.columnCalcs&&c(w,"bottom"));var D=new jsPDF(v);t&&t.autoTable&&(m="function"==typeof t.autoTable?t.autoTable(D)||{}:t.autoTable),C&&(m.addPageContent=function(o){D.text(C,40,30)}),m.head=d,m.body=h,D.autoTable(m),e(D.output("arraybuffer"),"application/pdf")},xlsx:function(o,n,t,e,i){function s(){function t(o,n){void 0===w[n]&&(w[n]=[]),void 0===p[n]&&(p[n]=[]),o.width>1&&p[n].push({type:"hoz",start:w[n].length,end:w[n].length+o.width-1}),w[n].push(o.title),o.subGroups?o.subGroups.forEach(function(o){t(o,n+1)}):(y.push(o.definition.field),e(y.length),p[n].push({type:"vert",start:y.length-1}))}function e(){var o=0;w.forEach(function(n){var t=n.length;t>o&&(o=t)}),w.forEach(function(n){var t=n.length;if(t<o)for(var e=t;e<o;e++)n.push("")})}function s(){var o=[];return f.forEach(function(n){o.push({s:{r:n,c:0},e:{r:n,c:y.length-1}})}),p.forEach(function(n,t){n.forEach(function(n){"hoz"===n.type?o.push({s:{r:t,c:n.start},e:{r:t,c:n.end}}):t!=w.length-1&&o.push({s:{r:t,c:n.start},e:{r:w.length-1,c:n.start}})})}),o}function r(o){o.forEach(function(o){m.push(u(o))})}function u(o){var n=[];return y.forEach(function(t){var e=a.getFieldValue(t,o);n.push(e instanceof Date||"object"!==(void 0===e?"undefined":_typeof(e))?e:JSON.stringify(e))}),n}function l(o,n,t){var e=o[n];e&&(t&&(e=e[t]),Object.keys(e).length&&(d.push(m.length),m.push(u(e))))}function h(o,n){var t=[];t.push(o.key),f.push(m.length),m.push(t),o.subGroups?o.subGroups.forEach(function(t){h(t,n[o.key]?n[o.key].groups||{}:{})}):(i.columnCalcs&&l(n,o.key,"top"),r(o.rows),i.columnCalcs&&l(n,o.key,"bottom"))}var w=[],y=[],m=[];return i.columnGroups?(o.forEach(function(o){t(o,0)}),w.forEach(function(o){m.push(o)})):function(){o.forEach(function(o){w.push(o.title),y.push(o.field)}),m.push(w)}(),i.rowGroups?n.forEach(function(o){h(o,c)}):(i.columnCalcs&&l(c,"top"),r(n),i.columnCalcs&&l(c,"bottom")),function(){var o={},n={s:{c:0,r:0},e:{c:y.length,r:m.length}};XLSX.utils.sheet_add_aoa(o,m),o["!ref"]=XLSX.utils.encode_range(n);var t=s();return t.length&&(o["!merges"]=t),o}()}var r,a=this,u=t.sheetName||"Sheet1",l={SheetNames:[],Sheets:{}},c={},f=[],p=[],d=[];if(i.columnCalcs&&(c=n.calcs,n=n.data),t.sheetOnly)return void e(s());if(t.sheets)for(var h in t.sheets)!0===t.sheets[h]?(l.SheetNames.push(h),l.Sheets[h]=s()):(l.SheetNames.push(h),this.table.modules.comms.send(t.sheets[h],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},intercept:function(o){l.Sheets[h]=o}}));else l.SheetNames.push(u),l.Sheets[u]=s();r=XLSX.write(l,{bookType:"xlsx",bookSST:!0,type:"binary"}),e(function(o){for(var n=new ArrayBuffer(o.length),t=new Uint8Array(n),e=0;e!=o.length;++e)t[e]=255&o.charCodeAt(e);return n}(r),"application/octet-stream")}},Tabulator.prototype.registerModule("download",Download); | ||
/* Tabulator v4.3.0 (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={}};Download.prototype.download=function(o,n,t,e){function i(t,i){e?!0===e?s.triggerDownload(t,i,o,n,!0):e(t):s.triggerDownload(t,i,o,n)}var s=this,r=!1;this.processConfig(),"function"==typeof o?r=o:s.downloaders[o]?r=s.downloaders[o]:console.warn("Download Error - No such download type found: ",o),this.processColumns(),r&&r.call(this,s.processDefinitions(),s.processData(),t||{},i,this.config)},Download.prototype.processConfig=function(){var o={columnGroups:!0,rowGroups:!0,columnCalcs:!0};if(this.table.options.downloadConfig)for(var n in this.table.options.downloadConfig)o[n]=this.table.options.downloadConfig[n];o.rowGroups&&this.table.options.groupBy&&this.table.modExists("groupRows")&&(this.config.rowGroups=!0),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)},Download.prototype.processColumns=function(){var o=this;o.columnsByIndex=[],o.columnsByField={},o.table.columnManager.columnsByIndex.forEach(function(n){n.field&&!1!==n.definition.download&&(n.visible||!n.visible&&n.definition.download)&&(o.columnsByIndex.push(n),o.columnsByField[n.field]=n)})},Download.prototype.processDefinitions=function(){var o=this,n=[];return this.config.columnGroups?o.table.columnManager.columns.forEach(function(t){var e=o.processColumnGroup(t);e&&n.push(e)}):o.columnsByIndex.forEach(function(t){!1!==t.download&&n.push(o.processDefinition(t))}),n},Download.prototype.processColumnGroup=function(o){var n=this,t=o.columns,e=0,i=this.processDefinition(o),s={type:"group",title:i.title,depth:1};if(t.length){if(s.subGroups=[],s.width=0,t.forEach(function(o){var t=n.processColumnGroup(o);t.depth>e&&(e=t.depth),t&&(s.width+=t.width,s.subGroups.push(t))}),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 n={};for(var t in o.definition)n[t]=o.definition[t];return void 0!==o.definition.downloadTitle&&(n.title=o.definition.downloadTitle),n},Download.prototype.processData=function(){var o=this,n=this,t=[],e=[],i={};return this.config.rowGroups?(e=this.table.modules.groupRows.getGroups(),e.forEach(function(n){t.push(o.processGroupData(n))})):t=n.table.rowManager.getData(!0,"download"),this.config.columnCalcs&&(i=this.table.getCalcResults(),t={calcs:i,data:t}),"function"==typeof n.table.options.downloadDataFormatter&&(t=n.table.options.downloadDataFormatter(t)),t},Download.prototype.processGroupData=function(o){var n=this,t=o.getSubGroups(),e={type:"group",key:o.key};return t.length?(e.subGroups=[],t.forEach(function(o){e.subGroups.push(n.processGroupData(o))})):e.rows=o.getData(!0,"download"),e},Download.prototype.triggerDownload=function(o,n,t,e,i){var s=document.createElement("a"),r=new Blob([o],{type:n}),e=e||"Tabulator."+("function"==typeof t?"txt":t);(r=this.table.options.downloadReady.call(this.table,o,r))&&(i?window.open(window.URL.createObjectURL(r)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(r,e):(s.setAttribute("href",window.URL.createObjectURL(r)),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,n){var t=this.columnsByField[o];return!!t&&t.getFieldValue(n)},Download.prototype.commsReceived=function(o,n,t){switch(n){case"intercept":this.download(t.type,"",t.options,t.intercept)}},Download.prototype.downloaders={csv:function(o,n,t,e,i){function s(o,n){o.subGroups?o.subGroups.forEach(function(o){s(o,n+1)}):(f.push('"'+String(o.title).split('"').join('""')+'"'),p.push(o.definition.field))}function r(o){o.forEach(function(o){var n=[];p.forEach(function(t){var e=c.getFieldValue(t,o);switch(void 0===e?"undefined":_typeof(e)){case"object":e=JSON.stringify(e);break;case"undefined":case"null":e="";break;default:e=e}n.push('"'+String(e).split('"').join('""')+'"')}),u.push(n.join(d))})}function a(o){o.subGroups?o.subGroups.forEach(function(o){a(o)}):r(o.rows)}var u,l,c=this,f=[],p=[],d=t&&t.delimiter?t.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"),n=n.data),i.rowGroups?(console.warn("Download Warning - CSV downloader cannot process row groups"),n.forEach(function(o){a(o)})):r(n),l=u.join("\n"),t.bom&&(l="\ufeff"+l),e(l,"text/csv")},json:function(o,n,t,e,i){var s;i.columnCalcs&&(console.warn("Download Warning - CSV downloader cannot process column calculations"),n=n.data),s=JSON.stringify(n,null,"\t"),e(s,"application/json")},pdf:function(o,n,t,e,i){function s(o,n){var t=o.width,e=1,i={content:o.title||""};if(o.subGroups?(o.subGroups.forEach(function(o){s(o,n+1)}),e=1):(p.push(o.definition.field),e=y-n),i.rowSpan=e,d[n].push(i),t--,e>1)for(var r=n+1;r<y;r++)d[r].push("");for(var r=0;r<t;r++)d[n].push("")}function r(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 a(o){o.forEach(function(o){h.push(u(o))})}function u(o,n){var t=[];return p.forEach(function(e){var i=f.getFieldValue(e,o);i=r(i),n?t.push({content:i,styles:n}):t.push(i)}),t}function l(o,n){var t=[];t.push({content:r(o.key),colSpan:p.length,styles:g}),h.push(t),o.subGroups?o.subGroups.forEach(function(t){l(t,n[o.key]?n[o.key].groups||{}:{})}):(i.columnCalcs&&c(n,o.key,"top"),a(o.rows),i.columnCalcs&&c(n,o.key,"bottom"))}function c(o,n,t){var e=o[n];e&&(t&&(e=e[t]),Object.keys(e).length&&h.push(u(e,b)))}var f=this,p=[],d=[],h=[],w={},y=1,m={},g=t.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},b=t.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},v=t.jsPDF||{},C=t&&t.title?t.title:"";if(i.columnCalcs&&(w=n.calcs,n=n.data),v.orientation||(v.orientation=t.orientation||"landscape"),v.unit||(v.unit="pt"),i.columnGroups){o.forEach(function(o){o.depth>y&&(y=o.depth)});for(var S=0;S<y;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?n.forEach(function(o){l(o,w)}):(i.columnCalcs&&c(w,"top"),a(n),i.columnCalcs&&c(w,"bottom"));var D=new jsPDF(v);t&&t.autoTable&&(m="function"==typeof t.autoTable?t.autoTable(D)||{}:t.autoTable),C&&(m.addPageContent=function(o){D.text(C,40,30)}),m.head=d,m.body=h,D.autoTable(m),t&&t.documentProcessing&&t.documentProcessing(D),e(D.output("arraybuffer"),"application/pdf")},xlsx:function(o,n,t,e,i){function s(){function t(o,n){void 0===w[n]&&(w[n]=[]),void 0===p[n]&&(p[n]=[]),o.width>1&&p[n].push({type:"hoz",start:w[n].length,end:w[n].length+o.width-1}),w[n].push(o.title),o.subGroups?o.subGroups.forEach(function(o){t(o,n+1)}):(y.push(o.definition.field),e(y.length),p[n].push({type:"vert",start:y.length-1}))}function e(){var o=0;w.forEach(function(n){var t=n.length;t>o&&(o=t)}),w.forEach(function(n){var t=n.length;if(t<o)for(var e=t;e<o;e++)n.push("")})}function s(){var o=[];return f.forEach(function(n){o.push({s:{r:n,c:0},e:{r:n,c:y.length-1}})}),p.forEach(function(n,t){n.forEach(function(n){"hoz"===n.type?o.push({s:{r:t,c:n.start},e:{r:t,c:n.end}}):t!=w.length-1&&o.push({s:{r:t,c:n.start},e:{r:w.length-1,c:n.start}})})}),o}function r(o){o.forEach(function(o){m.push(u(o))})}function u(o){var n=[];return y.forEach(function(t){var e=a.getFieldValue(t,o);n.push(e instanceof Date||"object"!==(void 0===e?"undefined":_typeof(e))?e:JSON.stringify(e))}),n}function l(o,n,t){var e=o[n];e&&(t&&(e=e[t]),Object.keys(e).length&&(d.push(m.length),m.push(u(e))))}function h(o,n){var t=[];t.push(o.key),f.push(m.length),m.push(t),o.subGroups?o.subGroups.forEach(function(t){h(t,n[o.key]?n[o.key].groups||{}:{})}):(i.columnCalcs&&l(n,o.key,"top"),r(o.rows),i.columnCalcs&&l(n,o.key,"bottom"))}var w=[],y=[],m=[];return i.columnGroups?(o.forEach(function(o){t(o,0)}),w.forEach(function(o){m.push(o)})):function(){o.forEach(function(o){w.push(o.title),y.push(o.field)}),m.push(w)}(),i.rowGroups?n.forEach(function(o){h(o,c)}):(i.columnCalcs&&l(c,"top"),r(n),i.columnCalcs&&l(c,"bottom")),function(){var o={},n={s:{c:0,r:0},e:{c:y.length,r:m.length}};XLSX.utils.sheet_add_aoa(o,m),o["!ref"]=XLSX.utils.encode_range(n);var t=s();return t.length&&(o["!merges"]=t),o}()}var r,a=this,u=t.sheetName||"Sheet1",l={SheetNames:[],Sheets:{}},c={},f=[],p=[],d=[];if(i.columnCalcs&&(c=n.calcs,n=n.data),t.sheetOnly)return void e(s());if(t.sheets)for(var h in t.sheets)!0===t.sheets[h]?(l.SheetNames.push(h),l.Sheets[h]=s()):(l.SheetNames.push(h),this.table.modules.comms.send(t.sheets[h],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},intercept:function(o){l.Sheets[h]=o}}));else l.SheetNames.push(u),l.Sheets[u]=s();r=XLSX.write(l,{bookType:"xlsx",bookSST:!0,type:"binary"}),e(function(o){for(var n=new ArrayBuffer(o.length),t=new Uint8Array(n),e=0;e!=o.length;++e)t[e]=255&o.charCodeAt(e);return n}(r),"application/octet-stream")}},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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -305,3 +305,3 @@ var Edit = function Edit(table) { | ||
input.setAttribute("type", "text"); | ||
input.setAttribute("type", editorParams.search ? "search" : "text"); | ||
@@ -351,3 +351,3 @@ input.style.padding = "4px"; | ||
cellValue = cell.getValue(), | ||
value = String(cellValue !== null && cellValue !== "undefined" ? cellValue : ""), | ||
value = String(cellValue !== null && typeof cellValue !== "undefined" ? cellValue : ""), | ||
count = (value.match(/(?:\r\n|\r|\n)/g) || []).length + 1, | ||
@@ -565,2 +565,4 @@ input = document.createElement("textarea"), | ||
this.table.rowManager.element.addEventListener("scroll", cancelItem); | ||
if (Array.isArray(editorParams) || !Array.isArray(editorParams) && (typeof editorParams === "undefined" ? "undefined" : _typeof(editorParams)) === "object" && !editorParams.values) { | ||
@@ -779,4 +781,10 @@ 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"); | ||
} | ||
removeScrollListener(); | ||
} | ||
function removeScrollListener() { | ||
self.table.rowManager.element.removeEventListener("scroll", cancelItem); | ||
} | ||
//style input | ||
@@ -788,3 +796,4 @@ input.setAttribute("type", "text"); | ||
input.style.boxSizing = "border-box"; | ||
input.readOnly = true; | ||
input.style.cursor = "default"; | ||
input.readOnly = this.currentCell != false; | ||
@@ -889,2 +898,4 @@ input.value = typeof initialValue !== "undefined" || initialValue === null ? initialValue : ""; | ||
this.table.rowManager.element.addEventListener("scroll", cancelItem); | ||
function getUniqueColumnValues() { | ||
@@ -1126,4 +1137,10 @@ var output = {}, | ||
} | ||
removeScrollListener(); | ||
} | ||
function removeScrollListener() { | ||
self.table.rowManager.element.removeEventListener("scroll", cancelItem); | ||
} | ||
//style input | ||
@@ -1130,0 +1147,0 @@ input.setAttribute("type", "search"); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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 WANRING - the tick editor has been depricated, 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 WANRING - the tick editor has been depricated, 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){this.recursionBlock=!0,"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(d.currentCell===e){var i=!0;e.column.modules.validate&&d.table.modExists("validate")&&(i=d.table.modules.validate.validate(e.column.modules.validate,e.getComponent(),t)),!0===i?(d.clearEditor(),e.setValue(t,!0),d.table.options.dataTree&&d.table.modExists("dataTree")&&d.table.modules.dataTree.checkForRestyle(e)):(d.invalidEdit=!0,m.classList.add("tabulator-validation-fail"),d.focusCellNoEvent(e),c(),d.table.options.validationFailed.call(d.table,e.getComponent(),t,i))}}function a(){d.currentCell===e&&(d.cancelEdit(),d.table.options.dataTree&&d.table.modExists("dataTree")&&d.table.modules.dataTree.checkForRestyle(e))}function o(e){c=e}var r,l,s,d=this,u=!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":u=e.column.modules.edit.check(e.getComponent());break;case"boolean":u=e.column.modules.edit.check}if(u||i){if(d.cancelEdit(),d.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),d.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(d,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 v=m.children,p=0;p<v.length;p++)v[p].addEventListener("click",function(e){e.stopPropagation()});return!0}return this.mouseClick=!1,m.blur(),!1},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):n()}var r=e.getValue(),l=document.createElement("input");return l.setAttribute("type","text"),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",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:i(l.value);break;case 27:n()}}),l},textarea:function(e,t,i,n,a){function o(t){(null===r||void 0===r)&&""!==s.value||s.value!=r?(i(s.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):n()}var r=e.getValue(),l=String(null!==r&&"undefined"!==r?r:""),s=(l.match(/(?:\r\n|\r|\n)/g),document.createElement("textarea")),d=0;return s.style.display="block",s.style.padding="2px",s.style.height="100%",s.style.width="100%",s.style.boxSizing="border-box",s.style.whiteSpace="pre-wrap",s.style.resize="none",s.value=l,t(function(){s.focus(),s.style.height="100%"}),s.addEventListener("change",o),s.addEventListener("blur",o),s.addEventListener("keyup",function(){s.style.height="";var t=s.scrollHeight;s.style.height=t+"px",t!=d&&(d=t,e.getRow().normalizeHeight())}),s.addEventListener("keydown",function(e){27==e.keyCode&&n()}),s},number:function(e,t,i,n,a){function o(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!=r?i(e):n()}var r=e.getValue(),l=document.createElement("input");l.setAttribute("type","number"),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",l.value=r;var s=function(e){o()};return t(function(){l.removeEventListener("blur",s),l.focus(),l.style.height="100%",l.addEventListener("blur",s)}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:case 9:o();break;case 27:n()}}),l},range:function(e,t,i,n,a){function o(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!=r?i(e):n()}var r=e.getValue(),l=document.createElement("input");return 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",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(){var t={},i=e.getColumn()._getSelf();return v.table.getData().forEach(function(e){var n=i.getFieldValue(e);null!==n&&void 0!==n&&""!==n&&(t[n]=!0)}),t=a.sortValuesList?"asc"==a.sortValuesList?Object.keys(t).sort():Object.keys(t).sort().reverse():Object.keys(t)}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 d in t){var u={label:a.listItemFormatter?a.listItemFormatter(d,t[d]):t[d],value:d,element:!1};u.value!==i&&(isNaN(parseFloat(u.value))||isNaN(parseFloat(u.value))||parseFloat(u.value)!==parseFloat(i))||s(u),o.push(u),r.push(u)}y=o,E=r,l()}function l(){for(;b.firstChild;)b.removeChild(b.firstChild);E.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),d()}),e===g&&t.classList.add("active")),t.addEventListener("mousedown",function(){k=!1,setTimeout(function(){k=!0},10)}),e.element=t),b.appendChild(t)})}function s(e){g&&g.element&&g.element.classList.remove("active"),g=e,h.value=" "===e.label?"":e.label,e.element&&e.element.classList.add("active")}function d(){m(),f!==g.value?(f=g.value,i(g.value)):n()}function u(){m(),n()}function c(){if(!b.parentNode){!0===a.values?r(o(),f):r(a.values||[],f);var e=Tabulator.prototype.helpers.elOffset(p);b.style.minWidth=p.offsetWidth+"px",b.style.top=e.top+p.offsetHeight+"px",b.style.left=e.left+"px",document.body.appendChild(b)}}function m(){b.parentNode&&b.parentNode.removeChild(b)}var v=this,p=e.getElement(),f=e.getValue(),h=document.createElement("input"),b=document.createElement("div"),y=[],E=[],g={},k=!0;return(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}),h.setAttribute("type","text"),h.style.padding="4px",h.style.width="100%",h.style.boxSizing="border-box",h.readOnly=!0,h.value=void 0!==f||null===f?f:"",!0===a.values?r(o(),f):r(a.values||[],f),h.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=y.indexOf(g),t>0&&s(y[t-1]);break;case 40:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=y.indexOf(g),t<y.length-1&&s(-1==t?y[0]:y[t+1]);break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:d();break;case 27:u()}}),h.addEventListener("blur",function(e){k&&u()}),h.addEventListener("focus",function(e){c()}),b=document.createElement("div"),b.classList.add("tabulator-edit-select-list"),t(function(){h.style.height="100%",h.focus()}),h},autocomplete:function(e,t,i,n,a){function o(){var t={},i=e.getColumn()._getSelf();return p.table.getData().forEach(function(e){var n=i.getFieldValue(e);null!==n&&void 0!==n&&""!==n&&(t[n]=!0)}),t=a.sortValuesList?"asc"==a.sortValuesList?Object.keys(t).sort():Object.keys(t).sort().reverse():Object.keys(t)}function r(e,t){var i=[];if(Array.isArray(e))e.forEach(function(e){var n={title:a.listItemFormatter?a.listItemFormatter(e,e):e,value:e,element:!1};n.value!==t&&(isNaN(parseFloat(n.value))||isNaN(parseFloat(n.value))||parseFloat(n.value)!==parseFloat(t))||d(n),i.push(n)});else for(var n in e){var o={title:a.listItemFormatter?a.listItemFormatter(n,e[n]):e[n],value:n,element:!1};o.value!==t&&(isNaN(parseFloat(o.value))||isNaN(parseFloat(o.value))||parseFloat(o.value)!==parseFloat(t))||d(o),i.push(o)}a.searchFunc&&i.forEach(function(e){e.search={title:e.title,value:e.value}}),E=i}function l(e,t){var i=[],n=[],o=[];a.searchFunc?(E.forEach(function(e){n.push(e.search)}),o=a.searchFunc(e,n),o.forEach(function(e){var t=E.find(function(t){return t.search===e});t&&i.push(t)})):""===e?a.showListOnEmpty&&E.forEach(function(e){i.push(e)}):E.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)&&i.push(t)}),g=i,s(t)}function s(e){for(var t=!1;y.firstChild;)y.removeChild(y.firstChild);g.forEach(function(i){var n=i.element;n||(n=document.createElement("div"),n.classList.add("tabulator-edit-select-list-item"),n.tabIndex=0,n.innerHTML=i.title,n.addEventListener("click",function(){d(i),u()}),n.addEventListener("mousedown",function(){L=!1,setTimeout(function(){L=!0},10)}),i.element=n,e&&i.value==h&&(b.value=i.title,i.element.classList.add("active"),t=!0),i===C&&(i.element.classList.add("active"),t=!0)),y.appendChild(n)}),t||d(!1)}function d(e,t){C&&C.element&&C.element.classList.remove("active"),C=e,e&&e.element&&e.element.classList.add("active")}function u(){v(),C?h!==C.value?(h=C.value,b.value=C.title,i(C.value)):n():a.freetext?(h=b.value,i(b.value)):a.allowEmpty&&""===b.value?(h=b.value,i(b.value)):n()}function c(){v(),n()}function m(){if(!y.parentNode){for(;y.firstChild;)y.removeChild(y.firstChild);k=!0===a.values?o():a.values||[],r(k,h);var e=Tabulator.prototype.helpers.elOffset(f);y.style.minWidth=f.offsetWidth+"px",y.style.top=e.top+f.offsetHeight+"px",y.style.left=e.left+"px",document.body.appendChild(y)}}function v(){y.parentNode&&y.parentNode.removeChild(y)}var p=this,f=e.getElement(),h=e.getValue(),b=document.createElement("input"),y=document.createElement("div"),E=[],g=[],k=[],C={},L=!0;return b.setAttribute("type","search"),b.style.padding="4px",b.style.width="100%",b.style.boxSizing="border-box",b.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=g.indexOf(C),d(t>0?g[t-1]:!1);break;case 40:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=g.indexOf(C),t<g.length-1&&d(-1==t?g[0]:g[t+1]);break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:u();break;case 27:c();break;case 36:case 35:e.stopImmediatePropagation()}}),b.addEventListener("keyup",function(e){switch(e.keyCode){case 38:case 37:case 39:case 40:case 13:case 27:break;default:l(b.value)}}),b.addEventListener("search",function(e){l(b.value)}),b.addEventListener("blur",function(e){L&&u()}),b.addEventListener("focus",function(e){var t=void 0!==h||null===h?h:"";m(),b.value=t,l(t,!0)}),y=document.createElement("div"),y.classList.add("tabulator-edit-select-list"),t(function(){b.style.height="100%",b.focus()}),b},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){d=e,o(e)}var l=this,s=e.getElement(),d=e.getValue(),u=s.getElementsByTagName("svg").length||5,c=s.getElementsByTagName("svg")[0]?s.getElementsByTagName("svg")[0].getAttribute("width"):14,m=[],v=document.createElement("div"),p=document.createElementNS("http://www.w3.org/2000/svg","svg");s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",v.style.verticalAlign="middle",v.style.display="inline-block",v.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";for(var f=1;f<=u;f++)!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),v.appendChild(t)}(f);return d=Math.min(parseInt(d),u),o(d),v.addEventListener("mousemove",function(e){o(0)}),v.addEventListener("click",function(e){i(0)}),s.addEventListener("blur",function(e){n()}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:r(d+1);break;case 37:r(d-1);break;case 13:i(d);break;case 27:n()}}),v},progress:function(e,t,i,n,a){function o(){var e=c*Math.round(p.offsetWidth/(s.clientWidth/100))+u;i(e),s.setAttribute("aria-valuenow",e),s.setAttribute("aria-label",m)}var r,l,s=e.getElement(),d=void 0===a.max?s.getElementsByTagName("div")[0].getAttribute("max")||100:a.max,u=void 0===a.min?s.getElementsByTagName("div")[0].getAttribute("min")||0:a.min,c=(d-u)/100,m=e.getValue()||0,v=document.createElement("div"),p=document.createElement("div");return v.style.position="absolute",v.style.right="0",v.style.top="0",v.style.bottom="0",v.style.width="5px",v.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%",s.style.padding="4px 4px",m=Math.min(parseFloat(m),d),m=Math.max(parseFloat(m),u),m=Math.round((m-u)/c),p.style.width=m+"%",s.setAttribute("aria-valuemin",u),s.setAttribute("aria-valuemax",d),p.appendChild(v),v.addEventListener("mousedown",function(e){r=e.screenX,l=p.offsetWidth}),v.addEventListener("mouseover",function(){v.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?u?d:l.checked:l.checked&&!u?(l.checked=!1,l.indeterminate=!0,u=!0,d):(u=!1,l.checked):l.checked}var r=e.getValue(),l=document.createElement("input"),s=a.tristate,d=void 0===a.indeterminateValue?null:a.indeterminateValue,u=!1;return l.setAttribute("type","checkbox"),l.style.marginTop="5px",l.style.boxSizing="border-box",l.value=r,!s||void 0!==r&&r!==d&&""!==r||(u=!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.3.0 (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 WANRING - the tick editor has been depricated, 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 WANRING - the tick editor has been depricated, 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){this.recursionBlock=!0,"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(d.currentCell===e){var i=!0;e.column.modules.validate&&d.table.modExists("validate")&&(i=d.table.modules.validate.validate(e.column.modules.validate,e.getComponent(),t)),!0===i?(d.clearEditor(),e.setValue(t,!0),d.table.options.dataTree&&d.table.modExists("dataTree")&&d.table.modules.dataTree.checkForRestyle(e)):(d.invalidEdit=!0,m.classList.add("tabulator-validation-fail"),d.focusCellNoEvent(e),c(),d.table.options.validationFailed.call(d.table,e.getComponent(),t,i))}}function a(){d.currentCell===e&&(d.cancelEdit(),d.table.options.dataTree&&d.table.modExists("dataTree")&&d.table.modules.dataTree.checkForRestyle(e))}function o(e){c=e}var r,l,s,d=this,u=!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":u=e.column.modules.edit.check(e.getComponent());break;case"boolean":u=e.column.modules.edit.check}if(u||i){if(d.cancelEdit(),d.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),d.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(d,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 v=m.children,f=0;f<v.length;f++)v[f].addEventListener("click",function(e){e.stopPropagation()});return!0}return this.mouseClick=!1,m.blur(),!1},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):n()}var r=e.getValue(),l=document.createElement("input");return l.setAttribute("type",a.search?"search":"text"),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",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:i(l.value);break;case 27:n()}}),l},textarea:function(e,t,i,n,a){function o(t){(null===r||void 0===r)&&""!==s.value||s.value!=r?(i(s.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):n()}var r=e.getValue(),l=String(null!==r&&void 0!==r?r:""),s=(l.match(/(?:\r\n|\r|\n)/g),document.createElement("textarea")),d=0;return s.style.display="block",s.style.padding="2px",s.style.height="100%",s.style.width="100%",s.style.boxSizing="border-box",s.style.whiteSpace="pre-wrap",s.style.resize="none",s.value=l,t(function(){s.focus(),s.style.height="100%"}),s.addEventListener("change",o),s.addEventListener("blur",o),s.addEventListener("keyup",function(){s.style.height="";var t=s.scrollHeight;s.style.height=t+"px",t!=d&&(d=t,e.getRow().normalizeHeight())}),s.addEventListener("keydown",function(e){27==e.keyCode&&n()}),s},number:function(e,t,i,n,a){function o(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!=r?i(e):n()}var r=e.getValue(),l=document.createElement("input");l.setAttribute("type","number"),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",l.value=r;var s=function(e){o()};return t(function(){l.removeEventListener("blur",s),l.focus(),l.style.height="100%",l.addEventListener("blur",s)}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:case 9:o();break;case 27:n()}}),l},range:function(e,t,i,n,a){function o(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!=r?i(e):n()}var r=e.getValue(),l=document.createElement("input");return 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",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(){var t={},i=e.getColumn()._getSelf();return f.table.getData().forEach(function(e){var n=i.getFieldValue(e);null!==n&&void 0!==n&&""!==n&&(t[n]=!0)}),t=a.sortValuesList?"asc"==a.sortValuesList?Object.keys(t).sort():Object.keys(t).sort().reverse():Object.keys(t)}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 d in t){var u={label:a.listItemFormatter?a.listItemFormatter(d,t[d]):t[d],value:d,element:!1};u.value!==i&&(isNaN(parseFloat(u.value))||isNaN(parseFloat(u.value))||parseFloat(u.value)!==parseFloat(i))||s(u),o.push(u),r.push(u)}E=o,g=r,l()}function l(){for(;y.firstChild;)y.removeChild(y.firstChild);g.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),d()}),e===k&&t.classList.add("active")),t.addEventListener("mousedown",function(){C=!1,setTimeout(function(){C=!0},10)}),e.element=t),y.appendChild(t)})}function s(e){k&&k.element&&k.element.classList.remove("active"),k=e,b.value=" "===e.label?"":e.label,e.element&&e.element.classList.add("active")}function d(){m(),h!==k.value?(h=k.value,i(k.value)):n()}function u(){m(),n()}function c(){if(!y.parentNode){!0===a.values?r(o(),h):r(a.values||[],h);var e=Tabulator.prototype.helpers.elOffset(p);y.style.minWidth=p.offsetWidth+"px",y.style.top=e.top+p.offsetHeight+"px",y.style.left=e.left+"px",document.body.appendChild(y)}}function m(){y.parentNode&&y.parentNode.removeChild(y),v()}function v(){f.table.rowManager.element.removeEventListener("scroll",u)}var f=this,p=e.getElement(),h=e.getValue(),b=document.createElement("input"),y=document.createElement("div"),E=[],g=[],k={},C=!0;return this.table.rowManager.element.addEventListener("scroll",u),(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}),b.setAttribute("type","text"),b.style.padding="4px",b.style.width="100%",b.style.boxSizing="border-box",b.style.cursor="default",b.readOnly=0!=this.currentCell,b.value=void 0!==h||null===h?h:"",!0===a.values?r(o(),h):r(a.values||[],h),b.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=E.indexOf(k),t>0&&s(E[t-1]);break;case 40:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=E.indexOf(k),t<E.length-1&&s(-1==t?E[0]:E[t+1]);break;case 37:case 39:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault();break;case 13:d();break;case 27:u()}}),b.addEventListener("blur",function(e){C&&u()}),b.addEventListener("focus",function(e){c()}),y=document.createElement("div"),y.classList.add("tabulator-edit-select-list"),t(function(){b.style.height="100%",b.focus()}),b},autocomplete:function(e,t,i,n,a){function o(){var t={},i=e.getColumn()._getSelf();return p.table.getData().forEach(function(e){var n=i.getFieldValue(e);null!==n&&void 0!==n&&""!==n&&(t[n]=!0)}),t=a.sortValuesList?"asc"==a.sortValuesList?Object.keys(t).sort():Object.keys(t).sort().reverse():Object.keys(t)}function r(e,t){var i=[];if(Array.isArray(e))e.forEach(function(e){var n={title:a.listItemFormatter?a.listItemFormatter(e,e):e,value:e,element:!1};n.value!==t&&(isNaN(parseFloat(n.value))||isNaN(parseFloat(n.value))||parseFloat(n.value)!==parseFloat(t))||d(n),i.push(n)});else for(var n in e){var o={title:a.listItemFormatter?a.listItemFormatter(n,e[n]):e[n],value:n,element:!1};o.value!==t&&(isNaN(parseFloat(o.value))||isNaN(parseFloat(o.value))||parseFloat(o.value)!==parseFloat(t))||d(o),i.push(o)}a.searchFunc&&i.forEach(function(e){e.search={title:e.title,value:e.value}}),g=i}function l(e,t){var i=[],n=[],o=[];a.searchFunc?(g.forEach(function(e){n.push(e.search)}),o=a.searchFunc(e,n),o.forEach(function(e){var t=g.find(function(t){return t.search===e});t&&i.push(t)})):""===e?a.showListOnEmpty&&g.forEach(function(e){i.push(e)}):g.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)&&i.push(t)}),k=i,s(t)}function s(e){for(var t=!1;E.firstChild;)E.removeChild(E.firstChild);k.forEach(function(i){var n=i.element;n||(n=document.createElement("div"),n.classList.add("tabulator-edit-select-list-item"),n.tabIndex=0,n.innerHTML=i.title,n.addEventListener("click",function(){d(i),u()}),n.addEventListener("mousedown",function(){w=!1,setTimeout(function(){w=!0},10)}),i.element=n,e&&i.value==b&&(y.value=i.title,i.element.classList.add("active"),t=!0),i===L&&(i.element.classList.add("active"),t=!0)),E.appendChild(n)}),t||d(!1)}function d(e,t){L&&L.element&&L.element.classList.remove("active"),L=e,e&&e.element&&e.element.classList.add("active")}function u(){v(),L?b!==L.value?(b=L.value,y.value=L.title,i(L.value)):n():a.freetext?(b=y.value,i(y.value)):a.allowEmpty&&""===y.value?(b=y.value,i(y.value)):n()}function c(){v(),n()}function m(){if(!E.parentNode){for(;E.firstChild;)E.removeChild(E.firstChild);C=!0===a.values?o():a.values||[],r(C,b);var e=Tabulator.prototype.helpers.elOffset(h);E.style.minWidth=h.offsetWidth+"px",E.style.top=e.top+h.offsetHeight+"px",E.style.left=e.left+"px",document.body.appendChild(E)}}function v(){E.parentNode&&E.parentNode.removeChild(E),f()}function f(){p.table.rowManager.element.removeEventListener("scroll",c)}var p=this,h=e.getElement(),b=e.getValue(),y=document.createElement("input"),E=document.createElement("div"),g=[],k=[],C=[],L={},w=!0;return this.table.rowManager.element.addEventListener("scroll",c),y.setAttribute("type","search"),y.style.padding="4px",y.style.width="100%",y.style.boxSizing="border-box",y.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=k.indexOf(L),d(t>0?k[t-1]:!1);break;case 40:e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t=k.indexOf(L),t<k.length-1&&d(-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:c();break;case 36:case 35:e.stopImmediatePropagation()}}),y.addEventListener("keyup",function(e){switch(e.keyCode){case 38:case 37:case 39:case 40:case 13:case 27:break;default:l(y.value)}}),y.addEventListener("search",function(e){l(y.value)}),y.addEventListener("blur",function(e){w&&u()}),y.addEventListener("focus",function(e){var t=void 0!==b||null===b?b:"";m(),y.value=t,l(t,!0)}),E=document.createElement("div"),E.classList.add("tabulator-edit-select-list"),t(function(){y.style.height="100%",y.focus()}),y},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){d=e,o(e)}var l=this,s=e.getElement(),d=e.getValue(),u=s.getElementsByTagName("svg").length||5,c=s.getElementsByTagName("svg")[0]?s.getElementsByTagName("svg")[0].getAttribute("width"):14,m=[],v=document.createElement("div"),f=document.createElementNS("http://www.w3.org/2000/svg","svg");s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",v.style.verticalAlign="middle",v.style.display="inline-block",v.style.padding="4px",f.setAttribute("width",c),f.setAttribute("height",c),f.setAttribute("viewBox","0 0 512 512"),f.setAttribute("xml:space","preserve"),f.style.padding="0 1px";for(var p=1;p<=u;p++)!function(e){var t=document.createElement("span"),n=f.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),v.appendChild(t)}(p);return d=Math.min(parseInt(d),u),o(d),v.addEventListener("mousemove",function(e){o(0)}),v.addEventListener("click",function(e){i(0)}),s.addEventListener("blur",function(e){n()}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:r(d+1);break;case 37:r(d-1);break;case 13:i(d);break;case 27:n()}}),v},progress:function(e,t,i,n,a){function o(){var e=c*Math.round(f.offsetWidth/(s.clientWidth/100))+u;i(e),s.setAttribute("aria-valuenow",e),s.setAttribute("aria-label",m)}var r,l,s=e.getElement(),d=void 0===a.max?s.getElementsByTagName("div")[0].getAttribute("max")||100:a.max,u=void 0===a.min?s.getElementsByTagName("div")[0].getAttribute("min")||0:a.min,c=(d-u)/100,m=e.getValue()||0,v=document.createElement("div"),f=document.createElement("div");return v.style.position="absolute",v.style.right="0",v.style.top="0",v.style.bottom="0",v.style.width="5px",v.classList.add("tabulator-progress-handle"),f.style.display="inline-block",f.style.position="relative",f.style.height="100%",f.style.backgroundColor="#488CE9",f.style.maxWidth="100%",f.style.minWidth="0%",s.style.padding="4px 4px",m=Math.min(parseFloat(m),d),m=Math.max(parseFloat(m),u),m=Math.round((m-u)/c),f.style.width=m+"%",s.setAttribute("aria-valuemin",u),s.setAttribute("aria-valuemax",d),f.appendChild(v),v.addEventListener("mousedown",function(e){r=e.screenX,l=f.offsetWidth}),v.addEventListener("mouseover",function(){v.style.cursor="ew-resize"}),s.addEventListener("mousemove",function(e){r&&(f.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:f.style.width=f.clientWidth+s.clientWidth/100+"px";break;case 37:f.style.width=f.clientWidth-s.clientWidth/100+"px";break;case 13:o();break;case 27:n()}}),s.addEventListener("blur",function(){n()}),f},tickCross:function(e,t,i,n,a){function o(e){return s?e?u?d:l.checked:l.checked&&!u?(l.checked=!1,l.indeterminate=!0,u=!0,d):(u=!1,l.checked):l.checked}var r=e.getValue(),l=document.createElement("input"),s=a.tristate,d=void 0===a.indeterminateValue?null:a.indeterminateValue,u=!1;return l.setAttribute("type","checkbox"),l.style.marginTop="5px",l.style.boxSizing="border-box",l.value=r,!s||void 0!==r&&r!==d&&""!==r||(u=!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); |
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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -459,13 +459,8 @@ var Filter = function Filter(table) { | ||
Filter.prototype.getFilters = function (all, ajax) { | ||
var self = this, | ||
output = []; | ||
var output = []; | ||
if (all) { | ||
output = self.getHeaderFilters(); | ||
output = this.getHeaderFilters(); | ||
} | ||
self.filterList.forEach(function (filter) { | ||
output.push({ field: filter.field, type: filter.type, value: filter.value }); | ||
}); | ||
if (ajax) { | ||
@@ -479,5 +474,34 @@ output.forEach(function (item) { | ||
output = output.concat(this.filtersToArray(this.filterList, ajax)); | ||
return output; | ||
}; | ||
//filter to Object | ||
Filter.prototype.filtersToArray = function (filterList, ajax) { | ||
var _this2 = this; | ||
var output = []; | ||
filterList.forEach(function (filter) { | ||
var item; | ||
if (Array.isArray(filter)) { | ||
output.push(_this2.filtersToArray(filter, ajax)); | ||
} else { | ||
item = { field: filter.field, type: filter.type, value: filter.value }; | ||
if (ajax) { | ||
if (typeof item.type == "function") { | ||
item.type = "function"; | ||
} | ||
} | ||
output.push(item); | ||
} | ||
}); | ||
return output; | ||
}; | ||
//get all filters | ||
@@ -484,0 +508,0 @@ Filter.prototype.getHeaderFilters = function () { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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.headerFilterElements=[],this.headerFilterColumns=[],this.changed=!1};Filter.prototype.initializeColumn=function(e,t){function i(t){var i,o="input"==e.modules.filter.tagType&&"text"==e.modules.filter.attrType||"textarea"==e.modules.filter.tagType?"partial":"match",a="";if(void 0===r||r!==t){if(r=t,e.modules.filter.emptyFunc(t))delete n.headerFilters[l];else{switch(e.modules.filter.value=t,_typeof(e.definition.headerFilterFunc)){case"string":n.filters[e.definition.headerFilterFunc]?(a=e.definition.headerFilterFunc,i=function(i){var r=e.definition.headerFilterFuncParams||{},l=e.getFieldValue(i);return r="function"==typeof r?r(t,l,i):r,n.filters[e.definition.headerFilterFunc](t,l,i,r)}):console.warn("Header Filter Error - Matching filter function not found: ",e.definition.headerFilterFunc);break;case"function":i=function(i){var r=e.definition.headerFilterFuncParams||{},n=e.getFieldValue(i);return r="function"==typeof r?r(t,n,i):r,e.definition.headerFilterFunc(t,n,i,r)},a=i}if(!i)switch(o){case"partial":i=function(i){var r=e.getFieldValue(i);return void 0!==r&&null!==r&&String(r).toLowerCase().indexOf(String(t).toLowerCase())>-1},a="like";break;default:i=function(i){return e.getFieldValue(i)==t},a="="}n.headerFilters[l]={value:t,func:i,type:a}}n.changed=!0,n.table.rowManager.filterRefresh()}}var r,n=this,l=e.getField();e.modules.filter={success:i,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)},Filter.prototype.generateHeaderFilterElement=function(e,t){function i(){}var r,n,l,o,a,s,d,u=this,f=this,c=e.modules.filter.success,h=e.getField();if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode){var p=e.modules.filter.headerElement.parentNode,F=f.headerFilterElements.indexOf(p);F>=0&&f.headerFilterElements.splice(F,1);var m=f.headerFilterColumns.indexOf(m);m>=0&&f.headerFilterColumns.splice(m,1),e.contentElement.removeChild(p)}if(h){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(e){return!e&&"0"!==e},r=document.createElement("div"),r.classList.add("tabulator-header-filter"),_typeof(e.definition.headerFilter)){case"string":f.table.modules.edit.editors[e.definition.headerFilter]?(n=f.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":n=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?n=e.modules.edit.editor:e.definition.formatter&&f.table.modules.edit.editors[e.definition.formatter]?(n=f.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})):n=f.table.modules.edit.editors.input}if(n){if(o={getValue:function(){return void 0!==t?t:""},getField:function(){return e.definition.field},getElement:function(){return r},getColumn:function(){return e.getComponent()},getRow:function(){return{normalizeHeight:function(){}}}},d=e.definition.headerFilterParams||{},d="function"==typeof d?d.call(f.table):d,!(l=n.call(this.table.modules.edit,o,function(){},c,i,d)))return void console.warn("Filter Error - Cannot add filter to "+h+" column, editor returned a value of false");if(!(l instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+h+" column, editor should return an instance of Node, the editor returned:",l);h?f.table.modules.localize.bind("headerFilters|columns|"+e.definition.field,function(e){l.setAttribute("placeholder",void 0!==e&&e?e:f.table.modules.localize.getText("headerFilters|default"))}):f.table.modules.localize.bind("headerFilters|default",function(e){l.setAttribute("placeholder",void 0!==f.column.definition.headerFilterPlaceholder&&f.column.definition.headerFilterPlaceholder?f.column.definition.headerFilterPlaceholder:e)}),l.addEventListener("click",function(e){e.stopPropagation(),l.focus()}),l.addEventListener("focus",function(e){var t=u.table.columnManager.element.scrollLeft;t!==u.table.rowManager.element.scrollLeft&&(u.table.rowManager.scrollHorizontal(t),u.table.columnManager.scrollHorizontal(t))}),a=!1,s=function(e){a&&clearTimeout(a),a=setTimeout(function(){c(l.value)},300)},e.modules.filter.headerElement=l,e.modules.filter.attrType=l.hasAttribute("type")?l.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=l.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)&&(l.addEventListener("keyup",s),l.addEventListener("search",s),"number"==e.modules.filter.attrType&&l.addEventListener("change",function(e){c(l.value)}),"text"==e.modules.filter.attrType&&"ie"!==this.table.browser&&l.setAttribute("type","search")),"input"!=e.modules.filter.tagType&&"select"!=e.modules.filter.tagType&&"textarea"!=e.modules.filter.tagType||l.addEventListener("mousedown",function(e){e.stopPropagation()})),r.appendChild(l),e.contentElement.appendChild(r),f.headerFilterElements.push(l),f.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.headerFilterElements.forEach(function(e){e.style.display="none"})},Filter.prototype.showHeaderFilterElements=function(){this.headerFilterElements.forEach(function(e){e.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.setHeaderFilterValue=function(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t),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):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,i){var r=this;r.filterList=[],Array.isArray(e)||(e=[{field:e,type:t,value:i}]),r.addFilter(e)},Filter.prototype.addFilter=function(e,t,i){var r=this;Array.isArray(e)||(e=[{field:e,type:t,value:i}]),e.forEach(function(e){(e=r.findFilter(e))&&(r.filterList.push(e),r.changed=!0)}),this.table.options.persistentFilter&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("filter")},Filter.prototype.findFilter=function(e){var t,i=this;if(Array.isArray(e))return this.findSubFilters(e);var r=!1;return"function"==typeof e.field?r=function(t){return e.field(t,e.type||{})}:i.filters[e.type]?(t=i.table.columnManager.getColumnByField(e.field),r=t?function(r){return i.filters[e.type](e.value,t.getFieldValue(r))}:function(t){return i.filters[e.type](e.value,t[e.field])}):console.warn("Filter Error - No such filter type found, ignoring: ",e.type),e.func=r,!!e.func&&e},Filter.prototype.findSubFilters=function(e){var t=this,i=[];return e.forEach(function(e){(e=t.findFilter(e))&&i.push(e)}),!!i.length&&i},Filter.prototype.getFilters=function(e,t){var i=this,r=[];return e&&(r=i.getHeaderFilters()),i.filterList.forEach(function(e){r.push({field:e.field,type:e.type,value:e.value})}),t&&r.forEach(function(e){"function"==typeof e.type&&(e.type="function")}),r},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,i){var r=this;Array.isArray(e)||(e=[{field:e,type:t,value:i}]),e.forEach(function(e){var t=-1;t="object"==_typeof(e.field)?r.filterList.findIndex(function(t){return e===t}):r.filterList.findIndex(function(t){return e.field===t.field&&e.type===t.type&&e.value===t.value}),t>-1?(r.filterList.splice(t,1),r.changed=!0):console.warn("Filter Error - No matching filter type found, ignoring: ",e.type)}),this.table.options.persistentFilter&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("filter")},Filter.prototype.clearFilter=function(e){this.filterList=[],e&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistentFilter&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("filter")},Filter.prototype.clearHeaderFilter=function(){var e=this;this.headerFilters={},this.headerFilterColumns.forEach(function(t){t.modules.filter.value=null,e.reloadHeaderFilter(t)}),this.changed=!0},Filter.prototype.search=function(e,t,i,r){var n=this,l=[],o=[];return Array.isArray(t)||(t=[{field:t,type:i,value:r}]),t.forEach(function(e){(e=n.findFilter(e))&&o.push(e)}),this.table.rowManager.rows.forEach(function(t){var i=!0;o.forEach(function(e){n.filterRecurse(e,t.getData())||(i=!1)}),i&&l.push("data"===e?t.getData("data"):t.getComponent())}),l},Filter.prototype.filter=function(e,t){var i=this,r=[],n=[];return i.table.options.dataFiltering&&i.table.options.dataFiltering.call(i.table,i.getFilters()),i.table.options.ajaxFiltering||!i.filterList.length&&!Object.keys(i.headerFilters).length?r=e.slice(0):e.forEach(function(e){i.filterRow(e)&&r.push(e)}),i.table.options.dataFiltered&&(r.forEach(function(e){n.push(e.getComponent())}),i.table.options.dataFiltered.call(i.table,i.getFilters(),n)),r},Filter.prototype.filterRow=function(e,t){var i=this,r=!0,n=e.getData();i.filterList.forEach(function(e){i.filterRecurse(e,n)||(r=!1)});for(var l in i.headerFilters)i.headerFilters[l].func(n)||(r=!1);return r},Filter.prototype.filterRecurse=function(e,t){var i=this,r=!1;return Array.isArray(e)?e.forEach(function(e){i.filterRecurse(e,t)&&(r=!0)}):r=e.func(t),r},Filter.prototype.filters={"=":function(e,t,i,r){return t==e},"<":function(e,t,i,r){return t<e},"<=":function(e,t,i,r){return t<=e},">":function(e,t,i,r){return t>e},">=":function(e,t,i,r){return t>=e},"!=":function(e,t,i,r){return t!=e},regex:function(e,t,i,r){return"string"==typeof e&&(e=new RegExp(e)),e.test(t)},like:function(e,t,i,r){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().indexOf(e.toLowerCase())>-1},in:function(e,t,i,r){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); | ||
/* Tabulator v4.3.0 (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.headerFilterElements=[],this.headerFilterColumns=[],this.changed=!1};Filter.prototype.initializeColumn=function(e,t){function r(t){var r,o="input"==e.modules.filter.tagType&&"text"==e.modules.filter.attrType||"textarea"==e.modules.filter.tagType?"partial":"match",a="";if(void 0===i||i!==t){if(i=t,e.modules.filter.emptyFunc(t))delete n.headerFilters[l];else{switch(e.modules.filter.value=t,_typeof(e.definition.headerFilterFunc)){case"string":n.filters[e.definition.headerFilterFunc]?(a=e.definition.headerFilterFunc,r=function(r){var i=e.definition.headerFilterFuncParams||{},l=e.getFieldValue(r);return i="function"==typeof i?i(t,l,r):i,n.filters[e.definition.headerFilterFunc](t,l,r,i)}):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)},a=r}if(!r)switch(o){case"partial":r=function(r){var i=e.getFieldValue(r);return void 0!==i&&null!==i&&String(i).toLowerCase().indexOf(String(t).toLowerCase())>-1},a="like";break;default:r=function(r){return e.getFieldValue(r)==t},a="="}n.headerFilters[l]={value:t,func:r,type:a}}n.changed=!0,n.table.rowManager.filterRefresh()}}var i,n=this,l=e.getField();e.modules.filter={success:r,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)},Filter.prototype.generateHeaderFilterElement=function(e,t){function r(){}var i,n,l,o,a,s,d,u=this,f=this,c=e.modules.filter.success,h=e.getField();if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode){var p=e.modules.filter.headerElement.parentNode,F=f.headerFilterElements.indexOf(p);F>=0&&f.headerFilterElements.splice(F,1);var m=f.headerFilterColumns.indexOf(m);m>=0&&f.headerFilterColumns.splice(m,1),e.contentElement.removeChild(p)}if(h){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(e){return!e&&"0"!==e},i=document.createElement("div"),i.classList.add("tabulator-header-filter"),_typeof(e.definition.headerFilter)){case"string":f.table.modules.edit.editors[e.definition.headerFilter]?(n=f.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":n=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?n=e.modules.edit.editor:e.definition.formatter&&f.table.modules.edit.editors[e.definition.formatter]?(n=f.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})):n=f.table.modules.edit.editors.input}if(n){if(o={getValue:function(){return void 0!==t?t:""},getField:function(){return e.definition.field},getElement:function(){return i},getColumn:function(){return e.getComponent()},getRow:function(){return{normalizeHeight:function(){}}}},d=e.definition.headerFilterParams||{},d="function"==typeof d?d.call(f.table):d,!(l=n.call(this.table.modules.edit,o,function(){},c,r,d)))return void console.warn("Filter Error - Cannot add filter to "+h+" column, editor returned a value of false");if(!(l instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+h+" column, editor should return an instance of Node, the editor returned:",l);h?f.table.modules.localize.bind("headerFilters|columns|"+e.definition.field,function(e){l.setAttribute("placeholder",void 0!==e&&e?e:f.table.modules.localize.getText("headerFilters|default"))}):f.table.modules.localize.bind("headerFilters|default",function(e){l.setAttribute("placeholder",void 0!==f.column.definition.headerFilterPlaceholder&&f.column.definition.headerFilterPlaceholder?f.column.definition.headerFilterPlaceholder:e)}),l.addEventListener("click",function(e){e.stopPropagation(),l.focus()}),l.addEventListener("focus",function(e){var t=u.table.columnManager.element.scrollLeft;t!==u.table.rowManager.element.scrollLeft&&(u.table.rowManager.scrollHorizontal(t),u.table.columnManager.scrollHorizontal(t))}),a=!1,s=function(e){a&&clearTimeout(a),a=setTimeout(function(){c(l.value)},300)},e.modules.filter.headerElement=l,e.modules.filter.attrType=l.hasAttribute("type")?l.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=l.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)&&(l.addEventListener("keyup",s),l.addEventListener("search",s),"number"==e.modules.filter.attrType&&l.addEventListener("change",function(e){c(l.value)}),"text"==e.modules.filter.attrType&&"ie"!==this.table.browser&&l.setAttribute("type","search")),"input"!=e.modules.filter.tagType&&"select"!=e.modules.filter.tagType&&"textarea"!=e.modules.filter.tagType||l.addEventListener("mousedown",function(e){e.stopPropagation()})),i.appendChild(l),e.contentElement.appendChild(i),f.headerFilterElements.push(l),f.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.headerFilterElements.forEach(function(e){e.style.display="none"})},Filter.prototype.showHeaderFilterElements=function(){this.headerFilterElements.forEach(function(e){e.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.setHeaderFilterValue=function(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t),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):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.persistentFilter&&this.table.modExists("persistence",!0)&&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.persistentFilter&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("filter")},Filter.prototype.clearFilter=function(e){this.filterList=[],e&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistentFilter&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.save("filter")},Filter.prototype.clearHeaderFilter=function(){var e=this;this.headerFilters={},this.headerFilterColumns.forEach(function(t){t.modules.filter.value=null,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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Format = function Format(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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){var t=this,r={params:e.definition.formatterParams||{}};switch(_typeof(e.definition.formatter)){case"string":"tick"===e.definition.formatter&&(e.definition.formatter="tickCross",void 0===r.params.crossElement&&(r.params.crossElement=!1),console.warn("DEPRECATION WANRING - the tick formatter has been depricated, please use the tickCross formatter with the crossElement param set to false")),t.formatters[e.definition.formatter]?r.formatter=t.formatters[e.definition.formatter]:(console.warn("Formatter Error - No such formatter found: ",e.definition.formatter),r.formatter=t.formatters.plaintext);break;case"function":r.formatter=e.definition.formatter;break;default:r.formatter=t.formatters.plaintext}e.modules.format=r},Format.prototype.cellRendered=function(e){e.column.modules.format.renderedCallback&&e.column.modules.format.renderedCallback()},Format.prototype.formatValue=function(e){function t(t){e.column.modules.format.renderedCallback=t}var r=e.getComponent(),a="function"==typeof e.column.modules.format.params?e.column.modules.format.params(r):e.column.modules.format.params;return e.column.modules.format.formatter.call(this,r,a,t)},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,r){return this.emptyToSpace(this.sanitizeHTML(e.getValue()))},html:function(e,t,r){return e.getValue()},textarea:function(e,t,r){return e.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(e.getValue()))},money:function(e,t,r){var a,o,i,n,l=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(l))return this.emptyToSpace(this.sanitizeHTML(e.getValue()));for(a=!1!==m?l.toFixed(m):l,a=String(a).split("."),o=a[0],i=a.length>1?s+a[1]:"",n=/(\d+)(\d{3})/;n.test(o);)o=o.replace(n,"$1"+c+"$2");return d?o+i+u:u+o+i},link:function(e,t,r){var a,o=e.getValue(),i=t.urlPrefix||"",n=this.emptyToSpace(o),l=document.createElement("a");if(t.labelField&&(a=e.getData(),n=a[t.labelField]),t.label)switch(_typeof(t.label)){case"string":n=t.label;break;case"function":n=t.label(e)}if(t.urlField&&(a=e.getData(),o=a[t.urlField]),t.url)switch(_typeof(t.url)){case"string":o=t.url;break;case"function":o=t.url(e)}return l.setAttribute("href",i+o),t.target&&l.setAttribute("target",t.target),l.innerHTML=this.emptyToSpace(this.sanitizeHTML(n)),l},image:function(e,t,r){var a=document.createElement("img");switch(a.setAttribute("src",e.getValue()),_typeof(t.height)){case"number":a.style.height=t.height+"px";break;case"string":a.style.height=t.height}switch(_typeof(t.width)){case"number":a.style.width=t.width+"px";break;case"string":a.style.width=t.width}return a.addEventListener("load",function(){e.getRow().normalizeHeight()}),a},tickCross:function(e,t,r){var a=e.getValue(),o=e.getElement(),i=t.allowEmpty,n=t.allowTruthy,l=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&&a||!0===a||"true"===a||"True"===a||1===a||"1"===a?(o.setAttribute("aria-checked",!0),l||""):!i||"null"!==a&&""!==a&&null!==a&&void 0!==a?(o.setAttribute("aria-checked",!1),s||""):(o.setAttribute("aria-checked","mixed"),"")},datetime:function(e,t,r){var a=t.inputFormat||"YYYY-MM-DD hh:mm:ss",o=t.outputFormat||"DD/MM/YYYY hh:mm:ss",i=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",n=e.getValue(),l=moment(n,a);return l.isValid()?l.format(o):!0===i?n:"function"==typeof i?i(n):i},datetimediff:function(e,t,r){var a=t.inputFormat||"YYYY-MM-DD hh:mm:ss",o=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",i=void 0!==t.suffix&&t.suffix,n=void 0!==t.unit?t.unit:void 0,l=void 0!==t.humanize&&t.humanize,s=void 0!==t.date?t.date:moment(),c=e.getValue(),u=moment(c,a);return u.isValid()?l?moment.duration(u.diff(s)).humanize(i):u.diff(s,n)+(i?" "+i:""):!0===o?c:"function"==typeof o?o(c):o},lookup:function(e,t,r){var a=e.getValue();return void 0===t[a]?(console.warn("Missing display value for "+a),a):t[a]},star:function(e,t,r){var a=e.getValue(),o=e.getElement(),i=t&&t.stars?t.stars:5,n=document.createElement("span"),l=document.createElementNS("http://www.w3.org/2000/svg","svg");n.style.verticalAlign="middle",l.setAttribute("width","14"),l.setAttribute("height","14"),l.setAttribute("viewBox","0 0 512 512"),l.setAttribute("xml:space","preserve"),l.style.padding="0 1px",a=parseInt(a)<i?parseInt(a):i;for(var s=1;s<=i;s++){var c=l.cloneNode(!0);c.innerHTML=s<=a?'<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 o.style.whiteSpace="nowrap",o.style.overflow="hidden",o.style.textOverflow="ellipsis",o.setAttribute("aria-label",a),n},traffic:function(e,t,r){var a,o,i=this.sanitizeHTML(e.getValue())||0,n=document.createElement("span"),l=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(i)&&void 0!==e.getValue()){switch(n.classList.add("tabulator-traffic-light"),o=parseFloat(i)<=l?parseFloat(i):l,o=parseFloat(o)>=s?parseFloat(o):s,a=(l-s)/100,o=Math.round((o-s)/a),void 0===c?"undefined":_typeof(c)){case"string":u=c;break;case"function":u=c(i);break;case"object":if(Array.isArray(c)){var d=100/c.length,m=Math.floor(o/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,r){var a,o,i,n,l,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(o=parseFloat(s)<=u?parseFloat(s):u,o=parseFloat(o)>=d?parseFloat(o):d,a=(u-d)/100,o=Math.round((o-d)/a),_typeof(t.color)){case"string":i=t.color;break;case"function":i=t.color(s);break;case"object":if(Array.isArray(t.color)){var f=100/t.color.length,p=Math.floor(o/f);p=Math.min(p,t.color.length-1),p=Math.max(p,0),i=t.color[p];break}default:i="#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":l=t.legendColor;break;case"function":l=t.legendColor(s);break;case"object":if(Array.isArray(t.legendColor)){var f=100/t.legendColor.length,p=Math.floor(o/f);p=Math.min(p,t.legendColor.length-1),p=Math.max(p,0),l=t.legendColor[p]}break;default:l="#000"}return c.style.minWidth="30px",c.style.position="relative",c.setAttribute("aria-label",o),"<div style='position:realtive; height:100%;' data-max='"+u+"' data-min='"+d+"'><div style='position:relative; height:100%; width:calc("+o+"%); background-color:"+i+"; display:inline-block;'></div></div>"+(n?"<div style='position:absolute; top:4px; left:0; text-align:"+m+"; width:100%; color:"+l+";'>"+n+"</div>":"")},color:function(e,t,r){return e.getElement().style.backgroundColor=this.sanitizeHTML(e.getValue()),""},buttonTick:function(e,t,r){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,r){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,r){return this.table.rowManager.activeRows.indexOf(e.getRow()._getSelf())+1},handle:function(e,t,r){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,r){function a(t){var r=e.getRow().getElement().getElementsByClassName("tabulator-responsive-collapse")[0];i=t,i?(n.classList.add("open"),r&&(r.style.display="")):(n.classList.remove("open"),r&&(r.style.display="none"))}var o=this,i=!1,n=document.createElement("div");return n.classList.add("tabulator-responsive-collapse-toggle"),n.innerHTML="<span class='tabulator-responsive-collapse-toggle-open'>+</span><span class='tabulator-responsive-collapse-toggle-close'>-</span>",e.getElement().classList.add("tabulator-row-handle"),o.table.options.responsiveLayoutCollapseStartOpen&&(i=!0),n.addEventListener("click",function(e){e.stopImmediatePropagation(),a(!i)}),a(i),n}},Tabulator.prototype.registerModule("format",Format); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var FrozenColumns = function FrozenColumns(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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 o={margin:0,edge:!1};t.definition.frozen?t.parent.isGroup?console.warn("Frozen Column Error - Grouped columns cannot be frozen"):t.isGroup?console.warn("Frozen Column Error - Column Groups cannot be frozen"):(o.position=this.initializationMode,"left"==this.initializationMode?this.leftColumns.push(t):this.rightColumns.unshift(t),this.active=!0,t.modules.frozen=o):this.initializationMode="right"},FrozenColumns.prototype.scrollHorizontal=function(){var t,o=this;this.active&&(clearTimeout(this.scrollEndTimer),this.scrollEndTimer=setTimeout(function(){o.layout()},100),t=this.table.rowManager.getVisibleRows(),this.calcMargins(),this.layoutColumnPosition(),this.layoutCalcRows(),t.forEach(function(t){"row"===t.type&&o.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 o=this;this.leftColumns.forEach(function(e,n){e.modules.frozen.margin=o._calcSpace(o.leftColumns,n)+o.table.columnManager.scrollLeft+"px",n==o.leftColumns.length-1?e.modules.frozen.edge=!0:e.modules.frozen.edge=!1,o.layoutElement(e.getElement(),e),t&&e.cells.forEach(function(t){o.layoutElement(t.getElement(),e)})}),this.rightColumns.forEach(function(e,n){e.modules.frozen.margin=o.rightPadding-o._calcSpace(o.rightColumns,n+1)+"px",n==o.rightColumns.length-1?e.modules.frozen.edge=!0:e.modules.frozen.edge=!1,o.layoutElement(e.getElement(),e),t&&e.cells.forEach(function(t){o.layoutElement(t.getElement(),e)})})},FrozenColumns.prototype.layout=function(){var t=this;t.active&&(this.calcMargins(),t.table.rowManager.getDisplayRows().forEach(function(o){"row"===o.type&&t.layoutRow(o)}),this.layoutCalcRows(),this.layoutColumnPosition(!0),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},FrozenColumns.prototype.layoutRow=function(t){var o=this;t.getElement().style.paddingLeft=this.leftMargin,this.leftColumns.forEach(function(e){var n=t.getCell(e);n&&o.layoutElement(n.getElement(),e)}),this.rightColumns.forEach(function(e){var n=t.getCell(e);n&&o.layoutElement(n.getElement(),e)})},FrozenColumns.prototype.layoutElement=function(t,o){o.modules.frozen&&(t.style.position="absolute",t.style.left=o.modules.frozen.margin,t.classList.add("tabulator-frozen"),o.modules.frozen.edge&&t.classList.add("tabulator-frozen-"+o.modules.frozen.position))},FrozenColumns.prototype._calcSpace=function(t,o){for(var e=0,n=0;n<o;n++)t[n].visible&&(e+=t[n].getWidth());return e},Tabulator.prototype.registerModule("frozenColumns",FrozenColumns); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var FrozenRows = function FrozenRows(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -160,3 +160,3 @@ //public group object | ||
tap = true; | ||
}); | ||
}, { passive: true }); | ||
@@ -206,3 +206,3 @@ self.element.addEventListener("touchend", function (e) { | ||
}, 1000); | ||
}); | ||
}, { passive: true }); | ||
@@ -379,3 +379,2 @@ self.element.addEventListener("touchend", function (e) { | ||
if (this.visible) { | ||
if (this.groupList.length) { | ||
@@ -389,2 +388,3 @@ this.groupList.forEach(function (group) { | ||
this.calcs.top.detachElement(); | ||
this.calcs.top.deleteCells(); | ||
} | ||
@@ -399,5 +399,5 @@ | ||
if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { | ||
if (this.calcs.bottom) { | ||
this.calcs.bottom.detachElement(); | ||
this.calcs.bottom.deleteCells(); | ||
} | ||
@@ -410,10 +410,16 @@ | ||
} else { | ||
if (!this.groupList.length && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.options.groupClosedShowCalcs) { | ||
if (!this.groupList.length && this.groupManager.table.options.columnCalcs != "table") { | ||
if (this.groupManager.table.modExists("columnCalcs")) { | ||
if (!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { | ||
if (this.calcs.top) { | ||
this.calcs.top.detachElement(); | ||
this.calcs.top.deleteCells(); | ||
} | ||
this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); | ||
output.push(this.calcs.top); | ||
if (this.groupManager.table.options.groupClosedShowCalcs) { | ||
this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); | ||
output.push(this.calcs.top); | ||
} | ||
} | ||
@@ -424,5 +430,9 @@ | ||
this.calcs.bottom.detachElement(); | ||
this.calcs.bottom.deleteCells(); | ||
} | ||
this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); | ||
output.push(this.calcs.bottom); | ||
if (this.groupManager.table.options.groupClosedShowCalcs) { | ||
this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); | ||
output.push(this.calcs.bottom); | ||
} | ||
} | ||
@@ -429,0 +439,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
var GroupComponent=function(t){this._group=t,this.type="GroupComponent"};GroupComponent.prototype.getKey=function(){return this._group.key},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(){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-arrow"),!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(t,i.getComponent())}),i.groupManager.table.options.groupDblClick&&i.element.addEventListener("dblclick",function(t){i.groupManager.table.options.groupDblClick(t,i.getComponent())}),i.groupManager.table.options.groupContext&&i.element.addEventListener("contextmenu",function(t){i.groupManager.table.options.groupContext(t,i.getComponent())}),i.groupManager.table.options.groupTap&&(e=!1,i.element.addEventListener("touchstart",function(t){e=!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)}),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=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=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.options.groupClosedShowCalcs&&this.groupManager.table.modExists("columnCalcs")&&(!t&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&this.calcs.top.detachElement(),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=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,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.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.assignRowToGroup=function(t,o){var e=this.groupIDLookups[0].func(t.getData()),r="0_"+e;this.groups[r]||this.createGroup(e,0,o),this.groups[r].addRow(t)},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); | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
var GroupComponent=function(t){this._group=t,this.type="GroupComponent"};GroupComponent.prototype.getKey=function(){return this._group.key},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,s,i,n){this.groupManager=t,this.parent=o,this.key=r,this.level=e,this.field=s,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=i,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(){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-arrow"),!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,s=this;s.groupManager.table.options.groupClick&&s.element.addEventListener("click",function(t){s.groupManager.table.options.groupClick(t,s.getComponent())}),s.groupManager.table.options.groupDblClick&&s.element.addEventListener("dblclick",function(t){s.groupManager.table.options.groupDblClick(t,s.getComponent())}),s.groupManager.table.options.groupContext&&s.element.addEventListener("contextmenu",function(t){s.groupManager.table.options.groupContext(t,s.getComponent())}),s.groupManager.table.options.groupTap&&(e=!1,s.element.addEventListener("touchstart",function(t){e=!0},{passive:!0}),s.element.addEventListener("touchend",function(t){e&&s.groupManager.table.options.groupTap(t,s.getComponent()),e=!1})),s.groupManager.table.options.groupDblTap&&(t=null,s.element.addEventListener("touchend",function(o){t?(clearTimeout(t),t=null,s.groupManager.table.options.groupDblTap(o,s.getComponent())):t=setTimeout(function(){clearTimeout(t),t=null},300)})),s.groupManager.table.options.groupTapHold&&(o=null,s.element.addEventListener("touchstart",function(t){clearTimeout(o),o=setTimeout(function(){clearTimeout(o),o=null,e=!1,s.groupManager.table.options.groupTapHold(t,s.getComponent())},1e3)},{passive:!0}),s.element.addEventListener("touchend",function(t){clearTimeout(o),o=null})),s.groupManager.table.options.groupToggleElement&&(r="arrow"==s.groupManager.table.options.groupToggleElement?s.arrowElement:s.element,r.addEventListener("click",function(t){t.stopPropagation(),t.stopImmediatePropagation(),s.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 s=this.rows.indexOf(o);s>-1?e?this.rows.splice(s+1,0,t):this.rows.splice(s,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,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,s){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 s=this.table.columnManager.getRealColumns();s.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,s;"function"==typeof o?r=o:(s=t.table.columnManager.getColumnByField(o),r=s?function(t){return s.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.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 s=[];t.hasSubGroups?(s=o.pullGroupListData(t.groupList),r.level=t.level,r.rowCount=s.length-t.groupList.length,r.headerContent=t.generator(t.key,r.rowCount,t.rows,t),e.push(r),e=e.concat(s)):(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,s=o+"_"+t;e=e||[],r=new Group(this,!1,o,t,this.groupIDLookups[0].field,this.headerGenerator[0],e[s]),this.groups[s]=r,this.groupList.push(r)},GroupRows.prototype.assignRowToGroup=function(t,o){var e=this.groupIDLookups[0].func(t.getData()),r="0_"+e;this.groups[r]||this.createGroup(e,0,o),this.groups[r].addRow(t)},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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var History = function History(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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._rebindRow(t.component,o)},rowMove:function(t){this.table.rowManager.moveRowActual(t.component,this.table.rowManager.rows[t.data.pos],!1),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._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.pos],!1),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 n=e.component.column.getField();n&&(e.component=o.getCell(n))}})},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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var HtmlTableImport = function HtmlTableImport(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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],r=[];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 l=0;l<n.length;l++){var i=n[l],s=i.getElementsByTagName("td"),p={};t.hasIndex||(p[o.index]=l);for(var m=0;m<s.length;m++){var d=s[m];void 0!==this.fieldIndex[m]&&(p[this.fieldIndex[m]]=d.innerHTML)}r.push(p)}var f=document.createElement("div"),u=e.attributes;for(var m in u)"object"==_typeof(u[m])&&f.setAttribute(u[m].name,u[m].value);e.parentNode.replaceChild(f,e),o.data=r,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),r={};n.forEach(function(t){r[t.toLowerCase()]=t});for(var l in a){var i,s=a[l];s&&"object"==(void 0===s?"undefined":_typeof(s))&&s.name&&0===s.name.indexOf("tabulator-")&&(i=s.name.replace("tabulator-",""),void 0!==r[i]&&(e[r[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,r=t[o],l=!1,i=this._findCol(r.textContent);i?l=!0:i={title:r.textContent.trim()},i.field||(i.field=r.textContent.trim().toLowerCase().replace(" ","_")),a=r.getAttribute("width"),a&&!i.width&&(i.width=a),n=r.attributes,this._extractOptions(r,i,Column.prototype.defaultOptionList);for(var s in n){var p,m=n[s];m&&"object"==(void 0===m?"undefined":_typeof(m))&&m.name&&0===m.name.indexOf("tabulator-")&&(p=m.name.replace("tabulator-",""),i[p]=this._attribValue(m.value))}this.fieldIndex[o]=i.field,i.field==this.table.options.index&&(this.hasIndex=!0),l||this.table.options.columns.push(i)}},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 r=a.getAttribute("width");r&&(n.width=r),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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Keybindings = function Keybindings(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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};e.toString().toLowerCase().split(" ").join("").split("+").forEach(function(t){switch(t){case"ctrl":n.ctrl=!0;break;case"shift":n.shift=!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&&(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=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().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(this.table.options.selectable&&"highlight"!=this.table.options.selectable?"selected":"active",null,null,null,!0)}},Tabulator.prototype.registerModule("keybindings",Keybindings); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -107,3 +107,3 @@ var MoveColumns = function MoveColumns(table) { | ||
}, self.checkPeriod); | ||
}); | ||
}, { passive: true }); | ||
@@ -154,3 +154,3 @@ colEl.addEventListener("touchmove", function (e) { | ||
} | ||
}); | ||
}, { passive: true }); | ||
@@ -157,0 +157,0 @@ colEl.addEventListener("touchend", function (e) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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)}),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))}),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.moveColumn(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); | ||
/* Tabulator v4.3.0 (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.moveColumn(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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -184,3 +184,3 @@ var MoveRows = function MoveRows(table) { | ||
}, self.checkPeriod); | ||
}); | ||
}, { passive: true }); | ||
this.moving, this.toRow, this.toRowAfter; | ||
@@ -187,0 +187,0 @@ element.addEventListener("touchmove", function (e) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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)}),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); | ||
/* Tabulator v4.3.0 (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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Mutator = function Mutator(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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(t),(!e||e&&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;return e?e.mutator(o,t.row.getData(),"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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -625,2 +625,4 @@ var Page = function Page(table) { | ||
"filters": "filters" | ||
// "filter_value":"filter_value", | ||
// "filter_type":"filter_type", | ||
}; | ||
@@ -627,0 +629,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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.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 n in a.table.options.paginationDataReceived)a.paginationDataReceivedNames[n]=a.table.options.paginationDataReceived[n];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){return("local"==this.mode||e)&&(this.page=1),!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;return new Promise(function(a,i){e=parseInt(e),e>0&&e<=t.max?(t.page=e,t.trigger().then(function(){a()}).catch(function(){i()})):(console.warn("Pagination Error - Requested page is out of range of 1 - "+t.max+":",e),i())})},Page.prototype.setPageToRow=function(e){var t=this;return new Promise(function(a,i){var n=t.table.rowManager.getDisplayRows(t.displayIndex-1),s=n.indexOf(e);if(s>-1){var o=Math.ceil((s+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()},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),n=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 s=i;s<=n;s++)s>0&&s<=e.max&&e.pagesElement.appendChild(e._generatePageButton(s));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()})):(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.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 n=a;n<i;n++)e[n]&&t.push(e[n]);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(n,s){if(i.table.modExists("ajax",!0)||s(),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),n()}).catch(function(e){s()}),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":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),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]),this.table.rowManager.scrollHorizontal(t),this.table.columnManager.scrollHorizontal(t),this.table.options.pageLoaded.call(this.table,this.getPage());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); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var Persistence = function Persistence(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
var Persistence=function(e){this.table=e,this.mode="",this.id="",this.persistProps=["field","width","visible"]};Persistence.prototype.initialize=function(e,t){this.mode=!0!==e?e:void 0!==window.localStorage?"local":"cookie",this.id="tabulator-"+(t||this.table.element.getAttribute("id")||"")},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){var t="",i=this.id+("columns"===e?"":"-"+e);switch(this.mode){case"local":t=localStorage.getItem(i);break;case"cookie":var o=document.cookie,s=o.indexOf(i+"="),r=void 0;s>-1&&(o=o.substr(s),r=o.indexOf(";"),r>-1&&(o=o.substr(0,r)),t=o.replace(i+"=",""));break;default:console.warn("Persistance Load Error - invalid mode selected",this.mode)}return!!t&&JSON.parse(t)},Persistence.prototype.mergeDefinition=function(e,t){var i=this,o=[];return t=t||[],t.forEach(function(t,s){var r=i._findColumn(e,t);r&&(r.width=t.width,r.visible=t.visible,r.columns&&(r.columns=i.mergeDefinition(r.columns,t.columns)),o.push(r))}),e.forEach(function(e,s){i._findColumn(t,e)||(o.length>s?o.splice(s,0,e):o.push(e))}),o},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())}var i=this.id+("columns"===e?"":"-"+e);this.saveData(i,t)},Persistence.prototype.validateSorters=function(e){return e.forEach(function(e){e.column=e.field,delete e.field}),e},Persistence.prototype.saveData=function(e,t){switch(t=JSON.stringify(t),this.mode){case"local":localStorage.setItem(e,t);break;case"cookie":var i=new Date;i.setDate(i.getDate()+1e4),document.cookie=e+"="+t+"; expires="+i.toUTCString();break;default:console.warn("Persistance Save Error - invalid mode selected",this.mode)}},Persistence.prototype.parseColumns=function(e){var t=this,i=[];return e.forEach(function(e){var o={};e.isGroup?(o.title=e.getDefinition().title,o.columns=t.parseColumns(e.getColumns())):(o.title=e.getDefinition().title,o.field=e.getField(),o.width=e.getWidth(),o.visible=e.visible),i.push(o)}),i},Tabulator.prototype.registerModule("persistence",Persistence); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var ReactiveData = function ReactiveData(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -45,3 +45,3 @@ var ResizeColumns = function ResizeColumns(table) { | ||
handle.addEventListener("mousedown", handleDown); | ||
handle.addEventListener("touchstart", handleDown); | ||
handle.addEventListener("touchstart", handleDown, { passive: true }); | ||
@@ -78,3 +78,3 @@ //reszie column on double click | ||
prevHandle.addEventListener("mousedown", prevHandleDown); | ||
prevHandle.addEventListener("touchstart", prevHandleDown); | ||
prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); | ||
@@ -159,3 +159,3 @@ //resize column on double click | ||
document.body.addEventListener("mouseup", mouseUp); | ||
handle.addEventListener("touchmove", mouseMove); | ||
handle.addEventListener("touchmove", mouseMove, { passive: true }); | ||
handle.addEventListener("touchend", mouseUp); | ||
@@ -162,0 +162,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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 i=this,o=!1,s=this.table.options.resizableColumns;if("header"===e&&(o="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:o}),!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&&i._checkResizability(n)&&(i.startColumn=t,i._mouseDown(e,n,a))};a.addEventListener("mousedown",r),a.addEventListener("touchstart",r),a.addEventListener("dblclick",function(e){var n=t.getLastColumn();n&&i._checkResizability(n)&&n.reinitializeWidth(!0)}),l.addEventListener("click",function(e){e.stopPropagation()});var d=function(e){var n,o,s;(n=t.getFirstColumn())&&(o=i.table.columnManager.findColumnIndex(n),(s=o>0&&i.table.columnManager.getColumnByIndex(o-1))&&i._checkResizability(s)&&(i.startColumn=t,i._mouseDown(e,s,l)))};l.addEventListener("mousedown",d),l.addEventListener("touchstart",d),l.addEventListener("dblclick",function(e){var n,o,s;(n=t.getFirstColumn())&&(o=i.table.columnManager.findColumnIndex(n),(s=o>0&&i.table.columnManager.getColumnByIndex(o-1))&&i._checkResizability(s)&&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 i(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 o(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",o),document.body.removeEventListener("mousemove",i),n.removeEventListener("touchmove",i),n.removeEventListener("touchend",o),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistentLayout&&s.table.modExists("persistence",!0)&&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",i),document.body.addEventListener("mouseup",o),n.addEventListener("touchmove",i),n.addEventListener("touchend",o)},Tabulator.prototype.registerModule("resizeColumns",ResizeColumns); | ||
/* Tabulator v4.3.0 (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 i=this,o=!1,s=this.table.options.resizableColumns;if("header"===e&&(o="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:o}),!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&&i._checkResizability(n)&&(i.startColumn=t,i._mouseDown(e,n,a))};a.addEventListener("mousedown",r),a.addEventListener("touchstart",r,{passive:!0}),a.addEventListener("dblclick",function(e){var n=t.getLastColumn();n&&i._checkResizability(n)&&n.reinitializeWidth(!0)}),l.addEventListener("click",function(e){e.stopPropagation()});var d=function(e){var n,o,s;(n=t.getFirstColumn())&&(o=i.table.columnManager.findColumnIndex(n),(s=o>0&&i.table.columnManager.getColumnByIndex(o-1))&&i._checkResizability(s)&&(i.startColumn=t,i._mouseDown(e,s,l)))};l.addEventListener("mousedown",d),l.addEventListener("touchstart",d,{passive:!0}),l.addEventListener("dblclick",function(e){var n,o,s;(n=t.getFirstColumn())&&(o=i.table.columnManager.findColumnIndex(n),(s=o>0&&i.table.columnManager.getColumnByIndex(o-1))&&i._checkResizability(s)&&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 i(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 o(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",o),document.body.removeEventListener("mousemove",i),n.removeEventListener("touchmove",i),n.removeEventListener("touchend",o),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistentLayout&&s.table.modExists("persistence",!0)&&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",i),document.body.addEventListener("mouseup",o),n.addEventListener("touchmove",i,{passive:!0}),n.addEventListener("touchend",o)},Tabulator.prototype.registerModule("resizeColumns",ResizeColumns); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -31,3 +31,3 @@ var ResizeRows = function ResizeRows(table) { | ||
handle.addEventListener("mousedown", handleDown); | ||
handle.addEventListener("mousedown", handleDown, { passive: true }); | ||
handle.addEventListener("touchstart", handleDown); | ||
@@ -49,3 +49,3 @@ | ||
prevHandle.addEventListener("mousedown", prevHandleDown); | ||
prevHandle.addEventListener("touchstart", prevHandleDown); | ||
prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); | ||
@@ -96,3 +96,3 @@ rowEl.appendChild(handle); | ||
handle.addEventListener("touchmove", mouseMove); | ||
handle.addEventListener("touchmove", mouseMove, { passive: true }); | ||
handle.addEventListener("touchend", mouseUp); | ||
@@ -99,0 +99,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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(),n=document.createElement("div");n.className="tabulator-row-resize-handle";var s=document.createElement("div");s.className="tabulator-row-resize-handle prev",n.addEventListener("click",function(e){e.stopPropagation()});var a=function(o){t.startRow=e,t._mouseDown(o,e,n)};n.addEventListener("mousedown",a),n.addEventListener("touchstart",a),s.addEventListener("click",function(e){e.stopPropagation()});var r=function(o){var n=t.table.rowManager.prevDisplayRow(e);n&&(t.startRow=n,t._mouseDown(o,n,s))};s.addEventListener("mousedown",r),s.addEventListener("touchstart",r),o.appendChild(n),o.appendChild(s)},ResizeRows.prototype._mouseDown=function(e,t,o){function n(e){t.setHeight(a.startHeight+((void 0===e.screenY?e.touches[0].screenY:e.screenY)-a.startY))}function s(e){document.body.removeEventListener("mouseup",n),document.body.removeEventListener("mousemove",n),o.removeEventListener("touchmove",n),o.removeEventListener("touchend",s),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",n),document.body.addEventListener("mouseup",s),o.addEventListener("touchmove",n),o.addEventListener("touchend",s)},Tabulator.prototype.registerModule("resizeRows",ResizeRows); | ||
/* Tabulator v4.3.0 (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,{passive:!0}),s.addEventListener("touchstart",a),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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var ResizeTable = function ResizeTable(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
var ResizeTable=function(e){this.table=e,this.binding=!1,this.observer=!1};ResizeTable.prototype.initialize=function(e){var i=this.table;"undefined"!=typeof ResizeObserver&&"virtual"===i.rowManager.getRenderMode()?(this.observer=new ResizeObserver(function(e){i.redraw()}),this.observer.observe(i.element)):(this.binding=function(){i.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)},Tabulator.prototype.registerModule("resizeTable",ResizeTable); |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -3,0 +3,0 @@ var ResponsiveLayout = function ResponsiveLayout(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
var ResponsiveLayout=function(e){this.table=e,this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0};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()},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.layoutRow=function(e){var t=e.getElement(),o=document.createElement("div");o.classList.add("tabulator-responsive-collapse"),t.classList.contains("tabulator-calcs")||(e.modules.responsiveLayout={element:o},this.collapseStartOpen||(o.style.display="none"),t.appendChild(o),this.generateCollapsedRowContent(e))},ResponsiveLayout.prototype.updateColumnVisibility=function(e,t){e.modules.responsive&&(e.modules.responsive.visible=t,this.initialize())},ResponsiveLayout.prototype.hideColumn=function(e){e.hide(!1,!0),"collapse"===this.mode&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent())},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())},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.columnManager.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 a=i.getFieldValue(n);i.definition.title&&i.field&&(i.modules.format&&o.table.options.responsiveLayoutCollapseUseFormatters?(t={value:!1,data:{},getValue:function(){return a},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:a}))}),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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -46,4 +46,7 @@ var SelectRow = function SelectRow(table) { | ||
if (self.table.options.selectable && self.table.options.selectable != "highlight") { | ||
if (self.table.options.selectableRangeMode && self.table.options.selectableRangeMode === "click") { | ||
if (self.table.options.selectableRangeMode === "click") { | ||
element.addEventListener("click", function (e) { | ||
self.table._clearSelection(); | ||
if (e.shiftKey) { | ||
@@ -61,6 +64,13 @@ self.lastClickedRow = self.lastClickedRow || row; | ||
if (e.ctrlKey) { | ||
if (e.ctrlKey || e.metaKey) { | ||
toggledRows.forEach(function (toggledRow) { | ||
if (toggledRow !== self.lastClickedRow) { | ||
self.toggleRow(toggledRow); | ||
if (self.table.options.selectable !== true && !self.isRowSelected(row)) { | ||
if (self.selectedRows.length < self.table.options.selectable) { | ||
self.toggleRow(toggledRow); | ||
} | ||
} else { | ||
self.toggleRow(toggledRow); | ||
} | ||
} | ||
@@ -71,5 +81,12 @@ }); | ||
self.deselectRows(); | ||
if (self.table.options.selectable !== true) { | ||
if (toggledRows.length > self.table.options.selectable) { | ||
toggledRows = toggledRows.slice(0, self.table.options.selectable); | ||
} | ||
} | ||
self.selectRows(toggledRows); | ||
} | ||
} else if (e.ctrlKey) { | ||
} else if (e.ctrlKey || e.metaKey) { | ||
self.toggleRow(row); | ||
@@ -82,5 +99,9 @@ self.lastClickedRow = row; | ||
} | ||
self.table._clearSelection(); | ||
}); | ||
} else { | ||
element.addEventListener("click", function (e) { | ||
self.table._clearSelection(); | ||
if (!self.selecting) { | ||
@@ -93,2 +114,4 @@ self.toggleRow(row); | ||
if (e.shiftKey) { | ||
self.table._clearSelection(); | ||
self.selecting = true; | ||
@@ -109,2 +132,3 @@ | ||
if (self.selecting) { | ||
self.table._clearSelection(); | ||
self.toggleRow(row); | ||
@@ -120,2 +144,3 @@ | ||
if (self.selecting) { | ||
self.table._clearSelection(); | ||
self.selectPrev.unshift(row); | ||
@@ -122,0 +147,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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=[]};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&&(t.table.options.selectableRangeMode&&"click"===t.table.options.selectableRangeMode?o.addEventListener("click",function(o){if(o.shiftKey){t.lastClickedRow=t.lastClickedRow||e;var l=t.table.rowManager.getDisplayRowIndex(t.lastClickedRow),s=t.table.rowManager.getDisplayRowIndex(e),c=l<=s?l:s,n=l>=s?l:s,i=t.table.rowManager.getDisplayRows().slice(0),a=i.splice(c,n-c+1);o.ctrlKey?(a.forEach(function(e){e!==t.lastClickedRow&&t.toggleRow(e)}),t.lastClickedRow=e):(t.deselectRows(),t.selectRows(a))}else o.ctrlKey?(t.toggleRow(e),t.lastClickedRow=e):(t.deselectRows(),t.selectRows(e),t.lastClickedRow=e)}):(o.addEventListener("click",function(o){t.selecting||t.toggleRow(e)}),o.addEventListener("mousedown",function(o){if(o.shiftKey)return 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.toggleRow(e),t.selectPrev[1]==e&&t.toggleRow(t.selectPrev[0]))}),o.addEventListener("mouseout",function(o){t.selecting&&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=this;switch(void 0===e?"undefined":_typeof(e)){case"undefined":t.table.rowManager.rows.forEach(function(e){t._selectRow(e,!0,!0)}),t._rowSelectionChanged();break;case"boolean":!0===e&&(t.table.rowManager.activeRows.forEach(function(e){t._selectRow(e,!0,!0)}),t._rowSelectionChanged());break;default:Array.isArray(e)?(e.forEach(function(e){t._selectRow(e,!0,!0)}),t._rowSelectionChanged()):t._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.getElement().classList.add("tabulator-selected"),this.selectedRows.push(l),t||(this.table.options.rowSelected.call(this.table,l.getComponent()),this._rowSelectionChanged())):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){var t,o=this;if(void 0===e){t=o.selectedRows.length;for(var l=0;l<t;l++)o._deselectRow(o.selectedRows[0],!0);o._rowSelectionChanged()}else Array.isArray(e)?(e.forEach(function(e){o._deselectRow(e,!0)}),o._rowSelectionChanged()):o._deselectRow(e)},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.getElement().classList.remove("tabulator-selected"),l.selectedRows.splice(o,1),t||(l.table.options.rowDeselected.call(this.table,s.getComponent()),l._rowSelectionChanged())):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(){this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},Tabulator.prototype.registerModule("selectRow",SelectRow); | ||
/* Tabulator v4.3.0 (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=[]};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(t.table._clearSelection(),o.shiftKey){t.lastClickedRow=t.lastClickedRow||e;var l=t.table.rowManager.getDisplayRowIndex(t.lastClickedRow),s=t.table.rowManager.getDisplayRowIndex(e),c=l<=s?l:s,n=l>=s?l:s,i=t.table.rowManager.getDisplayRows().slice(0),a=i.splice(c,n-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(),!0!==t.table.options.selectable&&a.length>t.table.options.selectable&&(a=a.slice(0,t.table.options.selectable)),t.selectRows(a))}else o.ctrlKey||o.metaKey?(t.toggleRow(e),t.lastClickedRow=e):(t.deselectRows(),t.selectRows(e),t.lastClickedRow=e);t.table._clearSelection()}):(o.addEventListener("click",function(o){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=this;switch(void 0===e?"undefined":_typeof(e)){case"undefined":t.table.rowManager.rows.forEach(function(e){t._selectRow(e,!0,!0)}),t._rowSelectionChanged();break;case"boolean":!0===e&&(t.table.rowManager.activeRows.forEach(function(e){t._selectRow(e,!0,!0)}),t._rowSelectionChanged());break;default:Array.isArray(e)?(e.forEach(function(e){t._selectRow(e,!0,!0)}),t._rowSelectionChanged()):t._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.getElement().classList.add("tabulator-selected"),this.selectedRows.push(l),t||(this.table.options.rowSelected.call(this.table,l.getComponent()),this._rowSelectionChanged())):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){var t,o=this;if(void 0===e){t=o.selectedRows.length;for(var l=0;l<t;l++)o._deselectRow(o.selectedRows[0],!0);o._rowSelectionChanged()}else Array.isArray(e)?(e.forEach(function(e){o._deselectRow(e,!0)}),o._rowSelectionChanged()):o._deselectRow(e)},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.getElement().classList.remove("tabulator-selected"),l.selectedRows.splice(o,1),t||(l.table.options.rowDeselected.call(this.table,s.getComponent()),l._rowSelectionChanged())):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(){this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -5,0 +5,0 @@ var Sort = function Sort(table) { |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (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,s=!1;switch(_typeof(t.definition.sorter)){case"string":n.sorters[t.definition.sorter]?s=n.sorters[t.definition.sorter]:console.warn("Sort Error - No such sorter found: ",t.definition.sorter);break;case"function":s=t.definition.sorter}t.modules.sort={sorter:s,dir:"none",params:t.definition.sorterParams||{},startingDir:t.definition.headerSortStartingDir||"asc",tristate:t.definition.headerSortTristate},!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=[],s=!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(),s=o.findIndex(function(e){return e.field===t.getField()}),s>-1?(o[s].dir=r,s!=o.length-1&&(s=o.splice(s,1)[0],"none"!=r&&o.push(s))):"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.persistentSort&&this.table.modExists("persistence",!0)&&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,r=this;e=this.table.options.sortOrderReverse?r.sortList.slice().reverse():r.sortList,r.table.options.dataSorting&&r.table.options.dataSorting.call(r.table,r.getSort()),r.clearColumnHeaders(),r.table.options.ajaxSorting?e.forEach(function(t,e){r.setColumnHeader(t.column,t.dir)}):e.forEach(function(o,n){o.column&&o.column.modules.sort&&(o.column.modules.sort.sorter||(o.column.modules.sort.sorter=r.findSorter(o.column)),r._sortItem(t,o.column,o.dir,e,n)),r.setColumnHeader(o.column,o.dir)}),r.table.options.dataSorted&&r.table.options.dataSorted.call(r.table,r.getSort(),r.table.rowManager.getComponents(!0))},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,r,o,n){var s=this,i="function"==typeof e.modules.sort.params?e.modules.sort.params(e.getComponent(),r):e.modules.sort.params;t.sort(function(t,a){var l=s._sortRow(t,a,e,r,i);if(0===l&&n)for(var u=n-1;u>=0&&0===(l=s._sortRow(t,a,o[u].column,o[u].dir,i));u--);return l})},Sort.prototype._sortRow=function(t,e,r,o,n){var s,i,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:"",s=a.getComponent(),i=l.getComponent(),r.modules.sort.sorter.call(this,t,e,s,i,r.getComponent(),o,n)},Sort.prototype.sorters={number:function(t,e,r,o,n,s,i){var a=i.alignEmptyValues,l=i.decimalSeparator||".",u=i.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"===s||"bottom"===a&&"asc"===s)&&(c*=-1),c},string:function(t,e,r,o,n,s,i){var a,l=i.alignEmptyValues,u=0;if(t){if(e){switch(_typeof(i.locale)){case"boolean":i.locale&&(a=this.table.modules.localize.getLocale());break;case"string":a=i.locale}return String(t).toLowerCase().localeCompare(String(e).toLowerCase(),a)}u=1}else u=e?-1:0;return("top"===l&&"desc"===s||"bottom"===l&&"asc"===s)&&(u*=-1),u},date:function(t,e,r,o,n,s,i){return i.format||(i.format="DD/MM/YYYY"),this.sorters.datetime.call(this,t,e,r,o,n,s,i)},time:function(t,e,r,o,n,s,i){return i.format||(i.format="hh:mm"),this.sorters.datetime.call(this,t,e,r,o,n,s,i)},datetime:function(t,e,r,o,n,s,i){var a=i.format||"DD/MM/YYYY hh:mm:ss",l=i.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"===s||"bottom"===l&&"asc"===s)&&(u*=-1),u}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function(t,e,r,o,n,s,i){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,s,i){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=i.type||"length",d=i.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"===s||"bottom"===d&&"asc"===s)&&(m*=-1),m},exists:function(t,e,r,o,n,s,i){return(void 0===t?0:1)-(void 0===e?0:1)},alphanum:function(t,e,r,o,n,s,i){var a,l,u,c,d,m=0,f=/(\d+)|(\D+)/g,p=/\d/,h=i.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"===s||"bottom"===h&&"asc"===s)&&(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.2.7 (c) Oliver Folkerd */ | ||
/* Tabulator v4.3.0 (c) Oliver Folkerd */ | ||
@@ -208,3 +208,3 @@ var Validate = function Validate(table) { | ||
required: function required(cell, value, parameters) { | ||
return value !== "" & value !== null && typeof value !== "undefined"; | ||
return value !== "" && value !== null && typeof value !== "undefined"; | ||
} | ||
@@ -211,0 +211,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/* Tabulator v4.2.7 (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,o=[];t.definition.validator&&(Array.isArray(t.definition.validator)?t.definition.validator.forEach(function(t){(n=i._extractValidator(t))&&o.push(n)}):(n=this._extractValidator(t.definition.validator))&&o.push(n),t.modules.validate=!!o.length&&o)},Validate.prototype._extractValidator=function(t){var n,i,o;switch(void 0===t?"undefined":_typeof(t)){case"string":return n=t.split(":",2),i=n.shift(),o=n[0],this._buildValidator(i,o);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 o=this,r=[];return t&&t.forEach(function(t){t.func.call(o,n,i,t.params)||r.push({type:t.type,parameters:t.params})}),!r.length||r},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 o=!0,r=t.getData(),e=t.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(t){var i=t.getData();i!==r&&n==e.getFieldValue(i)&&(o=!1)}),o},required:function(t,n,i){return""!==n&null!==n&&void 0!==n}},Tabulator.prototype.registerModule("validate",Validate); | ||
/* Tabulator v4.3.0 (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,o=[];t.definition.validator&&(Array.isArray(t.definition.validator)?t.definition.validator.forEach(function(t){(n=i._extractValidator(t))&&o.push(n)}):(n=this._extractValidator(t.definition.validator))&&o.push(n),t.modules.validate=!!o.length&&o)},Validate.prototype._extractValidator=function(t){var n,i,o;switch(void 0===t?"undefined":_typeof(t)){case"string":return n=t.split(":",2),i=n.shift(),o=n[0],this._buildValidator(i,o);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 o=this,r=[];return t&&t.forEach(function(t){t.func.call(o,n,i,t.params)||r.push({type:t.type,parameters:t.params})}),!r.length||r},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 o=!0,r=t.getData(),e=t.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(t){var i=t.getData();i!==r&&n==e.getFieldValue(i)&&(o=!1)}),o},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.2.7", | ||
var version_no = "4.3.0", | ||
@@ -25,0 +25,0 @@ version = "/* Tabulator v" + version_no + " (c) Oliver Folkerd */\n"; |
{ | ||
"name": "tabulator-tables", | ||
"version": "4.2.7", | ||
"version": "4.3.0", | ||
"description": "Interactive table generation JavaScript library", | ||
@@ -5,0 +5,0 @@ "main": "dist/js/tabulator.js", |
![Tabulator Table](http://olifolkerd.github.io/tabulator/images/tabulator.png) | ||
### Version 4.2 Out Now! | ||
### Version 4.3 Out Now! | ||
@@ -69,4 +69,4 @@ An easy to use interactive table generation JavaScript library | ||
```html | ||
<link href="https://unpkg.com/tabulator-tables@4.2.7/dist/css/tabulator.min.css" rel="stylesheet"> | ||
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.2.7/dist/js/tabulator.min.js"></script> | ||
<link href="https://unpkg.com/tabulator-tables@4.3.0/dist/css/tabulator.min.css" rel="stylesheet"> | ||
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.3.0/dist/js/tabulator.min.js"></script> | ||
``` | ||
@@ -80,3 +80,2 @@ | ||
- Additional Editors and Formatters | ||
- Print Styling | ||
- Multi Cell Editing | ||
@@ -83,0 +82,0 @@ - Cell Selection |
@@ -190,2 +190,17 @@ | ||
}); | ||
}else{ | ||
element.addEventListener("dblclick", function(e){ | ||
e.preventDefault(); | ||
if (document.selection) { // IE | ||
var range = document.body.createTextRange(); | ||
range.moveToElementText(self.element); | ||
range.select(); | ||
} else if (window.getSelection) { | ||
var range = document.createRange(); | ||
range.selectNode(self.element); | ||
window.getSelection().removeAllRanges(); | ||
window.getSelection().addRange(range); | ||
} | ||
}); | ||
} | ||
@@ -297,3 +312,3 @@ | ||
tap = true; | ||
}); | ||
}, {passive: true}); | ||
@@ -367,3 +382,3 @@ element.addEventListener("touchend", function(e){ | ||
}); | ||
}, {passive: true}); | ||
@@ -502,3 +517,11 @@ element.addEventListener("touchend", function(e){ | ||
if(this.table.options.groupBy && this.table.modExists("groupRows")){ | ||
this.table.modules.columnCalcs.recalcRowGroup(this.row); | ||
if(this.table.options.columnCalcs == "table" || this.table.options.columnCalcs == "both"){ | ||
this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); | ||
} | ||
if(this.table.options.columnCalcs != "table"){ | ||
this.table.modules.columnCalcs.recalcRowGroup(this.row); | ||
} | ||
}else{ | ||
@@ -505,0 +528,0 @@ this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); |
@@ -11,3 +11,2 @@ var ColumnManager = function(table){ | ||
this.scrollLeft = 0; | ||
this.scrollCount = 0; | ||
@@ -32,2 +31,6 @@ this.element.insertBefore(this.headersElement, this.element.firstChild); | ||
if(!this.table.options.headerVisible){ | ||
el.classList.add("tabulator-header-hidden"); | ||
} | ||
return el; | ||
@@ -34,0 +37,0 @@ }; |
@@ -114,7 +114,11 @@ | ||
ColumnComponent.prototype.getNextColumn = function(){ | ||
return this._column.nextColumn().getComponent(); | ||
var nextCol = this._column.nextColumn(); | ||
return nextCol ? nextCol.getComponent() : false; | ||
}; | ||
ColumnComponent.prototype.getPrevColumn = function(){ | ||
return this._column.prevColumn().getComponent(); | ||
var prevCol = this._column.prevColumn(); | ||
return prevCol ? prevCol.getComponent() : false; | ||
}; | ||
@@ -147,4 +151,4 @@ | ||
this.setField(this.definition.field); | ||
this.checkDefinition(); | ||
this.modules = {}; //hold module variables; | ||
@@ -174,2 +178,4 @@ | ||
this._mapDepricatedFunctionality(); | ||
//initialize column | ||
@@ -215,2 +221,10 @@ if(def.columns){ | ||
Column.prototype.checkDefinition = function(){ | ||
Object.keys(this.definition).forEach((key) => { | ||
if(this.defaultOptionList.indexOf(key) === -1){ | ||
console.warn("Invalid column definition option in '" + (this.field || this.definition.title) + "' column:", key) | ||
} | ||
}); | ||
} | ||
Column.prototype.setField = function(field){ | ||
@@ -244,2 +258,9 @@ this.field = field; | ||
Column.prototype._mapDepricatedFunctionality = function(){ | ||
if(typeof this.definition.hideInHtml !== "undefined"){ | ||
this.definition.htmlOutput = !this.definition.hideInHtml; | ||
console.warn("hideInHtml column definition property is depricated, you should now use htmlOutput") | ||
} | ||
}; | ||
Column.prototype.setTooltip = function(){ | ||
@@ -370,3 +391,3 @@ var self = this, | ||
tap = true; | ||
}); | ||
}, {passive: true}); | ||
@@ -416,3 +437,3 @@ self.element.addEventListener("touchend", function(e){ | ||
}); | ||
}, {passive: true}); | ||
@@ -1147,2 +1168,3 @@ self.element.addEventListener("touchend", function(e){ | ||
"field", | ||
"columns", | ||
"visible", | ||
@@ -1161,2 +1183,4 @@ "align", | ||
"hideInHtml", | ||
"print", | ||
"htmlOutput", | ||
"sorter", | ||
@@ -1232,2 +1256,3 @@ "sorterParams", | ||
"headerFilterLiveFilter", | ||
"print", | ||
]; | ||
@@ -1234,0 +1259,0 @@ |
@@ -102,2 +102,9 @@ 'use strict'; | ||
printAsHtml:false, //enable print as html | ||
printFormatter:false, //printing page formatter | ||
printHeader:false, //page header contents | ||
printFooter:false, //page footer contents | ||
printCopyStyle:true, //enable print as html styling | ||
printVisibleRows:true, //restrict print to visible rows only | ||
printConfig:{}, //print config options | ||
@@ -114,2 +121,4 @@ addRowPos:"bottom", //position to insert blank rows, top|bottom | ||
headerVisible:true, //hide header | ||
history:false, //enable edit history | ||
@@ -164,2 +173,4 @@ | ||
htmlOutputConfig:false, //html outypu config | ||
movableColumns:false, //enable movable columns | ||
@@ -295,2 +306,11 @@ | ||
Tabulator.prototype.initializeOptions = function(options){ | ||
//warn user if option is not available | ||
for (var key in options){ | ||
if(typeof this.defaultOptions[key] === "undefined"){ | ||
console.warn("Invalid table constructor option:", key) | ||
} | ||
} | ||
//assign options to table | ||
for (var key in this.defaultOptions){ | ||
@@ -338,2 +358,20 @@ if(key in options){ | ||
Tabulator.prototype._clearSelection = function(){ | ||
this.element.classList.add("tabulator-block-select"); | ||
if (window.getSelection) { | ||
if (window.getSelection().empty) { // Chrome | ||
window.getSelection().empty(); | ||
} else if (window.getSelection().removeAllRanges) { // Firefox | ||
window.getSelection().removeAllRanges(); | ||
} | ||
} else if (document.selection) { // IE? | ||
document.selection.empty(); | ||
} | ||
this.element.classList.remove("tabulator-block-select"); | ||
}; | ||
//concreate table | ||
@@ -544,2 +582,6 @@ Tabulator.prototype._create = function(){ | ||
if(options.printAsHtml && this.modExists("print")){ | ||
mod.print.initialize(); | ||
} | ||
options.tableBuilt.call(this); | ||
@@ -778,6 +820,15 @@ }; | ||
//get table html | ||
Tabulator.prototype.getHtml = function(active){ | ||
return this.rowManager.getHtml(active); | ||
Tabulator.prototype.getHtml = function(visible, style, config){ | ||
if(this.modExists("htmlTableExport", true)){ | ||
return this.modules.htmlTableExport.getHtml(visible, style, config); | ||
} | ||
}; | ||
//get print html | ||
Tabulator.prototype.print = function(visible, style, config){ | ||
if(this.modExists("print", true)){ | ||
return this.modules.print.printFullscreen(visible, style, config); | ||
} | ||
}; | ||
//retrieve Ajax URL | ||
@@ -1622,3 +1673,3 @@ Tabulator.prototype.getAjaxUrl = function(){ | ||
e.preventDefault(); | ||
return cell.nav().dpwn(); | ||
return cell.nav().down(); | ||
} | ||
@@ -1625,0 +1676,0 @@ } |
@@ -16,6 +16,10 @@ /* | ||
if (typeof define === 'function' && define.amd) { | ||
define(['jquery'], factory); | ||
define(['jquery', 'jquery-ui', 'tabulator'], factory); | ||
} | ||
else if(typeof module !== 'undefined' && module.exports) { | ||
module.exports = factory(require('jquery')); | ||
module.exports = factory( | ||
require('jquery'), | ||
require('jquery-ui'), | ||
require('tabulator') | ||
); | ||
} | ||
@@ -25,3 +29,3 @@ else { | ||
} | ||
}(function ($, undefined) { | ||
}(function ($, undefined, Tabulator) { | ||
$.widget("ui.tabulator", { | ||
@@ -48,3 +52,1 @@ _create:function(){ | ||
})); | ||
@@ -15,2 +15,3 @@ /*=include modules/accessor.js */ | ||
/*=include modules/html_table_import.js */ | ||
/*=include modules/html_table_export.js */ | ||
/*=include modules/keybindings.js */ | ||
@@ -22,2 +23,3 @@ /*=include modules/moveable_columns.js */ | ||
/*=include modules/persistence.js */ | ||
/*=include modules/print.js */ | ||
/*=include modules/reactive_data.js */ | ||
@@ -24,0 +26,0 @@ /*=include modules/resize_columns.js */ |
@@ -147,2 +147,6 @@ var ColumnCalcs = function(table){ | ||
if(this.topInitialized){ | ||
if(this.topRow){ | ||
this.topRow.deleteCells(); | ||
} | ||
row = this.generateRow("top", this.rowsToData(rows)) | ||
@@ -156,2 +160,6 @@ this.topRow = row; | ||
if(this.botInitialized){ | ||
if(this.botRow){ | ||
this.botRow.deleteCells(); | ||
} | ||
row = this.generateRow("bottom", this.rowsToData(rows)) | ||
@@ -278,3 +286,3 @@ this.botRow = row; | ||
} | ||
}); | ||
}); | ||
@@ -303,3 +311,3 @@ this.cells = cells; | ||
paramKey = type + "Params"; | ||
params = typeof column.modules.columnCalcs[paramKey] === "function" ? column.modules.columnCalcs[paramKey](value, data) : column.modules.columnCalcs[paramKey]; | ||
params = typeof column.modules.columnCalcs[paramKey] === "function" ? column.modules.columnCalcs[paramKey](values, data) : column.modules.columnCalcs[paramKey]; | ||
@@ -466,2 +474,2 @@ column.setFieldValue(rowData, column.modules.columnCalcs[type](values, data, params)); | ||
Tabulator.prototype.registerModule("columnCalcs", ColumnCalcs); | ||
Tabulator.prototype.registerModule("columnCalcs", ColumnCalcs); |
@@ -207,3 +207,3 @@ var Clipboard = function(table){ | ||
Clipboard.prototype.copy = function(selector, selectorParams, formatter, formatterParams, internal){ | ||
var range, sel; | ||
var range, sel, textRange; | ||
this.blocked = false; | ||
@@ -210,0 +210,0 @@ |
@@ -113,6 +113,6 @@ var Download = function(table){ | ||
maxDepth = 0; | ||
var processedColumn = this.processDefinition(column); | ||
var groupData = { | ||
type:"group", | ||
title:column.definition.title, | ||
title:processedColumn.title, | ||
depth:1, | ||
@@ -147,3 +147,3 @@ }; | ||
groupData.width = 1; | ||
groupData.definition = this.processDefinition(column); | ||
groupData.definition = processedColumn; | ||
}else{ | ||
@@ -627,2 +627,6 @@ return false; | ||
if(options && options.documentProcessing){ | ||
options.documentProcessing(doc); | ||
} | ||
setFileContents(doc.output("arraybuffer"), "application/pdf"); | ||
@@ -629,0 +633,0 @@ }, |
@@ -300,3 +300,3 @@ var Edit = function(table){ | ||
input.setAttribute("type", "text"); | ||
input.setAttribute("type", editorParams.search ? "search" : "text"); | ||
@@ -346,3 +346,3 @@ input.style.padding = "4px"; | ||
cellValue = cell.getValue(), | ||
value = String(cellValue !== null && cellValue !== "undefined" ? cellValue : ""), | ||
value = String(cellValue !== null && typeof cellValue !== "undefined" ? cellValue : ""), | ||
count = (value.match(/(?:\r\n|\r|\n)/g) || []).length + 1, | ||
@@ -560,2 +560,5 @@ input = document.createElement("textarea"), | ||
this.table.rowManager.element.addEventListener("scroll", cancelItem); | ||
if(Array.isArray(editorParams) || (!Array.isArray(editorParams) && typeof editorParams === "object" && !editorParams.values)){ | ||
@@ -781,4 +784,10 @@ 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"); | ||
} | ||
removeScrollListener(); | ||
} | ||
function removeScrollListener() { | ||
self.table.rowManager.element.removeEventListener("scroll", cancelItem); | ||
} | ||
//style input | ||
@@ -790,3 +799,4 @@ input.setAttribute("type", "text"); | ||
input.style.boxSizing = "border-box"; | ||
input.readOnly = true; | ||
input.style.cursor = "default"; | ||
input.readOnly = (this.currentCell != false); | ||
@@ -887,2 +897,4 @@ input.value = typeof initialValue !== "undefined" || initialValue === null ? initialValue : ""; | ||
this.table.rowManager.element.addEventListener("scroll", cancelItem); | ||
function getUniqueColumnValues(){ | ||
@@ -1127,4 +1139,10 @@ var output = {}, | ||
} | ||
removeScrollListener(); | ||
} | ||
function removeScrollListener() { | ||
self.table.rowManager.element.removeEventListener("scroll", cancelItem); | ||
} | ||
//style input | ||
@@ -1563,2 +1581,2 @@ input.setAttribute("type", "search"); | ||
Tabulator.prototype.registerModule("edit", Edit); | ||
Tabulator.prototype.registerModule("edit", Edit); |
@@ -270,11 +270,11 @@ var Filter = function(table){ | ||
!( | ||
column.definition.headerFilter === 'autocomplete' || | ||
column.definition.headerFilter === 'tickCross' || | ||
((column.definition.editor === 'autocomplete' || | ||
column.definition.editor === 'tickCross') && | ||
column.definition.headerFilter === true) | ||
) | ||
) { | ||
column.definition.headerFilter === 'autocomplete' || | ||
column.definition.headerFilter === 'tickCross' || | ||
((column.definition.editor === 'autocomplete' || | ||
column.definition.editor === 'tickCross') && | ||
column.definition.headerFilter === true) | ||
) | ||
) { | ||
editorElement.addEventListener("keyup", searchTrigger); | ||
editorElement.addEventListener("search", searchTrigger); | ||
editorElement.addEventListener("search", searchTrigger); | ||
@@ -473,13 +473,8 @@ | ||
Filter.prototype.getFilters = function(all, ajax){ | ||
var self = this, | ||
output = []; | ||
var output = []; | ||
if(all){ | ||
output = self.getHeaderFilters(); | ||
output = this.getHeaderFilters(); | ||
} | ||
self.filterList.forEach(function(filter){ | ||
output.push({field:filter.field, type:filter.type, value:filter.value}); | ||
}); | ||
if(ajax){ | ||
@@ -493,5 +488,32 @@ output.forEach(function(item){ | ||
output = output.concat(this.filtersToArray(this.filterList, ajax)); | ||
return output; | ||
}; | ||
//filter to Object | ||
Filter.prototype.filtersToArray = function(filterList, ajax){ | ||
var output = []; | ||
filterList.forEach((filter) => { | ||
var item; | ||
if(Array.isArray(filter)){ | ||
output.push(this.filtersToArray(filter, ajax)); | ||
}else{ | ||
item = {field:filter.field, type:filter.type, value:filter.value} | ||
if(ajax){ | ||
if(typeof item.type == "function"){ | ||
item.type = "function"; | ||
} | ||
} | ||
output.push(item); | ||
} | ||
}); | ||
return output; | ||
} | ||
//get all filters | ||
@@ -498,0 +520,0 @@ Filter.prototype.getHeaderFilters = function(){ |
@@ -156,3 +156,3 @@ | ||
tap = true; | ||
}); | ||
}, {passive: true}); | ||
@@ -205,3 +205,3 @@ self.element.addEventListener("touchend", function(e){ | ||
}); | ||
}, {passive: true}); | ||
@@ -388,3 +388,2 @@ self.element.addEventListener("touchend", function(e){ | ||
if(this.visible){ | ||
if(this.groupList.length){ | ||
@@ -399,2 +398,3 @@ this.groupList.forEach(function(group){ | ||
this.calcs.top.detachElement(); | ||
this.calcs.top.deleteCells(); | ||
} | ||
@@ -409,5 +409,5 @@ | ||
if(!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()){ | ||
if(this.calcs.bottom){ | ||
this.calcs.bottom.detachElement(); | ||
this.calcs.bottom.deleteCells(); | ||
} | ||
@@ -420,10 +420,16 @@ | ||
}else{ | ||
if(!this.groupList.length && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.options.groupClosedShowCalcs){ | ||
if(!this.groupList.length && this.groupManager.table.options.columnCalcs != "table"){ | ||
if(this.groupManager.table.modExists("columnCalcs")){ | ||
if(!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()){ | ||
if(this.calcs.top){ | ||
this.calcs.top.detachElement(); | ||
this.calcs.top.deleteCells(); | ||
} | ||
this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); | ||
output.push(this.calcs.top); | ||
if(this.groupManager.table.options.groupClosedShowCalcs){ | ||
this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); | ||
output.push(this.calcs.top); | ||
} | ||
} | ||
@@ -434,8 +440,13 @@ | ||
this.calcs.bottom.detachElement(); | ||
this.calcs.bottom.deleteCells(); | ||
} | ||
this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); | ||
output.push(this.calcs.bottom); | ||
if(this.groupManager.table.options.groupClosedShowCalcs){ | ||
this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); | ||
output.push(this.calcs.bottom); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
@@ -515,2 +526,3 @@ | ||
this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); | ||
}else{ | ||
@@ -885,5 +897,5 @@ this.groupManager.updateGroupRows(true); | ||
var groupHeader = {}; | ||
groupHeader.level = 0; | ||
groupHeader.rowCount = 0; | ||
groupHeader.headerContent = ""; | ||
groupHeader.level = 0; | ||
groupHeader.rowCount = 0; | ||
groupHeader.headerContent = ""; | ||
var childData = []; | ||
@@ -890,0 +902,0 @@ |
@@ -99,3 +99,3 @@ var MoveColumns = function(table){ | ||
}, self.checkPeriod); | ||
}); | ||
}, {passive: true}); | ||
@@ -146,3 +146,3 @@ colEl.addEventListener("touchmove", function(e){ | ||
} | ||
}); | ||
}, {passive: true}); | ||
@@ -149,0 +149,0 @@ colEl.addEventListener("touchend", function(e){ |
@@ -175,3 +175,3 @@ var MoveRows = function(table){ | ||
}, self.checkPeriod); | ||
}); | ||
}, {passive: true}); | ||
this.moving, this.toRow, this.toRowAfter | ||
@@ -178,0 +178,0 @@ element.addEventListener("touchmove", function(e){ |
@@ -44,3 +44,3 @@ var ResizeColumns = function(table){ | ||
handle.addEventListener("mousedown", handleDown); | ||
handle.addEventListener("touchstart", handleDown); | ||
handle.addEventListener("touchstart", handleDown, {passive: true}); | ||
@@ -78,3 +78,3 @@ //reszie column on double click | ||
prevHandle.addEventListener("mousedown", prevHandleDown); | ||
prevHandle.addEventListener("touchstart", prevHandleDown); | ||
prevHandle.addEventListener("touchstart", prevHandleDown, {passive: true}); | ||
@@ -160,3 +160,3 @@ //resize column on double click | ||
document.body.addEventListener("mouseup", mouseUp); | ||
handle.addEventListener("touchmove", mouseMove); | ||
handle.addEventListener("touchmove", mouseMove, {passive: true}); | ||
handle.addEventListener("touchend", mouseUp); | ||
@@ -163,0 +163,0 @@ }; |
@@ -29,3 +29,3 @@ var ResizeRows = function(table){ | ||
handle.addEventListener("mousedown", handleDown); | ||
handle.addEventListener("mousedown", handleDown, {passive: true}); | ||
handle.addEventListener("touchstart", handleDown); | ||
@@ -48,3 +48,3 @@ | ||
prevHandle.addEventListener("mousedown",prevHandleDown); | ||
prevHandle.addEventListener("touchstart",prevHandleDown); | ||
prevHandle.addEventListener("touchstart",prevHandleDown, {passive: true}); | ||
@@ -95,3 +95,3 @@ rowEl.appendChild(handle); | ||
handle.addEventListener("touchmove", mouseMove); | ||
handle.addEventListener("touchmove", mouseMove, {passive: true}); | ||
handle.addEventListener("touchend", mouseUp); | ||
@@ -98,0 +98,0 @@ }; |
@@ -43,4 +43,7 @@ var SelectRow = function(table){ | ||
if(self.table.options.selectable && self.table.options.selectable != "highlight"){ | ||
if(self.table.options.selectableRangeMode && self.table.options.selectableRangeMode === "click"){ | ||
if(self.table.options.selectableRangeMode === "click"){ | ||
element.addEventListener("click", function(e){ | ||
self.table._clearSelection(); | ||
if(e.shiftKey){ | ||
@@ -58,6 +61,13 @@ self.lastClickedRow = self.lastClickedRow || row; | ||
if(e.ctrlKey){ | ||
if(e.ctrlKey || e.metaKey){ | ||
toggledRows.forEach(function(toggledRow){ | ||
if(toggledRow !== self.lastClickedRow){ | ||
self.toggleRow(toggledRow) | ||
if(self.table.options.selectable !== true && !self.isRowSelected(row)){ | ||
if(self.selectedRows.length < self.table.options.selectable){ | ||
self.toggleRow(toggledRow); | ||
} | ||
}else{ | ||
self.toggleRow(toggledRow); | ||
} | ||
} | ||
@@ -68,6 +78,13 @@ }); | ||
self.deselectRows(); | ||
if(self.table.options.selectable !== true){ | ||
if(toggledRows.length > self.table.options.selectable){ | ||
toggledRows = toggledRows.slice(0, self.table.options.selectable) | ||
} | ||
} | ||
self.selectRows(toggledRows); | ||
} | ||
} | ||
else if(e.ctrlKey){ | ||
else if(e.ctrlKey || e.metaKey){ | ||
self.toggleRow(row); | ||
@@ -80,5 +97,9 @@ self.lastClickedRow = row; | ||
} | ||
self.table._clearSelection(); | ||
}); | ||
}else{ | ||
element.addEventListener("click", function(e){ | ||
self.table._clearSelection(); | ||
if(!self.selecting){ | ||
@@ -91,2 +112,4 @@ self.toggleRow(row); | ||
if(e.shiftKey){ | ||
self.table._clearSelection(); | ||
self.selecting = true; | ||
@@ -107,2 +130,3 @@ | ||
if(self.selecting){ | ||
self.table._clearSelection(); | ||
self.toggleRow(row); | ||
@@ -118,2 +142,3 @@ | ||
if(self.selecting){ | ||
self.table._clearSelection(); | ||
self.selectPrev.unshift(row); | ||
@@ -120,0 +145,0 @@ } |
@@ -206,3 +206,3 @@ var Validate = function(table){ | ||
required:function(cell, value, parameters){ | ||
return value !== "" & value !== null && typeof value !== "undefined"; | ||
return value !== "" && value !== null && typeof value !== "undefined"; | ||
}, | ||
@@ -209,0 +209,0 @@ }; |
@@ -717,71 +717,26 @@ var RowManager = function(table){ | ||
RowManager.prototype.getHtml = function(active){ | ||
var data = this.getData(active), | ||
columns = [], | ||
header = "", | ||
body = "", | ||
table = ""; | ||
RowManager.prototype.getComponents = function(active){ | ||
var self = this, | ||
output = []; | ||
//build header row | ||
this.table.columnManager.getColumns().forEach(function(column){ | ||
var def = column.getDefinition(); | ||
var rows = active ? self.activeRows : self.rows; | ||
if(column.visible && !def.hideInHtml){ | ||
header += `<th>${(def.title || "")}</th>`; | ||
columns.push(column); | ||
} | ||
}); | ||
rows.forEach(function(row){ | ||
output.push(row.getComponent()); | ||
}); | ||
//build body rows | ||
data.forEach(function(rowData){ | ||
var row = ""; | ||
return output; | ||
} | ||
columns.forEach(function(column){ | ||
var value = column.getFieldValue(rowData); | ||
RowManager.prototype.getDataCount = function(active){ | ||
return active ? this.activeRows.length : this.rows.length; | ||
}; | ||
if(typeof value === "undefined" || value === null){ | ||
value = ":"; | ||
} | ||
RowManager.prototype._genRemoteRequest = function(){ | ||
var self = this, | ||
table = self.table, | ||
options = table.options, | ||
params = {}; | ||
row += `<td>${value}</td>`; | ||
}); | ||
body += `<tr>${row}</tr>`; | ||
}); | ||
//build table | ||
table = `<table> | ||
<thead> | ||
<tr>${header}</tr> | ||
</thead> | ||
<tbody>${body}</tbody> | ||
</table>`; | ||
return table; | ||
}; | ||
RowManager.prototype.getComponents = function(active){ | ||
var self = this, | ||
output = []; | ||
var rows = active ? self.activeRows : self.rows; | ||
rows.forEach(function(row){ | ||
output.push(row.getComponent()); | ||
}); | ||
return output; | ||
} | ||
RowManager.prototype.getDataCount = function(active){ | ||
return active ? this.rows.length : this.activeRows.length; | ||
}; | ||
RowManager.prototype._genRemoteRequest = function(){ | ||
var self = this, | ||
table = self.table, | ||
options = table.options, | ||
params = {}; | ||
if(table.modExists("page")){ | ||
if(table.modExists("page")){ | ||
//set sort data if defined | ||
@@ -1096,4 +1051,38 @@ if(options.ajaxSorting){ | ||
RowManager.prototype.getVisibleRows = function(index){ | ||
return this.getDisplayRows().slice(this.vDomTop, this.vDomBottom + 1); | ||
RowManager.prototype.getVisibleRows = function(viewable){ | ||
var topEdge = this.element.scrollTop, | ||
bottomEdge = this.element.clientHeight + topEdge, | ||
topFound = false, | ||
topRow = 0, | ||
bottomRow = 0, | ||
rows = this.getDisplayRows(); | ||
if(viewable){ | ||
this.getDisplayRows(); | ||
for(var i = this.vDomTop; i <= this.vDomBottom; i++){ | ||
if(rows[i]){ | ||
if(!topFound){ | ||
if((topEdge - rows[i].getElement().offsetTop) >= 0){ | ||
topRow = i; | ||
}else{ | ||
topFound = true; | ||
} | ||
}else{ | ||
if(bottomEdge - rows[i].getElement().offsetTop >= 0){ | ||
bottomRow = i; | ||
}else{ | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
}else{ | ||
topRow = this.vDomTop; | ||
bottomRow = this.vDomBottom; | ||
} | ||
return rows.slice(topRow, bottomRow + 1); | ||
}; | ||
@@ -1100,0 +1089,0 @@ |
@@ -268,3 +268,3 @@ | ||
tap = true; | ||
}); | ||
}, {passive: true}); | ||
@@ -317,3 +317,3 @@ self.element.addEventListener("touchend", function(e){ | ||
}); | ||
}, {passive: true}); | ||
@@ -320,0 +320,0 @@ self.element.addEventListener("touchend", function(e){ |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
161
56023
3101509
83