amis-core 6.0.0 → 6.1.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 (293) 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 +45 -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/StatusAction.js +2 -2
  25. package/esm/actions/SwitchAction.js +2 -2
  26. package/esm/actions/ToastAction.js +2 -2
  27. package/esm/components/CustomStyle.d.ts +1 -2
  28. package/esm/components/CustomStyle.js +20 -7
  29. package/esm/components/ErrorBoundary.js +2 -2
  30. package/esm/components/LazyComponent.js +2 -2
  31. package/esm/components/Overlay.js +11 -9
  32. package/esm/components/PopOver.js +7 -5
  33. package/esm/env.d.ts +4 -0
  34. package/esm/env.js +2 -2
  35. package/esm/envOverwrite.js +2 -2
  36. package/esm/factory.js +15 -2
  37. package/esm/index.d.ts +2 -2
  38. package/esm/index.js +13 -8
  39. package/esm/locale.js +2 -2
  40. package/esm/polyfills.js +2 -2
  41. package/esm/renderers/Form.d.ts +4 -3
  42. package/esm/renderers/Form.js +94 -42
  43. package/esm/renderers/Item.d.ts +1 -0
  44. package/esm/renderers/Item.js +15 -16
  45. package/esm/renderers/Options.d.ts +5 -0
  46. package/esm/renderers/Options.js +27 -10
  47. package/esm/renderers/Placeholder.js +2 -2
  48. package/esm/renderers/builtin.js +2 -2
  49. package/esm/renderers/register.js +2 -2
  50. package/esm/renderers/wrapControl.js +37 -29
  51. package/esm/store/app.js +3 -3
  52. package/esm/store/combo.d.ts +48 -24
  53. package/esm/store/combo.js +2 -2
  54. package/esm/store/crud.js +2 -2
  55. package/esm/store/form.d.ts +20 -10
  56. package/esm/store/form.js +2 -2
  57. package/esm/store/formItem.d.ts +2 -1
  58. package/esm/store/formItem.js +4 -3
  59. package/esm/store/iRenderer.js +5 -3
  60. package/esm/store/index.js +2 -2
  61. package/esm/store/list.js +2 -2
  62. package/esm/store/manager.js +2 -2
  63. package/esm/store/modal.js +2 -2
  64. package/esm/store/node.js +2 -2
  65. package/esm/store/pagination.js +2 -2
  66. package/esm/store/root.js +3 -3
  67. package/esm/store/service.js +2 -2
  68. package/esm/store/status.js +2 -2
  69. package/esm/store/table.d.ts +42 -20
  70. package/esm/store/table.js +33 -19
  71. package/esm/store/table2.js +2 -2
  72. package/esm/theme.js +2 -2
  73. package/esm/utils/Animation.js +2 -2
  74. package/esm/utils/ColorScale.js +2 -2
  75. package/esm/utils/DataSchema.js +2 -2
  76. package/esm/utils/DataScope.js +2 -2
  77. package/esm/utils/RootClose.js +2 -2
  78. package/esm/utils/SimpleMap.js +2 -2
  79. package/esm/utils/api.js +2 -2
  80. package/esm/utils/arraySlice.js +2 -2
  81. package/esm/utils/attachmentAdpator.js +2 -2
  82. package/esm/utils/autobind.js +2 -2
  83. package/esm/utils/browser.js +2 -2
  84. package/esm/utils/columnsSplit.js +2 -2
  85. package/esm/utils/concatData.js +2 -2
  86. package/esm/utils/dataMapping.js +2 -2
  87. package/esm/utils/date.js +2 -2
  88. package/esm/utils/debug.js +2 -2
  89. package/esm/utils/decodeEntity.js +2 -2
  90. package/esm/utils/dom.js +2 -2
  91. package/esm/utils/errors.js +2 -2
  92. package/esm/utils/escapeHtml.js +2 -2
  93. package/esm/utils/filter-schema.js +2 -2
  94. package/esm/utils/filter.js +2 -2
  95. package/esm/utils/formatDuration.js +2 -2
  96. package/esm/utils/formula.js +2 -2
  97. package/esm/utils/getVariable.js +2 -2
  98. package/esm/utils/grammar.js +2 -2
  99. package/esm/utils/handleAction.js +2 -2
  100. package/esm/utils/helper.d.ts +8 -1
  101. package/esm/utils/helper.js +28 -10
  102. package/esm/utils/highlight.js +4 -3
  103. package/esm/utils/icon.js +2 -2
  104. package/esm/utils/image.js +2 -2
  105. package/esm/utils/index.d.ts +1 -0
  106. package/esm/utils/isPureVariable.js +2 -2
  107. package/esm/utils/json-schema-2-amis-schema.js +2 -2
  108. package/esm/utils/keyToPath.js +2 -2
  109. package/esm/utils/labelToString.d.ts +1 -0
  110. package/esm/utils/labelToString.js +38 -0
  111. package/esm/utils/makeSorter.js +2 -2
  112. package/esm/utils/math.js +2 -2
  113. package/esm/utils/memoryParse.js +2 -2
  114. package/esm/utils/normalizeLink.js +2 -2
  115. package/esm/utils/normalizeOptions.js +2 -2
  116. package/esm/utils/object.js +2 -2
  117. package/esm/utils/offset.js +2 -2
  118. package/esm/utils/offsetParent.js +2 -2
  119. package/esm/utils/optionValueCompare.js +2 -2
  120. package/esm/utils/position.js +2 -2
  121. package/esm/utils/prettyBytes.js +2 -2
  122. package/esm/utils/renderer-event.js +2 -2
  123. package/esm/utils/replaceText.js +10 -12
  124. package/esm/utils/resize-sensor.js +2 -2
  125. package/esm/utils/resolveCondition.js +2 -2
  126. package/esm/utils/resolveVariable.js +2 -2
  127. package/esm/utils/resolveVariableAndFilter.js +2 -2
  128. package/esm/utils/resolveVariableAndFilterForAsync.js +2 -2
  129. package/esm/utils/scrollPosition.js +2 -2
  130. package/esm/utils/string2regExp.d.ts +1 -1
  131. package/esm/utils/string2regExp.js +5 -4
  132. package/esm/utils/stripNumber.js +2 -2
  133. package/esm/utils/style-helper.d.ts +24 -5
  134. package/esm/utils/style-helper.js +47 -17
  135. package/esm/utils/style.js +2 -2
  136. package/esm/utils/toNumber.js +2 -2
  137. package/esm/utils/tokenize.d.ts +1 -0
  138. package/esm/utils/tokenize.js +11 -4
  139. package/esm/utils/tpl-builtin.js +2 -2
  140. package/esm/utils/tpl-lodash.js +2 -2
  141. package/esm/utils/tpl.js +7 -9
  142. package/esm/utils/uncontrollable.js +2 -2
  143. package/esm/utils/validateId.d.ts +16 -0
  144. package/esm/utils/validateId.js +154 -0
  145. package/esm/utils/validations.js +17 -9
  146. package/lib/Root.js +2 -2
  147. package/lib/RootRenderer.d.ts +1 -1
  148. package/lib/RootRenderer.js +4 -3
  149. package/lib/SchemaRenderer.js +5 -2
  150. package/lib/Scoped.d.ts +6 -0
  151. package/lib/Scoped.js +45 -7
  152. package/lib/StatusScoped.js +2 -2
  153. package/lib/WithRootStore.js +2 -2
  154. package/lib/WithStore.js +4 -6
  155. package/lib/actions/Action.js +2 -2
  156. package/lib/actions/AjaxAction.js +2 -2
  157. package/lib/actions/BreakAction.js +2 -2
  158. package/lib/actions/BroadcastAction.js +2 -2
  159. package/lib/actions/CmptAction.js +2 -2
  160. package/lib/actions/ContinueAction.js +2 -2
  161. package/lib/actions/CopyAction.js +2 -2
  162. package/lib/actions/CustomAction.js +3 -3
  163. package/lib/actions/DialogAction.js +2 -2
  164. package/lib/actions/DrawerAction.js +2 -2
  165. package/lib/actions/EmailAction.js +2 -2
  166. package/lib/actions/LinkAction.js +10 -5
  167. package/lib/actions/LoopAction.js +2 -2
  168. package/lib/actions/PageAction.js +2 -2
  169. package/lib/actions/ParallelAction.js +2 -2
  170. package/lib/actions/StatusAction.js +2 -2
  171. package/lib/actions/SwitchAction.js +2 -2
  172. package/lib/actions/ToastAction.js +2 -2
  173. package/lib/components/CustomStyle.d.ts +1 -2
  174. package/lib/components/CustomStyle.js +20 -7
  175. package/lib/components/ErrorBoundary.js +2 -2
  176. package/lib/components/LazyComponent.js +2 -2
  177. package/lib/components/Overlay.js +10 -8
  178. package/lib/components/PopOver.js +7 -5
  179. package/lib/env.d.ts +4 -0
  180. package/lib/env.js +2 -2
  181. package/lib/envOverwrite.js +2 -2
  182. package/lib/factory.js +15 -2
  183. package/lib/index.d.ts +2 -2
  184. package/lib/index.js +16 -5
  185. package/lib/locale.js +2 -2
  186. package/lib/polyfills.js +2 -2
  187. package/lib/renderers/Form.d.ts +4 -3
  188. package/lib/renderers/Form.js +94 -42
  189. package/lib/renderers/Item.d.ts +1 -0
  190. package/lib/renderers/Item.js +15 -16
  191. package/lib/renderers/Options.d.ts +5 -0
  192. package/lib/renderers/Options.js +27 -10
  193. package/lib/renderers/Placeholder.js +2 -2
  194. package/lib/renderers/builtin.js +2 -2
  195. package/lib/renderers/register.js +2 -2
  196. package/lib/renderers/wrapControl.js +36 -28
  197. package/lib/store/app.js +3 -3
  198. package/lib/store/combo.d.ts +72 -49
  199. package/lib/store/combo.js +2 -2
  200. package/lib/store/crud.js +2 -2
  201. package/lib/store/form.d.ts +30 -21
  202. package/lib/store/form.js +2 -2
  203. package/lib/store/formItem.d.ts +2 -1
  204. package/lib/store/formItem.js +4 -3
  205. package/lib/store/iRenderer.js +5 -3
  206. package/lib/store/index.js +2 -2
  207. package/lib/store/list.js +2 -2
  208. package/lib/store/manager.js +2 -2
  209. package/lib/store/modal.js +2 -2
  210. package/lib/store/node.js +2 -2
  211. package/lib/store/pagination.js +2 -2
  212. package/lib/store/root.js +3 -3
  213. package/lib/store/service.js +2 -2
  214. package/lib/store/status.js +2 -2
  215. package/lib/store/table.d.ts +62 -41
  216. package/lib/store/table.js +33 -19
  217. package/lib/store/table2.js +2 -2
  218. package/lib/theme.js +2 -2
  219. package/lib/utils/Animation.js +2 -2
  220. package/lib/utils/ColorScale.js +2 -2
  221. package/lib/utils/DataSchema.js +2 -2
  222. package/lib/utils/DataScope.js +2 -2
  223. package/lib/utils/RootClose.js +2 -2
  224. package/lib/utils/SimpleMap.js +2 -2
  225. package/lib/utils/api.js +2 -2
  226. package/lib/utils/arraySlice.js +2 -2
  227. package/lib/utils/attachmentAdpator.js +2 -2
  228. package/lib/utils/autobind.js +2 -2
  229. package/lib/utils/browser.js +2 -2
  230. package/lib/utils/columnsSplit.js +2 -2
  231. package/lib/utils/concatData.js +2 -2
  232. package/lib/utils/dataMapping.js +2 -2
  233. package/lib/utils/date.js +2 -2
  234. package/lib/utils/debug.js +2 -2
  235. package/lib/utils/decodeEntity.js +2 -2
  236. package/lib/utils/dom.js +2 -2
  237. package/lib/utils/errors.js +2 -2
  238. package/lib/utils/escapeHtml.js +2 -2
  239. package/lib/utils/filter-schema.js +2 -2
  240. package/lib/utils/filter.js +2 -2
  241. package/lib/utils/formatDuration.js +2 -2
  242. package/lib/utils/formula.js +2 -2
  243. package/lib/utils/getVariable.js +2 -2
  244. package/lib/utils/grammar.js +2 -2
  245. package/lib/utils/handleAction.js +2 -2
  246. package/lib/utils/helper.d.ts +8 -1
  247. package/lib/utils/helper.js +29 -8
  248. package/lib/utils/highlight.js +4 -3
  249. package/lib/utils/icon.js +2 -2
  250. package/lib/utils/image.js +2 -2
  251. package/lib/utils/index.d.ts +1 -0
  252. package/lib/utils/isPureVariable.js +2 -2
  253. package/lib/utils/json-schema-2-amis-schema.js +2 -2
  254. package/lib/utils/keyToPath.js +2 -2
  255. package/lib/utils/labelToString.d.ts +1 -0
  256. package/lib/utils/labelToString.js +46 -0
  257. package/lib/utils/makeSorter.js +2 -2
  258. package/lib/utils/math.js +2 -2
  259. package/lib/utils/memoryParse.js +2 -2
  260. package/lib/utils/normalizeLink.js +2 -2
  261. package/lib/utils/normalizeOptions.js +2 -2
  262. package/lib/utils/object.js +2 -2
  263. package/lib/utils/offset.js +2 -2
  264. package/lib/utils/offsetParent.js +2 -2
  265. package/lib/utils/optionValueCompare.js +2 -2
  266. package/lib/utils/position.js +2 -2
  267. package/lib/utils/prettyBytes.js +2 -2
  268. package/lib/utils/renderer-event.js +2 -2
  269. package/lib/utils/replaceText.js +9 -15
  270. package/lib/utils/resize-sensor.js +2 -2
  271. package/lib/utils/resolveCondition.js +2 -2
  272. package/lib/utils/resolveVariable.js +2 -2
  273. package/lib/utils/resolveVariableAndFilter.js +2 -2
  274. package/lib/utils/resolveVariableAndFilterForAsync.js +2 -2
  275. package/lib/utils/scrollPosition.js +2 -2
  276. package/lib/utils/string2regExp.d.ts +1 -1
  277. package/lib/utils/string2regExp.js +5 -4
  278. package/lib/utils/stripNumber.js +2 -2
  279. package/lib/utils/style-helper.d.ts +24 -5
  280. package/lib/utils/style-helper.js +47 -17
  281. package/lib/utils/style.js +2 -2
  282. package/lib/utils/toNumber.js +2 -2
  283. package/lib/utils/tokenize.d.ts +1 -0
  284. package/lib/utils/tokenize.js +11 -3
  285. package/lib/utils/tpl-builtin.js +2 -2
  286. package/lib/utils/tpl-lodash.js +2 -2
  287. package/lib/utils/tpl.js +6 -8
  288. package/lib/utils/uncontrollable.js +2 -2
  289. package/lib/utils/validateId.d.ts +16 -0
  290. package/lib/utils/validateId.js +160 -0
  291. package/lib/utils/validations.js +17 -9
  292. package/package.json +3 -3
  293. 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.1.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.1.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.1.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.1.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';
@@ -84,6 +85,43 @@ function filterTarget(target, data) {
84
85
  }
85
86
  return filter(target, data, '| raw');
86
87
  }
88
+ /**
89
+ * 分割目标,如果里面有表达式,不要跟表达式里面的逗号冲突。
90
+ * @param target
91
+ * @returns
92
+ */
93
+ function splitTarget(target) {
94
+ try {
95
+ var ast = memoParse(target);
96
+ var pos_1 = [];
97
+ ast.body.forEach(function (item) {
98
+ // 不要处理表达式里面的东西。
99
+ if (item.type === 'raw') {
100
+ var parts = item.value.split(',');
101
+ if (parts.length > 1) {
102
+ parts.pop();
103
+ var start_1 = item.start.index;
104
+ parts.forEach(function (part) {
105
+ pos_1.push(start_1 + part.length);
106
+ start_1 += part.length + 1;
107
+ });
108
+ }
109
+ }
110
+ });
111
+ if (pos_1.length) {
112
+ var parts = [];
113
+ pos_1.reduceRight(function (arr, index) {
114
+ arr.unshift(target.slice(index + 1));
115
+ target = target.slice(0, index);
116
+ return arr;
117
+ }, parts);
118
+ parts.unshift(target);
119
+ return parts;
120
+ }
121
+ }
122
+ catch (e) { }
123
+ return [target];
124
+ }
87
125
  var rootScopedContext = createScopedTools('');
88
126
  var ScopedContext = React.createContext(rootScopedContext);
89
127
  function createScopedTools(path, parent, env, rendererType) {
@@ -228,7 +266,7 @@ function createScopedTools(path, parent, env, rendererType) {
228
266
  },
229
267
  reload: function (target, ctx) {
230
268
  var scoped = this;
231
- var targets = typeof target === 'string' ? target.split(/\s*,\s*/) : target;
269
+ var targets = typeof target === 'string' ? splitTarget(target) : target;
232
270
  targets.forEach(function (name) {
233
271
  var idx2 = name.indexOf('?');
234
272
  var query = null;
@@ -264,7 +302,7 @@ function createScopedTools(path, parent, env, rendererType) {
264
302
  },
265
303
  send: function (receive, values) {
266
304
  var scoped = this;
267
- var receives = typeof receive === 'string' ? receive.split(/\s*,\s*/) : receive;
305
+ var receives = typeof receive === 'string' ? splitTarget(receive) : receive;
268
306
  // todo 没找到做提示!
269
307
  receives.forEach(function (name) {
270
308
  var askIdx = name.indexOf('?');
@@ -300,8 +338,7 @@ function createScopedTools(path, parent, env, rendererType) {
300
338
  var scoped = this;
301
339
  if (typeof target === 'string') {
302
340
  // 过滤已经关掉的,当用户 close 配置多个弹框 name 时会出现这种情况
303
- target
304
- .split(/\s*,\s*/)
341
+ splitTarget(target)
305
342
  .map(function (name) { return scoped.getComponentByName(name); })
306
343
  .filter(function (component) { return component && component.props.show; })
307
344
  .forEach(closeDialog);
@@ -427,4 +464,4 @@ function HocScoped(ComposedComponent, rendererType) {
427
464
  return ScopedComponent;
428
465
  }
429
466
 
430
- export { HocScoped, ScopedContext, HocScoped as default, filterTarget };
467
+ 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.1.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.1.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.1.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(store.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __awaiter, __generator } from 'tslib';
@@ -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.1.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.1.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.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends, __rest, __assign } from 'tslib';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.1.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  import { __extends, __rest, __assign, __decorate, __metadata } from 'tslib';
@@ -21,7 +21,7 @@ import '../utils/debug.js';
21
21
  import { getContainer, ownerDocument, calculatePosition } from '../utils/dom.js';
22
22
  import '../utils/errors.js';
23
23
  import '../utils/tpl.js';
24
- import { noop, getScrollParent, autobind } from '../utils/helper.js';
24
+ import { uuid, noop, getScrollParent, autobind } from '../utils/helper.js';
25
25
  import '../utils/filter.js';
26
26
  import 'lodash/isObject';
27
27
  import 'lodash/isString';
@@ -30,12 +30,12 @@ import '../utils/image.js';
30
30
  import 'lodash/isEqual';
31
31
  import '../actions/Action.js';
32
32
  import 'lodash/debounce';
33
- import 'lodash/cloneDeep';
34
33
  import { getComputedStyle, resizeSensor } from '../utils/resize-sensor.js';
35
34
  import { RootClose } from '../utils/RootClose.js';
36
35
  import '../utils/SimpleMap.js';
37
36
  import 'lodash/mapValues';
38
37
  import 'lodash/camelCase';
38
+ import 'lodash/cloneDeep';
39
39
  import 'lodash/map';
40
40
  import 'lodash/isEmpty';
41
41
  import 'lodash/kebabCase';
@@ -86,6 +86,7 @@ var Position = /** @class */ (function (_super) {
86
86
  arrowOffsetTop: null
87
87
  };
88
88
  _this._lastTarget = null;
89
+ _this.componentId = uuid();
89
90
  return _this;
90
91
  }
91
92
  Position.prototype.updatePosition = function (target) {
@@ -97,7 +98,7 @@ var Position = /** @class */ (function (_super) {
97
98
  var parentPopover = (_a = target === null || target === void 0 ? void 0 : target.closest) === null || _a === void 0 ? void 0 : _a.call(target, '[role=popover]');
98
99
  if (!this.parentPopover && parentPopover) {
99
100
  this.parentPopover = parentPopover;
100
- this.parentPopover.setAttribute(SubPopoverDisplayedID, true);
101
+ this.parentPopover.setAttribute(SubPopoverDisplayedID + '-' + this.componentId, true);
101
102
  }
102
103
  }
103
104
  if (!target) {
@@ -138,9 +139,11 @@ var Position = /** @class */ (function (_super) {
138
139
  };
139
140
  Position.prototype.componentWillUnmount = function () {
140
141
  var _a;
142
+ // 一个 PopOver 关闭时,需把挂载父 PopOver 的标记去掉
143
+ // 这里可能会存在多个子 PopOver 的情况,所以需要加上 componentId
141
144
  if (this.parentPopover &&
142
- this.parentPopover.getAttribute(SubPopoverDisplayedID)) {
143
- this.parentPopover.removeAttribute(SubPopoverDisplayedID);
145
+ this.parentPopover.getAttribute(SubPopoverDisplayedID + '-' + this.componentId)) {
146
+ this.parentPopover.removeAttribute(SubPopoverDisplayedID + '-' + this.componentId);
144
147
  this.parentPopover = null;
145
148
  }
146
149
  (_a = this.resizeDispose) === null || _a === void 0 ? void 0 : _a.forEach(function (fn) { return fn(); });
@@ -157,9 +160,8 @@ var Position = /** @class */ (function (_super) {
157
160
  return cloneElement(child, __assign(__assign(__assign(__assign({}, props), arrowPosition), (child.props.offset ? { offset: child.props.offset } : {})), {
158
161
  // FIXME: Don't forward `positionLeft` and `positionTop` via both props
159
162
  // and `props.style`.
160
- positionLeft: positionLeft, positionTop: positionTop, className: cx(className, child.props.className), style: __assign(__assign({}, child.props.style), { left: positionLeft, top: positionTop }) }));
163
+ positionLeft: positionLeft, positionTop: positionTop, className: cx(className, child.props.className), style: __assign(__assign({}, child.props.style), { left: positionLeft, top: positionTop }), componentId: this.componentId }));
161
164
  };
162
- // setState: (state: any) => void;
163
165
  Position.defaultProps = {
164
166
  containerPadding: 0,
165
167
  placement: 'right',