amis-formula 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-formula v1.3.
|
|
2
|
+
* amis-formula v1.3.3
|
|
3
3
|
* Copyright 2021 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1839,18 +1839,14 @@ function lexer(input, options) {
|
|
|
1839
1839
|
}
|
|
1840
1840
|
else {
|
|
1841
1841
|
// 支持旧的 $varName 的取值方法
|
|
1842
|
-
var
|
|
1843
|
-
|
|
1844
|
-
j <= input.length) {
|
|
1845
|
-
j++;
|
|
1846
|
-
}
|
|
1847
|
-
if (j - i > 2) {
|
|
1842
|
+
var match = /^[a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+)*/.exec(input.substring(i + 1));
|
|
1843
|
+
if (match) {
|
|
1848
1844
|
tokenCache.push({
|
|
1849
1845
|
type: TokenName[TokenEnum.Variable],
|
|
1850
|
-
value:
|
|
1851
|
-
raw:
|
|
1846
|
+
value: match[0],
|
|
1847
|
+
raw: match[0],
|
|
1852
1848
|
start: position(input.substring(index, i)),
|
|
1853
|
-
end: position(input.substring(index,
|
|
1849
|
+
end: position(input.substring(index, i + 1 + match[0].length))
|
|
1854
1850
|
});
|
|
1855
1851
|
break;
|
|
1856
1852
|
}
|
|
@@ -2309,7 +2305,7 @@ function lexer(input, options) {
|
|
|
2309
2305
|
var chunk = '';
|
|
2310
2306
|
while (i < input.length) {
|
|
2311
2307
|
var ch = input[i];
|
|
2312
|
-
if (/^[\u4e00-\u9fa5A-Za-z_$@][\u4e00-\u9fa5A-Za-z0-9_]*$/.test(chunk + ch)) {
|
|
2308
|
+
if (/^[\u4e00-\u9fa5A-Za-z_$@][\u4e00-\u9fa5A-Za-z0-9_\-]*$/.test(chunk + ch)) {
|
|
2313
2309
|
chunk += ch;
|
|
2314
2310
|
i++;
|
|
2315
2311
|
}
|
|
@@ -2948,10 +2944,16 @@ function parse(input, options) {
|
|
|
2948
2944
|
next();
|
|
2949
2945
|
return {
|
|
2950
2946
|
type: 'script',
|
|
2951
|
-
body: {
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2947
|
+
body: prevToken.value.split('.').reduce(function (prev, key) {
|
|
2948
|
+
return prev ? {
|
|
2949
|
+
type: 'getter',
|
|
2950
|
+
host: prev,
|
|
2951
|
+
key: key
|
|
2952
|
+
} : {
|
|
2953
|
+
type: 'variable',
|
|
2954
|
+
name: key
|
|
2955
|
+
};
|
|
2956
|
+
}, null)
|
|
2955
2957
|
};
|
|
2956
2958
|
}
|
|
2957
2959
|
next();
|