amis-core 6.0.0 → 6.2.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 (307) hide show
  1. package/esm/Root.js +2 -2
  2. package/esm/RootRenderer.js +4 -3
  3. package/esm/SchemaRenderer.js +5 -2
  4. package/esm/Scoped.d.ts +6 -0
  5. package/esm/Scoped.js +47 -8
  6. package/esm/StatusScoped.js +2 -2
  7. package/esm/WithRootStore.js +2 -2
  8. package/esm/WithStore.js +4 -6
  9. package/esm/actions/Action.js +2 -2
  10. package/esm/actions/AjaxAction.js +2 -2
  11. package/esm/actions/BreakAction.js +2 -2
  12. package/esm/actions/BroadcastAction.js +2 -2
  13. package/esm/actions/CmptAction.js +2 -2
  14. package/esm/actions/ContinueAction.js +2 -2
  15. package/esm/actions/CopyAction.js +2 -2
  16. package/esm/actions/CustomAction.js +3 -3
  17. package/esm/actions/DialogAction.js +2 -2
  18. package/esm/actions/DrawerAction.js +2 -2
  19. package/esm/actions/EmailAction.js +2 -2
  20. package/esm/actions/LinkAction.js +10 -5
  21. package/esm/actions/LoopAction.js +2 -2
  22. package/esm/actions/PageAction.js +2 -2
  23. package/esm/actions/ParallelAction.js +2 -2
  24. package/esm/actions/PrintAction.d.ts +19 -0
  25. package/esm/actions/PrintAction.js +49 -0
  26. package/esm/actions/StatusAction.js +2 -2
  27. package/esm/actions/SwitchAction.js +2 -2
  28. package/esm/actions/ToastAction.js +2 -2
  29. package/esm/actions/index.d.ts +1 -0
  30. package/esm/components/CustomStyle.d.ts +1 -2
  31. package/esm/components/CustomStyle.js +20 -7
  32. package/esm/components/ErrorBoundary.js +2 -2
  33. package/esm/components/LazyComponent.js +2 -2
  34. package/esm/components/Overlay.js +11 -9
  35. package/esm/components/PopOver.js +7 -5
  36. package/esm/env.d.ts +4 -0
  37. package/esm/env.js +2 -2
  38. package/esm/envOverwrite.js +2 -2
  39. package/esm/factory.js +15 -2
  40. package/esm/index.d.ts +3 -2
  41. package/esm/index.js +16 -9
  42. package/esm/locale.js +2 -2
  43. package/esm/polyfills.js +2 -2
  44. package/esm/renderers/Form.d.ts +4 -3
  45. package/esm/renderers/Form.js +97 -45
  46. package/esm/renderers/Item.d.ts +1 -0
  47. package/esm/renderers/Item.js +15 -16
  48. package/esm/renderers/Options.d.ts +5 -0
  49. package/esm/renderers/Options.js +27 -10
  50. package/esm/renderers/Placeholder.js +2 -2
  51. package/esm/renderers/builtin.js +2 -2
  52. package/esm/renderers/register.js +2 -2
  53. package/esm/renderers/wrapControl.js +37 -29
  54. package/esm/store/app.js +3 -3
  55. package/esm/store/combo.d.ts +48 -24
  56. package/esm/store/combo.js +2 -2
  57. package/esm/store/crud.js +2 -2
  58. package/esm/store/form.d.ts +20 -10
  59. package/esm/store/form.js +2 -2
  60. package/esm/store/formItem.d.ts +2 -1
  61. package/esm/store/formItem.js +4 -3
  62. package/esm/store/iRenderer.js +5 -3
  63. package/esm/store/index.js +2 -2
  64. package/esm/store/list.d.ts +11 -0
  65. package/esm/store/list.js +9 -2
  66. package/esm/store/manager.js +2 -2
  67. package/esm/store/modal.js +2 -2
  68. package/esm/store/node.js +2 -2
  69. package/esm/store/pagination.js +2 -2
  70. package/esm/store/root.js +3 -3
  71. package/esm/store/service.js +6 -3
  72. package/esm/store/status.js +2 -2
  73. package/esm/store/table.d.ts +70 -47
  74. package/esm/store/table.js +40 -24
  75. package/esm/store/table2.js +2 -2
  76. package/esm/theme.js +2 -2
  77. package/esm/utils/Animation.js +2 -2
  78. package/esm/utils/ColorScale.js +2 -2
  79. package/esm/utils/DataSchema.js +2 -2
  80. package/esm/utils/DataScope.js +2 -2
  81. package/esm/utils/RootClose.js +2 -2
  82. package/esm/utils/SimpleMap.js +2 -2
  83. package/esm/utils/api.js +4 -3
  84. package/esm/utils/arraySlice.js +2 -2
  85. package/esm/utils/attachmentAdpator.js +4 -3
  86. package/esm/utils/autobind.js +2 -2
  87. package/esm/utils/browser.d.ts +1 -0
  88. package/esm/utils/browser.js +8 -3
  89. package/esm/utils/columnsSplit.js +2 -2
  90. package/esm/utils/concatData.js +2 -2
  91. package/esm/utils/dataMapping.js +2 -2
  92. package/esm/utils/date.js +2 -2
  93. package/esm/utils/debug.js +2 -2
  94. package/esm/utils/decodeEntity.js +2 -2
  95. package/esm/utils/dom.js +8 -3
  96. package/esm/utils/errors.js +2 -2
  97. package/esm/utils/escapeHtml.js +2 -2
  98. package/esm/utils/filter-schema.js +2 -2
  99. package/esm/utils/filter.js +2 -2
  100. package/esm/utils/formatDuration.js +2 -2
  101. package/esm/utils/formula.js +2 -2
  102. package/esm/utils/getVariable.js +2 -2
  103. package/esm/utils/grammar.js +2 -2
  104. package/esm/utils/handleAction.js +2 -2
  105. package/esm/utils/helper.d.ts +8 -1
  106. package/esm/utils/helper.js +28 -10
  107. package/esm/utils/highlight.js +4 -3
  108. package/esm/utils/icon.js +2 -2
  109. package/esm/utils/image.js +2 -2
  110. package/esm/utils/index.d.ts +1 -0
  111. package/esm/utils/isPureVariable.js +2 -2
  112. package/esm/utils/json-schema-2-amis-schema.js +2 -2
  113. package/esm/utils/keyToPath.js +2 -2
  114. package/esm/utils/labelToString.d.ts +1 -0
  115. package/esm/utils/labelToString.js +38 -0
  116. package/esm/utils/makeSorter.js +2 -2
  117. package/esm/utils/math.js +2 -2
  118. package/esm/utils/memoryParse.js +2 -2
  119. package/esm/utils/normalizeLink.js +2 -2
  120. package/esm/utils/normalizeOptions.js +2 -2
  121. package/esm/utils/object.js +2 -2
  122. package/esm/utils/offset.js +2 -2
  123. package/esm/utils/offsetParent.js +2 -2
  124. package/esm/utils/optionValueCompare.js +2 -2
  125. package/esm/utils/position.js +2 -2
  126. package/esm/utils/prettyBytes.js +2 -2
  127. package/esm/utils/printElement.d.ts +6 -0
  128. package/esm/utils/printElement.js +71 -0
  129. package/esm/utils/renderer-event.js +2 -2
  130. package/esm/utils/replaceText.js +10 -12
  131. package/esm/utils/resize-sensor.js +2 -2
  132. package/esm/utils/resolveCondition.js +2 -2
  133. package/esm/utils/resolveVariable.js +2 -2
  134. package/esm/utils/resolveVariableAndFilter.js +2 -2
  135. package/esm/utils/resolveVariableAndFilterForAsync.js +2 -2
  136. package/esm/utils/scrollPosition.js +2 -2
  137. package/esm/utils/string2regExp.d.ts +1 -1
  138. package/esm/utils/string2regExp.js +5 -4
  139. package/esm/utils/stripNumber.js +2 -2
  140. package/esm/utils/style-helper.d.ts +24 -5
  141. package/esm/utils/style-helper.js +47 -17
  142. package/esm/utils/style.js +2 -2
  143. package/esm/utils/toNumber.js +2 -2
  144. package/esm/utils/tokenize.d.ts +1 -0
  145. package/esm/utils/tokenize.js +11 -4
  146. package/esm/utils/tpl-builtin.js +2 -2
  147. package/esm/utils/tpl-lodash.js +2 -2
  148. package/esm/utils/tpl.js +7 -9
  149. package/esm/utils/uncontrollable.js +2 -2
  150. package/esm/utils/validateId.d.ts +16 -0
  151. package/esm/utils/validateId.js +154 -0
  152. package/esm/utils/validations.js +17 -9
  153. package/lib/Root.js +2 -2
  154. package/lib/RootRenderer.d.ts +1 -1
  155. package/lib/RootRenderer.js +4 -3
  156. package/lib/SchemaRenderer.js +5 -2
  157. package/lib/Scoped.d.ts +6 -0
  158. package/lib/Scoped.js +47 -7
  159. package/lib/StatusScoped.js +2 -2
  160. package/lib/WithRootStore.js +2 -2
  161. package/lib/WithStore.js +4 -6
  162. package/lib/actions/Action.js +2 -2
  163. package/lib/actions/AjaxAction.js +2 -2
  164. package/lib/actions/BreakAction.js +2 -2
  165. package/lib/actions/BroadcastAction.js +2 -2
  166. package/lib/actions/CmptAction.js +2 -2
  167. package/lib/actions/ContinueAction.js +2 -2
  168. package/lib/actions/CopyAction.js +2 -2
  169. package/lib/actions/CustomAction.js +3 -3
  170. package/lib/actions/DialogAction.js +2 -2
  171. package/lib/actions/DrawerAction.js +2 -2
  172. package/lib/actions/EmailAction.js +2 -2
  173. package/lib/actions/LinkAction.js +10 -5
  174. package/lib/actions/LoopAction.js +2 -2
  175. package/lib/actions/PageAction.js +2 -2
  176. package/lib/actions/ParallelAction.js +2 -2
  177. package/lib/actions/PrintAction.d.ts +19 -0
  178. package/lib/actions/PrintAction.js +53 -0
  179. package/lib/actions/StatusAction.js +2 -2
  180. package/lib/actions/SwitchAction.js +2 -2
  181. package/lib/actions/ToastAction.js +2 -2
  182. package/lib/actions/index.d.ts +1 -0
  183. package/lib/components/CustomStyle.d.ts +1 -2
  184. package/lib/components/CustomStyle.js +20 -7
  185. package/lib/components/ErrorBoundary.js +2 -2
  186. package/lib/components/LazyComponent.js +2 -2
  187. package/lib/components/Overlay.js +10 -8
  188. package/lib/components/PopOver.js +7 -5
  189. package/lib/env.d.ts +4 -0
  190. package/lib/env.js +2 -2
  191. package/lib/envOverwrite.js +2 -2
  192. package/lib/factory.js +15 -2
  193. package/lib/index.d.ts +3 -2
  194. package/lib/index.js +19 -5
  195. package/lib/locale.js +2 -2
  196. package/lib/polyfills.js +2 -2
  197. package/lib/renderers/Form.d.ts +4 -3
  198. package/lib/renderers/Form.js +96 -44
  199. package/lib/renderers/Item.d.ts +1 -0
  200. package/lib/renderers/Item.js +15 -16
  201. package/lib/renderers/Options.d.ts +5 -0
  202. package/lib/renderers/Options.js +27 -10
  203. package/lib/renderers/Placeholder.js +2 -2
  204. package/lib/renderers/builtin.js +2 -2
  205. package/lib/renderers/register.js +2 -2
  206. package/lib/renderers/wrapControl.js +36 -28
  207. package/lib/store/app.js +3 -3
  208. package/lib/store/combo.d.ts +72 -48
  209. package/lib/store/combo.js +2 -2
  210. package/lib/store/crud.js +2 -2
  211. package/lib/store/form.d.ts +30 -20
  212. package/lib/store/form.js +2 -2
  213. package/lib/store/formItem.d.ts +2 -1
  214. package/lib/store/formItem.js +4 -3
  215. package/lib/store/iRenderer.js +5 -3
  216. package/lib/store/index.js +2 -2
  217. package/lib/store/list.d.ts +11 -0
  218. package/lib/store/list.js +9 -2
  219. package/lib/store/manager.js +2 -2
  220. package/lib/store/modal.js +2 -2
  221. package/lib/store/node.js +2 -2
  222. package/lib/store/pagination.js +2 -2
  223. package/lib/store/root.js +3 -3
  224. package/lib/store/service.js +6 -3
  225. package/lib/store/status.js +2 -2
  226. package/lib/store/table.d.ts +90 -68
  227. package/lib/store/table.js +40 -24
  228. package/lib/store/table2.js +2 -2
  229. package/lib/theme.js +2 -2
  230. package/lib/utils/Animation.js +2 -2
  231. package/lib/utils/ColorScale.js +2 -2
  232. package/lib/utils/DataSchema.js +2 -2
  233. package/lib/utils/DataScope.js +2 -2
  234. package/lib/utils/RootClose.js +2 -2
  235. package/lib/utils/SimpleMap.js +2 -2
  236. package/lib/utils/api.js +4 -3
  237. package/lib/utils/arraySlice.js +2 -2
  238. package/lib/utils/attachmentAdpator.js +4 -3
  239. package/lib/utils/autobind.js +2 -2
  240. package/lib/utils/browser.d.ts +1 -0
  241. package/lib/utils/browser.js +8 -2
  242. package/lib/utils/columnsSplit.js +2 -2
  243. package/lib/utils/concatData.js +2 -2
  244. package/lib/utils/dataMapping.js +2 -2
  245. package/lib/utils/date.js +2 -2
  246. package/lib/utils/debug.js +2 -2
  247. package/lib/utils/decodeEntity.js +2 -2
  248. package/lib/utils/dom.js +8 -3
  249. package/lib/utils/errors.js +2 -2
  250. package/lib/utils/escapeHtml.js +2 -2
  251. package/lib/utils/filter-schema.js +2 -2
  252. package/lib/utils/filter.js +2 -2
  253. package/lib/utils/formatDuration.js +2 -2
  254. package/lib/utils/formula.js +2 -2
  255. package/lib/utils/getVariable.js +2 -2
  256. package/lib/utils/grammar.js +2 -2
  257. package/lib/utils/handleAction.js +2 -2
  258. package/lib/utils/helper.d.ts +8 -1
  259. package/lib/utils/helper.js +29 -8
  260. package/lib/utils/highlight.js +4 -3
  261. package/lib/utils/icon.js +2 -2
  262. package/lib/utils/image.js +2 -2
  263. package/lib/utils/index.d.ts +1 -0
  264. package/lib/utils/isPureVariable.js +2 -2
  265. package/lib/utils/json-schema-2-amis-schema.js +2 -2
  266. package/lib/utils/keyToPath.js +2 -2
  267. package/lib/utils/labelToString.d.ts +1 -0
  268. package/lib/utils/labelToString.js +46 -0
  269. package/lib/utils/makeSorter.js +2 -2
  270. package/lib/utils/math.js +2 -2
  271. package/lib/utils/memoryParse.js +2 -2
  272. package/lib/utils/normalizeLink.js +2 -2
  273. package/lib/utils/normalizeOptions.js +2 -2
  274. package/lib/utils/object.js +2 -2
  275. package/lib/utils/offset.js +2 -2
  276. package/lib/utils/offsetParent.js +2 -2
  277. package/lib/utils/optionValueCompare.js +2 -2
  278. package/lib/utils/position.js +2 -2
  279. package/lib/utils/prettyBytes.js +2 -2
  280. package/lib/utils/printElement.d.ts +6 -0
  281. package/lib/utils/printElement.js +75 -0
  282. package/lib/utils/renderer-event.js +2 -2
  283. package/lib/utils/replaceText.js +9 -15
  284. package/lib/utils/resize-sensor.js +2 -2
  285. package/lib/utils/resolveCondition.js +2 -2
  286. package/lib/utils/resolveVariable.js +2 -2
  287. package/lib/utils/resolveVariableAndFilter.js +2 -2
  288. package/lib/utils/resolveVariableAndFilterForAsync.js +2 -2
  289. package/lib/utils/scrollPosition.js +2 -2
  290. package/lib/utils/string2regExp.d.ts +1 -1
  291. package/lib/utils/string2regExp.js +5 -4
  292. package/lib/utils/stripNumber.js +2 -2
  293. package/lib/utils/style-helper.d.ts +24 -5
  294. package/lib/utils/style-helper.js +47 -17
  295. package/lib/utils/style.js +2 -2
  296. package/lib/utils/toNumber.js +2 -2
  297. package/lib/utils/tokenize.d.ts +1 -0
  298. package/lib/utils/tokenize.js +11 -3
  299. package/lib/utils/tpl-builtin.js +2 -2
  300. package/lib/utils/tpl-lodash.js +2 -2
  301. package/lib/utils/tpl.js +6 -8
  302. package/lib/utils/uncontrollable.js +2 -2
  303. package/lib/utils/validateId.d.ts +16 -0
  304. package/lib/utils/validateId.js +160 -0
  305. package/lib/utils/validations.js +17 -9
  306. package/package.json +4 -9
  307. package/LICENSE +0 -201
package/esm/Root.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends, __rest, __assign, __decorate, __metadata } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends, __assign, __awaiter, __generator, __spreadArray, __read, __rest, __decorate, __metadata } from 'tslib';
@@ -56,12 +56,13 @@ var RootRenderer = /** @class */ (function (_super) {
56
56
  }
57
57
  };
58
58
  RootRenderer.prototype.componentDidUpdate = function (prevProps) {
59
+ var _a;
59
60
  var props = this.props;
60
61
  if (props.data !== prevProps.data) {
61
62
  this.store.initData(props.data);
62
63
  }
63
64
  if (props.location !== prevProps.location) {
64
- this.store.updateLocation(props.location);
65
+ this.store.updateLocation(props.location, (_a = this.props.env) === null || _a === void 0 ? void 0 : _a.parseLocation);
65
66
  }
66
67
  if (props.context !== prevProps.context) {
67
68
  this.store.updateContext(props.context);
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends, __assign, __awaiter, __generator, __rest, __values, __decorate, __metadata } from 'tslib';
@@ -314,6 +314,9 @@ var SchemaRenderer = /** @class */ (function (_super) {
314
314
  if (isStatic !== undefined) {
315
315
  props.static = isStatic;
316
316
  }
317
+ if (rest.env.enableTestid && props.id && !props.testid) {
318
+ props.testid = props.id;
319
+ }
317
320
  // 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
318
321
  if (renderer.autoVar) {
319
322
  try {
package/esm/Scoped.d.ts CHANGED
@@ -14,6 +14,12 @@ import { ListenerAction } from './actions';
14
14
  * @returns
15
15
  */
16
16
  export declare function filterTarget(target: string, data: Record<string, any>): string;
17
+ /**
18
+ * 分割目标,如果里面有表达式,不要跟表达式里面的逗号冲突。
19
+ * @param target
20
+ * @returns
21
+ */
22
+ export declare function splitTarget(target: string): Array<string>;
17
23
  export interface ScopedComponentType extends React.Component<RendererProps> {
18
24
  focus?: () => void;
19
25
  doAction?: (action: ActionObject, data: RendererData, throwErrors?: boolean) => void;
package/esm/Scoped.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __values, __assign, __awaiter, __generator, __extends, __rest, __decorate, __metadata } from 'tslib';
@@ -11,6 +11,7 @@ import hoistNonReactStatic from 'hoist-non-react-statics';
11
11
  import { registerFunction } from 'amis-formula';
12
12
  import 'moment';
13
13
  import { createObject } from './utils/object.js';
14
+ import { memoParse } from './utils/tokenize.js';
14
15
  import { isPureVariable } from './utils/isPureVariable.js';
15
16
  import { getVariable } from './utils/getVariable.js';
16
17
  import { dataMapping } from './utils/dataMapping.js';
@@ -33,12 +34,12 @@ import 'lodash/isBoolean';
33
34
  import './utils/image.js';
34
35
  import 'lodash/isEqual';
35
36
  import { createRendererEvent } from './utils/renderer-event.js';
36
- import 'lodash/cloneDeep';
37
37
  import './utils/resize-sensor.js';
38
38
  import 'react-overlays/useRootClose';
39
39
  import './utils/SimpleMap.js';
40
40
  import 'lodash/mapValues';
41
41
  import 'lodash/camelCase';
42
+ import 'lodash/cloneDeep';
42
43
  import 'lodash/map';
43
44
  import 'lodash/isEmpty';
44
45
  import 'lodash/kebabCase';
@@ -64,6 +65,7 @@ import './actions/EmailAction.js';
64
65
  import './actions/LinkAction.js';
65
66
  import './actions/ToastAction.js';
66
67
  import './actions/PageAction.js';
68
+ import './actions/PrintAction.js';
67
69
  import { runActions } from './actions/Action.js';
68
70
 
69
71
  /**
@@ -84,6 +86,44 @@ function filterTarget(target, data) {
84
86
  }
85
87
  return filter(target, data, '| raw');
86
88
  }
89
+ /**
90
+ * 分割目标,如果里面有表达式,不要跟表达式里面的逗号冲突。
91
+ * @param target
92
+ * @returns
93
+ */
94
+ function splitTarget(target) {
95
+ try {
96
+ var ast = memoParse(target);
97
+ var pos_1 = [];
98
+ ast.body.forEach(function (item) {
99
+ // 不要处理表达式里面的东西。
100
+ if (item.type === 'raw') {
101
+ var parts = item.value.split(',');
102
+ if (parts.length > 1) {
103
+ parts.pop();
104
+ var start_1 = item.start.index;
105
+ parts.forEach(function (part) {
106
+ pos_1.push(start_1 + part.length);
107
+ start_1 += part.length + 1;
108
+ });
109
+ }
110
+ }
111
+ });
112
+ if (pos_1.length) {
113
+ var parts = [];
114
+ pos_1.reduceRight(function (arr, index) {
115
+ var _a;
116
+ arr.unshift((_a = target.slice(index + 1)) === null || _a === void 0 ? void 0 : _a.trim());
117
+ target = target.slice(0, index);
118
+ return arr;
119
+ }, parts);
120
+ parts.unshift(target);
121
+ return parts;
122
+ }
123
+ }
124
+ catch (e) { }
125
+ return [target];
126
+ }
87
127
  var rootScopedContext = createScopedTools('');
88
128
  var ScopedContext = React.createContext(rootScopedContext);
89
129
  function createScopedTools(path, parent, env, rendererType) {
@@ -228,7 +268,7 @@ function createScopedTools(path, parent, env, rendererType) {
228
268
  },
229
269
  reload: function (target, ctx) {
230
270
  var scoped = this;
231
- var targets = typeof target === 'string' ? target.split(/\s*,\s*/) : target;
271
+ var targets = typeof target === 'string' ? splitTarget(target) : target;
232
272
  targets.forEach(function (name) {
233
273
  var idx2 = name.indexOf('?');
234
274
  var query = null;
@@ -264,7 +304,7 @@ function createScopedTools(path, parent, env, rendererType) {
264
304
  },
265
305
  send: function (receive, values) {
266
306
  var scoped = this;
267
- var receives = typeof receive === 'string' ? receive.split(/\s*,\s*/) : receive;
307
+ var receives = typeof receive === 'string' ? splitTarget(receive) : receive;
268
308
  // todo 没找到做提示!
269
309
  receives.forEach(function (name) {
270
310
  var askIdx = name.indexOf('?');
@@ -300,8 +340,7 @@ function createScopedTools(path, parent, env, rendererType) {
300
340
  var scoped = this;
301
341
  if (typeof target === 'string') {
302
342
  // 过滤已经关掉的,当用户 close 配置多个弹框 name 时会出现这种情况
303
- target
304
- .split(/\s*,\s*/)
343
+ splitTarget(target)
305
344
  .map(function (name) { return scoped.getComponentByName(name); })
306
345
  .filter(function (component) { return component && component.props.show; })
307
346
  .forEach(closeDialog);
@@ -427,4 +466,4 @@ function HocScoped(ComposedComponent, rendererType) {
427
466
  return ScopedComponent;
428
467
  }
429
468
 
430
- export { HocScoped, ScopedContext, HocScoped as default, filterTarget };
469
+ export { HocScoped, ScopedContext, HocScoped as default, filterTarget, splitTarget };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends, __assign } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends, __assign } from 'tslib';
package/esm/WithStore.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends, __assign, __rest, __decorate, __metadata } from 'tslib';
@@ -96,9 +96,7 @@ function HocStoreFactory(renderer) {
96
96
  isObjectShallowModified(state, this.state) && this.setState(state);
97
97
  // 需要重新监听
98
98
  (_a = this.unReaction) === null || _a === void 0 ? void 0 : _a.call(this);
99
- this.unReaction = reaction(function () { return JSON.stringify(getExprProperties(props, store.data)); }, function () {
100
- return _this.setState(__assign({}, getExprProperties(_this.props, store.data)));
101
- });
99
+ this.unReaction = reaction(function () { return getExprProperties(_this.props, store.data); }, function (exprProps) { return _this.setState(exprProps); });
102
100
  }
103
101
  var shouldSync = (_b = renderer.shouldSyncSuperStore) === null || _b === void 0 ? void 0 : _b.call(renderer, store, props, prevProps);
104
102
  if (shouldSync === false) {
@@ -143,7 +141,7 @@ function HocStoreFactory(renderer) {
143
141
  // 目前主要的问题是,如果 combo 中表单项名字和 combo 本身的名字一样,会导致里面的值会被覆盖成数组
144
142
  ((_c = props.store) === null || _c === void 0 ? void 0 : _c.storeType) === 'ComboStore'
145
143
  ? undefined
146
- : syncDataFromSuper(props.data, props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
144
+ : syncDataFromSuper(__assign(__assign({}, store.data), props.data), props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
147
145
  }
148
146
  else {
149
147
  store.initData(createObject(props.scope, props.data), props.updatePristineAfterStoreDataReInit === false);
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __values, __assign, __spreadArray, __read } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __assign } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -27,12 +27,12 @@ import '../utils/image.js';
27
27
  import 'lodash/isEqual';
28
28
  import { registerAction, runActions } from './Action.js';
29
29
  import 'lodash/debounce';
30
- import 'lodash/cloneDeep';
31
30
  import '../utils/resize-sensor.js';
32
31
  import 'react-overlays/useRootClose';
33
32
  import '../utils/SimpleMap.js';
34
33
  import 'lodash/mapValues';
35
34
  import 'lodash/camelCase';
35
+ import 'lodash/cloneDeep';
36
36
  import 'lodash/map';
37
37
  import 'lodash/isEmpty';
38
38
  import 'lodash/kebabCase';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __assign } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __assign } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __assign } from 'tslib';
@@ -20,15 +20,20 @@ var LinkAction = /** @class */ (function () {
20
20
  LinkAction.prototype.run = function (action, renderer, event) {
21
21
  var _a, _b, _c, _d, _e, _f, _g, _h;
22
22
  return __awaiter(this, void 0, void 0, function () {
23
- var urlObj;
23
+ var apiParams, urlObj;
24
24
  return __generator(this, function (_j) {
25
25
  if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.jumpTo)) {
26
26
  throw new Error('env.jumpTo is required!');
27
27
  }
28
+ apiParams = __assign(__assign({}, ((_c = (_b = action.args) === null || _b === void 0 ? void 0 : _b.params) !== null && _c !== void 0 ? _c : {})), ((_d = action.data) !== null && _d !== void 0 ? _d : {}));
29
+ if ((action === null || action === void 0 ? void 0 : action.actionType) === 'link' && (apiParams === null || apiParams === void 0 ? void 0 : apiParams.targetType)) {
30
+ // link动作新增打开方式targetType,buildApi不需要该参数
31
+ delete apiParams.targetType;
32
+ }
28
33
  urlObj = buildApi({
29
- url: (((_b = action.args) === null || _b === void 0 ? void 0 : _b.url) || ((_c = action.args) === null || _c === void 0 ? void 0 : _c.link)),
34
+ url: (((_e = action.args) === null || _e === void 0 ? void 0 : _e.url) || ((_f = action.args) === null || _f === void 0 ? void 0 : _f.link)),
30
35
  method: 'get'
31
- }, __assign(__assign({}, ((_e = (_d = action.args) === null || _d === void 0 ? void 0 : _d.params) !== null && _e !== void 0 ? _e : {})), ((_f = action.data) !== null && _f !== void 0 ? _f : {})), {
36
+ }, apiParams, {
32
37
  autoAppend: true
33
38
  });
34
39
  (_g = event.context.env) === null || _g === void 0 ? void 0 : _g.jumpTo(urlObj.url, __assign({ actionType: action.actionType, type: 'button' }, action.args), (_h = action.data) !== null && _h !== void 0 ? _h : {});
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __values } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -0,0 +1,19 @@
1
+ import { RendererEvent } from '../utils/renderer-event';
2
+ import { RendererAction, ListenerAction, ListenerContext } from './Action';
3
+ export interface IPrintAction extends ListenerAction {
4
+ actionType: 'copy';
5
+ args: {
6
+ testid?: string;
7
+ testids?: string[];
8
+ };
9
+ }
10
+ /**
11
+ * 打印动作
12
+ *
13
+ * @export
14
+ * @class PrintAction
15
+ * @implements {Action}
16
+ */
17
+ export declare class PrintAction implements RendererAction {
18
+ run(action: IPrintAction, renderer: ListenerContext, event: RendererEvent<any>): Promise<void>;
19
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
+ */
5
+
6
+ import { __awaiter, __generator } from 'tslib';
7
+ import { printElements } from '../utils/printElement.js';
8
+ import { registerAction } from './Action.js';
9
+
10
+ /**
11
+ * 打印动作
12
+ *
13
+ * @export
14
+ * @class PrintAction
15
+ * @implements {Action}
16
+ */
17
+ var PrintAction = /** @class */ (function () {
18
+ function PrintAction() {
19
+ }
20
+ PrintAction.prototype.run = function (action, renderer, event) {
21
+ var _a, _b;
22
+ return __awaiter(this, void 0, void 0, function () {
23
+ var element, elements_1;
24
+ return __generator(this, function (_c) {
25
+ if ((_a = action.args) === null || _a === void 0 ? void 0 : _a.testid) {
26
+ element = document.querySelector("[data-testid='".concat(action.args.testid, "']"));
27
+ if (element) {
28
+ printElements([element]);
29
+ }
30
+ }
31
+ else if ((_b = action.args) === null || _b === void 0 ? void 0 : _b.testids) {
32
+ elements_1 = [];
33
+ action.args.testids.forEach(function (testid) {
34
+ var element = document.querySelector("[data-testid='".concat(testid, "']"));
35
+ if (element) {
36
+ elements_1.push(element);
37
+ }
38
+ });
39
+ printElements(elements_1);
40
+ }
41
+ return [2 /*return*/];
42
+ });
43
+ });
44
+ };
45
+ return PrintAction;
46
+ }());
47
+ registerAction('print', new PrintAction());
48
+
49
+ export { PrintAction };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator, __values } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -18,4 +18,5 @@ import './EmailAction';
18
18
  import './LinkAction';
19
19
  import './ToastAction';
20
20
  import './PageAction';
21
+ import './PrintAction';
21
22
  export * from './Action';
@@ -1,11 +1,10 @@
1
- import type { RendererEnv } from '../env';
2
1
  import { type InsertCustomStyle } from '../utils/style-helper';
3
2
  interface CustomStyleProps {
4
3
  config: {
5
4
  wrapperCustomStyle?: any;
6
5
  componentId?: string;
7
6
  } & InsertCustomStyle;
8
- env: RendererEnv;
7
+ [propName: string]: any;
9
8
  }
10
9
  export declare const styleIdCount: Map<any, any>;
11
10
  export default function (props: CustomStyleProps): null;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { useEffect } from 'react';
@@ -8,7 +8,7 @@ import { insertCustomStyle, removeCustomStyle, insertEditCustomStyle } from '../
8
8
 
9
9
  var styleIdCount = new Map();
10
10
  function CustomStyle (props) {
11
- var config = props.config, env = props.env;
11
+ var config = props.config, env = props.env, data = props.data;
12
12
  var themeCss = config.themeCss, classNames = config.classNames, id = config.id, defaultData = config.defaultData, wrapperCustomStyle = config.wrapperCustomStyle;
13
13
  if (!themeCss && !wrapperCustomStyle) {
14
14
  return null;
@@ -32,24 +32,37 @@ function CustomStyle (props) {
32
32
  useEffect(function () {
33
33
  var _a, _b;
34
34
  if (themeCss && id) {
35
- insertCustomStyle(themeCss, classNames, id, defaultData, env === null || env === void 0 ? void 0 : env.customStyleClassPrefix, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
35
+ insertCustomStyle({
36
+ themeCss: themeCss,
37
+ classNames: classNames,
38
+ id: id,
39
+ defaultData: defaultData,
40
+ customStyleClassPrefix: env === null || env === void 0 ? void 0 : env.customStyleClassPrefix,
41
+ doc: (_b = (_a = env === null || env === void 0 ? void 0 : env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument,
42
+ data: data
43
+ });
36
44
  }
37
45
  return function () {
38
46
  var _a, _b;
39
47
  if (id && !styleIdCount.get(id)) {
40
- removeCustomStyle('', id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
48
+ removeCustomStyle('', id, (_b = (_a = env === null || env === void 0 ? void 0 : env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument, data);
41
49
  }
42
50
  };
43
51
  }, [themeCss, id]);
44
52
  useEffect(function () {
45
53
  var _a, _b;
46
54
  if (wrapperCustomStyle && id) {
47
- insertEditCustomStyle(wrapperCustomStyle, id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
55
+ insertEditCustomStyle({
56
+ customStyle: wrapperCustomStyle,
57
+ id: id,
58
+ doc: (_b = (_a = env === null || env === void 0 ? void 0 : env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument,
59
+ data: data
60
+ });
48
61
  }
49
62
  return function () {
50
63
  var _a, _b;
51
64
  if (id && !styleIdCount.get(id)) {
52
- removeCustomStyle('wrapperCustomStyle', id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
65
+ removeCustomStyle('wrapperCustomStyle', id, (_b = (_a = env === null || env === void 0 ? void 0 : env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument, data);
53
66
  }
54
67
  };
55
68
  }, [wrapperCustomStyle, id]);
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends, __rest, __assign } from 'tslib';