UNPKG

ng2-smart-table-custom

Version:

Angular Smart Table with inline-validations support

75 lines 3.23 kB
var Column = (function () { function Column(id, settings, dataSet) { this.id = id; this.settings = settings; this.dataSet = dataSet; this.title = ''; this.type = ''; this.class = ''; this.width = ''; this.isSortable = false; this.isEditable = true; this.isAddable = true; this.isFilterable = false; this.sortDirection = ''; this.defaultSortDirection = ''; this.editor = { type: '', config: {}, component: null }; this.filter = { type: '', config: {} }; this.renderComponent = null; this.process(); } Column.prototype.getOnComponentInitFunction = function () { return this.onComponentInitFunction; }; Column.prototype.getCompareFunction = function () { return this.compareFunction; }; Column.prototype.getValuePrepareFunction = function () { return this.valuePrepareFunction; }; Column.prototype.getFilterFunction = function () { return this.filterFunction; }; Column.prototype.getConfig = function () { return this.editor && this.editor.config; }; Column.prototype.getFilterType = function () { return this.filter && this.filter.type; }; Column.prototype.getFilterConfig = function () { return this.filter && this.filter.config; }; Column.prototype.process = function () { this.title = this.settings['title']; this.class = this.settings['class']; this.width = this.settings['width']; this.type = this.prepareType(); this.editor = this.settings['editor']; this.filter = this.settings['filter']; this.renderComponent = this.settings['renderComponent']; this.isFilterable = typeof this.settings['filter'] === 'undefined' ? true : !!this.settings['filter']; this.defaultSortDirection = ['asc', 'desc'] .indexOf(this.settings['sortDirection']) !== -1 ? this.settings['sortDirection'] : ''; this.isSortable = typeof this.settings['sort'] === 'undefined' ? true : !!this.settings['sort']; this.isEditable = typeof this.settings['editable'] === 'undefined' ? true : !!this.settings['editable']; this.isAddable = typeof this.settings['addable'] === 'undefined' ? true : !!this.settings['addable']; this.sortDirection = this.prepareSortDirection(); this.compareFunction = this.settings['compareFunction']; this.valuePrepareFunction = this.settings['valuePrepareFunction']; this.filterFunction = this.settings['filterFunction']; this.onComponentInitFunction = this.settings['onComponentInitFunction']; }; Column.prototype.prepareType = function () { return this.settings['type'] || this.determineType(); }; Column.prototype.prepareSortDirection = function () { return this.settings['sort'] === 'desc' ? 'desc' : 'asc'; }; Column.prototype.determineType = function () { // TODO: determine type by data return 'text'; }; return Column; }()); export { Column }; //# sourceMappingURL=column.js.map