amis-core 6.13.0-beta.8 → 6.13.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 (322) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +4 -2
  3. package/esm/SchemaRenderer.js +4 -4
  4. package/esm/Scoped.js +1 -1
  5. package/esm/StatusScoped.js +1 -1
  6. package/esm/StyleManager.js +1 -1
  7. package/esm/WithRootStore.js +1 -1
  8. package/esm/WithStore.js +2 -2
  9. package/esm/actions/Action.js +60 -15
  10. package/esm/actions/AjaxAction.js +2 -2
  11. package/esm/actions/BreakAction.js +1 -1
  12. package/esm/actions/BroadcastAction.js +1 -1
  13. package/esm/actions/CmptAction.js +48 -43
  14. package/esm/actions/ContinueAction.js +1 -1
  15. package/esm/actions/CopyAction.js +1 -1
  16. package/esm/actions/CustomAction.js +7 -7
  17. package/esm/actions/DialogAction.js +8 -8
  18. package/esm/actions/DrawerAction.js +8 -8
  19. package/esm/actions/EmailAction.js +1 -1
  20. package/esm/actions/EventAction.js +9 -9
  21. package/esm/actions/LinkAction.js +1 -1
  22. package/esm/actions/LoopAction.js +1 -1
  23. package/esm/actions/PageAction.js +1 -1
  24. package/esm/actions/ParallelAction.js +1 -1
  25. package/esm/actions/PrintAction.js +1 -1
  26. package/esm/actions/StatusAction.js +1 -1
  27. package/esm/actions/SwitchAction.js +1 -1
  28. package/esm/actions/ToastAction.js +1 -1
  29. package/esm/actions/WaitAction.js +1 -1
  30. package/esm/components/Animations.js +7 -7
  31. package/esm/components/CustomStyle.js +1 -1
  32. package/esm/components/ErrorBoundary.js +1 -1
  33. package/esm/components/LazyComponent.js +1 -1
  34. package/esm/components/Overlay.js +7 -7
  35. package/esm/components/PopOver.js +9 -7
  36. package/esm/env.js +1 -1
  37. package/esm/envOverwrite.js +1 -1
  38. package/esm/factory.js +1 -1
  39. package/esm/globalVar.js +1 -1
  40. package/esm/globalVarClientHandler.js +1 -1
  41. package/esm/globalVarDefaultValueHandler.js +1 -1
  42. package/esm/index.d.ts +4 -4
  43. package/esm/index.js +8 -8
  44. package/esm/locale.js +1 -1
  45. package/esm/polyfills.js +1 -1
  46. package/esm/renderers/Form.d.ts +7 -1
  47. package/esm/renderers/Form.js +72 -21
  48. package/esm/renderers/Item.d.ts +75 -33
  49. package/esm/renderers/Item.js +8 -2
  50. package/esm/renderers/Options.d.ts +14 -8
  51. package/esm/renderers/Options.js +1 -1
  52. package/esm/renderers/Placeholder.js +1 -1
  53. package/esm/renderers/builtin.js +1 -1
  54. package/esm/renderers/register.js +1 -1
  55. package/esm/renderers/wrapControl.d.ts +0 -1
  56. package/esm/renderers/wrapControl.js +21 -11
  57. package/esm/store/app.d.ts +1 -0
  58. package/esm/store/app.js +14 -8
  59. package/esm/store/combo.d.ts +126 -0
  60. package/esm/store/combo.js +24 -2
  61. package/esm/store/crud.d.ts +1 -0
  62. package/esm/store/crud.js +5 -2
  63. package/esm/store/form.d.ts +50 -0
  64. package/esm/store/form.js +3 -3
  65. package/esm/store/formItem.d.ts +1 -0
  66. package/esm/store/formItem.js +4 -2
  67. package/esm/store/iRenderer.js +1 -1
  68. package/esm/store/index.js +1 -1
  69. package/esm/store/list.js +1 -1
  70. package/esm/store/manager.js +1 -1
  71. package/esm/store/modal.d.ts +5 -0
  72. package/esm/store/modal.js +14 -2
  73. package/esm/store/node.js +1 -1
  74. package/esm/store/pagination.js +1 -1
  75. package/esm/store/root.d.ts +3 -0
  76. package/esm/store/root.js +73 -20
  77. package/esm/store/service.js +8 -8
  78. package/esm/store/status.js +1 -1
  79. package/esm/store/table.d.ts +102 -1
  80. package/esm/store/table.js +9 -3
  81. package/esm/store/table2.js +1 -1
  82. package/esm/theme.js +1 -1
  83. package/esm/types.d.ts +10 -6
  84. package/esm/utils/Animation.js +1 -1
  85. package/esm/utils/ColorScale.js +1 -1
  86. package/esm/utils/DataSchema.js +1 -1
  87. package/esm/utils/DataScope.js +1 -1
  88. package/esm/utils/RootClose.js +1 -1
  89. package/esm/utils/SimpleMap.js +1 -1
  90. package/esm/utils/animations.js +1 -1
  91. package/esm/utils/api.js +1 -1
  92. package/esm/utils/arraySlice.js +1 -1
  93. package/esm/utils/attachmentAdpator.js +1 -1
  94. package/esm/utils/autobind.js +1 -1
  95. package/esm/utils/browser.js +1 -1
  96. package/esm/utils/columnsSplit.js +1 -1
  97. package/esm/utils/concatData.js +1 -1
  98. package/esm/utils/dataMapping.js +1 -1
  99. package/esm/utils/date.js +12 -12
  100. package/esm/utils/debug.js +1 -1
  101. package/esm/utils/decodeEntity.js +1 -1
  102. package/esm/utils/dom.js +1 -1
  103. package/esm/utils/errors.js +1 -1
  104. package/esm/utils/escapeHtml.js +1 -1
  105. package/esm/utils/filter-schema.js +1 -1
  106. package/esm/utils/filter.js +1 -1
  107. package/esm/utils/formatDuration.js +1 -1
  108. package/esm/utils/formula.js +2 -2
  109. package/esm/utils/getPageId.js +1 -1
  110. package/esm/utils/getVariable.js +1 -1
  111. package/esm/utils/grammar.js +1 -1
  112. package/esm/utils/handleAction.js +1 -1
  113. package/esm/utils/helper.js +3 -3
  114. package/esm/utils/highlight.js +1 -1
  115. package/esm/utils/icon.js +1 -1
  116. package/esm/utils/image.js +1 -1
  117. package/esm/utils/index.d.ts +1 -1
  118. package/esm/utils/index.js +9 -9
  119. package/esm/utils/isPureVariable.js +1 -1
  120. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  121. package/esm/utils/keyToPath.js +1 -1
  122. package/esm/utils/labelToString.js +1 -1
  123. package/esm/utils/loopTooMuch.js +1 -1
  124. package/esm/utils/makeSorter.js +1 -1
  125. package/esm/utils/math.js +1 -1
  126. package/esm/utils/memoryParse.js +1 -1
  127. package/esm/utils/normalizeLink.js +1 -1
  128. package/esm/utils/normalizeOptions.js +1 -1
  129. package/esm/utils/object.js +1 -1
  130. package/esm/utils/offset.js +1 -1
  131. package/esm/utils/offsetParent.js +1 -1
  132. package/esm/utils/optionValueCompare.js +1 -1
  133. package/esm/utils/position.js +1 -1
  134. package/esm/utils/prettyBytes.js +1 -1
  135. package/esm/utils/printElement.js +1 -1
  136. package/esm/utils/renderer-event.js +1 -1
  137. package/esm/utils/replaceText.js +1 -1
  138. package/esm/utils/resize-sensor.d.ts +3 -1
  139. package/esm/utils/resize-sensor.js +63 -29
  140. package/esm/utils/resolveCondition.js +2 -2
  141. package/esm/utils/resolveVariable.js +1 -1
  142. package/esm/utils/resolveVariableAndFilter.js +4 -3
  143. package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
  144. package/esm/utils/scrollPosition.js +1 -1
  145. package/esm/utils/string2regExp.js +1 -1
  146. package/esm/utils/stripNumber.js +1 -1
  147. package/esm/utils/style-helper.d.ts +12 -1
  148. package/esm/utils/style-helper.js +30 -18
  149. package/esm/utils/style.d.ts +13 -0
  150. package/esm/utils/style.js +44 -4
  151. package/esm/utils/toNumber.js +1 -1
  152. package/esm/utils/tokenize.js +1 -1
  153. package/esm/utils/tpl-builtin.d.ts +1 -0
  154. package/esm/utils/tpl-builtin.js +7 -3
  155. package/esm/utils/tpl-lodash.js +1 -1
  156. package/esm/utils/tpl.js +1 -1
  157. package/esm/utils/uncontrollable.js +1 -1
  158. package/esm/utils/validateId.js +1 -1
  159. package/esm/utils/validations.js +2 -2
  160. package/esm/utils/visitedCache.js +1 -1
  161. package/lib/Root.js +1 -1
  162. package/lib/RootRenderer.d.ts +1 -1
  163. package/lib/RootRenderer.js +4 -2
  164. package/lib/SchemaRenderer.js +3 -3
  165. package/lib/Scoped.js +1 -1
  166. package/lib/StatusScoped.js +1 -1
  167. package/lib/StyleManager.js +1 -1
  168. package/lib/WithRootStore.js +1 -1
  169. package/lib/WithStore.js +2 -2
  170. package/lib/actions/Action.js +62 -14
  171. package/lib/actions/AjaxAction.js +2 -2
  172. package/lib/actions/BreakAction.js +1 -1
  173. package/lib/actions/BroadcastAction.js +1 -1
  174. package/lib/actions/CmptAction.js +48 -43
  175. package/lib/actions/ContinueAction.js +1 -1
  176. package/lib/actions/CopyAction.js +1 -1
  177. package/lib/actions/CustomAction.js +7 -7
  178. package/lib/actions/DialogAction.js +8 -8
  179. package/lib/actions/DrawerAction.js +8 -8
  180. package/lib/actions/EmailAction.js +1 -1
  181. package/lib/actions/EventAction.js +9 -9
  182. package/lib/actions/LinkAction.js +1 -1
  183. package/lib/actions/LoopAction.js +1 -1
  184. package/lib/actions/PageAction.js +1 -1
  185. package/lib/actions/ParallelAction.js +1 -1
  186. package/lib/actions/PrintAction.js +1 -1
  187. package/lib/actions/StatusAction.js +1 -1
  188. package/lib/actions/SwitchAction.js +1 -1
  189. package/lib/actions/ToastAction.js +1 -1
  190. package/lib/actions/WaitAction.js +1 -1
  191. package/lib/components/Animations.js +7 -7
  192. package/lib/components/CustomStyle.js +1 -1
  193. package/lib/components/ErrorBoundary.js +1 -1
  194. package/lib/components/LazyComponent.js +1 -1
  195. package/lib/components/Overlay.js +7 -7
  196. package/lib/components/PopOver.js +9 -7
  197. package/lib/env.js +1 -1
  198. package/lib/envOverwrite.js +1 -1
  199. package/lib/factory.js +1 -1
  200. package/lib/globalVar.js +1 -1
  201. package/lib/globalVarClientHandler.js +1 -1
  202. package/lib/globalVarDefaultValueHandler.js +1 -1
  203. package/lib/index.d.ts +4 -4
  204. package/lib/index.js +12 -6
  205. package/lib/locale.js +1 -1
  206. package/lib/polyfills.js +1 -1
  207. package/lib/renderers/Form.d.ts +7 -1
  208. package/lib/renderers/Form.js +71 -20
  209. package/lib/renderers/Item.d.ts +75 -33
  210. package/lib/renderers/Item.js +8 -2
  211. package/lib/renderers/Options.d.ts +14 -8
  212. package/lib/renderers/Options.js +1 -1
  213. package/lib/renderers/Placeholder.js +1 -1
  214. package/lib/renderers/builtin.js +1 -1
  215. package/lib/renderers/register.js +1 -1
  216. package/lib/renderers/wrapControl.d.ts +0 -1
  217. package/lib/renderers/wrapControl.js +21 -11
  218. package/lib/store/app.d.ts +1 -0
  219. package/lib/store/app.js +14 -8
  220. package/lib/store/combo.d.ts +150 -25
  221. package/lib/store/combo.js +24 -2
  222. package/lib/store/crud.d.ts +1 -0
  223. package/lib/store/crud.js +5 -2
  224. package/lib/store/form.d.ts +60 -11
  225. package/lib/store/form.js +3 -3
  226. package/lib/store/formItem.d.ts +1 -0
  227. package/lib/store/formItem.js +4 -2
  228. package/lib/store/iRenderer.js +1 -1
  229. package/lib/store/index.js +1 -1
  230. package/lib/store/list.js +1 -1
  231. package/lib/store/manager.js +1 -1
  232. package/lib/store/modal.d.ts +5 -0
  233. package/lib/store/modal.js +14 -2
  234. package/lib/store/node.js +1 -1
  235. package/lib/store/pagination.js +1 -1
  236. package/lib/store/root.d.ts +3 -1
  237. package/lib/store/root.js +72 -19
  238. package/lib/store/service.js +8 -8
  239. package/lib/store/status.js +1 -1
  240. package/lib/store/table.d.ts +122 -22
  241. package/lib/store/table.js +9 -3
  242. package/lib/store/table2.js +1 -1
  243. package/lib/theme.js +1 -1
  244. package/lib/types.d.ts +10 -6
  245. package/lib/utils/Animation.js +1 -1
  246. package/lib/utils/ColorScale.js +1 -1
  247. package/lib/utils/DataSchema.js +1 -1
  248. package/lib/utils/DataScope.js +1 -1
  249. package/lib/utils/RootClose.js +1 -1
  250. package/lib/utils/SimpleMap.js +1 -1
  251. package/lib/utils/animations.js +1 -1
  252. package/lib/utils/api.js +1 -1
  253. package/lib/utils/arraySlice.js +1 -1
  254. package/lib/utils/attachmentAdpator.js +1 -1
  255. package/lib/utils/autobind.js +1 -1
  256. package/lib/utils/browser.js +1 -1
  257. package/lib/utils/columnsSplit.js +1 -1
  258. package/lib/utils/concatData.js +1 -1
  259. package/lib/utils/dataMapping.js +1 -1
  260. package/lib/utils/date.js +12 -12
  261. package/lib/utils/debug.js +1 -1
  262. package/lib/utils/decodeEntity.js +1 -1
  263. package/lib/utils/dom.js +1 -1
  264. package/lib/utils/errors.js +1 -1
  265. package/lib/utils/escapeHtml.js +1 -1
  266. package/lib/utils/filter-schema.js +1 -1
  267. package/lib/utils/filter.js +1 -1
  268. package/lib/utils/formatDuration.js +1 -1
  269. package/lib/utils/formula.js +2 -2
  270. package/lib/utils/getPageId.js +1 -1
  271. package/lib/utils/getVariable.js +1 -1
  272. package/lib/utils/grammar.js +1 -1
  273. package/lib/utils/handleAction.js +1 -1
  274. package/lib/utils/helper.js +3 -3
  275. package/lib/utils/highlight.js +1 -1
  276. package/lib/utils/icon.js +1 -1
  277. package/lib/utils/image.js +1 -1
  278. package/lib/utils/index.d.ts +1 -1
  279. package/lib/utils/index.js +22 -20
  280. package/lib/utils/isPureVariable.js +1 -1
  281. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  282. package/lib/utils/keyToPath.js +1 -1
  283. package/lib/utils/labelToString.js +1 -1
  284. package/lib/utils/loopTooMuch.js +1 -1
  285. package/lib/utils/makeSorter.js +1 -1
  286. package/lib/utils/math.js +1 -1
  287. package/lib/utils/memoryParse.js +1 -1
  288. package/lib/utils/normalizeLink.js +1 -1
  289. package/lib/utils/normalizeOptions.js +1 -1
  290. package/lib/utils/object.js +1 -1
  291. package/lib/utils/offset.js +1 -1
  292. package/lib/utils/offsetParent.js +1 -1
  293. package/lib/utils/optionValueCompare.js +1 -1
  294. package/lib/utils/position.js +1 -1
  295. package/lib/utils/prettyBytes.js +1 -1
  296. package/lib/utils/printElement.js +1 -1
  297. package/lib/utils/renderer-event.js +1 -1
  298. package/lib/utils/replaceText.js +1 -1
  299. package/lib/utils/resize-sensor.d.ts +3 -1
  300. package/lib/utils/resize-sensor.js +64 -28
  301. package/lib/utils/resolveCondition.js +2 -2
  302. package/lib/utils/resolveVariable.js +1 -1
  303. package/lib/utils/resolveVariableAndFilter.js +3 -2
  304. package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
  305. package/lib/utils/scrollPosition.js +1 -1
  306. package/lib/utils/string2regExp.js +1 -1
  307. package/lib/utils/stripNumber.js +1 -1
  308. package/lib/utils/style-helper.d.ts +12 -1
  309. package/lib/utils/style-helper.js +30 -17
  310. package/lib/utils/style.d.ts +13 -0
  311. package/lib/utils/style.js +45 -3
  312. package/lib/utils/toNumber.js +1 -1
  313. package/lib/utils/tokenize.js +1 -1
  314. package/lib/utils/tpl-builtin.d.ts +1 -0
  315. package/lib/utils/tpl-builtin.js +7 -2
  316. package/lib/utils/tpl-lodash.js +1 -1
  317. package/lib/utils/tpl.js +1 -1
  318. package/lib/utils/uncontrollable.js +1 -1
  319. package/lib/utils/validateId.js +1 -1
  320. package/lib/utils/validations.js +2 -2
  321. package/lib/utils/visitedCache.js +1 -1
  322. package/package.json +5 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -18,9 +18,9 @@ var tpl = require('../utils/tpl.js');
18
18
  require('amis-formula');
19
19
  require('moment');
20
20
  var object = require('../utils/object.js');
21
+ var resolveVariableAndFilter = require('../utils/resolveVariableAndFilter.js');
21
22
  require('../utils/memoryParse.js');
22
23
  require('@rc-component/mini-decimal');
23
- var resolveVariableAndFilter = require('../utils/resolveVariableAndFilter.js');
24
24
  var dataMapping = require('../utils/dataMapping.js');
25
25
  require('../utils/filter.js');
26
26
  var api = require('../utils/api.js');
@@ -81,6 +81,7 @@ var FormItemStore = node.StoreNode.named('FormItemStore')
81
81
  itemsRef: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.string), []),
82
82
  inited: false,
83
83
  validated: false,
84
+ validatedAt: 0,
84
85
  validating: false,
85
86
  multiple: false,
86
87
  delimiter: ',',
@@ -419,6 +420,7 @@ var FormItemStore = node.StoreNode.named('FormItemStore')
419
420
  }
420
421
  }
421
422
  self.validating = false;
423
+ self.validatedAt = Date.now();
422
424
  return [2 /*return*/, self.valid];
423
425
  }
424
426
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
package/lib/store/list.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -34,8 +34,10 @@ export declare const ModalStore: import("mobx-state-tree").IModelType<{
34
34
  } & {
35
35
  form: import("mobx-state-tree").IType<any, any, any>;
36
36
  entered: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
37
+ dragging: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
37
38
  resizeCoord: import("mobx-state-tree").IType<number | undefined, number, number>;
38
39
  schema: import("mobx-state-tree").IType<any, any, any>;
40
+ isFullscreen: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
39
41
  }, {
40
42
  readonly parentStore: any;
41
43
  readonly __: any;
@@ -83,12 +85,15 @@ export declare const ModalStore: import("mobx-state-tree").IModelType<{
83
85
  checkRemote: (api: import("..").Api, data?: object | undefined, options?: import("..").fetchOptions | undefined) => Promise<any>;
84
86
  } & {
85
87
  readonly formData: object;
88
+ readonly inDragging: boolean;
86
89
  } & {
87
90
  setEntered(value: boolean): void;
91
+ setDragging(value: boolean): void;
88
92
  setFormData(obj: any): void;
89
93
  reset(): void;
90
94
  setResizeCoord(value: number): void;
91
95
  setSchema(schema: any): void;
96
+ setFullScreen(isFullscreen?: boolean): void;
92
97
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
93
98
  export type IModalStore = Instance<typeof ModalStore>;
94
99
  export type SModalStore = SnapshotIn<typeof ModalStore>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -16,13 +16,18 @@ var ModalStore = service.ServiceStore.named('ModalStore')
16
16
  .props({
17
17
  form: mobxStateTree.types.frozen(),
18
18
  entered: false,
19
+ dragging: false,
19
20
  resizeCoord: 0,
20
- schema: mobxStateTree.types.frozen()
21
+ schema: mobxStateTree.types.frozen(),
22
+ isFullscreen: false
21
23
  })
22
24
  .views(function (self) {
23
25
  return {
24
26
  get formData() {
25
27
  return object.createObject(self.data, self.form);
28
+ },
29
+ get inDragging() {
30
+ return self.dragging;
26
31
  }
27
32
  };
28
33
  })
@@ -31,6 +36,9 @@ var ModalStore = service.ServiceStore.named('ModalStore')
31
36
  setEntered: function (value) {
32
37
  self.entered = value;
33
38
  },
39
+ setDragging: function (value) {
40
+ self.dragging = value;
41
+ },
34
42
  setFormData: function (obj) {
35
43
  self.form = obj;
36
44
  },
@@ -47,6 +55,10 @@ var ModalStore = service.ServiceStore.named('ModalStore')
47
55
  return;
48
56
  }
49
57
  self.schema = schema;
58
+ },
59
+ setFullScreen: function (isFullscreen) {
60
+ if (isFullscreen === void 0) { isFullscreen = false; }
61
+ self.isFullscreen = isFullscreen;
50
62
  }
51
63
  };
52
64
  });
package/lib/store/node.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -1,4 +1,3 @@
1
- /// <reference types="lodash" />
2
1
  import { Instance } from 'mobx-state-tree';
3
2
  import { GlobalVariableItem, GlobalVariableState, GlobalVariableItemFull } from '../globalVar';
4
3
  export declare const RootStore: import("mobx-state-tree").IModelType<{
@@ -94,6 +93,7 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
94
93
  readonly nextGlobalData: any;
95
94
  readonly downStream: any;
96
95
  } & {
96
+ updateContextBySetter(context: any): void;
97
97
  updateContext(context: any, isInit?: boolean): void;
98
98
  updateGlobalVarState(key: string, state: Partial<GlobalVariableState>): void;
99
99
  setGlobalVars: (vars?: Array<GlobalVariableItem>) => Promise<any>;
@@ -107,7 +107,9 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
107
107
  updateLocation(location?: any, parseFn?: Function): void;
108
108
  init: (schema: any) => Promise<any>;
109
109
  syncGlobalVarStates: () => void;
110
+ syncLegacyGlobalVarStates: () => void;
110
111
  addSyncGlobalVarStatePendingTask: (fn: (callback: () => void) => void, callback?: () => void) => void;
112
+ afterCreate(): void;
111
113
  afterDestroy(): void;
112
114
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
113
115
  export type IRootStore = Instance<typeof RootStore>;
package/lib/store/root.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -11,27 +11,27 @@ var tslib = require('tslib');
11
11
  var mobxStateTree = require('mobx-state-tree');
12
12
  var helper = require('../utils/helper.js');
13
13
  var service = require('./service.js');
14
+ require('amis-formula');
15
+ require('moment');
16
+ var object = require('../utils/object.js');
17
+ require('../utils/memoryParse.js');
18
+ require('@rc-component/mini-decimal');
19
+ var isPlainObject = require('lodash/isPlainObject');
20
+ require('../utils/filter.js');
14
21
  require('../utils/api.js');
15
22
  require('file-saver');
16
23
  require('../utils/browser.js');
17
24
  require('../utils/ColorScale.js');
18
25
  require('../utils/columnsSplit.js');
19
- var object = require('../utils/object.js');
20
- require('../utils/memoryParse.js');
21
- require('amis-formula');
22
- var isPlainObject = require('lodash/isPlainObject');
23
26
  require('../utils/DataSchema.js');
24
27
  require('../utils/DataScope.js');
25
- require('moment');
26
28
  require('../utils/debug.js');
27
29
  require('../utils/dom.js');
28
30
  require('../utils/errors.js');
29
31
  require('../utils/tpl.js');
30
- require('../utils/filter.js');
31
32
  require('lodash/isObject');
32
33
  require('lodash/isString');
33
34
  require('lodash/isBoolean');
34
- require('@rc-component/mini-decimal');
35
35
  require('../utils/highlight.js');
36
36
  require('../utils/icon.js');
37
37
  require('../utils/image.js');
@@ -53,7 +53,7 @@ require('uncontrollable');
53
53
  require('hoist-non-react-statics');
54
54
  require('../utils/validations.js');
55
55
  require('../utils/resolveCondition.js');
56
- require('mobx');
56
+ var mobx = require('mobx');
57
57
  require('../utils/Animation.js');
58
58
  var globalVar = require('../globalVar.js');
59
59
 
@@ -422,17 +422,18 @@ var RootStore = service.ServiceStore.named('RootStore')
422
422
  }
423
423
  // 设置全局变量,返回一个Promise
424
424
  var setGlobalVars = mobxStateTree.flow(function setGlobalVars(vars) {
425
- var _a, newVars, updateVars, removeVars, _b;
426
- return tslib.__generator(this, function (_c) {
427
- switch (_c.label) {
425
+ var _a, newVars, updateVars, removeVars, globalVars;
426
+ return tslib.__generator(this, function (_b) {
427
+ switch (_b.label) {
428
428
  case 0:
429
429
  _a = diffVariables(vars || [], self.globalVars), newVars = _a.newVars, updateVars = _a.updateVars, removeVars = _a.removeVars;
430
- // 初始化全局变量
431
- _b = self;
432
430
  return [4 /*yield*/, initializeGlobalVars(newVars, updateVars)];
433
431
  case 1:
434
- // 初始化全局变量
435
- _b.globalVars = _c.sent();
432
+ globalVars = _b.sent();
433
+ if (!mobxStateTree.isAlive(self)) {
434
+ return [2 /*return*/];
435
+ }
436
+ self.globalVars = globalVars;
436
437
  removeVars.forEach(function (item) {
437
438
  self.globalVarTempStates.delete(item.key);
438
439
  });
@@ -613,6 +614,8 @@ var RootStore = service.ServiceStore.named('RootStore')
613
614
  self.globalVarTempStates.forEach(function (state, key) {
614
615
  self.globalVarStates.set(key, tslib.__assign({}, state));
615
616
  });
617
+ }
618
+ function syncLegacyGlobalVarStates() {
616
619
  if (self.legacyGlobalTempContext.__page !== self.context.__page ||
617
620
  self.legacyGlobalTempContext.appVariables !== self.context.appVariables) {
618
621
  Object.assign(self.context, self.legacyGlobalTempContext);
@@ -629,11 +632,40 @@ var RootStore = service.ServiceStore.named('RootStore')
629
632
  if (pendingCount === 0) {
630
633
  callbacks.forEach(function (callback) { return callback(); });
631
634
  callbacks = [];
632
- self.syncGlobalVarStates();
635
+ if (mobxStateTree.isAlive(self)) {
636
+ self.syncGlobalVarStates();
637
+ self.syncLegacyGlobalVarStates();
638
+ }
639
+ }
640
+ });
641
+ }
642
+ function observeSet(obj, callback) {
643
+ if (!obj || obj.__observed) {
644
+ // 如果已经被观察过了,就不需要再观察了
645
+ return obj;
646
+ }
647
+ var timer = 0;
648
+ return new Proxy(tslib.__assign({}, obj), {
649
+ get: function (target, prop) {
650
+ if (prop === '__observed') {
651
+ return true;
652
+ }
653
+ return Reflect.get(target, prop);
654
+ },
655
+ set: function (target, prop, value) {
656
+ Reflect.set(target, prop, value);
657
+ cancelAnimationFrame(timer);
658
+ timer = requestAnimationFrame(function () { return callback(target); });
659
+ console.warn("Don't modify the context directly.");
660
+ return true;
633
661
  }
634
662
  });
635
663
  }
636
664
  return {
665
+ updateContextBySetter: function (context) {
666
+ this.updateContext(context);
667
+ self.data = object.cloneObject(self.data);
668
+ },
637
669
  updateContext: function (context, isInit) {
638
670
  // 因为 context 不是受控属性,直接共用引用好了
639
671
  // 否则还会触发孩子节点的重新渲染
@@ -641,9 +673,22 @@ var RootStore = service.ServiceStore.named('RootStore')
641
673
  var _a = context || {}, __page = _a.__page, appVariables = _a.appVariables, rest = tslib.__rest(_a, ["__page", "appVariables"]);
642
674
  // 对历史用法做兼容
643
675
  if (__page || appVariables) {
676
+ // 有部分用户直接在自定义动作脚本里面修改 __page 或者 appVariables 变量
677
+ // 奇怪的是之前的实现方式这种修改是会更新变更的
678
+ // 所以这里用 Proxy 来解决不更新的问题
679
+ __page = __page
680
+ ? observeSet(__page, function (__page) {
681
+ return self.updateContextBySetter(tslib.__assign(tslib.__assign({}, self.context), { __page: __page }));
682
+ })
683
+ : __page;
684
+ appVariables = appVariables
685
+ ? observeSet(appVariables, function (appVariables) {
686
+ return self.updateContextBySetter(tslib.__assign(tslib.__assign({}, self.context), { appVariables: appVariables }));
687
+ })
688
+ : appVariables;
644
689
  if (isInit) {
645
- self.context.__page = context.__page;
646
- self.context.appVariables = context.appVariables;
690
+ self.context.__page = __page;
691
+ self.context.appVariables = appVariables;
647
692
  }
648
693
  self.legacyGlobalTempContext.__page = __page;
649
694
  self.legacyGlobalTempContext.appVariables = appVariables;
@@ -671,7 +716,15 @@ var RootStore = service.ServiceStore.named('RootStore')
671
716
  },
672
717
  init: init,
673
718
  syncGlobalVarStates: syncGlobalVarStates,
719
+ syncLegacyGlobalVarStates: syncLegacyGlobalVarStates,
674
720
  addSyncGlobalVarStatePendingTask: addSyncGlobalVarStatePendingTask,
721
+ afterCreate: function () {
722
+ mobxStateTree.addDisposer(self, mobx.reaction(function () { return self.nextGlobalData; }, function () {
723
+ return self.addSyncGlobalVarStatePendingTask(function (callback) {
724
+ return requestAnimationFrame(callback);
725
+ });
726
+ }));
727
+ },
675
728
  afterDestroy: function () {
676
729
  lazySaveGlobalVarValues.flush();
677
730
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -16,25 +16,25 @@ var api = require('../utils/api.js');
16
16
  var replaceText = require('../utils/replaceText.js');
17
17
  var concatData = require('../utils/concatData.js');
18
18
  var envOverwrite = require('../envOverwrite.js');
19
+ require('amis-formula');
20
+ require('moment');
21
+ var object = require('../utils/object.js');
22
+ require('../utils/memoryParse.js');
23
+ require('@rc-component/mini-decimal');
24
+ require('lodash/isPlainObject');
25
+ require('../utils/filter.js');
19
26
  require('file-saver');
20
27
  require('../utils/browser.js');
21
28
  require('../utils/ColorScale.js');
22
29
  require('../utils/columnsSplit.js');
23
- require('../utils/memoryParse.js');
24
- require('amis-formula');
25
- require('lodash/isPlainObject');
26
- var object = require('../utils/object.js');
27
30
  require('../utils/DataSchema.js');
28
31
  require('../utils/DataScope.js');
29
- require('moment');
30
32
  require('../utils/debug.js');
31
33
  require('../utils/dom.js');
32
34
  var tpl = require('../utils/tpl.js');
33
- require('../utils/filter.js');
34
35
  require('lodash/isObject');
35
36
  require('lodash/isString');
36
37
  require('lodash/isBoolean');
37
- require('@rc-component/mini-decimal');
38
38
  require('../utils/highlight.js');
39
39
  require('../utils/icon.js');
40
40
  require('../utils/image.js');
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.8
2
+ * amis-core v6.13.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5