Browse Source

Fix for custom getValue/setValue in TraitView (#6204)

Fix for custom getValue/setValue in TraitView. Closes #6180
pull/6206/head
Artur Arseniev 1 year ago
committed by GitHub
parent
commit
05ada9eba0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  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