UNPKG

ng2-stable-nxtc

Version:

Angular Smart Table neXtCode Version

61 lines 2.55 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'; let AddButtonComponent = class AddButtonComponent { constructor(ref) { this.ref = ref; this.create = new EventEmitter(); } ngAfterViewInit() { this.ref.nativeElement.classList.add('ng2-smart-actions-title', 'ng2-smart-actions-title-add'); } ngOnChanges() { this.isActionAdd = this.grid.getSetting('actions.add'); this.addNewButtonContent = this.grid.getSetting('add.addButtonContent'); } onAdd(event) { event.preventDefault(); event.stopPropagation(); if (this.grid.getSetting('mode') === 'external') { this.create.emit({ source: this.source, }); } else { this.grid.createFormShown = true; } } }; __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: ` <a *ngIf="isActionAdd" href="#" class="ng2-smart-action ng2-smart-action-add-add" [innerHTML]="addNewButtonContent" (click)="onAdd($event)"></a> `, }), __metadata("design:paramtypes", [ElementRef]) ], AddButtonComponent); export { AddButtonComponent }; //# sourceMappingURL=add-button.component.js.map