diff --git a/src/style_manager/view/PropertyStackView.js b/src/style_manager/view/PropertyStackView.ts similarity index 84% rename from src/style_manager/view/PropertyStackView.js rename to src/style_manager/view/PropertyStackView.ts index 3b7b3e08a..f7646260b 100644 --- a/src/style_manager/view/PropertyStackView.js +++ b/src/style_manager/view/PropertyStackView.ts @@ -1,8 +1,13 @@ import PropertyCompositeView from './PropertyCompositeView'; import PropertiesView from './PropertiesView'; import LayersView from './LayersView'; +import PropertyStack from '../model/PropertyStack'; export default class PropertyStackView extends PropertyCompositeView { + // @ts-ignore + model: PropertyStack; + layersView?: LayersView; + events() { return { ...PropertyCompositeView.prototype.events(), @@ -43,17 +48,18 @@ export default class PropertyStackView extends PropertyCompositeView { remove() { this.layersView?.remove(); - PropertyCompositeView.prototype.remove.apply(this, arguments); + PropertyCompositeView.prototype.remove.apply(this, arguments as any); + return this; } clearCached() { - PropertyCompositeView.prototype.clearCached.apply(this, arguments); - this.layersView = null; + PropertyCompositeView.prototype.clearCached.apply(this, arguments as any); + delete this.layersView; } onRender() { const { model, el, config } = this; - const props = model.get('properties'); + const props = model.get('properties')!; if (props.length && !this.props) { const propsView = new PropertiesView({ @@ -62,6 +68,7 @@ export default class PropertyStackView extends PropertyCompositeView { highlightComputed: false, highlightChanged: false, }, + // @ts-ignore collection: props, parent: this, }); @@ -69,12 +76,13 @@ export default class PropertyStackView extends PropertyCompositeView { const layersView = new LayersView({ collection: model.__getLayers(), + // @ts-ignore config, propertyView: this, }); layersView.render(); - const fieldEl = el.querySelector('[data-layers-wrapper]'); + const fieldEl = el.querySelector('[data-layers-wrapper]')!; fieldEl.appendChild(layersView.el); this.props = propsView; this.layersView = layersView;