amis-core 3.3.0 → 3.4.0-beta.12

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 (272) hide show
  1. package/LICENSE +1 -1
  2. package/esm/Root.js +1 -1
  3. package/esm/RootRenderer.js +3 -3
  4. package/esm/SchemaRenderer.d.ts +1 -0
  5. package/esm/SchemaRenderer.js +10 -5
  6. package/esm/Scoped.js +1 -1
  7. package/esm/StatusScoped.js +1 -1
  8. package/esm/WithRootStore.js +1 -1
  9. package/esm/WithStore.js +1 -1
  10. package/esm/actions/Action.d.ts +1 -0
  11. package/esm/actions/Action.js +42 -24
  12. package/esm/actions/AjaxAction.js +12 -4
  13. package/esm/actions/BreakAction.js +1 -1
  14. package/esm/actions/BroadcastAction.js +1 -1
  15. package/esm/actions/CmptAction.js +9 -3
  16. package/esm/actions/ContinueAction.js +1 -1
  17. package/esm/actions/CopyAction.js +1 -1
  18. package/esm/actions/CustomAction.js +1 -1
  19. package/esm/actions/DialogAction.js +1 -1
  20. package/esm/actions/DrawerAction.js +1 -1
  21. package/esm/actions/EmailAction.js +1 -1
  22. package/esm/actions/LinkAction.js +1 -1
  23. package/esm/actions/LoopAction.js +1 -1
  24. package/esm/actions/PageAction.js +1 -1
  25. package/esm/actions/ParallelAction.js +1 -1
  26. package/esm/actions/StatusAction.js +1 -1
  27. package/esm/actions/SwitchAction.js +1 -1
  28. package/esm/actions/ToastAction.js +1 -1
  29. package/esm/components/CustomStyle.js +1 -1
  30. package/esm/components/LazyComponent.js +1 -1
  31. package/esm/components/Overlay.js +1 -1
  32. package/esm/components/PopOver.js +3 -2
  33. package/esm/env.d.ts +2 -0
  34. package/esm/env.js +1 -1
  35. package/esm/envOverwrite.js +1 -1
  36. package/esm/factory.d.ts +1 -0
  37. package/esm/factory.js +4 -3
  38. package/esm/index.js +5 -5
  39. package/esm/locale.js +10 -4
  40. package/esm/polyfills.js +1 -1
  41. package/esm/renderers/Form.js +50 -11
  42. package/esm/renderers/Item.js +18 -20
  43. package/esm/renderers/Options.d.ts +4 -0
  44. package/esm/renderers/Options.js +1 -1
  45. package/esm/renderers/Placeholder.js +1 -1
  46. package/esm/renderers/builtin.js +1 -1
  47. package/esm/renderers/register.js +1 -1
  48. package/esm/renderers/wrapControl.js +5 -4
  49. package/esm/store/app.js +1 -1
  50. package/esm/store/combo.d.ts +120 -120
  51. package/esm/store/combo.js +1 -1
  52. package/esm/store/crud.js +1 -1
  53. package/esm/store/form.d.ts +50 -50
  54. package/esm/store/form.js +1 -1
  55. package/esm/store/formItem.d.ts +1 -1
  56. package/esm/store/formItem.js +95 -52
  57. package/esm/store/iRenderer.js +1 -1
  58. package/esm/store/index.js +1 -1
  59. package/esm/store/list.js +1 -1
  60. package/esm/store/manager.js +1 -1
  61. package/esm/store/modal.js +1 -1
  62. package/esm/store/node.js +1 -1
  63. package/esm/store/pagination.js +1 -1
  64. package/esm/store/root.js +1 -1
  65. package/esm/store/service.js +1 -1
  66. package/esm/store/status.js +1 -1
  67. package/esm/store/table.d.ts +226 -125
  68. package/esm/store/table.js +109 -43
  69. package/esm/store/table2.js +2 -2
  70. package/esm/theme.d.ts +2 -0
  71. package/esm/theme.js +1 -1
  72. package/esm/types.d.ts +6 -0
  73. package/esm/utils/Animation.js +1 -1
  74. package/esm/utils/ColorScale.js +1 -1
  75. package/esm/utils/DataSchema.js +1 -1
  76. package/esm/utils/DataScope.js +1 -1
  77. package/esm/utils/RootClose.js +1 -1
  78. package/esm/utils/SimpleMap.js +1 -1
  79. package/esm/utils/api.js +6 -11
  80. package/esm/utils/arraySlice.js +1 -1
  81. package/esm/utils/attachmentAdpator.js +1 -1
  82. package/esm/utils/autobind.js +1 -1
  83. package/esm/utils/columnsSplit.js +1 -1
  84. package/esm/utils/dataMapping.js +1 -1
  85. package/esm/utils/date.js +1 -1
  86. package/esm/utils/debug.js +1 -1
  87. package/esm/utils/decodeEntity.js +1 -1
  88. package/esm/utils/dom.js +1 -1
  89. package/esm/utils/errors.js +1 -1
  90. package/esm/utils/escapeHtml.js +1 -1
  91. package/esm/utils/filter-schema.js +1 -1
  92. package/esm/utils/filter.js +1 -1
  93. package/esm/utils/formatDuration.js +1 -1
  94. package/esm/utils/formula.js +1 -1
  95. package/esm/utils/getVariable.js +1 -1
  96. package/esm/utils/grammar.js +1 -1
  97. package/esm/utils/handleAction.js +1 -1
  98. package/esm/utils/helper.d.ts +17 -10
  99. package/esm/utils/helper.js +164 -68
  100. package/esm/utils/highlight.js +1 -1
  101. package/esm/utils/icon.js +1 -1
  102. package/esm/utils/image.js +1 -1
  103. package/esm/utils/isPureVariable.js +1 -1
  104. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  105. package/esm/utils/keyToPath.js +1 -1
  106. package/esm/utils/makeSorter.js +1 -1
  107. package/esm/utils/math.js +1 -1
  108. package/esm/utils/memoryParse.js +1 -1
  109. package/esm/utils/normalizeLink.js +1 -1
  110. package/esm/utils/normalizeOptions.js +1 -1
  111. package/esm/utils/object.js +1 -1
  112. package/esm/utils/offset.js +1 -1
  113. package/esm/utils/offsetParent.js +1 -1
  114. package/esm/utils/optionValueCompare.d.ts +2 -0
  115. package/esm/utils/optionValueCompare.js +15 -5
  116. package/esm/utils/position.js +1 -1
  117. package/esm/utils/prettyBytes.js +1 -1
  118. package/esm/utils/renderer-event.js +1 -1
  119. package/esm/utils/replaceText.js +1 -1
  120. package/esm/utils/resize-sensor.js +1 -1
  121. package/esm/utils/resolveCondition.js +1 -1
  122. package/esm/utils/resolveVariable.js +1 -1
  123. package/esm/utils/resolveVariableAndFilter.js +1 -1
  124. package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
  125. package/esm/utils/scrollPosition.js +1 -1
  126. package/esm/utils/string2regExp.js +1 -1
  127. package/esm/utils/stripNumber.js +1 -1
  128. package/esm/utils/style-helper.js +1 -1
  129. package/esm/utils/style.js +1 -1
  130. package/esm/utils/toNumber.js +1 -1
  131. package/esm/utils/tokenize.js +1 -1
  132. package/esm/utils/tpl-builtin.js +1 -1
  133. package/esm/utils/tpl-lodash.js +1 -1
  134. package/esm/utils/tpl.js +1 -1
  135. package/esm/utils/uncontrollable.js +1 -1
  136. package/esm/utils/validations.js +1 -1
  137. package/lib/Root.js +1 -1
  138. package/lib/RootRenderer.js +3 -3
  139. package/lib/SchemaRenderer.d.ts +1 -0
  140. package/lib/SchemaRenderer.js +9 -4
  141. package/lib/Scoped.js +1 -1
  142. package/lib/StatusScoped.js +1 -1
  143. package/lib/WithRootStore.js +1 -1
  144. package/lib/WithStore.js +1 -1
  145. package/lib/actions/Action.d.ts +1 -0
  146. package/lib/actions/Action.js +42 -24
  147. package/lib/actions/AjaxAction.js +11 -3
  148. package/lib/actions/BreakAction.js +1 -1
  149. package/lib/actions/BroadcastAction.js +1 -1
  150. package/lib/actions/CmptAction.js +9 -3
  151. package/lib/actions/ContinueAction.js +1 -1
  152. package/lib/actions/CopyAction.js +1 -1
  153. package/lib/actions/CustomAction.js +1 -1
  154. package/lib/actions/DialogAction.js +1 -1
  155. package/lib/actions/DrawerAction.js +1 -1
  156. package/lib/actions/EmailAction.js +1 -1
  157. package/lib/actions/LinkAction.js +1 -1
  158. package/lib/actions/LoopAction.js +1 -1
  159. package/lib/actions/PageAction.js +1 -1
  160. package/lib/actions/ParallelAction.js +1 -1
  161. package/lib/actions/StatusAction.js +1 -1
  162. package/lib/actions/SwitchAction.js +1 -1
  163. package/lib/actions/ToastAction.js +1 -1
  164. package/lib/components/CustomStyle.js +1 -1
  165. package/lib/components/LazyComponent.js +1 -1
  166. package/lib/components/Overlay.js +1 -1
  167. package/lib/components/PopOver.js +3 -2
  168. package/lib/env.d.ts +2 -0
  169. package/lib/env.js +1 -1
  170. package/lib/envOverwrite.js +1 -1
  171. package/lib/factory.d.ts +1 -0
  172. package/lib/factory.js +3 -2
  173. package/lib/index.js +6 -3
  174. package/lib/locale.js +11 -4
  175. package/lib/polyfills.js +1 -1
  176. package/lib/renderers/Form.js +50 -11
  177. package/lib/renderers/Item.js +17 -19
  178. package/lib/renderers/Options.d.ts +4 -0
  179. package/lib/renderers/Options.js +1 -1
  180. package/lib/renderers/Placeholder.js +1 -1
  181. package/lib/renderers/builtin.js +1 -1
  182. package/lib/renderers/register.js +1 -1
  183. package/lib/renderers/wrapControl.js +5 -4
  184. package/lib/store/app.js +1 -1
  185. package/lib/store/combo.d.ts +144 -144
  186. package/lib/store/combo.js +1 -1
  187. package/lib/store/crud.js +1 -1
  188. package/lib/store/form.d.ts +60 -60
  189. package/lib/store/form.js +1 -1
  190. package/lib/store/formItem.d.ts +1 -1
  191. package/lib/store/formItem.js +94 -50
  192. package/lib/store/iRenderer.js +1 -1
  193. package/lib/store/index.js +1 -1
  194. package/lib/store/list.js +1 -1
  195. package/lib/store/manager.js +1 -1
  196. package/lib/store/modal.js +1 -1
  197. package/lib/store/node.js +1 -1
  198. package/lib/store/pagination.js +1 -1
  199. package/lib/store/root.js +1 -1
  200. package/lib/store/service.js +1 -1
  201. package/lib/store/status.js +1 -1
  202. package/lib/store/table.d.ts +246 -145
  203. package/lib/store/table.js +109 -43
  204. package/lib/store/table2.js +2 -2
  205. package/lib/theme.d.ts +2 -0
  206. package/lib/theme.js +1 -1
  207. package/lib/types.d.ts +6 -0
  208. package/lib/utils/Animation.js +1 -1
  209. package/lib/utils/ColorScale.js +1 -1
  210. package/lib/utils/DataSchema.js +1 -1
  211. package/lib/utils/DataScope.js +1 -1
  212. package/lib/utils/RootClose.js +1 -1
  213. package/lib/utils/SimpleMap.js +1 -1
  214. package/lib/utils/api.js +5 -10
  215. package/lib/utils/arraySlice.js +1 -1
  216. package/lib/utils/attachmentAdpator.js +1 -1
  217. package/lib/utils/autobind.js +1 -1
  218. package/lib/utils/columnsSplit.js +1 -1
  219. package/lib/utils/dataMapping.js +1 -1
  220. package/lib/utils/date.js +1 -1
  221. package/lib/utils/debug.js +1 -1
  222. package/lib/utils/decodeEntity.js +1 -1
  223. package/lib/utils/dom.js +1 -1
  224. package/lib/utils/errors.js +1 -1
  225. package/lib/utils/escapeHtml.js +1 -1
  226. package/lib/utils/filter-schema.js +1 -1
  227. package/lib/utils/filter.js +1 -1
  228. package/lib/utils/formatDuration.js +1 -1
  229. package/lib/utils/formula.js +1 -1
  230. package/lib/utils/getVariable.js +1 -1
  231. package/lib/utils/grammar.js +1 -1
  232. package/lib/utils/handleAction.js +1 -1
  233. package/lib/utils/helper.d.ts +17 -10
  234. package/lib/utils/helper.js +169 -70
  235. package/lib/utils/highlight.js +1 -1
  236. package/lib/utils/icon.js +1 -1
  237. package/lib/utils/image.js +1 -1
  238. package/lib/utils/isPureVariable.js +1 -1
  239. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  240. package/lib/utils/keyToPath.js +1 -1
  241. package/lib/utils/makeSorter.js +1 -1
  242. package/lib/utils/math.js +1 -1
  243. package/lib/utils/memoryParse.js +1 -1
  244. package/lib/utils/normalizeLink.js +1 -1
  245. package/lib/utils/normalizeOptions.js +1 -1
  246. package/lib/utils/object.js +1 -1
  247. package/lib/utils/offset.js +1 -1
  248. package/lib/utils/offsetParent.js +1 -1
  249. package/lib/utils/optionValueCompare.d.ts +2 -0
  250. package/lib/utils/optionValueCompare.js +16 -4
  251. package/lib/utils/position.js +1 -1
  252. package/lib/utils/prettyBytes.js +1 -1
  253. package/lib/utils/renderer-event.js +1 -1
  254. package/lib/utils/replaceText.js +1 -1
  255. package/lib/utils/resize-sensor.js +1 -1
  256. package/lib/utils/resolveCondition.js +1 -1
  257. package/lib/utils/resolveVariable.js +1 -1
  258. package/lib/utils/resolveVariableAndFilter.js +1 -1
  259. package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
  260. package/lib/utils/scrollPosition.js +1 -1
  261. package/lib/utils/string2regExp.js +1 -1
  262. package/lib/utils/stripNumber.js +1 -1
  263. package/lib/utils/style-helper.js +1 -1
  264. package/lib/utils/style.js +1 -1
  265. package/lib/utils/toNumber.js +1 -1
  266. package/lib/utils/tokenize.js +1 -1
  267. package/lib/utils/tpl-builtin.js +1 -1
  268. package/lib/utils/tpl-lodash.js +1 -1
  269. package/lib/utils/tpl.js +1 -1
  270. package/lib/utils/uncontrollable.js +1 -1
  271. package/lib/utils/validations.js +1 -1
  272. package/package.json +3 -3
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2023 Baidu
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/esm/Root.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -82,7 +82,7 @@ var RootRenderer = /** @class */ (function (_super) {
82
82
  var _this = this;
83
83
  var _a, _b;
84
84
  if (throwErrors === void 0) { throwErrors = false; }
85
- var _c = this.props, env = _c.env, messages = _c.messages, onAction = _c.onAction, render = _c.render;
85
+ var _c = this.props, env = _c.env, messages = _c.messages, onAction = _c.onAction, mobileUI = _c.mobileUI, render = _c.render;
86
86
  var store = this.store;
87
87
  if ((onAction === null || onAction === void 0 ? void 0 : onAction(e, action, ctx, throwErrors, delegate || this.context)) ===
88
88
  false) {
@@ -129,7 +129,7 @@ var RootRenderer = /** @class */ (function (_super) {
129
129
  ? render('body', item.body, __assign(__assign({}, _this.props), { data: ctx }))
130
130
  : '', __assign(__assign(__assign({}, action.toast), item), { title: item.title
131
131
  ? render('title', item.title, __assign(__assign({}, _this.props), { data: ctx }))
132
- : null, useMobileUI: env.useMobileUI }));
132
+ : null, mobileUI: mobileUI }));
133
133
  });
134
134
  }
135
135
  else if (action.actionType === 'ajax') {
@@ -21,6 +21,7 @@ export declare class SchemaRenderer extends React.Component<SchemaRendererProps,
21
21
  path: string;
22
22
  reaction: any;
23
23
  unbindEvent: (() => void) | undefined;
24
+ isStatic: any;
24
25
  constructor(props: SchemaRendererProps);
25
26
  componentDidMount(): void;
26
27
  componentWillUnmount(): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -24,7 +24,7 @@ import 'lodash/isPlainObject';
24
24
  import { resolveVariableAndFilter } from './utils/resolveVariableAndFilter.js';
25
25
  import './utils/filter.js';
26
26
  import { buildStyle } from './utils/style.js';
27
- import { filter } from './utils/tpl.js';
27
+ import { filter, evalExpression } from './utils/tpl.js';
28
28
 
29
29
  var RENDERER_TRANSMISSION_OMIT_PROPS = [
30
30
  'type',
@@ -66,6 +66,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
66
66
  var _this = _super.call(this, props) || this;
67
67
  _this.rendererKey = '';
68
68
  _this.unbindEvent = undefined;
69
+ _this.isStatic = undefined;
69
70
  _this.refFn = _this.refFn.bind(_this);
70
71
  _this.renderChild = _this.renderChild.bind(_this);
71
72
  _this.reRender = _this.reRender.bind(_this);
@@ -175,8 +176,9 @@ var SchemaRenderer = /** @class */ (function (_super) {
175
176
  });
176
177
  };
177
178
  SchemaRenderer.prototype.renderChild = function (region, node, subProps) {
179
+ var _a, _b;
178
180
  if (subProps === void 0) { subProps = {}; }
179
- var _a = this.props; _a.schema; _a.$path; var env = _a.env, render = _a.render, rest = __rest(_a, ["schema", "$path", "env", "render"]);
181
+ var _c = this.props, _ = _c.schema; _c.$path; var env = _c.env, render = _c.render, rest = __rest(_c, ["schema", "$path", "env", "render"]);
180
182
  var $path = this.resolveRenderer(this.props).path;
181
183
  var omitList = RENDERER_TRANSMISSION_OMIT_PROPS.concat();
182
184
  if (this.renderer) {
@@ -184,7 +186,9 @@ var SchemaRenderer = /** @class */ (function (_super) {
184
186
  Component.propsList &&
185
187
  omitList.push.apply(omitList, Component.propsList);
186
188
  }
187
- return render("".concat($path).concat(region ? "/".concat(region) : ''), node || '', __assign(__assign(__assign({}, omit(rest, omitList)), subProps), { data: subProps.data || rest.data, env: env }));
189
+ return render("".concat($path).concat(region ? "/".concat(region) : ''), node || '', __assign(__assign(__assign(__assign({}, omit(rest, omitList)), { defaultStatic: (_a = this.isStatic) !== null && _a !== void 0 ? _a : (_.staticOn
190
+ ? evalExpression(_.staticOn, rest.data)
191
+ : (_b = _.static) !== null && _b !== void 0 ? _b : rest.defaultStatic) }), subProps), { data: subProps.data || rest.data, env: env }));
188
192
  };
189
193
  SchemaRenderer.prototype.reRender = function () {
190
194
  this.resolveRenderer(this.props, true);
@@ -220,6 +224,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
220
224
  var isStatic = isAlive(statusStore)
221
225
  ? (_d = statusStore.staticState[id]) !== null && _d !== void 0 ? _d : statusStore.staticState[name]
222
226
  : undefined;
227
+ this.isStatic = isStatic;
223
228
  if (visible === false ||
224
229
  (visible !== true &&
225
230
  exprProps &&
@@ -300,7 +305,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
300
305
  var $schema = __assign(__assign({}, schema), exprProps);
301
306
  var props = __assign(__assign(__assign(__assign(__assign({}, theme.getRendererConfig(renderer.name)), restSchema), chainEvents(rest, restSchema)), exprProps), {
302
307
  // value: defaultValue, // 备注: 此处并没有将value传递给渲染器
303
- defaultData: (_f = restSchema.defaultData) !== null && _f !== void 0 ? _f : defaultData, defaultValue: (_g = restSchema.defaultValue) !== null && _g !== void 0 ? _g : defaultValue, defaultActiveKey: defaultActiveKey, propKey: propKey, $path: $path, $schema: $schema, ref: this.refFn, render: this.renderChild, rootStore: rootStore, statusStore: statusStore, dispatchEvent: this.dispatchEvent });
308
+ defaultData: (_f = restSchema.defaultData) !== null && _f !== void 0 ? _f : defaultData, defaultValue: (_g = restSchema.defaultValue) !== null && _g !== void 0 ? _g : defaultValue, defaultActiveKey: defaultActiveKey, propKey: propKey, $path: $path, $schema: $schema, ref: this.refFn, render: this.renderChild, rootStore: rootStore, statusStore: statusStore, dispatchEvent: this.dispatchEvent, mobileUI: schema.useMobileUI === false ? false : rest.mobileUI });
304
309
  if (disable !== undefined) {
305
310
  props.disabled = disable;
306
311
  }
package/esm/Scoped.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/WithStore.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -17,6 +17,7 @@ export interface ListenerAction {
17
17
  description?: string;
18
18
  componentId?: string;
19
19
  componentName?: string;
20
+ ignoreError?: boolean;
20
21
  args?: Record<string, any>;
21
22
  data?: Record<string, any> | null;
22
23
  dataMergeMode?: 'merge' | 'override';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -52,6 +52,7 @@ var getOmitActionProp = function (type) {
52
52
  omitList = ['msg', 'title'];
53
53
  break;
54
54
  case 'ajax':
55
+ case 'download':
55
56
  omitList = ['api', 'messages', 'options'];
56
57
  break;
57
58
  case 'setValue':
@@ -97,21 +98,22 @@ var getOmitActionProp = function (type) {
97
98
  return omitList;
98
99
  };
99
100
  var runActions = function (actions, renderer, event) { return __awaiter(void 0, void 0, void 0, function () {
100
- var actions_1, actions_1_1, actionConfig, actionInstrance, e_1_1;
101
- var e_1, _a;
102
- return __generator(this, function (_b) {
103
- switch (_b.label) {
101
+ var actions_1, actions_1_1, actionConfig, actionInstrance, e_1, ignore, e_2_1;
102
+ var e_2, _a;
103
+ var _b;
104
+ return __generator(this, function (_c) {
105
+ switch (_c.label) {
104
106
  case 0:
105
107
  if (!Array.isArray(actions)) {
106
108
  actions = [actions];
107
109
  }
108
- _b.label = 1;
110
+ _c.label = 1;
109
111
  case 1:
110
- _b.trys.push([1, 6, 7, 8]);
112
+ _c.trys.push([1, 9, 10, 11]);
111
113
  actions_1 = __values(actions), actions_1_1 = actions_1.next();
112
- _b.label = 2;
114
+ _c.label = 2;
113
115
  case 2:
114
- if (!!actions_1_1.done) return [3 /*break*/, 5];
116
+ if (!!actions_1_1.done) return [3 /*break*/, 8];
115
117
  actionConfig = actions_1_1.value;
116
118
  actionInstrance = getActionByType(actionConfig.actionType);
117
119
  // 如果存在指定组件ID,说明是组件专有动作
@@ -138,30 +140,42 @@ var runActions = function (actions, renderer, event) { return __awaiter(void 0,
138
140
  if (!actionInstrance) {
139
141
  actionInstrance = getActionByType('component');
140
142
  }
143
+ _c.label = 3;
144
+ case 3:
145
+ _c.trys.push([3, 5, , 6]);
141
146
  // 这些节点的子节点运行逻辑由节点内部实现
142
147
  return [4 /*yield*/, runAction(actionInstrance, actionConfig, renderer, event)];
143
- case 3:
148
+ case 4:
144
149
  // 这些节点的子节点运行逻辑由节点内部实现
145
- _b.sent();
150
+ _c.sent();
151
+ return [3 /*break*/, 6];
152
+ case 5:
153
+ e_1 = _c.sent();
154
+ ignore = (_b = actionConfig.ignoreError) !== null && _b !== void 0 ? _b : false;
155
+ if (!ignore) {
156
+ throw Error("".concat(actionConfig.actionType, " \u52A8\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A").concat(e_1.message || '未知'));
157
+ }
158
+ return [3 /*break*/, 6];
159
+ case 6:
146
160
  if (event.stoped) {
147
- return [3 /*break*/, 5];
161
+ return [3 /*break*/, 8];
148
162
  }
149
- _b.label = 4;
150
- case 4:
163
+ _c.label = 7;
164
+ case 7:
151
165
  actions_1_1 = actions_1.next();
152
166
  return [3 /*break*/, 2];
153
- case 5: return [3 /*break*/, 8];
154
- case 6:
155
- e_1_1 = _b.sent();
156
- e_1 = { error: e_1_1 };
157
- return [3 /*break*/, 8];
158
- case 7:
167
+ case 8: return [3 /*break*/, 11];
168
+ case 9:
169
+ e_2_1 = _c.sent();
170
+ e_2 = { error: e_2_1 };
171
+ return [3 /*break*/, 11];
172
+ case 10:
159
173
  try {
160
174
  if (actions_1_1 && !actions_1_1.done && (_a = actions_1.return)) _a.call(actions_1);
161
175
  }
162
- finally { if (e_1) throw e_1.error; }
176
+ finally { if (e_2) throw e_2.error; }
163
177
  return [7 /*endfinally*/];
164
- case 8: return [2 /*return*/];
178
+ case 11: return [2 /*return*/];
165
179
  }
166
180
  });
167
181
  }); };
@@ -218,7 +232,7 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
218
232
  action.drawer = __assign({}, ((_e = action.drawer) !== null && _e !== void 0 ? _e : (_f = action.args) === null || _f === void 0 ? void 0 : _f.drawer));
219
233
  (_g = action.args) === null || _g === void 0 ? true : delete _g.drawer;
220
234
  }
221
- else if (action.actionType === 'ajax') {
235
+ else if (['ajax', 'download'].includes(action.actionType)) {
222
236
  api = (_h = action.api) !== null && _h !== void 0 ? _h : (_j = action.args) === null || _j === void 0 ? void 0 : _j.api;
223
237
  action.api = typeof api === 'string' ? api : __assign({}, api);
224
238
  action.options = __assign({}, ((_k = action.options) !== null && _k !== void 0 ? _k : (_l = action.args) === null || _l === void 0 ? void 0 : _l.options));
@@ -240,7 +254,10 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
240
254
  actionData = args && Object.keys(args).length
241
255
  ? omit(__assign(__assign({}, args), (afterMappingData !== null && afterMappingData !== void 0 ? afterMappingData : {})), getOmitActionProp(action.actionType))
242
256
  : afterMappingData;
243
- data = actionData !== undefined ? actionData : mergeData;
257
+ data = actionData !== undefined &&
258
+ !['ajax', 'download', 'dialog', 'drawer'].includes(action.actionType) // 避免非法配置影响对actionData的判断,导致动作配置中的数据映射失败
259
+ ? actionData
260
+ : mergeData;
244
261
  (_s = console.group) === null || _s === void 0 ? void 0 : _s.call(console, "run action ".concat(action.actionType));
245
262
  console.debug("[".concat(action.actionType, "] action args, data"), args, data);
246
263
  stopped = false;
@@ -250,6 +267,7 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
250
267
  // 二次确认弹窗如果取消,则终止后续动作
251
268
  if ((action === null || action === void 0 ? void 0 : action.actionType) === 'confirmDialog' && !actionResult) {
252
269
  stopped = true;
270
+ preventDefault = true; // 这种对表单项change比较有意义,例如switch切换时弹确认弹窗,如果取消后不能把switch修改了
253
271
  }
254
272
  stopPropagation = false;
255
273
  if (!action.stopPropagation) return [3 /*break*/, 7];
@@ -1,10 +1,10 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __assign } from 'tslib';
7
- import { normalizeApiResponseData } from '../utils/api.js';
7
+ import { normalizeApiResponseData, normalizeApi } from '../utils/api.js';
8
8
  import { ServerError } from '../utils/errors.js';
9
9
  import { isEmpty } from '../utils/helper.js';
10
10
  import { registerAction } from './Action.js';
@@ -25,7 +25,7 @@ var AjaxAction = /** @class */ (function () {
25
25
  AjaxAction.prototype.run = function (action, renderer, event) {
26
26
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
27
27
  return __awaiter(this, void 0, void 0, function () {
28
- var env, silent, messages, result, responseData, msg, e_1, result;
28
+ var env, silent, messages, api, result, responseData, msg, e_1, result;
29
29
  var _o;
30
30
  return __generator(this, function (_p) {
31
31
  switch (_p.label) {
@@ -33,6 +33,9 @@ var AjaxAction = /** @class */ (function () {
33
33
  if (!((_a = renderer.props.env) === null || _a === void 0 ? void 0 : _a.fetcher)) {
34
34
  throw new Error('env.fetcher is required!');
35
35
  }
36
+ if (!action.api) {
37
+ throw new Error('api is required!');
38
+ }
36
39
  if (this.fetcherType === 'download' && action.actionType === 'download') {
37
40
  if (action.api) {
38
41
  action.api.responseType = 'blob';
@@ -41,10 +44,15 @@ var AjaxAction = /** @class */ (function () {
41
44
  env = event.context.env;
42
45
  silent = (_b = action === null || action === void 0 ? void 0 : action.options) === null || _b === void 0 ? void 0 : _b.silent;
43
46
  messages = (_c = action === null || action === void 0 ? void 0 : action.api) === null || _c === void 0 ? void 0 : _c.messages;
47
+ api = normalizeApi(action.api);
48
+ // 如果没配置data数据映射,则给一个空对象,避免将当前数据域作为接口请求参数
49
+ if ((api === null || api === void 0 ? void 0 : api.data) == undefined) {
50
+ api = __assign(__assign({}, api), { data: {} });
51
+ }
44
52
  _p.label = 1;
45
53
  case 1:
46
54
  _p.trys.push([1, 3, , 4]);
47
- return [4 /*yield*/, env.fetcher(action === null || action === void 0 ? void 0 : action.api, (_d = action.data) !== null && _d !== void 0 ? _d : {}, (_e = action === null || action === void 0 ? void 0 : action.options) !== null && _e !== void 0 ? _e : {})];
55
+ return [4 /*yield*/, env.fetcher(api, (_d = action.data) !== null && _d !== void 0 ? _d : {}, (_e = action === null || action === void 0 ? void 0 : action.options) !== null && _e !== void 0 ? _e : {})];
48
56
  case 2:
49
57
  result = _p.sent();
50
58
  responseData = !isEmpty(result.data) || result.ok
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -21,7 +21,7 @@ var CmptAction = /** @class */ (function () {
21
21
  CmptAction.prototype.run = function (action, renderer, event) {
22
22
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
23
23
  return __awaiter(this, void 0, void 0, function () {
24
- var key, dataMergeMode, component, beforeSetData, path, res, result, e_1;
24
+ var key, dataMergeMode, component, msg, beforeSetData, path, res, result, e_1;
25
25
  var _s, _t;
26
26
  return __generator(this, function (_u) {
27
27
  switch (_u.label) {
@@ -32,7 +32,13 @@ var CmptAction = /** @class */ (function () {
32
32
  ? (_a = event.context.scoped) === null || _a === void 0 ? void 0 : _a[action.componentId ? 'getComponentById' : 'getComponentByName'](key)
33
33
  : null;
34
34
  if (key && !component) {
35
- throw Error('目标组件没有找到,请检查componentId或componentName是否正确');
35
+ msg = '尝试执行一个不存在的目标组件动作,请检查目标组件非隐藏状态,且正确指定了componentId或componentName';
36
+ if (action.ignoreError === false) {
37
+ throw Error(msg);
38
+ }
39
+ else {
40
+ console.warn(msg);
41
+ }
36
42
  }
37
43
  if (!(action.actionType === 'setValue')) return [3 /*break*/, 3];
38
44
  beforeSetData = (_c = (_b = renderer === null || renderer === void 0 ? void 0 : renderer.props) === null || _b === void 0 ? void 0 : _b.env) === null || _c === void 0 ? void 0 : _c.beforeSetData;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -102,7 +102,8 @@ var PopOver = /** @class */ (function (_super) {
102
102
  var _a = this.props; _a.placement; var activePlacement = _a.activePlacement, positionTop = _a.positionTop, positionLeft = _a.positionLeft; _a.arrowOffsetLeft; _a.arrowOffsetTop; var style = _a.style, children = _a.children; _a.offset; var overlay = _a.overlay, onHide = _a.onHide, ns = _a.classPrefix, cx = _a.classnames, className = _a.className, rest = __rest(_a, ["placement", "activePlacement", "positionTop", "positionLeft", "arrowOffsetLeft", "arrowOffsetTop", "style", "children", "offset", "overlay", "onHide", "classPrefix", "classnames", "className"]);
103
103
  var _b = this.state, xOffset = _b.xOffset, yOffset = _b.yOffset;
104
104
  var outerStyle = __assign(__assign({ display: 'block' }, style), { top: positionTop + yOffset, left: positionLeft + xOffset });
105
- return (React.createElement("div", __assign({ ref: this.wrapperRef, className: cx("".concat(ns, "PopOver"), className, "".concat(ns, "PopOver--").concat(camel(activePlacement))), style: outerStyle }, rest),
105
+ var placements = typeof activePlacement === 'string' ? activePlacement.split('-') : [];
106
+ return (React.createElement("div", __assign({ ref: this.wrapperRef, className: cx("PopOver", className, "PopOver--".concat(camel(activePlacement)), placements[3] ? "PopOver--v-".concat(placements[3]) : ''), style: outerStyle }, rest),
106
107
  overlay ? (React.createElement("div", { className: "".concat(ns, "PopOver-overlay"), onClick: onHide })) : null,
107
108
  children));
108
109
  };
package/esm/env.d.ts CHANGED
@@ -57,7 +57,9 @@ export interface RendererEnv {
57
57
  richTextToken: string;
58
58
  loadRenderer: (schema: Schema, path: string, reRender: Function) => Promise<React.ElementType> | React.ElementType | JSX.Element | void;
59
59
  loadChartExtends?: () => void | Promise<void>;
60
+ loadTinymcePlugin?: (tinymce: any) => void | Promise<void>;
60
61
  useMobileUI?: boolean;
62
+ isMobile: () => boolean;
61
63
  /**
62
64
  * 过滤 html 标签,可用来添加 xss 保护逻辑
63
65
  */
package/esm/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/factory.d.ts CHANGED
@@ -37,6 +37,7 @@ export interface RendererProps extends ThemeProps, LocaleProps, OnEventProps, St
37
37
  [propName: string]: any;
38
38
  };
39
39
  onBroadcast?: (type: string, rawEvent: RendererEvent<any>, ctx: any) => any;
40
+ mobileUI?: boolean;
40
41
  [propName: string]: any;
41
42
  }
42
43
  export type RendererComponent = React.ComponentType<RendererProps> & {
package/esm/factory.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.3.0
2
+ * amis-core v3.4.0-beta.12
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -9,7 +9,7 @@ import { RendererStore } from './store/index.js';
9
9
  import { destroy, getEnv } from 'mobx-state-tree';
10
10
  import { wrapFetcher } from './utils/api.js';
11
11
  import { normalizeLink } from './utils/normalizeLink.js';
12
- import { qsparse, parseQuery, findIndex, promisify } from './utils/helper.js';
12
+ import { qsparse, parseQuery, isMobile, findIndex, promisify } from './utils/helper.js';
13
13
  import { observer } from 'mobx-react';
14
14
  import { HocScoped } from './Scoped.js';
15
15
  import find from 'lodash/find';
@@ -203,7 +203,8 @@ var defaultOptions = {
203
203
  /**
204
204
  * 过滤 html 标签,可用来添加 xss 保护逻辑
205
205
  */
206
- filterHtml: function (input) { return input; }
206
+ filterHtml: function (input) { return input; },
207
+ isMobile: isMobile
207
208
  };
208
209
  var stores = {};
209
210
  // 默认 env 会被缓存,所以新传入的 env 不会替换旧的。