tabulator-tables
Version:
Interactive table generation JavaScript library
2 lines • 1.5 kB
JavaScript
/* Tabulator v4.9.3 (c) Oliver Folkerd */
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},Accessor=function(o){this.table=o,this.allowedTypes=["","data","download","clipboard","print","htmlOutput"]};Accessor.prototype.initializeColumn=function(o){var e=this,s=!1,t={};this.allowedTypes.forEach(function(r){var c,a="accessor"+(r.charAt(0).toUpperCase()+r.slice(1));o.definition[a]&&(c=e.lookupAccessor(o.definition[a]))&&(s=!0,t[a]={accessor:c,params:o.definition[a+"Params"]||{}})}),s&&(o.modules.accessor=t)},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="accessor"+(e.charAt(0).toUpperCase()+e.slice(1)),t=o.getComponent(),r=Tabulator.prototype.helpers.deepClone(o.data||{});return this.table.columnManager.traverse(function(o){var c,a,n,i;o.modules.accessor&&(a=o.modules.accessor[s]||o.modules.accessor.accessor||!1)&&"undefined"!=(c=o.getFieldValue(r))&&(i=o.getComponent(),n="function"==typeof a.params?a.params(c,r,e,i,t):a.params,o.setFieldValue(r,a.accessor(c,r,e,n,i,t)))}),r},Accessor.prototype.accessors={},Tabulator.prototype.registerModule("accessor",Accessor);