prop maths: prevent replacing variable names declared in formula's scope
This commit is contained in:
parent
d2f57ed3ef
commit
fd243c7689
2 changed files with 8 additions and 1 deletions
|
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## next
|
||||
|
||||
- bug fixes
|
||||
- property maths: variables names declared in a formula where replaced by their associated value if found in the formula's result
|
||||
|
||||
## 0.24.2
|
||||
|
||||
- bug fixes
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ class Widget extends EventEmitter {
|
|||
obj
|
||||
|
||||
var variables = {},
|
||||
mathscope = {},
|
||||
varnumber = 0
|
||||
|
||||
if (typeof propValue == 'string') {
|
||||
|
|
@ -291,6 +292,7 @@ class Widget extends EventEmitter {
|
|||
varnumber++
|
||||
|
||||
variables[varname] = r
|
||||
mathscope[varname] = r
|
||||
|
||||
return varname
|
||||
|
||||
|
|
@ -313,7 +315,7 @@ class Widget extends EventEmitter {
|
|||
|
||||
if (!this.parsers[m]) this.parsers[m] = math.compile(m.substr(2, m.length - 3).trim())
|
||||
|
||||
let r = this.parsers[m].eval(variables)
|
||||
let r = this.parsers[m].eval(mathscope)
|
||||
|
||||
if (r instanceof math.type.ResultSet && !r.entries.length) {
|
||||
r = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue