amis-core 2.8.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/esm/Root.d.ts +1 -1
  2. package/esm/Root.js +1 -1
  3. package/esm/RootRenderer.d.ts +1 -1
  4. package/esm/RootRenderer.js +21 -4
  5. package/esm/SchemaRenderer.d.ts +3 -1
  6. package/esm/SchemaRenderer.js +7 -5
  7. package/esm/Scoped.js +30 -2
  8. package/esm/WithRootStore.d.ts +4 -8
  9. package/esm/WithRootStore.js +1 -1
  10. package/esm/WithStore.js +1 -1
  11. package/esm/actions/Action.d.ts +2 -1
  12. package/esm/actions/Action.js +40 -12
  13. package/esm/actions/AjaxAction.js +1 -1
  14. package/esm/actions/BreakAction.js +1 -1
  15. package/esm/actions/BroadcastAction.js +1 -1
  16. package/esm/actions/CmptAction.js +1 -1
  17. package/esm/actions/ContinueAction.js +1 -1
  18. package/esm/actions/CopyAction.js +1 -1
  19. package/esm/actions/CustomAction.js +2 -1
  20. package/esm/actions/DialogAction.d.ts +1 -1
  21. package/esm/actions/DialogAction.js +12 -3
  22. package/esm/actions/DrawerAction.js +1 -1
  23. package/esm/actions/EmailAction.js +1 -1
  24. package/esm/actions/LinkAction.js +1 -1
  25. package/esm/actions/LoopAction.js +1 -1
  26. package/esm/actions/PageAction.js +1 -1
  27. package/esm/actions/ParallelAction.js +1 -1
  28. package/esm/actions/SwitchAction.js +18 -15
  29. package/esm/actions/ToastAction.js +1 -1
  30. package/esm/components/LazyComponent.d.ts +3 -3
  31. package/esm/components/LazyComponent.js +1 -1
  32. package/esm/components/Overlay.d.ts +2 -2
  33. package/esm/components/Overlay.js +2 -1
  34. package/esm/components/PopOver.d.ts +2 -4
  35. package/esm/components/PopOver.js +2 -1
  36. package/esm/env.d.ts +3 -7
  37. package/esm/env.js +1 -1
  38. package/esm/envOverwrite.js +1 -1
  39. package/esm/factory.d.ts +2 -1
  40. package/esm/factory.js +5 -3
  41. package/esm/index.d.ts +9 -5
  42. package/esm/index.js +12 -9
  43. package/esm/locale.d.ts +1 -3
  44. package/esm/locale.js +1 -1
  45. package/esm/renderers/Form.d.ts +1 -1
  46. package/esm/renderers/Form.js +17 -15
  47. package/esm/renderers/Item.d.ts +9 -15
  48. package/esm/renderers/Item.js +11 -7
  49. package/esm/renderers/Options.js +4 -3
  50. package/esm/renderers/Placeholder.js +1 -1
  51. package/esm/renderers/builtin.js +1 -1
  52. package/esm/renderers/register.js +1 -1
  53. package/esm/renderers/wrapControl.d.ts +4 -8
  54. package/esm/renderers/wrapControl.js +21 -30
  55. package/esm/store/app.d.ts +4 -2
  56. package/esm/store/app.js +1 -1
  57. package/esm/store/combo.d.ts +12 -6
  58. package/esm/store/combo.js +1 -1
  59. package/esm/store/crud.d.ts +5 -2
  60. package/esm/store/crud.js +46 -12
  61. package/esm/store/form.d.ts +4 -2
  62. package/esm/store/form.js +1 -1
  63. package/esm/store/formItem.js +6 -5
  64. package/esm/store/iRenderer.d.ts +5 -2
  65. package/esm/store/iRenderer.js +15 -3
  66. package/esm/store/index.js +1 -1
  67. package/esm/store/list.d.ts +4 -2
  68. package/esm/store/list.js +5 -5
  69. package/esm/store/manager.js +1 -1
  70. package/esm/store/modal.d.ts +4 -2
  71. package/esm/store/modal.js +1 -1
  72. package/esm/store/node.js +1 -1
  73. package/esm/store/pagination.d.ts +4 -2
  74. package/esm/store/pagination.js +2 -2
  75. package/esm/store/root.d.ts +4 -2
  76. package/esm/store/root.js +1 -1
  77. package/esm/store/service.d.ts +4 -2
  78. package/esm/store/service.js +1 -1
  79. package/esm/store/table.d.ts +36 -29
  80. package/esm/store/table.js +28 -5
  81. package/esm/store/table2.d.ts +9 -7
  82. package/esm/store/table2.js +23 -19
  83. package/esm/theme.d.ts +2 -4
  84. package/esm/theme.js +1 -1
  85. package/esm/types.d.ts +45 -2
  86. package/esm/utils/Animation.js +1 -1
  87. package/esm/utils/ColorScale.js +1 -1
  88. package/esm/utils/DataSchema.js +1 -1
  89. package/esm/utils/DataScope.js +1 -1
  90. package/esm/utils/RootClose.js +1 -1
  91. package/esm/utils/SimpleMap.js +1 -1
  92. package/esm/utils/api.js +11 -5
  93. package/esm/utils/attachmentAdpator.js +1 -1
  94. package/esm/utils/autobind.js +1 -1
  95. package/esm/utils/columnsSplit.js +1 -1
  96. package/esm/utils/dataMapping.js +1 -1
  97. package/esm/utils/date.js +1 -1
  98. package/esm/utils/debug.d.ts +1 -0
  99. package/esm/utils/debug.js +4 -4
  100. package/esm/utils/decodeEntity.js +1 -1
  101. package/esm/utils/dom.d.ts +2 -0
  102. package/esm/utils/dom.js +47 -10
  103. package/esm/utils/errors.js +1 -1
  104. package/esm/utils/escapeHtml.js +1 -1
  105. package/esm/utils/filter-schema.js +1 -1
  106. package/esm/utils/filter.js +1 -1
  107. package/esm/utils/formatDuration.js +1 -1
  108. package/esm/utils/formula.d.ts +1 -0
  109. package/esm/utils/formula.js +7 -3
  110. package/esm/utils/getVariable.js +1 -1
  111. package/esm/utils/grammar.js +1 -1
  112. package/esm/utils/handleAction.js +1 -1
  113. package/esm/utils/helper.d.ts +7 -0
  114. package/esm/utils/helper.js +28 -3
  115. package/esm/utils/highlight.js +1 -1
  116. package/esm/utils/icon.d.ts +6 -1
  117. package/esm/utils/icon.js +6 -1
  118. package/esm/utils/image.js +1 -1
  119. package/esm/utils/index.d.ts +2 -0
  120. package/esm/utils/isPureVariable.js +1 -1
  121. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  122. package/esm/utils/keyToPath.js +1 -1
  123. package/esm/utils/makeSorter.js +1 -1
  124. package/esm/utils/normalizeLink.js +1 -1
  125. package/esm/utils/normalizeOptions.js +1 -1
  126. package/esm/utils/object.js +1 -1
  127. package/esm/utils/offset.js +1 -1
  128. package/esm/utils/offsetParent.js +1 -1
  129. package/esm/utils/optionValueCompare.js +7 -3
  130. package/esm/utils/position.js +1 -1
  131. package/esm/utils/prettyBytes.js +1 -1
  132. package/esm/utils/renderer-event.js +35 -32
  133. package/esm/utils/replaceText.js +1 -1
  134. package/esm/utils/resize-sensor.js +1 -1
  135. package/esm/utils/resolveCondition.d.ts +6 -0
  136. package/esm/utils/resolveCondition.js +321 -0
  137. package/esm/utils/resolveVariable.js +1 -1
  138. package/esm/utils/resolveVariableAndFilter.js +1 -1
  139. package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -0
  140. package/esm/utils/resolveVariableAndFilterForAsync.js +63 -0
  141. package/esm/utils/scrollPosition.js +1 -1
  142. package/esm/utils/string2regExp.js +1 -1
  143. package/esm/utils/stripNumber.js +1 -1
  144. package/esm/utils/style-helper.d.ts +9 -4
  145. package/esm/utils/style-helper.js +81 -16
  146. package/esm/utils/style.js +2 -2
  147. package/esm/utils/toNumber.js +1 -1
  148. package/esm/utils/tokenize.d.ts +1 -0
  149. package/esm/utils/tokenize.js +34 -3
  150. package/esm/utils/tpl-builtin.d.ts +2 -1
  151. package/esm/utils/tpl-builtin.js +18 -3
  152. package/esm/utils/tpl-lodash.js +3 -2
  153. package/esm/utils/tpl.d.ts +9 -0
  154. package/esm/utils/tpl.js +45 -3
  155. package/esm/utils/uncontrollable.js +1 -1
  156. package/esm/utils/validations.d.ts +4 -1
  157. package/esm/utils/validations.js +27 -12
  158. package/lib/Root.d.ts +1 -1
  159. package/lib/Root.js +1 -1
  160. package/lib/RootRenderer.d.ts +1 -1
  161. package/lib/RootRenderer.js +21 -4
  162. package/lib/SchemaRenderer.d.ts +3 -1
  163. package/lib/SchemaRenderer.js +7 -4
  164. package/lib/Scoped.js +30 -2
  165. package/lib/WithRootStore.d.ts +4 -8
  166. package/lib/WithRootStore.js +1 -1
  167. package/lib/WithStore.js +1 -1
  168. package/lib/actions/Action.d.ts +2 -1
  169. package/lib/actions/Action.js +39 -11
  170. package/lib/actions/AjaxAction.js +1 -1
  171. package/lib/actions/BreakAction.js +1 -1
  172. package/lib/actions/BroadcastAction.js +1 -1
  173. package/lib/actions/CmptAction.js +1 -1
  174. package/lib/actions/ContinueAction.js +1 -1
  175. package/lib/actions/CopyAction.js +1 -1
  176. package/lib/actions/CustomAction.js +2 -1
  177. package/lib/actions/DialogAction.d.ts +1 -1
  178. package/lib/actions/DialogAction.js +12 -3
  179. package/lib/actions/DrawerAction.js +1 -1
  180. package/lib/actions/EmailAction.js +1 -1
  181. package/lib/actions/LinkAction.js +1 -1
  182. package/lib/actions/LoopAction.js +1 -1
  183. package/lib/actions/PageAction.js +1 -1
  184. package/lib/actions/ParallelAction.js +1 -1
  185. package/lib/actions/SwitchAction.js +17 -14
  186. package/lib/actions/ToastAction.js +1 -1
  187. package/lib/components/LazyComponent.d.ts +3 -3
  188. package/lib/components/LazyComponent.js +1 -1
  189. package/lib/components/Overlay.d.ts +2 -2
  190. package/lib/components/Overlay.js +2 -1
  191. package/lib/components/PopOver.d.ts +2 -4
  192. package/lib/components/PopOver.js +2 -1
  193. package/lib/env.d.ts +3 -7
  194. package/lib/env.js +1 -1
  195. package/lib/envOverwrite.js +1 -1
  196. package/lib/factory.d.ts +2 -1
  197. package/lib/factory.js +5 -3
  198. package/lib/index.d.ts +9 -5
  199. package/lib/index.js +30 -2
  200. package/lib/locale.d.ts +1 -3
  201. package/lib/locale.js +1 -1
  202. package/lib/renderers/Form.d.ts +1 -1
  203. package/lib/renderers/Form.js +16 -14
  204. package/lib/renderers/Item.d.ts +9 -15
  205. package/lib/renderers/Item.js +11 -7
  206. package/lib/renderers/Options.js +4 -3
  207. package/lib/renderers/Placeholder.js +1 -1
  208. package/lib/renderers/builtin.js +1 -1
  209. package/lib/renderers/register.js +1 -1
  210. package/lib/renderers/wrapControl.d.ts +4 -8
  211. package/lib/renderers/wrapControl.js +20 -28
  212. package/lib/store/app.d.ts +4 -2
  213. package/lib/store/app.js +1 -1
  214. package/lib/store/combo.d.ts +12 -6
  215. package/lib/store/combo.js +1 -1
  216. package/lib/store/crud.d.ts +5 -2
  217. package/lib/store/crud.js +45 -11
  218. package/lib/store/form.d.ts +4 -2
  219. package/lib/store/form.js +1 -1
  220. package/lib/store/formItem.js +6 -5
  221. package/lib/store/iRenderer.d.ts +5 -2
  222. package/lib/store/iRenderer.js +15 -3
  223. package/lib/store/index.js +1 -1
  224. package/lib/store/list.d.ts +4 -2
  225. package/lib/store/list.js +5 -5
  226. package/lib/store/manager.js +1 -1
  227. package/lib/store/modal.d.ts +4 -2
  228. package/lib/store/modal.js +1 -1
  229. package/lib/store/node.js +1 -1
  230. package/lib/store/pagination.d.ts +4 -2
  231. package/lib/store/pagination.js +2 -2
  232. package/lib/store/root.d.ts +4 -2
  233. package/lib/store/root.js +1 -1
  234. package/lib/store/service.d.ts +4 -2
  235. package/lib/store/service.js +1 -1
  236. package/lib/store/table.d.ts +36 -29
  237. package/lib/store/table.js +28 -5
  238. package/lib/store/table2.d.ts +9 -7
  239. package/lib/store/table2.js +23 -19
  240. package/lib/theme.d.ts +2 -4
  241. package/lib/theme.js +1 -1
  242. package/lib/types.d.ts +45 -2
  243. package/lib/utils/Animation.js +1 -1
  244. package/lib/utils/ColorScale.js +1 -1
  245. package/lib/utils/DataSchema.js +1 -1
  246. package/lib/utils/DataScope.js +1 -1
  247. package/lib/utils/RootClose.js +1 -1
  248. package/lib/utils/SimpleMap.js +1 -1
  249. package/lib/utils/api.js +10 -4
  250. package/lib/utils/attachmentAdpator.js +1 -1
  251. package/lib/utils/autobind.js +1 -1
  252. package/lib/utils/columnsSplit.js +1 -1
  253. package/lib/utils/dataMapping.js +1 -1
  254. package/lib/utils/date.js +1 -1
  255. package/lib/utils/debug.d.ts +1 -0
  256. package/lib/utils/debug.js +4 -4
  257. package/lib/utils/decodeEntity.js +1 -1
  258. package/lib/utils/dom.d.ts +2 -0
  259. package/lib/utils/dom.js +48 -9
  260. package/lib/utils/errors.js +1 -1
  261. package/lib/utils/escapeHtml.js +1 -1
  262. package/lib/utils/filter-schema.js +1 -1
  263. package/lib/utils/filter.js +1 -1
  264. package/lib/utils/formatDuration.js +1 -1
  265. package/lib/utils/formula.d.ts +1 -0
  266. package/lib/utils/formula.js +7 -2
  267. package/lib/utils/getVariable.js +1 -1
  268. package/lib/utils/grammar.js +1 -1
  269. package/lib/utils/handleAction.js +1 -1
  270. package/lib/utils/helper.d.ts +7 -0
  271. package/lib/utils/helper.js +29 -2
  272. package/lib/utils/highlight.js +1 -1
  273. package/lib/utils/icon.d.ts +6 -1
  274. package/lib/utils/icon.js +6 -1
  275. package/lib/utils/image.js +1 -1
  276. package/lib/utils/index.d.ts +2 -0
  277. package/lib/utils/isPureVariable.js +1 -1
  278. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  279. package/lib/utils/keyToPath.js +1 -1
  280. package/lib/utils/makeSorter.js +1 -1
  281. package/lib/utils/normalizeLink.js +1 -1
  282. package/lib/utils/normalizeOptions.js +1 -1
  283. package/lib/utils/object.js +1 -1
  284. package/lib/utils/offset.js +1 -1
  285. package/lib/utils/offsetParent.js +1 -1
  286. package/lib/utils/optionValueCompare.js +7 -3
  287. package/lib/utils/position.js +1 -1
  288. package/lib/utils/prettyBytes.js +1 -1
  289. package/lib/utils/renderer-event.js +35 -32
  290. package/lib/utils/replaceText.js +1 -1
  291. package/lib/utils/resize-sensor.js +1 -1
  292. package/lib/utils/resolveCondition.d.ts +6 -0
  293. package/lib/utils/resolveCondition.js +338 -0
  294. package/lib/utils/resolveVariable.js +1 -1
  295. package/lib/utils/resolveVariableAndFilter.js +1 -1
  296. package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -0
  297. package/lib/utils/resolveVariableAndFilterForAsync.js +68 -0
  298. package/lib/utils/scrollPosition.js +1 -1
  299. package/lib/utils/string2regExp.js +1 -1
  300. package/lib/utils/stripNumber.js +1 -1
  301. package/lib/utils/style-helper.d.ts +9 -4
  302. package/lib/utils/style-helper.js +86 -15
  303. package/lib/utils/style.js +2 -2
  304. package/lib/utils/toNumber.js +1 -1
  305. package/lib/utils/tokenize.d.ts +1 -0
  306. package/lib/utils/tokenize.js +33 -1
  307. package/lib/utils/tpl-builtin.d.ts +2 -1
  308. package/lib/utils/tpl-builtin.js +17 -2
  309. package/lib/utils/tpl-lodash.js +3 -2
  310. package/lib/utils/tpl.d.ts +9 -0
  311. package/lib/utils/tpl.js +45 -1
  312. package/lib/utils/uncontrollable.js +1 -1
  313. package/lib/utils/validations.d.ts +4 -1
  314. package/lib/utils/validations.js +27 -12
  315. package/package.json +5 -5
package/esm/Root.d.ts CHANGED
@@ -21,7 +21,7 @@ export interface RootProps {
21
21
  }
22
22
  export interface RootWrapperProps {
23
23
  env: RendererEnv;
24
- children: React.ReactNode;
24
+ children: React.ReactNode | Array<React.ReactNode>;
25
25
  schema: SchemaNode;
26
26
  rootStore: IRendererStore;
27
27
  theme: string;
package/esm/Root.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -23,5 +23,5 @@ export declare class RootRenderer extends React.Component<RootRendererProps> {
23
23
  handleDrawerClose(): void;
24
24
  openFeedback(dialog: any, ctx: any): Promise<unknown>;
25
25
  reloadTarget(scoped: IScopedContext, target: string, data?: any): void;
26
- render(): React.ReactNode;
26
+ render(): string | number | boolean | JSX.Element | React.ReactFragment | null | undefined;
27
27
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -111,11 +111,11 @@ var RootRenderer = /** @class */ (function (_super) {
111
111
  }
112
112
  else if (action.actionType === 'dialog') {
113
113
  store.setCurrentAction(action);
114
- store.openDialog(ctx);
114
+ store.openDialog(ctx, undefined, undefined, delegate);
115
115
  }
116
116
  else if (action.actionType === 'drawer') {
117
117
  store.setCurrentAction(action);
118
- store.openDrawer(ctx);
118
+ store.openDrawer(ctx, undefined, undefined, delegate);
119
119
  }
120
120
  else if (action.actionType === 'toast') {
121
121
  (_b = (_a = action.toast) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.forEach(function (item) {
@@ -149,7 +149,7 @@ var RootRenderer = /** @class */ (function (_super) {
149
149
  redirect = action.redirect && filter(action.redirect, store.data);
150
150
  redirect && env.jumpTo(redirect, action);
151
151
  action.reload &&
152
- this.reloadTarget(delegate || this.context, action.reload, store.data);
152
+ this.reloadTarget(delegate || this.context, filter(action.reload, ctx), store.data);
153
153
  return [2 /*return*/];
154
154
  }
155
155
  });
@@ -181,6 +181,7 @@ var RootRenderer = /** @class */ (function (_super) {
181
181
  }
182
182
  };
183
183
  RootRenderer.prototype.handleDialogConfirm = function (values, action) {
184
+ var _a;
184
185
  var args = [];
185
186
  for (var _i = 2; _i < arguments.length; _i++) {
186
187
  args[_i - 2] = arguments[_i];
@@ -195,7 +196,13 @@ var RootRenderer = /** @class */ (function (_super) {
195
196
  dialog.onConfirm.apply(dialog, __spreadArray([values, action], __read(args), false)) === false) {
196
197
  return;
197
198
  }
199
+ var dialogAction = store.action;
200
+ var reload = (_a = action.reload) !== null && _a !== void 0 ? _a : dialogAction.reload;
201
+ var scoped = store.getDialogScoped() || this.context;
198
202
  store.closeDialog(true);
203
+ if (reload) {
204
+ scoped.reload(reload, store.data);
205
+ }
199
206
  };
200
207
  RootRenderer.prototype.handleDialogClose = function (confirmed) {
201
208
  if (confirmed === void 0) { confirmed = false; }
@@ -203,6 +210,7 @@ var RootRenderer = /** @class */ (function (_super) {
203
210
  store.closeDialog(confirmed);
204
211
  };
205
212
  RootRenderer.prototype.handleDrawerConfirm = function (values, action) {
213
+ var _a;
206
214
  var args = [];
207
215
  for (var _i = 2; _i < arguments.length; _i++) {
208
216
  args[_i - 2] = arguments[_i];
@@ -217,7 +225,16 @@ var RootRenderer = /** @class */ (function (_super) {
217
225
  drawer.onConfirm.apply(drawer, __spreadArray([values, action], __read(args), false)) === false) {
218
226
  return;
219
227
  }
228
+ var drawerAction = store.action;
229
+ var reload = (_a = action.reload) !== null && _a !== void 0 ? _a : drawerAction.reload;
230
+ var scoped = store.getDrawerScoped() || this.context;
220
231
  store.closeDrawer();
232
+ // 稍等会,等动画结束。
233
+ setTimeout(function () {
234
+ if (reload) {
235
+ scoped.reload(reload, store.data);
236
+ }
237
+ }, 300);
221
238
  };
222
239
  RootRenderer.prototype.handleDrawerClose = function () {
223
240
  var store = this.store;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { RendererConfig, RendererEnv, RendererProps } from './factory';
3
+ import { IScopedContext } from './Scoped';
3
4
  import { Schema, SchemaNode } from './types';
4
5
  import { RendererEvent } from './utils/renderer-event';
5
6
  interface SchemaRendererProps extends Partial<RendererProps> {
@@ -7,9 +8,10 @@ interface SchemaRendererProps extends Partial<RendererProps> {
7
8
  $path: string;
8
9
  env: RendererEnv;
9
10
  }
11
+ export declare const RENDERER_TRANSMISSION_OMIT_PROPS: string[];
10
12
  export declare class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
11
13
  static displayName: string;
12
- static contextType: React.Context<import("./Scoped").IScopedContext>;
14
+ static contextType: React.Context<IScopedContext>;
13
15
  rendererKey: string;
14
16
  renderer: RendererConfig | null;
15
17
  ref: any;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -25,7 +25,7 @@ import { resolveVariableAndFilter } from './utils/resolveVariableAndFilter.js';
25
25
  import './utils/filter.js';
26
26
  import { buildStyle } from './utils/style.js';
27
27
 
28
- var defaultOmitList = [
28
+ var RENDERER_TRANSMISSION_OMIT_PROPS = [
29
29
  'type',
30
30
  'name',
31
31
  '$ref',
@@ -50,7 +50,9 @@ var defaultOmitList = [
50
50
  'mode',
51
51
  'body',
52
52
  'id',
53
- 'inputOnly'
53
+ 'inputOnly',
54
+ 'label',
55
+ 'renderLabel'
54
56
  ];
55
57
  var componentCache = new SimpleMap();
56
58
  var SchemaRenderer = /** @class */ (function (_super) {
@@ -168,7 +170,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
168
170
  if (subProps === void 0) { subProps = {}; }
169
171
  var _a = this.props; _a.schema; _a.$path; var env = _a.env, render = _a.render, rest = __rest(_a, ["schema", "$path", "env", "render"]);
170
172
  var $path = this.resolveRenderer(this.props).path;
171
- var omitList = defaultOmitList.concat();
173
+ var omitList = RENDERER_TRANSMISSION_OMIT_PROPS.concat();
172
174
  if (this.renderer) {
173
175
  var Component = this.renderer.component;
174
176
  Component.propsList &&
@@ -341,4 +343,4 @@ var PlaceholderComponent = /** @class */ (function (_super) {
341
343
  return PlaceholderComponent;
342
344
  }(React.Component));
343
345
 
344
- export { SchemaRenderer };
346
+ export { RENDERER_TRANSMISSION_OMIT_PROPS, SchemaRenderer };
package/esm/Scoped.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -16,6 +16,33 @@ import { isPureVariable } from './utils/isPureVariable.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';
19
+ import './utils/api.js';
20
+ import './utils/ColorScale.js';
21
+ import 'lodash/chunk';
22
+ import './utils/DataSchema.js';
23
+ import './utils/DataScope.js';
24
+ import './utils/debug.js';
25
+ import 'react-dom';
26
+ import './utils/errors.js';
27
+ import { filter } from './utils/tpl.js';
28
+ import 'classnames';
29
+ import 'lodash/isObject';
30
+ import 'lodash/isString';
31
+ import 'lodash/isBoolean';
32
+ import 'lodash';
33
+ import './utils/image.js';
34
+ import './actions/Action.js';
35
+ import 'lodash/debounce';
36
+ import 'lodash/cloneDeep';
37
+ import './utils/resize-sensor.js';
38
+ import 'react-overlays/useRootClose';
39
+ import './utils/SimpleMap.js';
40
+ import 'lodash/mapValues';
41
+ import 'lodash/camelCase';
42
+ import 'uncontrollable';
43
+ import './utils/validations.js';
44
+ import './utils/resolveCondition.js';
45
+ import './utils/Animation.js';
19
46
 
20
47
  /**
21
48
  * @file 用来创建一个域,在这个域里面会把里面的运行时实例注册进来,方便组件之间的通信。
@@ -58,7 +85,8 @@ function createScopedTools(path, parent, env) {
58
85
  }, this);
59
86
  }
60
87
  var resolved = find(components, function (component) {
61
- return component.props.name === name || component.props.id === name;
88
+ return filter(component.props.name, component.props.data) === name ||
89
+ component.props.id === name;
62
90
  });
63
91
  return resolved || (parent && parent.getComponentByName(name));
64
92
  },
@@ -335,12 +335,10 @@ export declare function withRootStore<T extends React.ComponentType<React.Compon
335
335
  }>>(ComposedComponent: T): {
336
336
  new (props: JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">> | Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>): {
337
337
  render(): JSX.Element;
338
- context: any;
338
+ context: unknown;
339
339
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
340
340
  forceUpdate(callback?: (() => void) | undefined): void;
341
- readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>> & Readonly<{
342
- children?: React.ReactNode;
343
- }>;
341
+ readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>;
344
342
  state: Readonly<{}>;
345
343
  refs: {
346
344
  [key: string]: React.ReactInstance;
@@ -360,12 +358,10 @@ export declare function withRootStore<T extends React.ComponentType<React.Compon
360
358
  };
361
359
  new (props: JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>, context: any): {
362
360
  render(): JSX.Element;
363
- context: any;
361
+ context: unknown;
364
362
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
365
363
  forceUpdate(callback?: (() => void) | undefined): void;
366
- readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>> & Readonly<{
367
- children?: React.ReactNode;
368
- }>;
364
+ readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>;
369
365
  state: Readonly<{}>;
370
366
  refs: {
371
367
  [key: string]: React.ReactInstance;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/esm/WithStore.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { RendererProps } from '../factory';
3
+ import { ConditionGroupValue } from '../types';
3
4
  import { RendererEvent } from '../utils/renderer-event';
4
5
  import { IBreakAction } from './BreakAction';
5
6
  import { IContinueAction } from './ContinueAction';
@@ -21,7 +22,7 @@ export interface ListenerAction {
21
22
  outputVar?: string;
22
23
  preventDefault?: boolean;
23
24
  stopPropagation?: boolean;
24
- expression?: string;
25
+ expression?: string | ConditionGroupValue;
25
26
  execOn?: string;
26
27
  }
27
28
  export interface ILogicAction extends ListenerAction {
@@ -1,12 +1,12 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __values, __assign } from 'tslib';
7
7
  import omit from 'lodash/omit';
8
8
  import '../utils/helper.js';
9
- import { evalExpression } from '../utils/tpl.js';
9
+ import { evalExpressionWithConditionBuilder } from '../utils/tpl.js';
10
10
  import 'amis-formula';
11
11
  import 'moment';
12
12
  import { createObject } from '../utils/object.js';
@@ -154,7 +154,7 @@ var runActions = function (actions, renderer, event) { return __awaiter(void 0,
154
154
  }); };
155
155
  // 执行动作,与原有动作处理打通
156
156
  var runAction = function (actionInstrance, actionConfig, renderer, event) { return __awaiter(void 0, void 0, void 0, function () {
157
- var additional, mergeData, expression, preventDefault, stopPropagation, args, afterMappingData, actionData, data;
157
+ var additional, mergeData, expression, isStop, preventDefault, stopPropagation, args, afterMappingData, actionData, data, stoped, actionResult;
158
158
  var _a, _b, _c;
159
159
  return __generator(this, function (_d) {
160
160
  switch (_d.label) {
@@ -173,15 +173,38 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
173
173
  ? createObject(renderer.props.data.__super, additional)
174
174
  : additional, renderer.props.data), event.data);
175
175
  expression = (_a = actionConfig.expression) !== null && _a !== void 0 ? _a : actionConfig.execOn;
176
- if (expression && !evalExpression(expression, mergeData)) {
176
+ isStop = false;
177
+ if (!expression) return [3 /*break*/, 2];
178
+ return [4 /*yield*/, evalExpressionWithConditionBuilder(expression, mergeData, true)];
179
+ case 1:
180
+ isStop = !(_d.sent());
181
+ _d.label = 2;
182
+ case 2:
183
+ if (isStop) {
177
184
  return [2 /*return*/];
178
185
  }
179
- preventDefault = actionConfig.preventDefault &&
180
- evalExpression(String(actionConfig.preventDefault), mergeData);
181
- stopPropagation = actionConfig.stopPropagation &&
182
- evalExpression(String(actionConfig.stopPropagation), mergeData);
186
+ preventDefault = false;
187
+ if (!actionConfig.preventDefault) return [3 /*break*/, 4];
188
+ return [4 /*yield*/, evalExpressionWithConditionBuilder(actionConfig.preventDefault, mergeData, false)];
189
+ case 3:
190
+ preventDefault = _d.sent();
191
+ _d.label = 4;
192
+ case 4:
193
+ stopPropagation = false;
194
+ if (!actionConfig.stopPropagation) return [3 /*break*/, 6];
195
+ return [4 /*yield*/, evalExpressionWithConditionBuilder(actionConfig.stopPropagation, mergeData, false)];
196
+ case 5:
197
+ stopPropagation = _d.sent();
198
+ _d.label = 6;
199
+ case 6:
183
200
  args = dataMapping(actionConfig.args, mergeData, function (key) {
184
- return ['adaptor', 'responseAdaptor', 'requestAdaptor', 'responseData'].includes(key);
201
+ return [
202
+ 'adaptor',
203
+ 'responseAdaptor',
204
+ 'requestAdaptor',
205
+ 'responseData',
206
+ 'condition'
207
+ ].includes(key);
185
208
  });
186
209
  afterMappingData = dataMapping(actionConfig.data, mergeData);
187
210
  actionData = args && Object.keys(args).length
@@ -194,15 +217,20 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
194
217
  : event.data;
195
218
  (_b = console.group) === null || _b === void 0 ? void 0 : _b.call(console, "run action ".concat(actionConfig.actionType));
196
219
  console.debug("[".concat(actionConfig.actionType, "] action args, data"), args, data);
220
+ stoped = false;
197
221
  return [4 /*yield*/, actionInstrance.run(__assign(__assign({}, actionConfig), { args: args, data: data }), renderer, event, mergeData)];
198
- case 1:
199
- _d.sent();
222
+ case 7:
223
+ actionResult = _d.sent();
224
+ // 二次确认弹窗如果取消,则终止后续动作
225
+ if ((actionConfig === null || actionConfig === void 0 ? void 0 : actionConfig.actionType) === 'confirmDialog' && !actionResult) {
226
+ stoped = true;
227
+ }
200
228
  console.debug("[".concat(actionConfig.actionType, "] action end event"), event);
201
229
  (_c = console.groupEnd) === null || _c === void 0 ? void 0 : _c.call(console);
202
230
  // 阻止原有动作执行
203
231
  preventDefault && event.preventDefault();
204
232
  // 阻止后续动作执行
205
- stopPropagation && event.stopPropagation();
233
+ (stopPropagation || stoped) && event.stopPropagation();
206
234
  return [2 /*return*/];
207
235
  }
208
236
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -36,6 +36,7 @@ import 'lodash/camelCase';
36
36
  import 'uncontrollable';
37
37
  import 'hoist-non-react-statics';
38
38
  import '../utils/validations.js';
39
+ import '../utils/resolveCondition.js';
39
40
  import '../utils/Animation.js';
40
41
 
41
42
  /**
@@ -56,5 +56,5 @@ export declare class AlertAction implements RendererAction {
56
56
  * confirm确认提示动作
57
57
  */
58
58
  export declare class ConfirmAction implements RendererAction {
59
- run(action: IConfirmAction, renderer: ListenerContext, event: RendererEvent<any>): Promise<void>;
59
+ run(action: IConfirmAction, renderer: ListenerContext, event: RendererEvent<any>): Promise<any>;
60
60
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -20,6 +20,10 @@ var DialogAction = /** @class */ (function () {
20
20
  var _a, _b, _c;
21
21
  return __awaiter(this, void 0, void 0, function () {
22
22
  return __generator(this, function (_d) {
23
+ // 防止editor preview模式下执行
24
+ if (action.$$id !== undefined) {
25
+ return [2 /*return*/];
26
+ }
23
27
  (_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, {
24
28
  actionType: 'dialog',
25
29
  dialog: ((_c = action.args) === null || _c === void 0 ? void 0 : _c.dialog) || action.dialog,
@@ -85,9 +89,14 @@ var ConfirmAction = /** @class */ (function () {
85
89
  ConfirmAction.prototype.run = function (action, renderer, event) {
86
90
  var _a, _b, _c, _d;
87
91
  return __awaiter(this, void 0, void 0, function () {
92
+ var confirmed;
88
93
  return __generator(this, function (_e) {
89
- (_b = (_a = event.context.env).confirm) === null || _b === void 0 ? void 0 : _b.call(_a, (_c = action.args) === null || _c === void 0 ? void 0 : _c.msg, (_d = action.args) === null || _d === void 0 ? void 0 : _d.title);
90
- return [2 /*return*/];
94
+ switch (_e.label) {
95
+ case 0: return [4 /*yield*/, ((_b = (_a = event.context.env).confirm) === null || _b === void 0 ? void 0 : _b.call(_a, (_c = action.args) === null || _c === void 0 ? void 0 : _c.msg, (_d = action.args) === null || _d === void 0 ? void 0 : _d.title))];
96
+ case 1:
97
+ confirmed = _e.sent();
98
+ return [2 /*return*/, confirmed];
99
+ }
91
100
  });
92
101
  });
93
102
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,10 +1,10 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __values } from 'tslib';
7
- import { evalExpression } from '../utils/tpl.js';
7
+ import { evalExpressionWithConditionBuilder } from '../utils/tpl.js';
8
8
  import { registerAction, runActions } from './Action.js';
9
9
 
10
10
  /**
@@ -15,41 +15,44 @@ var SwitchAction = /** @class */ (function () {
15
15
  }
16
16
  SwitchAction.prototype.run = function (action, renderer, event, mergeData) {
17
17
  return __awaiter(this, void 0, void 0, function () {
18
- var _a, _b, branch, e_1_1;
18
+ var _a, _b, branch, isPass, e_1_1;
19
19
  var e_1, _c;
20
20
  return __generator(this, function (_d) {
21
21
  switch (_d.label) {
22
22
  case 0:
23
- _d.trys.push([0, 5, 6, 7]);
23
+ _d.trys.push([0, 6, 7, 8]);
24
24
  _a = __values(action.children || []), _b = _a.next();
25
25
  _d.label = 1;
26
26
  case 1:
27
- if (!!_b.done) return [3 /*break*/, 4];
27
+ if (!!_b.done) return [3 /*break*/, 5];
28
28
  branch = _b.value;
29
29
  if (!branch.expression) {
30
- return [3 /*break*/, 3];
30
+ return [3 /*break*/, 4];
31
31
  }
32
- if (!evalExpression(branch.expression, mergeData)) return [3 /*break*/, 3];
33
- return [4 /*yield*/, runActions(branch, renderer, event)];
32
+ return [4 /*yield*/, evalExpressionWithConditionBuilder(branch.expression, mergeData)];
34
33
  case 2:
34
+ isPass = _d.sent();
35
+ if (!isPass) return [3 /*break*/, 4];
36
+ return [4 /*yield*/, runActions(branch, renderer, event)];
37
+ case 3:
35
38
  _d.sent();
36
39
  // 去掉runAllMatch,这里只做排他,多个可以直接通过expression
37
- return [3 /*break*/, 4];
38
- case 3:
40
+ return [3 /*break*/, 5];
41
+ case 4:
39
42
  _b = _a.next();
40
43
  return [3 /*break*/, 1];
41
- case 4: return [3 /*break*/, 7];
42
- case 5:
44
+ case 5: return [3 /*break*/, 8];
45
+ case 6:
43
46
  e_1_1 = _d.sent();
44
47
  e_1 = { error: e_1_1 };
45
- return [3 /*break*/, 7];
46
- case 6:
48
+ return [3 /*break*/, 8];
49
+ case 7:
47
50
  try {
48
51
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
49
52
  }
50
53
  finally { if (e_1) throw e_1.error; }
51
54
  return [7 /*endfinally*/];
52
- case 7: return [2 /*return*/];
55
+ case 8: return [2 /*return*/];
53
56
  }
54
57
  });
55
58
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import React from 'react';
7
7
  export interface LazyComponentProps {
8
- component?: React.ReactType;
9
- getComponent?: () => Promise<React.ReactType>;
8
+ component?: React.ElementType;
9
+ getComponent?: () => Promise<React.ElementType>;
10
10
  placeholder?: React.ReactNode;
11
11
  unMountOnHidden?: boolean;
12
12
  childProps?: object;
@@ -15,7 +15,7 @@ export interface LazyComponentProps {
15
15
  }
16
16
  export interface LazyComponentState {
17
17
  visible: boolean;
18
- component?: React.ReactType;
18
+ component?: React.ElementType;
19
19
  }
20
20
  export default class LazyComponent extends React.Component<LazyComponentProps, LazyComponentState> {
21
21
  static defaultProps: {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -13,9 +13,9 @@ interface OverlayProps {
13
13
  shouldUpdatePosition?: boolean;
14
14
  rootClose?: boolean;
15
15
  onHide?(props: any, ...args: any[]): any;
16
- container?: React.ReactNode | Function;
16
+ container?: HTMLElement | React.ReactNode | (() => HTMLElement | React.ReactNode | null | undefined);
17
17
  containerSelector?: string;
18
- target?: React.ReactNode | Function;
18
+ target?: React.ReactNode | HTMLElement | Function;
19
19
  watchTargetSizeChange?: boolean;
20
20
  offset?: [number, number];
21
21
  onEnter?(node: HTMLElement): any;