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/lib/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
  'use strict';
@@ -15,6 +15,7 @@ var hoistNonReactStatic = require('hoist-non-react-statics');
15
15
  var amisFormula = require('amis-formula');
16
16
  require('moment');
17
17
  var object = require('./utils/object.js');
18
+ var tokenize = require('./utils/tokenize.js');
18
19
  var isPureVariable = require('./utils/isPureVariable.js');
19
20
  var getVariable = require('./utils/getVariable.js');
20
21
  var dataMapping = require('./utils/dataMapping.js');
@@ -39,13 +40,13 @@ require('./utils/icon.js');
39
40
  require('./utils/image.js');
40
41
  require('lodash/isEqual');
41
42
  var rendererEvent = require('./utils/renderer-event.js');
42
- require('lodash/cloneDeep');
43
43
  require('./utils/resize-sensor.js');
44
44
  require('react-overlays/useRootClose');
45
45
  require('react-dom');
46
46
  require('./utils/SimpleMap.js');
47
47
  require('lodash/mapValues');
48
48
  require('lodash/camelCase');
49
+ require('lodash/cloneDeep');
49
50
  require('lodash/map');
50
51
  require('lodash/isEmpty');
51
52
  require('lodash/kebabCase');
@@ -97,6 +98,43 @@ function filterTarget(target, data) {
97
98
  }
98
99
  return tpl.filter(target, data, '| raw');
99
100
  }
101
+ /**
102
+ * 分割目标,如果里面有表达式,不要跟表达式里面的逗号冲突。
103
+ * @param target
104
+ * @returns
105
+ */
106
+ function splitTarget(target) {
107
+ try {
108
+ var ast = tokenize.memoParse(target);
109
+ var pos_1 = [];
110
+ ast.body.forEach(function (item) {
111
+ // 不要处理表达式里面的东西。
112
+ if (item.type === 'raw') {
113
+ var parts = item.value.split(',');
114
+ if (parts.length > 1) {
115
+ parts.pop();
116
+ var start_1 = item.start.index;
117
+ parts.forEach(function (part) {
118
+ pos_1.push(start_1 + part.length);
119
+ start_1 += part.length + 1;
120
+ });
121
+ }
122
+ }
123
+ });
124
+ if (pos_1.length) {
125
+ var parts = [];
126
+ pos_1.reduceRight(function (arr, index) {
127
+ arr.unshift(target.slice(index + 1));
128
+ target = target.slice(0, index);
129
+ return arr;
130
+ }, parts);
131
+ parts.unshift(target);
132
+ return parts;
133
+ }
134
+ }
135
+ catch (e) { }
136
+ return [target];
137
+ }
100
138
  var rootScopedContext = createScopedTools('');
101
139
  var ScopedContext = React__default["default"].createContext(rootScopedContext);
102
140
  function createScopedTools(path, parent, env, rendererType) {
@@ -241,7 +279,7 @@ function createScopedTools(path, parent, env, rendererType) {
241
279
  },
242
280
  reload: function (target, ctx) {
243
281
  var scoped = this;
244
- var targets = typeof target === 'string' ? target.split(/\s*,\s*/) : target;
282
+ var targets = typeof target === 'string' ? splitTarget(target) : target;
245
283
  targets.forEach(function (name) {
246
284
  var idx2 = name.indexOf('?');
247
285
  var query = null;
@@ -277,7 +315,7 @@ function createScopedTools(path, parent, env, rendererType) {
277
315
  },
278
316
  send: function (receive, values) {
279
317
  var scoped = this;
280
- var receives = typeof receive === 'string' ? receive.split(/\s*,\s*/) : receive;
318
+ var receives = typeof receive === 'string' ? splitTarget(receive) : receive;
281
319
  // todo 没找到做提示!
282
320
  receives.forEach(function (name) {
283
321
  var askIdx = name.indexOf('?');
@@ -313,8 +351,7 @@ function createScopedTools(path, parent, env, rendererType) {
313
351
  var scoped = this;
314
352
  if (typeof target === 'string') {
315
353
  // 过滤已经关掉的,当用户 close 配置多个弹框 name 时会出现这种情况
316
- target
317
- .split(/\s*,\s*/)
354
+ splitTarget(target)
318
355
  .map(function (name) { return scoped.getComponentByName(name); })
319
356
  .filter(function (component) { return component && component.props.show; })
320
357
  .forEach(closeDialog);
@@ -444,3 +481,4 @@ exports.HocScoped = HocScoped;
444
481
  exports.ScopedContext = ScopedContext;
445
482
  exports["default"] = HocScoped;
446
483
  exports.filterTarget = filterTarget;
484
+ exports.splitTarget = 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
  'use strict';
@@ -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
  'use strict';
package/lib/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
  'use strict';
@@ -108,9 +108,7 @@ function HocStoreFactory(renderer) {
108
108
  helper.isObjectShallowModified(state, this.state) && this.setState(state);
109
109
  // 需要重新监听
110
110
  (_a = this.unReaction) === null || _a === void 0 ? void 0 : _a.call(this);
111
- this.unReaction = mobx.reaction(function () { return JSON.stringify(filterSchema.getExprProperties(props, store.data)); }, function () {
112
- return _this.setState(tslib.__assign({}, filterSchema.getExprProperties(_this.props, store.data)));
113
- });
111
+ this.unReaction = mobx.reaction(function () { return filterSchema.getExprProperties(_this.props, store.data); }, function (exprProps) { return _this.setState(exprProps); });
114
112
  }
115
113
  var shouldSync = (_b = renderer.shouldSyncSuperStore) === null || _b === void 0 ? void 0 : _b.call(renderer, store, props, prevProps);
116
114
  if (shouldSync === false) {
@@ -155,7 +153,7 @@ function HocStoreFactory(renderer) {
155
153
  // 目前主要的问题是,如果 combo 中表单项名字和 combo 本身的名字一样,会导致里面的值会被覆盖成数组
156
154
  ((_c = props.store) === null || _c === void 0 ? void 0 : _c.storeType) === 'ComboStore'
157
155
  ? undefined
158
- : helper.syncDataFromSuper(props.data, props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
156
+ : helper.syncDataFromSuper(store.data, props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
159
157
  }
160
158
  else {
161
159
  store.initData(object.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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -32,7 +32,6 @@ require('../utils/image.js');
32
32
  require('lodash/isEqual');
33
33
  var Action = require('./Action.js');
34
34
  require('lodash/debounce');
35
- require('lodash/cloneDeep');
36
35
  require('../utils/resize-sensor.js');
37
36
  require('react');
38
37
  require('react-overlays/useRootClose');
@@ -40,6 +39,7 @@ require('react-dom');
40
39
  require('../utils/SimpleMap.js');
41
40
  require('lodash/mapValues');
42
41
  require('lodash/camelCase');
42
+ require('lodash/cloneDeep');
43
43
  require('lodash/map');
44
44
  require('lodash/isEmpty');
45
45
  require('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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -24,15 +24,20 @@ var LinkAction = /** @class */ (function () {
24
24
  LinkAction.prototype.run = function (action, renderer, event) {
25
25
  var _a, _b, _c, _d, _e, _f, _g, _h;
26
26
  return tslib.__awaiter(this, void 0, void 0, function () {
27
- var urlObj;
27
+ var apiParams, urlObj;
28
28
  return tslib.__generator(this, function (_j) {
29
29
  if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.jumpTo)) {
30
30
  throw new Error('env.jumpTo is required!');
31
31
  }
32
+ apiParams = tslib.__assign(tslib.__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 : {}));
33
+ if ((action === null || action === void 0 ? void 0 : action.actionType) === 'link' && (apiParams === null || apiParams === void 0 ? void 0 : apiParams.targetType)) {
34
+ // link动作新增打开方式targetType,buildApi不需要该参数
35
+ delete apiParams.targetType;
36
+ }
32
37
  urlObj = api.buildApi({
33
- url: (((_b = action.args) === null || _b === void 0 ? void 0 : _b.url) || ((_c = action.args) === null || _c === void 0 ? void 0 : _c.link)),
38
+ url: (((_e = action.args) === null || _e === void 0 ? void 0 : _e.url) || ((_f = action.args) === null || _f === void 0 ? void 0 : _f.link)),
34
39
  method: 'get'
35
- }, tslib.__assign(tslib.__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 : {})), {
40
+ }, apiParams, {
36
41
  autoAppend: true
37
42
  });
38
43
  (_g = event.context.env) === null || _g === void 0 ? void 0 : _g.jumpTo(urlObj.url, tslib.__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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -12,7 +12,7 @@ var styleHelper = require('../utils/style-helper.js');
12
12
 
13
13
  var styleIdCount = new Map();
14
14
  function CustomStyle (props) {
15
- var config = props.config, env = props.env;
15
+ var config = props.config, env = props.env, data = props.data;
16
16
  var themeCss = config.themeCss, classNames = config.classNames, id = config.id, defaultData = config.defaultData, wrapperCustomStyle = config.wrapperCustomStyle;
17
17
  if (!themeCss && !wrapperCustomStyle) {
18
18
  return null;
@@ -36,24 +36,37 @@ function CustomStyle (props) {
36
36
  React.useEffect(function () {
37
37
  var _a, _b;
38
38
  if (themeCss && id) {
39
- styleHelper.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);
39
+ styleHelper.insertCustomStyle({
40
+ themeCss: themeCss,
41
+ classNames: classNames,
42
+ id: id,
43
+ defaultData: defaultData,
44
+ customStyleClassPrefix: env === null || env === void 0 ? void 0 : env.customStyleClassPrefix,
45
+ 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,
46
+ data: data
47
+ });
40
48
  }
41
49
  return function () {
42
50
  var _a, _b;
43
51
  if (id && !styleIdCount.get(id)) {
44
- styleHelper.removeCustomStyle('', id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
52
+ styleHelper.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);
45
53
  }
46
54
  };
47
55
  }, [themeCss, id]);
48
56
  React.useEffect(function () {
49
57
  var _a, _b;
50
58
  if (wrapperCustomStyle && id) {
51
- styleHelper.insertEditCustomStyle(wrapperCustomStyle, id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
59
+ styleHelper.insertEditCustomStyle({
60
+ customStyle: wrapperCustomStyle,
61
+ id: id,
62
+ 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,
63
+ data: data
64
+ });
52
65
  }
53
66
  return function () {
54
67
  var _a, _b;
55
68
  if (id && !styleIdCount.get(id)) {
56
- styleHelper.removeCustomStyle('wrapperCustomStyle', id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
69
+ styleHelper.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);
57
70
  }
58
71
  };
59
72
  }, [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
  'use strict';
@@ -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
  'use strict';
@@ -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
  'use strict';
@@ -36,12 +36,12 @@ require('../utils/image.js');
36
36
  require('lodash/isEqual');
37
37
  require('../actions/Action.js');
38
38
  require('lodash/debounce');
39
- require('lodash/cloneDeep');
40
39
  var resizeSensor = require('../utils/resize-sensor.js');
41
40
  var RootClose = require('../utils/RootClose.js');
42
41
  require('../utils/SimpleMap.js');
43
42
  require('lodash/mapValues');
44
43
  require('lodash/camelCase');
44
+ require('lodash/cloneDeep');
45
45
  require('lodash/map');
46
46
  require('lodash/isEmpty');
47
47
  require('lodash/kebabCase');
@@ -97,6 +97,7 @@ var Position = /** @class */ (function (_super) {
97
97
  arrowOffsetTop: null
98
98
  };
99
99
  _this._lastTarget = null;
100
+ _this.componentId = helper.uuid();
100
101
  return _this;
101
102
  }
102
103
  Position.prototype.updatePosition = function (target) {
@@ -108,7 +109,7 @@ var Position = /** @class */ (function (_super) {
108
109
  var parentPopover = (_a = target === null || target === void 0 ? void 0 : target.closest) === null || _a === void 0 ? void 0 : _a.call(target, '[role=popover]');
109
110
  if (!this.parentPopover && parentPopover) {
110
111
  this.parentPopover = parentPopover;
111
- this.parentPopover.setAttribute(SubPopoverDisplayedID, true);
112
+ this.parentPopover.setAttribute(SubPopoverDisplayedID + '-' + this.componentId, true);
112
113
  }
113
114
  }
114
115
  if (!target) {
@@ -149,9 +150,11 @@ var Position = /** @class */ (function (_super) {
149
150
  };
150
151
  Position.prototype.componentWillUnmount = function () {
151
152
  var _a;
153
+ // 一个 PopOver 关闭时,需把挂载父 PopOver 的标记去掉
154
+ // 这里可能会存在多个子 PopOver 的情况,所以需要加上 componentId
152
155
  if (this.parentPopover &&
153
- this.parentPopover.getAttribute(SubPopoverDisplayedID)) {
154
- this.parentPopover.removeAttribute(SubPopoverDisplayedID);
156
+ this.parentPopover.getAttribute(SubPopoverDisplayedID + '-' + this.componentId)) {
157
+ this.parentPopover.removeAttribute(SubPopoverDisplayedID + '-' + this.componentId);
155
158
  this.parentPopover = null;
156
159
  }
157
160
  (_a = this.resizeDispose) === null || _a === void 0 ? void 0 : _a.forEach(function (fn) { return fn(); });
@@ -168,9 +171,8 @@ var Position = /** @class */ (function (_super) {
168
171
  return React.cloneElement(child, tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, props), arrowPosition), (child.props.offset ? { offset: child.props.offset } : {})), {
169
172
  // FIXME: Don't forward `positionLeft` and `positionTop` via both props
170
173
  // and `props.style`.
171
- positionLeft: positionLeft, positionTop: positionTop, className: cx__default["default"](className, child.props.className), style: tslib.__assign(tslib.__assign({}, child.props.style), { left: positionLeft, top: positionTop }) }));
174
+ positionLeft: positionLeft, positionTop: positionTop, className: cx__default["default"](className, child.props.className), style: tslib.__assign(tslib.__assign({}, child.props.style), { left: positionLeft, top: positionTop }), componentId: this.componentId }));
172
175
  };
173
- // setState: (state: any) => void;
174
176
  Position.defaultProps = {
175
177
  containerPadding: 0,
176
178
  placement: 'right',
@@ -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
  'use strict';
@@ -35,12 +35,12 @@ require('../utils/image.js');
35
35
  require('lodash/isEqual');
36
36
  require('../actions/Action.js');
37
37
  require('lodash/debounce');
38
- require('lodash/cloneDeep');
39
38
  require('../utils/resize-sensor.js');
40
39
  require('react-overlays/useRootClose');
41
40
  require('../utils/SimpleMap.js');
42
41
  require('lodash/mapValues');
43
42
  require('lodash/camelCase');
43
+ require('lodash/cloneDeep');
44
44
  require('lodash/map');
45
45
  require('lodash/isEmpty');
46
46
  require('lodash/kebabCase');
@@ -112,7 +112,9 @@ var PopOver = /** @class */ (function (_super) {
112
112
  closeOnOutside &&
113
113
  target &&
114
114
  this.wrapperRef.current &&
115
- !this.wrapperRef.current.getAttribute(Overlay.SubPopoverDisplayedID) &&
115
+ !this.wrapperRef.current
116
+ .getAttributeNames()
117
+ .find(function (n) { return n.startsWith(Overlay.SubPopoverDisplayedID); }) &&
116
118
  ((!this.wrapperRef.current.contains(target) &&
117
119
  !target.closest('[role=dialog]')) ||
118
120
  (target.matches(".".concat(ns, "Modal")) && target === this.wrapperRef.current))); // 干脆过滤掉来自弹框里面的点击
@@ -158,7 +160,7 @@ var PopOver = /** @class */ (function (_super) {
158
160
  });
159
161
  };
160
162
  PopOver.prototype.render = function () {
161
- var _a = this.props; _a.placement; var activePlacement = _a.activePlacement, positionTop = _a.positionTop, positionLeft = _a.positionLeft; _a.arrowOffsetLeft; _a.arrowOffsetTop; var style = _a.style, children = _a.children; _a.offset; var overlay = _a.overlay, onHide = _a.onHide, ns = _a.classPrefix, cx = _a.classnames, className = _a.className, rest = tslib.__rest(_a, ["placement", "activePlacement", "positionTop", "positionLeft", "arrowOffsetLeft", "arrowOffsetTop", "style", "children", "offset", "overlay", "onHide", "classPrefix", "classnames", "className"]);
163
+ var _a = this.props; _a.placement; var activePlacement = _a.activePlacement, positionTop = _a.positionTop, positionLeft = _a.positionLeft; _a.arrowOffsetLeft; _a.arrowOffsetTop; var style = _a.style, children = _a.children; _a.offset; var overlay = _a.overlay, onHide = _a.onHide, ns = _a.classPrefix, cx = _a.classnames, className = _a.className; _a.componentId; var rest = tslib.__rest(_a, ["placement", "activePlacement", "positionTop", "positionLeft", "arrowOffsetLeft", "arrowOffsetTop", "style", "children", "offset", "overlay", "onHide", "classPrefix", "classnames", "className", "componentId"]);
162
164
  var _b = this.state, xOffset = _b.xOffset, yOffset = _b.yOffset;
163
165
  var outerStyle = tslib.__assign(tslib.__assign({ display: 'block' }, style), { top: positionTop + yOffset, left: positionLeft + xOffset });
164
166
  var placements = typeof activePlacement === 'string' ? activePlacement.split('-') : [];
package/lib/env.d.ts CHANGED
@@ -86,6 +86,10 @@ export interface RendererEnv {
86
86
  * 是否开启 amis 调试
87
87
  */
88
88
  enableAMISDebug?: boolean;
89
+ /**
90
+ * 是否开启 testid 定位
91
+ */
92
+ enableTestid?: boolean;
89
93
  /**
90
94
  * 替换文本,用于实现 URL 替换、语言替换等
91
95
  */
package/lib/env.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
  'use strict';
@@ -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
  'use strict';
package/lib/factory.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
  'use strict';
@@ -162,6 +162,19 @@ var defaultOptions = {
162
162
  action.blank === false ? (window.location.href = to) : window.open(to);
163
163
  return;
164
164
  }
165
+ // link动作新增了targetType属性,默认是内容区打开(page),在新窗口打开(blank);在当前页签打开(self)
166
+ if ((action === null || action === void 0 ? void 0 : action.actionType) === 'link' &&
167
+ ['blank', 'self'].includes(action === null || action === void 0 ? void 0 : action.targetType)) {
168
+ if (action.targetType === 'self') {
169
+ // 当前页签打开,需要刷新页面
170
+ window.history.pushState(null, '', to);
171
+ location.reload();
172
+ }
173
+ else {
174
+ window.open(to);
175
+ }
176
+ return;
177
+ }
165
178
  if (/^https?:\/\//.test(to)) {
166
179
  window.location.replace(to);
167
180
  }