Browse Source

Fix for custom getValue/setValue in TraitView. Closes #6180

pull/6204/head
Artur Arseniev 1 year ago
parent
commit
9e97ae13f5
  1. 2
      packages/core/src/trait_manager/model/Trait.ts
  2. 10
      packages/core/src/trait_manager/view/TraitView.ts

2
packages/core/src/trait_manager/model/Trait.ts

@ -110,7 +110,7 @@ export default class Trait extends Model<TraitProperties> {
}
updateValueFromDataVariable(value: string) {
this.setTargetValue(value);
this.setValue(value);
this.trigger('change:value');
}

10
packages/core/src/trait_manager/view/TraitView.ts

@ -117,13 +117,15 @@ export default class TraitView extends View<Trait> {
* On change callback
* @private
*/
onValueChange(model: Trait, value: string, opts: SetOptions & { fromTarget?: boolean } = {}) {
onValueChange(_m: Trait, _v: string, opts: SetOptions & { fromTarget?: boolean } = {}) {
const { model } = this;
const value = this.getValueForTarget();
if (opts.fromTarget) {
this.setInputValue(model.get('value'));
this.setInputValue(value);
this.postUpdate();
} else {
const val = this.getValueForTarget();
model?.setTargetValue(val, opts);
model.setValue(value, opts as any);
}
}

Loading…
Cancel
Save