Separate PropertiesModel load from constructor

This commit is contained in:
BoykoAlex
2017-08-31 10:17:46 -04:00
parent 80f1511462
commit a4e8891737
2 changed files with 6 additions and 14 deletions

View File

@@ -49,18 +49,9 @@ export class Editor implements Flo.Editor {
let bsModalRef = this.modelService.show(PropertiesDialogComponent);
let metadata : Flo.ElementMetadata = cell.attr('metadata');
bsModalRef.content.title = `Properties for ${metadata.name.toUpperCase()}`;
// metadata.properties().then((allProps : Array<Flo.PropertyMetadata>) => {
// let models = allProps.map(p => new Flo.PropertiesForm.GenericControlModel({
// id: p.id,
// name: p.name,
// defaultValue: p.defaultValue,
// attr: `props/${p.name}`,
// value: cell.attr(`props/${p.name}`),
// description: p.description
// }, Flo.PropertiesForm.InputType.TEXT));
// bsModalRef.content.addControlModels(models);
// });
bsModalRef.content.propertiesGroupModel = new SamplePropertiesGroupModel(cell);
let propertiesModel = new SamplePropertiesGroupModel(cell);
propertiesModel.load();
bsModalRef.content.propertiesGroupModel = propertiesModel;
}
validatePort(context : Flo.EditorContext, view : dia.ElementView, magnet : SVGElement) {

View File

@@ -106,10 +106,11 @@ export namespace Properties {
constructor(cell : dia.Cell) {
this.cell = cell;
this.init();
}
private init() {
load() {
this.loading = true;
this._loadedSubject.next(false);
this.createProperties().then(properties => {
this.controlModels = properties.map(p => this.createControlModel(p));
this.loading = false;