amis-core 6.2.2 → 6.4.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 (329) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.d.ts +1 -1
  3. package/esm/RootRenderer.js +28 -10
  4. package/esm/SchemaRenderer.js +17 -7
  5. package/esm/Scoped.d.ts +2 -1
  6. package/esm/Scoped.js +30 -14
  7. package/esm/StatusScoped.js +4 -2
  8. package/esm/WithRootStore.js +1 -1
  9. package/esm/WithStore.js +28 -17
  10. package/esm/actions/Action.js +5 -3
  11. package/esm/actions/AjaxAction.js +29 -19
  12. package/esm/actions/BreakAction.js +1 -1
  13. package/esm/actions/BroadcastAction.js +1 -1
  14. package/esm/actions/CmptAction.js +3 -3
  15. package/esm/actions/ContinueAction.js +1 -1
  16. package/esm/actions/CopyAction.js +1 -1
  17. package/esm/actions/CustomAction.js +2 -2
  18. package/esm/actions/DialogAction.d.ts +8 -0
  19. package/esm/actions/DialogAction.js +116 -40
  20. package/esm/actions/DrawerAction.d.ts +5 -0
  21. package/esm/actions/DrawerAction.js +74 -11
  22. package/esm/actions/EmailAction.js +1 -1
  23. package/esm/actions/EventAction.d.ts +20 -0
  24. package/esm/actions/EventAction.js +102 -0
  25. package/esm/actions/LinkAction.js +1 -1
  26. package/esm/actions/LoopAction.js +1 -1
  27. package/esm/actions/PageAction.js +1 -1
  28. package/esm/actions/ParallelAction.js +1 -1
  29. package/esm/actions/PrintAction.d.ts +2 -2
  30. package/esm/actions/PrintAction.js +6 -6
  31. package/esm/actions/StatusAction.js +1 -1
  32. package/esm/actions/SwitchAction.js +1 -1
  33. package/esm/actions/ToastAction.js +1 -1
  34. package/esm/actions/WaitAction.d.ts +18 -0
  35. package/esm/actions/WaitAction.js +41 -0
  36. package/esm/actions/index.d.ts +2 -0
  37. package/esm/components/CustomStyle.js +1 -4
  38. package/esm/components/ErrorBoundary.js +1 -1
  39. package/esm/components/LazyComponent.js +1 -1
  40. package/esm/components/Overlay.d.ts +3 -0
  41. package/esm/components/Overlay.js +7 -4
  42. package/esm/components/PopOver.js +2 -2
  43. package/esm/env.js +1 -1
  44. package/esm/envOverwrite.js +1 -1
  45. package/esm/factory.d.ts +3 -0
  46. package/esm/factory.js +1 -1
  47. package/esm/index.js +6 -4
  48. package/esm/locale.js +4 -2
  49. package/esm/polyfills.js +1 -1
  50. package/esm/renderers/Form.d.ts +6 -4
  51. package/esm/renderers/Form.js +134 -66
  52. package/esm/renderers/Item.d.ts +123 -79
  53. package/esm/renderers/Item.js +159 -60
  54. package/esm/renderers/Options.d.ts +0 -11
  55. package/esm/renderers/Options.js +20 -84
  56. package/esm/renderers/Placeholder.js +1 -1
  57. package/esm/renderers/builtin.js +1 -1
  58. package/esm/renderers/register.js +1 -1
  59. package/esm/renderers/wrapControl.d.ts +2 -1
  60. package/esm/renderers/wrapControl.js +34 -28
  61. package/esm/store/app.d.ts +5 -5
  62. package/esm/store/app.js +1 -1
  63. package/esm/store/combo.d.ts +255 -63
  64. package/esm/store/combo.js +1 -1
  65. package/esm/store/crud.d.ts +5 -5
  66. package/esm/store/crud.js +12 -6
  67. package/esm/store/form.d.ts +105 -25
  68. package/esm/store/form.js +33 -15
  69. package/esm/store/formItem.d.ts +6 -2
  70. package/esm/store/formItem.js +68 -5
  71. package/esm/store/iRenderer.d.ts +5 -5
  72. package/esm/store/iRenderer.js +28 -12
  73. package/esm/store/index.js +1 -1
  74. package/esm/store/list.d.ts +18 -5
  75. package/esm/store/list.js +14 -1
  76. package/esm/store/manager.js +1 -1
  77. package/esm/store/modal.d.ts +5 -5
  78. package/esm/store/modal.js +1 -1
  79. package/esm/store/node.js +1 -1
  80. package/esm/store/pagination.d.ts +5 -5
  81. package/esm/store/pagination.js +1 -1
  82. package/esm/store/root.d.ts +5 -5
  83. package/esm/store/root.js +1 -1
  84. package/esm/store/service.d.ts +5 -5
  85. package/esm/store/service.js +2 -2
  86. package/esm/store/status.js +1 -1
  87. package/esm/store/table.d.ts +244 -55
  88. package/esm/store/table.js +27 -9
  89. package/esm/store/table2.d.ts +5 -5
  90. package/esm/store/table2.js +1 -1
  91. package/esm/theme.js +4 -2
  92. package/esm/types.d.ts +7 -1
  93. package/esm/utils/Animation.js +1 -1
  94. package/esm/utils/ColorScale.js +1 -1
  95. package/esm/utils/DataSchema.js +1 -1
  96. package/esm/utils/DataScope.js +1 -1
  97. package/esm/utils/RootClose.js +1 -1
  98. package/esm/utils/SimpleMap.js +1 -1
  99. package/esm/utils/api.js +1 -1
  100. package/esm/utils/arraySlice.js +1 -1
  101. package/esm/utils/attachmentAdpator.js +1 -1
  102. package/esm/utils/autobind.js +1 -1
  103. package/esm/utils/browser.js +1 -1
  104. package/esm/utils/columnsSplit.js +1 -1
  105. package/esm/utils/concatData.js +1 -1
  106. package/esm/utils/dataMapping.js +1 -1
  107. package/esm/utils/date.js +1 -1
  108. package/esm/utils/debug.js +1 -1
  109. package/esm/utils/decodeEntity.js +1 -1
  110. package/esm/utils/dom.d.ts +2 -2
  111. package/esm/utils/dom.js +72 -13
  112. package/esm/utils/errors.js +1 -1
  113. package/esm/utils/escapeHtml.js +1 -1
  114. package/esm/utils/filter-schema.js +1 -1
  115. package/esm/utils/filter.js +1 -1
  116. package/esm/utils/formatDuration.js +1 -1
  117. package/esm/utils/formula.js +2 -2
  118. package/esm/utils/getVariable.js +1 -1
  119. package/esm/utils/grammar.js +1 -1
  120. package/esm/utils/handleAction.js +1 -1
  121. package/esm/utils/helper.d.ts +12 -6
  122. package/esm/utils/helper.js +41 -18
  123. package/esm/utils/highlight.js +1 -1
  124. package/esm/utils/icon.js +1 -1
  125. package/esm/utils/image.js +1 -1
  126. package/esm/utils/isPureVariable.js +1 -1
  127. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  128. package/esm/utils/keyToPath.js +1 -1
  129. package/esm/utils/labelToString.js +1 -1
  130. package/esm/utils/makeSorter.js +1 -1
  131. package/esm/utils/math.js +1 -1
  132. package/esm/utils/memoryParse.js +1 -1
  133. package/esm/utils/normalizeLink.js +1 -1
  134. package/esm/utils/normalizeOptions.js +1 -1
  135. package/esm/utils/object.js +1 -1
  136. package/esm/utils/offset.js +1 -1
  137. package/esm/utils/offsetParent.js +1 -1
  138. package/esm/utils/optionValueCompare.js +1 -1
  139. package/esm/utils/position.js +1 -1
  140. package/esm/utils/prettyBytes.js +1 -1
  141. package/esm/utils/printElement.js +1 -1
  142. package/esm/utils/renderer-event.d.ts +13 -0
  143. package/esm/utils/renderer-event.js +111 -2
  144. package/esm/utils/replaceText.js +1 -1
  145. package/esm/utils/resize-sensor.js +1 -1
  146. package/esm/utils/resolveCondition.js +1 -1
  147. package/esm/utils/resolveVariable.js +1 -1
  148. package/esm/utils/resolveVariableAndFilter.js +1 -1
  149. package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
  150. package/esm/utils/scrollPosition.js +1 -1
  151. package/esm/utils/string2regExp.js +1 -1
  152. package/esm/utils/stripNumber.d.ts +1 -1
  153. package/esm/utils/stripNumber.js +4 -3
  154. package/esm/utils/style-helper.d.ts +21 -2
  155. package/esm/utils/style-helper.js +55 -10
  156. package/esm/utils/style.js +1 -1
  157. package/esm/utils/toNumber.js +1 -1
  158. package/esm/utils/tokenize.js +1 -1
  159. package/esm/utils/tpl-builtin.js +1 -1
  160. package/esm/utils/tpl-lodash.js +1 -1
  161. package/esm/utils/tpl.js +4 -4
  162. package/esm/utils/uncontrollable.js +1 -1
  163. package/esm/utils/validateId.js +5 -2
  164. package/esm/utils/validations.js +1 -1
  165. package/lib/Root.js +1 -1
  166. package/lib/RootRenderer.d.ts +2 -2
  167. package/lib/RootRenderer.js +28 -10
  168. package/lib/SchemaRenderer.js +16 -6
  169. package/lib/Scoped.d.ts +2 -1
  170. package/lib/Scoped.js +30 -14
  171. package/lib/StatusScoped.js +4 -2
  172. package/lib/WithRootStore.js +1 -1
  173. package/lib/WithStore.js +28 -17
  174. package/lib/actions/Action.js +5 -3
  175. package/lib/actions/AjaxAction.js +29 -19
  176. package/lib/actions/BreakAction.js +1 -1
  177. package/lib/actions/BroadcastAction.js +1 -1
  178. package/lib/actions/CmptAction.js +3 -3
  179. package/lib/actions/ContinueAction.js +1 -1
  180. package/lib/actions/CopyAction.js +1 -1
  181. package/lib/actions/CustomAction.js +1 -1
  182. package/lib/actions/DialogAction.d.ts +8 -0
  183. package/lib/actions/DialogAction.js +119 -40
  184. package/lib/actions/DrawerAction.d.ts +5 -0
  185. package/lib/actions/DrawerAction.js +77 -11
  186. package/lib/actions/EmailAction.js +1 -1
  187. package/lib/actions/EventAction.d.ts +20 -0
  188. package/lib/actions/EventAction.js +109 -0
  189. package/lib/actions/LinkAction.js +1 -1
  190. package/lib/actions/LoopAction.js +1 -1
  191. package/lib/actions/PageAction.js +1 -1
  192. package/lib/actions/ParallelAction.js +1 -1
  193. package/lib/actions/PrintAction.d.ts +2 -2
  194. package/lib/actions/PrintAction.js +6 -6
  195. package/lib/actions/StatusAction.js +1 -1
  196. package/lib/actions/SwitchAction.js +1 -1
  197. package/lib/actions/ToastAction.js +1 -1
  198. package/lib/actions/WaitAction.d.ts +18 -0
  199. package/lib/actions/WaitAction.js +45 -0
  200. package/lib/actions/index.d.ts +2 -0
  201. package/lib/components/CustomStyle.js +1 -4
  202. package/lib/components/ErrorBoundary.js +1 -1
  203. package/lib/components/LazyComponent.js +1 -1
  204. package/lib/components/Overlay.d.ts +3 -0
  205. package/lib/components/Overlay.js +7 -4
  206. package/lib/components/PopOver.js +1 -1
  207. package/lib/env.js +1 -1
  208. package/lib/envOverwrite.js +1 -1
  209. package/lib/factory.d.ts +3 -0
  210. package/lib/factory.js +1 -1
  211. package/lib/index.js +6 -4
  212. package/lib/locale.js +4 -2
  213. package/lib/polyfills.js +1 -1
  214. package/lib/renderers/Form.d.ts +6 -4
  215. package/lib/renderers/Form.js +135 -65
  216. package/lib/renderers/Item.d.ts +123 -79
  217. package/lib/renderers/Item.js +158 -58
  218. package/lib/renderers/Options.d.ts +0 -11
  219. package/lib/renderers/Options.js +19 -84
  220. package/lib/renderers/Placeholder.js +1 -1
  221. package/lib/renderers/builtin.js +1 -1
  222. package/lib/renderers/register.js +1 -1
  223. package/lib/renderers/wrapControl.d.ts +2 -1
  224. package/lib/renderers/wrapControl.js +34 -28
  225. package/lib/store/app.d.ts +5 -5
  226. package/lib/store/app.js +1 -1
  227. package/lib/store/combo.d.ts +279 -88
  228. package/lib/store/combo.js +1 -1
  229. package/lib/store/crud.d.ts +5 -5
  230. package/lib/store/crud.js +12 -6
  231. package/lib/store/form.d.ts +115 -36
  232. package/lib/store/form.js +33 -15
  233. package/lib/store/formItem.d.ts +6 -2
  234. package/lib/store/formItem.js +67 -4
  235. package/lib/store/iRenderer.d.ts +5 -5
  236. package/lib/store/iRenderer.js +27 -11
  237. package/lib/store/index.js +1 -1
  238. package/lib/store/list.d.ts +18 -5
  239. package/lib/store/list.js +14 -1
  240. package/lib/store/manager.js +1 -1
  241. package/lib/store/modal.d.ts +5 -5
  242. package/lib/store/modal.js +1 -1
  243. package/lib/store/node.js +1 -1
  244. package/lib/store/pagination.d.ts +5 -5
  245. package/lib/store/pagination.js +1 -1
  246. package/lib/store/root.d.ts +5 -5
  247. package/lib/store/root.js +1 -1
  248. package/lib/store/service.d.ts +5 -5
  249. package/lib/store/service.js +2 -2
  250. package/lib/store/status.js +1 -1
  251. package/lib/store/table.d.ts +264 -76
  252. package/lib/store/table.js +27 -9
  253. package/lib/store/table2.d.ts +5 -5
  254. package/lib/store/table2.js +1 -1
  255. package/lib/theme.js +4 -2
  256. package/lib/types.d.ts +7 -1
  257. package/lib/utils/Animation.js +1 -1
  258. package/lib/utils/ColorScale.js +1 -1
  259. package/lib/utils/DataSchema.js +1 -1
  260. package/lib/utils/DataScope.js +1 -1
  261. package/lib/utils/RootClose.js +1 -1
  262. package/lib/utils/SimpleMap.js +1 -1
  263. package/lib/utils/api.js +1 -1
  264. package/lib/utils/arraySlice.js +1 -1
  265. package/lib/utils/attachmentAdpator.js +1 -1
  266. package/lib/utils/autobind.js +1 -1
  267. package/lib/utils/browser.js +1 -1
  268. package/lib/utils/columnsSplit.js +1 -1
  269. package/lib/utils/concatData.js +1 -1
  270. package/lib/utils/dataMapping.js +1 -1
  271. package/lib/utils/date.js +1 -1
  272. package/lib/utils/debug.js +1 -1
  273. package/lib/utils/decodeEntity.js +1 -1
  274. package/lib/utils/dom.d.ts +2 -2
  275. package/lib/utils/dom.js +72 -13
  276. package/lib/utils/errors.js +1 -1
  277. package/lib/utils/escapeHtml.js +1 -1
  278. package/lib/utils/filter-schema.js +1 -1
  279. package/lib/utils/filter.js +1 -1
  280. package/lib/utils/formatDuration.js +1 -1
  281. package/lib/utils/formula.js +2 -2
  282. package/lib/utils/getVariable.js +1 -1
  283. package/lib/utils/grammar.js +1 -1
  284. package/lib/utils/handleAction.js +1 -1
  285. package/lib/utils/helper.d.ts +12 -6
  286. package/lib/utils/helper.js +41 -20
  287. package/lib/utils/highlight.js +1 -1
  288. package/lib/utils/icon.js +1 -1
  289. package/lib/utils/image.js +1 -1
  290. package/lib/utils/isPureVariable.js +1 -1
  291. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  292. package/lib/utils/keyToPath.js +1 -1
  293. package/lib/utils/labelToString.js +1 -1
  294. package/lib/utils/makeSorter.js +1 -1
  295. package/lib/utils/math.js +1 -1
  296. package/lib/utils/memoryParse.js +1 -1
  297. package/lib/utils/normalizeLink.js +1 -1
  298. package/lib/utils/normalizeOptions.js +1 -1
  299. package/lib/utils/object.js +1 -1
  300. package/lib/utils/offset.js +1 -1
  301. package/lib/utils/offsetParent.js +1 -1
  302. package/lib/utils/optionValueCompare.js +1 -1
  303. package/lib/utils/position.js +1 -1
  304. package/lib/utils/prettyBytes.js +1 -1
  305. package/lib/utils/printElement.js +1 -1
  306. package/lib/utils/renderer-event.d.ts +13 -0
  307. package/lib/utils/renderer-event.js +111 -1
  308. package/lib/utils/replaceText.js +1 -1
  309. package/lib/utils/resize-sensor.js +1 -1
  310. package/lib/utils/resolveCondition.js +1 -1
  311. package/lib/utils/resolveVariable.js +1 -1
  312. package/lib/utils/resolveVariableAndFilter.js +1 -1
  313. package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
  314. package/lib/utils/scrollPosition.js +1 -1
  315. package/lib/utils/string2regExp.js +1 -1
  316. package/lib/utils/stripNumber.d.ts +1 -1
  317. package/lib/utils/stripNumber.js +4 -3
  318. package/lib/utils/style-helper.d.ts +21 -2
  319. package/lib/utils/style-helper.js +55 -10
  320. package/lib/utils/style.js +1 -1
  321. package/lib/utils/toNumber.js +1 -1
  322. package/lib/utils/tokenize.js +1 -1
  323. package/lib/utils/tpl-builtin.js +1 -1
  324. package/lib/utils/tpl-lodash.js +1 -1
  325. package/lib/utils/tpl.js +4 -4
  326. package/lib/utils/uncontrollable.js +1 -1
  327. package/lib/utils/validateId.js +9 -2
  328. package/lib/utils/validations.js +1 -1
  329. package/package.json +5 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -32,7 +32,7 @@ var sortBy__default = /*#__PURE__*/_interopDefaultLegacy(sortBy);
32
32
  * 内部列的数量 '__checkme' | '__dragme' | '__expandme'
33
33
  */
34
34
  var PARTITION_INDEX = 3;
35
- function initChildren(children, depth, pindex, parentId, path) {
35
+ function initChildren(children, depth, pindex, parentId, path, getEntryId) {
36
36
  if (path === void 0) { path = ''; }
37
37
  depth += 1;
38
38
  return children.map(function (item, index) {
@@ -42,7 +42,7 @@ function initChildren(children, depth, pindex, parentId, path) {
42
42
  : {
43
43
  item: item
44
44
  };
45
- var id = (_a = item.__id) !== null && _a !== void 0 ? _a : helper.guid();
45
+ var id = String(getEntryId ? getEntryId(item, index) : (_a = item.__id) !== null && _a !== void 0 ? _a : helper.guid());
46
46
  return {
47
47
  // id: String(item && (item as any)[self.primaryField] || `${pindex}-${depth}-${key}`),
48
48
  id: String(id),
@@ -59,7 +59,7 @@ function initChildren(children, depth, pindex, parentId, path) {
59
59
  loading: false,
60
60
  rowSpans: {},
61
61
  children: item && Array.isArray(item.children)
62
- ? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."))
62
+ ? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."), getEntryId)
63
63
  : []
64
64
  };
65
65
  });
@@ -198,11 +198,9 @@ var Row = mobxStateTree.types
198
198
  return Object.keys(self.data).some(function (key) { return !isEqual__default["default"](self.data[key], self.pristine[key]); });
199
199
  },
200
200
  getDataWithModifiedChilden: function () {
201
- var data = tslib.__assign({}, self.data);
201
+ var data = self.data;
202
202
  if (data.children && self.children) {
203
- data.children = self.children.map(function (item) {
204
- return item.getDataWithModifiedChilden();
205
- });
203
+ data = tslib.__assign(tslib.__assign({}, data), { children: self.children.map(function (item) { return item.getDataWithModifiedChilden(); }) });
206
204
  }
207
205
  return data;
208
206
  },
@@ -296,6 +294,9 @@ var Row = mobxStateTree.types
296
294
  toggleExpanded: function () {
297
295
  mobxStateTree.getParent(self, self.depth * 2).toggleExpanded(self);
298
296
  },
297
+ setExpanded: function (expanded) {
298
+ mobxStateTree.getParent(self, self.depth * 2).setExpanded(self, expanded);
299
+ },
299
300
  change: function (values, savePristine) {
300
301
  self.data = helper.immutableExtends(self.data, values);
301
302
  savePristine && (self.pristine = self.data);
@@ -1076,7 +1077,7 @@ var TableStore = iRenderer.iRendererStore
1076
1077
  loaded: false,
1077
1078
  loading: false,
1078
1079
  children: item && Array.isArray(item.children)
1079
- ? initChildren(item.children, 1, index, id, "".concat(index, "."))
1080
+ ? initChildren(item.children, 1, index, id, "".concat(index, "."), getEntryId)
1080
1081
  : []
1081
1082
  };
1082
1083
  });
@@ -1324,6 +1325,18 @@ var TableStore = iRenderer.iRendererStore
1324
1325
  self.expandedRows.push(row.id);
1325
1326
  }
1326
1327
  }
1328
+ function setExpanded(row, expanded) {
1329
+ var id = typeof row === 'string' ? row : row.id;
1330
+ var idx = self.expandedRows.indexOf(id);
1331
+ if (expanded) {
1332
+ if (!~idx) {
1333
+ self.expandedRows.push(id);
1334
+ }
1335
+ }
1336
+ else {
1337
+ ~idx && self.expandedRows.splice(idx, 1);
1338
+ }
1339
+ }
1327
1340
  function collapseAllAtDepth(depth) {
1328
1341
  var rows = self.getExpandedRows().filter(function (item) { return item.depth !== depth; });
1329
1342
  self.expandedRows.replace(rows.map(function (item) { return item.id; }));
@@ -1355,6 +1368,9 @@ var TableStore = iRenderer.iRendererStore
1355
1368
  function toggleDragging() {
1356
1369
  self.dragging = !self.dragging;
1357
1370
  }
1371
+ function startDragging() {
1372
+ self.dragging = true;
1373
+ }
1358
1374
  function stopDragging() {
1359
1375
  self.dragging = false;
1360
1376
  }
@@ -1456,12 +1472,14 @@ var TableStore = iRenderer.iRendererStore
1456
1472
  getToggleShiftRows: getToggleShiftRows,
1457
1473
  toggleExpandAll: toggleExpandAll,
1458
1474
  toggleExpanded: toggleExpanded,
1475
+ setExpanded: setExpanded,
1459
1476
  collapseAllAtDepth: collapseAllAtDepth,
1460
1477
  clear: clear,
1461
1478
  setOrderByInfo: setOrderByInfo,
1462
1479
  changeOrder: changeOrder,
1463
1480
  reset: reset,
1464
1481
  toggleDragging: toggleDragging,
1482
+ startDragging: startDragging,
1465
1483
  stopDragging: stopDragging,
1466
1484
  exchange: exchange,
1467
1485
  addForm: addForm,
@@ -165,11 +165,11 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
165
165
  reset(): void;
166
166
  updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined, concatFields?: string | string[] | undefined): void;
167
167
  changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
168
- setCurrentAction(action: object): void;
169
- openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
170
- closeDialog(result?: any): void;
171
- openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
172
- closeDrawer(result?: any): void;
168
+ setCurrentAction(action: any, resolveDefinitions?: ((schema: any) => any) | undefined): void;
169
+ openDialog(ctx: any, additonal?: object | undefined, callback?: ((confirmed: boolean, values: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
170
+ closeDialog(confirmed?: any, data?: any): void;
171
+ openDrawer(ctx: any, additonal?: object | undefined, callback?: ((confirmed: boolean, ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
172
+ closeDrawer(confirmed?: any, data?: any): void;
173
173
  getDialogScoped(): import("..").IScopedContext | null;
174
174
  getDrawerScoped(): import("..").IScopedContext | null;
175
175
  } & {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
package/lib/theme.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -122,7 +122,9 @@ function themeable(ComposedComponent) {
122
122
  classnames: config.classnames,
123
123
  theme: theme
124
124
  };
125
- var refConfig = ((_a = ComposedComponent.prototype) === null || _a === void 0 ? void 0 : _a.isReactComponent)
125
+ var refConfig = ((_a = ComposedComponent.prototype) === null || _a === void 0 ? void 0 : _a.isReactComponent) ||
126
+ ComposedComponent.$$typeof ===
127
+ Symbol.for('react.forward_ref')
126
128
  ? { ref: this.childRef }
127
129
  : { forwardedRef: this.childRef };
128
130
  var body = (_J$X_(ComposedComponent, tslib.__assign({}, config.getComponentConfig(ComposedComponent.themeKey), this.props, injectedProps, refConfig)));
package/lib/types.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  import type { JSONSchema7 } from 'json-schema';
3
3
  import { ListenerAction } from './actions/Action';
4
4
  import { debounceConfig, trackConfig } from './utils/renderer-event';
5
+ import type { TestIdBuilder } from './utils/helper';
5
6
  export interface Option {
6
7
  /**
7
8
  * 用来显示的文字
@@ -271,7 +272,7 @@ export interface Definitions {
271
272
  [propName: string]: SchemaNode;
272
273
  }
273
274
  export interface ActionObject extends ButtonObject {
274
- actionType?: 'submit' | 'copy' | 'reload' | 'ajax' | 'saveAs' | 'dialog' | 'drawer' | 'confirmDialog' | 'jump' | 'link' | 'url' | 'email' | 'close' | 'confirm' | 'add' | 'remove' | 'delete' | 'edit' | 'cancel' | 'next' | 'prev' | 'reset' | 'validate' | 'reset-and-submit' | 'clear' | 'clear-and-submit' | 'toast' | 'goto-step' | 'goto-image' | 'expand' | 'collapse' | 'step-submit' | 'selectAll' | 'changeTabKey' | 'clearSearch';
275
+ actionType?: 'submit' | 'copy' | 'reload' | 'ajax' | 'saveAs' | 'dialog' | 'drawer' | 'confirmDialog' | 'jump' | 'link' | 'url' | 'email' | 'close' | 'confirm' | 'add' | 'remove' | 'delete' | 'edit' | 'cancel' | 'next' | 'prev' | 'reset' | 'validate' | 'reset-and-submit' | 'clear' | 'clear-and-submit' | 'toast' | 'goto-step' | 'goto-image' | 'expand' | 'collapse' | 'step-submit' | 'select' | 'selectAll' | 'clearAll' | 'changeTabKey' | 'clearSearch' | 'submitQuickEdit' | 'initDrag' | 'cancelDrag' | 'toggleExpanded' | 'setExpanded';
275
276
  api?: BaseApiObject | string;
276
277
  asyncApi?: BaseApiObject | string;
277
278
  payload?: any;
@@ -432,6 +433,10 @@ export type SchemaClassName = string | {
432
433
  [propName: string]: boolean | undefined | null | SchemaExpression;
433
434
  };
434
435
  export interface BaseSchemaWithoutType {
436
+ /**
437
+ * 组件唯一 id,主要用于页面设计器中定位 json 节点
438
+ */
439
+ $$id?: string;
435
440
  /**
436
441
  * 容器 css 类名
437
442
  */
@@ -534,6 +539,7 @@ export interface BaseSchemaWithoutType {
534
539
  * 可以组件级别用来关闭移动端样式
535
540
  */
536
541
  useMobileUI?: boolean;
542
+ testIdBuilder?: TestIdBuilder;
537
543
  }
538
544
  export type OperatorType = 'equal' | 'not_equal' | 'is_empty' | 'is_not_empty' | 'like' | 'not_like' | 'starts_with' | 'ends_with' | 'less' | 'less_or_equal' | 'greater' | 'greater_or_equal' | 'between' | 'not_between' | 'select_equals' | 'select_not_equals' | 'select_any_in' | 'select_not_any_in' | {
539
545
  label: string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
package/lib/utils/api.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
package/lib/utils/date.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -4,8 +4,8 @@ export declare function ownerDocument(componentOrElement: any): Document;
4
4
  export declare function calculatePosition(placement: any, overlayNode: any, target: HTMLElement, container: any, padding?: any, customOffset?: [number, number]): {
5
5
  positionLeft: number;
6
6
  positionTop: number;
7
- arrowOffsetLeft: number;
8
- arrowOffsetTop: number;
7
+ arrowOffsetLeft: any;
8
+ arrowOffsetTop: any;
9
9
  activePlacement: string;
10
10
  };
11
11
  /**
package/lib/utils/dom.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -12,6 +12,7 @@ var ReactDOM = require('react-dom');
12
12
  require('react');
13
13
  var offset = require('./offset.js');
14
14
  var position = require('./position.js');
15
+ var helper = require('./helper.js');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
@@ -75,12 +76,14 @@ function getLeftDelta(left, overlayWidth, container, padding) {
75
76
  return 0;
76
77
  }
77
78
  function calculatePosition(placement, overlayNode, target, container, padding, customOffset) {
79
+ var _a;
78
80
  if (padding === void 0) { padding = 0; }
79
81
  if (customOffset === void 0) { customOffset = [0, 0]; }
82
+ var scrollParent = helper.getScrollParent(container);
80
83
  var childOffset = container.tagName === 'BODY'
81
84
  ? offset.offset(target)
82
85
  : position.position(target, container);
83
- var _a = offset.offset(overlayNode), overlayHeight = _a.height, overlayWidth = _a.width;
86
+ var _b = offset.offset(overlayNode), overlayHeight = _b.height, overlayWidth = _b.width;
84
87
  var clip = container.getBoundingClientRect();
85
88
  var clip2 = overlayNode.getBoundingClientRect();
86
89
  var scaleX = overlayNode.offsetWidth
@@ -97,6 +100,40 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
97
100
  ? "left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom ".concat(autoDefaultPlacement)
98
101
  : placement;
99
102
  var positionLeft = 0, positionTop = 0, arrowOffsetLeft = '', arrowOffsetTop = '', activePlacement = placement;
103
+ // 如果是作为菜单浮层,不再基于四个方向对齐,而是模拟原生右键菜单定位:
104
+ // 1.计算放右边,还是左边
105
+ // 2.计算能否放在下面,如果不能则贴底
106
+ // 3.由于是基于一个点此时不考虑 arrow
107
+ if (placement === 'asContextMenu') {
108
+ if (childOffset.left + 1 + overlayWidth <= clip.width) {
109
+ // 放右边
110
+ positionLeft = childOffset.left + 1;
111
+ }
112
+ else if (childOffset.left - overlayWidth >= 0) {
113
+ // 放左边
114
+ positionLeft = childOffset.left - overlayWidth;
115
+ }
116
+ else {
117
+ // 兜底贴右边
118
+ positionLeft = Math.max(clip.width - overlayWidth, 10);
119
+ }
120
+ if (childOffset.top + 1 + overlayHeight <= clip.height) {
121
+ // 放下面
122
+ positionTop = childOffset.top + 1;
123
+ }
124
+ else {
125
+ // 贴底边,预留5px避免完全贴底
126
+ positionTop = Math.max(clip.height - overlayHeight - 5, 10);
127
+ }
128
+ var _c = tslib.__read(customOffset, 2), _d = _c[0], offSetX_1 = _d === void 0 ? 0 : _d, _e = _c[1], offSetY_1 = _e === void 0 ? 0 : _e;
129
+ return {
130
+ positionLeft: (positionLeft + offSetX_1) / scaleX,
131
+ positionTop: (positionTop + offSetY_1) / scaleY,
132
+ arrowOffsetLeft: arrowOffsetLeft,
133
+ arrowOffsetTop: arrowOffsetTop,
134
+ activePlacement: activePlacement
135
+ };
136
+ }
100
137
  if (~placement.indexOf('-')) {
101
138
  var tests = placement.split(/\s+/);
102
139
  // 收集可见方向
@@ -106,11 +143,11 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
106
143
  // 自动对齐模式下,当四个方向都无法完全可见时
107
144
  // 根据之前的计算结果,使用收集的可见方向作为兜底,避免完全不可见
108
145
  if (isAuto && tests.length === 0) {
109
- var _b = tslib.__read(autoDefaultPlacement.split('-'), 4), _atX = _b[0], _atY = _b[1], _myX = _b[2], _myY = _b[3];
110
- var _c = visiblePlacement.atX, atX_1 = _c === void 0 ? _atX : _c, _d = visiblePlacement.atY, atY_1 = _d === void 0 ? _atY : _d, _e = visiblePlacement.myX, myX_1 = _e === void 0 ? _myX : _e, _f = visiblePlacement.myY, myY_1 = _f === void 0 ? _myY : _f;
146
+ var _f = tslib.__read(autoDefaultPlacement.split('-'), 4), _atX = _f[0], _atY = _f[1], _myX = _f[2], _myY = _f[3];
147
+ var _g = visiblePlacement.atX, atX_1 = _g === void 0 ? _atX : _g, _h = visiblePlacement.atY, atY_1 = _h === void 0 ? _atY : _h, _j = visiblePlacement.myX, myX_1 = _j === void 0 ? _myX : _j, _k = visiblePlacement.myY, myY_1 = _k === void 0 ? _myY : _k;
111
148
  current = activePlacement = [atX_1, atY_1, myX_1, myY_1].join('-');
112
149
  }
113
- var _g = tslib.__read(current.split('-'), 4), atX = _g[0], atY = _g[1], myX = _g[2], myY = _g[3];
150
+ var _l = tslib.__read(current.split('-'), 4), atX = _l[0], atY = _l[1], myX = _l[2], myY = _l[3];
114
151
  myX = myX || atX;
115
152
  myY = myY || atY;
116
153
  positionLeft =
@@ -143,14 +180,16 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
143
180
  };
144
181
  var visibleX = false;
145
182
  var visibleY = false;
146
- if (transformed.x > 0 &&
147
- transformed.x + transformed.width < window.innerWidth) {
183
+ if (transformed.x >= 0 &&
184
+ transformed.x + transformed.width <
185
+ window.innerWidth + scrollParent.scrollLeft) {
148
186
  visibleX = true;
149
187
  !visiblePlacement.atX && (visiblePlacement.atX = atX);
150
188
  !visiblePlacement.myX && (visiblePlacement.myX = myX);
151
189
  }
152
- if (transformed.y > 0 &&
153
- transformed.y + transformed.height < window.innerHeight) {
190
+ if (transformed.y >= 0 &&
191
+ transformed.y + transformed.height <
192
+ window.innerHeight + scrollParent.scrollTop) {
154
193
  visibleY = true;
155
194
  !visiblePlacement.atY && (visiblePlacement.atY = atY);
156
195
  !visiblePlacement.myY && (visiblePlacement.myY = myY);
@@ -159,9 +198,29 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
159
198
  break;
160
199
  }
161
200
  else if (isAuto && tests.length === 0) {
162
- // 如果是 auto 模式,且最后一个方向都不可见,则直接平移到可见区域
163
- visibleY || (positionTop = window.innerHeight - transformed.height);
164
- visibleX || (positionLeft = window.innerWidth - transformed.width);
201
+ // 获取相对定位的父元素位置
202
+ var offsetParent = overlayNode.offsetParent;
203
+ while (offsetParent &&
204
+ window.getComputedStyle(offsetParent).position === 'static') {
205
+ offsetParent = offsetParent.offsetParent;
206
+ }
207
+ var parentRect = (_a = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(offsetParent);
208
+ var parentTransformed = {
209
+ x: (parentRect === null || parentRect === void 0 ? void 0 : parentRect.x) || 0,
210
+ y: (parentRect === null || parentRect === void 0 ? void 0 : parentRect.y) || 0
211
+ };
212
+ // 如果是 auto 模式,且最后一个方向都不可见,则直接平移到可见区域,考虑相对定位的父元素位置,保留10px的边距
213
+ visibleY ||
214
+ (positionTop =
215
+ Math.max(10, window.innerHeight - transformed.height) +
216
+ scrollParent.scrollTop -
217
+ parentTransformed.y -
218
+ 10);
219
+ visibleX ||
220
+ (positionLeft =
221
+ Math.max(10, window.innerWidth - transformed.width) +
222
+ scrollParent.scrollLeft -
223
+ parentTransformed.x);
165
224
  }
166
225
  }
167
226
  }
@@ -206,7 +265,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
206
265
  else {
207
266
  throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
208
267
  }
209
- var _h = tslib.__read(customOffset, 2), _j = _h[0], offSetX = _j === void 0 ? 0 : _j, _k = _h[1], offSetY = _k === void 0 ? 0 : _k;
268
+ var _m = tslib.__read(customOffset, 2), _o = _m[0], offSetX = _o === void 0 ? 0 : _o, _p = _m[1], offSetY = _p === void 0 ? 0 : _p;
210
269
  return {
211
270
  positionLeft: (positionLeft + offSetX) / scaleX,
212
271
  positionTop: (positionTop + offSetY) / scaleY,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -201,7 +201,7 @@ function isExpression(expression) {
201
201
  }
202
202
  // 备注1: "\\${xxx}"不作为表达式,至少含一个${xxx}才算是表达式
203
203
  // 备注2: safari 不支持 /(?<!\\)(\${).+(\})/.test(expression)
204
- return /(^|[^\\])\$\{.+\}/.test(expression);
204
+ return /(^|[^\\])\$\{[\s\S]+\}/.test(expression);
205
205
  }
206
206
  // 用于判断是否需要执行表达式:
207
207
  function isNeedFormula(expression, prevData, curData) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.2.2
2
+ * amis-core v6.4.0
3
3
  * Copyright 2018-2024 fex
4
4
  */
5
5
 
@@ -384,9 +384,15 @@ export declare function evalTrackExpression(expression: string, data: Record<str
384
384
  export declare function importLazyComponent(mod: any): any;
385
385
  export declare function replaceUrlParams(path: string, params: Record<string, any>): string;
386
386
  export declare const TEST_ID_KEY: 'data-testid';
387
- export declare function buildTestId(testid?: string, data?: PlainObject): {
388
- "data-testid"?: undefined;
389
- } | {
390
- "data-testid": string;
391
- };
392
- export declare function getTestId(testid?: string, data?: PlainObject): string | undefined;
387
+ export declare class TestIdBuilder {
388
+ testId?: string;
389
+ static fast(testId: string): {
390
+ "data-testid": string;
391
+ };
392
+ constructor(testId?: string);
393
+ getChild(childPath: string | number, data?: object): TestIdBuilder;
394
+ getTestId(data?: object): {
395
+ "data-testid": string;
396
+ } | undefined;
397
+ getTestIdValue(data?: object): string | undefined;
398
+ }