amis-core 3.5.3 → 3.6.1

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/esm/Root.js +1 -1
  2. package/esm/RootRenderer.d.ts +1 -1
  3. package/esm/RootRenderer.js +1 -1
  4. package/esm/SchemaRenderer.js +1 -1
  5. package/esm/Scoped.d.ts +2 -0
  6. package/esm/Scoped.js +48 -6
  7. package/esm/StatusScoped.js +1 -1
  8. package/esm/WithRootStore.js +1 -1
  9. package/esm/WithStore.js +27 -12
  10. package/esm/actions/Action.js +30 -22
  11. package/esm/actions/AjaxAction.js +2 -2
  12. package/esm/actions/BreakAction.js +1 -1
  13. package/esm/actions/BroadcastAction.js +1 -1
  14. package/esm/actions/CmptAction.js +3 -3
  15. package/esm/actions/ContinueAction.js +1 -1
  16. package/esm/actions/CopyAction.js +3 -3
  17. package/esm/actions/CustomAction.js +1 -1
  18. package/esm/actions/DialogAction.js +1 -1
  19. package/esm/actions/DrawerAction.js +1 -1
  20. package/esm/actions/EmailAction.js +1 -1
  21. package/esm/actions/LinkAction.js +5 -5
  22. package/esm/actions/LoopAction.js +1 -1
  23. package/esm/actions/PageAction.js +1 -1
  24. package/esm/actions/ParallelAction.js +1 -1
  25. package/esm/actions/StatusAction.js +1 -1
  26. package/esm/actions/SwitchAction.js +1 -1
  27. package/esm/actions/ToastAction.js +3 -3
  28. package/esm/components/CustomStyle.js +1 -1
  29. package/esm/components/ErrorBoundary.d.ts +20 -0
  30. package/esm/components/ErrorBoundary.js +41 -0
  31. package/esm/components/LazyComponent.js +1 -1
  32. package/esm/components/Overlay.js +1 -1
  33. package/esm/components/PopOver.d.ts +4 -0
  34. package/esm/components/PopOver.js +66 -3
  35. package/esm/env.js +1 -1
  36. package/esm/envOverwrite.js +1 -1
  37. package/esm/factory.js +1 -1
  38. package/esm/index.d.ts +2 -1
  39. package/esm/index.js +4 -3
  40. package/esm/locale.js +1 -1
  41. package/esm/polyfills.js +1 -1
  42. package/esm/renderers/Form.d.ts +1 -1
  43. package/esm/renderers/Form.js +16 -8
  44. package/esm/renderers/Item.d.ts +54 -0
  45. package/esm/renderers/Item.js +1 -1
  46. package/esm/renderers/Options.d.ts +4 -0
  47. package/esm/renderers/Options.js +5 -4
  48. package/esm/renderers/Placeholder.js +1 -1
  49. package/esm/renderers/builtin.js +1 -1
  50. package/esm/renderers/register.js +1 -1
  51. package/esm/renderers/wrapControl.js +4 -6
  52. package/esm/store/app.js +1 -1
  53. package/esm/store/combo.d.ts +24 -24
  54. package/esm/store/combo.js +1 -1
  55. package/esm/store/crud.d.ts +9 -1
  56. package/esm/store/crud.js +29 -13
  57. package/esm/store/form.d.ts +10 -10
  58. package/esm/store/form.js +1 -1
  59. package/esm/store/formItem.js +16 -7
  60. package/esm/store/iRenderer.js +1 -1
  61. package/esm/store/index.js +1 -1
  62. package/esm/store/list.js +1 -1
  63. package/esm/store/manager.js +1 -1
  64. package/esm/store/modal.js +1 -1
  65. package/esm/store/node.js +1 -1
  66. package/esm/store/pagination.js +1 -1
  67. package/esm/store/root.js +1 -1
  68. package/esm/store/service.js +1 -1
  69. package/esm/store/status.js +1 -1
  70. package/esm/store/table.d.ts +21 -20
  71. package/esm/store/table.js +8 -12
  72. package/esm/store/table2.js +1 -1
  73. package/esm/theme.js +1 -1
  74. package/esm/utils/Animation.js +1 -1
  75. package/esm/utils/ColorScale.js +1 -1
  76. package/esm/utils/DataSchema.js +1 -1
  77. package/esm/utils/DataScope.js +1 -1
  78. package/esm/utils/RootClose.js +1 -1
  79. package/esm/utils/SimpleMap.js +1 -1
  80. package/esm/utils/api.js +1 -1
  81. package/esm/utils/arraySlice.js +1 -1
  82. package/esm/utils/attachmentAdpator.js +3 -1
  83. package/esm/utils/autobind.js +1 -1
  84. package/esm/utils/columnsSplit.js +1 -1
  85. package/esm/utils/dataMapping.js +1 -1
  86. package/esm/utils/date.js +1 -1
  87. package/esm/utils/debug.js +1 -1
  88. package/esm/utils/decodeEntity.js +1 -1
  89. package/esm/utils/dom.js +1 -1
  90. package/esm/utils/errors.js +1 -1
  91. package/esm/utils/escapeHtml.js +1 -1
  92. package/esm/utils/filter-schema.d.ts +2 -1
  93. package/esm/utils/filter-schema.js +14 -5
  94. package/esm/utils/filter.js +1 -1
  95. package/esm/utils/formatDuration.js +1 -1
  96. package/esm/utils/formula.js +1 -1
  97. package/esm/utils/getVariable.js +1 -1
  98. package/esm/utils/grammar.js +1 -1
  99. package/esm/utils/handleAction.js +1 -1
  100. package/esm/utils/helper.js +1 -1
  101. package/esm/utils/highlight.js +1 -1
  102. package/esm/utils/icon.js +1 -1
  103. package/esm/utils/image.js +1 -1
  104. package/esm/utils/isPureVariable.js +1 -1
  105. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  106. package/esm/utils/keyToPath.js +1 -1
  107. package/esm/utils/makeSorter.js +1 -1
  108. package/esm/utils/math.js +1 -1
  109. package/esm/utils/memoryParse.js +1 -1
  110. package/esm/utils/normalizeLink.js +1 -1
  111. package/esm/utils/normalizeOptions.js +1 -1
  112. package/esm/utils/object.js +1 -1
  113. package/esm/utils/offset.js +1 -1
  114. package/esm/utils/offsetParent.js +1 -1
  115. package/esm/utils/optionValueCompare.js +1 -1
  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 +5 -3
  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 +1 -1
  139. package/lib/SchemaRenderer.js +1 -1
  140. package/lib/Scoped.d.ts +2 -0
  141. package/lib/Scoped.js +47 -5
  142. package/lib/StatusScoped.js +1 -1
  143. package/lib/WithRootStore.js +1 -1
  144. package/lib/WithStore.js +26 -11
  145. package/lib/actions/Action.js +29 -21
  146. package/lib/actions/AjaxAction.js +2 -2
  147. package/lib/actions/BreakAction.js +1 -1
  148. package/lib/actions/BroadcastAction.js +1 -1
  149. package/lib/actions/CmptAction.js +3 -3
  150. package/lib/actions/ContinueAction.js +1 -1
  151. package/lib/actions/CopyAction.js +3 -3
  152. package/lib/actions/CustomAction.js +1 -1
  153. package/lib/actions/DialogAction.js +1 -1
  154. package/lib/actions/DrawerAction.js +1 -1
  155. package/lib/actions/EmailAction.js +1 -1
  156. package/lib/actions/LinkAction.js +5 -5
  157. package/lib/actions/LoopAction.js +1 -1
  158. package/lib/actions/PageAction.js +1 -1
  159. package/lib/actions/ParallelAction.js +1 -1
  160. package/lib/actions/StatusAction.js +1 -1
  161. package/lib/actions/SwitchAction.js +1 -1
  162. package/lib/actions/ToastAction.js +3 -3
  163. package/lib/components/CustomStyle.js +1 -1
  164. package/lib/components/ErrorBoundary.d.ts +20 -0
  165. package/lib/components/ErrorBoundary.js +52 -0
  166. package/lib/components/LazyComponent.js +1 -1
  167. package/lib/components/Overlay.js +1 -1
  168. package/lib/components/PopOver.d.ts +4 -0
  169. package/lib/components/PopOver.js +64 -1
  170. package/lib/env.js +1 -1
  171. package/lib/envOverwrite.js +1 -1
  172. package/lib/factory.js +1 -1
  173. package/lib/index.d.ts +2 -1
  174. package/lib/index.js +5 -2
  175. package/lib/locale.js +1 -1
  176. package/lib/polyfills.js +1 -1
  177. package/lib/renderers/Form.d.ts +1 -1
  178. package/lib/renderers/Form.js +16 -8
  179. package/lib/renderers/Item.d.ts +55 -1
  180. package/lib/renderers/Item.js +1 -1
  181. package/lib/renderers/Options.d.ts +4 -0
  182. package/lib/renderers/Options.js +5 -4
  183. package/lib/renderers/Placeholder.js +1 -1
  184. package/lib/renderers/builtin.js +1 -1
  185. package/lib/renderers/register.js +1 -1
  186. package/lib/renderers/wrapControl.js +4 -6
  187. package/lib/store/app.js +1 -1
  188. package/lib/store/combo.d.ts +25 -24
  189. package/lib/store/combo.js +1 -1
  190. package/lib/store/crud.d.ts +9 -1
  191. package/lib/store/crud.js +29 -13
  192. package/lib/store/form.d.ts +11 -10
  193. package/lib/store/form.js +1 -1
  194. package/lib/store/formItem.js +16 -7
  195. package/lib/store/iRenderer.js +1 -1
  196. package/lib/store/index.js +1 -1
  197. package/lib/store/list.js +1 -1
  198. package/lib/store/manager.js +1 -1
  199. package/lib/store/modal.js +1 -1
  200. package/lib/store/node.js +1 -1
  201. package/lib/store/pagination.js +1 -1
  202. package/lib/store/root.js +1 -1
  203. package/lib/store/service.js +1 -1
  204. package/lib/store/status.js +1 -1
  205. package/lib/store/table.d.ts +22 -20
  206. package/lib/store/table.js +8 -12
  207. package/lib/store/table2.js +1 -1
  208. package/lib/theme.js +1 -1
  209. package/lib/utils/Animation.js +1 -1
  210. package/lib/utils/ColorScale.js +1 -1
  211. package/lib/utils/DataSchema.js +1 -1
  212. package/lib/utils/DataScope.js +1 -1
  213. package/lib/utils/RootClose.js +1 -1
  214. package/lib/utils/SimpleMap.js +1 -1
  215. package/lib/utils/api.js +1 -1
  216. package/lib/utils/arraySlice.js +1 -1
  217. package/lib/utils/attachmentAdpator.js +3 -1
  218. package/lib/utils/autobind.js +1 -1
  219. package/lib/utils/columnsSplit.js +1 -1
  220. package/lib/utils/dataMapping.js +1 -1
  221. package/lib/utils/date.js +1 -1
  222. package/lib/utils/debug.js +1 -1
  223. package/lib/utils/decodeEntity.js +1 -1
  224. package/lib/utils/dom.js +1 -1
  225. package/lib/utils/errors.js +1 -1
  226. package/lib/utils/escapeHtml.js +1 -1
  227. package/lib/utils/filter-schema.d.ts +2 -1
  228. package/lib/utils/filter-schema.js +14 -4
  229. package/lib/utils/filter.js +1 -1
  230. package/lib/utils/formatDuration.js +1 -1
  231. package/lib/utils/formula.js +1 -1
  232. package/lib/utils/getVariable.js +1 -1
  233. package/lib/utils/grammar.js +1 -1
  234. package/lib/utils/handleAction.js +1 -1
  235. package/lib/utils/helper.js +1 -1
  236. package/lib/utils/highlight.js +1 -1
  237. package/lib/utils/icon.js +1 -1
  238. package/lib/utils/image.js +1 -1
  239. package/lib/utils/isPureVariable.js +1 -1
  240. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  241. package/lib/utils/keyToPath.js +1 -1
  242. package/lib/utils/makeSorter.js +1 -1
  243. package/lib/utils/math.js +1 -1
  244. package/lib/utils/memoryParse.js +1 -1
  245. package/lib/utils/normalizeLink.js +1 -1
  246. package/lib/utils/normalizeOptions.js +1 -1
  247. package/lib/utils/object.js +1 -1
  248. package/lib/utils/offset.js +1 -1
  249. package/lib/utils/offsetParent.js +1 -1
  250. package/lib/utils/optionValueCompare.js +1 -1
  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 +5 -3
  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/esm/Root.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -30,5 +30,5 @@ export declare class RootRenderer extends React.Component<RootRendererProps> {
30
30
  renderError(): React.ReactNode;
31
31
  renderDialog(): React.ReactNode;
32
32
  renderDrawer(): React.ReactNode;
33
- render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
33
+ render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
34
34
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/Scoped.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  import React from 'react';
6
6
  import { RendererEnv, RendererProps } from './factory';
7
7
  import { RendererData, ActionObject } from './types';
8
+ import { ListenerAction } from './actions';
8
9
  /**
9
10
  * target 里面可能包含 ?xxx=xxx,这种情况下,需要把 ?xxx=xxx 保留下来,然后对前面的部分进行 filter
10
11
  * 因为后面会对 query 部分做不一样的处理。会保留原始的值。而不是会转成字符串。
@@ -36,6 +37,7 @@ export interface IScopedContext {
36
37
  close: (target: string) => void;
37
38
  closeById: (target: string) => void;
38
39
  getComponentsByRefPath: (session: string, path: string) => ScopedComponentType[];
40
+ doAction: (actions: ListenerAction | ListenerAction[], ctx: any) => void;
39
41
  }
40
42
  type AliasIScopedContext = IScopedContext;
41
43
  export declare const ScopedContext: React.Context<IScopedContext>;
package/esm/Scoped.js CHANGED
@@ -1,18 +1,18 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __values, __assign, __extends, __rest, __decorate, __metadata } from 'tslib';
6
+ import { __values, __assign, __awaiter, __generator, __extends, __rest, __decorate, __metadata } from 'tslib';
7
7
  import React from 'react';
8
8
  import find from 'lodash/find';
9
9
  import values from 'lodash/values';
10
10
  import hoistNonReactStatic from 'hoist-non-react-statics';
11
11
  import { registerFunction } from 'amis-formula';
12
12
  import 'moment';
13
- import 'lodash/isPlainObject';
14
- import { getVariable } from './utils/getVariable.js';
13
+ import { createObject } from './utils/object.js';
15
14
  import { isPureVariable } from './utils/isPureVariable.js';
15
+ import { getVariable } from './utils/getVariable.js';
16
16
  import { dataMapping } from './utils/dataMapping.js';
17
17
  import './utils/filter.js';
18
18
  import { findTree, eachTree, qsparse, qsstringify, parseQuery, autobind } from './utils/helper.js';
@@ -25,13 +25,13 @@ import './utils/debug.js';
25
25
  import 'react-dom';
26
26
  import './utils/errors.js';
27
27
  import { filter } from './utils/tpl.js';
28
+ import 'lodash/isPlainObject';
28
29
  import 'lodash/isObject';
29
30
  import 'lodash/isString';
30
31
  import 'lodash/isBoolean';
31
32
  import './utils/image.js';
32
33
  import 'lodash/isEqual';
33
- import './actions/Action.js';
34
- import 'lodash/debounce';
34
+ import { createRendererEvent } from './utils/renderer-event.js';
35
35
  import 'lodash/cloneDeep';
36
36
  import './utils/resize-sensor.js';
37
37
  import 'react-overlays/useRootClose';
@@ -46,6 +46,24 @@ import './utils/validations.js';
46
46
  import './utils/resolveCondition.js';
47
47
  import 'mobx';
48
48
  import './utils/Animation.js';
49
+ import './actions/LoopAction.js';
50
+ import './actions/BreakAction.js';
51
+ import './actions/ContinueAction.js';
52
+ import './actions/SwitchAction.js';
53
+ import './actions/ParallelAction.js';
54
+ import './actions/CustomAction.js';
55
+ import './actions/BroadcastAction.js';
56
+ import './actions/CmptAction.js';
57
+ import './actions/StatusAction.js';
58
+ import './actions/AjaxAction.js';
59
+ import './actions/CopyAction.js';
60
+ import './actions/DialogAction.js';
61
+ import './actions/DrawerAction.js';
62
+ import './actions/EmailAction.js';
63
+ import './actions/LinkAction.js';
64
+ import './actions/ToastAction.js';
65
+ import './actions/PageAction.js';
66
+ import { runActions } from './actions/Action.js';
49
67
 
50
68
  /**
51
69
  * @file 用来创建一个域,在这个域里面会把里面的运行时实例注册进来,方便组件之间的通信。
@@ -298,6 +316,30 @@ function createScopedTools(path, parent, env, rendererType) {
298
316
  if (component && component.props.show) {
299
317
  closeDialog(component);
300
318
  }
319
+ },
320
+ doAction: function (actions, ctx) {
321
+ return __awaiter(this, void 0, void 0, function () {
322
+ var renderer, rendererEvent;
323
+ return __generator(this, function (_a) {
324
+ switch (_a.label) {
325
+ case 0:
326
+ renderer = this.getComponents()[0];
327
+ rendererEvent = createRendererEvent('embed', {
328
+ env: env,
329
+ nativeEvent: undefined,
330
+ data: createObject(renderer.props.data, ctx),
331
+ scoped: this
332
+ });
333
+ return [4 /*yield*/, runActions(actions, renderer, rendererEvent)];
334
+ case 1:
335
+ _a.sent();
336
+ if (rendererEvent.prevented) {
337
+ return [2 /*return*/];
338
+ }
339
+ return [2 /*return*/];
340
+ }
341
+ });
342
+ });
301
343
  }
302
344
  };
303
345
  registerFunction('GETRENDERERDATA', function (componentId, path, scoped) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
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.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -9,7 +9,7 @@ import { reaction } from 'mobx';
9
9
  import { observer } from 'mobx-react';
10
10
  import { isAlive } from 'mobx-state-tree';
11
11
  import React from 'react';
12
- import { getExprProperties } from './utils/filter-schema.js';
12
+ import { getExprProperties, hasExprPropertiesChanged } from './utils/filter-schema.js';
13
13
  import { guid, isObjectShallowModified, isSuperDataModified, syncDataFromSuper } from './utils/helper.js';
14
14
  import 'amis-formula';
15
15
  import 'moment';
@@ -60,12 +60,10 @@ function HocStoreFactory(renderer) {
60
60
  var detectField = props.detectField, rest = __rest(props, ["detectField"]);
61
61
  var exprProps = {};
62
62
  if (!detectField || detectField === 'data') {
63
- exprProps = getExprProperties(rest, store.data, undefined, rest);
63
+ exprProps = getExprProperties(rest, store.data);
64
64
  _this.state = __assign({}, exprProps);
65
- _this.unReaction = reaction(function () {
66
- return JSON.stringify(getExprProperties(_this.props, store.data, undefined, _this.props));
67
- }, function () {
68
- return _this.setState(__assign({}, getExprProperties(_this.props, store.data, undefined, _this.props)));
65
+ _this.unReaction = reaction(function () { return JSON.stringify(getExprProperties(_this.props, store.data)); }, function () {
66
+ return _this.setState(__assign({}, getExprProperties(_this.props, store.data)));
69
67
  });
70
68
  }
71
69
  return _this;
@@ -85,10 +83,24 @@ function HocStoreFactory(renderer) {
85
83
  return data;
86
84
  };
87
85
  StoreFactory.prototype.componentDidUpdate = function (prevProps) {
88
- var _a, _b, _c;
86
+ var _this = this;
87
+ var _a, _b, _c, _d;
89
88
  var props = this.props;
90
89
  var store = this.store;
91
- var shouldSync = (_a = renderer.shouldSyncSuperStore) === null || _a === void 0 ? void 0 : _a.call(renderer, store, props, prevProps);
90
+ // dialog 场景下 schema 是显示的时候更新的,
91
+ // 所以 schema 里面有表达式属性其实是监听不到变化的
92
+ // 所以这里需要根据新属性重新 reaction 一下
93
+ if ((!props.detectField || props.detectField === 'data') &&
94
+ hasExprPropertiesChanged(this.props, prevProps)) {
95
+ var state = getExprProperties(this.props, store.data);
96
+ isObjectShallowModified(state, this.state) && this.setState(state);
97
+ // 需要重新监听
98
+ (_a = this.unReaction) === null || _a === void 0 ? void 0 : _a.call(this);
99
+ this.unReaction = reaction(function () { return JSON.stringify(getExprProperties(props, store.data)); }, function () {
100
+ return _this.setState(__assign({}, getExprProperties(_this.props, store.data)));
101
+ });
102
+ }
103
+ var shouldSync = (_b = renderer.shouldSyncSuperStore) === null || _b === void 0 ? void 0 : _b.call(renderer, store, props, prevProps);
92
104
  if (shouldSync === false) {
93
105
  return;
94
106
  }
@@ -123,10 +135,13 @@ function HocStoreFactory(renderer) {
123
135
  ? __assign({}, store.data) : syncDataFromSuper(store.data, props.store.data, prevProps.scope, store, props.syncSuperStore === true)), props.updatePristineAfterStoreDataReInit === false);
124
136
  }
125
137
  else if (props.data && props.data.__super) {
126
- store.initData(extendObject(props.data, store.hasRemoteData || store.path === 'page'
138
+ store.initData(extendObject(props.data,
139
+ // 有远程数据
140
+ // 或者顶级 store
141
+ store.hasRemoteData || !store.path.includes('/')
127
142
  ? __assign(__assign({}, store.data), props.data) : // combo 不需要同步,如果要同步,在 Combo.tsx 里面已经实现了相关逻辑
128
143
  // 目前主要的问题是,如果 combo 中表单项名字和 combo 本身的名字一样,会导致里面的值会被覆盖成数组
129
- ((_b = props.store) === null || _b === void 0 ? void 0 : _b.storeType) === 'ComboStore'
144
+ ((_c = props.store) === null || _c === void 0 ? void 0 : _c.storeType) === 'ComboStore'
130
145
  ? undefined
131
146
  : syncDataFromSuper(props.data, props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
132
147
  }
@@ -143,7 +158,7 @@ function HocStoreFactory(renderer) {
143
158
  isObjectShallowModified(props.data.__super, prevProps.data.__super, false)) {
144
159
  store.initData(createObject(props.data.__super, __assign(__assign({}, props.data), store.data)), props.updatePristineAfterStoreDataReInit === false ||
145
160
  (store.storeType === 'FormStore' &&
146
- ((_c = prevProps.store) === null || _c === void 0 ? void 0 : _c.storeType) === 'CRUDStore'));
161
+ ((_d = prevProps.store) === null || _d === void 0 ? void 0 : _d.storeType) === 'CRUDStore'));
147
162
  }
148
163
  // nextProps.data.__super !== props.data.__super) &&
149
164
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
- import { __awaiter, __generator, __values, __assign } from 'tslib';
6
+ import { __awaiter, __generator, __values, __assign, __spreadArray, __read } from 'tslib';
7
7
  import omit from 'lodash/omit';
8
8
  import '../utils/helper.js';
9
9
  import { evalExpressionWithConditionBuilder } from '../utils/tpl.js';
@@ -181,10 +181,10 @@ var runActions = function (actions, renderer, event) { return __awaiter(void 0,
181
181
  }); };
182
182
  // 执行动作,与原有动作处理打通
183
183
  var runAction = function (actionInstrance, actionConfig, renderer, event) { return __awaiter(void 0, void 0, void 0, function () {
184
- var additional, action, mergeData, expression, isStop, preventDefault, key, api, args, afterMappingData, actionData, data, stopped, actionResult, stopPropagation;
185
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
186
- return __generator(this, function (_u) {
187
- switch (_u.label) {
184
+ var additional, action, mergeData, expression, isStop, preventDefault, key, api, cmptFlag, targetComponent, args, afterMappingData, actionData, data, stopped, actionResult, stopPropagation;
185
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
186
+ return __generator(this, function (_v) {
187
+ switch (_v.label) {
188
188
  case 0:
189
189
  additional = {
190
190
  event: event
@@ -206,8 +206,8 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
206
206
  if (!expression) return [3 /*break*/, 2];
207
207
  return [4 /*yield*/, evalExpressionWithConditionBuilder(expression, mergeData, true)];
208
208
  case 1:
209
- isStop = !(_u.sent());
210
- _u.label = 2;
209
+ isStop = !(_v.sent());
210
+ _v.label = 2;
211
211
  case 2:
212
212
  if (isStop) {
213
213
  return [2 /*return*/];
@@ -216,8 +216,8 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
216
216
  if (!action.preventDefault) return [3 /*break*/, 4];
217
217
  return [4 /*yield*/, evalExpressionWithConditionBuilder(action.preventDefault, mergeData, false)];
218
218
  case 3:
219
- preventDefault = _u.sent();
220
- _u.label = 4;
219
+ preventDefault = _v.sent();
220
+ _v.label = 4;
221
221
  case 4:
222
222
  key = {
223
223
  componentId: dataMapping(action.componentId, mergeData),
@@ -241,14 +241,22 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
241
241
  (_q = action.args) === null || _q === void 0 ? true : delete _q.options;
242
242
  (_r = action.args) === null || _r === void 0 ? true : delete _r.messages;
243
243
  }
244
+ cmptFlag = key.componentId || key.componentName;
245
+ targetComponent = cmptFlag
246
+ ? (_s = event.context.scoped) === null || _s === void 0 ? void 0 : _s[action.componentId ? 'getComponentById' : 'getComponentByName'](cmptFlag)
247
+ : renderer;
244
248
  args = dataMapping(action.args, mergeData, function (key) {
245
- return [
246
- 'adaptor',
247
- 'responseAdaptor',
248
- 'requestAdaptor',
249
- 'responseData',
250
- 'condition'
251
- ].includes(key);
249
+ var _a;
250
+ var actionIgnoreKey = {
251
+ ajax: ['adaptor', 'responseAdaptor', 'requestAdaptor', 'responseData']
252
+ };
253
+ var cmptIgnoreMap = {
254
+ 'input-table': ['condition']
255
+ };
256
+ var curCmptType = (_a = targetComponent === null || targetComponent === void 0 ? void 0 : targetComponent.props) === null || _a === void 0 ? void 0 : _a.type;
257
+ var curActionType = action.actionType;
258
+ var ignoreKey = __spreadArray(__spreadArray([], __read((actionIgnoreKey[curActionType] || [])), false), __read((cmptIgnoreMap[curCmptType] || [])), false);
259
+ return ignoreKey.includes(key);
252
260
  });
253
261
  afterMappingData = dataMapping(action.data, mergeData);
254
262
  actionData = args && Object.keys(args).length
@@ -258,12 +266,12 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
258
266
  !['ajax', 'download', 'dialog', 'drawer'].includes(action.actionType) // 避免非法配置影响对actionData的判断,导致动作配置中的数据映射失败
259
267
  ? actionData
260
268
  : mergeData;
261
- (_s = console.group) === null || _s === void 0 ? void 0 : _s.call(console, "run action ".concat(action.actionType));
269
+ (_t = console.group) === null || _t === void 0 ? void 0 : _t.call(console, "run action ".concat(action.actionType));
262
270
  console.debug("[".concat(action.actionType, "] action args, data"), args, data);
263
271
  stopped = false;
264
272
  return [4 /*yield*/, actionInstrance.run(__assign(__assign(__assign({}, action), { args: args, data: action.actionType === 'reload' ? actionData : data }), key), renderer, event, mergeData)];
265
273
  case 5:
266
- actionResult = _u.sent();
274
+ actionResult = _v.sent();
267
275
  // 二次确认弹窗如果取消,则终止后续动作
268
276
  if ((action === null || action === void 0 ? void 0 : action.actionType) === 'confirmDialog' && !actionResult) {
269
277
  stopped = true;
@@ -273,11 +281,11 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
273
281
  if (!action.stopPropagation) return [3 /*break*/, 7];
274
282
  return [4 /*yield*/, evalExpressionWithConditionBuilder(action.stopPropagation, mergeData, false)];
275
283
  case 6:
276
- stopPropagation = _u.sent();
277
- _u.label = 7;
284
+ stopPropagation = _v.sent();
285
+ _v.label = 7;
278
286
  case 7:
279
287
  console.debug("[".concat(action.actionType, "] action end event"), event);
280
- (_t = console.groupEnd) === null || _t === void 0 ? void 0 : _t.call(console);
288
+ (_u = console.groupEnd) === null || _u === void 0 ? void 0 : _u.call(console);
281
289
  // 阻止原有动作执行
282
290
  preventDefault && event.preventDefault();
283
291
  // 阻止后续动作执行
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -30,7 +30,7 @@ var AjaxAction = /** @class */ (function () {
30
30
  return __generator(this, function (_p) {
31
31
  switch (_p.label) {
32
32
  case 0:
33
- if (!((_a = renderer.props.env) === null || _a === void 0 ? void 0 : _a.fetcher)) {
33
+ if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.fetcher)) {
34
34
  throw new Error('env.fetcher is required!');
35
35
  }
36
36
  if (!action.api) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -30,7 +30,7 @@ var CmptAction = /** @class */ (function () {
30
30
  dataMergeMode = action.dataMergeMode || 'merge';
31
31
  path = (_a = action.args) === null || _a === void 0 ? void 0 : _a.path;
32
32
  if (!(action.actionType === 'setValue' && path && typeof path === 'string')) return [3 /*break*/, 2];
33
- 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;
33
+ beforeSetData = (_c = (_b = event === null || event === void 0 ? void 0 : event.context) === null || _b === void 0 ? void 0 : _b.env) === null || _c === void 0 ? void 0 : _c.beforeSetData;
34
34
  if (!(beforeSetData && typeof beforeSetData === 'function')) return [3 /*break*/, 2];
35
35
  return [4 /*yield*/, beforeSetData(renderer, action, event)];
36
36
  case 1:
@@ -43,7 +43,7 @@ var CmptAction = /** @class */ (function () {
43
43
  component = key
44
44
  ? (_d = event.context.scoped) === null || _d === void 0 ? void 0 : _d[action.componentId ? 'getComponentById' : 'getComponentByName'](key)
45
45
  : renderer;
46
- // 如果key指定来,但是没找到组件,则报错
46
+ // 如果key指定了,但是没找到组件,则报错
47
47
  if (key && !component) {
48
48
  msg = '尝试执行一个不存在的目标组件动作,请检查目标组件非隐藏状态,且正确指定了componentId或componentName';
49
49
  if (action.ignoreError === false) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -20,11 +20,11 @@ var CopyAction = /** @class */ (function () {
20
20
  var _a, _b, _c, _d, _e, _f;
21
21
  return __awaiter(this, void 0, void 0, function () {
22
22
  return __generator(this, function (_g) {
23
- if (!((_a = renderer.props.env) === null || _a === void 0 ? void 0 : _a.copy)) {
23
+ if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.copy)) {
24
24
  throw new Error('env.copy is required!');
25
25
  }
26
26
  if ((_b = action.args) === null || _b === void 0 ? void 0 : _b.content) {
27
- (_d = (_c = renderer.props.env).copy) === null || _d === void 0 ? void 0 : _d.call(_c, action.args.content, {
27
+ (_d = (_c = event.context.env) === null || _c === void 0 ? void 0 : _c.copy) === null || _d === void 0 ? void 0 : _d.call(_c, action.args.content, {
28
28
  format: (_f = (_e = action.args) === null || _e === void 0 ? void 0 : _e.copyFormat) !== null && _f !== void 0 ? _f : 'text/html'
29
29
  });
30
30
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -18,11 +18,11 @@ var LinkAction = /** @class */ (function () {
18
18
  function LinkAction() {
19
19
  }
20
20
  LinkAction.prototype.run = function (action, renderer, event) {
21
- var _a, _b, _c, _d, _e, _f, _g;
21
+ var _a, _b, _c, _d, _e, _f, _g, _h;
22
22
  return __awaiter(this, void 0, void 0, function () {
23
23
  var urlObj;
24
- return __generator(this, function (_h) {
25
- if (!((_a = renderer.props.env) === null || _a === void 0 ? void 0 : _a.jumpTo)) {
24
+ return __generator(this, function (_j) {
25
+ if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.jumpTo)) {
26
26
  throw new Error('env.jumpTo is required!');
27
27
  }
28
28
  urlObj = buildApi({
@@ -31,7 +31,7 @@ var LinkAction = /** @class */ (function () {
31
31
  }, __assign(__assign({}, ((_e = (_d = action.args) === null || _d === void 0 ? void 0 : _d.params) !== null && _e !== void 0 ? _e : {})), ((_f = action.data) !== null && _f !== void 0 ? _f : {})), {
32
32
  autoAppend: true
33
33
  });
34
- renderer.props.env.jumpTo(urlObj.url, __assign({ actionType: action.actionType, type: 'button' }, action.args), (_g = action.data) !== null && _g !== void 0 ? _g : {});
34
+ (_g = event.context.env) === null || _g === void 0 ? void 0 : _g.jumpTo(urlObj.url, __assign({ actionType: action.actionType, type: 'button' }, action.args), (_h = action.data) !== null && _h !== void 0 ? _h : {});
35
35
  return [2 /*return*/];
36
36
  });
37
37
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -16,10 +16,10 @@ var ToastAction = /** @class */ (function () {
16
16
  var _a, _b, _c, _d, _e;
17
17
  return __awaiter(this, void 0, void 0, function () {
18
18
  return __generator(this, function (_f) {
19
- if (!((_a = renderer.props.env) === null || _a === void 0 ? void 0 : _a.notify)) {
19
+ if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.notify)) {
20
20
  throw new Error('env.notify is required!');
21
21
  }
22
- (_c = (_b = event.context.env).notify) === null || _c === void 0 ? void 0 : _c.call(_b, ((_d = action.args) === null || _d === void 0 ? void 0 : _d.msgType) || 'info', String((_e = action.args) === null || _e === void 0 ? void 0 : _e.msg), action.args);
22
+ (_c = (_b = event.context.env) === null || _b === void 0 ? void 0 : _b.notify) === null || _c === void 0 ? void 0 : _c.call(_b, ((_d = action.args) === null || _d === void 0 ? void 0 : _d.msgType) || 'info', String((_e = action.args) === null || _e === void 0 ? void 0 : _e.msg), action.args);
23
23
  return [2 /*return*/];
24
24
  });
25
25
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.5.3
2
+ * amis-core v3.6.1
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @file ErrorBoundary
3
+ * @description 捕获发生在其子组件树任何位置的 JavaScript 错误,并打印这些错误
4
+ * @author wibetter
5
+ */
6
+ import React from 'react';
7
+ interface ErrorBoundaryProps {
8
+ customErrorMsg?: string;
9
+ fallback?: () => void;
10
+ children: any;
11
+ }
12
+ interface ErrorBoundaryStates {
13
+ hasError: boolean;
14
+ }
15
+ export default class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryStates> {
16
+ constructor(props: any);
17
+ componentDidCatch(error: any, errorInfo: any): void;
18
+ render(): any;
19
+ }
20
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * amis-core v3.6.1
3
+ * Copyright 2018-2023 fex
4
+ */
5
+
6
+ import { __extends } from 'tslib';
7
+ import React from 'react';
8
+
9
+ var ErrorBoundary = /** @class */ (function (_super) {
10
+ __extends(ErrorBoundary, _super);
11
+ function ErrorBoundary(props) {
12
+ var _this = _super.call(this, props) || this;
13
+ _this.state = { hasError: false };
14
+ return _this;
15
+ }
16
+ ErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) {
17
+ var customErrorMsg = this.props.customErrorMsg;
18
+ if (customErrorMsg) {
19
+ console.warn(customErrorMsg);
20
+ }
21
+ console.warn('错误对象:', error);
22
+ console.warn('错误信息:', errorInfo);
23
+ this.setState({
24
+ hasError: true
25
+ });
26
+ };
27
+ ErrorBoundary.prototype.render = function () {
28
+ var fallback = this.props.fallback;
29
+ if (this.state.hasError) {
30
+ if (fallback) {
31
+ return fallback();
32
+ }
33
+ // 默认渲染错误信息
34
+ return (React.createElement("div", { className: "renderer-error-boundary" }, "\u6E32\u67D3\u53D1\u751F\u9519\u8BEF\uFF0C\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\u8F93\u51FA\u3002"));
35
+ }
36
+ return this.props.children;
37
+ };
38
+ return ErrorBoundary;
39
+ }(React.Component));
40
+
41
+ export { ErrorBoundary as default };