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
 
@@ -23,7 +23,7 @@ import { getStoreById } from './manager.js';
23
23
  * 内部列的数量 '__checkme' | '__dragme' | '__expandme'
24
24
  */
25
25
  var PARTITION_INDEX = 3;
26
- function initChildren(children, depth, pindex, parentId, path) {
26
+ function initChildren(children, depth, pindex, parentId, path, getEntryId) {
27
27
  if (path === void 0) { path = ''; }
28
28
  depth += 1;
29
29
  return children.map(function (item, index) {
@@ -33,7 +33,7 @@ function initChildren(children, depth, pindex, parentId, path) {
33
33
  : {
34
34
  item: item
35
35
  };
36
- var id = (_a = item.__id) !== null && _a !== void 0 ? _a : guid();
36
+ var id = String(getEntryId ? getEntryId(item, index) : (_a = item.__id) !== null && _a !== void 0 ? _a : guid());
37
37
  return {
38
38
  // id: String(item && (item as any)[self.primaryField] || `${pindex}-${depth}-${key}`),
39
39
  id: String(id),
@@ -50,7 +50,7 @@ function initChildren(children, depth, pindex, parentId, path) {
50
50
  loading: false,
51
51
  rowSpans: {},
52
52
  children: item && Array.isArray(item.children)
53
- ? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."))
53
+ ? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."), getEntryId)
54
54
  : []
55
55
  };
56
56
  });
@@ -189,11 +189,9 @@ var Row = types
189
189
  return Object.keys(self.data).some(function (key) { return !isEqual(self.data[key], self.pristine[key]); });
190
190
  },
191
191
  getDataWithModifiedChilden: function () {
192
- var data = __assign({}, self.data);
192
+ var data = self.data;
193
193
  if (data.children && self.children) {
194
- data.children = self.children.map(function (item) {
195
- return item.getDataWithModifiedChilden();
196
- });
194
+ data = __assign(__assign({}, data), { children: self.children.map(function (item) { return item.getDataWithModifiedChilden(); }) });
197
195
  }
198
196
  return data;
199
197
  },
@@ -287,6 +285,9 @@ var Row = types
287
285
  toggleExpanded: function () {
288
286
  getParent(self, self.depth * 2).toggleExpanded(self);
289
287
  },
288
+ setExpanded: function (expanded) {
289
+ getParent(self, self.depth * 2).setExpanded(self, expanded);
290
+ },
290
291
  change: function (values, savePristine) {
291
292
  self.data = immutableExtends(self.data, values);
292
293
  savePristine && (self.pristine = self.data);
@@ -1067,7 +1068,7 @@ var TableStore = iRendererStore
1067
1068
  loaded: false,
1068
1069
  loading: false,
1069
1070
  children: item && Array.isArray(item.children)
1070
- ? initChildren(item.children, 1, index, id, "".concat(index, "."))
1071
+ ? initChildren(item.children, 1, index, id, "".concat(index, "."), getEntryId)
1071
1072
  : []
1072
1073
  };
1073
1074
  });
@@ -1315,6 +1316,18 @@ var TableStore = iRendererStore
1315
1316
  self.expandedRows.push(row.id);
1316
1317
  }
1317
1318
  }
1319
+ function setExpanded(row, expanded) {
1320
+ var id = typeof row === 'string' ? row : row.id;
1321
+ var idx = self.expandedRows.indexOf(id);
1322
+ if (expanded) {
1323
+ if (!~idx) {
1324
+ self.expandedRows.push(id);
1325
+ }
1326
+ }
1327
+ else {
1328
+ ~idx && self.expandedRows.splice(idx, 1);
1329
+ }
1330
+ }
1318
1331
  function collapseAllAtDepth(depth) {
1319
1332
  var rows = self.getExpandedRows().filter(function (item) { return item.depth !== depth; });
1320
1333
  self.expandedRows.replace(rows.map(function (item) { return item.id; }));
@@ -1346,6 +1359,9 @@ var TableStore = iRendererStore
1346
1359
  function toggleDragging() {
1347
1360
  self.dragging = !self.dragging;
1348
1361
  }
1362
+ function startDragging() {
1363
+ self.dragging = true;
1364
+ }
1349
1365
  function stopDragging() {
1350
1366
  self.dragging = false;
1351
1367
  }
@@ -1447,12 +1463,14 @@ var TableStore = iRendererStore
1447
1463
  getToggleShiftRows: getToggleShiftRows,
1448
1464
  toggleExpandAll: toggleExpandAll,
1449
1465
  toggleExpanded: toggleExpanded,
1466
+ setExpanded: setExpanded,
1450
1467
  collapseAllAtDepth: collapseAllAtDepth,
1451
1468
  clear: clear,
1452
1469
  setOrderByInfo: setOrderByInfo,
1453
1470
  changeOrder: changeOrder,
1454
1471
  reset: reset,
1455
1472
  toggleDragging: toggleDragging,
1473
+ startDragging: startDragging,
1456
1474
  stopDragging: stopDragging,
1457
1475
  exchange: exchange,
1458
1476
  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/esm/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
 
@@ -109,7 +109,9 @@ function themeable(ComposedComponent) {
109
109
  classnames: config.classnames,
110
110
  theme: theme
111
111
  };
112
- var refConfig = ((_a = ComposedComponent.prototype) === null || _a === void 0 ? void 0 : _a.isReactComponent)
112
+ var refConfig = ((_a = ComposedComponent.prototype) === null || _a === void 0 ? void 0 : _a.isReactComponent) ||
113
+ ComposedComponent.$$typeof ===
114
+ Symbol.for('react.forward_ref')
113
115
  ? { ref: this.childRef }
114
116
  : { forwardedRef: this.childRef };
115
117
  var body = (React.createElement(ComposedComponent, __assign({}, config.getComponentConfig(ComposedComponent.themeKey), this.props, injectedProps, refConfig)));
package/esm/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/esm/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/esm/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/esm/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
 
@@ -8,6 +8,7 @@ import ReactDOM from 'react-dom';
8
8
  import React from 'react';
9
9
  import { offset } from './offset.js';
10
10
  import { position } from './position.js';
11
+ import { getScrollParent } from './helper.js';
11
12
 
12
13
  function getContainer(container, defaultContainer) {
13
14
  container = typeof container === 'function' ? container() : container;
@@ -64,12 +65,14 @@ function getLeftDelta(left, overlayWidth, container, padding) {
64
65
  return 0;
65
66
  }
66
67
  function calculatePosition(placement, overlayNode, target, container, padding, customOffset) {
68
+ var _a;
67
69
  if (padding === void 0) { padding = 0; }
68
70
  if (customOffset === void 0) { customOffset = [0, 0]; }
71
+ var scrollParent = getScrollParent(container);
69
72
  var childOffset = container.tagName === 'BODY'
70
73
  ? offset(target)
71
74
  : position(target, container);
72
- var _a = offset(overlayNode), overlayHeight = _a.height, overlayWidth = _a.width;
75
+ var _b = offset(overlayNode), overlayHeight = _b.height, overlayWidth = _b.width;
73
76
  var clip = container.getBoundingClientRect();
74
77
  var clip2 = overlayNode.getBoundingClientRect();
75
78
  var scaleX = overlayNode.offsetWidth
@@ -86,6 +89,40 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
86
89
  ? "left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom ".concat(autoDefaultPlacement)
87
90
  : placement;
88
91
  var positionLeft = 0, positionTop = 0, arrowOffsetLeft = '', arrowOffsetTop = '', activePlacement = placement;
92
+ // 如果是作为菜单浮层,不再基于四个方向对齐,而是模拟原生右键菜单定位:
93
+ // 1.计算放右边,还是左边
94
+ // 2.计算能否放在下面,如果不能则贴底
95
+ // 3.由于是基于一个点此时不考虑 arrow
96
+ if (placement === 'asContextMenu') {
97
+ if (childOffset.left + 1 + overlayWidth <= clip.width) {
98
+ // 放右边
99
+ positionLeft = childOffset.left + 1;
100
+ }
101
+ else if (childOffset.left - overlayWidth >= 0) {
102
+ // 放左边
103
+ positionLeft = childOffset.left - overlayWidth;
104
+ }
105
+ else {
106
+ // 兜底贴右边
107
+ positionLeft = Math.max(clip.width - overlayWidth, 10);
108
+ }
109
+ if (childOffset.top + 1 + overlayHeight <= clip.height) {
110
+ // 放下面
111
+ positionTop = childOffset.top + 1;
112
+ }
113
+ else {
114
+ // 贴底边,预留5px避免完全贴底
115
+ positionTop = Math.max(clip.height - overlayHeight - 5, 10);
116
+ }
117
+ var _c = __read(customOffset, 2), _d = _c[0], offSetX_1 = _d === void 0 ? 0 : _d, _e = _c[1], offSetY_1 = _e === void 0 ? 0 : _e;
118
+ return {
119
+ positionLeft: (positionLeft + offSetX_1) / scaleX,
120
+ positionTop: (positionTop + offSetY_1) / scaleY,
121
+ arrowOffsetLeft: arrowOffsetLeft,
122
+ arrowOffsetTop: arrowOffsetTop,
123
+ activePlacement: activePlacement
124
+ };
125
+ }
89
126
  if (~placement.indexOf('-')) {
90
127
  var tests = placement.split(/\s+/);
91
128
  // 收集可见方向
@@ -95,11 +132,11 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
95
132
  // 自动对齐模式下,当四个方向都无法完全可见时
96
133
  // 根据之前的计算结果,使用收集的可见方向作为兜底,避免完全不可见
97
134
  if (isAuto && tests.length === 0) {
98
- var _b = __read(autoDefaultPlacement.split('-'), 4), _atX = _b[0], _atY = _b[1], _myX = _b[2], _myY = _b[3];
99
- 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;
135
+ var _f = __read(autoDefaultPlacement.split('-'), 4), _atX = _f[0], _atY = _f[1], _myX = _f[2], _myY = _f[3];
136
+ 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;
100
137
  current = activePlacement = [atX_1, atY_1, myX_1, myY_1].join('-');
101
138
  }
102
- var _g = __read(current.split('-'), 4), atX = _g[0], atY = _g[1], myX = _g[2], myY = _g[3];
139
+ var _l = __read(current.split('-'), 4), atX = _l[0], atY = _l[1], myX = _l[2], myY = _l[3];
103
140
  myX = myX || atX;
104
141
  myY = myY || atY;
105
142
  positionLeft =
@@ -132,14 +169,16 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
132
169
  };
133
170
  var visibleX = false;
134
171
  var visibleY = false;
135
- if (transformed.x > 0 &&
136
- transformed.x + transformed.width < window.innerWidth) {
172
+ if (transformed.x >= 0 &&
173
+ transformed.x + transformed.width <
174
+ window.innerWidth + scrollParent.scrollLeft) {
137
175
  visibleX = true;
138
176
  !visiblePlacement.atX && (visiblePlacement.atX = atX);
139
177
  !visiblePlacement.myX && (visiblePlacement.myX = myX);
140
178
  }
141
- if (transformed.y > 0 &&
142
- transformed.y + transformed.height < window.innerHeight) {
179
+ if (transformed.y >= 0 &&
180
+ transformed.y + transformed.height <
181
+ window.innerHeight + scrollParent.scrollTop) {
143
182
  visibleY = true;
144
183
  !visiblePlacement.atY && (visiblePlacement.atY = atY);
145
184
  !visiblePlacement.myY && (visiblePlacement.myY = myY);
@@ -148,9 +187,29 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
148
187
  break;
149
188
  }
150
189
  else if (isAuto && tests.length === 0) {
151
- // 如果是 auto 模式,且最后一个方向都不可见,则直接平移到可见区域
152
- visibleY || (positionTop = window.innerHeight - transformed.height);
153
- visibleX || (positionLeft = window.innerWidth - transformed.width);
190
+ // 获取相对定位的父元素位置
191
+ var offsetParent = overlayNode.offsetParent;
192
+ while (offsetParent &&
193
+ window.getComputedStyle(offsetParent).position === 'static') {
194
+ offsetParent = offsetParent.offsetParent;
195
+ }
196
+ var parentRect = (_a = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(offsetParent);
197
+ var parentTransformed = {
198
+ x: (parentRect === null || parentRect === void 0 ? void 0 : parentRect.x) || 0,
199
+ y: (parentRect === null || parentRect === void 0 ? void 0 : parentRect.y) || 0
200
+ };
201
+ // 如果是 auto 模式,且最后一个方向都不可见,则直接平移到可见区域,考虑相对定位的父元素位置,保留10px的边距
202
+ visibleY ||
203
+ (positionTop =
204
+ Math.max(10, window.innerHeight - transformed.height) +
205
+ scrollParent.scrollTop -
206
+ parentTransformed.y -
207
+ 10);
208
+ visibleX ||
209
+ (positionLeft =
210
+ Math.max(10, window.innerWidth - transformed.width) +
211
+ scrollParent.scrollLeft -
212
+ parentTransformed.x);
154
213
  }
155
214
  }
156
215
  }
@@ -195,7 +254,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
195
254
  else {
196
255
  throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
197
256
  }
198
- var _h = __read(customOffset, 2), _j = _h[0], offSetX = _j === void 0 ? 0 : _j, _k = _h[1], offSetY = _k === void 0 ? 0 : _k;
257
+ var _m = __read(customOffset, 2), _o = _m[0], offSetX = _o === void 0 ? 0 : _o, _p = _m[1], offSetY = _p === void 0 ? 0 : _p;
199
258
  return {
200
259
  positionLeft: (positionLeft + offSetX) / scaleX,
201
260
  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
 
@@ -191,7 +191,7 @@ function isExpression(expression) {
191
191
  }
192
192
  // 备注1: "\\${xxx}"不作为表达式,至少含一个${xxx}才算是表达式
193
193
  // 备注2: safari 不支持 /(?<!\\)(\${).+(\})/.test(expression)
194
- return /(^|[^\\])\$\{.+\}/.test(expression);
194
+ return /(^|[^\\])\$\{[\s\S]+\}/.test(expression);
195
195
  }
196
196
  // 用于判断是否需要执行表达式:
197
197
  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
+ }