amis-core 2.9.0 → 3.0.0

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 (265) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +1 -1
  3. package/esm/SchemaRenderer.d.ts +1 -0
  4. package/esm/SchemaRenderer.js +7 -5
  5. package/esm/Scoped.js +1 -1
  6. package/esm/WithRootStore.js +1 -1
  7. package/esm/WithStore.js +1 -1
  8. package/esm/actions/Action.js +8 -2
  9. package/esm/actions/AjaxAction.js +1 -1
  10. package/esm/actions/BreakAction.js +1 -1
  11. package/esm/actions/BroadcastAction.js +1 -1
  12. package/esm/actions/CmptAction.js +1 -1
  13. package/esm/actions/ContinueAction.js +1 -1
  14. package/esm/actions/CopyAction.js +1 -1
  15. package/esm/actions/CustomAction.js +1 -1
  16. package/esm/actions/DialogAction.js +5 -1
  17. package/esm/actions/DrawerAction.js +1 -1
  18. package/esm/actions/EmailAction.js +1 -1
  19. package/esm/actions/LinkAction.js +1 -1
  20. package/esm/actions/LoopAction.js +1 -1
  21. package/esm/actions/PageAction.js +1 -1
  22. package/esm/actions/ParallelAction.js +1 -1
  23. package/esm/actions/SwitchAction.js +1 -1
  24. package/esm/actions/ToastAction.js +1 -1
  25. package/esm/components/LazyComponent.js +1 -1
  26. package/esm/components/Overlay.d.ts +2 -2
  27. package/esm/components/Overlay.js +1 -1
  28. package/esm/components/PopOver.js +1 -1
  29. package/esm/env.js +1 -1
  30. package/esm/envOverwrite.js +1 -1
  31. package/esm/factory.d.ts +2 -1
  32. package/esm/factory.js +3 -3
  33. package/esm/index.d.ts +8 -3
  34. package/esm/index.js +10 -9
  35. package/esm/locale.js +1 -1
  36. package/esm/renderers/Form.d.ts +1 -1
  37. package/esm/renderers/Form.js +1 -1
  38. package/esm/renderers/Item.js +10 -7
  39. package/esm/renderers/Options.js +3 -3
  40. package/esm/renderers/Placeholder.js +1 -1
  41. package/esm/renderers/builtin.js +1 -1
  42. package/esm/renderers/register.js +1 -1
  43. package/esm/renderers/wrapControl.js +1 -1
  44. package/esm/store/app.js +1 -1
  45. package/esm/store/combo.js +1 -1
  46. package/esm/store/crud.js +22 -8
  47. package/esm/store/form.js +1 -1
  48. package/esm/store/formItem.js +2 -2
  49. package/esm/store/iRenderer.js +1 -1
  50. package/esm/store/index.js +1 -1
  51. package/esm/store/list.js +1 -1
  52. package/esm/store/manager.js +1 -1
  53. package/esm/store/modal.js +1 -1
  54. package/esm/store/node.js +1 -1
  55. package/esm/store/pagination.js +2 -2
  56. package/esm/store/root.js +1 -1
  57. package/esm/store/service.js +1 -1
  58. package/esm/store/table.d.ts +24 -23
  59. package/esm/store/table.js +17 -4
  60. package/esm/store/table2.d.ts +5 -5
  61. package/esm/store/table2.js +23 -19
  62. package/esm/theme.js +1 -1
  63. package/esm/types.d.ts +6 -0
  64. package/esm/utils/Animation.js +1 -1
  65. package/esm/utils/ColorScale.js +1 -1
  66. package/esm/utils/DataSchema.js +1 -1
  67. package/esm/utils/DataScope.js +1 -1
  68. package/esm/utils/RootClose.js +1 -1
  69. package/esm/utils/SimpleMap.js +1 -1
  70. package/esm/utils/api.js +9 -2
  71. package/esm/utils/attachmentAdpator.js +1 -1
  72. package/esm/utils/autobind.js +1 -1
  73. package/esm/utils/columnsSplit.js +1 -1
  74. package/esm/utils/dataMapping.js +1 -1
  75. package/esm/utils/date.js +1 -1
  76. package/esm/utils/debug.js +4 -4
  77. package/esm/utils/decodeEntity.js +1 -1
  78. package/esm/utils/dom.d.ts +2 -0
  79. package/esm/utils/dom.js +47 -10
  80. package/esm/utils/errors.js +1 -1
  81. package/esm/utils/escapeHtml.js +1 -1
  82. package/esm/utils/filter-schema.js +1 -1
  83. package/esm/utils/filter.js +1 -1
  84. package/esm/utils/formatDuration.js +1 -1
  85. package/esm/utils/formula.js +2 -2
  86. package/esm/utils/getVariable.js +1 -1
  87. package/esm/utils/grammar.js +1 -1
  88. package/esm/utils/handleAction.js +1 -1
  89. package/esm/utils/helper.d.ts +7 -0
  90. package/esm/utils/helper.js +28 -3
  91. package/esm/utils/highlight.js +1 -1
  92. package/esm/utils/icon.d.ts +6 -1
  93. package/esm/utils/icon.js +6 -1
  94. package/esm/utils/image.js +1 -1
  95. package/esm/utils/isPureVariable.js +1 -1
  96. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  97. package/esm/utils/keyToPath.js +1 -1
  98. package/esm/utils/makeSorter.js +1 -1
  99. package/esm/utils/normalizeLink.js +1 -1
  100. package/esm/utils/normalizeOptions.js +1 -1
  101. package/esm/utils/object.js +1 -1
  102. package/esm/utils/offset.js +1 -1
  103. package/esm/utils/offsetParent.js +1 -1
  104. package/esm/utils/optionValueCompare.js +1 -1
  105. package/esm/utils/position.js +1 -1
  106. package/esm/utils/prettyBytes.js +1 -1
  107. package/esm/utils/renderer-event.js +35 -32
  108. package/esm/utils/replaceText.js +1 -1
  109. package/esm/utils/resize-sensor.js +1 -1
  110. package/esm/utils/resolveCondition.d.ts +1 -0
  111. package/esm/utils/resolveCondition.js +19 -4
  112. package/esm/utils/resolveVariable.js +1 -1
  113. package/esm/utils/resolveVariableAndFilter.js +1 -1
  114. package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
  115. package/esm/utils/resolveVariableAndFilterForAsync.js +20 -3
  116. package/esm/utils/scrollPosition.js +1 -1
  117. package/esm/utils/string2regExp.js +1 -1
  118. package/esm/utils/stripNumber.js +1 -1
  119. package/esm/utils/style-helper.d.ts +9 -4
  120. package/esm/utils/style-helper.js +81 -16
  121. package/esm/utils/style.js +2 -2
  122. package/esm/utils/toNumber.js +1 -1
  123. package/esm/utils/tokenize.d.ts +1 -0
  124. package/esm/utils/tokenize.js +34 -3
  125. package/esm/utils/tpl-builtin.d.ts +2 -1
  126. package/esm/utils/tpl-builtin.js +18 -3
  127. package/esm/utils/tpl-lodash.js +3 -2
  128. package/esm/utils/tpl.d.ts +2 -0
  129. package/esm/utils/tpl.js +24 -2
  130. package/esm/utils/uncontrollable.js +1 -1
  131. package/esm/utils/validations.d.ts +4 -1
  132. package/esm/utils/validations.js +27 -12
  133. package/lib/Root.js +1 -1
  134. package/lib/RootRenderer.js +1 -1
  135. package/lib/SchemaRenderer.d.ts +1 -0
  136. package/lib/SchemaRenderer.js +7 -4
  137. package/lib/Scoped.js +1 -1
  138. package/lib/WithRootStore.js +1 -1
  139. package/lib/WithStore.js +1 -1
  140. package/lib/actions/Action.js +8 -2
  141. package/lib/actions/AjaxAction.js +1 -1
  142. package/lib/actions/BreakAction.js +1 -1
  143. package/lib/actions/BroadcastAction.js +1 -1
  144. package/lib/actions/CmptAction.js +1 -1
  145. package/lib/actions/ContinueAction.js +1 -1
  146. package/lib/actions/CopyAction.js +1 -1
  147. package/lib/actions/CustomAction.js +1 -1
  148. package/lib/actions/DialogAction.js +5 -1
  149. package/lib/actions/DrawerAction.js +1 -1
  150. package/lib/actions/EmailAction.js +1 -1
  151. package/lib/actions/LinkAction.js +1 -1
  152. package/lib/actions/LoopAction.js +1 -1
  153. package/lib/actions/PageAction.js +1 -1
  154. package/lib/actions/ParallelAction.js +1 -1
  155. package/lib/actions/SwitchAction.js +1 -1
  156. package/lib/actions/ToastAction.js +1 -1
  157. package/lib/components/LazyComponent.js +1 -1
  158. package/lib/components/Overlay.d.ts +2 -2
  159. package/lib/components/Overlay.js +1 -1
  160. package/lib/components/PopOver.js +1 -1
  161. package/lib/env.js +1 -1
  162. package/lib/envOverwrite.js +1 -1
  163. package/lib/factory.d.ts +2 -1
  164. package/lib/factory.js +3 -3
  165. package/lib/index.d.ts +8 -3
  166. package/lib/index.js +14 -2
  167. package/lib/locale.js +1 -1
  168. package/lib/renderers/Form.d.ts +1 -1
  169. package/lib/renderers/Form.js +1 -1
  170. package/lib/renderers/Item.js +10 -7
  171. package/lib/renderers/Options.js +3 -3
  172. package/lib/renderers/Placeholder.js +1 -1
  173. package/lib/renderers/builtin.js +1 -1
  174. package/lib/renderers/register.js +1 -1
  175. package/lib/renderers/wrapControl.js +1 -1
  176. package/lib/store/app.js +1 -1
  177. package/lib/store/combo.js +1 -1
  178. package/lib/store/crud.js +22 -8
  179. package/lib/store/form.js +1 -1
  180. package/lib/store/formItem.js +2 -2
  181. package/lib/store/iRenderer.js +1 -1
  182. package/lib/store/index.js +1 -1
  183. package/lib/store/list.js +1 -1
  184. package/lib/store/manager.js +1 -1
  185. package/lib/store/modal.js +1 -1
  186. package/lib/store/node.js +1 -1
  187. package/lib/store/pagination.js +2 -2
  188. package/lib/store/root.js +1 -1
  189. package/lib/store/service.js +1 -1
  190. package/lib/store/table.d.ts +24 -23
  191. package/lib/store/table.js +17 -4
  192. package/lib/store/table2.d.ts +5 -5
  193. package/lib/store/table2.js +23 -19
  194. package/lib/theme.js +1 -1
  195. package/lib/types.d.ts +6 -0
  196. package/lib/utils/Animation.js +1 -1
  197. package/lib/utils/ColorScale.js +1 -1
  198. package/lib/utils/DataSchema.js +1 -1
  199. package/lib/utils/DataScope.js +1 -1
  200. package/lib/utils/RootClose.js +1 -1
  201. package/lib/utils/SimpleMap.js +1 -1
  202. package/lib/utils/api.js +9 -2
  203. package/lib/utils/attachmentAdpator.js +1 -1
  204. package/lib/utils/autobind.js +1 -1
  205. package/lib/utils/columnsSplit.js +1 -1
  206. package/lib/utils/dataMapping.js +1 -1
  207. package/lib/utils/date.js +1 -1
  208. package/lib/utils/debug.js +4 -4
  209. package/lib/utils/decodeEntity.js +1 -1
  210. package/lib/utils/dom.d.ts +2 -0
  211. package/lib/utils/dom.js +48 -9
  212. package/lib/utils/errors.js +1 -1
  213. package/lib/utils/escapeHtml.js +1 -1
  214. package/lib/utils/filter-schema.js +1 -1
  215. package/lib/utils/filter.js +1 -1
  216. package/lib/utils/formatDuration.js +1 -1
  217. package/lib/utils/formula.js +2 -2
  218. package/lib/utils/getVariable.js +1 -1
  219. package/lib/utils/grammar.js +1 -1
  220. package/lib/utils/handleAction.js +1 -1
  221. package/lib/utils/helper.d.ts +7 -0
  222. package/lib/utils/helper.js +29 -2
  223. package/lib/utils/highlight.js +1 -1
  224. package/lib/utils/icon.d.ts +6 -1
  225. package/lib/utils/icon.js +6 -1
  226. package/lib/utils/image.js +1 -1
  227. package/lib/utils/isPureVariable.js +1 -1
  228. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  229. package/lib/utils/keyToPath.js +1 -1
  230. package/lib/utils/makeSorter.js +1 -1
  231. package/lib/utils/normalizeLink.js +1 -1
  232. package/lib/utils/normalizeOptions.js +1 -1
  233. package/lib/utils/object.js +1 -1
  234. package/lib/utils/offset.js +1 -1
  235. package/lib/utils/offsetParent.js +1 -1
  236. package/lib/utils/optionValueCompare.js +1 -1
  237. package/lib/utils/position.js +1 -1
  238. package/lib/utils/prettyBytes.js +1 -1
  239. package/lib/utils/renderer-event.js +35 -32
  240. package/lib/utils/replaceText.js +1 -1
  241. package/lib/utils/resize-sensor.js +1 -1
  242. package/lib/utils/resolveCondition.d.ts +1 -0
  243. package/lib/utils/resolveCondition.js +19 -3
  244. package/lib/utils/resolveVariable.js +1 -1
  245. package/lib/utils/resolveVariableAndFilter.js +1 -1
  246. package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
  247. package/lib/utils/resolveVariableAndFilterForAsync.js +20 -2
  248. package/lib/utils/scrollPosition.js +1 -1
  249. package/lib/utils/string2regExp.js +1 -1
  250. package/lib/utils/stripNumber.js +1 -1
  251. package/lib/utils/style-helper.d.ts +9 -4
  252. package/lib/utils/style-helper.js +86 -15
  253. package/lib/utils/style.js +2 -2
  254. package/lib/utils/toNumber.js +1 -1
  255. package/lib/utils/tokenize.d.ts +1 -0
  256. package/lib/utils/tokenize.js +33 -1
  257. package/lib/utils/tpl-builtin.d.ts +2 -1
  258. package/lib/utils/tpl-builtin.js +17 -2
  259. package/lib/utils/tpl-lodash.js +3 -2
  260. package/lib/utils/tpl.d.ts +2 -0
  261. package/lib/utils/tpl.js +24 -1
  262. package/lib/utils/uncontrollable.js +1 -1
  263. package/lib/utils/validations.d.ts +4 -1
  264. package/lib/utils/validations.js +27 -12
  265. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -6,6 +6,11 @@ import { ClassNamesFn } from '../theme';
6
6
  export interface IconCheckedSchema {
7
7
  id: string;
8
8
  name?: string;
9
+ svg?: string;
10
+ }
11
+ export interface IconCheckedSchemaNew {
12
+ type: 'icon';
13
+ icon: IconCheckedSchema;
9
14
  }
10
15
  /**
11
16
  * 判断字符串来生成 i 或 img
@@ -13,4 +18,4 @@ export interface IconCheckedSchema {
13
18
  * @param className 内部用的 className
14
19
  * @param classNameProp amis 配置里设置的 className
15
20
  */
16
- export declare const generateIcon: (cx: ClassNamesFn, icon?: string | IconCheckedSchema | React.ReactNode, className?: string, classNameProp?: string) => JSX.Element | null | undefined;
21
+ export declare const generateIcon: (cx: ClassNamesFn, icon?: string | IconCheckedSchema | React.ReactNode | IconCheckedSchemaNew, className?: string, classNameProp?: string) => JSX.Element | null | undefined;
package/lib/utils/icon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -24,6 +24,11 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
24
  * @param classNameProp amis 配置里设置的 className
25
25
  */
26
26
  var generateIcon = function (cx, icon, className, classNameProp) {
27
+ if (lodash.isObject(icon) &&
28
+ icon.type === 'icon' &&
29
+ icon.icon) {
30
+ icon = icon.icon;
31
+ }
27
32
  if (React__default["default"].isValidElement(icon)) {
28
33
  return icon;
29
34
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -42,7 +42,7 @@ function createRendererEvent(type, context) {
42
42
  // 绑定事件
43
43
  var bindEvent = function (renderer) {
44
44
  var e_1, _a;
45
- var _b, _c;
45
+ var _b, _c, _d;
46
46
  if (!renderer) {
47
47
  return undefined;
48
48
  }
@@ -57,15 +57,16 @@ var bindEvent = function (renderer) {
57
57
  rendererEventListeners = rendererEventListeners.filter(function (item) {
58
58
  return !(item.renderer === listener.renderer && item.type === listener.type);
59
59
  });
60
- rendererEventListeners.push({
61
- renderer: renderer,
62
- type: key,
63
- debounce: listener.debounce || null,
64
- weight: listener.weight || 0,
65
- actions: listener.actions
66
- });
60
+ listener.actions.length &&
61
+ rendererEventListeners.push({
62
+ renderer: renderer,
63
+ type: key,
64
+ debounce: listener.debounce || null,
65
+ weight: listener.weight || 0,
66
+ actions: listener.actions
67
+ });
67
68
  }
68
- if (!listener) {
69
+ if (!listener && ((_d = listeners[key].actions) === null || _d === void 0 ? void 0 : _d.length)) {
69
70
  rendererEventListeners.push({
70
71
  renderer: renderer,
71
72
  type: key,
@@ -77,15 +78,15 @@ var bindEvent = function (renderer) {
77
78
  };
78
79
  try {
79
80
  // 暂存
80
- for (var _d = tslib.__values(Object.keys(listeners)), _e = _d.next(); !_e.done; _e = _d.next()) {
81
- var key = _e.value;
81
+ for (var _e = tslib.__values(Object.keys(listeners)), _f = _e.next(); !_f.done; _f = _e.next()) {
82
+ var key = _f.value;
82
83
  _loop_1(key);
83
84
  }
84
85
  }
85
86
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
86
87
  finally {
87
88
  try {
88
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
89
+ if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
89
90
  }
90
91
  finally { if (e_1) throw e_1.error; }
91
92
  }
@@ -97,19 +98,20 @@ var bindEvent = function (renderer) {
97
98
  };
98
99
  // 触发事件
99
100
  function dispatchEvent(e, renderer, scoped, data, broadcast) {
100
- var _a, _b, _c, _d, _e, _f;
101
+ var _a, _b, _c, _d, _e, _f, _g, _h;
101
102
  return tslib.__awaiter(this, void 0, void 0, function () {
102
103
  var unbindEvent, eventName, eventConfig, rendererEvent, listeners, executedCount, checkExecuted, _loop_2, listeners_1, listeners_1_1, listener, state_1, e_2_1;
103
- var e_2, _g;
104
+ var e_2, _j;
104
105
  var _this = this;
105
- return tslib.__generator(this, function (_h) {
106
- switch (_h.label) {
106
+ return tslib.__generator(this, function (_k) {
107
+ switch (_k.label) {
107
108
  case 0:
108
109
  unbindEvent = null;
109
110
  eventName = typeof e === 'string' ? e : e.type;
110
111
  (_c = (_b = (_a = renderer === null || renderer === void 0 ? void 0 : renderer.props) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.beforeDispatchEvent) === null || _c === void 0 ? void 0 : _c.call(_b, e, renderer, scoped, data, broadcast);
112
+ broadcast && ((_e = (_d = renderer.props).onBroadcast) === null || _e === void 0 ? void 0 : _e.call(_d, e, broadcast, data));
111
113
  if (!broadcast) {
112
- eventConfig = (_e = (_d = renderer === null || renderer === void 0 ? void 0 : renderer.props) === null || _d === void 0 ? void 0 : _d.onEvent) === null || _e === void 0 ? void 0 : _e[eventName];
114
+ eventConfig = (_g = (_f = renderer === null || renderer === void 0 ? void 0 : renderer.props) === null || _f === void 0 ? void 0 : _f.onEvent) === null || _g === void 0 ? void 0 : _g[eventName];
113
115
  if (!eventConfig) {
114
116
  // 没命中也没关系
115
117
  return [2 /*return*/, Promise.resolve()];
@@ -122,7 +124,7 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
122
124
  }
123
125
  rendererEvent = broadcast ||
124
126
  createRendererEvent(eventName, {
125
- env: (_f = renderer === null || renderer === void 0 ? void 0 : renderer.props) === null || _f === void 0 ? void 0 : _f.env,
127
+ env: (_h = renderer === null || renderer === void 0 ? void 0 : renderer.props) === null || _h === void 0 ? void 0 : _h.env,
126
128
  nativeEvent: e,
127
129
  data: data,
128
130
  scoped: scoped
@@ -143,11 +145,11 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
143
145
  }
144
146
  };
145
147
  _loop_2 = function (listener) {
146
- var _j, _k, wait, _l, trailing, _m, leading, _o, maxWait, debounced_1;
147
- return tslib.__generator(this, function (_p) {
148
- switch (_p.label) {
148
+ var _l, _m, wait, _o, trailing, _p, leading, _q, maxWait, debounced_1;
149
+ return tslib.__generator(this, function (_r) {
150
+ switch (_r.label) {
149
151
  case 0:
150
- _j = (listener === null || listener === void 0 ? void 0 : listener.debounce) || {}, _k = _j.wait, wait = _k === void 0 ? 100 : _k, _l = _j.trailing, trailing = _l === void 0 ? true : _l, _m = _j.leading, leading = _m === void 0 ? false : _m, _o = _j.maxWait, maxWait = _o === void 0 ? 10000 : _o;
152
+ _l = (listener === null || listener === void 0 ? void 0 : listener.debounce) || {}, _m = _l.wait, wait = _m === void 0 ? 100 : _m, _o = _l.trailing, trailing = _o === void 0 ? true : _o, _p = _l.leading, leading = _p === void 0 ? false : _p, _q = _l.maxWait, maxWait = _q === void 0 ? 10000 : _q;
151
153
  if (!(listener === null || listener === void 0 ? void 0 : listener.debounce)) return [3 /*break*/, 1];
152
154
  debounced_1 = debounce__default["default"](function () { return tslib.__awaiter(_this, void 0, void 0, function () {
153
155
  return tslib.__generator(this, function (_a) {
@@ -176,9 +178,9 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
176
178
  return [3 /*break*/, 3];
177
179
  case 1: return [4 /*yield*/, Action.runActions(listener.actions, listener.renderer, rendererEvent)];
178
180
  case 2:
179
- _p.sent();
181
+ _r.sent();
180
182
  checkExecuted();
181
- _p.label = 3;
183
+ _r.label = 3;
182
184
  case 3:
183
185
  // 停止后续监听器执行
184
186
  if (rendererEvent.stoped) {
@@ -188,31 +190,31 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
188
190
  }
189
191
  });
190
192
  };
191
- _h.label = 1;
193
+ _k.label = 1;
192
194
  case 1:
193
- _h.trys.push([1, 6, 7, 8]);
195
+ _k.trys.push([1, 6, 7, 8]);
194
196
  listeners_1 = tslib.__values(listeners), listeners_1_1 = listeners_1.next();
195
- _h.label = 2;
197
+ _k.label = 2;
196
198
  case 2:
197
199
  if (!!listeners_1_1.done) return [3 /*break*/, 5];
198
200
  listener = listeners_1_1.value;
199
201
  return [5 /*yield**/, _loop_2(listener)];
200
202
  case 3:
201
- state_1 = _h.sent();
203
+ state_1 = _k.sent();
202
204
  if (state_1 === "break")
203
205
  return [3 /*break*/, 5];
204
- _h.label = 4;
206
+ _k.label = 4;
205
207
  case 4:
206
208
  listeners_1_1 = listeners_1.next();
207
209
  return [3 /*break*/, 2];
208
210
  case 5: return [3 /*break*/, 8];
209
211
  case 6:
210
- e_2_1 = _h.sent();
212
+ e_2_1 = _k.sent();
211
213
  e_2 = { error: e_2_1 };
212
214
  return [3 /*break*/, 8];
213
215
  case 7:
214
216
  try {
215
- if (listeners_1_1 && !listeners_1_1.done && (_g = listeners_1.return)) _g.call(listeners_1);
217
+ if (listeners_1_1 && !listeners_1_1.done && (_j = listeners_1.return)) _j.call(listeners_1);
216
218
  }
217
219
  finally { if (e_2) throw e_2.error; }
218
220
  return [7 /*endfinally*/];
@@ -232,6 +234,7 @@ var getRendererEventListeners = function () {
232
234
  */
233
235
  var resolveEventData = function (props, data, valueKey) {
234
236
  var _a, _b;
237
+ if (valueKey === void 0) { valueKey = 'value'; }
235
238
  return object.createObject(props.data, props.name && valueKey
236
239
  ? tslib.__assign(tslib.__assign({}, data), (_a = {}, _a[props.name] = data[valueKey], _a.__rendererData = tslib.__assign(tslib.__assign({}, props.data), (_b = {}, _b[props.name] = data[valueKey], _b)), _a)) : data);
237
240
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -3,3 +3,4 @@ export declare function registerConditionComputer(op: string, func: (left: any,
3
3
  export declare function getConditionComputers(): {
4
4
  [op: string]: (left: any, right: any, fieldType?: string | undefined) => boolean;
5
5
  };
6
+ export declare function setConditionComputeErrorHandler(fn: (conditions: any, data: any, defaultResult: boolean) => boolean | Promise<boolean>): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -29,9 +29,11 @@ var capitalize__default = /*#__PURE__*/_interopDefaultLegacy(capitalize);
29
29
 
30
30
  var conditionResolverMap = {};
31
31
  var DEFAULT_RESULT = true;
32
+ var conditionComputeErrorHandler;
32
33
  function resolveCondition(conditions, data, defaultResult) {
33
34
  if (defaultResult === void 0) { defaultResult = true; }
34
35
  return tslib.__awaiter(this, void 0, void 0, function () {
36
+ var e_1;
35
37
  return tslib.__generator(this, function (_a) {
36
38
  switch (_a.label) {
37
39
  case 0:
@@ -41,8 +43,18 @@ function resolveCondition(conditions, data, defaultResult) {
41
43
  !conditions.children.length) {
42
44
  return [2 /*return*/, defaultResult];
43
45
  }
46
+ _a.label = 1;
47
+ case 1:
48
+ _a.trys.push([1, 3, , 6]);
44
49
  return [4 /*yield*/, computeConditions(conditions.children, conditions.conjunction, data)];
45
- case 1: return [2 /*return*/, _a.sent()];
50
+ case 2: return [2 /*return*/, _a.sent()];
51
+ case 3:
52
+ e_1 = _a.sent();
53
+ if (!(e_1.name === 'FormulaEvalError')) return [3 /*break*/, 5];
54
+ return [4 /*yield*/, (conditionComputeErrorHandler === null || conditionComputeErrorHandler === void 0 ? void 0 : conditionComputeErrorHandler(conditions.children, conditions.conjunction, data))];
55
+ case 4: return [2 /*return*/, _a.sent()];
56
+ case 5: return [2 /*return*/, defaultResult];
57
+ case 6: return [2 /*return*/];
46
58
  }
47
59
  });
48
60
  });
@@ -93,7 +105,7 @@ function computeCondition(rule, index, data) {
93
105
  switch (_b.label) {
94
106
  case 0:
95
107
  leftValue = get__default["default"](data, rule.left.field);
96
- return [4 /*yield*/, resolveVariableAndFilterForAsync.resolveVariableAndFilterForAsync(rule.right, data)];
108
+ return [4 /*yield*/, resolveVariableAndFilterForAsync.resolveVariableAndFilterForAsync(rule.right, data, undefined, undefined, true)];
97
109
  case 1:
98
110
  rightValue = _b.sent();
99
111
  func = (_a = conditionResolverMap["".concat(rule.op, "For").concat(capitalize__default["default"](rule.left.type))]) !== null && _a !== void 0 ? _a : conditionResolverMap[rule.op];
@@ -282,6 +294,9 @@ function registerConditionComputer(op, func, fieldType) {
282
294
  function getConditionComputers() {
283
295
  return conditionResolverMap;
284
296
  }
297
+ function setConditionComputeErrorHandler(fn) {
298
+ conditionComputeErrorHandler = fn;
299
+ }
285
300
  registerConditionComputer('greater', greaterFunc);
286
301
  registerConditionComputer('greater', greaterForDateFunc, 'date');
287
302
  registerConditionComputer('greater', greaterForDateFunc, 'time');
@@ -320,3 +335,4 @@ registerConditionComputer('ends_with', endsWithFunc);
320
335
  exports.getConditionComputers = getConditionComputers;
321
336
  exports.registerConditionComputer = registerConditionComputer;
322
337
  exports.resolveCondition = resolveCondition;
338
+ exports.setConditionComputeErrorHandler = setConditionComputeErrorHandler;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1 +1,6 @@
1
- export declare const resolveVariableAndFilterForAsync: (path?: string, data?: object, defaultFilter?: string, fallbackValue?: (value: any) => any) => Promise<any>;
1
+ /**
2
+ * 设置自定义函数,functions中找不到处理的函数时执行
3
+ * @param fn
4
+ */
5
+ export declare function setFormulaEvalErrorHandler(fn: (path: string, data?: object, ...args: any[]) => any): void;
6
+ export declare const resolveVariableAndFilterForAsync: (path?: string, data?: object, defaultFilter?: string, fallbackValue?: (value: any) => any, skipFormulaEvalErrorHandler?: boolean) => Promise<any>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -10,10 +10,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
10
10
  var tslib = require('tslib');
11
11
  var amisFormula = require('amis-formula');
12
12
 
13
- var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fallbackValue) {
13
+ var formulaEvalErrorHandler;
14
+ /**
15
+ * 设置自定义函数,functions中找不到处理的函数时执行
16
+ * @param fn
17
+ */
18
+ function setFormulaEvalErrorHandler(fn) {
19
+ formulaEvalErrorHandler = fn;
20
+ }
21
+ var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fallbackValue, skipFormulaEvalErrorHandler) {
14
22
  if (data === void 0) { data = {}; }
15
23
  if (defaultFilter === void 0) { defaultFilter = '| html'; }
16
24
  if (fallbackValue === void 0) { fallbackValue = function (value) { return value; }; }
25
+ if (skipFormulaEvalErrorHandler === void 0) { skipFormulaEvalErrorHandler = false; }
17
26
  return tslib.__awaiter(void 0, void 0, void 0, function () {
18
27
  var ast, ret, e_1;
19
28
  return tslib.__generator(this, function (_a) {
@@ -40,6 +49,14 @@ var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fall
40
49
  case 3:
41
50
  e_1 = _a.sent();
42
51
  console.warn(e_1);
52
+ if (e_1.name === 'FormulaEvalError') {
53
+ if (!skipFormulaEvalErrorHandler) {
54
+ // 无法解析时,执行handler自定义解析逻辑
55
+ return [2 /*return*/, formulaEvalErrorHandler === null || formulaEvalErrorHandler === void 0 ? void 0 : formulaEvalErrorHandler(path, data, defaultFilter, fallbackValue)];
56
+ }
57
+ // 跳过自定义解析逻辑,则直接抛异常
58
+ throw e_1;
59
+ }
43
60
  return [2 /*return*/, undefined];
44
61
  case 4: return [2 /*return*/];
45
62
  }
@@ -48,3 +65,4 @@ var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fall
48
65
  };
49
66
 
50
67
  exports.resolveVariableAndFilterForAsync = resolveVariableAndFilterForAsync;
68
+ exports.setFormulaEvalErrorHandler = setFormulaEvalErrorHandler;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,6 @@
1
1
  import { PlainObject } from '../types';
2
2
  export declare const valueMap: PlainObject;
3
+ export declare const inheritValueMap: PlainObject;
3
4
  interface extra {
4
5
  pre?: string;
5
6
  suf?: string;
@@ -7,7 +8,7 @@ interface extra {
7
8
  export declare function findOrCreactStyle(id: string): HTMLElement;
8
9
  export declare function insertStyle(style: string, id: string): void;
9
10
  export declare function addStyle(style: string, id: string): void;
10
- export declare function formatStyle(css: any, classNames: {
11
+ export declare function formatStyle(themeCss: any, classNames: {
11
12
  key: string;
12
13
  value?: string;
13
14
  weights?: {
@@ -16,14 +17,14 @@ export declare function formatStyle(css: any, classNames: {
16
17
  active?: extra;
17
18
  disabled?: extra;
18
19
  };
19
- }[], id?: string): {
20
+ }[], id?: string, defaultData?: any): {
20
21
  value: string;
21
22
  origin: {
22
23
  className: string;
23
24
  content: string;
24
25
  }[];
25
26
  };
26
- export declare function insertCustomStyle(css: any, classNames: {
27
+ export declare function insertCustomStyle(themeCss: any, classNames: {
27
28
  key: string;
28
29
  value?: string;
29
30
  weights?: {
@@ -32,5 +33,9 @@ export declare function insertCustomStyle(css: any, classNames: {
32
33
  active?: extra;
33
34
  disabled?: extra;
34
35
  };
35
- }[], id?: string): void;
36
+ }[], id?: string, defaultData?: any): void;
37
+ /**
38
+ * 根据路径获取默认值
39
+ */
40
+ export declare function getValueByPath(path: string, data: any): any;
36
41
  export {};