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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
7 additions and
5 deletions
-
packages/core/src/trait_manager/model/Trait.ts
-
packages/core/src/trait_manager/view/TraitView.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'); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|