ng2-json-editor
Version:
Angular2 component for editing large json documents
70 lines • 3.39 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.
*/
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
import { DomUtilService, PathUtilService, AppGlobalsService } from '../shared/services';
var TreeMenuComponent = (function () {
function TreeMenuComponent(domUtilService, pathUtilService, appGlobalsService) {
this.domUtilService = domUtilService;
this.pathUtilService = pathUtilService;
this.appGlobalsService = appGlobalsService;
this.prefixOrPath = '';
}
TreeMenuComponent.prototype.ngOnChanges = function (changes) {
if (changes['record']) {
this.keys = this.record.keySeq().toSet();
}
};
TreeMenuComponent.prototype.getChildPath = function (key) {
return "" + this.pathUtilService.separator + key;
};
TreeMenuComponent.prototype.trackByElement = function (index, element) {
return element;
};
Object.defineProperty(TreeMenuComponent.prototype, "adminMode$", {
get: function () {
return this.appGlobalsService.adminMode$;
},
enumerable: true,
configurable: true
});
return TreeMenuComponent;
}());
export { TreeMenuComponent };
TreeMenuComponent.decorators = [
{ type: Component, args: [{
selector: 'tree-menu',
styles: ["div.tree-menu-container { padding: 8px 2px 0 0; overflow-y: auto; text-align: center; } ul.menu-item-container { list-style: none; text-align: left; padding-top: 8px; padding-left: 0px; } ul.menu-item-container li { margin-bottom: 2px; } "],
template: "<div class=\"tree-menu-container\"> <ul class=\"menu-item-container\"> <li *ngFor=\"let key of keys | filterHiddenFields:schema:(adminMode$ | async) | addAlwaysShowFields:schema | sortAlphabetically; trackBy:trackByElement\"> <tree-menu-item [label]=\"key\" [value]=\"record.get(key)\" [schema]=\"schema.properties[key]\" [path]=\"getChildPath(key)\" [depth]=\"1\"></tree-menu-item> </li> </ul> </div>",
changeDetection: ChangeDetectionStrategy.OnPush
},] },
];
/** @nocollapse */
TreeMenuComponent.ctorParameters = function () { return [
{ type: DomUtilService, },
{ type: PathUtilService, },
{ type: AppGlobalsService, },
]; };
TreeMenuComponent.propDecorators = {
'record': [{ type: Input },],
'schema': [{ type: Input },],
};
//# sourceMappingURL=tree-menu.component.js.map