1 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; };
5 var Accessor =
function Accessor(table) {
7 this.allowedTypes = [
"",
"data",
"download",
"clipboard"];
11 Accessor.prototype.initializeColumn =
function (column) {
16 this.allowedTypes.forEach(
function (type) {
17 var key =
"accessor" + (type.charAt(0).toUpperCase() + type.slice(1)),
20 if (column.definition[key]) {
21 accessor =
self.lookupAccessor(column.definition[key]);
28 params: column.definition[key +
"Params"] || {}
35 column.modules.accessor = config;
37 }, Accessor.prototype.lookupAccessor =
function (value) {
41 switch (typeof value ===
"undefined" ?
"undefined" : _typeof(value)) {
43 if (this.accessors[value]) {
44 accessor = this.accessors[value];
46 console.warn(
"Accessor Error - No such accessor found, ignoring: ", value);
59 Accessor.prototype.transformRow =
function (dataIn, type) {
61 key =
"accessor" + (type.charAt(0).toUpperCase() + type.slice(1));
64 var data = Tabulator.prototype.helpers.deepClone(dataIn || {});
66 self.table.columnManager.traverse(
function (column) {
67 var value, accessor, params, component;
69 if (column.modules.accessor) {
71 accessor = column.modules.accessor[key] || column.modules.accessor.accessor ||
false;
74 value = column.getFieldValue(data);
76 if (value !=
"undefined") {
77 component = column.getComponent();
78 params = typeof accessor.params ===
"function" ? accessor.params(value, data, type, component) : accessor.params;
79 column.setFieldValue(data, accessor.accessor(value, data, type, params, component));
89 Accessor.prototype.accessors = {};
91 Tabulator.prototype.registerModule(
"accessor", Accessor);