amis-core 3.1.1 → 3.3.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 (313) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.d.ts +1 -1
  3. package/esm/RootRenderer.js +3 -3
  4. package/esm/SchemaRenderer.js +6 -2
  5. package/esm/Scoped.d.ts +4 -1
  6. package/esm/Scoped.js +9 -5
  7. package/esm/StatusScoped.js +1 -1
  8. package/esm/WithRootStore.d.ts +4 -24
  9. package/esm/WithRootStore.js +12 -4
  10. package/esm/WithStore.js +23 -16
  11. package/esm/actions/Action.d.ts +1 -0
  12. package/esm/actions/Action.js +70 -45
  13. package/esm/actions/AjaxAction.d.ts +6 -8
  14. package/esm/actions/AjaxAction.js +20 -18
  15. package/esm/actions/BreakAction.js +1 -1
  16. package/esm/actions/BroadcastAction.js +1 -1
  17. package/esm/actions/CmptAction.d.ts +1 -2
  18. package/esm/actions/CmptAction.js +47 -32
  19. package/esm/actions/ContinueAction.js +1 -1
  20. package/esm/actions/CopyAction.js +1 -1
  21. package/esm/actions/CustomAction.js +3 -2
  22. package/esm/actions/DialogAction.d.ts +2 -0
  23. package/esm/actions/DialogAction.js +39 -23
  24. package/esm/actions/DrawerAction.js +4 -4
  25. package/esm/actions/EmailAction.js +1 -1
  26. package/esm/actions/LinkAction.js +1 -1
  27. package/esm/actions/LoopAction.js +1 -1
  28. package/esm/actions/PageAction.js +1 -1
  29. package/esm/actions/ParallelAction.js +1 -1
  30. package/esm/actions/StatusAction.d.ts +15 -0
  31. package/esm/actions/StatusAction.js +49 -0
  32. package/esm/actions/SwitchAction.js +1 -1
  33. package/esm/actions/ToastAction.js +1 -1
  34. package/esm/actions/index.d.ts +1 -0
  35. package/esm/components/CustomStyle.js +1 -1
  36. package/esm/components/LazyComponent.js +1 -1
  37. package/esm/components/Overlay.js +3 -2
  38. package/esm/components/PopOver.js +3 -2
  39. package/esm/env.js +1 -1
  40. package/esm/envOverwrite.js +1 -1
  41. package/esm/factory.js +2 -2
  42. package/esm/index.d.ts +3 -1
  43. package/esm/index.js +16 -14
  44. package/esm/locale.js +1 -1
  45. package/esm/polyfills.d.ts +3 -0
  46. package/esm/polyfills.js +18 -0
  47. package/esm/renderers/Form.d.ts +7 -7
  48. package/esm/renderers/Form.js +182 -128
  49. package/esm/renderers/Item.d.ts +82 -77
  50. package/esm/renderers/Item.js +90 -74
  51. package/esm/renderers/Options.js +1 -2
  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 +4 -24
  56. package/esm/renderers/wrapControl.js +140 -88
  57. package/esm/store/app.js +42 -4
  58. package/esm/store/combo.d.ts +564 -1892
  59. package/esm/store/combo.js +9 -2
  60. package/esm/store/crud.d.ts +4 -2
  61. package/esm/store/crud.js +17 -4
  62. package/esm/store/form.d.ts +182 -882
  63. package/esm/store/form.js +83 -81
  64. package/esm/store/formItem.d.ts +6 -2
  65. package/esm/store/formItem.js +19 -3
  66. package/esm/store/iRenderer.js +3 -2
  67. package/esm/store/index.js +1 -1
  68. package/esm/store/list.d.ts +1 -0
  69. package/esm/store/list.js +8 -2
  70. package/esm/store/manager.js +1 -1
  71. package/esm/store/modal.js +1 -1
  72. package/esm/store/node.js +1 -1
  73. package/esm/store/pagination.js +1 -1
  74. package/esm/store/root.js +3 -2
  75. package/esm/store/service.js +17 -12
  76. package/esm/store/status.js +1 -1
  77. package/esm/store/table.d.ts +604 -2020
  78. package/esm/store/table.js +86 -56
  79. package/esm/store/table2.d.ts +49 -0
  80. package/esm/store/table2.js +37 -4
  81. package/esm/theme.js +1 -1
  82. package/esm/types.d.ts +22 -5
  83. package/esm/utils/Animation.js +1 -1
  84. package/esm/utils/ColorScale.js +1 -1
  85. package/esm/utils/DataSchema.d.ts +3 -2
  86. package/esm/utils/DataSchema.js +27 -7
  87. package/esm/utils/DataScope.d.ts +10 -3
  88. package/esm/utils/DataScope.js +50 -12
  89. package/esm/utils/RootClose.js +1 -1
  90. package/esm/utils/SimpleMap.js +1 -1
  91. package/esm/utils/api.d.ts +2 -2
  92. package/esm/utils/api.js +152 -112
  93. package/esm/utils/arraySlice.d.ts +1 -0
  94. package/esm/utils/arraySlice.js +76 -0
  95. package/esm/utils/attachmentAdpator.js +1 -1
  96. package/esm/utils/autobind.js +1 -1
  97. package/esm/utils/columnsSplit.js +1 -1
  98. package/esm/utils/dataMapping.js +29 -19
  99. package/esm/utils/date.js +1 -1
  100. package/esm/utils/debug.d.ts +2 -0
  101. package/esm/utils/debug.js +34 -7
  102. package/esm/utils/decodeEntity.js +1 -1
  103. package/esm/utils/dom.js +4 -1
  104. package/esm/utils/errors.js +1 -1
  105. package/esm/utils/escapeHtml.js +1 -1
  106. package/esm/utils/filter-schema.js +1 -1
  107. package/esm/utils/filter.js +1 -1
  108. package/esm/utils/formatDuration.js +1 -1
  109. package/esm/utils/formula.d.ts +0 -1
  110. package/esm/utils/formula.js +6 -9
  111. package/esm/utils/getVariable.js +1 -1
  112. package/esm/utils/grammar.js +1 -1
  113. package/esm/utils/handleAction.js +1 -1
  114. package/esm/utils/helper.d.ts +19 -2
  115. package/esm/utils/helper.js +69 -10
  116. package/esm/utils/highlight.js +1 -1
  117. package/esm/utils/icon.d.ts +4 -2
  118. package/esm/utils/icon.js +3 -2
  119. package/esm/utils/image.js +1 -1
  120. package/esm/utils/index.d.ts +2 -0
  121. package/esm/utils/isPureVariable.js +1 -1
  122. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  123. package/esm/utils/keyToPath.js +1 -1
  124. package/esm/utils/makeSorter.js +1 -1
  125. package/esm/utils/math.d.ts +3 -0
  126. package/esm/utils/math.js +52 -0
  127. package/esm/utils/memoryParse.js +1 -1
  128. package/esm/utils/normalizeLink.js +18 -9
  129. package/esm/utils/normalizeOptions.js +1 -1
  130. package/esm/utils/object.d.ts +7 -0
  131. package/esm/utils/object.js +13 -2
  132. package/esm/utils/offset.js +1 -1
  133. package/esm/utils/offsetParent.js +1 -1
  134. package/esm/utils/optionValueCompare.js +2 -2
  135. package/esm/utils/position.js +1 -1
  136. package/esm/utils/prettyBytes.js +1 -1
  137. package/esm/utils/renderer-event.d.ts +1 -1
  138. package/esm/utils/renderer-event.js +14 -6
  139. package/esm/utils/replaceText.js +1 -1
  140. package/esm/utils/resize-sensor.js +1 -1
  141. package/esm/utils/resolveCondition.js +1 -1
  142. package/esm/utils/resolveVariable.js +1 -1
  143. package/esm/utils/resolveVariableAndFilter.js +1 -1
  144. package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
  145. package/esm/utils/scrollPosition.js +1 -1
  146. package/esm/utils/string2regExp.js +1 -1
  147. package/esm/utils/stripNumber.js +1 -1
  148. package/esm/utils/style-helper.js +1 -1
  149. package/esm/utils/style.js +1 -1
  150. package/esm/utils/toNumber.js +1 -1
  151. package/esm/utils/tokenize.js +1 -1
  152. package/esm/utils/tpl-builtin.js +1 -1
  153. package/esm/utils/tpl-lodash.js +1 -1
  154. package/esm/utils/tpl.js +1 -1
  155. package/esm/utils/uncontrollable.js +1 -1
  156. package/esm/utils/validations.js +1 -1
  157. package/lib/Root.js +10 -7
  158. package/lib/RootRenderer.d.ts +1 -1
  159. package/lib/RootRenderer.js +11 -8
  160. package/lib/SchemaRenderer.js +13 -6
  161. package/lib/Scoped.d.ts +4 -1
  162. package/lib/Scoped.js +19 -13
  163. package/lib/StatusScoped.js +5 -2
  164. package/lib/WithRootStore.d.ts +4 -24
  165. package/lib/WithRootStore.js +15 -4
  166. package/lib/WithStore.js +27 -17
  167. package/lib/actions/Action.d.ts +1 -0
  168. package/lib/actions/Action.js +70 -45
  169. package/lib/actions/AjaxAction.d.ts +6 -8
  170. package/lib/actions/AjaxAction.js +20 -18
  171. package/lib/actions/BreakAction.js +1 -1
  172. package/lib/actions/BroadcastAction.js +1 -1
  173. package/lib/actions/CmptAction.d.ts +1 -2
  174. package/lib/actions/CmptAction.js +47 -32
  175. package/lib/actions/ContinueAction.js +1 -1
  176. package/lib/actions/CopyAction.js +1 -1
  177. package/lib/actions/CustomAction.js +9 -5
  178. package/lib/actions/DialogAction.d.ts +2 -0
  179. package/lib/actions/DialogAction.js +39 -23
  180. package/lib/actions/DrawerAction.js +4 -4
  181. package/lib/actions/EmailAction.js +1 -1
  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/StatusAction.d.ts +15 -0
  187. package/lib/actions/StatusAction.js +53 -0
  188. package/lib/actions/SwitchAction.js +1 -1
  189. package/lib/actions/ToastAction.js +1 -1
  190. package/lib/actions/index.d.ts +1 -0
  191. package/lib/components/CustomStyle.js +1 -1
  192. package/lib/components/LazyComponent.js +12 -14
  193. package/lib/components/Overlay.js +15 -14
  194. package/lib/components/PopOver.js +12 -10
  195. package/lib/env.js +4 -1
  196. package/lib/envOverwrite.js +1 -1
  197. package/lib/factory.js +11 -9
  198. package/lib/index.d.ts +3 -1
  199. package/lib/index.js +26 -19
  200. package/lib/locale.js +6 -3
  201. package/lib/polyfills.d.ts +3 -0
  202. package/lib/polyfills.js +20 -0
  203. package/lib/renderers/Form.d.ts +7 -7
  204. package/lib/renderers/Form.js +194 -135
  205. package/lib/renderers/Item.d.ts +82 -77
  206. package/lib/renderers/Item.js +126 -104
  207. package/lib/renderers/Options.js +10 -5
  208. package/lib/renderers/Placeholder.js +1 -1
  209. package/lib/renderers/builtin.js +1 -1
  210. package/lib/renderers/register.js +1 -1
  211. package/lib/renderers/wrapControl.d.ts +4 -24
  212. package/lib/renderers/wrapControl.js +143 -88
  213. package/lib/store/app.js +44 -3
  214. package/lib/store/combo.d.ts +564 -1892
  215. package/lib/store/combo.js +9 -2
  216. package/lib/store/crud.d.ts +4 -2
  217. package/lib/store/crud.js +17 -4
  218. package/lib/store/form.d.ts +182 -882
  219. package/lib/store/form.js +81 -79
  220. package/lib/store/formItem.d.ts +6 -2
  221. package/lib/store/formItem.js +19 -3
  222. package/lib/store/iRenderer.js +9 -5
  223. package/lib/store/index.js +1 -1
  224. package/lib/store/list.d.ts +1 -0
  225. package/lib/store/list.js +8 -2
  226. package/lib/store/manager.js +1 -1
  227. package/lib/store/modal.js +1 -1
  228. package/lib/store/node.js +1 -1
  229. package/lib/store/pagination.js +1 -1
  230. package/lib/store/root.js +9 -5
  231. package/lib/store/service.js +17 -12
  232. package/lib/store/status.js +1 -1
  233. package/lib/store/table.d.ts +604 -2020
  234. package/lib/store/table.js +85 -55
  235. package/lib/store/table2.d.ts +49 -0
  236. package/lib/store/table2.js +36 -3
  237. package/lib/theme.js +6 -3
  238. package/lib/types.d.ts +22 -5
  239. package/lib/utils/Animation.js +1 -1
  240. package/lib/utils/ColorScale.js +1 -1
  241. package/lib/utils/DataSchema.d.ts +3 -2
  242. package/lib/utils/DataSchema.js +27 -7
  243. package/lib/utils/DataScope.d.ts +10 -3
  244. package/lib/utils/DataScope.js +50 -11
  245. package/lib/utils/RootClose.js +1 -1
  246. package/lib/utils/SimpleMap.js +1 -1
  247. package/lib/utils/api.d.ts +2 -2
  248. package/lib/utils/api.js +151 -111
  249. package/lib/utils/arraySlice.d.ts +1 -0
  250. package/lib/utils/arraySlice.js +80 -0
  251. package/lib/utils/attachmentAdpator.js +1 -1
  252. package/lib/utils/autobind.js +1 -1
  253. package/lib/utils/columnsSplit.js +8 -6
  254. package/lib/utils/dataMapping.js +29 -19
  255. package/lib/utils/date.js +1 -1
  256. package/lib/utils/debug.d.ts +2 -0
  257. package/lib/utils/debug.js +61 -33
  258. package/lib/utils/decodeEntity.js +1 -1
  259. package/lib/utils/dom.js +10 -5
  260. package/lib/utils/errors.js +1 -1
  261. package/lib/utils/escapeHtml.js +1 -1
  262. package/lib/utils/filter-schema.js +1 -1
  263. package/lib/utils/filter.js +1 -1
  264. package/lib/utils/formatDuration.js +1 -1
  265. package/lib/utils/formula.d.ts +0 -1
  266. package/lib/utils/formula.js +6 -10
  267. package/lib/utils/getVariable.js +1 -1
  268. package/lib/utils/grammar.js +1 -1
  269. package/lib/utils/handleAction.js +1 -1
  270. package/lib/utils/helper.d.ts +19 -2
  271. package/lib/utils/helper.js +70 -9
  272. package/lib/utils/highlight.js +8 -9
  273. package/lib/utils/icon.d.ts +4 -2
  274. package/lib/utils/icon.js +12 -10
  275. package/lib/utils/image.js +1 -1
  276. package/lib/utils/index.d.ts +2 -0
  277. package/lib/utils/isPureVariable.js +1 -1
  278. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  279. package/lib/utils/keyToPath.js +1 -1
  280. package/lib/utils/makeSorter.js +1 -1
  281. package/lib/utils/math.d.ts +3 -0
  282. package/lib/utils/math.js +58 -0
  283. package/lib/utils/memoryParse.js +1 -1
  284. package/lib/utils/normalizeLink.js +18 -9
  285. package/lib/utils/normalizeOptions.js +1 -1
  286. package/lib/utils/object.d.ts +7 -0
  287. package/lib/utils/object.js +13 -1
  288. package/lib/utils/offset.js +1 -1
  289. package/lib/utils/offsetParent.js +1 -1
  290. package/lib/utils/optionValueCompare.js +7 -3
  291. package/lib/utils/position.js +1 -1
  292. package/lib/utils/prettyBytes.js +1 -1
  293. package/lib/utils/renderer-event.d.ts +1 -1
  294. package/lib/utils/renderer-event.js +13 -5
  295. package/lib/utils/replaceText.js +1 -1
  296. package/lib/utils/resize-sensor.js +1 -1
  297. package/lib/utils/resolveCondition.js +1 -1
  298. package/lib/utils/resolveVariable.js +1 -1
  299. package/lib/utils/resolveVariableAndFilter.js +1 -1
  300. package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
  301. package/lib/utils/scrollPosition.js +1 -1
  302. package/lib/utils/string2regExp.js +1 -1
  303. package/lib/utils/stripNumber.js +1 -1
  304. package/lib/utils/style-helper.js +1 -1
  305. package/lib/utils/style.js +1 -1
  306. package/lib/utils/toNumber.js +1 -1
  307. package/lib/utils/tokenize.js +1 -1
  308. package/lib/utils/tpl-builtin.js +1 -1
  309. package/lib/utils/tpl-lodash.js +1 -1
  310. package/lib/utils/tpl.js +1 -1
  311. package/lib/utils/uncontrollable.js +1 -1
  312. package/lib/utils/validations.js +1 -1
  313. package/package.json +9 -4
package/lib/store/form.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -62,7 +62,7 @@ var FormStore = service.ServiceStore.named('FormStore')
62
62
  if (current.storeType === 'FormItemStore') {
63
63
  formItems.push(current);
64
64
  }
65
- else {
65
+ else if (!['ComboStore', 'TableStore', 'FormStore'].includes(current.storeType)) {
66
66
  pool.push.apply(pool, tslib.__spreadArray([], tslib.__read(current.children), false));
67
67
  }
68
68
  }
@@ -75,30 +75,11 @@ var FormStore = service.ServiceStore.named('FormStore')
75
75
  get items() {
76
76
  return getItems();
77
77
  },
78
- /**
79
- * 相对于 items(), 只收集直接子formItem
80
- * 避免 子form 表单项的重复验证
81
- */
82
- get directItems() {
83
- var formItems = [];
84
- // 查找孩子节点中是 formItem 的表单项
85
- var pool = self.children.concat();
86
- while (pool.length) {
87
- var current = pool.shift();
88
- if (current.storeType === 'FormItemStore') {
89
- formItems.push(current);
90
- }
91
- else if (!['ComboStore', 'TableStore'].includes(current.storeType)) {
92
- pool.push.apply(pool, tslib.__spreadArray([], tslib.__read(current.children), false));
93
- }
94
- }
95
- return formItems;
96
- },
97
78
  /** 获取InputGroup的子元素 */
98
79
  get inputGroupItems() {
99
80
  var _a, _b;
100
81
  var formItems = {};
101
- var children = self.children.concat();
82
+ var children = this.items.concat();
102
83
  while (children.length) {
103
84
  var current = children.shift();
104
85
  if (current.inputGroupControl && ((_a = current.inputGroupControl) === null || _a === void 0 ? void 0 : _a.name)) {
@@ -168,11 +149,27 @@ var FormStore = service.ServiceStore.named('FormStore')
168
149
  self.updateData(values, tag, replace);
169
150
  // 如果数据域中有数据变化,就都reset一下,去掉之前残留的验证消息
170
151
  self.items.forEach(function (item) {
171
- var value = item.value;
172
- if (typeof value !== 'undefined' && value !== item.tmpValue) {
173
- item.changeTmpValue(value);
152
+ if (item.extraName) {
153
+ var value = [
154
+ getVariable.getVariable(values, item.name, false),
155
+ getVariable.getVariable(values, item.extraName, false)
156
+ ];
157
+ if (value.some(function (item) { return item !== undefined; }) &&
158
+ !isEqual__default["default"](value, item.tmpValue)) {
159
+ var origin_1 = item.splitExtraValue(item.tmpValue);
160
+ item.changeTmpValue(value.map(function (item, idx) { return item !== null && item !== void 0 ? item : origin_1[idx]; }), 'dataChanged');
161
+ item.changeEmitedValue(undefined);
162
+ }
163
+ }
164
+ else {
165
+ var value = getVariable.getVariable(values, item.name, false);
166
+ if (value !== undefined && value !== item.tmpValue) {
167
+ item.changeTmpValue(value, 'dataChanged');
168
+ item.changeEmitedValue(undefined);
169
+ }
174
170
  }
175
171
  item.reset();
172
+ item.validateOnChange && item.validate(self.data);
176
173
  });
177
174
  // 同步 options
178
175
  syncOptions();
@@ -284,33 +281,33 @@ var FormStore = service.ServiceStore.named('FormStore')
284
281
  }
285
282
  var saveRemote = mobxStateTree.flow(function saveRemote(api$1, data, options) {
286
283
  var ret, json, ret, e_1, ret, result;
287
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
284
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
288
285
  if (options === void 0) { options = {}; }
289
- return tslib.__generator(this, function (_q) {
290
- switch (_q.label) {
286
+ return tslib.__generator(this, function (_r) {
287
+ switch (_r.label) {
291
288
  case 0:
292
289
  clearRestError();
293
- _q.label = 1;
290
+ _r.label = 1;
294
291
  case 1:
295
- _q.trys.push([1, 12, , 15]);
292
+ _r.trys.push([1, 12, , 15]);
296
293
  options = tslib.__assign({ method: 'post' }, options);
297
294
  if (!(options && options.beforeSend)) return [3 /*break*/, 4];
298
295
  ret = options.beforeSend(data);
299
296
  if (!(ret && ret.then)) return [3 /*break*/, 3];
300
297
  return [4 /*yield*/, ret];
301
298
  case 2:
302
- ret = _q.sent();
303
- _q.label = 3;
299
+ ret = _r.sent();
300
+ _r.label = 3;
304
301
  case 3:
305
302
  if (ret === false) {
306
303
  return [2 /*return*/];
307
304
  }
308
- _q.label = 4;
305
+ _r.label = 4;
309
306
  case 4:
310
307
  self.markSaving(true);
311
308
  return [4 /*yield*/, mobxStateTree.getEnv(self).fetcher(api$1, data, options)];
312
309
  case 5:
313
- json = _q.sent();
310
+ json = _r.sent();
314
311
  // 失败也同样修改数据,如果有数据的话。
315
312
  if (!helper.isEmpty(json.data) || json.ok) {
316
313
  self.updatedAt = Date.now();
@@ -331,24 +328,24 @@ var FormStore = service.ServiceStore.named('FormStore')
331
328
  throw new errors.ServerError(self.msg, json);
332
329
  case 6:
333
330
  updateSavedData();
334
- ret = options && options.onSuccess && options.onSuccess(json);
331
+ ret = (_h = options === null || options === void 0 ? void 0 : options.onSuccess) === null || _h === void 0 ? void 0 : _h.call(options, json, json.data);
335
332
  if (!(ret === null || ret === void 0 ? void 0 : ret.then)) return [3 /*break*/, 8];
336
333
  return [4 /*yield*/, ret];
337
334
  case 7:
338
- ret = _q.sent();
339
- _q.label = 8;
335
+ ret = _r.sent();
336
+ _r.label = 8;
340
337
  case 8:
341
- if (!((_h = ret === null || ret === void 0 ? void 0 : ret.cbResult) === null || _h === void 0 ? void 0 : _h.then)) return [3 /*break*/, 10];
338
+ if (!((_j = ret === null || ret === void 0 ? void 0 : ret.cbResult) === null || _j === void 0 ? void 0 : _j.then)) return [3 /*break*/, 10];
342
339
  return [4 /*yield*/, ret.cbResult];
343
340
  case 9:
344
- _q.sent();
345
- _q.label = 10;
341
+ _r.sent();
342
+ _r.label = 10;
346
343
  case 10:
347
344
  self.markSaving(false);
348
- self.updateMessage((_m = (_l = (_k = (_j = api$1 === null || api$1 === void 0 ? void 0 : api$1.messages) === null || _j === void 0 ? void 0 : _j.success) !== null && _k !== void 0 ? _k : json.msg) !== null && _l !== void 0 ? _l : (options.successMessage === 'saveSuccess'
345
+ self.updateMessage((_o = (_m = (_l = (_k = api$1 === null || api$1 === void 0 ? void 0 : api$1.messages) === null || _k === void 0 ? void 0 : _k.success) !== null && _l !== void 0 ? _l : json.msg) !== null && _m !== void 0 ? _m : (options.successMessage === 'saveSuccess'
349
346
  ? json.defaultMsg
350
- : self.__(options && options.successMessage))) !== null && _m !== void 0 ? _m : json.defaultMsg);
351
- if (!((_o = ret === null || ret === void 0 ? void 0 : ret.dispatcher) === null || _o === void 0 ? void 0 : _o.prevented)) {
347
+ : self.__(options && options.successMessage))) !== null && _o !== void 0 ? _o : json.defaultMsg);
348
+ if (!((_p = ret === null || ret === void 0 ? void 0 : ret.dispatcher) === null || _p === void 0 ? void 0 : _p.prevented)) {
352
349
  self.msg &&
353
350
  mobxStateTree.getEnv(self).notify('success', self.msg, json.msgTimeout !== undefined
354
351
  ? {
@@ -360,19 +357,19 @@ var FormStore = service.ServiceStore.named('FormStore')
360
357
  return [2 /*return*/, json.data];
361
358
  case 11: return [3 /*break*/, 15];
362
359
  case 12:
363
- e_1 = _q.sent();
360
+ e_1 = _r.sent();
364
361
  self.markSaving(false);
365
362
  ret = options && options.onFailed && options.onFailed(e_1.response || {});
366
363
  if (!(ret === null || ret === void 0 ? void 0 : ret.then)) return [3 /*break*/, 14];
367
364
  return [4 /*yield*/, ret];
368
365
  case 13:
369
- ret = _q.sent();
370
- _q.label = 14;
366
+ ret = _r.sent();
367
+ _r.label = 14;
371
368
  case 14:
372
369
  if (!mobxStateTree.isAlive(self) || self.disposed) {
373
370
  return [2 /*return*/];
374
371
  }
375
- if ((_p = ret === null || ret === void 0 ? void 0 : ret.dispatcher) === null || _p === void 0 ? void 0 : _p.prevented) {
372
+ if ((_q = ret === null || ret === void 0 ? void 0 : ret.dispatcher) === null || _q === void 0 ? void 0 : _q.prevented) {
376
373
  return [2 /*return*/];
377
374
  }
378
375
  if (e_1.type === 'ServerError') {
@@ -441,8 +438,8 @@ var FormStore = service.ServiceStore.named('FormStore')
441
438
  trailing: false,
442
439
  leading: true
443
440
  });
444
- var submit = mobxStateTree.flow(function submit(fn, hooks, failedMessage, validateErrCb) {
445
- var valid, msg, dispatcher, diff, result;
441
+ var submit = mobxStateTree.flow(function submit(fn, hooks, failedMessage, validateErrCb, throwErrors) {
442
+ var diff, result;
446
443
  return tslib.__generator(this, function (_a) {
447
444
  switch (_a.label) {
448
445
  case 0:
@@ -450,53 +447,35 @@ var FormStore = service.ServiceStore.named('FormStore')
450
447
  self.submiting = true;
451
448
  _a.label = 1;
452
449
  case 1:
453
- _a.trys.push([1, , 8, 9]);
454
- return [4 /*yield*/, validate(hooks)];
450
+ _a.trys.push([1, , 5, 6]);
451
+ return [4 /*yield*/, validate(hooks, undefined, true, failedMessage, validateErrCb)];
455
452
  case 2:
456
- valid = _a.sent();
457
- if (!((!valid &&
458
- self.items.some(function (item) {
459
- return item.errorData.some(function (e) { return e.tag !== 'remote'; });
460
- })) ||
461
- self.restError.length)) return [3 /*break*/, 5];
462
- msg = failedMessage !== null && failedMessage !== void 0 ? failedMessage : self.__('Form.validateFailed');
463
- dispatcher = validateErrCb && validateErrCb();
464
- if (!(dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.then)) return [3 /*break*/, 4];
465
- return [4 /*yield*/, dispatcher];
466
- case 3:
467
- dispatcher = _a.sent();
468
- _a.label = 4;
469
- case 4:
470
- if (!(dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.prevented)) {
471
- msg && toastValidateError(msg);
472
- }
473
- throw new Error(msg);
474
- case 5:
475
- if (!fn) return [3 /*break*/, 7];
453
+ _a.sent();
454
+ if (!fn) return [3 /*break*/, 4];
476
455
  diff = helper.difference(self.data, self.pristine);
477
456
  return [4 /*yield*/, fn(object.createObject(object.createObject(self.data.__super, {
478
457
  diff: diff,
479
458
  __diff: diff,
480
459
  pristine: self.pristine
481
460
  }), self.data))];
482
- case 6:
461
+ case 3:
483
462
  result = _a.sent();
484
463
  return [2 /*return*/, result !== null && result !== void 0 ? result : self.data];
485
- case 7: return [2 /*return*/, self.data];
486
- case 8:
464
+ case 4: return [2 /*return*/, self.data];
465
+ case 5:
487
466
  self.submiting = false;
488
467
  return [7 /*endfinally*/];
489
- case 9: return [2 /*return*/];
468
+ case 6: return [2 /*return*/];
490
469
  }
491
470
  });
492
471
  });
493
- var validate = mobxStateTree.flow(function validate(hooks, forceValidate) {
494
- var items, i, len, item, i, len;
472
+ var validate = mobxStateTree.flow(function validate(hooks, forceValidate, throwErrors, failedMessage, validateErrCb) {
473
+ var items, i, len, item, i, len, msg, dispatcher;
495
474
  return tslib.__generator(this, function (_a) {
496
475
  switch (_a.label) {
497
476
  case 0:
498
477
  self.validated = true;
499
- items = self.directItems.concat();
478
+ items = self.items.concat();
500
479
  i = 0, len = items.length;
501
480
  _a.label = 1;
502
481
  case 1:
@@ -547,7 +526,30 @@ var FormStore = service.ServiceStore.named('FormStore')
547
526
  case 7:
548
527
  i++;
549
528
  return [3 /*break*/, 5];
550
- case 8: return [2 /*return*/, self.valid];
529
+ case 8:
530
+ if (!!self.valid) return [3 /*break*/, 12];
531
+ if (!(self.items.some(function (item) {
532
+ return item.errorData.some(function (e) { return e.tag !== 'remote'; });
533
+ }) ||
534
+ self.restError.length)) return [3 /*break*/, 11];
535
+ msg = failedMessage !== null && failedMessage !== void 0 ? failedMessage : self.__('Form.validateFailed');
536
+ dispatcher = validateErrCb && validateErrCb();
537
+ if (!(dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.then)) return [3 /*break*/, 10];
538
+ return [4 /*yield*/, dispatcher];
539
+ case 9:
540
+ dispatcher = _a.sent();
541
+ _a.label = 10;
542
+ case 10:
543
+ if (!(dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.prevented)) {
544
+ msg && toastValidateError(msg);
545
+ }
546
+ _a.label = 11;
547
+ case 11:
548
+ if (throwErrors) {
549
+ throw new helper.ValidateError(failedMessage || self.__('Form.validateFailed'), self.errors);
550
+ }
551
+ _a.label = 12;
552
+ case 12: return [2 /*return*/, self.valid];
551
553
  }
552
554
  });
553
555
  });
@@ -17,6 +17,7 @@ export declare const FormItemStore: import("mobx-state-tree").IModelType<{
17
17
  isValueSchemaExp: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
18
18
  tmpValue: import("mobx-state-tree").IType<any, any, any>;
19
19
  emitedValue: import("mobx-state-tree").IType<any, any, any>;
20
+ changeMotivation: import("mobx-state-tree").IType<string | undefined, string, string>;
20
21
  rules: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
21
22
  messages: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
22
23
  errorData: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
@@ -25,6 +26,7 @@ export declare const FormItemStore: import("mobx-state-tree").IModelType<{
25
26
  rule: import("mobx-state-tree").IType<string | undefined, string, string>;
26
27
  }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>, [undefined]>;
27
28
  name: import("mobx-state-tree").ISimpleType<string>;
29
+ extraName: import("mobx-state-tree").IType<string | undefined, string, string>;
28
30
  itemId: import("mobx-state-tree").IType<string | undefined, string, string>;
29
31
  unsetValueOnInvisible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
30
32
  itemsRef: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").ISimpleType<string>>, [undefined]>;
@@ -71,10 +73,12 @@ export declare const FormItemStore: import("mobx-state-tree").IModelType<{
71
73
  readonly errClassNames: string;
72
74
  readonly lastSelectValue: string;
73
75
  getSelectedOptions: (value?: any, nodeValueArray?: any[] | undefined) => any[];
76
+ splitExtraValue(value: any): any[];
74
77
  } & {
75
78
  focus: () => void;
76
79
  blur: () => void;
77
- config: ({ required, unique, value, isValueSchemaExp, rules, messages, delimiter, multiple, valueField, labelField, joinValues, extractValue, type, id, selectFirst, autoFill, clearValueOnHidden, validateApi, maxLength, minLength, validateOnChange, label, inputGroupControl }: {
80
+ config: ({ extraName, required, unique, value, isValueSchemaExp, rules, messages, delimiter, multiple, valueField, labelField, joinValues, extractValue, type, id, selectFirst, autoFill, clearValueOnHidden, validateApi, maxLength, minLength, validateOnChange, label, inputGroupControl }: {
81
+ extraName?: string | undefined;
78
82
  required?: boolean | undefined;
79
83
  unique?: boolean | undefined;
80
84
  value?: any;
@@ -131,7 +135,7 @@ export declare const FormItemStore: import("mobx-state-tree").IModelType<{
131
135
  resetValidationStatus: (tag?: string) => void;
132
136
  openDialog: (schema: any, ctx: any, callback?: ((ret?: any) => void) | undefined) => void;
133
137
  closeDialog: (result?: any) => void;
134
- changeTmpValue: (value: any) => void;
138
+ changeTmpValue: (value: any, changeReason?: 'initialValue' | 'formInited' | 'dataChanged' | 'formulaChanged' | 'controlled' | 'input' | 'defaultValue') => void;
135
139
  changeEmitedValue: (value: any) => void;
136
140
  addSubFormItem: (item: IFormItemStore) => void;
137
141
  removeSubFormItem: (item: IFormItemStore) => void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -51,10 +51,12 @@ var FormItemStore = node.StoreNode.named('FormItemStore')
51
51
  isValueSchemaExp: mobxStateTree.types.optional(mobxStateTree.types.boolean, false),
52
52
  tmpValue: mobxStateTree.types.frozen(),
53
53
  emitedValue: mobxStateTree.types.frozen(),
54
+ changeMotivation: 'input',
54
55
  rules: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {}),
55
56
  messages: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {}),
56
57
  errorData: mobxStateTree.types.optional(mobxStateTree.types.array(ErrorDetail), []),
57
58
  name: mobxStateTree.types.string,
59
+ extraName: '',
58
60
  itemId: '',
59
61
  unsetValueOnInvisible: false,
60
62
  itemsRef: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.string), []),
@@ -177,6 +179,15 @@ var FormItemStore = node.StoreNode.named('FormItemStore')
177
179
  }
178
180
  });
179
181
  return selectedOptions;
182
+ },
183
+ splitExtraValue: function (value) {
184
+ var delimiter = self.delimiter || ',';
185
+ var values = Array.isArray(value)
186
+ ? value
187
+ : typeof value === 'string'
188
+ ? value.split(delimiter || ',')
189
+ : [];
190
+ return values;
180
191
  }
181
192
  };
182
193
  })
@@ -185,10 +196,11 @@ var FormItemStore = node.StoreNode.named('FormItemStore')
185
196
  var dialogCallbacks = new SimpleMap.SimpleMap();
186
197
  var loadAutoUpdateCancel = null;
187
198
  function config(_a) {
188
- var required = _a.required, unique = _a.unique; _a.value; var isValueSchemaExp = _a.isValueSchemaExp, rules = _a.rules, messages = _a.messages, delimiter = _a.delimiter, multiple = _a.multiple, valueField = _a.valueField, labelField = _a.labelField, joinValues = _a.joinValues, extractValue = _a.extractValue, type = _a.type, id = _a.id, selectFirst = _a.selectFirst, autoFill = _a.autoFill, clearValueOnHidden = _a.clearValueOnHidden, validateApi = _a.validateApi, maxLength = _a.maxLength, minLength = _a.minLength, validateOnChange = _a.validateOnChange, label = _a.label, inputGroupControl = _a.inputGroupControl;
199
+ var extraName = _a.extraName, required = _a.required, unique = _a.unique; _a.value; var isValueSchemaExp = _a.isValueSchemaExp, rules = _a.rules, messages = _a.messages, delimiter = _a.delimiter, multiple = _a.multiple, valueField = _a.valueField, labelField = _a.labelField, joinValues = _a.joinValues, extractValue = _a.extractValue, type = _a.type, id = _a.id, selectFirst = _a.selectFirst, autoFill = _a.autoFill, clearValueOnHidden = _a.clearValueOnHidden, validateApi = _a.validateApi, maxLength = _a.maxLength, minLength = _a.minLength, validateOnChange = _a.validateOnChange, label = _a.label, inputGroupControl = _a.inputGroupControl;
189
200
  if (typeof rules === 'string') {
190
201
  rules = validations.str2rules(rules);
191
202
  }
203
+ typeof extraName !== 'undefined' && (self.extraName = extraName);
192
204
  typeof type !== 'undefined' && (self.type = type);
193
205
  typeof id !== 'undefined' && (self.itemId = id);
194
206
  typeof messages !== 'undefined' && (self.messages = messages);
@@ -850,8 +862,12 @@ var FormItemStore = node.StoreNode.named('FormItemStore')
850
862
  setTimeout(function () { return callback(result); }, 200);
851
863
  }
852
864
  }
853
- function changeTmpValue(value) {
865
+ function changeTmpValue(value, changeReason // 默认值
866
+ ) {
854
867
  self.tmpValue = value;
868
+ if (changeReason) {
869
+ self.changeMotivation = changeReason;
870
+ }
855
871
  }
856
872
  function changeEmitedValue(value) {
857
873
  self.emitedValue = value;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -20,12 +20,11 @@ var SimpleMap = require('../utils/SimpleMap.js');
20
20
  var node = require('./node.js');
21
21
  require('../utils/api.js');
22
22
  require('../utils/ColorScale.js');
23
- require('react');
24
- require('lodash/chunk');
23
+ require('../utils/columnsSplit.js');
25
24
  require('../utils/DataSchema.js');
26
25
  require('../utils/DataScope.js');
27
26
  require('../utils/debug.js');
28
- require('react-dom');
27
+ require('../utils/dom.js');
29
28
  require('../utils/errors.js');
30
29
  require('../utils/tpl.js');
31
30
  require('lodash/isPlainObject');
@@ -33,19 +32,24 @@ require('classnames');
33
32
  require('lodash/isObject');
34
33
  require('lodash/isString');
35
34
  require('lodash/isBoolean');
36
- require('lodash');
35
+ require('../utils/highlight.js');
36
+ require('../utils/icon.js');
37
37
  require('../utils/image.js');
38
+ require('lodash/isEqual');
38
39
  require('../actions/Action.js');
39
40
  require('lodash/debounce');
40
41
  require('lodash/cloneDeep');
41
42
  require('../utils/resize-sensor.js');
43
+ require('react');
42
44
  require('react-overlays/useRootClose');
45
+ require('react-dom');
43
46
  require('lodash/mapValues');
44
47
  require('lodash/camelCase');
45
48
  require('uncontrollable');
46
49
  require('hoist-non-react-statics');
47
50
  require('../utils/validations.js');
48
51
  require('../utils/resolveCondition.js');
52
+ require('mobx');
49
53
  require('../utils/Animation.js');
50
54
 
51
55
  var iRendererStore = node.StoreNode.named('iRendererStore')
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -80,6 +80,7 @@ export declare const ListStore: import("mobx-state-tree").IModelType<{
80
80
  draggable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
81
81
  dragging: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
82
82
  multiple: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
83
+ strictMode: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
83
84
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
84
85
  itemCheckableOn: import("mobx-state-tree").IType<string | undefined, string, string>;
85
86
  itemDraggableOn: import("mobx-state-tree").IType<string | undefined, string, string>;
package/lib/store/list.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -87,6 +87,7 @@ var ListStore = iRenderer.iRendererStore
87
87
  draggable: false,
88
88
  dragging: false,
89
89
  multiple: true,
90
+ strictMode: false,
90
91
  selectable: false,
91
92
  itemCheckableOn: '',
92
93
  itemDraggableOn: '',
@@ -140,6 +141,7 @@ var ListStore = iRenderer.iRendererStore
140
141
  config.selectable === void 0 || (self.selectable = config.selectable);
141
142
  config.draggable === void 0 || (self.draggable = config.draggable);
142
143
  config.multiple === void 0 || (self.multiple = config.multiple);
144
+ config.strictMode === void 0 || (self.strictMode = config.strictMode);
143
145
  config.hideCheckToggler === void 0 ||
144
146
  (self.hideCheckToggler = config.hideCheckToggler);
145
147
  if (typeof config.orderBy !== 'undefined') {
@@ -178,7 +180,11 @@ var ListStore = iRenderer.iRendererStore
178
180
  self.selectedItems.push(item);
179
181
  }
180
182
  else if (find__default["default"](selected, function (a) {
181
- return a[valueField || 'value'] == item.pristine[valueField || 'value'];
183
+ var selectValue = a[valueField || 'value'];
184
+ var itemValue = item.pristine[valueField || 'value'];
185
+ return self.strictMode
186
+ ? selectValue === itemValue
187
+ : selectValue == itemValue;
182
188
  })) {
183
189
  self.selectedItems.push(item);
184
190
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/lib/store/node.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/lib/store/root.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.1.1
2
+ * amis-core v3.3.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -13,8 +13,7 @@ var helper = require('../utils/helper.js');
13
13
  var service = require('./service.js');
14
14
  require('../utils/api.js');
15
15
  require('../utils/ColorScale.js');
16
- require('react');
17
- require('lodash/chunk');
16
+ require('../utils/columnsSplit.js');
18
17
  require('amis-formula');
19
18
  require('lodash/isPlainObject');
20
19
  var object = require('../utils/object.js');
@@ -22,7 +21,7 @@ require('../utils/DataSchema.js');
22
21
  require('../utils/DataScope.js');
23
22
  require('moment');
24
23
  require('../utils/debug.js');
25
- require('react-dom');
24
+ require('../utils/dom.js');
26
25
  require('../utils/errors.js');
27
26
  require('../utils/tpl.js');
28
27
  require('classnames');
@@ -30,13 +29,17 @@ require('../utils/filter.js');
30
29
  require('lodash/isObject');
31
30
  require('lodash/isString');
32
31
  require('lodash/isBoolean');
33
- require('lodash');
32
+ require('../utils/highlight.js');
33
+ require('../utils/icon.js');
34
34
  require('../utils/image.js');
35
+ require('lodash/isEqual');
35
36
  require('../actions/Action.js');
36
37
  require('lodash/debounce');
37
38
  require('lodash/cloneDeep');
38
39
  require('../utils/resize-sensor.js');
40
+ require('react');
39
41
  require('react-overlays/useRootClose');
42
+ require('react-dom');
40
43
  require('../utils/SimpleMap.js');
41
44
  require('lodash/mapValues');
42
45
  require('lodash/camelCase');
@@ -44,6 +47,7 @@ require('uncontrollable');
44
47
  require('hoist-non-react-statics');
45
48
  require('../utils/validations.js');
46
49
  require('../utils/resolveCondition.js');
50
+ require('mobx');
47
51
  require('../utils/Animation.js');
48
52
 
49
53
  var RootStore = service.ServiceStore.named('RootStore')