UNPKG

ng2-smart-table-custom

Version:

Angular Smart Table with inline-validations support

60 lines 2.88 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { Component, Input, Output, EventEmitter, ElementRef } from '@angular/core'; import { Grid } from '../../../lib/grid'; import { DataSource } from '../../../lib/data-source/data-source'; var AddButtonComponent = (function () { function AddButtonComponent(ref) { this.ref = ref; this.create = new EventEmitter(); } AddButtonComponent.prototype.ngAfterViewInit = function () { this.ref.nativeElement.classList.add('ng2-smart-actions-title', 'ng2-smart-actions-title-add'); }; AddButtonComponent.prototype.ngOnChanges = function () { this.isActionAdd = this.grid.getSetting('actions.add'); this.isCreateFormShownAlways = this.grid.getSetting('add.createFormShownAlways'); this.addNewButtonContent = this.grid.getSetting('add.addButtonContent'); }; AddButtonComponent.prototype.onAdd = function (event) { event.preventDefault(); event.stopPropagation(); if (this.grid.getSetting('mode') === 'external') { this.create.emit({ source: this.source, }); } else if (!this.isCreateFormShownAlways) { this.grid.createFormShown = true; } }; return AddButtonComponent; }()); __decorate([ Input(), __metadata("design:type", Grid) ], AddButtonComponent.prototype, "grid", void 0); __decorate([ Input(), __metadata("design:type", DataSource) ], AddButtonComponent.prototype, "source", void 0); __decorate([ Output(), __metadata("design:type", Object) ], AddButtonComponent.prototype, "create", void 0); AddButtonComponent = __decorate([ Component({ selector: '[ng2-st-add-button]', template: "\n <a *ngIf=\"isActionAdd && !isCreateFormShownAlways\" href=\"#\" class=\"ng2-smart-action ng2-smart-action-add-add\"\n [innerHTML]=\"addNewButtonContent\" (click)=\"onAdd($event)\"></a>\n ", }), __metadata("design:paramtypes", [ElementRef]) ], AddButtonComponent); export { AddButtonComponent }; //# sourceMappingURL=add-button.component.js.map