amis-formula 1.3.4 → 1.3.5

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-formula v1.3.4
2
+ * amis-formula v1.3.5
3
3
  * Copyright 2021 fex
4
4
  */
5
5
 
@@ -3225,12 +3225,19 @@ function pickValues(names, data) {
3225
3225
  }
3226
3226
  function resolveVariable(path, data) {
3227
3227
  if (data === void 0) { data = {}; }
3228
- if (path === '&') {
3228
+ if (path === '&' || path == '$$') {
3229
3229
  return data;
3230
3230
  }
3231
3231
  else if (!path || typeof path !== 'string') {
3232
3232
  return undefined;
3233
3233
  }
3234
+ else if (!~path.indexOf(':')) {
3235
+ // 简单用法直接用 getVariable
3236
+ return getVariable(data, path[0] === '$' ? path.substring(1) : path);
3237
+ }
3238
+ // window:xxx ls:xxx.xxx
3239
+ // 带 namespace 的用公式
3240
+ // 主要是用公式会严格点,不能出现奇怪的变量名
3234
3241
  try {
3235
3242
  return new Evaluator(data).evalute(parse(path, {
3236
3243
  variableMode: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amis-formula",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "负责 amis 里面的表达式实现,内置公式,编辑器等",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {