Browse Source

Move PropertyStackView to TS

pull/4849/head
Artur Arseniev 3 years ago
parent
commit
a6442e2fc3
  1. 18
      src/style_manager/view/PropertyStackView.ts

18
src/style_manager/view/PropertyStackView.js → 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;
Loading…
Cancel
Save