amis-core 6.13.0-beta.9 → 6.14.0-beta.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 (319) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +4 -2
  3. package/esm/SchemaRenderer.js +2 -2
  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 +7 -7
  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 +3 -3
  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 +4 -1
  76. package/esm/store/root.js +110 -61
  77. package/esm/store/service.js +8 -8
  78. package/esm/store/status.js +1 -1
  79. package/esm/store/table.d.ts +100 -0
  80. package/esm/store/table.js +2 -2
  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 +6 -6
  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.js +2 -2
  150. package/esm/utils/toNumber.js +1 -1
  151. package/esm/utils/tokenize.js +1 -1
  152. package/esm/utils/tpl-builtin.d.ts +1 -0
  153. package/esm/utils/tpl-builtin.js +7 -3
  154. package/esm/utils/tpl-lodash.js +1 -1
  155. package/esm/utils/tpl.js +1 -1
  156. package/esm/utils/uncontrollable.js +1 -1
  157. package/esm/utils/validateId.js +1 -1
  158. package/esm/utils/validations.js +2 -2
  159. package/esm/utils/visitedCache.js +1 -1
  160. package/lib/Root.js +1 -1
  161. package/lib/RootRenderer.js +4 -2
  162. package/lib/SchemaRenderer.js +2 -2
  163. package/lib/Scoped.js +1 -1
  164. package/lib/StatusScoped.js +1 -1
  165. package/lib/StyleManager.js +1 -1
  166. package/lib/WithRootStore.js +1 -1
  167. package/lib/WithStore.js +2 -2
  168. package/lib/actions/Action.js +62 -14
  169. package/lib/actions/AjaxAction.js +2 -2
  170. package/lib/actions/BreakAction.js +1 -1
  171. package/lib/actions/BroadcastAction.js +1 -1
  172. package/lib/actions/CmptAction.js +48 -43
  173. package/lib/actions/ContinueAction.js +1 -1
  174. package/lib/actions/CopyAction.js +1 -1
  175. package/lib/actions/CustomAction.js +7 -7
  176. package/lib/actions/DialogAction.js +8 -8
  177. package/lib/actions/DrawerAction.js +8 -8
  178. package/lib/actions/EmailAction.js +1 -1
  179. package/lib/actions/EventAction.js +9 -9
  180. package/lib/actions/LinkAction.js +1 -1
  181. package/lib/actions/LoopAction.js +1 -1
  182. package/lib/actions/PageAction.js +1 -1
  183. package/lib/actions/ParallelAction.js +1 -1
  184. package/lib/actions/PrintAction.js +1 -1
  185. package/lib/actions/StatusAction.js +1 -1
  186. package/lib/actions/SwitchAction.js +1 -1
  187. package/lib/actions/ToastAction.js +1 -1
  188. package/lib/actions/WaitAction.js +1 -1
  189. package/lib/components/Animations.js +7 -7
  190. package/lib/components/CustomStyle.js +1 -1
  191. package/lib/components/ErrorBoundary.js +1 -1
  192. package/lib/components/LazyComponent.js +1 -1
  193. package/lib/components/Overlay.js +7 -7
  194. package/lib/components/PopOver.js +9 -7
  195. package/lib/env.js +1 -1
  196. package/lib/envOverwrite.js +1 -1
  197. package/lib/factory.js +1 -1
  198. package/lib/globalVar.js +1 -1
  199. package/lib/globalVarClientHandler.js +1 -1
  200. package/lib/globalVarDefaultValueHandler.js +1 -1
  201. package/lib/index.d.ts +4 -4
  202. package/lib/index.js +10 -6
  203. package/lib/locale.js +1 -1
  204. package/lib/polyfills.js +1 -1
  205. package/lib/renderers/Form.d.ts +7 -1
  206. package/lib/renderers/Form.js +71 -20
  207. package/lib/renderers/Item.d.ts +75 -33
  208. package/lib/renderers/Item.js +8 -2
  209. package/lib/renderers/Options.d.ts +14 -8
  210. package/lib/renderers/Options.js +1 -1
  211. package/lib/renderers/Placeholder.js +1 -1
  212. package/lib/renderers/builtin.js +1 -1
  213. package/lib/renderers/register.js +1 -1
  214. package/lib/renderers/wrapControl.d.ts +0 -1
  215. package/lib/renderers/wrapControl.js +21 -11
  216. package/lib/store/app.d.ts +1 -0
  217. package/lib/store/app.js +14 -8
  218. package/lib/store/combo.d.ts +151 -24
  219. package/lib/store/combo.js +24 -2
  220. package/lib/store/crud.d.ts +1 -0
  221. package/lib/store/crud.js +5 -2
  222. package/lib/store/form.d.ts +61 -10
  223. package/lib/store/form.js +3 -3
  224. package/lib/store/formItem.d.ts +1 -0
  225. package/lib/store/formItem.js +4 -2
  226. package/lib/store/iRenderer.js +3 -3
  227. package/lib/store/index.js +1 -1
  228. package/lib/store/list.js +1 -1
  229. package/lib/store/manager.js +1 -1
  230. package/lib/store/modal.d.ts +5 -0
  231. package/lib/store/modal.js +14 -2
  232. package/lib/store/node.js +1 -1
  233. package/lib/store/pagination.js +1 -1
  234. package/lib/store/root.d.ts +4 -1
  235. package/lib/store/root.js +109 -60
  236. package/lib/store/service.js +8 -8
  237. package/lib/store/status.js +1 -1
  238. package/lib/store/table.d.ts +121 -20
  239. package/lib/store/table.js +2 -2
  240. package/lib/store/table2.js +1 -1
  241. package/lib/theme.js +1 -1
  242. package/lib/types.d.ts +10 -6
  243. package/lib/utils/Animation.js +1 -1
  244. package/lib/utils/ColorScale.js +1 -1
  245. package/lib/utils/DataSchema.js +1 -1
  246. package/lib/utils/DataScope.js +1 -1
  247. package/lib/utils/RootClose.js +1 -1
  248. package/lib/utils/SimpleMap.js +1 -1
  249. package/lib/utils/animations.js +1 -1
  250. package/lib/utils/api.js +1 -1
  251. package/lib/utils/arraySlice.js +1 -1
  252. package/lib/utils/attachmentAdpator.js +1 -1
  253. package/lib/utils/autobind.js +1 -1
  254. package/lib/utils/browser.js +1 -1
  255. package/lib/utils/columnsSplit.js +1 -1
  256. package/lib/utils/concatData.js +1 -1
  257. package/lib/utils/dataMapping.js +1 -1
  258. package/lib/utils/date.js +12 -12
  259. package/lib/utils/debug.js +1 -1
  260. package/lib/utils/decodeEntity.js +1 -1
  261. package/lib/utils/dom.js +1 -1
  262. package/lib/utils/errors.js +1 -1
  263. package/lib/utils/escapeHtml.js +1 -1
  264. package/lib/utils/filter-schema.js +1 -1
  265. package/lib/utils/filter.js +1 -1
  266. package/lib/utils/formatDuration.js +1 -1
  267. package/lib/utils/formula.js +2 -2
  268. package/lib/utils/getPageId.js +1 -1
  269. package/lib/utils/getVariable.js +1 -1
  270. package/lib/utils/grammar.js +1 -1
  271. package/lib/utils/handleAction.js +1 -1
  272. package/lib/utils/helper.js +6 -6
  273. package/lib/utils/highlight.js +1 -1
  274. package/lib/utils/icon.js +1 -1
  275. package/lib/utils/image.js +1 -1
  276. package/lib/utils/index.d.ts +1 -1
  277. package/lib/utils/index.js +22 -20
  278. package/lib/utils/isPureVariable.js +1 -1
  279. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  280. package/lib/utils/keyToPath.js +1 -1
  281. package/lib/utils/labelToString.js +1 -1
  282. package/lib/utils/loopTooMuch.js +1 -1
  283. package/lib/utils/makeSorter.js +1 -1
  284. package/lib/utils/math.js +1 -1
  285. package/lib/utils/memoryParse.js +1 -1
  286. package/lib/utils/normalizeLink.js +1 -1
  287. package/lib/utils/normalizeOptions.js +1 -1
  288. package/lib/utils/object.js +1 -1
  289. package/lib/utils/offset.js +1 -1
  290. package/lib/utils/offsetParent.js +1 -1
  291. package/lib/utils/optionValueCompare.js +1 -1
  292. package/lib/utils/position.js +1 -1
  293. package/lib/utils/prettyBytes.js +1 -1
  294. package/lib/utils/printElement.js +1 -1
  295. package/lib/utils/renderer-event.js +1 -1
  296. package/lib/utils/replaceText.js +1 -1
  297. package/lib/utils/resize-sensor.d.ts +3 -1
  298. package/lib/utils/resize-sensor.js +64 -28
  299. package/lib/utils/resolveCondition.js +2 -2
  300. package/lib/utils/resolveVariable.js +1 -1
  301. package/lib/utils/resolveVariableAndFilter.js +3 -2
  302. package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
  303. package/lib/utils/scrollPosition.js +1 -1
  304. package/lib/utils/string2regExp.js +1 -1
  305. package/lib/utils/stripNumber.js +1 -1
  306. package/lib/utils/style-helper.d.ts +12 -1
  307. package/lib/utils/style-helper.js +30 -17
  308. package/lib/utils/style.js +2 -2
  309. package/lib/utils/toNumber.js +1 -1
  310. package/lib/utils/tokenize.js +1 -1
  311. package/lib/utils/tpl-builtin.d.ts +1 -0
  312. package/lib/utils/tpl-builtin.js +7 -2
  313. package/lib/utils/tpl-lodash.js +1 -1
  314. package/lib/utils/tpl.js +1 -1
  315. package/lib/utils/uncontrollable.js +1 -1
  316. package/lib/utils/validateId.js +1 -1
  317. package/lib/utils/validations.js +2 -2
  318. package/lib/utils/visitedCache.js +1 -1
  319. package/package.json +5 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.9
2
+ * amis-core v6.14.0-beta.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -12,13 +12,18 @@ var ModalStore = ServiceStore.named('ModalStore')
12
12
  .props({
13
13
  form: types.frozen(),
14
14
  entered: false,
15
+ dragging: false,
15
16
  resizeCoord: 0,
16
- schema: types.frozen()
17
+ schema: types.frozen(),
18
+ isFullscreen: false
17
19
  })
18
20
  .views(function (self) {
19
21
  return {
20
22
  get formData() {
21
23
  return createObject(self.data, self.form);
24
+ },
25
+ get inDragging() {
26
+ return self.dragging;
22
27
  }
23
28
  };
24
29
  })
@@ -27,6 +32,9 @@ var ModalStore = ServiceStore.named('ModalStore')
27
32
  setEntered: function (value) {
28
33
  self.entered = value;
29
34
  },
35
+ setDragging: function (value) {
36
+ self.dragging = value;
37
+ },
30
38
  setFormData: function (obj) {
31
39
  self.form = obj;
32
40
  },
@@ -43,6 +51,10 @@ var ModalStore = ServiceStore.named('ModalStore')
43
51
  return;
44
52
  }
45
53
  self.schema = schema;
54
+ },
55
+ setFullScreen: function (isFullscreen) {
56
+ if (isFullscreen === void 0) { isFullscreen = false; }
57
+ self.isFullscreen = isFullscreen;
46
58
  }
47
59
  };
48
60
  });
package/esm/store/node.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.9
2
+ * amis-core v6.14.0-beta.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.9
2
+ * amis-core v6.14.0-beta.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -92,8 +92,9 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
92
92
  globalData: any;
93
93
  } & {
94
94
  readonly nextGlobalData: any;
95
- readonly downStream: any;
95
+ readonly downStream: object;
96
96
  } & {
97
+ updateContextBySetter(context: any): void;
97
98
  updateContext(context: any, isInit?: boolean): void;
98
99
  updateGlobalVarState(key: string, state: Partial<GlobalVariableState>): void;
99
100
  setGlobalVars: (vars?: Array<GlobalVariableItem>) => Promise<any>;
@@ -107,7 +108,9 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
107
108
  updateLocation(location?: any, parseFn?: Function): void;
108
109
  init: (schema: any) => Promise<any>;
109
110
  syncGlobalVarStates: () => void;
111
+ syncLegacyGlobalVarStates: () => void;
110
112
  addSyncGlobalVarStatePendingTask: (fn: (callback: () => void) => void, callback?: () => void) => void;
113
+ afterCreate(): void;
111
114
  afterDestroy(): void;
112
115
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
113
116
  export type IRootStore = Instance<typeof RootStore>;
package/esm/store/root.js CHANGED
@@ -1,34 +1,34 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.9
2
+ * amis-core v6.14.0-beta.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
6
6
  import { __assign, __generator, __rest, __values, __awaiter, __read } from 'tslib';
7
- import { types, flow } from 'mobx-state-tree';
7
+ import { types, flow, isAlive, addDisposer } from 'mobx-state-tree';
8
8
  import { parseQuery, isObjectShallowModified } from '../utils/helper.js';
9
9
  import { ServiceStore } from './service.js';
10
+ import 'amis-formula';
11
+ import 'moment';
12
+ import { extractObjectChain, createObjectFromChain, cloneObject } from '../utils/object.js';
13
+ import '../utils/memoryParse.js';
14
+ import '@rc-component/mini-decimal';
15
+ import isPlainObject from 'lodash/isPlainObject';
16
+ import '../utils/filter.js';
10
17
  import '../utils/api.js';
11
18
  import 'file-saver';
12
19
  import '../utils/browser.js';
13
20
  import '../utils/ColorScale.js';
14
21
  import 'react';
15
22
  import 'lodash/chunk';
16
- import { extractObjectChain, createObjectFromChain, cloneObject } from '../utils/object.js';
17
- import '../utils/memoryParse.js';
18
- import 'amis-formula';
19
- import isPlainObject from 'lodash/isPlainObject';
20
23
  import '../utils/DataSchema.js';
21
24
  import '../utils/DataScope.js';
22
- import 'moment';
23
25
  import '../utils/debug.js';
24
26
  import 'react-dom';
25
27
  import '../utils/errors.js';
26
28
  import '../utils/tpl.js';
27
- import '../utils/filter.js';
28
29
  import 'lodash/isObject';
29
30
  import 'lodash/isString';
30
31
  import 'lodash/isBoolean';
31
- import '@rc-component/mini-decimal';
32
32
  import '../utils/image.js';
33
33
  import 'lodash/isEqual';
34
34
  import '../actions/Action.js';
@@ -46,7 +46,7 @@ import 'uncontrollable';
46
46
  import 'hoist-non-react-statics';
47
47
  import '../utils/validations.js';
48
48
  import '../utils/resolveCondition.js';
49
- import 'mobx';
49
+ import { reaction } from 'mobx';
50
50
  import '../utils/Animation.js';
51
51
  import { createGlobalVarState, buildGlobalVariable } from '../globalVar.js';
52
52
 
@@ -113,47 +113,43 @@ var RootStore = ServiceStore.named('RootStore')
113
113
  return createObjectFromChain(chain);
114
114
  },
115
115
  get downStream() {
116
- var result = self.data;
117
- if (self.context || self.query) {
118
- var chain = extractObjectChain(result);
119
- // 数据链中添加 global 和 globalState
120
- // 对应的是全局变量的值和全局变量的状态
121
- var globalData_1 = {};
122
- var touched_1 = false;
123
- var saved_1 = true;
124
- var errors_1 = {};
125
- var initialized_1 = true;
126
- self.globalVarStates.forEach(function (state, key) {
127
- globalData_1[key] = state.value;
128
- touched_1 = touched_1 || state.touched;
129
- if (!state.saved) {
130
- saved_1 = false;
131
- }
132
- if (state.errorMessages.length) {
133
- errors_1[key] = state.errorMessages;
134
- }
135
- if (!state.initialized) {
136
- initialized_1 = false;
137
- }
138
- });
139
- // 保存全局变量的值和状态
140
- Object.assign(self.globalData.global, globalData_1);
141
- Object.assign(self.globalData.globalState, {
142
- fields: self.globalVarStates.toJSON(),
143
- initialized: initialized_1,
144
- touched: touched_1,
145
- saved: saved_1,
146
- errors: errors_1,
147
- valid: !Object.keys(errors_1).length
148
- });
149
- // self.globalData 一直都是那个对象,这样组件里面始终拿到的都是最新的
150
- chain.unshift(self.globalData);
151
- chain.unshift(self.context);
152
- self.query &&
153
- chain.splice(chain.length - 1, 0, __assign(__assign({}, self.query), { __query: self.query }));
154
- result = createObjectFromChain(chain);
155
- }
156
- return result;
116
+ var chain = extractObjectChain(self.data);
117
+ // 数据链中添加 global globalState
118
+ // 对应的是全局变量的值和全局变量的状态
119
+ var globalData = {};
120
+ var touched = false;
121
+ var saved = true;
122
+ var errors = {};
123
+ var initialized = true;
124
+ self.globalVarStates.forEach(function (state, key) {
125
+ globalData[key] = state.value;
126
+ touched = touched || state.touched;
127
+ if (!state.saved) {
128
+ saved = false;
129
+ }
130
+ if (state.errorMessages.length) {
131
+ errors[key] = state.errorMessages;
132
+ }
133
+ if (!state.initialized) {
134
+ initialized = false;
135
+ }
136
+ });
137
+ // 保存全局变量的值和状态
138
+ Object.assign(self.globalData.global, globalData);
139
+ Object.assign(self.globalData.globalState, {
140
+ fields: self.globalVarStates.toJSON(),
141
+ initialized: initialized,
142
+ touched: touched,
143
+ saved: saved,
144
+ errors: errors,
145
+ valid: !Object.keys(errors).length
146
+ });
147
+ // self.globalData 一直都是那个对象,这样组件里面始终拿到的都是最新的
148
+ chain.unshift(self.globalData);
149
+ self.context && chain.unshift(self.context);
150
+ self.query &&
151
+ chain.splice(chain.length - 1, 0, __assign(__assign({}, self.query), { __query: self.query }));
152
+ return createObjectFromChain(chain);
157
153
  }
158
154
  }); })
159
155
  .actions(function (self) {
@@ -410,17 +406,18 @@ var RootStore = ServiceStore.named('RootStore')
410
406
  }
411
407
  // 设置全局变量,返回一个Promise
412
408
  var setGlobalVars = flow(function setGlobalVars(vars) {
413
- var _a, newVars, updateVars, removeVars, _b;
414
- return __generator(this, function (_c) {
415
- switch (_c.label) {
409
+ var _a, newVars, updateVars, removeVars, globalVars;
410
+ return __generator(this, function (_b) {
411
+ switch (_b.label) {
416
412
  case 0:
417
413
  _a = diffVariables(vars || [], self.globalVars), newVars = _a.newVars, updateVars = _a.updateVars, removeVars = _a.removeVars;
418
- // 初始化全局变量
419
- _b = self;
420
414
  return [4 /*yield*/, initializeGlobalVars(newVars, updateVars)];
421
415
  case 1:
422
- // 初始化全局变量
423
- _b.globalVars = _c.sent();
416
+ globalVars = _b.sent();
417
+ if (!isAlive(self)) {
418
+ return [2 /*return*/];
419
+ }
420
+ self.globalVars = globalVars;
424
421
  removeVars.forEach(function (item) {
425
422
  self.globalVarTempStates.delete(item.key);
426
423
  });
@@ -601,6 +598,8 @@ var RootStore = ServiceStore.named('RootStore')
601
598
  self.globalVarTempStates.forEach(function (state, key) {
602
599
  self.globalVarStates.set(key, __assign({}, state));
603
600
  });
601
+ }
602
+ function syncLegacyGlobalVarStates() {
604
603
  if (self.legacyGlobalTempContext.__page !== self.context.__page ||
605
604
  self.legacyGlobalTempContext.appVariables !== self.context.appVariables) {
606
605
  Object.assign(self.context, self.legacyGlobalTempContext);
@@ -617,11 +616,40 @@ var RootStore = ServiceStore.named('RootStore')
617
616
  if (pendingCount === 0) {
618
617
  callbacks.forEach(function (callback) { return callback(); });
619
618
  callbacks = [];
620
- self.syncGlobalVarStates();
619
+ if (isAlive(self)) {
620
+ self.syncGlobalVarStates();
621
+ self.syncLegacyGlobalVarStates();
622
+ }
623
+ }
624
+ });
625
+ }
626
+ function observeSet(obj, callback) {
627
+ if (!obj || obj.__observed) {
628
+ // 如果已经被观察过了,就不需要再观察了
629
+ return obj;
630
+ }
631
+ var timer = 0;
632
+ return new Proxy(__assign({}, obj), {
633
+ get: function (target, prop) {
634
+ if (prop === '__observed') {
635
+ return true;
636
+ }
637
+ return Reflect.get(target, prop);
638
+ },
639
+ set: function (target, prop, value) {
640
+ Reflect.set(target, prop, value);
641
+ cancelAnimationFrame(timer);
642
+ timer = requestAnimationFrame(function () { return callback(target); });
643
+ console.warn("Don't modify the context directly.");
644
+ return true;
621
645
  }
622
646
  });
623
647
  }
624
648
  return {
649
+ updateContextBySetter: function (context) {
650
+ this.updateContext(context);
651
+ self.data = cloneObject(self.data);
652
+ },
625
653
  updateContext: function (context, isInit) {
626
654
  // 因为 context 不是受控属性,直接共用引用好了
627
655
  // 否则还会触发孩子节点的重新渲染
@@ -629,9 +657,22 @@ var RootStore = ServiceStore.named('RootStore')
629
657
  var _a = context || {}, __page = _a.__page, appVariables = _a.appVariables, rest = __rest(_a, ["__page", "appVariables"]);
630
658
  // 对历史用法做兼容
631
659
  if (__page || appVariables) {
660
+ // 有部分用户直接在自定义动作脚本里面修改 __page 或者 appVariables 变量
661
+ // 奇怪的是之前的实现方式这种修改是会更新变更的
662
+ // 所以这里用 Proxy 来解决不更新的问题
663
+ __page = __page
664
+ ? observeSet(__page, function (__page) {
665
+ return self.updateContextBySetter(__assign(__assign({}, self.context), { __page: __page }));
666
+ })
667
+ : __page;
668
+ appVariables = appVariables
669
+ ? observeSet(appVariables, function (appVariables) {
670
+ return self.updateContextBySetter(__assign(__assign({}, self.context), { appVariables: appVariables }));
671
+ })
672
+ : appVariables;
632
673
  if (isInit) {
633
- self.context.__page = context.__page;
634
- self.context.appVariables = context.appVariables;
674
+ self.context.__page = __page;
675
+ self.context.appVariables = appVariables;
635
676
  }
636
677
  self.legacyGlobalTempContext.__page = __page;
637
678
  self.legacyGlobalTempContext.appVariables = appVariables;
@@ -659,7 +700,15 @@ var RootStore = ServiceStore.named('RootStore')
659
700
  },
660
701
  init: init,
661
702
  syncGlobalVarStates: syncGlobalVarStates,
703
+ syncLegacyGlobalVarStates: syncLegacyGlobalVarStates,
662
704
  addSyncGlobalVarStatePendingTask: addSyncGlobalVarStatePendingTask,
705
+ afterCreate: function () {
706
+ addDisposer(self, reaction(function () { return self.nextGlobalData; }, function () {
707
+ return self.addSyncGlobalVarStatePendingTask(function (callback) {
708
+ return requestAnimationFrame(callback);
709
+ });
710
+ }));
711
+ },
663
712
  afterDestroy: function () {
664
713
  lazySaveGlobalVarValues.flush();
665
714
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.9
2
+ * amis-core v6.14.0-beta.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5
 
@@ -12,26 +12,26 @@ import { normalizeApiResponseData } from '../utils/api.js';
12
12
  import { replaceText } from '../utils/replaceText.js';
13
13
  import { concatData } from '../utils/concatData.js';
14
14
  import { envOverwrite } from '../envOverwrite.js';
15
+ import 'amis-formula';
16
+ import 'moment';
17
+ import { isObject, extendObject } from '../utils/object.js';
18
+ import '../utils/memoryParse.js';
19
+ import '@rc-component/mini-decimal';
20
+ import 'lodash/isPlainObject';
21
+ import '../utils/filter.js';
15
22
  import 'file-saver';
16
23
  import '../utils/browser.js';
17
24
  import '../utils/ColorScale.js';
18
25
  import 'react';
19
26
  import 'lodash/chunk';
20
- import '../utils/memoryParse.js';
21
- import 'amis-formula';
22
- import 'lodash/isPlainObject';
23
- import { isObject, extendObject } from '../utils/object.js';
24
27
  import '../utils/DataSchema.js';
25
28
  import '../utils/DataScope.js';
26
- import 'moment';
27
29
  import '../utils/debug.js';
28
30
  import 'react-dom';
29
31
  import { filter } from '../utils/tpl.js';
30
- import '../utils/filter.js';
31
32
  import 'lodash/isObject';
32
33
  import 'lodash/isString';
33
34
  import 'lodash/isBoolean';
34
- import '@rc-component/mini-decimal';
35
35
  import '../utils/image.js';
36
36
  import 'lodash/isEqual';
37
37
  import '../actions/Action.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v6.13.0-beta.9
2
+ * amis-core v6.14.0-beta.0
3
3
  * Copyright 2018-2025 fex
4
4
  */
5
5