ng2-json-editor
Version:
Angular2 component for editing large json documents
71 lines • 4.35 kB
JavaScript
/*
* This file is part of ng2-json-editor.
* Copyright (C) 2016 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.
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { Component, Input, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { AbstractListFieldComponent } from '../abstract-list-field';
import { AppGlobalsService, JsonStoreService, PathUtilService, ProblemsService } from '../shared/services';
var PrimitiveListFieldComponent = (function (_super) {
__extends(PrimitiveListFieldComponent, _super);
function PrimitiveListFieldComponent(appGlobalsService, problemsService, jsonStoreService, pathUtilService, changeDetectorRef) {
var _this = _super.call(this, appGlobalsService, problemsService, jsonStoreService, pathUtilService, changeDetectorRef) || this;
_this.appGlobalsService = appGlobalsService;
_this.problemsService = problemsService;
_this.jsonStoreService = jsonStoreService;
_this.pathUtilService = pathUtilService;
_this.changeDetectorRef = changeDetectorRef;
return _this;
}
return PrimitiveListFieldComponent;
}(AbstractListFieldComponent));
export { PrimitiveListFieldComponent };
PrimitiveListFieldComponent.decorators = [
{ type: Component, args: [{
selector: 'primitive-list-field',
styles: ["td { padding: 0px !important; } "],
template: "<div [id]=\"pathString\" [ngClass]=\"redLeftBorderClass\"> <div class=\"wide\"> <table class=\"table\"> <tr *ngFor=\"let value of values | selfOrEmpty:schema; let i = index; trackBy:trackByIndex\"> <td> <any-type-field [value]=\"value\" [schema]=\"schema.items\" [path]=\"getPathForChild(i)\"></any-type-field> </td> <td *ngIf=\"values.size > 0\" class=\"button-holder\" [class.sortable]=\"schema.sortable\"> <list-action-group (onMove)=\"moveElement(i, $event)\" (onDelete)=\"deleteElement(i, value)\" [canMove]=\"schema.sortable\" [isDisabled]=\"disabled\"></list-action-group> </td> </tr> <tr *ngIf=\"removeJsonPatch\"> <patch-actions [patch]=\"removeJsonPatch\"></patch-actions> </tr> </table> <table class=\"table\"> <tr *ngFor=\"let patch of addJsonPatches\"> <add-or-replace-patch [patch]=\"patch\"></add-or-replace-patch> </tr> <tr *ngIf=\"replaceJsonPatches && replaceJsonPatches[0]\"> <add-or-replace-patch [patch]=\"replaceJsonPatches[0]\"></add-or-replace-patch> </tr> </table> </div> </div> ",
changeDetection: ChangeDetectionStrategy.OnPush
},] },
];
/** @nocollapse */
PrimitiveListFieldComponent.ctorParameters = function () { return [
{ type: AppGlobalsService, },
{ type: ProblemsService, },
{ type: JsonStoreService, },
{ type: PathUtilService, },
{ type: ChangeDetectorRef, },
]; };
PrimitiveListFieldComponent.propDecorators = {
'values': [{ type: Input },],
'supportValues': [{ type: Input },],
'schema': [{ type: Input },],
'path': [{ type: Input },],
};
//# sourceMappingURL=primitive-list-field.component.js.map