otsdaq_utilities  v2_05_02_indev
mutator.min.js
1 /* Tabulator v4.5.3 (c) Oliver Folkerd */
2 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)&&e&&(a=r.getFieldValue(e),"data"!=o&&void 0===a||(s=r.getComponent(),i="function"==typeof n.params?n.params(a,t,o,s):n.params,r.setFieldValue(t,n.mutator(a,t,o,i,s))))}),t},Mutator.prototype.transformCell=function(t,o){var e=t.column.modules.mutate.mutatorEdit||t.column.modules.mutate.mutator||!1,a={};return e?(a=Object.assign(a,t.row.getData()),t.column.setFieldValue(a,o),e.mutator(o,a,"edit",e.params,t.getComponent())):o},Mutator.prototype.enable=function(){this.enabled=!0},Mutator.prototype.disable=function(){this.enabled=!1},Mutator.prototype.mutators={},Tabulator.prototype.registerModule("mutator",Mutator);