amis-core 3.6.2 → 6.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 (287) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +1 -1
  3. package/esm/SchemaRenderer.js +1 -1
  4. package/esm/Scoped.js +2 -1
  5. package/esm/StatusScoped.js +1 -1
  6. package/esm/WithRootStore.js +1 -1
  7. package/esm/WithStore.js +1 -1
  8. package/esm/actions/Action.js +31 -27
  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 +65 -26
  13. package/esm/actions/ContinueAction.js +1 -1
  14. package/esm/actions/CopyAction.js +1 -1
  15. package/esm/actions/CustomAction.js +3 -2
  16. package/esm/actions/DialogAction.js +1 -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/StatusAction.js +1 -1
  24. package/esm/actions/SwitchAction.js +1 -1
  25. package/esm/actions/ToastAction.js +1 -1
  26. package/esm/components/CustomStyle.js +1 -1
  27. package/esm/components/ErrorBoundary.js +1 -1
  28. package/esm/components/LazyComponent.js +1 -1
  29. package/esm/components/Overlay.d.ts +2 -1
  30. package/esm/components/Overlay.js +21 -6
  31. package/esm/components/PopOver.js +6 -3
  32. package/esm/env.js +1 -1
  33. package/esm/envOverwrite.js +1 -1
  34. package/esm/factory.js +1 -1
  35. package/esm/index.js +4 -2
  36. package/esm/locale.js +1 -1
  37. package/esm/polyfills.js +1 -1
  38. package/esm/renderers/Form.js +125 -111
  39. package/esm/renderers/Item.js +4 -3
  40. package/esm/renderers/Options.js +163 -49
  41. package/esm/renderers/Placeholder.js +1 -1
  42. package/esm/renderers/builtin.js +1 -1
  43. package/esm/renderers/register.js +1 -1
  44. package/esm/renderers/wrapControl.js +4 -3
  45. package/esm/store/app.d.ts +2 -2
  46. package/esm/store/app.js +3 -2
  47. package/esm/store/combo.d.ts +7 -7
  48. package/esm/store/combo.js +1 -1
  49. package/esm/store/crud.d.ts +3 -2
  50. package/esm/store/crud.js +18 -4
  51. package/esm/store/form.d.ts +3 -3
  52. package/esm/store/form.js +5 -5
  53. package/esm/store/formItem.js +1 -1
  54. package/esm/store/iRenderer.d.ts +1 -1
  55. package/esm/store/iRenderer.js +7 -2
  56. package/esm/store/index.js +1 -1
  57. package/esm/store/list.d.ts +1 -1
  58. package/esm/store/list.js +18 -13
  59. package/esm/store/manager.js +1 -1
  60. package/esm/store/modal.d.ts +2 -2
  61. package/esm/store/modal.js +1 -1
  62. package/esm/store/node.js +1 -1
  63. package/esm/store/pagination.d.ts +2 -1
  64. package/esm/store/pagination.js +3 -2
  65. package/esm/store/root.d.ts +2 -2
  66. package/esm/store/root.js +3 -2
  67. package/esm/store/service.d.ts +2 -2
  68. package/esm/store/service.js +11 -7
  69. package/esm/store/status.js +1 -1
  70. package/esm/store/table.d.ts +7 -7
  71. package/esm/store/table.js +26 -11
  72. package/esm/store/table2.d.ts +14 -3
  73. package/esm/store/table2.js +22 -9
  74. package/esm/theme.js +1 -1
  75. package/esm/types.d.ts +7 -0
  76. package/esm/utils/Animation.js +1 -1
  77. package/esm/utils/ColorScale.js +1 -1
  78. package/esm/utils/DataSchema.js +1 -1
  79. package/esm/utils/DataScope.js +1 -1
  80. package/esm/utils/RootClose.js +1 -1
  81. package/esm/utils/SimpleMap.js +1 -1
  82. package/esm/utils/api.js +1 -1
  83. package/esm/utils/arraySlice.js +1 -1
  84. package/esm/utils/attachmentAdpator.js +1 -1
  85. package/esm/utils/autobind.js +1 -1
  86. package/esm/utils/browser.d.ts +1 -0
  87. package/esm/utils/browser.js +11 -0
  88. package/esm/utils/columnsSplit.js +1 -1
  89. package/esm/utils/concatData.d.ts +8 -0
  90. package/esm/utils/concatData.js +39 -0
  91. package/esm/utils/dataMapping.js +1 -1
  92. package/esm/utils/date.js +1 -1
  93. package/esm/utils/debug.js +1 -1
  94. package/esm/utils/decodeEntity.js +1 -1
  95. package/esm/utils/dom.js +1 -1
  96. package/esm/utils/errors.js +1 -1
  97. package/esm/utils/escapeHtml.js +1 -1
  98. package/esm/utils/filter-schema.js +1 -1
  99. package/esm/utils/filter.js +1 -1
  100. package/esm/utils/formatDuration.js +1 -1
  101. package/esm/utils/formula.js +1 -1
  102. package/esm/utils/getVariable.js +1 -1
  103. package/esm/utils/grammar.js +1 -1
  104. package/esm/utils/handleAction.js +1 -1
  105. package/esm/utils/helper.d.ts +6 -1
  106. package/esm/utils/helper.js +23 -6
  107. package/esm/utils/highlight.js +1 -1
  108. package/esm/utils/icon.js +1 -1
  109. package/esm/utils/image.js +1 -1
  110. package/esm/utils/index.d.ts +2 -0
  111. package/esm/utils/isPureVariable.js +1 -1
  112. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  113. package/esm/utils/keyToPath.js +1 -1
  114. package/esm/utils/makeSorter.js +1 -1
  115. package/esm/utils/math.js +1 -1
  116. package/esm/utils/memoryParse.js +1 -1
  117. package/esm/utils/normalizeLink.js +1 -1
  118. package/esm/utils/normalizeOptions.js +1 -1
  119. package/esm/utils/object.js +1 -1
  120. package/esm/utils/offset.js +1 -1
  121. package/esm/utils/offsetParent.js +1 -1
  122. package/esm/utils/optionValueCompare.js +1 -1
  123. package/esm/utils/position.js +1 -1
  124. package/esm/utils/prettyBytes.js +1 -1
  125. package/esm/utils/renderer-event.js +19 -3
  126. package/esm/utils/replaceText.js +1 -1
  127. package/esm/utils/resize-sensor.js +1 -1
  128. package/esm/utils/resolveCondition.js +1 -1
  129. package/esm/utils/resolveVariable.js +1 -1
  130. package/esm/utils/resolveVariableAndFilter.js +1 -1
  131. package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
  132. package/esm/utils/scrollPosition.js +1 -1
  133. package/esm/utils/string2regExp.js +1 -1
  134. package/esm/utils/stripNumber.js +1 -1
  135. package/esm/utils/style-helper.js +4 -6
  136. package/esm/utils/style.js +1 -1
  137. package/esm/utils/toNumber.js +1 -1
  138. package/esm/utils/tokenize.js +1 -1
  139. package/esm/utils/tpl-builtin.js +1 -1
  140. package/esm/utils/tpl-lodash.js +1 -1
  141. package/esm/utils/tpl.js +1 -1
  142. package/esm/utils/uncontrollable.js +1 -1
  143. package/esm/utils/validations.js +1 -1
  144. package/lib/Root.js +1 -1
  145. package/lib/RootRenderer.js +1 -1
  146. package/lib/SchemaRenderer.js +1 -1
  147. package/lib/Scoped.js +2 -1
  148. package/lib/StatusScoped.js +1 -1
  149. package/lib/WithRootStore.js +1 -1
  150. package/lib/WithStore.js +1 -1
  151. package/lib/actions/Action.js +31 -27
  152. package/lib/actions/AjaxAction.js +1 -1
  153. package/lib/actions/BreakAction.js +1 -1
  154. package/lib/actions/BroadcastAction.js +1 -1
  155. package/lib/actions/CmptAction.js +65 -26
  156. package/lib/actions/ContinueAction.js +1 -1
  157. package/lib/actions/CopyAction.js +1 -1
  158. package/lib/actions/CustomAction.js +3 -2
  159. package/lib/actions/DialogAction.js +1 -1
  160. package/lib/actions/DrawerAction.js +1 -1
  161. package/lib/actions/EmailAction.js +1 -1
  162. package/lib/actions/LinkAction.js +1 -1
  163. package/lib/actions/LoopAction.js +1 -1
  164. package/lib/actions/PageAction.js +1 -1
  165. package/lib/actions/ParallelAction.js +1 -1
  166. package/lib/actions/StatusAction.js +1 -1
  167. package/lib/actions/SwitchAction.js +1 -1
  168. package/lib/actions/ToastAction.js +1 -1
  169. package/lib/components/CustomStyle.js +1 -1
  170. package/lib/components/ErrorBoundary.js +1 -1
  171. package/lib/components/LazyComponent.js +1 -1
  172. package/lib/components/Overlay.d.ts +2 -1
  173. package/lib/components/Overlay.js +21 -5
  174. package/lib/components/PopOver.js +6 -3
  175. package/lib/env.js +1 -1
  176. package/lib/envOverwrite.js +1 -1
  177. package/lib/factory.js +1 -1
  178. package/lib/index.js +6 -2
  179. package/lib/locale.js +1 -1
  180. package/lib/polyfills.js +1 -1
  181. package/lib/renderers/Form.js +125 -111
  182. package/lib/renderers/Item.js +4 -3
  183. package/lib/renderers/Options.js +163 -49
  184. package/lib/renderers/Placeholder.js +1 -1
  185. package/lib/renderers/builtin.js +1 -1
  186. package/lib/renderers/register.js +1 -1
  187. package/lib/renderers/wrapControl.js +4 -3
  188. package/lib/store/app.d.ts +2 -2
  189. package/lib/store/app.js +3 -2
  190. package/lib/store/combo.d.ts +7 -7
  191. package/lib/store/combo.js +1 -1
  192. package/lib/store/crud.d.ts +3 -2
  193. package/lib/store/crud.js +18 -4
  194. package/lib/store/form.d.ts +3 -3
  195. package/lib/store/form.js +5 -5
  196. package/lib/store/formItem.js +1 -1
  197. package/lib/store/iRenderer.d.ts +1 -1
  198. package/lib/store/iRenderer.js +7 -2
  199. package/lib/store/index.js +1 -1
  200. package/lib/store/list.d.ts +1 -1
  201. package/lib/store/list.js +18 -14
  202. package/lib/store/manager.js +1 -1
  203. package/lib/store/modal.d.ts +2 -2
  204. package/lib/store/modal.js +1 -1
  205. package/lib/store/node.js +1 -1
  206. package/lib/store/pagination.d.ts +2 -1
  207. package/lib/store/pagination.js +3 -2
  208. package/lib/store/root.d.ts +2 -2
  209. package/lib/store/root.js +3 -2
  210. package/lib/store/service.d.ts +2 -2
  211. package/lib/store/service.js +11 -7
  212. package/lib/store/status.js +1 -1
  213. package/lib/store/table.d.ts +7 -7
  214. package/lib/store/table.js +26 -12
  215. package/lib/store/table2.d.ts +14 -3
  216. package/lib/store/table2.js +22 -9
  217. package/lib/theme.js +1 -1
  218. package/lib/types.d.ts +7 -0
  219. package/lib/utils/Animation.js +1 -1
  220. package/lib/utils/ColorScale.js +1 -1
  221. package/lib/utils/DataSchema.js +1 -1
  222. package/lib/utils/DataScope.js +1 -1
  223. package/lib/utils/RootClose.js +1 -1
  224. package/lib/utils/SimpleMap.js +1 -1
  225. package/lib/utils/api.js +1 -1
  226. package/lib/utils/arraySlice.js +1 -1
  227. package/lib/utils/attachmentAdpator.js +1 -1
  228. package/lib/utils/autobind.js +1 -1
  229. package/lib/utils/browser.d.ts +1 -0
  230. package/lib/utils/browser.js +15 -0
  231. package/lib/utils/columnsSplit.js +1 -1
  232. package/lib/utils/concatData.d.ts +8 -0
  233. package/lib/utils/concatData.js +43 -0
  234. package/lib/utils/dataMapping.js +1 -1
  235. package/lib/utils/date.js +1 -1
  236. package/lib/utils/debug.js +1 -1
  237. package/lib/utils/decodeEntity.js +1 -1
  238. package/lib/utils/dom.js +1 -1
  239. package/lib/utils/errors.js +1 -1
  240. package/lib/utils/escapeHtml.js +1 -1
  241. package/lib/utils/filter-schema.js +1 -1
  242. package/lib/utils/filter.js +1 -1
  243. package/lib/utils/formatDuration.js +1 -1
  244. package/lib/utils/formula.js +1 -1
  245. package/lib/utils/getVariable.js +1 -1
  246. package/lib/utils/grammar.js +1 -1
  247. package/lib/utils/handleAction.js +1 -1
  248. package/lib/utils/helper.d.ts +6 -1
  249. package/lib/utils/helper.js +23 -6
  250. package/lib/utils/highlight.js +1 -1
  251. package/lib/utils/icon.js +1 -1
  252. package/lib/utils/image.js +1 -1
  253. package/lib/utils/index.d.ts +2 -0
  254. package/lib/utils/isPureVariable.js +1 -1
  255. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  256. package/lib/utils/keyToPath.js +1 -1
  257. package/lib/utils/makeSorter.js +1 -1
  258. package/lib/utils/math.js +1 -1
  259. package/lib/utils/memoryParse.js +1 -1
  260. package/lib/utils/normalizeLink.js +1 -1
  261. package/lib/utils/normalizeOptions.js +1 -1
  262. package/lib/utils/object.js +1 -1
  263. package/lib/utils/offset.js +1 -1
  264. package/lib/utils/offsetParent.js +1 -1
  265. package/lib/utils/optionValueCompare.js +1 -1
  266. package/lib/utils/position.js +1 -1
  267. package/lib/utils/prettyBytes.js +1 -1
  268. package/lib/utils/renderer-event.js +19 -3
  269. package/lib/utils/replaceText.js +1 -1
  270. package/lib/utils/resize-sensor.js +1 -1
  271. package/lib/utils/resolveCondition.js +1 -1
  272. package/lib/utils/resolveVariable.js +1 -1
  273. package/lib/utils/resolveVariableAndFilter.js +1 -1
  274. package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
  275. package/lib/utils/scrollPosition.js +1 -1
  276. package/lib/utils/string2regExp.js +1 -1
  277. package/lib/utils/stripNumber.js +1 -1
  278. package/lib/utils/style-helper.js +4 -6
  279. package/lib/utils/style.js +1 -1
  280. package/lib/utils/toNumber.js +1 -1
  281. package/lib/utils/tokenize.js +1 -1
  282. package/lib/utils/tpl-builtin.js +1 -1
  283. package/lib/utils/tpl-lodash.js +1 -1
  284. package/lib/utils/tpl.js +1 -1
  285. package/lib/utils/uncontrollable.js +1 -1
  286. package/lib/utils/validations.js +1 -1
  287. package/package.json +4 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.2
2
+ * amis-core v6.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -8,10 +8,11 @@ import React from 'react';
8
8
  import { findDOMNode } from 'react-dom';
9
9
  import { themeable } from '../theme.js';
10
10
  import '../utils/api.js';
11
+ import '../utils/browser.js';
11
12
  import '../utils/ColorScale.js';
12
13
  import 'lodash/chunk';
13
- import 'amis-formula';
14
14
  import 'lodash/isPlainObject';
15
+ import 'amis-formula';
15
16
  import '../utils/DataSchema.js';
16
17
  import '../utils/DataScope.js';
17
18
  import 'moment';
@@ -42,6 +43,7 @@ import '../utils/validations.js';
42
43
  import '../utils/resolveCondition.js';
43
44
  import 'mobx';
44
45
  import '../utils/Animation.js';
46
+ import { SubPopoverDisplayedID } from './Overlay.js';
45
47
 
46
48
  /**
47
49
  * @file PopOver
@@ -101,6 +103,7 @@ var PopOver = /** @class */ (function (_super) {
101
103
  closeOnOutside &&
102
104
  target &&
103
105
  this.wrapperRef.current &&
106
+ !this.wrapperRef.current.getAttribute(SubPopoverDisplayedID) &&
104
107
  ((!this.wrapperRef.current.contains(target) &&
105
108
  !target.closest('[role=dialog]')) ||
106
109
  (target.matches(".".concat(ns, "Modal")) && target === this.wrapperRef.current))); // 干脆过滤掉来自弹框里面的点击
@@ -150,7 +153,7 @@ var PopOver = /** @class */ (function (_super) {
150
153
  var _b = this.state, xOffset = _b.xOffset, yOffset = _b.yOffset;
151
154
  var outerStyle = __assign(__assign({ display: 'block' }, style), { top: positionTop + yOffset, left: positionLeft + xOffset });
152
155
  var placements = typeof activePlacement === 'string' ? activePlacement.split('-') : [];
153
- 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),
156
+ return (React.createElement("div", __assign({ ref: this.wrapperRef, role: "popover", className: cx("PopOver", className, "PopOver--".concat(camel(activePlacement)), placements[3] ? "PopOver--v-".concat(placements[3]) : ''), style: outerStyle }, rest),
154
157
  overlay ? (React.createElement("div", { className: "".concat(ns, "PopOver-overlay"), onClick: onHide })) : null,
155
158
  children));
156
159
  };
package/esm/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.2
2
+ * amis-core v6.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.2
2
+ * amis-core v6.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/factory.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.2
2
+ * amis-core v6.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.2
2
+ * amis-core v6.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -13,8 +13,10 @@ import { wrapFetcher } from './utils/api.js';
13
13
  export { buildApi, callStrFunction, clearApiCache, getApiCache, isApiOutdated, isApiOutdatedWithData, isEffectiveApi, isSameApi, isValidApi, jsFetcher, jsonpFetcher, normalizeApi, normalizeApiResponseData, responseAdaptor, setApiCache, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher } from './utils/api.js';
14
14
  export { attachmentAdpator } from './utils/attachmentAdpator.js';
15
15
  export { autobindMethod, bind } from './utils/autobind.js';
16
+ export { chromeVersion } from './utils/browser.js';
16
17
  export { ColorScale } from './utils/ColorScale.js';
17
18
  export { columnsSplit } from './utils/columnsSplit.js';
19
+ export { concatData } from './utils/concatData.js';
18
20
  export { dataMapping, resolveMapping, resolveMappingObject } from './utils/dataMapping.js';
19
21
  export { DataSchema } from './utils/DataSchema.js';
20
22
  export { DATASCHEMA_TYPE_MAP, DataScope } from './utils/DataScope.js';
@@ -141,7 +143,7 @@ export { StoreNode } from './store/node.js';
141
143
  */
142
144
  var classPrefix = getClassPrefix();
143
145
  // @ts-ignore
144
- var version = '3.6.2';
146
+ var version = '6.0.0';
145
147
  function render(schema, props, options, pathPrefix) {
146
148
  if (props === void 0) { props = {}; }
147
149
  if (options === void 0) { options = {}; }
package/esm/locale.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.2
2
+ * amis-core v6.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/polyfills.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.2
2
+ * amis-core v6.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.2
2
+ * amis-core v6.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -22,6 +22,7 @@ import '../utils/filter.js';
22
22
  import { isEffectiveApi, isApiOutdated } from '../utils/api.js';
23
23
  import LazyComponent from '../components/LazyComponent.js';
24
24
  import { isAlive } from 'mobx-state-tree';
25
+ import '../utils/browser.js';
25
26
  import '../utils/ColorScale.js';
26
27
  import 'lodash/chunk';
27
28
  import '../utils/DataSchema.js';
@@ -610,119 +611,132 @@ var Form = /** @class */ (function (_super) {
610
611
  else if (action.actionType === 'clear-and-submit') {
611
612
  store.clear(this.handleReset(action));
612
613
  }
613
- return [2 /*return*/, this.submit(function (values) {
614
+ return [2 /*return*/, this.submit(function (values) { return __awaiter(_this, void 0, void 0, function () {
615
+ var result, finnalAsyncApi_1;
614
616
  var _a;
615
- if (onSubmit && onSubmit(values, action) === false) {
616
- return Promise.resolve(false);
617
- }
618
- // 走到这里代表校验成功了
619
- dispatchEvent_1('validateSucc', _this.props.data);
620
- if (target) {
621
- _this.submitToTarget(filterTarget(target, values), values);
622
- /** 可能配置页面跳转事件,页面路由变化导致persistKey不一致,无法清除持久化数据,所以提交成功事件之前先清理一下 */
623
- clearPersistDataAfterSubmit && store.clearLocalPersistData();
624
- dispatchEvent_1('submitSucc', createObject(_this.props.data, values));
625
- }
626
- else if (action.actionType === 'reload') {
627
- action.target &&
628
- _this.reloadTarget(filterTarget(action.target, values), values);
629
- }
630
- else if (action.actionType === 'dialog') {
631
- store.openDialog(data, undefined, action.callback, delegate || _this.context);
632
- }
633
- else if (action.actionType === 'drawer') {
634
- store.openDrawer(data);
635
- }
636
- else if (isEffectiveApi(action.api || api, values)) {
637
- var finnalAsyncApi_1 = action.asyncApi || asyncApi;
638
- isEffectiveApi(finnalAsyncApi_1, store.data) &&
639
- store.updateData((_a = {},
640
- _a[finishedField || 'finished'] = false,
641
- _a));
642
- return store
643
- .saveRemote(action.api || api, values, {
644
- successMessage: typeof saveSuccess === 'string'
645
- ? filter(saveSuccess, store.data)
646
- : undefined,
647
- errorMessage: typeof saveFailed === 'string'
648
- ? filter(saveFailed, store.data)
649
- : undefined,
650
- onSuccess: function (result) { return __awaiter(_this, void 0, void 0, function () {
651
- var dispatcher, cbResult;
652
- var _this = this;
653
- return __generator(this, function (_a) {
654
- switch (_a.label) {
655
- case 0:
656
- clearPersistDataAfterSubmit && store.clearLocalPersistData();
657
- return [4 /*yield*/, dispatchEvent_1('submitSucc', createObject(this.props.data, { result: result }))];
658
- case 1:
659
- dispatcher = _a.sent();
660
- if (!isEffectiveApi(finnalAsyncApi_1, store.data) ||
661
- store.data[finishedField || 'finished']) {
662
- return [2 /*return*/, {
663
- cbResult: null,
664
- dispatcher: dispatcher
665
- }];
666
- }
667
- cbResult = until(function () { return store.checkRemote(finnalAsyncApi_1, store.data); }, function (ret) { return ret && ret[finishedField || 'finished']; }, function (cancel) { return (_this.asyncCancel = cancel); }, checkInterval).then(function (value) {
668
- // 派发asyncApiFinished事件
669
- dispatchEvent_1('asyncApiFinished', store.data);
617
+ var _this = this;
618
+ return __generator(this, function (_b) {
619
+ switch (_b.label) {
620
+ case 0:
621
+ if (!onSubmit) return [3 /*break*/, 2];
622
+ return [4 /*yield*/, onSubmit(values, action)];
623
+ case 1:
624
+ result = _b.sent();
625
+ if (result === false) {
626
+ return [2 /*return*/, Promise.resolve(false)];
627
+ }
628
+ _b.label = 2;
629
+ case 2:
630
+ // 走到这里代表校验成功了
631
+ dispatchEvent_1('validateSucc', this.props.data);
632
+ if (target) {
633
+ this.submitToTarget(filterTarget(target, values), values);
634
+ /** 可能配置页面跳转事件,页面路由变化导致persistKey不一致,无法清除持久化数据,所以提交成功事件之前先清理一下 */
635
+ clearPersistDataAfterSubmit && store.clearLocalPersistData();
636
+ dispatchEvent_1('submitSucc', createObject(this.props.data, values));
637
+ }
638
+ else if (action.actionType === 'reload') {
639
+ action.target &&
640
+ this.reloadTarget(filterTarget(action.target, values), values);
641
+ }
642
+ else if (action.actionType === 'dialog') {
643
+ store.openDialog(data, undefined, action.callback, delegate || this.context);
644
+ }
645
+ else if (action.actionType === 'drawer') {
646
+ store.openDrawer(data);
647
+ }
648
+ else if (isEffectiveApi(action.api || api, values)) {
649
+ finnalAsyncApi_1 = action.asyncApi || asyncApi;
650
+ isEffectiveApi(finnalAsyncApi_1, store.data) &&
651
+ store.updateData((_a = {},
652
+ _a[finishedField || 'finished'] = false,
653
+ _a));
654
+ return [2 /*return*/, store
655
+ .saveRemote(action.api || api, values, {
656
+ successMessage: typeof saveSuccess === 'string'
657
+ ? filter(saveSuccess, store.data)
658
+ : undefined,
659
+ errorMessage: typeof saveFailed === 'string'
660
+ ? filter(saveFailed, store.data)
661
+ : undefined,
662
+ onSuccess: function (result) { return __awaiter(_this, void 0, void 0, function () {
663
+ var dispatcher, cbResult;
664
+ var _this = this;
665
+ return __generator(this, function (_a) {
666
+ switch (_a.label) {
667
+ case 0:
668
+ clearPersistDataAfterSubmit && store.clearLocalPersistData();
669
+ return [4 /*yield*/, dispatchEvent_1('submitSucc', createObject(this.props.data, { result: result }))];
670
+ case 1:
671
+ dispatcher = _a.sent();
672
+ if (!isEffectiveApi(finnalAsyncApi_1, store.data) ||
673
+ store.data[finishedField || 'finished']) {
674
+ return [2 /*return*/, {
675
+ cbResult: null,
676
+ dispatcher: dispatcher
677
+ }];
678
+ }
679
+ cbResult = until(function () { return store.checkRemote(finnalAsyncApi_1, store.data); }, function (ret) { return ret && ret[finishedField || 'finished']; }, function (cancel) { return (_this.asyncCancel = cancel); }, checkInterval).then(function (value) {
680
+ // 派发asyncApiFinished事件
681
+ dispatchEvent_1('asyncApiFinished', store.data);
682
+ });
683
+ return [2 /*return*/, {
684
+ cbResult: cbResult,
685
+ dispatcher: dispatcher
686
+ }];
687
+ }
688
+ });
689
+ }); },
690
+ onFailed: function (result) { return __awaiter(_this, void 0, void 0, function () {
691
+ var dispatcher;
692
+ return __generator(this, function (_a) {
693
+ switch (_a.label) {
694
+ case 0: return [4 /*yield*/, dispatchEvent_1('submitFail', createObject(this.props.data, { error: result }))];
695
+ case 1:
696
+ dispatcher = _a.sent();
697
+ return [2 /*return*/, {
698
+ dispatcher: dispatcher
699
+ }];
700
+ }
701
+ });
702
+ }); }
703
+ })
704
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
705
+ var feedback, confirmed;
706
+ return __generator(this, function (_a) {
707
+ switch (_a.label) {
708
+ case 0:
709
+ onSaved && onSaved(values, response);
710
+ feedback = action.feedback || this.props.feedback;
711
+ if (!(feedback && isVisible(feedback, store.data))) return [3 /*break*/, 2];
712
+ return [4 /*yield*/, this.openFeedback(feedback, store.data)];
713
+ case 1:
714
+ confirmed = _a.sent();
715
+ // 如果 feedback 配置了,取消就跳过原有逻辑。
716
+ if (feedback.skipRestOnCancel && !confirmed) {
717
+ throw new SkipOperation();
718
+ }
719
+ else if (feedback.skipRestOnConfirm && confirmed) {
720
+ throw new SkipOperation();
721
+ }
722
+ _a.label = 2;
723
+ case 2: return [2 /*return*/, injectObjectChain(store.data, {
724
+ __payload: values,
725
+ __response: response
726
+ })];
727
+ }
670
728
  });
671
- return [2 /*return*/, {
672
- cbResult: cbResult,
673
- dispatcher: dispatcher
674
- }];
675
- }
676
- });
677
- }); },
678
- onFailed: function (result) { return __awaiter(_this, void 0, void 0, function () {
679
- var dispatcher;
680
- return __generator(this, function (_a) {
681
- switch (_a.label) {
682
- case 0: return [4 /*yield*/, dispatchEvent_1('submitFail', createObject(this.props.data, { error: result }))];
683
- case 1:
684
- dispatcher = _a.sent();
685
- return [2 /*return*/, {
686
- dispatcher: dispatcher
687
- }];
688
- }
689
- });
690
- }); }
691
- })
692
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
693
- var feedback, confirmed;
694
- return __generator(this, function (_a) {
695
- switch (_a.label) {
696
- case 0:
697
- onSaved && onSaved(values, response);
698
- feedback = action.feedback || this.props.feedback;
699
- if (!(feedback && isVisible(feedback, store.data))) return [3 /*break*/, 2];
700
- return [4 /*yield*/, this.openFeedback(feedback, store.data)];
701
- case 1:
702
- confirmed = _a.sent();
703
- // 如果 feedback 配置了,取消就跳过原有逻辑。
704
- if (feedback.skipRestOnCancel && !confirmed) {
705
- throw new SkipOperation();
706
- }
707
- else if (feedback.skipRestOnConfirm && confirmed) {
708
- throw new SkipOperation();
709
- }
710
- _a.label = 2;
711
- case 2: return [2 /*return*/, injectObjectChain(store.data, {
712
- __payload: values,
713
- __response: response
714
- })];
729
+ }); })];
715
730
  }
716
- });
717
- }); });
718
- }
719
- else {
720
- clearPersistDataAfterSubmit && store.clearLocalPersistData();
721
- // type为submit,但是没有配api以及target时,只派发事件
722
- dispatchEvent_1('submitSucc', createObject(_this.props.data, values));
723
- }
724
- return Promise.resolve(null);
725
- }, throwErrors)
731
+ else {
732
+ clearPersistDataAfterSubmit && store.clearLocalPersistData();
733
+ // type为submit,但是没有配api以及target时,只派发事件
734
+ dispatchEvent_1('submitSucc', createObject(this.props.data, values));
735
+ }
736
+ return [2 /*return*/, Promise.resolve(null)];
737
+ }
738
+ });
739
+ }); }, throwErrors)
726
740
  .then(function (values) {
727
741
  // 有可能 onSubmit return false 了,那么后面的就不应该再执行了。
728
742
  if (values === false) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.6.2
2
+ * amis-core v6.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -15,13 +15,15 @@ import { wrapControl } from './wrapControl.js';
15
15
  import debounce from 'lodash/debounce';
16
16
  import { isEffectiveApi, isApiOutdated } from '../utils/api.js';
17
17
  import { findDOMNode } from 'react-dom';
18
+ import '../utils/browser.js';
18
19
  import '../utils/ColorScale.js';
19
20
  import 'lodash/chunk';
21
+ import { getVariable } from '../utils/getVariable.js';
22
+ import { createObject } from '../utils/object.js';
20
23
  import { dataMapping } from '../utils/dataMapping.js';
21
24
  import '../utils/DataSchema.js';
22
25
  import '../utils/DataScope.js';
23
26
  import 'moment';
24
- import { createObject } from '../utils/object.js';
25
27
  import 'amis-formula';
26
28
  import '../utils/debug.js';
27
29
  import '../utils/errors.js';
@@ -31,7 +33,6 @@ import '../utils/filter.js';
31
33
  import 'lodash/isObject';
32
34
  import 'lodash/isString';
33
35
  import 'lodash/isBoolean';
34
- import { getVariable } from '../utils/getVariable.js';
35
36
  import '../utils/image.js';
36
37
  import 'lodash/isEqual';
37
38
  import '../actions/Action.js';