Browse Source

Fix style views

pull/4080/head
Artur Arseniev 4 years ago
parent
commit
5af9be77c2
  1. 2
      src/style_manager/model/PropertyComposite.js
  2. 4
      src/style_manager/view/PropertyColorView.js
  3. 2
      src/style_manager/view/PropertyCompositeView.js
  4. 2
      src/style_manager/view/PropertyNumberView.js
  5. 2
      src/style_manager/view/PropertyRadioView.js
  6. 2
      src/style_manager/view/PropertyStackView.js
  7. 2
      src/style_manager/view/PropertyView.js

2
src/style_manager/model/PropertyComposite.js

@ -1,5 +1,6 @@
import { isString, isUndefined, keys } from 'underscore';
import Property from './Property';
import Properties from './Properties';
export const isNumberType = type => type === 'integer' || type === 'number';
@ -54,7 +55,6 @@ export default class PropertyComposite extends Property {
initialize(props = {}, opts = {}) {
Property.callParentInit(Property, this, props, opts);
const { em } = this;
const Properties = require('./Properties').default;
const properties = new Properties(this.get('properties') || [], { em, parentProp: this });
this.set('properties', properties, { silent: 1 });
this.listenTo(properties, 'change', this.__upProperties);

4
src/style_manager/view/PropertyColorView.js

@ -3,14 +3,14 @@ import InputColor from 'domain_abstract/ui/InputColor';
export default class PropertyColorView extends PropertyNumberView {
setValue(value) {
this.inputInst.setValue(value, { fromTarget: 1, def: this.model.getDefaultValue() });
this.inputInst?.setValue(value, { fromTarget: 1, def: this.model.getDefaultValue() });
}
remove() {
PropertyNumberView.prototype.remove.apply(this, arguments);
const inp = this.inputInst;
inp && inp.remove && inp.remove();
['inputInst', '$color'].forEach(i => (this[i] = {}));
['inputInst', '$color'].forEach(i => (this[i] = null));
}
__handleChange(value, partial) {

2
src/style_manager/view/PropertyCompositeView.js

@ -20,7 +20,7 @@ export default class PropertyCompositeView extends PropertyView {
onRender() {
const { model, pfx } = this;
const props = model.getProperties();
const props = model.get('properties');
if (props.length && !this.props) {
const detached = model.isDetached();

2
src/style_manager/view/PropertyNumberView.js

@ -14,7 +14,7 @@ export default class PropertyNumberView extends PropertyView {
setValue(value) {
const parsed = this.model.parseValue(value);
value = `${parsed.value}${parsed.unit}`;
this.inputInst.setValue(value, { silent: 1 });
this.inputInst?.setValue(value, { silent: 1 });
}
onRender() {

2
src/style_manager/view/PropertyRadioView.js

@ -39,7 +39,7 @@ export default class PropertyRadioView extends PropertySelectView {
}
__setValueInput(value) {
const model = this.model;
const { model } = this;
const id = value || model.getDefaultValue();
const inputIn = this.getInputEl()?.querySelector(`[value="${id}"]`);
inputIn && (inputIn.checked = true);

2
src/style_manager/view/PropertyStackView.js

@ -53,7 +53,7 @@ export default class PropertyStackView extends PropertyCompositeView {
onRender() {
const { model, el, config } = this;
const props = model.getProperties();
const props = model.get('properties');
if (props.length && !this.props) {
const propsView = new PropertiesView({

2
src/style_manager/view/PropertyView.js

@ -65,7 +65,7 @@ export default class Property extends View {
remove() {
View.prototype.remove.apply(this, arguments);
['em', 'input', '$input', 'view'].forEach(i => (this[i] = {}));
['em', 'input', '$input', 'view'].forEach(i => (this[i] = null));
this.__destroyFn(this._getClbOpts());
}

Loading…
Cancel
Save