UNPKG

ng2-json-editor

Version:

Angular2 component for editing large json documents

57 lines 3.13 kB
/* * This file is part of ng2-json-editor. * Copyright (C) 2017 CERN. * * ng2-json-editor is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * ng2-json-editor is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ng2-json-editor; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * In applying this license, CERN does not * waive the privileges and immunities granted to it by virtue of its status * as an Intergovernmental Organization or submit itself to any jurisdiction. */ import { Component, Input, ChangeDetectionStrategy } from '@angular/core'; import { JsonStoreService } from '../shared/services'; var PatchActionsComponent = (function () { function PatchActionsComponent(jsonStoreService) { this.jsonStoreService = jsonStoreService; } PatchActionsComponent.prototype.onAcceptClick = function () { this.jsonStoreService.applyPatch(this.patch); }; PatchActionsComponent.prototype.onRejectClick = function () { this.jsonStoreService.rejectPatch(this.patch); }; PatchActionsComponent.prototype.onAddNewClick = function () { this.patch.op = 'add-as-new'; this.jsonStoreService.applyPatch(this.patch); }; return PatchActionsComponent; }()); export { PatchActionsComponent }; PatchActionsComponent.decorators = [ { type: Component, args: [{ selector: 'patch-actions', styles: [".patch-actions-container { display: inline-block; padding-left: 2px; } .patch-actions-container > button { border: none; background-color: transparent; padding: 1px 3px 1.5px; } .patch-actions-container > button .fa { font-size: 18px; } .patch-actions-container > button .fa-check-circle { color: #27ae60; } .patch-actions-container > button .fa-times-circle { color: #e74c3c; } .patch-actions-container > button .fa-plus-circle { color: #f1c40f; } "], template: "<div class=\"patch-actions-container\" [ngClass]=\"patch.op\" tabindex=\"-1\"> <button (click)=\"onAcceptClick()\"><i class=\"fa fa-check-circle\"></i></button> <button (click)=\"onRejectClick()\"><i class=\"fa fa-times-circle\"></i></button> <button *ngIf=\"addActionEnabled\" (click)=\"onAddNewClick()\"><i class=\"fa fa-plus-circle\" ></i></button> </div>", changeDetection: ChangeDetectionStrategy.OnPush },] }, ]; /** @nocollapse */ PatchActionsComponent.ctorParameters = function () { return [ { type: JsonStoreService, }, ]; }; PatchActionsComponent.propDecorators = { 'patch': [{ type: Input },], 'addActionEnabled': [{ type: Input },], }; //# sourceMappingURL=patch-actions.component.js.map