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/lib/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
 
@@ -20,6 +20,33 @@ var isPureVariable = require('./utils/isPureVariable.js');
20
20
  var dataMapping = require('./utils/dataMapping.js');
21
21
  require('./utils/filter.js');
22
22
  var helper = require('./utils/helper.js');
23
+ require('./utils/api.js');
24
+ require('./utils/ColorScale.js');
25
+ require('lodash/chunk');
26
+ require('./utils/DataSchema.js');
27
+ require('./utils/DataScope.js');
28
+ require('./utils/debug.js');
29
+ require('react-dom');
30
+ require('./utils/errors.js');
31
+ var tpl = require('./utils/tpl.js');
32
+ require('classnames');
33
+ require('lodash/isObject');
34
+ require('lodash/isString');
35
+ require('lodash/isBoolean');
36
+ require('lodash');
37
+ require('./utils/image.js');
38
+ require('./actions/Action.js');
39
+ require('lodash/debounce');
40
+ require('lodash/cloneDeep');
41
+ require('./utils/resize-sensor.js');
42
+ require('react-overlays/useRootClose');
43
+ require('./utils/SimpleMap.js');
44
+ require('lodash/mapValues');
45
+ require('lodash/camelCase');
46
+ require('uncontrollable');
47
+ require('./utils/validations.js');
48
+ require('./utils/resolveCondition.js');
49
+ require('./utils/Animation.js');
23
50
 
24
51
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
25
52
 
@@ -69,7 +96,8 @@ function createScopedTools(path, parent, env) {
69
96
  }, this);
70
97
  }
71
98
  var resolved = find__default["default"](components, function (component) {
72
- return component.props.name === name || component.props.id === name;
99
+ return tpl.filter(component.props.name, component.props.data) === name ||
100
+ component.props.id === name;
73
101
  });
74
102
  return resolved || (parent && parent.getComponentByName(name));
75
103
  },
@@ -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/lib/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,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
 
@@ -162,7 +162,7 @@ var runActions = function (actions, renderer, event) { return tslib.__awaiter(vo
162
162
  }); };
163
163
  // 执行动作,与原有动作处理打通
164
164
  var runAction = function (actionInstrance, actionConfig, renderer, event) { return tslib.__awaiter(void 0, void 0, void 0, function () {
165
- var additional, mergeData, expression, preventDefault, stopPropagation, args, afterMappingData, actionData, data;
165
+ var additional, mergeData, expression, isStop, preventDefault, stopPropagation, args, afterMappingData, actionData, data, stoped, actionResult;
166
166
  var _a, _b, _c;
167
167
  return tslib.__generator(this, function (_d) {
168
168
  switch (_d.label) {
@@ -181,15 +181,38 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
181
181
  ? object.createObject(renderer.props.data.__super, additional)
182
182
  : additional, renderer.props.data), event.data);
183
183
  expression = (_a = actionConfig.expression) !== null && _a !== void 0 ? _a : actionConfig.execOn;
184
- if (expression && !tpl.evalExpression(expression, mergeData)) {
184
+ isStop = false;
185
+ if (!expression) return [3 /*break*/, 2];
186
+ return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(expression, mergeData, true)];
187
+ case 1:
188
+ isStop = !(_d.sent());
189
+ _d.label = 2;
190
+ case 2:
191
+ if (isStop) {
185
192
  return [2 /*return*/];
186
193
  }
187
- preventDefault = actionConfig.preventDefault &&
188
- tpl.evalExpression(String(actionConfig.preventDefault), mergeData);
189
- stopPropagation = actionConfig.stopPropagation &&
190
- tpl.evalExpression(String(actionConfig.stopPropagation), mergeData);
194
+ preventDefault = false;
195
+ if (!actionConfig.preventDefault) return [3 /*break*/, 4];
196
+ return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(actionConfig.preventDefault, mergeData, false)];
197
+ case 3:
198
+ preventDefault = _d.sent();
199
+ _d.label = 4;
200
+ case 4:
201
+ stopPropagation = false;
202
+ if (!actionConfig.stopPropagation) return [3 /*break*/, 6];
203
+ return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(actionConfig.stopPropagation, mergeData, false)];
204
+ case 5:
205
+ stopPropagation = _d.sent();
206
+ _d.label = 6;
207
+ case 6:
191
208
  args = dataMapping.dataMapping(actionConfig.args, mergeData, function (key) {
192
- return ['adaptor', 'responseAdaptor', 'requestAdaptor', 'responseData'].includes(key);
209
+ return [
210
+ 'adaptor',
211
+ 'responseAdaptor',
212
+ 'requestAdaptor',
213
+ 'responseData',
214
+ 'condition'
215
+ ].includes(key);
193
216
  });
194
217
  afterMappingData = dataMapping.dataMapping(actionConfig.data, mergeData);
195
218
  actionData = args && Object.keys(args).length
@@ -202,15 +225,20 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
202
225
  : event.data;
203
226
  (_b = console.group) === null || _b === void 0 ? void 0 : _b.call(console, "run action ".concat(actionConfig.actionType));
204
227
  console.debug("[".concat(actionConfig.actionType, "] action args, data"), args, data);
228
+ stoped = false;
205
229
  return [4 /*yield*/, actionInstrance.run(tslib.__assign(tslib.__assign({}, actionConfig), { args: args, data: data }), renderer, event, mergeData)];
206
- case 1:
207
- _d.sent();
230
+ case 7:
231
+ actionResult = _d.sent();
232
+ // 二次确认弹窗如果取消,则终止后续动作
233
+ if ((actionConfig === null || actionConfig === void 0 ? void 0 : actionConfig.actionType) === 'confirmDialog' && !actionResult) {
234
+ stoped = true;
235
+ }
208
236
  console.debug("[".concat(actionConfig.actionType, "] action end event"), event);
209
237
  (_c = console.groupEnd) === null || _c === void 0 ? void 0 : _c.call(console);
210
238
  // 阻止原有动作执行
211
239
  preventDefault && event.preventDefault();
212
240
  // 阻止后续动作执行
213
- stopPropagation && event.stopPropagation();
241
+ (stopPropagation || stoped) && event.stopPropagation();
214
242
  return [2 /*return*/];
215
243
  }
216
244
  });
@@ -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
 
@@ -40,6 +40,7 @@ require('lodash/camelCase');
40
40
  require('uncontrollable');
41
41
  require('hoist-non-react-statics');
42
42
  require('../utils/validations.js');
43
+ require('../utils/resolveCondition.js');
43
44
  require('../utils/Animation.js');
44
45
 
45
46
  /**
@@ -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
 
@@ -24,6 +24,10 @@ var DialogAction = /** @class */ (function () {
24
24
  var _a, _b, _c;
25
25
  return tslib.__awaiter(this, void 0, void 0, function () {
26
26
  return tslib.__generator(this, function (_d) {
27
+ // 防止editor preview模式下执行
28
+ if (action.$$id !== undefined) {
29
+ return [2 /*return*/];
30
+ }
27
31
  (_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, {
28
32
  actionType: 'dialog',
29
33
  dialog: ((_c = action.args) === null || _c === void 0 ? void 0 : _c.dialog) || action.dialog,
@@ -89,9 +93,14 @@ var ConfirmAction = /** @class */ (function () {
89
93
  ConfirmAction.prototype.run = function (action, renderer, event) {
90
94
  var _a, _b, _c, _d;
91
95
  return tslib.__awaiter(this, void 0, void 0, function () {
96
+ var confirmed;
92
97
  return tslib.__generator(this, function (_e) {
93
- (_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);
94
- return [2 /*return*/];
98
+ switch (_e.label) {
99
+ 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))];
100
+ case 1:
101
+ confirmed = _e.sent();
102
+ return [2 /*return*/, confirmed];
103
+ }
95
104
  });
96
105
  });
97
106
  };
@@ -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
 
@@ -19,41 +19,44 @@ var SwitchAction = /** @class */ (function () {
19
19
  }
20
20
  SwitchAction.prototype.run = function (action, renderer, event, mergeData) {
21
21
  return tslib.__awaiter(this, void 0, void 0, function () {
22
- var _a, _b, branch, e_1_1;
22
+ var _a, _b, branch, isPass, e_1_1;
23
23
  var e_1, _c;
24
24
  return tslib.__generator(this, function (_d) {
25
25
  switch (_d.label) {
26
26
  case 0:
27
- _d.trys.push([0, 5, 6, 7]);
27
+ _d.trys.push([0, 6, 7, 8]);
28
28
  _a = tslib.__values(action.children || []), _b = _a.next();
29
29
  _d.label = 1;
30
30
  case 1:
31
- if (!!_b.done) return [3 /*break*/, 4];
31
+ if (!!_b.done) return [3 /*break*/, 5];
32
32
  branch = _b.value;
33
33
  if (!branch.expression) {
34
- return [3 /*break*/, 3];
34
+ return [3 /*break*/, 4];
35
35
  }
36
- if (!tpl.evalExpression(branch.expression, mergeData)) return [3 /*break*/, 3];
37
- return [4 /*yield*/, Action.runActions(branch, renderer, event)];
36
+ return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(branch.expression, mergeData)];
38
37
  case 2:
38
+ isPass = _d.sent();
39
+ if (!isPass) return [3 /*break*/, 4];
40
+ return [4 /*yield*/, Action.runActions(branch, renderer, event)];
41
+ case 3:
39
42
  _d.sent();
40
43
  // 去掉runAllMatch,这里只做排他,多个可以直接通过expression
41
- return [3 /*break*/, 4];
42
- case 3:
44
+ return [3 /*break*/, 5];
45
+ case 4:
43
46
  _b = _a.next();
44
47
  return [3 /*break*/, 1];
45
- case 4: return [3 /*break*/, 7];
46
- case 5:
48
+ case 5: return [3 /*break*/, 8];
49
+ case 6:
47
50
  e_1_1 = _d.sent();
48
51
  e_1 = { error: e_1_1 };
49
- return [3 /*break*/, 7];
50
- case 6:
52
+ return [3 /*break*/, 8];
53
+ case 7:
51
54
  try {
52
55
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
53
56
  }
54
57
  finally { if (e_1) throw e_1.error; }
55
58
  return [7 /*endfinally*/];
56
- case 7: return [2 /*return*/];
59
+ case 8: return [2 /*return*/];
57
60
  }
58
61
  });
59
62
  });
@@ -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;
@@ -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
 
@@ -42,6 +42,7 @@ require('lodash/camelCase');
42
42
  require('uncontrollable');
43
43
  require('hoist-non-react-statics');
44
44
  require('../utils/validations.js');
45
+ require('../utils/resolveCondition.js');
45
46
  require('../utils/Animation.js');
46
47
 
47
48
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -58,12 +58,10 @@ declare const _default: {
58
58
  childRef(ref: any): void;
59
59
  getWrappedInstance(): any;
60
60
  render(): JSX.Element;
61
- context: any;
61
+ context: unknown;
62
62
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<PopOverPorps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
63
63
  forceUpdate(callback?: (() => void) | undefined): void;
64
- readonly props: Readonly<Omit<PopOverPorps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOutterProps> & Readonly<{
65
- children?: React.ReactNode;
66
- }>;
64
+ readonly props: Readonly<Omit<PopOverPorps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOutterProps>;
67
65
  state: Readonly<{}>;
68
66
  refs: {
69
67
  [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
 
@@ -41,6 +41,7 @@ require('lodash/camelCase');
41
41
  require('uncontrollable');
42
42
  require('hoist-non-react-statics');
43
43
  require('../utils/validations.js');
44
+ require('../utils/resolveCondition.js');
44
45
  require('../utils/Animation.js');
45
46
 
46
47
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
package/lib/env.d.ts CHANGED
@@ -47,7 +47,7 @@ export interface RendererEnv {
47
47
  affixOffsetTop: number;
48
48
  affixOffsetBottom: number;
49
49
  richTextToken: string;
50
- loadRenderer: (schema: Schema, path: string, reRender: Function) => Promise<React.ReactType> | React.ReactType | JSX.Element | void;
50
+ loadRenderer: (schema: Schema, path: string, reRender: Function) => Promise<React.ElementType> | React.ElementType | JSX.Element | void;
51
51
  loadChartExtends?: () => void | Promise<void>;
52
52
  useMobileUI?: boolean;
53
53
  /**
@@ -87,15 +87,13 @@ export declare function withRendererEnv<T extends React.ComponentType<React.Comp
87
87
  env?: RendererEnv | undefined;
88
88
  }>): {
89
89
  render(): JSX.Element;
90
- context: any;
90
+ context: unknown;
91
91
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "env">> & {
92
92
  env?: RendererEnv | undefined;
93
93
  }>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
94
94
  forceUpdate(callback?: (() => void) | undefined): void;
95
95
  readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "env">> & {
96
96
  env?: RendererEnv | undefined;
97
- }> & Readonly<{
98
- children?: React.ReactNode;
99
97
  }>;
100
98
  state: Readonly<{}>;
101
99
  refs: {
@@ -132,15 +130,13 @@ export declare function withRendererEnv<T extends React.ComponentType<React.Comp
132
130
  env?: RendererEnv | undefined;
133
131
  }, context: any): {
134
132
  render(): JSX.Element;
135
- context: any;
133
+ context: unknown;
136
134
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "env">> & {
137
135
  env?: RendererEnv | undefined;
138
136
  }>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
139
137
  forceUpdate(callback?: (() => void) | undefined): void;
140
138
  readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "env">> & {
141
139
  env?: RendererEnv | undefined;
142
- }> & Readonly<{
143
- children?: React.ReactNode;
144
140
  }>;
145
141
  state: Readonly<{}>;
146
142
  refs: {
package/lib/env.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,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/lib/factory.d.ts CHANGED
@@ -4,7 +4,7 @@ import { fetcherResult, SchemaNode, Schema, PlainObject } from './types';
4
4
  import { ThemeProps } from './theme';
5
5
  import { LocaleProps } from './locale';
6
6
  import type { RendererEnv } from './env';
7
- import { OnEventProps } from './utils/renderer-event';
7
+ import { OnEventProps, RendererEvent } from './utils/renderer-event';
8
8
  export interface TestFunc {
9
9
  (path: string, schema?: Schema, resolveRenderer?: (path: string, schema?: Schema, props?: any) => null | RendererConfig): boolean;
10
10
  }
@@ -35,6 +35,7 @@ export interface RendererProps extends ThemeProps, LocaleProps, OnEventProps {
35
35
  style?: {
36
36
  [propName: string]: any;
37
37
  };
38
+ onBroadcast?: (type: string, rawEvent: RendererEvent<any>, ctx: any) => any;
38
39
  [propName: string]: any;
39
40
  }
40
41
  export type RendererComponent = React.ComponentType<RendererProps> & {
package/lib/factory.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
 
@@ -83,6 +83,8 @@ function registerRenderer(config) {
83
83
  }
84
84
  function unRegisterRenderer(config) {
85
85
  var name = (typeof config === 'string' ? config : config.name);
86
+ var idx = renderers.findIndex(function (item) { return item.name === name; });
87
+ ~idx && renderers.splice(idx, 1);
86
88
  delete renderersMap[name];
87
89
  // 清空渲染器定位缓存
88
90
  cache = {};
@@ -145,11 +147,11 @@ var defaultOptions = {
145
147
  }
146
148
  },
147
149
  isCancel: function () {
148
- console.error('Please implement isCancel. see https://baidu.gitee.io/amis/docs/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
150
+ console.error('Please implement isCancel. see https://aisuda.bce.baidu.com/amis/zh-CN/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
149
151
  return false;
150
152
  },
151
153
  updateLocation: function () {
152
- console.error('Please implement updateLocation. see https://baidu.gitee.io/amis/docs/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
154
+ console.error('Please implement updateLocation. see https://aisuda.bce.baidu.com/amis/zh-CN/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
153
155
  },
154
156
  jumpTo: function (to, action) {
155
157
  if (to === 'goBack') {